]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Netfilter: bridge: fix double POST_ROUTING invocation
authorPatrick McHardy <kaber@trash.net>
Tue, 29 Jan 2008 18:08:25 +0000 (19:08 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:48 +0000 (12:01 -0800)
commit418b48ea165b0b03652c85436807ac6760838c21
tree747b0f7205b54e3f06d430e2d07d35c2903bcde7
parent0bf056904b95fa555c36eb0cfbcee9c015747f59
Netfilter: bridge: fix double POST_ROUTING invocation

[NETFILTER]: bridge: fix double POST_ROUTING invocation

Upstream commit 2948d2ebbb98747b912ac6d0c864b4d02be8a6f5

The bridge code incorrectly causes two POST_ROUTING hook invocations
for DNATed packets that end up on the same bridge device. This
happens because packets with a changed destination address are passed
to dst_output() to make them go through the neighbour output function
again to build a new destination MAC address, before they will continue
through the IP hooks simulated by bridge netfilter.

The resulting hook order is:
 PREROUTING (bridge netfilter)
 POSTROUTING        (dst_output -> ip_output)
 FORWARD    (bridge netfilter)
 POSTROUTING        (bridge netfilter)

The deferred hooks used to abort the first POST_ROUTING invocation,
but since the only thing bridge netfilter actually really wants is
a new MAC address, we can avoid going through the IP stack completely
by simply calling the neighbour output function directly.

Tested, reported and lots of data provided by: Damien Thebault <damien.thebault@gmail.com>

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/bridge/br_netfilter.c