@@ -134,11 +134,19 @@ struct net {
atomic_t fnhe_genid;
};
+struct net_ctx {
+#ifdef CONFIG_NET_NS
+ struct net *net;
+#endif
+};
+
#include <linux/seq_file_net.h>
/* Init's network namespace */
extern struct net init_net;
+#define INIT_NET_CTX { .net = &init_net }
+
#ifdef CONFIG_NET_NS
struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
struct net *old_net);
@@ -202,6 +210,13 @@ int net_eq(const struct net *net1, const struct net *net2)
return net1 == net2;
}
+static inline
+int net_ctx_eq(struct net_ctx *ctx1, struct net_ctx *ctx2)
+{
+ return net_eq(ctx1->net, ctx2->net);
+}
+
+
void net_drop_ns(void *);
#else
@@ -226,6 +241,12 @@ int net_eq(const struct net *net1, const struct net *net2)
return 1;
}
+static inline
+int net_ctx_eq(struct net_ctx *ctx1, struct net_ctx *ctx2)
+{
+ return 1;
+}
+
#define net_drop_ns NULL
#endif
For now the network context is just the namespace. A later patch adds a vrf context. Signed-off-by: David Ahern <dsahern@gmail.com> --- include/net/net_namespace.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)