[NET]: Make the device list and device lookups per namespace.
[pandora-kernel.git] / net / ipv4 / ipconfig.c
index 342ca8d..4303851 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/root_dev.h>
 #include <linux/delay.h>
 #include <linux/nfs_fs.h>
+#include <net/net_namespace.h>
 #include <net/arp.h>
 #include <net/ip.h>
 #include <net/ipconfig.h>
@@ -192,7 +193,7 @@ static int __init ic_open_devs(void)
        if (dev_change_flags(&loopback_dev, loopback_dev.flags | IFF_UP) < 0)
                printk(KERN_ERR "IP-Config: Failed to open %s\n", loopback_dev.name);
 
-       for_each_netdev(dev) {
+       for_each_netdev(&init_net, dev) {
                if (dev == &loopback_dev)
                        continue;
                if (user_dev_name[0] ? !strcmp(dev->name, user_dev_name) :
@@ -425,6 +426,9 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        unsigned char *sha, *tha;               /* s for "source", t for "target" */
        struct ic_device *d;
 
+       if (dev->nd_net != &init_net)
+               goto drop;
+
        if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
                return NET_RX_DROP;
 
@@ -834,6 +838,9 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
        struct ic_device *d;
        int len, ext_len;
 
+       if (dev->nd_net != &init_net)
+               goto drop;
+
        /* Perform verifications before taking the lock.  */
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop;
@@ -1253,7 +1260,7 @@ static int __init ip_auto_config(void)
        __be32 addr;
 
 #ifdef CONFIG_PROC_FS
-       proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops);
+       proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
 #endif /* CONFIG_PROC_FS */
 
        if (!ic_enable)
@@ -1281,9 +1288,9 @@ static int __init ip_auto_config(void)
         */
        if (ic_myaddr == NONE ||
 #ifdef CONFIG_ROOT_NFS
-           (MAJOR(ROOT_DEV) == UNNAMED_MAJOR
-            && root_server_addr == NONE
-            && ic_servaddr == NONE) ||
+           (root_server_addr == NONE
+            && ic_servaddr == NONE
+            && ROOT_DEV == Root_NFS) ||
 #endif
            ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC