OpenVZ Forum


Home » Mailing lists » Devel » [NETNS][patch 1/1] fix allnoconfig compilation error
[NETNS][patch 1/1] fix allnoconfig compilation error [message #20171] Wed, 12 September 2007 20:48 Go to next message
Daniel Lezcano is currently offline  Daniel Lezcano
Messages: 417
Registered: June 2006
Senior Member
From: Daniel Lezcano <dlezcano@fr.ibm.com>

When CONFIG_NET=no, init_net is unresolved because net_namespace.c
is not compiled and the include pull init_net definition.

This problem was very similar with the ipc namespace where the kernel
can be compiled with SYSV ipc out.

This patch fix that defining a macro which simply remove init_net
initialization from nsproxy namespace aggregator.

Compiled and booted on qemu-i386 with CONFIG_NET=no and CONFIG_NET=yes.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
 include/linux/init_task.h   |    2 +-
 include/net/net_namespace.h |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Index: net-2.6.24/include/linux/init_task.h
===================================================================
--- net-2.6.24.orig/include/linux/init_task.h
+++ net-2.6.24/include/linux/init_task.h
@@ -79,7 +79,7 @@ extern struct nsproxy init_nsproxy;
 	.nslock		= __SPIN_LOCK_UNLOCKED(nsproxy.nslock),		\
 	.uts_ns		= &init_uts_ns,					\
 	.mnt_ns		= NULL,						\
-	.net_ns		= &init_net,					\
+	INIT_NET_NS(net_ns)                                             \
 	INIT_IPC_NS(ipc_ns)						\
 	.user_ns	= &init_user_ns,				\
 }
Index: net-2.6.24/include/net/net_namespace.h
===================================================================
--- net-2.6.24.orig/include/net/net_namespace.h
+++ net-2.6.24/include/net/net_namespace.h
@@ -28,7 +28,14 @@ struct net {
 	struct hlist_head	*dev_index_head;
 };
 
+#ifdef CONFIG_NET
+/* Init's network namespace */
 extern struct net init_net;
+#define INIT_NET_NS(net_ns) .net_ns = &init_net,
+#else
+#define INIT_NET_NS(net_ns)
+#endif
+
 extern struct list_head net_namespace_list;
 
 extern void __put_net(struct net *net);

-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [NETNS][patch 1/1] fix allnoconfig compilation error [message #20177 is a reply to message #20171] Wed, 12 September 2007 21:27 Go to previous message
ebiederm is currently offline  ebiederm
Messages: 1354
Registered: February 2006
Senior Member
dlezcano@fr.ibm.com writes:

> From: Daniel Lezcano <dlezcano@fr.ibm.com>
>
> When CONFIG_NET=no, init_net is unresolved because net_namespace.c
> is not compiled and the include pull init_net definition.
>
> This problem was very similar with the ipc namespace where the kernel
> can be compiled with SYSV ipc out.
>
> This patch fix that defining a macro which simply remove init_net
> initialization from nsproxy namespace aggregator.
>
> Compiled and booted on qemu-i386 with CONFIG_NET=no and CONFIG_NET=yes.
>
> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

This looks good and is quite simple.

My apologies for over looking the case where the networking stack is not
compiled in. 

Eric
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [NETNS][patch 0/1] fix allnoconfig compilation error
Next Topic: [net-2.6.24][NETNS][patch 0/1] fix allnoconfig compilation erro
Goto Forum:
  


Current Time: Sun Aug 17 10:05:08 GMT 2025

Total time taken to generate the page: 0.29839 seconds