netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
@ 2015-06-26  9:37 Zhu Yanjun
  2015-06-26  9:50 ` yzhu1
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Zhu Yanjun @ 2015-06-26  9:37 UTC (permalink / raw)
  To: netdev, davem

The new net namespace can inherit from the original net config, or
the current net config. As such, a config is needed to decide where
the new namespace inherit from.

Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
---
 init/Kconfig       |  9 +++++++++
 net/ipv4/devinet.c | 13 +++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/init/Kconfig b/init/Kconfig
index dc24dec..fab8c41 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1212,6 +1212,15 @@ config NET_NS
 	  Allow user space to create what appear to be multiple instances
 	  of the network stack.
 
+config NET_NS_INHERIT_ORIGINAL
+	bool "New network namespace inherits from original net config"
+	depends on NET_NS
+	default n
+	help
+	  Allow new network namespace inherit from original net config.
+	  If no, the new network namespace inherits from the current net
+	  config including the modified net config.
+
 endif # NAMESPACES
 
 config SCHED_AUTOGROUP
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 419d23c..cf635e4 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net *net)
 #endif
 
 	err = -ENOMEM;
+#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
 	all = &ipv4_devconf;
 	dflt = &ipv4_devconf_dflt;
 
@@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net *net)
 		dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
 		if (!dflt)
 			goto err_alloc_dflt;
+#else
+	all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
+	if (!all)
+		goto err_alloc_all;
+
+	dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
+	if (!dflt)
+		goto err_alloc_dflt;
+#endif
 
 #ifdef CONFIG_SYSCTL
 		tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
@@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net *net)
 		tbl[0].extra1 = all;
 		tbl[0].extra2 = net;
 #endif
+
+#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
 	}
+#endif
 
 #ifdef CONFIG_SYSCTL
 	err = __devinet_sysctl_register(net, "all", all);
-- 
1.9.1

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

* Re: [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
  2015-06-26  9:37 [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config Zhu Yanjun
@ 2015-06-26  9:50 ` yzhu1
  2015-06-26 14:34 ` Paul Gortmaker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: yzhu1 @ 2015-06-26  9:50 UTC (permalink / raw)
  To: netdev, davem

Hi, all

Some expect the new net namespace inherits from the original net config. 
Some expect the new net namespace
inherits from the current net config, including the modified net 
configurations.

To meet the different reqirements, this patch is made.

I think maybe mainline should need this patch.

Please comment on this patch.

Any reply is appreciated.

Thanks a lot.
Zhu Yanjun
On 06/26/2015 05:37 PM, Zhu Yanjun wrote:
> The new net namespace can inherit from the original net config, or
> the current net config. As such, a config is needed to decide where
> the new namespace inherit from.
>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
> ---
>   init/Kconfig       |  9 +++++++++
>   net/ipv4/devinet.c | 13 +++++++++++++
>   2 files changed, 22 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index dc24dec..fab8c41 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1212,6 +1212,15 @@ config NET_NS
>   	  Allow user space to create what appear to be multiple instances
>   	  of the network stack.
>   
> +config NET_NS_INHERIT_ORIGINAL
> +	bool "New network namespace inherits from original net config"
> +	depends on NET_NS
> +	default n
> +	help
> +	  Allow new network namespace inherit from original net config.
> +	  If no, the new network namespace inherits from the current net
> +	  config including the modified net config.
> +
>   endif # NAMESPACES
>   
>   config SCHED_AUTOGROUP
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 419d23c..cf635e4 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net *net)
>   #endif
>   
>   	err = -ENOMEM;
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	all = &ipv4_devconf;
>   	dflt = &ipv4_devconf_dflt;
>   
> @@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net *net)
>   		dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
>   		if (!dflt)
>   			goto err_alloc_dflt;
> +#else
> +	all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
> +	if (!all)
> +		goto err_alloc_all;
> +
> +	dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
> +	if (!dflt)
> +		goto err_alloc_dflt;
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   		tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
> @@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net *net)
>   		tbl[0].extra1 = all;
>   		tbl[0].extra2 = net;
>   #endif
> +
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	}
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   	err = __devinet_sysctl_register(net, "all", all);

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

* Re: [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
  2015-06-26  9:37 [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config Zhu Yanjun
  2015-06-26  9:50 ` yzhu1
