Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2576702imm; Sun, 19 Aug 2018 00:07:58 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwbhTdO+4eKxR/bYSD/O8Va6V9/YuqRoxtOn7vTuiaCxAK7V0uvMMU6F9BObM5p9gIyTI9m X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr40213500plh.135.1534662478328; Sun, 19 Aug 2018 00:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534662478; cv=none; d=google.com; s=arc-20160816; b=Mud6hCN4XdsmAmmG7AOLv/q0Hne2LYug8Hf8+0vbF35mok8cYxeq988po+zQZgX+En Yd2RxI1+ZzW1YSx2keMtwJSeaKhP0kiJkgt1sgl2zI+zApQVvhTBVzFzt9OSi4k9Nymj MHl8yz1NV7FN3YGxm4WNog6WUyalwx8QPaxyA2hBeQwntqGm0WZ7+jCZf9jRKk9yveHg PlSIH4ZVg5Y8RmXW8FULSfErlIs9Owlc+JOTu4J2qs1EFnt95529CUWshB8P9lo2Fe8M BElwYibaG80l9bcEWvoTGM8QKrM43+QDyoLWQ/bQzTizfXVWSG0sOdI8YqvxlJRIQuQz yq5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=CpXdstQt6IuSn2l9i9ZAWSNpCYzqOTlWt+QcKg8BKzc=; b=Tj4AtwZ7YhlGJAOBxooUA4y+e2FKaRyqVS94OAnSJ1BLs07mQwMa4xitrgIrZVus/w 7E/chxK4SJXv9YWk+PoleBybK6xBuRl56vA+L921Fqq9MHpdzUxGpuRYQq8pXuXgG7xq UnKw2YAP96Fq4zXDGm336RHiW46YE02aVI07RAIXH2kisEUmEDIQxadQKeBH7vn7v9m8 vJORDS++fN0zH34hKKvp32n0mbjKuT0O5OUTBul7IvnGgHZtoJie0JQ2j5NJDFsuO5nS k5qT6xvuKpYGjhFNsnKFXb/dugvA7MbQEx2LAvlTW/+cRgmSRlH6kByT6iKe/72iISVT ANeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n72-v6si6863306pfk.14.2018.08.19.00.07.43; Sun, 19 Aug 2018 00:07:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbeHSKQY (ORCPT + 99 others); Sun, 19 Aug 2018 06:16:24 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:43615 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbeHSKQX (ORCPT ); Sun, 19 Aug 2018 06:16:23 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app09-12009 (RichMail) with SMTP id 2ee95b7916c6970-54351; Sun, 19 Aug 2018 15:05:45 +0800 (CST) X-RM-TRANSID: 2ee95b7916c6970-54351 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.240]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea5b7916c88cf-d8acd; Sun, 19 Aug 2018 15:05:45 +0800 (CST) X-RM-TRANSID: 2eea5b7916c88cf-d8acd From: Haishuang Yan To: Steffen Klassert , "David S. Miller" , Alexey Kuznetsov Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Haishuang Yan Subject: [PATCH 2/2] ip6_vti: fix creating fallback tunnel device for vti6 Date: Sun, 19 Aug 2018 15:05:05 +0800 Message-Id: <1534662305-16734-2-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534662305-16734-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1534662305-16734-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 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 --- net/ipv6/ip6_vti.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index c72ae3a..3b9f39f 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -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)) + return 0; err = -ENOMEM; ip6n->fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6_vti0", NET_NAME_UNKNOWN, vti6_dev_setup); -- 1.8.3.1