diff options
author | Eric W. Biederman <ebiederm@aristanetworks.com> | 2009-11-08 03:53:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-08 03:53:51 -0500 |
commit | 81adee47dfb608df3ad0b91d230fb3cef75f0060 (patch) | |
tree | e9d7a41872f84c1395e21915e5f92c05ab872e69 /net/8021q/vlan_netlink.c | |
parent | f7a3a1d8affe563846fc17f0e7c0cc1500190c57 (diff) |
net: Support specifying the network namespace upon device creation.
There is no good reason to not support userspace specifying the
network namespace during device creation, and it makes it easier
to create a network device and pass it to a child network namespace
with a well known name.
We have to be careful to ensure that the target network namespace
for the new device exists through the life of the call. To keep
that logic clear I have factored out the network namespace grabbing
logic into rtnl_link_get_net.
In addtion we need to continue to pass the source network namespace
to the rtnl_link_ops.newlink method so that we can find the base
device source network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'net/8021q/vlan_netlink.c')
-rw-r--r-- | net/8021q/vlan_netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index a91504850195..3c9cf6a8e7fb 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c | |||
@@ -119,7 +119,7 @@ static int vlan_get_tx_queues(struct net *net, | |||
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
121 | 121 | ||
122 | static int vlan_newlink(struct net_device *dev, | 122 | static int vlan_newlink(struct net *src_net, struct net_device *dev, |
123 | struct nlattr *tb[], struct nlattr *data[]) | 123 | struct nlattr *tb[], struct nlattr *data[]) |
124 | { | 124 | { |
125 | struct vlan_dev_info *vlan = vlan_dev_info(dev); | 125 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
@@ -131,7 +131,7 @@ static int vlan_newlink(struct net_device *dev, | |||
131 | 131 | ||
132 | if (!tb[IFLA_LINK]) | 132 | if (!tb[IFLA_LINK]) |
133 | return -EINVAL; | 133 | return -EINVAL; |
134 | real_dev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK])); | 134 | real_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); |
135 | if (!real_dev) | 135 | if (!real_dev) |
136 | return -ENODEV; | 136 | return -ENODEV; |
137 | 137 | ||