mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Acked-by: Eric Dumazet <[email protected]>
This commit is contained in:
parent
f7a3a1d8af
commit
81adee47df
7 changed files with 50 additions and 23 deletions
|
|
@ -119,7 +119,7 @@ static int vlan_get_tx_queues(struct net *net,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vlan_newlink(struct net_device *dev,
|
||||
static int vlan_newlink(struct net *src_net, struct net_device *dev,
|
||||
struct nlattr *tb[], struct nlattr *data[])
|
||||
{
|
||||
struct vlan_dev_info *vlan = vlan_dev_info(dev);
|
||||
|
|
@ -131,7 +131,7 @@ static int vlan_newlink(struct net_device *dev,
|
|||
|
||||
if (!tb[IFLA_LINK])
|
||||
return -EINVAL;
|
||||
real_dev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK]));
|
||||
real_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
|
||||
if (!real_dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue