From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbcBUWQm (ORCPT ); Sun, 21 Feb 2016 17:16:42 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:38142 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbcBUWQk (ORCPT ); Sun, 21 Feb 2016 17:16:40 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Konstantin Khlebnikov Cc: netdev@vger.kernel.org, "David S. Miller" , containers@lists.linux-foundation.org, Vasily Averin , linux-kernel@vger.kernel.org References: <20160221071102.9686.63148.stgit@buzz> Date: Sun, 21 Feb 2016 16:06:22 -0600 In-Reply-To: <20160221071102.9686.63148.stgit@buzz> (Konstantin Khlebnikov's message of "Sun, 21 Feb 2016 10:11:02 +0300") Message-ID: <87egc5en1d.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1+ee/PVOZyZiipaQrhHL9G7mr/WRXDV9Gg= X-SA-Exim-Connect-IP: 67.3.245.179 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4996] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Konstantin Khlebnikov X-Spam-Relay-Country: X-Spam-Timing: total 611 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.9 (0.6%), b_tie_ro: 2.7 (0.4%), parse: 1.12 (0.2%), extract_message_metadata: 30 (4.9%), get_uri_detail_list: 2.6 (0.4%), tests_pri_-1000: 12 (1.9%), tests_pri_-950: 1.90 (0.3%), tests_pri_-900: 1.64 (0.3%), tests_pri_-400: 30 (4.9%), check_bayes: 28 (4.6%), b_tokenize: 11 (1.7%), b_tok_get_all: 7 (1.2%), b_comp_prob: 3.6 (0.6%), b_tok_touch_all: 3.2 (0.5%), b_finish: 0.89 (0.1%), tests_pri_0: 519 (85.0%), check_dkim_signature: 0.79 (0.1%), check_dkim_adsp: 4.0 (0.7%), tests_pri_500: 7 (1.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Konstantin Khlebnikov writes: > Currently initial net.ipv4.conf.all.* and net.ipv4.conf.default.* are > copied from init network namespace because static structures are used > for init_net. This makes no sense because new netns might be created > from any netns. This patch makes private copy also for init netns if > network namespaces are enabled. Other sysctls in net.ipv4 and net.ipv6 > already initialized with default values at namespace creation. Acked-by: "Eric W. Biederman" Assuming that this does not cause a regression I am all for this, as it makes the kernels behavior predictable. When creating a network namespace we have two predictable choices. Copy from the current network namespace, or initialize all sysctl values with the kernel's defaults. Copying values looks like a way to introduce subtle hard to debug breakage into existing setups. So all else being equal my preference is that we initialize values in new nework namespaces to their initial defaults. > Signed-off-by: Konstantin Khlebnikov > Fixes: 752d14dc6aa9 ("[IPV4]: Move the devinet pointers on the struct net") > --- > net/ipv4/devinet.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c > index cebd9d31e65a..9d73d4bbdba3 100644 > --- a/net/ipv4/devinet.c > +++ b/net/ipv4/devinet.c > @@ -2290,7 +2290,7 @@ static __net_init int devinet_init_net(struct net *net) > all = &ipv4_devconf; > dflt = &ipv4_devconf_dflt; > > - if (!net_eq(net, &init_net)) { > + if (IS_ENABLED(CONFIG_NET_NS)) { > all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); > if (!all) > goto err_alloc_all;