aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-16 03:55:06 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-16 03:56:37 -0400
commit65d292a2ef2df66fd1ab83447afee71ef3720ded (patch)
treed3ac632109448ab07f0fef3fe767dca66d183149 /net/8021q/vlan.c
parent7a17a2f79f54a988d08ffa33ec9e1038bffec42b (diff)
[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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5cacad0671db..7e9d22ec7d45 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,
340 if (new_dev == NULL) 340 if (new_dev == NULL)
341 return -ENOBUFS; 341 return -ENOBUFS;
342 342
343 dev_net_set(new_dev, net);
343 /* need 4 bytes for extra VLAN header info, 344 /* need 4 bytes for extra VLAN header info,
344 * hope the underlying device can handle it. 345 * hope the underlying device can handle it.
345 */ 346 */
@@ -406,9 +407,6 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
406 int i, flgs; 407 int i, flgs;
407 struct net_device *vlandev; 408 struct net_device *vlandev;
408 409
409 if (dev_net(dev) != &init_net)
410 return NOTIFY_DONE;
411
412 if (is_vlan_dev(dev)) { 410 if (is_vlan_dev(dev)) {
413 __vlan_device_event(dev, event); 411 __vlan_device_event(dev, event);
414 goto out; 412 goto out;
@@ -534,7 +532,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
534 case GET_VLAN_REALDEV_NAME_CMD: 532 case GET_VLAN_REALDEV_NAME_CMD:
535 case GET_VLAN_VID_CMD: 533 case GET_VLAN_VID_CMD:
536 err = -ENODEV; 534 err = -ENODEV;
537 dev = __dev_get_by_name(&init_net, args.device1); 535 dev = __dev_get_by_name(net, args.device1);
538 if (!dev) 536 if (!dev)
539 goto out; 537 goto out;
540 538
@@ -665,6 +663,7 @@ static void vlan_exit_net(struct net *net)
665 struct vlan_net *vn; 663 struct vlan_net *vn;
666 664
667 vn = net_generic(net, vlan_net_id); 665 vn = net_generic(net, vlan_net_id);
666 rtnl_kill_links(net, &vlan_link_ops);
668 vlan_proc_cleanup(net); 667 vlan_proc_cleanup(net);
669 kfree(vn); 668 kfree(vn);
670} 669}