mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
ip6_vti: not register vti_ipv6_handler twice
An xfrm6_tunnel object is linked into the list when registering,
so vti_ipv6_handler can not be registered twice, otherwise its
next pointer will be overwritten on the second time.
So this patch is to define a new xfrm6_tunnel object to register
for AF_INET.
Fixes: 2ab110cbb0
("ip6_vti: support IP6IP tunnel processing")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
55a48c7ec7
commit
a875714790
1 changed files with 10 additions and 3 deletions
|
@ -1236,6 +1236,13 @@ static struct xfrm6_tunnel vti_ipv6_handler __read_mostly = {
|
|||
.err_handler = vti6_err,
|
||||
.priority = 0,
|
||||
};
|
||||
|
||||
static struct xfrm6_tunnel vti_ip6ip_handler __read_mostly = {
|
||||
.handler = vti6_rcv_tunnel,
|
||||
.cb_handler = vti6_rcv_cb,
|
||||
.err_handler = vti6_err,
|
||||
.priority = 0,
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1268,7 +1275,7 @@ static int __init vti6_tunnel_init(void)
|
|||
err = xfrm6_tunnel_register(&vti_ipv6_handler, AF_INET6);
|
||||
if (err < 0)
|
||||
goto vti_tunnel_ipv6_failed;
|
||||
err = xfrm6_tunnel_register(&vti_ipv6_handler, AF_INET);
|
||||
err = xfrm6_tunnel_register(&vti_ip6ip_handler, AF_INET);
|
||||
if (err < 0)
|
||||
goto vti_tunnel_ip6ip_failed;
|
||||
#endif
|
||||
|
@ -1282,7 +1289,7 @@ static int __init vti6_tunnel_init(void)
|
|||
|
||||
rtnl_link_failed:
|
||||
#if IS_ENABLED(CONFIG_INET6_XFRM_TUNNEL)
|
||||
err = xfrm6_tunnel_deregister(&vti_ipv6_handler, AF_INET);
|
||||
err = xfrm6_tunnel_deregister(&vti_ip6ip_handler, AF_INET);
|
||||
vti_tunnel_ip6ip_failed:
|
||||
err = xfrm6_tunnel_deregister(&vti_ipv6_handler, AF_INET6);
|
||||
vti_tunnel_ipv6_failed:
|
||||
|
@ -1306,7 +1313,7 @@ static void __exit vti6_tunnel_cleanup(void)
|
|||
{
|
||||
rtnl_link_unregister(&vti6_link_ops);
|
||||
#if IS_ENABLED(CONFIG_INET6_XFRM_TUNNEL)
|
||||
xfrm6_tunnel_deregister(&vti_ipv6_handler, AF_INET);
|
||||
xfrm6_tunnel_deregister(&vti_ip6ip_handler, AF_INET);
|
||||
xfrm6_tunnel_deregister(&vti_ipv6_handler, AF_INET6);
|
||||
#endif
|
||||
xfrm6_protocol_deregister(&vti_ipcomp6_protocol, IPPROTO_COMP);
|
||||
|
|
Loading…
Reference in a new issue