Home » Mailing lists » Devel » [PATCH 00/16] core network namespace support
[PATCH 13/16] net: Make the device list and device lookups per namespace. [message #19979 is a reply to message #19978] |
Sat, 08 September 2007 21:35   |
ebiederm
Messages: 1354 Registered: February 2006
|
Senior Member |
|
|
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>
---
arch/s390/appldata/appldata_net_sum.c | 3 +-
arch/sparc64/solaris/ioctl.c | 3 +-
drivers/atm/idt77252.c | 2 +-
drivers/block/aoe/aoecmd.c | 3 +-
drivers/infiniband/hw/cxgb3/cxio_hal.c | 3 +-
drivers/net/bonding/bond_main.c | 2 +-
drivers/net/bonding/bond_sysfs.c | 3 +-
drivers/net/eql.c | 9 +-
drivers/net/ifb.c | 3 +-
drivers/net/macvlan.c | 2 +-
drivers/net/pppoe.c | 4 +-
drivers/net/shaper.c | 3 +-
drivers/net/tun.c | 3 +-
drivers/net/veth.c | 2 +-
drivers/net/wan/dlci.c | 4 +-
drivers/net/wan/sbni.c | 3 +-
drivers/net/wireless/strip.c | 2 +-
drivers/parisc/led.c | 2 +-
fs/afs/netdevices.c | 5 +-
include/linux/if_bridge.h | 2 +-
include/linux/if_vlan.h | 2 +-
include/linux/netdevice.h | 66 ++++----
include/net/net_namespace.h | 4 +
include/net/pkt_cls.h | 3 +-
include/net/rtnetlink.h | 2 +-
include/net/wext.h | 15 ++-
net/802/tr.c | 2 +-
net/8021q/vlan.c | 6 +-
net/8021q/vlan_netlink.c | 3 +-
net/8021q/vlanproc.c | 6 +-
net/appletalk/ddp.c | 6 +-
net/atm/mpc.c | 2 +-
net/ax25/af_ax25.c | 2 +-
net/bridge/br_if.c | 4 +-
net/bridge/br_ioctl.c | 7 +-
net/bridge/br_netlink.c | 5 +-
net/bridge/br_private.h | 2 +-
net/core/dev.c | 271 +++++++++++++++++++++-----------
net/core/dev_mcast.c | 41 +++++-
net/core/ethtool.c | 4 +-
net/core/fib_rules.c | 4 +-
net/core/neighbour.c | 6 +-
net/core/netpoll.c | 2 +-
net/core/pktgen.c | 2 +-
net/core/rtnetlink.c | 35 +++--
net/core/sock.c | 3 +-
net/decnet/af_decnet.c | 2 +-
net/decnet/dn_dev.c | 20 ++--
net/decnet/dn_fib.c | 8 +-
net/decnet/dn_route.c | 6 +-
net/decnet/sysctl_net_decnet.c | 4 +-
net/econet/af_econet.c | 2 +-
net/ipv4/arp.c | 4 +-
net/ipv4/devinet.c | 18 +-
net/ipv4/fib_frontend.c | 2 +-
net/ipv4/fib_semantics.c | 4 +-
net/ipv4/icmp.c | 2 +-
net/ipv4/igmp.c | 4 +-
net/ipv4/ip_fragment.c | 2 +-
net/ipv4/ip_gre.c | 4 +-
net/ipv4/ip_sockglue.c | 2 +-
net/ipv4/ipconfig.c | 2 +-
net/ipv4/ipip.c | 4 +-
net/ipv4/ipmr.c | 4 +-
net/ipv4/ipvs/ip_vs_sync.c | 10 +-
net/ipv4/netfilter/ipt_CLUSTERIP.c | 2 +-
net/ipv4/route.c | 4 +-
net/ipv6/addrconf.c | 28 ++--
net/ipv6/af_inet6.c | 2 +-
net/ipv6/anycast.c | 12 +-
net/ipv6/datagram.c | 2 +-
net/ipv6/ip6_tunnel.c | 6 +-
net/ipv6/ipv6_sockglue.c | 2 +-
net/ipv6/mcast.c | 12 +-
net/ipv6/raw.c | 2 +-
net/ipv6/reassembly.c | 2 +-
net/ipv6/route.c | 4 +-
net/ipv6/sit.c | 4 +-
net/ipx/af_ipx.c | 6 +-
net/irda/irnetlink.c | 9 +-
net/llc/af_llc.c | 4 +-
net/llc/llc_core.c | 3 +-
net/mac80211/ieee80211.c | 1 +
net/mac80211/ieee80211_cfg.c | 3 +-
net/mac80211/tx.c | 9 +-
net/mac80211/util.c | 7 +-
net/netrom/nr_route.c | 6 +-
net/packet/af_packet.c | 18 +-
net/rose/rose_route.c | 8 +-
net/sched/act_mirred.c | 3 +-
net/sched/cls_api.c | 4 +-
net/sched/em_meta.c | 2 +-
net/sched/sch_api.c | 10 +-
net/sctp/ipv6.c | 4 +-
net/sctp/protocol.c | 2 +-
net/socket.c | 22 ++-
net/tipc/eth_media.c | 2 +-
net/wireless/wext.c | 38 ++++-
net/x25/x25_route.c | 2 +-
99 files changed, 555 insertions(+), 362 deletions(-)
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 2180ac1..6c1815a 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -16,6 +16,7 @@
#include <linux/errno.h>
#include <linux/kernel_stat.h>
#include <linux/netdevice.h>
+#include <net/net_namespace.h>
#include "appldata.h"
@@ -107,7 +108,7 @@ static void appldata_get_net_sum_data(void *data)
tx_dropped = 0;
collisions = 0;
read_lock(&dev_base_lock);
- for_each_netdev(dev) {
+ for_each_netdev(&init_net, dev) {
stats = dev->get_stats(dev);
rx_packets += stats->rx_packets;
tx_packets += stats->tx_packets;
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c
index 18352a4..8ad10a6 100644
--- a/arch/sparc64/solaris/ioctl.c
+++ b/arch/sparc64/solaris/ioctl.c
@@ -28,6 +28,7 @@
#include <linux/compat.h>
#include <net/sock.h>
+#include <net/net_namespace.h>
#include <asm/uaccess.h>
#include <asm/termios.h>
@@ -686,7 +687,7 @@ static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg)
int i = 0;
read_lock_bh(&dev_base_lock);
- for_each_netdev(d)
+ for_each_netdev(&init_net, d)
i++;
read_unlock_bh(&dev_base_lock);
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index f8b1700..eee54c0 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3576,7 +3576,7 @@ init_card(struct atm_dev *dev)
* XXX: <hack>
*/
sprintf(tname, "eth%d", card->index);
- tmp = dev_get_by_name(tname); /* jhs: was "tmp = dev_get(tname);" */
+ tmp = dev_get_by_name(&init_net, tname); /* jhs: was "tmp = dev_get(tname);" */
if (tmp) {
memcpy(card->atmdev->esi, tmp->dev_addr, 6);
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 01fbdd3..30394f7 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -9,6 +9,7 @@
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/genhd.h>
+#include <net/net_namespace.h>
#include <asm/unaligned.h>
#include "aoe.h"
@@ -194,7 +195,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
sl = sl_tail = NULL;
read_lock(&dev_base_lock);
- for_each_netdev(ifp) {
+ for_each_netdev(&init_net, ifp) {
dev_hold(ifp);
if (!is_aoe_netif(ifp))
goto cont;
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 1518b41..7b92b7d 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -37,6 +37,7 @@
#include <linux/spinlock.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
+#include <net/net_namespace.h>
#include "cxio_resource.h"
#include "cxio_hal.h"
@@ -894,7 +895,7 @@ int cxio_rdev_open(struct cxio_rdev *rdev_p)
if (cxio_hal_find_rdev_by_name(rdev_p->dev_name)) {
return -EBUSY;
}
- netdev_p = dev_get_by_name(rdev_p->dev_name);
+ netdev_p = dev_get_by_name(&init_net, rdev_p->dev_name);
if (!netdev_p) {
return -EINVAL;
}
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index cf97d8a..559fe94 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3719,7
...
|
|
|
 |
|
[PATCH 00/16] core network namespace support
By: ebiederm on Sat, 08 September 2007 21:07
|
 |
|
[PATCH 01/16] appletalk: In notifier handlers convert the void pointer to a netdevice
By: ebiederm on Sat, 08 September 2007 21:09
|
 |
|
[PATCH 02/16] net: Don't implement dev_ifname32 inline
By: ebiederm on Sat, 08 September 2007 21:13
|
 |
|
[PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Sat, 08 September 2007 21:15
|
 |
|
[PATCH 04/16] net: Add a network namespace parameter to tasks
By: ebiederm on Sat, 08 September 2007 21:17
|
 |
|
[PATCH 05/16] net: Add a network namespace tag to struct net_device
By: ebiederm on Sat, 08 September 2007 21:18
|
 |
|
[PATCH 07/16] net: Make /proc/net per network namespace
By: ebiederm on Sat, 08 September 2007 21:20
|
 |
|
[PATCH 08/16] net: Make socket creation namespace safe.
By: ebiederm on Sat, 08 September 2007 21:23
|
 |
|
[PATCH 09/16] net: Initialize the network namespace of network devices.
By: ebiederm on Sat, 08 September 2007 21:24
|
 |
|
[PATCH 10/16] net: Make packet reception network namespace safe
By: ebiederm on Sat, 08 September 2007 21:25
|
 |
|
[PATCH 11/16] net: Make device event notification network namespace safe
By: ebiederm on Sat, 08 September 2007 21:27
|
 |
|
[PATCH 12/16] net: Support multiple network namespaces with netlink
By: ebiederm on Sat, 08 September 2007 21:28
|
 |
|
[PATCH 13/16] net: Make the device list and device lookups per namespace.
By: ebiederm on Sat, 08 September 2007 21:35
|
 |
|
[PATCH 14/16] net: Factor out __dev_alloc_name from dev_alloc_name
By: ebiederm on Sat, 08 September 2007 21:36
|
 |
|
[PATCH 15/16] net: Implement network device movement between namespaces
By: ebiederm on Sat, 08 September 2007 21:38
|
 |
|
[PATCH 16/16] net: netlink support for moving devices between network namespaces.
By: ebiederm on Sat, 08 September 2007 21:43
|
 |
|
[PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
By: ebiederm on Sat, 08 September 2007 21:47
|
 |
|
Re: [PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
By: ebiederm on Mon, 10 September 2007 15:27
|
 |
|
Re: [PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
|
 |
|
Re: [PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
By: davem on Wed, 12 September 2007 11:59
|
 |
|
Re: [PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
By: davem on Wed, 12 September 2007 12:03
|
 |
|
Re: [PATCH 17/16] net: Disable netfilter sockopts when not in the initial network namespace
By: ebiederm on Wed, 12 September 2007 12:16
|
 |
|
Re: [PATCH 16/16] net: netlink support for moving devices between network namespaces.
By: ebiederm on Mon, 10 September 2007 19:30
|
 |
|
Re: [PATCH 16/16] net: netlink support for moving devices between network namespaces.
By: serue on Tue, 11 September 2007 00:54
|
 |
|
Re: [PATCH 16/16] net: netlink support for moving devices between network namespaces.
By: serue on Mon, 10 September 2007 19:07
|
 |
|
Re: [PATCH 16/16] net: netlink support for moving devices between network namespaces.
By: davem on Wed, 12 September 2007 11:57
|
 |
|
Re: [PATCH 15/16] net: Implement network device movement between namespaces
By: davem on Wed, 12 September 2007 11:54
|
 |
|
Re: [PATCH 14/16] net: Factor out __dev_alloc_name from dev_alloc_name
By: davem on Wed, 12 September 2007 11:49
|
 |
|
Re: [PATCH 13/16] net: Make the device list and device lookups per namespace.
By: davem on Wed, 12 September 2007 11:39
|
 |
|
Re: [PATCH 12/16] net: Support multiple network namespaces with netlink
By: ebiederm on Mon, 10 September 2007 15:24
|
 |
|
Re: [PATCH 12/16] net: Support multiple network namespaces with netlink
|
 |
|
Re: [PATCH 12/16] net: Support multiple network namespaces with netlink
By: davem on Wed, 12 September 2007 11:06
|
 |
|
Re: [PATCH 11/16] net: Make device event notification network namespace safe
By: davem on Wed, 12 September 2007 11:02
|
 |
|
Re: [PATCH 10/16] net: Make packet reception network namespace safe
By: davem on Wed, 12 September 2007 11:00
|
 |
|
Re: [PATCH 09/16] net: Initialize the network namespace of network devices.
By: davem on Wed, 12 September 2007 10:58
|
 |
|
Re: [PATCH 08/16] net: Make socket creation namespace safe.
By: davem on Wed, 12 September 2007 10:04
|
 |
|
Re: [PATCH 07/16] net: Make /proc/net per network namespace
By: davem on Wed, 12 September 2007 10:02
|
 |
|
Re: [PATCH 07/16] net: Make /proc/net per network namespace
|
 |
|
Re: [PATCH 07/16] net: Make /proc/net per network namespace
By: davem on Wed, 12 September 2007 12:19
|
 |
|
[PATCH 06/16] net: Add a network namespace parameter to struct sock
By: ebiederm on Sat, 08 September 2007 21:21
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
By: davem on Wed, 12 September 2007 09:58
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
By: den on Thu, 20 September 2007 12:55
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
By: den on Fri, 21 September 2007 05:04
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
By: ebiederm on Fri, 21 September 2007 05:58
|
 |
|
Re: [PATCH 06/16] net: Add a network namespace parameter to struct sock
|
 |
|
Re: [PATCH 05/16] net: Add a network namespace tag to struct net_device
By: davem on Wed, 12 September 2007 09:57
|
 |
|
Re: [PATCH 04/16] net: Add a network namespace parameter to tasks
By: davem on Wed, 12 September 2007 09:55
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: paulmck on Sun, 09 September 2007 00:33
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Sun, 09 September 2007 10:04
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: paulmck on Sun, 09 September 2007 16:45
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Mon, 10 September 2007 06:32
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Sun, 09 September 2007 10:18
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Mon, 10 September 2007 06:40
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: ebiederm on Mon, 10 September 2007 15:53
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
|
 |
|
Re: [PATCH 03/16] net: Basic network namespace infrastructure.
By: davem on Wed, 12 September 2007 09:52
|
 |
|
Re: [PATCH 02/16] net: Don't implement dev_ifname32 inline
By: davem on Wed, 12 September 2007 09:39
|
 |
|
Re: [PATCH 01/16] appletalk: In notifier handlers convert the void pointer to a netdevice
By: davem on Wed, 12 September 2007 09:27
|
Goto Forum:
Current Time: Fri Aug 22 01:41:10 GMT 2025
Total time taken to generate the page: 0.05749 seconds
|