netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback
@ 2007-04-20 10:02 Kazunori MIYAZAWA
  2007-04-20 14:18 ` James Morris
  2007-05-29 20:03 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Kazunori MIYAZAWA @ 2007-04-20 10:02 UTC (permalink / raw)
  To: David Miller, Herbert Xu; +Cc: Miika Komu, Diego Beltrami, netdev, usagi-core

Hello,

I send patches to fix panic when using inter
address family IPsec on loopback device.

These patches can be applied to current linux-2.6 and
should also be net-2.6.

Best regards, 

Signed-off-by: Kazunori MIYAZAWA <kazunori@miyazawa.org>
---
 net/ipv4/xfrm4_input.c       |    6 ++----
 net/ipv4/xfrm4_mode_tunnel.c |    2 ++
 net/ipv6/xfrm6_input.c       |    6 ++----
 net/ipv6/xfrm6_mode_tunnel.c |    1 +
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 78e80de..9fcf6d8 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -138,10 +138,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb,
 	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 {
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index ceb4376..5115574 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -84,6 +84,8 @@ #endif
 	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;
 }
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 31f651f..c53c0d3 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, _
 	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 {
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 0bc866c..8741bcd 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xf
 	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;
 }
 
-- 
1.4.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback
  2007-04-20 10:02 [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback Kazunori MIYAZAWA
@ 2007-04-20 14:18 ` James Morris
  2007-05-29 20:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: James Morris @ 2007-04-20 14:18 UTC (permalink / raw)
  To: Kazunori MIYAZAWA
  Cc: David Miller, Herbert Xu, Miika Komu, Diego Beltrami, netdev,
	usagi-core

On Fri, 20 Apr 2007, Kazunori MIYAZAWA wrote:

> Hello,
> 
> I send patches to fix panic when using inter
> address family IPsec on loopback device.
> 
> These patches can be applied to current linux-2.6 and
> should also be net-2.6.

Looks good to me, although I wonder why the !IFF_LOOPBACK check was there 
in the first place.



- James
-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback
  2007-04-20 10:02 [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback Kazunori MIYAZAWA
  2007-04-20 14:18 ` James Morris
@ 2007-05-29 20:03 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2007-05-29 20:03 UTC (permalink / raw)
  To: kazunori; +Cc: herbert, miika, Diego.Beltrami, netdev, usagi-core

From: Kazunori MIYAZAWA <kazunori@miyazawa.org>
Date: Fri, 20 Apr 2007 19:02:51 +0900

> I send patches to fix panic when using inter
> address family IPsec on loopback device.
> 
> These patches can be applied to current linux-2.6 and
> should also be net-2.6.
> 
> Best regards, 
> 
> Signed-off-by: Kazunori MIYAZAWA <kazunori@miyazawa.org>

Patch applied, thank you.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-29 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-20 10:02 [PATCH][IPSEC] fix panic when using inter address familiy IPsec on loopback Kazunori MIYAZAWA
2007-04-20 14:18 ` James Morris
2007-05-29 20:03 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).