[NET]: Make the device list and device lookups per namespace.
[pandora-kernel.git] / net / tipc / eth_media.c
index 711ca4b..d6fc057 100644 (file)
@@ -38,6 +38,7 @@
 #include <net/tipc/tipc_bearer.h>
 #include <net/tipc/tipc_msg.h>
 #include <linux/netdevice.h>
+#include <net/net_namespace.h>
 
 #define MAX_ETH_BEARERS                2
 #define ETH_LINK_PRIORITY      TIPC_DEF_LINK_PRI
@@ -100,6 +101,11 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
        struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
        u32 size;
 
+       if (dev->nd_net != &init_net) {
+               kfree_skb(buf);
+               return 0;
+       }
+
        if (likely(eb_ptr->bearer)) {
                if (likely(buf->pkt_type <= PACKET_BROADCAST)) {
                        size = msg_size((struct tipc_msg *)buf->data);
@@ -129,7 +135,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
 
        /* Find device with specified name */
 
-       for_each_netdev(pdev){
+       for_each_netdev(&init_net, pdev){
                if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) {
                        dev = pdev;
                        break;
@@ -192,6 +198,9 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
        struct eth_bearer *eb_ptr = &eth_bearers[0];
        struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS];
 
+       if (dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        while ((eb_ptr->dev != dev)) {
                if (++eb_ptr == stop)
                        return NOTIFY_DONE;     /* couldn't find device */