Skip to contentSkip to conversation

Bug in bridge or netfilter code (REJECT + incorrect MAC)?

DISCUSSION Casper Gripenberg 3 participants 7 messages Apr 1, 2008 – Apr 24, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I sent this to the netfilter list, but nobody replied there.

I've found something strange with REJECT and DNAT rules where the MAC address for packets coming back through the bridge get rewritten incorrectly.

The setup to test this is fairly simple, and I can reproduce it consistently on my stock Ubuntu 7.10 installation (kernel 2.6.22-14).

Is it something I'm doing wrong, or any idea what is going on? I filed a bug report here:

https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=531

Thanks.

Casper

#1 lore raw
Quoted 9 lines · Casper Gripenberg

Hi,

I sent this to the netfilter list, but nobody replied there.

I've found something strange with REJECT and DNAT rules where the MAC address for packets coming back through the bridge get rewritten incorrectly.

Quoted 8 lines

The setup to test this is fairly simple, and I can reproduce it consistently on my stock Ubuntu 7.10 installation (kernel 2.6.22-14).

Is it something I'm doing wrong, or any idea what is going on? I filed a bug report here:

https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=531

I'm wondering, why does your client care about the source MAC address of the REJECT packet? Or is there another switch in between that does MAC filtering?

#2 lore raw
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Casper Gripenberg

[...]
https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=531

I'm wondering, why does your client care about the source MAC address of the REJECT packet? Or is there another switch in between that does MAC filtering?

Yes..there is a switch or router between the Linux bridge and the computer that is supposed to receive the REJECT packet.

The packet stops at this router, because presumably it's doing some sort of MAC spoof filtering, or it just doesn't understand what is happening when the MAC of the source IP suddenly changes.

The router is my ISP's internet router, which I do not control. But I doubt the router is doing anything wrong though. The weirdness is more on the Linux side..

Casper

#3 lore raw
Quoted 13 lines · Casper Gripenberg
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Casper Gripenberg

[...]
https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=531

I'm wondering, why does your client care about the source MAC address of the REJECT packet? Or is there another switch in between that does MAC filtering?

Yes..there is a switch or router between the Linux bridge and the computer that is supposed to receive the REJECT packet.

Quoted 8 lines

The packet stops at this router, because presumably it's doing some sort of MAC spoof filtering, or it just doesn't understand what is happening when the MAC of the source IP suddenly changes.

The router is my ISP's internet router, which I do not control. But I doubt the router is doing anything wrong though. The weirdness is more on the Linux side..

Sure, for full transparency the packets should ideally use the original source MAC address. I'll see if I can come up with a patch for this.

#4 lore raw
Quoted 8 lines · Patrick McHardy
Quoted 4 lines

The router is my ISP's internet router, which I do not control. But I doubt the router is doing anything wrong though. The weirdness is more on the Linux side..

Sure, for full transparency the packets should ideally use the original source MAC address. I'll see if I can come up with a patch for this.

The problem is an interesting one. REJECT itself does not fill in the MAC address, and probably should not try (there is more than just Ethernet). Yet the routing code is so deeply buried that drawing a seam through the entire call chain seems intrusive. </random thoughts>

Signature · 1 line
make boldconfig -- to boldly select what no one has selected before
#5 lore raw
Quoted 11 lines · Jan Engelhardt
Quoted 8 lines · Patrick McHardy
Quoted 4 lines

The router is my ISP's internet router, which I do not control. But I doubt the router is doing anything wrong though. The weirdness is more on the Linux side..

Sure, for full transparency the packets should ideally use the original source MAC address. I'll see if I can come up with a patch for this.

Quoted 5 lines

The problem is an interesting one. REJECT itself does not fill in the MAC address, and probably should not try (there is more than just Ethernet). Yet the routing code is so deeply buried that drawing a seam through the entire call chain seems intrusive. </random thoughts>

One way is to have REJECT specifically handle the bridging case by setting up an appropriate skb->nf_bridge struct, which will make the bridging code fill in the correct MAC address. For REJECT this would be borderline OK, but icmp_send really shouldn't care about this, so a generic method would be preferrable.

#6 lore raw
In reply to Jan Engelhardt
Quoted 11 lines · Jan Engelhardt
Quoted 8 lines · Patrick McHardy
Quoted 4 lines

The router is my ISP's internet router, which I do not control. But I doubt the router is doing anything wrong though. The weirdness is more on the Linux side..

Sure, for full transparency the packets should ideally use the original source MAC address. I'll see if I can come up with a patch for this.

Quoted 5 lines

The problem is an interesting one. REJECT itself does not fill in the MAC address, and probably should not try (there is more than just Ethernet). Yet the routing code is so deeply buried that drawing a seam through the entire call chain seems intrusive. </random thoughts>

Well, I didn't find a good way to fix this. Casper, please open a bug report at bugzilla.netfilter.org so this doesn't get lost. Thanks.