netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][IPSEC][4/6] changing "ipip tunnel" and xfrm4_tunnel to the API change
@ 2007-02-08  8:04 Kazunori MIYAZAWA
  2007-02-08 13:10 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Kazunori MIYAZAWA @ 2007-02-08  8:04 UTC (permalink / raw)
  To: Herbert Xu, David Miller; +Cc: Miika Komu, Diego Beltrami, netdev, usagi-core

Changing ipip tunnel and xfrm4_tunnel to the API

xfrm4_tunnel should regitser against both addresses so that
it should handle a tunnel packet whose internal address is
either IPv4 or IPv6.

signed-off-by Kazunori MIYAZAWA <miyazawa@linux-ipv6.org>

---
 net/ipv4/ipip.c         |    6 +++---
 net/ipv4/xfrm4_tunnel.c |   14 +++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 9d719d6..775e950 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -870,7 +870,7 @@ static int __init ipip_init(void)
 
 	printk(banner);
 
-	if (xfrm4_tunnel_register(&ipip_handler)) {
+	if (xfrm4_tunnel_register(&ipip_handler, AF_INET)) {
 		printk(KERN_INFO "ipip init: can't register tunnel\n");
 		return -EAGAIN;
 	}
@@ -892,7 +892,7 @@ static int __init ipip_init(void)
  err2:
 	free_netdev(ipip_fb_tunnel_dev);
  err1:
-	xfrm4_tunnel_deregister(&ipip_handler);
+	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
 	goto out;
 }
 
@@ -912,7 +912,7 @@ static void __exit ipip_destroy_tunnels(
 
 static void __exit ipip_fini(void)
 {
-	if (xfrm4_tunnel_deregister(&ipip_handler))
+	if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
 		printk(KERN_INFO "ipip close: can't deregister tunnel\n");
 
 	rtnl_lock();
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index f110af5..00fc09f 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -66,12 +66,15 @@ static struct xfrm_tunnel xfrm_tunnel_ha
 
 static int __init ipip_init(void)
 {
-	if (xfrm_register_type(&ipip_type, AF_INET) < 0) {
-		printk(KERN_INFO "ipip init: can't add xfrm type\n");
+	if (xfrm_register_type(&ipip_type, AF_INET) < 0)
+		return -EAGAIN;
+
+	if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) {
+		printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET\n");
 		return -EAGAIN;
 	}
-	if (xfrm4_tunnel_register(&xfrm_tunnel_handler)) {
-		printk(KERN_INFO "ipip init: can't add xfrm handler\n");
+	if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET6)) {
+		printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n");
 		xfrm_unregister_type(&ipip_type, AF_INET);
 		return -EAGAIN;
 	}
@@ -80,7 +83,8 @@ static int __init ipip_init(void)
 
 static void __exit ipip_fini(void)
 {
-	if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler))
+	if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET) ||
+	    xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET6))
 		printk(KERN_INFO "ipip close: can't remove xfrm handler\n");
 	if (xfrm_unregister_type(&ipip_type, AF_INET) < 0)
 		printk(KERN_INFO "ipip close: can't remove xfrm type\n");
-- 
1.4.1


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

end of thread, other threads:[~2007-02-09  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-08  8:04 [PATCH][IPSEC][4/6] changing "ipip tunnel" and xfrm4_tunnel to the API change Kazunori MIYAZAWA
2007-02-08 13:10 ` Patrick McHardy
2007-02-09  0:37   ` Kazunori MIYAZAWA
2007-02-09  8:36     ` Patrick McHardy

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).