]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - net/core/net_namespace.c
netlink: allow to listen "all" netns
[mirror_ubuntu-artful-kernel.git] / net / core / net_namespace.c
index ae5008b097de2cf777269a60c47a7b12e4ed883d..a665bf490c8808c43184effa2dba18112155295a 100644 (file)
@@ -229,7 +229,7 @@ int peernet2id_alloc(struct net *net, struct net *peer)
 EXPORT_SYMBOL(peernet2id_alloc);
 
 /* This function returns, if assigned, the id of a peer netns. */
-static int peernet2id(struct net *net, struct net *peer)
+int peernet2id(struct net *net, struct net *peer)
 {
        unsigned long flags;
        int id;
@@ -240,6 +240,14 @@ static int peernet2id(struct net *net, struct net *peer)
        return id;
 }
 
+/* This function returns true is the peer netns has an id assigned into the
+ * current netns.
+ */
+bool peernet_has_id(struct net *net, struct net *peer)
+{
+       return peernet2id(net, peer) >= 0;
+}
+
 struct net *get_net_ns_by_id(struct net *net, int id)
 {
        unsigned long flags;