]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
[PATCH] IPSEC: Fix panic when using inter address familiy IPsec on loopback.
authorKazunori MIYAZAWA <kazunori@miyazawa.org>
Thu, 7 Jun 2007 05:41:52 +0000 (22:41 -0700)
committerChris Wright <chrisw@sous-sol.org>
Mon, 11 Jun 2007 18:36:51 +0000 (11:36 -0700)
Signed-off-by: Kazunori MIYAZAWA <kazunori@miyazawa.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/xfrm4_input.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/xfrm6_input.c
net/ipv6/xfrm6_mode_tunnel.c

index 78e80deb7e89a25780d74a7e1691b73bb7e06b53..9fcf6d892c8ee2ed9482351990afe002b4563538 100644 (file)
@@ -138,10 +138,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
        nf_reset(skb);
 
        if (decaps) {
-               if (!(skb->dev->flags&IFF_LOOPBACK)) {
-                       dst_release(skb->dst);
-                       skb->dst = NULL;
-               }
+               dst_release(skb->dst);
+               skb->dst = NULL;
                netif_rx(skb);
                return 0;
        } else {
index ceb4376f572ae8cd6c7b95845efc38d9820d84bc..5115574776a90518388f7733a75cc07541604db1 100644 (file)
@@ -84,6 +84,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
        top_iph->saddr = x->props.saddr.a4;
        top_iph->daddr = x->id.daddr.a4;
 
+       skb->protocol = htons(ETH_P_IP);
+
        memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
        return 0;
 }
index 31f651f950967018be3c43d0b173dd80dc0449c0..c53c0d3a50066bfb4cc0347e3d196a3ae7589c57 100644 (file)
@@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
        nf_reset(skb);
 
        if (decaps) {
-               if (!(skb->dev->flags&IFF_LOOPBACK)) {
-                       dst_release(skb->dst);
-                       skb->dst = NULL;
-               }
+               dst_release(skb->dst);
+               skb->dst = NULL;
                netif_rx(skb);
                return -1;
        } else {
index 0bc866c0d83c4d4e352fa484ede378ca2134ed29..8741bcd4ba76ac3cff3ac2e6b810c6024830498b 100644 (file)
@@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
        top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
        ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
        ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
+       skb->protocol = htons(ETH_P_IPV6);
        return 0;
 }