aboutsummaryrefslogtreecommitdiff
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-11 17:10:07 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-03-11 17:10:07 +1100
commite14eee56c2280953c6e3d24d5dce42bd90836b81 (patch)
tree21ab792d9ad6fbbab460058f352a0158f995644e /include/net/net_namespace.h
parentd6ee6f7e4c74d9a0fed7544f4d389bde004651d3 (diff)
parent99adcd9d67aaf04e28f5ae96df280f236bde4b66 (diff)
Merge commit 'origin/master' into next
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 6fc13d905c5..ded434b032a 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
#ifdef CONFIG_NET_NS
extern void __put_net(struct net *net);
-static inline int net_alive(struct net *net)
-{
- return net && atomic_read(&net->count);
-}
-
static inline struct net *get_net(struct net *net)
{
atomic_inc(&net->count);
@@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
}
#else
-static inline int net_alive(struct net *net)
-{
- return 1;
-}
-
static inline struct net *get_net(struct net *net)
{
return net;
@@ -234,6 +224,23 @@ struct pernet_operations {
void (*exit)(struct net *net);
};
+/*
+ * Use these carefully. If you implement a network device and it
+ * needs per network namespace operations use device pernet operations,
+ * otherwise use pernet subsys operations.
+ *
+ * This is critically important. Most of the network code cleanup
+ * runs with the assumption that dev_remove_pack has been called so no
+ * new packets will arrive during and after the cleanup functions have
+ * been called. dev_remove_pack is not per namespace so instead the
+ * guarantee of no more packets arriving in a network namespace is
+ * provided by ensuring that all network devices and all sockets have
+ * left the network namespace before the cleanup methods are called.
+ *
+ * For the longest time the ipv4 icmp code was registered as a pernet
+ * device which caused kernel oops, and panics during network
+ * namespace cleanup. So please don't get this wrong.
+ */
extern int register_pernet_subsys(struct pernet_operations *);
extern void unregister_pernet_subsys(struct pernet_operations *);
extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);