@@ -438,7 +438,8 @@ static int __net_init vti_init_net(struct net *net)if(err)returnerr;itn=net_generic(net,vti_net_id);-vti_fb_tunnel_init(itn->fb_tunnel_dev);+if(itn->fb_tunnel_dev)+vti_fb_tunnel_init(itn->fb_tunnel_dev);return0;}
From: Haishuang Yan <hidden> Date: 2018-08-19 07:05:56
When set fb_tunnels_only_for_init_net to 1, don't create fallback tunnel
device for vti6 when a new namespace is created.
Tested:
[root@builder2 ~]# modprobe ip6_tunnel
[root@builder2 ~]# modprobe ip6_vti
[root@builder2 ~]# echo 1 > /proc/sys/net/core/fb_tunnels_only_for_init_net
[root@builder2 ~]# unshare -n
[root@builder2 ~]# ip link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group
default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Signed-off-by: Haishuang Yan <redacted>
---
net/ipv6/ip6_vti.c | 2 ++
1 file changed, 2 insertions(+)
@@ -1114,6 +1114,8 @@ static int __net_init vti6_init_net(struct net *net)ip6n->tnls[0]=ip6n->tnls_wc;ip6n->tnls[1]=ip6n->tnls_r_l;+if(!net_has_fallback_tunnels(net))+return0;err=-ENOMEM;ip6n->fb_tnl_dev=alloc_netdev(sizeof(structip6_tnl),"ip6_vti0",NET_NAME_UNKNOWN,vti6_dev_setup);
From: David Miller <davem@davemloft.net> Date: 2018-08-19 18:28:02
From: Haishuang Yan <redacted>
Date: Sun, 19 Aug 2018 15:05:04 +0800
After set fb_tunnels_only_for_init_net to 1, the itn->fb_tunnel_dev will
be NULL and will cause following crash:
...
Reproduce:
echo 1 > /proc/sys/net/core/fb_tunnels_only_for_init_net
modprobe ip_vti
unshare -n
Fixes: 79134e6ce2c9 (net: do not create fallback tunnels for non-default
namespaces)
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Haishuang Yan <redacted>
Applied, but please format your Fixes: tag properly next time.
Do not split up a Fixes tag into multiple lines, no matter how long it
is. And enclose the commit header text in both parenthesis and double
quotes, not just parenthesis. Like ("blah blah blah"), thank you.
From: David Miller <davem@davemloft.net> Date: 2018-08-19 18:28:02
From: Haishuang Yan <redacted>
Date: Sun, 19 Aug 2018 15:05:05 +0800
When set fb_tunnels_only_for_init_net to 1, don't create fallback tunnel
device for vti6 when a new namespace is created.
Tested:
[root@builder2 ~]# modprobe ip6_tunnel
[root@builder2 ~]# modprobe ip6_vti
[root@builder2 ~]# echo 1 > /proc/sys/net/core/fb_tunnels_only_for_init_net
[root@builder2 ~]# unshare -n
[root@builder2 ~]# ip link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group
default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
Signed-off-by: Haishuang Yan <redacted>
From: Haishuang Yan <hidden> Date: 2018-08-20 01:58:37
On 2018年8月20日, at 上午2:27, David Miller [off-list ref] wrote:
From: Haishuang Yan <redacted>
Date: Sun, 19 Aug 2018 15:05:04 +0800
quoted
After set fb_tunnels_only_for_init_net to 1, the itn->fb_tunnel_dev will
be NULL and will cause following crash:
...
quoted
Reproduce:
echo 1 > /proc/sys/net/core/fb_tunnels_only_for_init_net
modprobe ip_vti
unshare -n
Fixes: 79134e6ce2c9 (net: do not create fallback tunnels for non-default
namespaces)
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Haishuang Yan <redacted>
Applied, but please format your Fixes: tag properly next time.
Do not split up a Fixes tag into multiple lines, no matter how long it
is. And enclose the commit header text in both parenthesis and double
quotes, not just parenthesis. Like ("blah blah blah"), thank you.