aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 95e646641184..c5a43f56b796 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -23,6 +23,7 @@
23#endif 23#endif
24#include <net/netns/xfrm.h> 24#include <net/netns/xfrm.h>
25 25
26struct user_namespace;
26struct proc_dir_entry; 27struct proc_dir_entry;
27struct net_device; 28struct net_device;
28struct sock; 29struct sock;
@@ -53,6 +54,8 @@ struct net {
53 struct list_head cleanup_list; /* namespaces on death row */ 54 struct list_head cleanup_list; /* namespaces on death row */
54 struct list_head exit_list; /* Use only net_mutex */ 55 struct list_head exit_list; /* Use only net_mutex */
55 56
57 struct user_namespace *user_ns; /* Owning user namespace */
58
56 struct proc_dir_entry *proc_net; 59 struct proc_dir_entry *proc_net;
57 struct proc_dir_entry *proc_net_stat; 60 struct proc_dir_entry *proc_net_stat;
58 61
@@ -126,16 +129,21 @@ struct net {
126/* Init's network namespace */ 129/* Init's network namespace */
127extern struct net init_net; 130extern struct net init_net;
128 131
129#ifdef CONFIG_NET 132#ifdef CONFIG_NET_NS
130extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 133extern struct net *copy_net_ns(unsigned long flags,
131 134 struct user_namespace *user_ns, struct net *old_net);
132#else /* CONFIG_NET */ 135
133static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 136#else /* CONFIG_NET_NS */
137#include <linux/sched.h>
138#include <linux/nsproxy.h>
139static inline struct net *copy_net_ns(unsigned long flags,
140 struct user_namespace *user_ns, struct net *old_net)
134{ 141{
135 /* There is nothing to copy so this is a noop */ 142 if (flags & CLONE_NEWNET)
136 return net_ns; 143 return ERR_PTR(-EINVAL);
144 return old_net;
137} 145}
138#endif /* CONFIG_NET */ 146#endif /* CONFIG_NET_NS */
139 147
140 148
141extern struct list_head net_namespace_list; 149extern struct list_head net_namespace_list;