Merge branch 'tj-percpu' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc...
[safe/jmp/linux-2.6] / net / ipv4 / xfrm4_input.c
index 662d1e8..4ec2162 100644 (file)
@@ -39,6 +39,7 @@ drop:
 int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
                    int encap_type)
 {
+       XFRM_SPI_SKB_CB(skb)->family = AF_INET;
        XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
        return xfrm_input(skb, nexthdr, spi, encap_type);
 }
@@ -50,17 +51,18 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)
 
        iph->protocol = XFRM_MODE_SKB_CB(skb)->protocol;
 
-#ifdef CONFIG_NETFILTER
+#ifndef CONFIG_NETFILTER
+       if (!async)
+               return -iph->protocol;
+#endif
+
        __skb_push(skb, skb->data - skb_network_header(skb));
        iph->tot_len = htons(skb->len);
        ip_send_check(iph);
 
-       NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL,
+       NF_HOOK(PF_INET, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
                xfrm4_rcv_encap_finish);
        return 0;
-#else
-       return -iph->protocol;
-#endif
 }
 
 /* If it's a keepalive packet, then just eat it.
@@ -76,7 +78,6 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
        struct udphdr *uh;
        struct iphdr *iph;
        int iphlen, len;
-       int ret;
 
        __u8 *udpdata;
        __be32 *udpdata32;
@@ -150,8 +151,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
        skb_reset_transport_header(skb);
 
        /* process ESP */
-       ret = xfrm4_rcv_encap(skb, IPPROTO_ESP, 0, encap_type);
-       return ret;
+       return xfrm4_rcv_encap(skb, IPPROTO_ESP, 0, encap_type);
 
 drop:
        kfree_skb(skb);