diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-16 00:55:06 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-16 00:56:37 -0700 |
commit | 65d292a2ef2df66fd1ab83447afee71ef3720ded (patch) | |
tree | d3ac632109448ab07f0fef3fe767dca66d183149 /net/8021q/vlan.c | |
parent | 7a17a2f79f54a988d08ffa33ec9e1038bffec42b (diff) | |
download | kernel_samsung_crespo-65d292a2ef2df66fd1ab83447afee71ef3720ded.zip kernel_samsung_crespo-65d292a2ef2df66fd1ab83447afee71ef3720ded.tar.gz kernel_samsung_crespo-65d292a2ef2df66fd1ab83447afee71ef3720ded.tar.bz2 |
[VLAN]: Allow vlan devices registration in net namespaces.
This one is similar to what I've done for TUN - set the proper
net after device allocation and clean VLANs on net exit (use the
rtnl_kill_links helper finally).
Plus, drop explicit init_net usage and net != &init_net checks.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r-- | net/8021q/vlan.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 5cacad0..7e9d22e 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -340,6 +340,7 @@ static int register_vlan_device(struct net_device *real_dev, if (new_dev == NULL) return -ENOBUFS; + dev_net_set(new_dev, net); /* need 4 bytes for extra VLAN header info, * hope the underlying device can handle it. */ @@ -406,9 +407,6 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, int i, flgs; struct net_device *vlandev; - if (dev_net(dev) != &init_net) - return NOTIFY_DONE; - if (is_vlan_dev(dev)) { __vlan_device_event(dev, event); goto out; @@ -534,7 +532,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg) case GET_VLAN_REALDEV_NAME_CMD: case GET_VLAN_VID_CMD: err = -ENODEV; - dev = __dev_get_by_name(&init_net, args.device1); + dev = __dev_get_by_name(net, args.device1); if (!dev) goto out; @@ -665,6 +663,7 @@ static void vlan_exit_net(struct net *net) struct vlan_net *vn; vn = net_generic(net, vlan_net_id); + rtnl_kill_links(net, &vlan_link_ops); vlan_proc_cleanup(net); kfree(vn); } |