[NET]: Make the device list and device lookups per namespace.
[deliverable/linux.git] / drivers / net / bonding / bond_main.c
index 1afda3230defc01c1d38db13f9e17cf8b80397cd..559fe9437e0b6ed2937d0056853d8255cfcc570f 100644 (file)
@@ -75,6 +75,7 @@
 #include <linux/if_vlan.h>
 #include <linux/if_bonding.h>
 #include <net/route.h>
+#include <net/net_namespace.h>
 #include "bonding.h"
 #include "bond_3ad.h"
 #include "bond_alb.h"
@@ -2457,6 +2458,9 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
        unsigned char *arp_ptr;
        u32 sip, tip;
 
+       if (dev->nd_net != &init_net)
+               goto out;
+
        if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
                goto out;
 
@@ -3144,7 +3148,7 @@ static void bond_create_proc_dir(void)
 {
        int len = strlen(DRV_NAME);
 
-       for (bond_proc_dir = proc_net->subdir; bond_proc_dir;
+       for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir;
             bond_proc_dir = bond_proc_dir->next) {
                if ((bond_proc_dir->namelen == len) &&
                    !memcmp(bond_proc_dir->name, DRV_NAME, len)) {
@@ -3153,7 +3157,7 @@ static void bond_create_proc_dir(void)
        }
 
        if (!bond_proc_dir) {
-               bond_proc_dir = proc_mkdir(DRV_NAME, proc_net);
+               bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
                if (bond_proc_dir) {
                        bond_proc_dir->owner = THIS_MODULE;
                } else {
@@ -3188,7 +3192,7 @@ static void bond_destroy_proc_dir(void)
                        bond_proc_dir->owner = NULL;
                }
        } else {
-               remove_proc_entry(DRV_NAME, proc_net);
+               remove_proc_entry(DRV_NAME, init_net.proc_net);
                bond_proc_dir = NULL;
        }
 }
@@ -3295,6 +3299,9 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
 {
        struct net_device *event_dev = (struct net_device *)ptr;
 
+       if (event_dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        dprintk("event_dev: %s, event: %lx\n",
                (event_dev ? event_dev->name : "None"),
                event);
@@ -3712,7 +3719,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
        }
 
        down_write(&(bonding_rwsem));
-       slave_dev = dev_get_by_name(ifr->ifr_slave);
+       slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
 
        dprintk("slave_dev=%p: \n", slave_dev);
 
This page took 0.025962 seconds and 5 git commands to generate.