From: ebiederm@xmission•com (Eric W. Biederman)
To: Konstantin Khlebnikov <khlebnikov@yandex-team•ru>
Cc: netdev@vger•kernel.org, "David S. Miller" <davem@davemloft•net>,
containers@lists•linux-foundation.org,
Vasily Averin <vvs@virtuozzo•com>,
linux-kernel@vger•kernel.org
Subject: Re: [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
Date: Sun, 21 Feb 2016 16:06:22 -0600 [thread overview]
Message-ID: <87egc5en1d.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <20160221071102.9686.63148.stgit@buzz> (Konstantin Khlebnikov's message of "Sun, 21 Feb 2016 10:11:02 +0300")
Konstantin Khlebnikov <khlebnikov@yandex-team•ru> 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" <ebiederm@xmission•com>
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 <khlebnikov@yandex-team•ru>
> 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;
next prev parent reply other threads:[~2016-02-21 22:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-21 7:11 [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults Konstantin Khlebnikov
2016-02-21 9:25 ` Vasily Averin
[not found] ` <56C9827D.3010103-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2016-02-21 16:58 ` Konstantin Khlebnikov
2016-02-21 22:06 ` Eric W. Biederman [this message]
2016-02-23 23:21 ` David Miller
[not found] ` <20160223.182121.2101846699151527296.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2016-02-24 5:16 ` Konstantin Khlebnikov
[not found] ` <CALYGNiNfuDzPr3+qE82CLVBvSTFQvyAyhWv9kzXbBrUO2jYMTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-24 15:20 ` David Miller
2016-02-24 22:05 ` Eric W. Biederman
[not found] ` <87y4a9ix2h.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-02-25 14:20 ` Nicolas Dichtel
[not found] ` <56CF0DC0.7030003-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2016-02-25 16:43 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egc5en1d.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission$(echo .)com \
--cc=containers@lists$(echo .)linux-foundation.org \
--cc=davem@davemloft$(echo .)net \
--cc=khlebnikov@yandex-team$(echo .)ru \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=vvs@virtuozzo$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox