lkml.org 
[lkml]   [2016]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] ipv4: in new netns initialize sysctls in net.ipv4.conf.* with defaults
From
Date
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@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;
\
 
 \ /
  Last update: 2016-02-21 19:01    [W:0.079 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site