Commit 0a82f3f0 authored by Steffen Klassert's avatar Steffen Klassert
Browse files

Merge remote-tracking branch 'origin/testing'



Xin Long says:

====================
xfrm: not register one xfrm(6)_tunnel object twice

Now in ip(6)_vti and xfrm interface tunnel support, it uses the
same xfrm(6)_tunnel object to handle for AF_NET and AF_INET6 by
registering it twice.

However the xfrm(6)_tunnel object is linked into a list with its
'next' pointer. The second registering will cause its 'next'
pointer to be overwritten, and break the list.

So this patchset is to add a new xfrm(6)_tunnel object for each
of them and register it, although its members are the same with
the old one.
====================

Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parents 910a71ed 8b404f46
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -484,6 +484,13 @@ static struct xfrm_tunnel vti_ipip_handler __read_mostly = {
	.err_handler	=	vti4_err,
	.priority	=	0,
};

static struct xfrm_tunnel vti_ipip6_handler __read_mostly = {
	.handler	=	vti_rcv_tunnel,
	.cb_handler	=	vti_rcv_cb,
	.err_handler	=	vti4_err,
	.priority	=	0,
};
#endif

static int __net_init vti_init_net(struct net *net)
@@ -660,7 +667,7 @@ static int __init vti_init(void)
	if (err < 0)
		goto xfrm_tunnel_ipip_failed;
#if IS_ENABLED(CONFIG_IPV6)
	err = xfrm4_tunnel_register(&vti_ipip_handler, AF_INET6);
	err = xfrm4_tunnel_register(&vti_ipip6_handler, AF_INET6);
	if (err < 0)
		goto xfrm_tunnel_ipip6_failed;
#endif
@@ -676,7 +683,7 @@ 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);
	xfrm4_tunnel_deregister(&vti_ipip6_handler, AF_INET6);
xfrm_tunnel_ipip6_failed:
#endif
	xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET);
@@ -699,7 +706,7 @@ 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);
	xfrm4_tunnel_deregister(&vti_ipip6_handler, AF_INET6);
#endif
	xfrm4_tunnel_deregister(&vti_ipip_handler, AF_INET);
#endif
+10 −3
Original line number Diff line number Diff line
@@ -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);
+18 −4
Original line number Diff line number Diff line
@@ -830,6 +830,13 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = {
	.err_handler	=	xfrmi6_err,
	.priority	=	-1,
};

static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
	.handler	=	xfrmi6_rcv_tunnel,
	.cb_handler	=	xfrmi_rcv_cb,
	.err_handler	=	xfrmi6_err,
	.priority	=	-1,
};
#endif

static struct xfrm4_protocol xfrmi_esp4_protocol __read_mostly = {
@@ -868,6 +875,13 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = {
	.err_handler	=	xfrmi4_err,
	.priority	=	-1,
};

static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
	.handler	=	xfrmi4_rcv_tunnel,
	.cb_handler	=	xfrmi_rcv_cb,
	.err_handler	=	xfrmi4_err,
	.priority	=	-1,
};
#endif

static int __init xfrmi4_init(void)
@@ -887,7 +901,7 @@ static int __init xfrmi4_init(void)
	err = xfrm4_tunnel_register(&xfrmi_ipip_handler, AF_INET);
	if (err < 0)
		goto xfrm_tunnel_ipip_failed;
	err = xfrm4_tunnel_register(&xfrmi_ipip_handler, AF_INET6);
	err = xfrm4_tunnel_register(&xfrmi_ipip6_handler, AF_INET6);
	if (err < 0)
		goto xfrm_tunnel_ipip6_failed;
#endif
@@ -911,7 +925,7 @@ xfrm_proto_esp_failed:
static void xfrmi4_fini(void)
{
#if IS_ENABLED(CONFIG_INET_XFRM_TUNNEL)
	xfrm4_tunnel_deregister(&xfrmi_ipip_handler, AF_INET6);
	xfrm4_tunnel_deregister(&xfrmi_ipip6_handler, AF_INET6);
	xfrm4_tunnel_deregister(&xfrmi_ipip_handler, AF_INET);
#endif
	xfrm4_protocol_deregister(&xfrmi_ipcomp4_protocol, IPPROTO_COMP);
@@ -936,7 +950,7 @@ static int __init xfrmi6_init(void)
	err = xfrm6_tunnel_register(&xfrmi_ipv6_handler, AF_INET6);
	if (err < 0)
		goto xfrm_tunnel_ipv6_failed;
	err = xfrm6_tunnel_register(&xfrmi_ipv6_handler, AF_INET);
	err = xfrm6_tunnel_register(&xfrmi_ip6ip_handler, AF_INET);
	if (err < 0)
		goto xfrm_tunnel_ip6ip_failed;
#endif
@@ -960,7 +974,7 @@ xfrm_proto_esp_failed:
static void xfrmi6_fini(void)
{
#if IS_ENABLED(CONFIG_INET6_XFRM_TUNNEL)
	xfrm6_tunnel_deregister(&xfrmi_ipv6_handler, AF_INET);
	xfrm6_tunnel_deregister(&xfrmi_ip6ip_handler, AF_INET);
	xfrm6_tunnel_deregister(&xfrmi_ipv6_handler, AF_INET6);
#endif
	xfrm6_protocol_deregister(&xfrmi_ipcomp6_protocol, IPPROTO_COMP);