summaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-13 01:29:17 +0100
committerIngo Molnar <mingo@elte.hu>2009-03-13 01:29:17 +0100
commit3c1f67d60e2b4f4455563928999fd41cc653645d (patch)
tree0d58c145a05fb09167f1ab6882b474eccb1f3563 /include/net/net_namespace.h
parent03d78913f01e8f6599823f00357ed17b32747d3d (diff)
parent9ead64974b05501bbac0d63a47c99fa786d064ba (diff)
downloadkernel-crypto-3c1f67d60e2b4f4455563928999fd41cc653645d.tar.gz
kernel-crypto-3c1f67d60e2b4f4455563928999fd41cc653645d.tar.xz
kernel-crypto-3c1f67d60e2b4f4455563928999fd41cc653645d.zip
Merge branch 'linus' into core/locking
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 *);