vlan.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. /*
  2. * INET 802.1Q VLAN
  3. * Ethernet-type device handling.
  4. *
  5. * Authors: Ben Greear <greearb@candelatech.com>
  6. * Please send support related email to: netdev@vger.kernel.org
  7. * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
  8. *
  9. * Fixes:
  10. * Fix for packet capture - Nick Eggleston <nick@dccinc.com>;
  11. * Add HW acceleration hooks - David S. Miller <davem@redhat.com>;
  12. * Correct all the locking - David S. Miller <davem@redhat.com>;
  13. * Use hash table for VLAN groups - David S. Miller <davem@redhat.com>
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * as published by the Free Software Foundation; either version
  18. * 2 of the License, or (at your option) any later version.
  19. */
  20. #include <asm/uaccess.h> /* for copy_from_user */
  21. #include <linux/capability.h>
  22. #include <linux/module.h>
  23. #include <linux/netdevice.h>
  24. #include <linux/skbuff.h>
  25. #include <net/datalink.h>
  26. #include <linux/mm.h>
  27. #include <linux/in.h>
  28. #include <linux/init.h>
  29. #include <net/p8022.h>
  30. #include <net/arp.h>
  31. #include <linux/rtnetlink.h>
  32. #include <linux/notifier.h>
  33. #include <net/net_namespace.h>
  34. #include <linux/if_vlan.h>
  35. #include "vlan.h"
  36. #include "vlanproc.h"
  37. #define DRV_VERSION "1.8"
  38. /* Global VLAN variables */
  39. /* Our listing of VLAN group(s) */
  40. static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE];
  41. static char vlan_fullname[] = "802.1Q VLAN Support";
  42. static char vlan_version[] = DRV_VERSION;
  43. static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
  44. static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
  45. /* Determines interface naming scheme. */
  46. unsigned short vlan_name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
  47. static struct packet_type vlan_packet_type = {
  48. .type = __constant_htons(ETH_P_8021Q),
  49. .func = vlan_skb_recv, /* VLAN receive method */
  50. };
  51. /* End of global variables definitions. */
  52. static inline unsigned int vlan_grp_hashfn(unsigned int idx)
  53. {
  54. return ((idx >> VLAN_GRP_HASH_SHIFT) ^ idx) & VLAN_GRP_HASH_MASK;
  55. }
  56. /* Must be invoked with RCU read lock (no preempt) */
  57. static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
  58. {
  59. struct vlan_group *grp;
  60. struct hlist_node *n;
  61. int hash = vlan_grp_hashfn(real_dev_ifindex);
  62. hlist_for_each_entry_rcu(grp, n, &vlan_group_hash[hash], hlist) {
  63. if (grp->real_dev_ifindex == real_dev_ifindex)
  64. return grp;
  65. }
  66. return NULL;
  67. }
  68. /* Find the protocol handler. Assumes VID < VLAN_VID_MASK.
  69. *
  70. * Must be invoked with RCU read lock (no preempt)
  71. */
  72. struct net_device *__find_vlan_dev(struct net_device *real_dev,
  73. unsigned short VID)
  74. {
  75. struct vlan_group *grp = __vlan_find_group(real_dev->ifindex);
  76. if (grp)
  77. return vlan_group_get_device(grp, VID);
  78. return NULL;
  79. }
  80. static void vlan_group_free(struct vlan_group *grp)
  81. {
  82. int i;
  83. for (i = 0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
  84. kfree(grp->vlan_devices_arrays[i]);
  85. kfree(grp);
  86. }
  87. static struct vlan_group *vlan_group_alloc(int ifindex)
  88. {
  89. struct vlan_group *grp;
  90. unsigned int size;
  91. unsigned int i;
  92. grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
  93. if (!grp)
  94. return NULL;
  95. size = sizeof(struct net_device *) * VLAN_GROUP_ARRAY_PART_LEN;
  96. for (i = 0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) {
  97. grp->vlan_devices_arrays[i] = kzalloc(size, GFP_KERNEL);
  98. if (!grp->vlan_devices_arrays[i])
  99. goto err;
  100. }
  101. grp->real_dev_ifindex = ifindex;
  102. hlist_add_head_rcu(&grp->hlist,
  103. &vlan_group_hash[vlan_grp_hashfn(ifindex)]);
  104. return grp;
  105. err:
  106. vlan_group_free(grp);
  107. return NULL;
  108. }
  109. static void vlan_rcu_free(struct rcu_head *rcu)
  110. {
  111. vlan_group_free(container_of(rcu, struct vlan_group, rcu));
  112. }
  113. void unregister_vlan_dev(struct net_device *dev)
  114. {
  115. struct vlan_dev_info *vlan = vlan_dev_info(dev);
  116. struct net_device *real_dev = vlan->real_dev;
  117. struct vlan_group *grp;
  118. unsigned short vlan_id = vlan->vlan_id;
  119. ASSERT_RTNL();
  120. grp = __vlan_find_group(real_dev->ifindex);
  121. BUG_ON(!grp);
  122. vlan_proc_rem_dev(dev);
  123. /* Take it out of our own structures, but be sure to interlock with
  124. * HW accelerating devices or SW vlan input packet processing.
  125. */
  126. if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
  127. real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
  128. vlan_group_set_device(grp, vlan_id, NULL);
  129. grp->nr_vlans--;
  130. synchronize_net();
  131. /* If the group is now empty, kill off the group. */
  132. if (grp->nr_vlans == 0) {
  133. if (real_dev->features & NETIF_F_HW_VLAN_RX)
  134. real_dev->vlan_rx_register(real_dev, NULL);
  135. hlist_del_rcu(&grp->hlist);
  136. /* Free the group, after all cpu's are done. */
  137. call_rcu(&grp->rcu, vlan_rcu_free);
  138. }
  139. /* Get rid of the vlan's reference to real_dev */
  140. dev_put(real_dev);
  141. unregister_netdevice(dev);
  142. }
  143. static void vlan_transfer_operstate(const struct net_device *dev,
  144. struct net_device *vlandev)
  145. {
  146. /* Have to respect userspace enforced dormant state
  147. * of real device, also must allow supplicant running
  148. * on VLAN device
  149. */
  150. if (dev->operstate == IF_OPER_DORMANT)
  151. netif_dormant_on(vlandev);
  152. else
  153. netif_dormant_off(vlandev);
  154. if (netif_carrier_ok(dev)) {
  155. if (!netif_carrier_ok(vlandev))
  156. netif_carrier_on(vlandev);
  157. } else {
  158. if (netif_carrier_ok(vlandev))
  159. netif_carrier_off(vlandev);
  160. }
  161. }
  162. int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
  163. {
  164. char *name = real_dev->name;
  165. if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
  166. pr_info("8021q: VLANs not supported on %s\n", name);
  167. return -EOPNOTSUPP;
  168. }
  169. if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
  170. !real_dev->vlan_rx_register) {
  171. pr_info("8021q: device %s has buggy VLAN hw accel\n", name);
  172. return -EOPNOTSUPP;
  173. }
  174. if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
  175. (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) {
  176. pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
  177. return -EOPNOTSUPP;
  178. }
  179. /* The real device must be up and operating in order to
  180. * assosciate a VLAN device with it.
  181. */
  182. if (!(real_dev->flags & IFF_UP))
  183. return -ENETDOWN;
  184. if (__find_vlan_dev(real_dev, vlan_id) != NULL)
  185. return -EEXIST;
  186. return 0;
  187. }
  188. int register_vlan_dev(struct net_device *dev)
  189. {
  190. struct vlan_dev_info *vlan = vlan_dev_info(dev);
  191. struct net_device *real_dev = vlan->real_dev;
  192. unsigned short vlan_id = vlan->vlan_id;
  193. struct vlan_group *grp, *ngrp = NULL;
  194. int err;
  195. grp = __vlan_find_group(real_dev->ifindex);
  196. if (!grp) {
  197. ngrp = grp = vlan_group_alloc(real_dev->ifindex);
  198. if (!grp)
  199. return -ENOBUFS;
  200. }
  201. err = register_netdevice(dev);
  202. if (err < 0)
  203. goto out_free_group;
  204. /* Account for reference in struct vlan_dev_info */
  205. dev_hold(real_dev);
  206. vlan_transfer_operstate(real_dev, dev);
  207. linkwatch_fire_event(dev); /* _MUST_ call rfc2863_policy() */
  208. /* So, got the sucker initialized, now lets place
  209. * it into our local structure.
  210. */
  211. vlan_group_set_device(grp, vlan_id, dev);
  212. grp->nr_vlans++;
  213. if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX)
  214. real_dev->vlan_rx_register(real_dev, ngrp);
  215. if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
  216. real_dev->vlan_rx_add_vid(real_dev, vlan_id);
  217. if (vlan_proc_add_dev(dev) < 0)
  218. pr_warning("8021q: failed to add proc entry for %s\n",
  219. dev->name);
  220. return 0;
  221. out_free_group:
  222. if (ngrp)
  223. vlan_group_free(ngrp);
  224. return err;
  225. }
  226. /* Attach a VLAN device to a mac address (ie Ethernet Card).
  227. * Returns 0 if the device was created or a negative error code otherwise.
  228. */
  229. static int register_vlan_device(struct net_device *real_dev,
  230. unsigned short VLAN_ID)
  231. {
  232. struct net_device *new_dev;
  233. char name[IFNAMSIZ];
  234. int err;
  235. if (VLAN_ID >= VLAN_VID_MASK)
  236. return -ERANGE;
  237. err = vlan_check_real_dev(real_dev, VLAN_ID);
  238. if (err < 0)
  239. return err;
  240. /* Gotta set up the fields for the device. */
  241. switch (vlan_name_type) {
  242. case VLAN_NAME_TYPE_RAW_PLUS_VID:
  243. /* name will look like: eth1.0005 */
  244. snprintf(name, IFNAMSIZ, "%s.%.4i", real_dev->name, VLAN_ID);
  245. break;
  246. case VLAN_NAME_TYPE_PLUS_VID_NO_PAD:
  247. /* Put our vlan.VID in the name.
  248. * Name will look like: vlan5
  249. */
  250. snprintf(name, IFNAMSIZ, "vlan%i", VLAN_ID);
  251. break;
  252. case VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD:
  253. /* Put our vlan.VID in the name.
  254. * Name will look like: eth0.5
  255. */
  256. snprintf(name, IFNAMSIZ, "%s.%i", real_dev->name, VLAN_ID);
  257. break;
  258. case VLAN_NAME_TYPE_PLUS_VID:
  259. /* Put our vlan.VID in the name.
  260. * Name will look like: vlan0005
  261. */
  262. default:
  263. snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID);
  264. }
  265. new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
  266. vlan_setup);
  267. if (new_dev == NULL)
  268. return -ENOBUFS;
  269. /* need 4 bytes for extra VLAN header info,
  270. * hope the underlying device can handle it.
  271. */
  272. new_dev->mtu = real_dev->mtu;
  273. vlan_dev_info(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
  274. vlan_dev_info(new_dev)->real_dev = real_dev;
  275. vlan_dev_info(new_dev)->dent = NULL;
  276. vlan_dev_info(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
  277. new_dev->rtnl_link_ops = &vlan_link_ops;
  278. err = register_vlan_dev(new_dev);
  279. if (err < 0)
  280. goto out_free_newdev;
  281. return 0;
  282. out_free_newdev:
  283. free_netdev(new_dev);
  284. return err;
  285. }
  286. static void vlan_sync_address(struct net_device *dev,
  287. struct net_device *vlandev)
  288. {
  289. struct vlan_dev_info *vlan = vlan_dev_info(vlandev);
  290. /* May be called without an actual change */
  291. if (!compare_ether_addr(vlan->real_dev_addr, dev->dev_addr))
  292. return;
  293. /* vlan address was different from the old address and is equal to
  294. * the new address */
  295. if (compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) &&
  296. !compare_ether_addr(vlandev->dev_addr, dev->dev_addr))
  297. dev_unicast_delete(dev, vlandev->dev_addr, ETH_ALEN);
  298. /* vlan address was equal to the old address and is different from
  299. * the new address */
  300. if (!compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) &&
  301. compare_ether_addr(vlandev->dev_addr, dev->dev_addr))
  302. dev_unicast_add(dev, vlandev->dev_addr, ETH_ALEN);
  303. memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
  304. }
  305. static void __vlan_device_event(struct net_device *dev, unsigned long event)
  306. {
  307. switch (event) {
  308. case NETDEV_CHANGENAME:
  309. vlan_proc_rem_dev(dev);
  310. if (vlan_proc_add_dev(dev) < 0)
  311. pr_warning("8021q: failed to change proc name for %s\n",
  312. dev->name);
  313. break;
  314. }
  315. }
  316. static int vlan_device_event(struct notifier_block *unused, unsigned long event,
  317. void *ptr)
  318. {
  319. struct net_device *dev = ptr;
  320. struct vlan_group *grp;
  321. int i, flgs;
  322. struct net_device *vlandev;
  323. if (dev->nd_net != &init_net)
  324. return NOTIFY_DONE;
  325. if (is_vlan_dev(dev)) {
  326. __vlan_device_event(dev, event);
  327. goto out;
  328. }
  329. grp = __vlan_find_group(dev->ifindex);
  330. if (!grp)
  331. goto out;
  332. /* It is OK that we do not hold the group lock right now,
  333. * as we run under the RTNL lock.
  334. */
  335. switch (event) {
  336. case NETDEV_CHANGE:
  337. /* Propagate real device state to vlan devices */
  338. for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
  339. vlandev = vlan_group_get_device(grp, i);
  340. if (!vlandev)
  341. continue;
  342. vlan_transfer_operstate(dev, vlandev);
  343. }
  344. break;
  345. case NETDEV_CHANGEADDR:
  346. /* Adjust unicast filters on underlying device */
  347. for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
  348. vlandev = vlan_group_get_device(grp, i);
  349. if (!vlandev)
  350. continue;
  351. flgs = vlandev->flags;
  352. if (!(flgs & IFF_UP))
  353. continue;
  354. vlan_sync_address(dev, vlandev);
  355. }
  356. break;
  357. case NETDEV_DOWN:
  358. /* Put all VLANs for this dev in the down state too. */
  359. for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
  360. vlandev = vlan_group_get_device(grp, i);
  361. if (!vlandev)
  362. continue;
  363. flgs = vlandev->flags;
  364. if (!(flgs & IFF_UP))
  365. continue;
  366. dev_change_flags(vlandev, flgs & ~IFF_UP);
  367. }
  368. break;
  369. case NETDEV_UP:
  370. /* Put all VLANs for this dev in the up state too. */
  371. for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
  372. vlandev = vlan_group_get_device(grp, i);
  373. if (!vlandev)
  374. continue;
  375. flgs = vlandev->flags;
  376. if (flgs & IFF_UP)
  377. continue;
  378. dev_change_flags(vlandev, flgs | IFF_UP);
  379. }
  380. break;
  381. case NETDEV_UNREGISTER:
  382. /* Delete all VLANs for this dev. */
  383. for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
  384. vlandev = vlan_group_get_device(grp, i);
  385. if (!vlandev)
  386. continue;
  387. /* unregistration of last vlan destroys group, abort
  388. * afterwards */
  389. if (grp->nr_vlans == 1)
  390. i = VLAN_GROUP_ARRAY_LEN;
  391. unregister_vlan_dev(vlandev);
  392. }
  393. break;
  394. }
  395. out:
  396. return NOTIFY_DONE;
  397. }
  398. static struct notifier_block vlan_notifier_block __read_mostly = {
  399. .notifier_call = vlan_device_event,
  400. };
  401. /*
  402. * VLAN IOCTL handler.
  403. * o execute requested action or pass command to the device driver
  404. * arg is really a struct vlan_ioctl_args __user *.
  405. */
  406. static int vlan_ioctl_handler(struct net *net, void __user *arg)
  407. {
  408. int err;
  409. unsigned short vid = 0;
  410. struct vlan_ioctl_args args;
  411. struct net_device *dev = NULL;
  412. if (copy_from_user(&args, arg, sizeof(struct vlan_ioctl_args)))
  413. return -EFAULT;
  414. /* Null terminate this sucker, just in case. */
  415. args.device1[23] = 0;
  416. args.u.device2[23] = 0;
  417. rtnl_lock();
  418. switch (args.cmd) {
  419. case SET_VLAN_INGRESS_PRIORITY_CMD:
  420. case SET_VLAN_EGRESS_PRIORITY_CMD:
  421. case SET_VLAN_FLAG_CMD:
  422. case ADD_VLAN_CMD:
  423. case DEL_VLAN_CMD:
  424. case GET_VLAN_REALDEV_NAME_CMD:
  425. case GET_VLAN_VID_CMD:
  426. err = -ENODEV;
  427. dev = __dev_get_by_name(&init_net, args.device1);
  428. if (!dev)
  429. goto out;
  430. err = -EINVAL;
  431. if (args.cmd != ADD_VLAN_CMD &&
  432. !(dev->priv_flags & IFF_802_1Q_VLAN))
  433. goto out;
  434. }
  435. switch (args.cmd) {
  436. case SET_VLAN_INGRESS_PRIORITY_CMD:
  437. err = -EPERM;
  438. if (!capable(CAP_NET_ADMIN))
  439. break;
  440. vlan_dev_set_ingress_priority(dev,
  441. args.u.skb_priority,
  442. args.vlan_qos);
  443. err = 0;
  444. break;
  445. case SET_VLAN_EGRESS_PRIORITY_CMD:
  446. err = -EPERM;
  447. if (!capable(CAP_NET_ADMIN))
  448. break;
  449. err = vlan_dev_set_egress_priority(dev,
  450. args.u.skb_priority,
  451. args.vlan_qos);
  452. break;
  453. case SET_VLAN_FLAG_CMD:
  454. err = -EPERM;
  455. if (!capable(CAP_NET_ADMIN))
  456. break;
  457. err = vlan_dev_set_vlan_flag(dev,
  458. args.u.flag,
  459. args.vlan_qos);
  460. break;
  461. case SET_VLAN_NAME_TYPE_CMD:
  462. err = -EPERM;
  463. if (!capable(CAP_NET_ADMIN))
  464. break;
  465. if ((args.u.name_type >= 0) &&
  466. (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
  467. vlan_name_type = args.u.name_type;
  468. err = 0;
  469. } else {
  470. err = -EINVAL;
  471. }
  472. break;
  473. case ADD_VLAN_CMD:
  474. err = -EPERM;
  475. if (!capable(CAP_NET_ADMIN))
  476. break;
  477. err = register_vlan_device(dev, args.u.VID);
  478. break;
  479. case DEL_VLAN_CMD:
  480. err = -EPERM;
  481. if (!capable(CAP_NET_ADMIN))
  482. break;
  483. unregister_vlan_dev(dev);
  484. err = 0;
  485. break;
  486. case GET_VLAN_REALDEV_NAME_CMD:
  487. err = 0;
  488. vlan_dev_get_realdev_name(dev, args.u.device2);
  489. if (copy_to_user(arg, &args,
  490. sizeof(struct vlan_ioctl_args)))
  491. err = -EFAULT;
  492. break;
  493. case GET_VLAN_VID_CMD:
  494. err = 0;
  495. vlan_dev_get_vid(dev, &vid);
  496. args.u.VID = vid;
  497. if (copy_to_user(arg, &args,
  498. sizeof(struct vlan_ioctl_args)))
  499. err = -EFAULT;
  500. break;
  501. default:
  502. err = -EOPNOTSUPP;
  503. break;
  504. }
  505. out:
  506. rtnl_unlock();
  507. return err;
  508. }
  509. static int __init vlan_proto_init(void)
  510. {
  511. int err;
  512. pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
  513. pr_info("All bugs added by %s\n", vlan_buggyright);
  514. err = vlan_proc_init();
  515. if (err < 0)
  516. goto err1;
  517. err = register_netdevice_notifier(&vlan_notifier_block);
  518. if (err < 0)
  519. goto err2;
  520. err = vlan_netlink_init();
  521. if (err < 0)
  522. goto err3;
  523. dev_add_pack(&vlan_packet_type);
  524. vlan_ioctl_set(vlan_ioctl_handler);
  525. return 0;
  526. err3:
  527. unregister_netdevice_notifier(&vlan_notifier_block);
  528. err2:
  529. vlan_proc_cleanup();
  530. err1:
  531. return err;
  532. }
  533. static void __exit vlan_cleanup_module(void)
  534. {
  535. unsigned int i;
  536. vlan_ioctl_set(NULL);
  537. vlan_netlink_fini();
  538. unregister_netdevice_notifier(&vlan_notifier_block);
  539. dev_remove_pack(&vlan_packet_type);
  540. /* This table must be empty if there are no module references left. */
  541. for (i = 0; i < VLAN_GRP_HASH_SIZE; i++)
  542. BUG_ON(!hlist_empty(&vlan_group_hash[i]));
  543. vlan_proc_cleanup();
  544. synchronize_net();
  545. }
  546. module_init(vlan_proto_init);
  547. module_exit(vlan_cleanup_module);
  548. MODULE_LICENSE("GPL");
  549. MODULE_VERSION(DRV_VERSION);