aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/eql.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-17 14:56:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:10 -0400
commit881d966b48b035ab3f3aeaae0f3d3f9b584f45b2 (patch)
treec579d59a4107cbbe9e2b85939bc0d496b815c887 /drivers/net/eql.c
parentb4b510290b056b86611757ce1175a230f1080f53 (diff)
[NET]: Make the device list and device lookups per namespace.
This patch makes most of the generic device layer network namespace safe. This patch makes dev_base_head a network namespace variable, and then it picks up a few associated variables. The functions: dev_getbyhwaddr dev_getfirsthwbytype dev_get_by_flags dev_get_by_name __dev_get_by_name dev_get_by_index __dev_get_by_index dev_ioctl dev_ethtool dev_load wireless_process_ioctl were modified to take a network namespace argument, and deal with it. vlan_ioctl_set and brioctl_set were modified so their hooks will receive a network namespace argument. So basically anthing in the core of the network stack that was affected to by the change of dev_base was modified to handle multiple network namespaces. The rest of the network stack was simply modified to explicitly use &init_net the initial network namespace. This can be fixed when those components of the network stack are modified to handle multiple network namespaces. For now the ifindex generator is left global. Fundametally ifindex numbers are per namespace, or else we will have corner case problems with migration when we get that far. At the same time there are assumptions in the network stack that the ifindex of a network device won't change. Making the ifindex number global seems a good compromise until the network stack can cope with ifindex changes when you change namespaces, and the like. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/eql.c')
-rw-r--r--drivers/net/eql.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index 102218c4a907..f1cc66dcbdfd 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -116,6 +116,7 @@
116#include <linux/init.h> 116#include <linux/init.h>
117#include <linux/timer.h> 117#include <linux/timer.h>
118#include <linux/netdevice.h> 118#include <linux/netdevice.h>
119#include <net/net_namespace.h>
119 120
120#include <linux/if.h> 121#include <linux/if.h>
121#include <linux/if_arp.h> 122#include <linux/if_arp.h>
@@ -412,7 +413,7 @@ static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *
412 if (copy_from_user(&srq, srqp, sizeof (slaving_request_t))) 413 if (copy_from_user(&srq, srqp, sizeof (slaving_request_t)))
413 return -EFAULT; 414 return -EFAULT;
414 415
415 slave_dev = dev_get_by_name(srq.slave_name); 416 slave_dev = dev_get_by_name(&init_net, srq.slave_name);
416 if (slave_dev) { 417 if (slave_dev) {
417 if ((master_dev->flags & IFF_UP) == IFF_UP) { 418 if ((master_dev->flags & IFF_UP) == IFF_UP) {
418 /* slave is not a master & not already a slave: */ 419 /* slave is not a master & not already a slave: */
@@ -460,7 +461,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use
460 if (copy_from_user(&srq, srqp, sizeof (slaving_request_t))) 461 if (copy_from_user(&srq, srqp, sizeof (slaving_request_t)))
461 return -EFAULT; 462 return -EFAULT;
462 463
463 slave_dev = dev_get_by_name(srq.slave_name); 464 slave_dev = dev_get_by_name(&init_net, srq.slave_name);
464 ret = -EINVAL; 465 ret = -EINVAL;
465 if (slave_dev) { 466 if (slave_dev) {
466 spin_lock_bh(&eql->queue.lock); 467 spin_lock_bh(&eql->queue.lock);
@@ -493,7 +494,7 @@ static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
493 if (copy_from_user(&sc, scp, sizeof (slave_config_t))) 494 if (copy_from_user(&sc, scp, sizeof (slave_config_t)))
494 return -EFAULT; 495 return -EFAULT;
495 496
496 slave_dev = dev_get_by_name(sc.slave_name); 497 slave_dev = dev_get_by_name(&init_net, sc.slave_name);
497 if (!slave_dev) 498 if (!slave_dev)
498 return -ENODEV; 499 return -ENODEV;
499 500
@@ -528,7 +529,7 @@ static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
528 if (copy_from_user(&sc, scp, sizeof (slave_config_t))) 529 if (copy_from_user(&sc, scp, sizeof (slave_config_t)))
529 return -EFAULT; 530 return -EFAULT;
530 531
531 slave_dev = dev_get_by_name(sc.slave_name); 532 slave_dev = dev_get_by_name(&init_net, sc.slave_name);
532 if (!slave_dev) 533 if (!slave_dev)
533 return -ENODEV; 534 return -ENODEV;
534 535