summaryrefslogtreecommitdiff
path: root/net/ipv4/ip_vti.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2020-07-06 15:01:33 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2020-07-09 13:53:58 +0300
commite6ce64570f2451684b4f9bcbaee6c40c4a7dff82 (patch)
tree58edc0a9751b1cb5be7b0ac01654cae7d979a785 /net/ipv4/ip_vti.c
parent87e66b9682d7067eb7db08040dae36b608a4d971 (diff)
downloadlinux-e6ce64570f2451684b4f9bcbaee6c40c4a7dff82.tar.xz
ip_vti: support IPIP6 tunnel processing
For IPIP6 tunnel processing, the functions called will be the same as that for IPIP tunnel's. So reuse it and register it with family == AF_INET6. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv4/ip_vti.c')
-rw-r--r--net/ipv4/ip_vti.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index 68177f065117..c0b97b8f6fbd 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -658,7 +658,12 @@ static int __init vti_init(void)
msg = "ipip tunnel";
err = xfrm4_tunnel_register(&vti_ipip_handler, AF_INET);
if (err < 0)
- goto xfrm_tunnel_failed;
+ goto xfrm_tunnel_ipip_failed;
+#if IS_ENABLED(CONFIG_IPV6)
+ err = xfrm4_tunnel_register(&vti_ipip_handler, AF_INET6);
+ if (err < 0)
+ goto xfrm_tunnel_ipip6_failed;
+#endif
#endif
msg = "netlink interface";
@@ -670,8 +675,12 @@ static int __init vti_init(void)
rtnl_link_failed:
#if IS_ENABLED(CONFIG_INET_XFRM_TUNNEL)
+#if IS_ENABLED(CONFIG_IPV6)
+ xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET6);
+xfrm_tunnel_ipip6_failed:
+#endif
xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET);
-xfrm_tunnel_failed:
+xfrm_tunnel_ipip_failed:
#endif
xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
xfrm_proto_comp_failed:
@@ -689,6 +698,9 @@ static void __exit vti_fini(void)
{
rtnl_link_unregister(&vti_link_ops);
#if IS_ENABLED(CONFIG_INET_XFRM_TUNNEL)
+#if IS_ENABLED(CONFIG_IPV6)
+ xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET6);
+#endif
xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET);
#endif
xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);