@ 2015-06-26 14:34 ` Paul Gortmaker
  2015-07-02  2:04 ` yzhu1
  2015-10-08  6:44 ` yzhu1
  3 siblings, 0 replies; 6+ messages in thread
From: Paul Gortmaker @ 2015-06-26 14:34 UTC (permalink / raw)
  To: Zhu Yanjun; +Cc: netdev, David Miller

On Fri, Jun 26, 2015 at 5:37 AM, Zhu Yanjun <Yanjun.Zhu@windriver.com> wrote:
> The new net namespace can inherit from the original net config, or
> the current net config. As such, a config is needed to decide where
> the new namespace inherit from.

As per the netdev mailing list FAQ, and Dave's post from a day
or two ago, netdev is closed for patches during the merge
window.

And on top of that your commit doesn't tell us who needs this
and why, plus a compile time switch is a klunky and user
unfriendly way of configuring something that smells like it
might be needed to be changed regularly (if it needs to exist
even at all).  Finally, putting ifdefs around a curly brace like
you've done here is really bad form.

Paul.
--

>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
> ---
>  init/Kconfig       |  9 +++++++++
>  net/ipv4/devinet.c | 13 +++++++++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index dc24dec..fab8c41 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1212,6 +1212,15 @@ config NET_NS
>           Allow user space to create what appear to be multiple instances
>           of the network stack.
>
> +config NET_NS_INHERIT_ORIGINAL
> +       bool "New network namespace inherits from original net config"
> +       depends on NET_NS
> +       default n
> +       help
> +         Allow new network namespace inherit from original net config.
> +         If no, the new network namespace inherits from the current net
> +         config including the modified net config.
> +
>  endif # NAMESPACES
>
>  config SCHED_AUTOGROUP
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 419d23c..cf635e4 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net *net)
>  #endif
>
>         err = -ENOMEM;
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>         all = &ipv4_devconf;
>         dflt = &ipv4_devconf_dflt;
>
> @@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net *net)
>                 dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
>                 if (!dflt)
>                         goto err_alloc_dflt;
> +#else
> +       all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
> +       if (!all)
> +               goto err_alloc_all;
> +
> +       dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
> +       if (!dflt)
> +               goto err_alloc_dflt;
> +#endif
>
>  #ifdef CONFIG_SYSCTL
>                 tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
> @@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net *net)
>                 tbl[0].extra1 = all;
>                 tbl[0].extra2 = net;
>  #endif
> +
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>         }
> +#endif
>
>  #ifdef CONFIG_SYSCTL
>         err = __devinet_sysctl_register(net, "all", all);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
  2015-06-26  9:37 [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config Zhu Yanjun
  2015-06-26  9:50 ` yzhu1
  2015-06-26 14:34 ` Paul Gortmaker
@ 2015-07-02  2:04 ` yzhu1
  2015-10-08  6:44 ` yzhu1
  3 siblings, 0 replies; 6+ messages in thread
From: yzhu1 @ 2015-07-02  2:04 UTC (permalink / raw)
  To: netdev, davem

Hi, David

This patch is applied in our linux for a long time. It should work well.

Would you like to let me know your advice about this patch?

Thanks a lot.
Zhu Yanjun

On 06/26/2015 05:37 PM, Zhu Yanjun wrote:
> The new net namespace can inherit from the original net config, or
> the current net config. As such, a config is needed to decide where
> the new namespace inherit from.
>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
> ---
>   init/Kconfig       |  9 +++++++++
>   net/ipv4/devinet.c | 13 +++++++++++++
>   2 files changed, 22 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index dc24dec..fab8c41 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1212,6 +1212,15 @@ config NET_NS
>   	  Allow user space to create what appear to be multiple instances
>   	  of the network stack.
>   
> +config NET_NS_INHERIT_ORIGINAL
> +	bool "New network namespace inherits from original net config"
> +	depends on NET_NS
> +	default n
> +	help
> +	  Allow new network namespace inherit from original net config.
> +	  If no, the new network namespace inherits from the current net
> +	  config including the modified net config.
> +
>   endif # NAMESPACES
>   
>   config SCHED_AUTOGROUP
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 419d23c..cf635e4 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net *net)
>   #endif
>   
>   	err = -ENOMEM;
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	all = &ipv4_devconf;
>   	dflt = &ipv4_devconf_dflt;
>   
> @@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net *net)
>   		dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
>   		if (!dflt)
>   			goto err_alloc_dflt;
> +#else
> +	all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
> +	if (!all)
> +		goto err_alloc_all;
> +
> +	dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
> +	if (!dflt)
> +		goto err_alloc_dflt;
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   		tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
> @@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net *net)
>   		tbl[0].extra1 = all;
>   		tbl[0].extra2 = net;
>   #endif
> +
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	}
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   	err = __devinet_sysctl_register(net, "all", all);

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

* Re: [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
  2015-06-26  9:37 [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config Zhu Yanjun
                   ` (2 preceding siblings ...)
  2015-07-02  2:04 ` yzhu1
@ 2015-10-08  6:44 ` yzhu1
  2015-10-09  3:13   ` Paul Gortmaker
  3 siblings, 1 reply; 6+ messages in thread
From: yzhu1 @ 2015-10-08  6:44 UTC (permalink / raw)
  To: netdev, davem

Hi, Miller

Would you like to check this patch?

Thanks a lot.
Zhu Yanjun

On 06/26/2015 05:37 PM, Zhu Yanjun wrote:
> The new net namespace can inherit from the original net config, or
> the current net config. As such, a config is needed to decide where
> the new namespace inherit from.
>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
> ---
>   init/Kconfig       |  9 +++++++++
>   net/ipv4/devinet.c | 13 +++++++++++++
>   2 files changed, 22 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index dc24dec..fab8c41 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1212,6 +1212,15 @@ config NET_NS
>   	  Allow user space to create what appear to be multiple instances
>   	  of the network stack.
>   
> +config NET_NS_INHERIT_ORIGINAL
> +	bool "New network namespace inherits from original net config"
> +	depends on NET_NS
> +	default n
> +	help
> +	  Allow new network namespace inherit from original net config.
> +	  If no, the new network namespace inherits from the current net
> +	  config including the modified net config.
> +
>   endif # NAMESPACES
>   
>   config SCHED_AUTOGROUP
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 419d23c..cf635e4 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net *net)
>   #endif
>   
>   	err = -ENOMEM;
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	all = &ipv4_devconf;
>   	dflt = &ipv4_devconf_dflt;
>   
> @@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net *net)
>   		dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
>   		if (!dflt)
>   			goto err_alloc_dflt;
> +#else
> +	all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
> +	if (!all)
> +		goto err_alloc_all;
> +
> +	dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt), GFP_KERNEL);
> +	if (!dflt)
> +		goto err_alloc_dflt;
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   		tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
> @@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net *net)
>   		tbl[0].extra1 = all;
>   		tbl[0].extra2 = net;
>   #endif
> +
> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>   	}
> +#endif
>   
>   #ifdef CONFIG_SYSCTL
>   	err = __devinet_sysctl_register(net, "all", all);

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

* Re: [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config
  2015-10-08  6:44 ` yzhu1
