All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "Damien Thébault" <damien.thebault@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Wrong ethernet headers after double postrouting fix
Date: Thu, 13 Dec 2007 09:41:04 +0100	[thread overview]
Message-ID: <4760F020.5070405@trash.net> (raw)
In-Reply-To: <9a4a382a0712130005l49a72164r26e5818060534285@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1817 bytes --]

Damien Thébault wrote:
> Hello,
> 
> I'm using a nat-over-bridges setup with two bridges and I'm using
> iptables to MASQUERADE over it.
> I'm trying to use rtsp so I applied the rtsp conntrack/nat patch (to
> the 2.6.23 kernel I'm using actually) [1]. But it doesn't work because
> the nat seems to be done twice.
> After some search, I found a patch [2] which should solve this problem
> (bridge-to-bridge routing). So I applied it, but then I get wrong
> packets on the output (see below).
> I tried with 2.6.24-rc5 and the result is similar (the output below is
> with 2.6.24-rc5).
> 
> [1] http://mike.it-loops.com/rtsp/rtsp-2.6.23.patch
> [2] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=81d9ddae856678c45297550e9353c8a5a7fd6438
> 
> (The captures were taken with tcpdump and displayed with wireshark,
> tell me if it's not the right way to post it)
> 
> LAN-side bridge setup : IP 192.168.1.1    MAC 00:03:47:df:32:a8
> WAN-side bridge setup : IP 172.20.211.144 MAC 10:d0:cf:03:fc:52
> LAN client            : IP 192.168.1.206  MAC 00:19:4b:27:ca:86
> WAN server gateway    : IP 172.20.211.190 MAC 00:03:fa:00:05:00
> 
> [...]
> We can see that the outputted packets have a wrong ethernet header :
> ac 14 df 8c 00 00 00 00  00 00 00 00 00 00
> Without the patch, the same header is good :
> 00 03 fa 00 05 00 10 d0  cf 03 fc 52 08 00
> 
> The ethertype is set to 00 00 instead of 08 00 (IPv4), the destination
> mac address is set to the destination ip address instead, and there is
> no source mac address.
> 
> I think that the ethernet-building stage is not run anymore in my
> case, but I don't know really why.
> Any help would be appreciated.


Thanks for debugging this so far. The bridge-netfilter code is really
horribly fragile.

Could you try this patch please?


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 529 bytes --]

diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 533ee35..499aa93 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -50,7 +50,8 @@ enum nf_br_hook_priorities {
 extern int nf_bridge_copy_header(struct sk_buff *skb);
 static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
 {
-	if (skb->nf_bridge)
+	if (skb->nf_bridge &&
+	    skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
 		return nf_bridge_copy_header(skb);
   	return 0;
 }

  reply	other threads:[~2007-12-13  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13  8:05 Wrong ethernet headers after double postrouting fix Damien Thébault
2007-12-13  8:41 ` Patrick McHardy [this message]
2007-12-13 15:33   ` Damien Thébault
2007-12-13 16:55     ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4760F020.5070405@trash.net \
    --to=kaber@trash.net \
    --cc=damien.thebault@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.