diff options
author | Patrick McHardy <kaber@trash.net> | 2005-07-19 17:03:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-07-19 17:03:34 -0400 |
commit | 0303770deb834c15ca664a9d741d40f893c92f4e (patch) | |
tree | d48e2df54d3545052aaffeeeec1c34c214055056 /net/ipv6 | |
parent | c877efb207bf4629cfa97ac13412f7392a873485 (diff) |
[NET]: Make ipip/ip6_tunnel independant of XFRM
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/Kconfig | 1 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 38 |
2 files changed, 33 insertions, 6 deletions
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 95163cd52ae0..ab7a9124f985 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -91,7 +91,6 @@ config INET6_TUNNEL | |||
91 | config IPV6_TUNNEL | 91 | config IPV6_TUNNEL |
92 | tristate "IPv6: IPv6-in-IPv6 tunnel" | 92 | tristate "IPv6: IPv6-in-IPv6 tunnel" |
93 | depends on IPV6 | 93 | depends on IPV6 |
94 | select INET6_TUNNEL | ||
95 | ---help--- | 94 | ---help--- |
96 | Support for IPv6-in-IPv6 tunnels described in RFC 2473. | 95 | Support for IPv6-in-IPv6 tunnels described in RFC 2473. |
97 | 96 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index ba3b0c267f75..f39ddeae1eef 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1110,11 +1110,39 @@ ip6ip6_fb_tnl_dev_init(struct net_device *dev) | |||
1110 | return 0; | 1110 | return 0; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | #ifdef CONFIG_INET6_TUNNEL | ||
1113 | static struct xfrm6_tunnel ip6ip6_handler = { | 1114 | static struct xfrm6_tunnel ip6ip6_handler = { |
1114 | .handler = ip6ip6_rcv, | 1115 | .handler = ip6ip6_rcv, |
1115 | .err_handler = ip6ip6_err, | 1116 | .err_handler = ip6ip6_err, |
1116 | }; | 1117 | }; |
1117 | 1118 | ||
1119 | static inline int ip6ip6_register(void) | ||
1120 | { | ||
1121 | return xfrm6_tunnel_register(&ip6ip6_handler); | ||
1122 | } | ||
1123 | |||
1124 | static inline int ip6ip6_unregister(void) | ||
1125 | { | ||
1126 | return xfrm6_tunnel_unregister(&ip6ip6_handler); | ||
1127 | } | ||
1128 | #else | ||
1129 | static struct inet6_protocol xfrm6_tunnel_protocol = { | ||
1130 | .handler = ip6ip6_rcv, | ||
1131 | .err_handler = ip6ip6_err, | ||
1132 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | ||
1133 | }; | ||
1134 | |||
1135 | static inline int ip6ip6_register(void) | ||
1136 | { | ||
1137 | return inet6_add_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6); | ||
1138 | } | ||
1139 | |||
1140 | static inline int ip6ip6_unregister(void) | ||
1141 | { | ||
1142 | return inet6_del_protocol(&xfrm6_tunnel_protocol, IPPROTO_IPV6); | ||
1143 | } | ||
1144 | #endif | ||
1145 | |||
1118 | /** | 1146 | /** |
1119 | * ip6_tunnel_init - register protocol and reserve needed resources | 1147 | * ip6_tunnel_init - register protocol and reserve needed resources |
1120 | * | 1148 | * |
@@ -1125,7 +1153,7 @@ static int __init ip6_tunnel_init(void) | |||
1125 | { | 1153 | { |
1126 | int err; | 1154 | int err; |
1127 | 1155 | ||
1128 | if (xfrm6_tunnel_register(&ip6ip6_handler) < 0) { | 1156 | if (ip6ip6_register() < 0) { |
1129 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); | 1157 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); |
1130 | return -EAGAIN; | 1158 | return -EAGAIN; |
1131 | } | 1159 | } |
@@ -1144,7 +1172,7 @@ static int __init ip6_tunnel_init(void) | |||
1144 | } | 1172 | } |
1145 | return 0; | 1173 | return 0; |
1146 | fail: | 1174 | fail: |
1147 | xfrm6_tunnel_deregister(&ip6ip6_handler); | 1175 | ip6ip6_unregister(); |
1148 | return err; | 1176 | return err; |
1149 | } | 1177 | } |
1150 | 1178 | ||
@@ -1154,7 +1182,7 @@ fail: | |||
1154 | 1182 | ||
1155 | static void __exit ip6_tunnel_cleanup(void) | 1183 | static void __exit ip6_tunnel_cleanup(void) |
1156 | { | 1184 | { |
1157 | if (xfrm6_tunnel_deregister(&ip6ip6_handler) < 0) | 1185 | if (ip6ip6_unregister() < 0) |
1158 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); | 1186 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); |
1159 | 1187 | ||
1160 | unregister_netdev(ip6ip6_fb_tnl_dev); | 1188 | unregister_netdev(ip6ip6_fb_tnl_dev); |