netfilter: ipv6: add IPSKB_REROUTED exclusion to NF_HOOK/POSTROUTING invocation
authorJan Engelhardt <jengelh@medozas.de>
Tue, 13 Apr 2010 13:32:16 +0000 (15:32 +0200)
committerPatrick McHardy <kaber@trash.net>
Tue, 13 Apr 2010 13:32:16 +0000 (15:32 +0200)
Similar to how IPv4's ip_output.c works, have ip6_output also check
the IPSKB_REROUTED flag. It will be set from xt_TEE for cloned packets
since Xtables can currently only deal with a single packet in flight
at a time.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Acked-by: David S. Miller <davem@davemloft.net>
[Patrick: changed to use an IP6SKB value instead of IPSKB]
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/linux/ipv6.h
net/ipv6/ip6_output.c

index e0cc9a7db2b5fdc689bceb7d2a3fb5d00aea6ede..7bdf6ffe2b4918339a50ac836b8a7cf774ccec0d 100644 (file)
@@ -250,6 +250,7 @@ struct inet6_skb_parm {
 
 #define IP6SKB_XFRM_TRANSFORMED        1
 #define IP6SKB_FORWARDED       2
+#define IP6SKB_REROUTED                4
 };
 
 #define IP6CB(skb)     ((struct inet6_skb_parm*)((skb)->cb))
index 236ac7813744d3b0e00d705c554b1d5b4ffd69e9..c10a38a71a5e64c7a9bc5f586aa87528798f9756 100644 (file)
@@ -172,8 +172,9 @@ int ip6_output(struct sk_buff *skb)
                return 0;
        }
 
-       return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, dev,
-                      ip6_finish_output);
+       return NF_HOOK_COND(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL, dev,
+                           ip6_finish_output,
+                           !(IP6CB(skb)->flags & IP6SKB_REROUTED));
 }
 
 /*