netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
@ 2016-02-21  7:11 Konstantin Khlebnikov
  2016-02-21  9:25 ` Vasily Averin
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Konstantin Khlebnikov @ 2016-02-21  7:11 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Vasily Averin, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Eric W. Biederman

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.

Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
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;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-25 16:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).