]> git.baikalelectronics.ru Git - kernel.git/commit
[NETFILTER]: Fix xfrm lookup after SNAT
authorPatrick McHardy <kaber@trash.net>
Wed, 15 Feb 2006 09:34:23 +0000 (01:34 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Feb 2006 09:34:23 +0000 (01:34 -0800)
commitb06e9b31ac5f5f7b3d8ec87b899fd4bc749ca42e
treee99b13be0392532d17a133fe6b9e7edb0a7a4de9
parent248f7c82dacb724a5777750378dedf8b9b5b69ad
[NETFILTER]: Fix xfrm lookup after SNAT

To find out if a packet needs to be handled by IPsec after SNAT, packets
are currently rerouted in POST_ROUTING and a new xfrm lookup is done. This
breaks SNAT of non-unicast packets to non-local addresses because the
packet is routed as incoming packet and no neighbour entry is bound to the
dst_entry. In general, it seems to be a bad idea to replace the dst_entry
after the packet was already sent to the output routine because its state
might not match what's expected.

This patch changes the xfrm lookup in POST_ROUTING to re-use the original
dst_entry without routing the packet again. This means no policy routing
can be used for transport mode transforms (which keep the original route)
when packets are SNATed to match the policy, but it looks like the best
we can do for now.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter_ipv4.h
net/ipv4/netfilter.c
net/ipv4/netfilter/ip_nat_standalone.c