]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/xfrm6_input.c
[IPV6]: Fix modular build with netfilter enabled.
[linux-2.6-omap-h63xx.git] / net / ipv6 / xfrm6_input.c
index 28c29d78338e3a84c259264182b6f5d322f71ac9..1ca2da68ef69c35e420c1badf3c84e079bb88aec 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/netfilter.h>
+#include <linux/netfilter_ipv6.h>
 #include <net/dsfield.h>
 #include <net/inet_ecn.h>
 #include <net/ip.h>
@@ -26,7 +28,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
                IP6_ECN_set_ce(inner_iph);
 }
 
-int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi)
+int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi)
 {
        struct sk_buff *skb = *pskb;
        int err;
@@ -38,7 +40,7 @@ int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi)
        int nexthdr;
        unsigned int nhoff;
 
-       nhoff = *nhoffp;
+       nhoff = IP6CB(skb)->nhoff;
        nexthdr = skb->nh.raw[nhoff];
 
        seq = 0;
@@ -121,6 +123,8 @@ int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi)
        skb->sp->len += xfrm_nr;
        skb->ip_summed = CHECKSUM_NONE;
 
+       nf_reset(skb);
+
        if (decaps) {
                if (!(skb->dev->flags&IFF_LOOPBACK)) {
                        dst_release(skb->dst);
@@ -129,7 +133,16 @@ int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi)
                netif_rx(skb);
                return -1;
        } else {
+#ifdef CONFIG_NETFILTER
+               skb->nh.ipv6h->payload_len = htons(skb->len);
+               __skb_push(skb, skb->data - skb->nh.raw);
+
+               NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
+                       ip6_rcv_finish);
+               return -1;
+#else
                return 1;
+#endif
        }
 
 drop_unlock:
@@ -144,7 +157,7 @@ drop:
 
 EXPORT_SYMBOL(xfrm6_rcv_spi);
 
-int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
+int xfrm6_rcv(struct sk_buff **pskb)
 {
-       return xfrm6_rcv_spi(pskb, nhoffp, 0);
+       return xfrm6_rcv_spi(pskb, 0);
 }