aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-12 06:57:33 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:07 -0400
commit6d34b1c27a72d5d1c73c567b2f6b1fde316e0eae (patch)
tree01e9abb8a2babae407ffe11b5202505992d41265 /net/core
parent1b8d7ae42d02e483ad94035cca851e4f7fbecb40 (diff)
[NET]: Initialize the network namespace of network devices.
Except for carefully selected pseudo devices all network interfaces should start out in the initial network namespace. Ultimately it will be register_netdev that examines what dev->nd_net is set to and places a device in a network namespace. This patch modifies alloc_netdev to initialize the network namespace a device is in with the initial network namespace. This gets it right for the vast majority of devices so their drivers need not be modified and for those few pseudo devices that need something different they can change this parameter before calling register_netdevice. The network namespace parameter on a network device is not reference counted as the devices are inside of a network namespace and cannot remain in that namespace past the lifetime of the network namespace. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 618fb1c1dd4..40fd66fbe4e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3725,6 +3725,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
3725 dev = (struct net_device *) 3725 dev = (struct net_device *)
3726 (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); 3726 (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
3727 dev->padded = (char *)dev - (char *)p; 3727 dev->padded = (char *)dev - (char *)p;
3728 dev->nd_net = &init_net;
3728 3729
3729 if (sizeof_priv) { 3730 if (sizeof_priv) {
3730 dev->priv = ((char *)dev + 3731 dev->priv = ((char *)dev +