aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-06-13 15:07:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:15:03 -0400
commit07b5b17e157b7018d0ca40ca0d1581a23096fb45 (patch)
tree6dd11652eb4cd1f6c008a6c57e7eaeca10aa9143 /net/8021q/vlan.c
parenta4bf3af4ac46802436d352ef409cee4fe80445b3 (diff)
[VLAN]: Use rtnl_link API
Signed-off-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.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index f12f914edf0..e7583eea6fd 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -97,15 +97,22 @@ static int __init vlan_proto_init(void)
97 97
98 /* Register us to receive netdevice events */ 98 /* Register us to receive netdevice events */
99 err = register_netdevice_notifier(&vlan_notifier_block); 99 err = register_netdevice_notifier(&vlan_notifier_block);
100 if (err < 0) { 100 if (err < 0)
101 dev_remove_pack(&vlan_packet_type); 101 goto err1;
102 vlan_proc_cleanup();
103 return err;
104 }
105 102
106 vlan_ioctl_set(vlan_ioctl_handler); 103 err = vlan_netlink_init();
104 if (err < 0)
105 goto err2;
107 106
107 vlan_ioctl_set(vlan_ioctl_handler);
108 return 0; 108 return 0;
109
110err2:
111 unregister_netdevice_notifier(&vlan_notifier_block);
112err1:
113 vlan_proc_cleanup();
114 dev_remove_pack(&vlan_packet_type);
115 return err;
109} 116}
110 117
111/* Cleanup all vlan devices 118/* Cleanup all vlan devices
@@ -136,6 +143,7 @@ static void __exit vlan_cleanup_module(void)
136{ 143{
137 int i; 144 int i;
138 145
146 vlan_netlink_fini();
139 vlan_ioctl_set(NULL); 147 vlan_ioctl_set(NULL);
140 148
141 /* Un-register us from receiving netdevice events */ 149 /* Un-register us from receiving netdevice events */
@@ -306,7 +314,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
306 return ret; 314 return ret;
307} 315}
308 316
309static int unregister_vlan_device(struct net_device *dev) 317int unregister_vlan_device(struct net_device *dev)
310{ 318{
311 int ret; 319 int ret;
312 320
@@ -361,7 +369,7 @@ static int vlan_dev_init(struct net_device *dev)
361 return 0; 369 return 0;
362} 370}
363 371
364static void vlan_setup(struct net_device *new_dev) 372void vlan_setup(struct net_device *new_dev)
365{ 373{
366 SET_MODULE_OWNER(new_dev); 374 SET_MODULE_OWNER(new_dev);
367 375
@@ -410,7 +418,7 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev
410 } 418 }
411} 419}
412 420
413static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) 421int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
414{ 422{
415 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { 423 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
416 printk(VLAN_DBG "%s: VLANs not supported on %s.\n", 424 printk(VLAN_DBG "%s: VLANs not supported on %s.\n",
@@ -447,7 +455,7 @@ static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_
447 return 0; 455 return 0;
448} 456}
449 457
450static int register_vlan_dev(struct net_device *dev) 458int register_vlan_dev(struct net_device *dev)
451{ 459{
452 struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); 460 struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
453 struct net_device *real_dev = vlan->real_dev; 461 struct net_device *real_dev = vlan->real_dev;
@@ -567,6 +575,7 @@ static int register_vlan_device(struct net_device *real_dev,
567 VLAN_DEV_INFO(new_dev)->dent = NULL; 575 VLAN_DEV_INFO(new_dev)->dent = NULL;
568 VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR; 576 VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
569 577
578 new_dev->rtnl_link_ops = &vlan_link_ops;
570 err = register_vlan_dev(new_dev); 579 err = register_vlan_dev(new_dev);
571 if (err < 0) 580 if (err < 0)
572 goto out_free_newdev; 581 goto out_free_newdev;