Skip to content

Commit e2948e5

Browse files
Haishuang Yandavem330
authored andcommitted
ip6_vti: fix creating fallback tunnel device for vti6
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 <yanhaishuang@cmss.chinamobile.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cd1aa9c commit e2948e5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/ip6_vti.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,8 @@ static int __net_init vti6_init_net(struct net *net)
11061106
ip6n->tnls[0] = ip6n->tnls_wc;
11071107
ip6n->tnls[1] = ip6n->tnls_r_l;
11081108

1109+
if (!net_has_fallback_tunnels(net))
1110+
return 0;
11091111
err = -ENOMEM;
11101112
ip6n->fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6_vti0",
11111113
NET_NAME_UNKNOWN, vti6_dev_setup);

0 commit comments

Comments
 (0)