@ 2015-10-09  3:13   ` Paul Gortmaker
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Gortmaker @ 2015-10-09  3:13 UTC (permalink / raw)
  To: yzhu1; +Cc: netdev, David Miller

On Thu, Oct 8, 2015 at 2:44 AM, yzhu1 <Yanjun.Zhu@windriver.com> wrote:
> Hi, Miller
>
> Would you like to check this patch?

I explained to you way back in June what some of the biggest oversights
were, here with your work.  And you have changed nothing but yet expect
a reply from maintainers who are extremely busy, simply by resending
the same old patch over and over.  Do you not see why this approach will
not work?

Paul.
--

>
> Thanks a lot.
> Zhu Yanjun
>
> On 06/26/2015 05:37 PM, Zhu Yanjun wrote:
>>
>> The new net namespace can inherit from the original net config, or
>> the current net config. As such, a config is needed to decide where
>> the new namespace inherit from.
>>
>> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
>> ---
>>   init/Kconfig       |  9 +++++++++
>>   net/ipv4/devinet.c | 13 +++++++++++++
>>   2 files changed, 22 insertions(+)
>>
>> diff --git a/init/Kconfig b/init/Kconfig
>> index dc24dec..fab8c41 100644
>> --- a/init/Kconfig
>> +++ b/init/Kconfig
>> @@ -1212,6 +1212,15 @@ config NET_NS
>>           Allow user space to create what appear to be multiple instances
>>           of the network stack.
>>   +config NET_NS_INHERIT_ORIGINAL
>> +       bool "New network namespace inherits from original net config"
>> +       depends on NET_NS
>> +       default n
>> +       help
>> +         Allow new network namespace inherit from original net config.
>> +         If no, the new network namespace inherits from the current net
>> +         config including the modified net config.
>> +
>>   endif # NAMESPACES
>>     config SCHED_AUTOGROUP
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index 419d23c..cf635e4 100644
>> --- a/net/ipv4/devinet.c
>> +++ b/net/ipv4/devinet.c
>> @@ -2271,6 +2271,7 @@ static __net_init int devinet_init_net(struct net
>> *net)
>>   #endif
>>         err = -ENOMEM;
>> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>>         all = &ipv4_devconf;
>>         dflt = &ipv4_devconf_dflt;
>>   @@ -2282,6 +2283,15 @@ static __net_init int devinet_init_net(struct net
>> *net)
>>                 dflt = kmemdup(dflt, sizeof(ipv4_devconf_dflt),
>> GFP_KERNEL);
>>                 if (!dflt)
>>                         goto err_alloc_dflt;
>> +#else
>> +       all = kmemdup(&ipv4_devconf, sizeof(ipv4_devconf), GFP_KERNEL);
>> +       if (!all)
>> +               goto err_alloc_all;
>> +
>> +       dflt = kmemdup(&ipv4_devconf_dflt, sizeof(ipv4_devconf_dflt),
>> GFP_KERNEL);
>> +       if (!dflt)
>> +               goto err_alloc_dflt;
>> +#endif
>>     #ifdef CONFIG_SYSCTL
>>                 tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
>> @@ -2292,7 +2302,10 @@ static __net_init int devinet_init_net(struct net
>> *net)
>>                 tbl[0].extra1 = all;
>>                 tbl[0].extra2 = net;
>>   #endif
>> +
>> +#ifndef CONFIG_NET_NS_INHERIT_ORIGINAL
>>         }
>> +#endif
>>     #ifdef CONFIG_SYSCTL
>>         err = __devinet_sysctl_register(net, "all", all);
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-10-09  3:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-26  9:37 [PATCH 1/1] net namespace: dynamically configure new net namespace inherit net config Zhu Yanjun
2015-06-26  9:50 ` yzhu1
2015-06-26 14:34 ` Paul Gortmaker
2015-07-02  2:04 ` yzhu1
2015-10-08  6:44 ` yzhu1
2015-10-09  3:13   ` Paul Gortmaker

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).