br_mdb.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #include <linux/err.h>
  2. #include <linux/igmp.h>
  3. #include <linux/kernel.h>
  4. #include <linux/netdevice.h>
  5. #include <linux/rculist.h>
  6. #include <linux/skbuff.h>
  7. #include <linux/if_ether.h>
  8. #include <net/ip.h>
  9. #include <net/netlink.h>
  10. #include <net/switchdev.h>
  11. #if IS_ENABLED(CONFIG_IPV6)
  12. #include <net/ipv6.h>
  13. #include <net/addrconf.h>
  14. #endif
  15. #include "br_private.h"
  16. static int br_rports_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
  17. struct net_device *dev)
  18. {
  19. struct net_bridge *br = netdev_priv(dev);
  20. struct net_bridge_port *p;
  21. struct nlattr *nest;
  22. if (!br->multicast_router || hlist_empty(&br->router_list))
  23. return 0;
  24. nest = nla_nest_start(skb, MDBA_ROUTER);
  25. if (nest == NULL)
  26. return -EMSGSIZE;
  27. hlist_for_each_entry_rcu(p, &br->router_list, rlist) {
  28. if (p && nla_put_u32(skb, MDBA_ROUTER_PORT, p->dev->ifindex))
  29. goto fail;
  30. }
  31. nla_nest_end(skb, nest);
  32. return 0;
  33. fail:
  34. nla_nest_cancel(skb, nest);
  35. return -EMSGSIZE;
  36. }
  37. static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
  38. struct net_device *dev)
  39. {
  40. struct net_bridge *br = netdev_priv(dev);
  41. struct net_bridge_mdb_htable *mdb;
  42. struct nlattr *nest, *nest2;
  43. int i, err = 0;
  44. int idx = 0, s_idx = cb->args[1];
  45. if (br->multicast_disabled)
  46. return 0;
  47. mdb = rcu_dereference(br->mdb);
  48. if (!mdb)
  49. return 0;
  50. nest = nla_nest_start(skb, MDBA_MDB);
  51. if (nest == NULL)
  52. return -EMSGSIZE;
  53. for (i = 0; i < mdb->max; i++) {
  54. struct net_bridge_mdb_entry *mp;
  55. struct net_bridge_port_group *p;
  56. struct net_bridge_port_group __rcu **pp;
  57. struct net_bridge_port *port;
  58. hlist_for_each_entry_rcu(mp, &mdb->mhash[i], hlist[mdb->ver]) {
  59. if (idx < s_idx)
  60. goto skip;
  61. nest2 = nla_nest_start(skb, MDBA_MDB_ENTRY);
  62. if (nest2 == NULL) {
  63. err = -EMSGSIZE;
  64. goto out;
  65. }
  66. for (pp = &mp->ports;
  67. (p = rcu_dereference(*pp)) != NULL;
  68. pp = &p->next) {
  69. port = p->port;
  70. if (port) {
  71. struct br_mdb_entry e;
  72. memset(&e, 0, sizeof(e));
  73. e.ifindex = port->dev->ifindex;
  74. e.state = p->state;
  75. e.vid = p->addr.vid;
  76. if (p->addr.proto == htons(ETH_P_IP))
  77. e.addr.u.ip4 = p->addr.u.ip4;
  78. #if IS_ENABLED(CONFIG_IPV6)
  79. if (p->addr.proto == htons(ETH_P_IPV6))
  80. e.addr.u.ip6 = p->addr.u.ip6;
  81. #endif
  82. e.addr.proto = p->addr.proto;
  83. if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) {
  84. nla_nest_cancel(skb, nest2);
  85. err = -EMSGSIZE;
  86. goto out;
  87. }
  88. }
  89. }
  90. nla_nest_end(skb, nest2);
  91. skip:
  92. idx++;
  93. }
  94. }
  95. out:
  96. cb->args[1] = idx;
  97. nla_nest_end(skb, nest);
  98. return err;
  99. }
  100. static int br_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
  101. {
  102. struct net_device *dev;
  103. struct net *net = sock_net(skb->sk);
  104. struct nlmsghdr *nlh = NULL;
  105. int idx = 0, s_idx;
  106. s_idx = cb->args[0];
  107. rcu_read_lock();
  108. /* In theory this could be wrapped to 0... */
  109. cb->seq = net->dev_base_seq + br_mdb_rehash_seq;
  110. for_each_netdev_rcu(net, dev) {
  111. if (dev->priv_flags & IFF_EBRIDGE) {
  112. struct br_port_msg *bpm;
  113. if (idx < s_idx)
  114. goto skip;
  115. nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid,
  116. cb->nlh->nlmsg_seq, RTM_GETMDB,
  117. sizeof(*bpm), NLM_F_MULTI);
  118. if (nlh == NULL)
  119. break;
  120. bpm = nlmsg_data(nlh);
  121. memset(bpm, 0, sizeof(*bpm));
  122. bpm->ifindex = dev->ifindex;
  123. if (br_mdb_fill_info(skb, cb, dev) < 0)
  124. goto out;
  125. if (br_rports_fill_info(skb, cb, dev) < 0)
  126. goto out;
  127. cb->args[1] = 0;
  128. nlmsg_end(skb, nlh);
  129. skip:
  130. idx++;
  131. }
  132. }
  133. out:
  134. if (nlh)
  135. nlmsg_end(skb, nlh);
  136. rcu_read_unlock();
  137. cb->args[0] = idx;
  138. return skb->len;
  139. }
  140. static int nlmsg_populate_mdb_fill(struct sk_buff *skb,
  141. struct net_device *dev,
  142. struct br_mdb_entry *entry, u32 pid,
  143. u32 seq, int type, unsigned int flags)
  144. {
  145. struct nlmsghdr *nlh;
  146. struct br_port_msg *bpm;
  147. struct nlattr *nest, *nest2;
  148. nlh = nlmsg_put(skb, pid, seq, type, sizeof(*bpm), 0);
  149. if (!nlh)
  150. return -EMSGSIZE;
  151. bpm = nlmsg_data(nlh);
  152. memset(bpm, 0, sizeof(*bpm));
  153. bpm->family = AF_BRIDGE;
  154. bpm->ifindex = dev->ifindex;
  155. nest = nla_nest_start(skb, MDBA_MDB);
  156. if (nest == NULL)
  157. goto cancel;
  158. nest2 = nla_nest_start(skb, MDBA_MDB_ENTRY);
  159. if (nest2 == NULL)
  160. goto end;
  161. if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(*entry), entry))
  162. goto end;
  163. nla_nest_end(skb, nest2);
  164. nla_nest_end(skb, nest);
  165. nlmsg_end(skb, nlh);
  166. return 0;
  167. end:
  168. nla_nest_end(skb, nest);
  169. cancel:
  170. nlmsg_cancel(skb, nlh);
  171. return -EMSGSIZE;
  172. }
  173. static inline size_t rtnl_mdb_nlmsg_size(void)
  174. {
  175. return NLMSG_ALIGN(sizeof(struct br_port_msg))
  176. + nla_total_size(sizeof(struct br_mdb_entry));
  177. }
  178. static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry,
  179. int type)
  180. {
  181. struct switchdev_obj_port_mdb mdb = {
  182. .obj = {
  183. .id = SWITCHDEV_OBJ_ID_PORT_MDB,
  184. .flags = SWITCHDEV_F_DEFER,
  185. },
  186. .vid = entry->vid,
  187. };
  188. struct net_device *port_dev;
  189. struct net *net = dev_net(dev);
  190. struct sk_buff *skb;
  191. int err = -ENOBUFS;
  192. port_dev = __dev_get_by_index(net, entry->ifindex);
  193. if (entry->addr.proto == htons(ETH_P_IP))
  194. ip_eth_mc_map(entry->addr.u.ip4, mdb.addr);
  195. #if IS_ENABLED(CONFIG_IPV6)
  196. else
  197. ipv6_eth_mc_map(&entry->addr.u.ip6, mdb.addr);
  198. #endif
  199. mdb.obj.orig_dev = port_dev;
  200. if (port_dev && type == RTM_NEWMDB)
  201. switchdev_port_obj_add(port_dev, &mdb.obj);
  202. else if (port_dev && type == RTM_DELMDB)
  203. switchdev_port_obj_del(port_dev, &mdb.obj);
  204. skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC);
  205. if (!skb)
  206. goto errout;
  207. err = nlmsg_populate_mdb_fill(skb, dev, entry, 0, 0, type, NTF_SELF);
  208. if (err < 0) {
  209. kfree_skb(skb);
  210. goto errout;
  211. }
  212. rtnl_notify(skb, net, 0, RTNLGRP_MDB, NULL, GFP_ATOMIC);
  213. return;
  214. errout:
  215. rtnl_set_sk_err(net, RTNLGRP_MDB, err);
  216. }
  217. void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
  218. struct br_ip *group, int type, u8 state)
  219. {
  220. struct br_mdb_entry entry;
  221. memset(&entry, 0, sizeof(entry));
  222. entry.ifindex = port->dev->ifindex;
  223. entry.addr.proto = group->proto;
  224. entry.addr.u.ip4 = group->u.ip4;
  225. #if IS_ENABLED(CONFIG_IPV6)
  226. entry.addr.u.ip6 = group->u.ip6;
  227. #endif
  228. entry.state = state;
  229. entry.vid = group->vid;
  230. __br_mdb_notify(dev, &entry, type);
  231. }
  232. static int nlmsg_populate_rtr_fill(struct sk_buff *skb,
  233. struct net_device *dev,
  234. int ifindex, u32 pid,
  235. u32 seq, int type, unsigned int flags)
  236. {
  237. struct br_port_msg *bpm;
  238. struct nlmsghdr *nlh;
  239. struct nlattr *nest;
  240. nlh = nlmsg_put(skb, pid, seq, type, sizeof(*bpm), NLM_F_MULTI);
  241. if (!nlh)
  242. return -EMSGSIZE;
  243. bpm = nlmsg_data(nlh);
  244. memset(bpm, 0, sizeof(*bpm));
  245. bpm->family = AF_BRIDGE;
  246. bpm->ifindex = dev->ifindex;
  247. nest = nla_nest_start(skb, MDBA_ROUTER);
  248. if (!nest)
  249. goto cancel;
  250. if (nla_put_u32(skb, MDBA_ROUTER_PORT, ifindex))
  251. goto end;
  252. nla_nest_end(skb, nest);
  253. nlmsg_end(skb, nlh);
  254. return 0;
  255. end:
  256. nla_nest_end(skb, nest);
  257. cancel:
  258. nlmsg_cancel(skb, nlh);
  259. return -EMSGSIZE;
  260. }
  261. static inline size_t rtnl_rtr_nlmsg_size(void)
  262. {
  263. return NLMSG_ALIGN(sizeof(struct br_port_msg))
  264. + nla_total_size(sizeof(__u32));
  265. }
  266. void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port,
  267. int type)
  268. {
  269. struct net *net = dev_net(dev);
  270. struct sk_buff *skb;
  271. int err = -ENOBUFS;
  272. int ifindex;
  273. ifindex = port ? port->dev->ifindex : 0;
  274. skb = nlmsg_new(rtnl_rtr_nlmsg_size(), GFP_ATOMIC);
  275. if (!skb)
  276. goto errout;
  277. err = nlmsg_populate_rtr_fill(skb, dev, ifindex, 0, 0, type, NTF_SELF);
  278. if (err < 0) {
  279. kfree_skb(skb);
  280. goto errout;
  281. }
  282. rtnl_notify(skb, net, 0, RTNLGRP_MDB, NULL, GFP_ATOMIC);
  283. return;
  284. errout:
  285. rtnl_set_sk_err(net, RTNLGRP_MDB, err);
  286. }
  287. static bool is_valid_mdb_entry(struct br_mdb_entry *entry)
  288. {
  289. if (entry->ifindex == 0)
  290. return false;
  291. if (entry->addr.proto == htons(ETH_P_IP)) {
  292. if (!ipv4_is_multicast(entry->addr.u.ip4))
  293. return false;
  294. if (ipv4_is_local_multicast(entry->addr.u.ip4))
  295. return false;
  296. #if IS_ENABLED(CONFIG_IPV6)
  297. } else if (entry->addr.proto == htons(ETH_P_IPV6)) {
  298. if (ipv6_addr_is_ll_all_nodes(&entry->addr.u.ip6))
  299. return false;
  300. #endif
  301. } else
  302. return false;
  303. if (entry->state != MDB_PERMANENT && entry->state != MDB_TEMPORARY)
  304. return false;
  305. if (entry->vid >= VLAN_VID_MASK)
  306. return false;
  307. return true;
  308. }
  309. static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh,
  310. struct net_device **pdev, struct br_mdb_entry **pentry)
  311. {
  312. struct net *net = sock_net(skb->sk);
  313. struct br_mdb_entry *entry;
  314. struct br_port_msg *bpm;
  315. struct nlattr *tb[MDBA_SET_ENTRY_MAX+1];
  316. struct net_device *dev;
  317. int err;
  318. err = nlmsg_parse(nlh, sizeof(*bpm), tb, MDBA_SET_ENTRY_MAX, NULL);
  319. if (err < 0)
  320. return err;
  321. bpm = nlmsg_data(nlh);
  322. if (bpm->ifindex == 0) {
  323. pr_info("PF_BRIDGE: br_mdb_parse() with invalid ifindex\n");
  324. return -EINVAL;
  325. }
  326. dev = __dev_get_by_index(net, bpm->ifindex);
  327. if (dev == NULL) {
  328. pr_info("PF_BRIDGE: br_mdb_parse() with unknown ifindex\n");
  329. return -ENODEV;
  330. }
  331. if (!(dev->priv_flags & IFF_EBRIDGE)) {
  332. pr_info("PF_BRIDGE: br_mdb_parse() with non-bridge\n");
  333. return -EOPNOTSUPP;
  334. }
  335. *pdev = dev;
  336. if (!tb[MDBA_SET_ENTRY] ||
  337. nla_len(tb[MDBA_SET_ENTRY]) != sizeof(struct br_mdb_entry)) {
  338. pr_info("PF_BRIDGE: br_mdb_parse() with invalid attr\n");
  339. return -EINVAL;
  340. }
  341. entry = nla_data(tb[MDBA_SET_ENTRY]);
  342. if (!is_valid_mdb_entry(entry)) {
  343. pr_info("PF_BRIDGE: br_mdb_parse() with invalid entry\n");
  344. return -EINVAL;
  345. }
  346. *pentry = entry;
  347. return 0;
  348. }
  349. static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
  350. struct br_ip *group, unsigned char state)
  351. {
  352. struct net_bridge_mdb_entry *mp;
  353. struct net_bridge_port_group *p;
  354. struct net_bridge_port_group __rcu **pp;
  355. struct net_bridge_mdb_htable *mdb;
  356. unsigned long now = jiffies;
  357. int err;
  358. mdb = mlock_dereference(br->mdb, br);
  359. mp = br_mdb_ip_get(mdb, group);
  360. if (!mp) {
  361. mp = br_multicast_new_group(br, port, group);
  362. err = PTR_ERR(mp);
  363. if (IS_ERR(mp))
  364. return err;
  365. }
  366. for (pp = &mp->ports;
  367. (p = mlock_dereference(*pp, br)) != NULL;
  368. pp = &p->next) {
  369. if (p->port == port)
  370. return -EEXIST;
  371. if ((unsigned long)p->port < (unsigned long)port)
  372. break;
  373. }
  374. p = br_multicast_new_port_group(port, group, *pp, state);
  375. if (unlikely(!p))
  376. return -ENOMEM;
  377. rcu_assign_pointer(*pp, p);
  378. if (state == MDB_TEMPORARY)
  379. mod_timer(&p->timer, now + br->multicast_membership_interval);
  380. return 0;
  381. }
  382. static int __br_mdb_add(struct net *net, struct net_bridge *br,
  383. struct br_mdb_entry *entry)
  384. {
  385. struct br_ip ip;
  386. struct net_device *dev;
  387. struct net_bridge_port *p;
  388. int ret;
  389. if (!netif_running(br->dev) || br->multicast_disabled)
  390. return -EINVAL;
  391. dev = __dev_get_by_index(net, entry->ifindex);
  392. if (!dev)
  393. return -ENODEV;
  394. p = br_port_get_rtnl(dev);
  395. if (!p || p->br != br || p->state == BR_STATE_DISABLED)
  396. return -EINVAL;
  397. memset(&ip, 0, sizeof(ip));
  398. ip.vid = entry->vid;
  399. ip.proto = entry->addr.proto;
  400. if (ip.proto == htons(ETH_P_IP))
  401. ip.u.ip4 = entry->addr.u.ip4;
  402. #if IS_ENABLED(CONFIG_IPV6)
  403. else
  404. ip.u.ip6 = entry->addr.u.ip6;
  405. #endif
  406. spin_lock_bh(&br->multicast_lock);
  407. ret = br_mdb_add_group(br, p, &ip, entry->state);
  408. spin_unlock_bh(&br->multicast_lock);
  409. return ret;
  410. }
  411. static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh)
  412. {
  413. struct net *net = sock_net(skb->sk);
  414. struct net_bridge_vlan_group *vg;
  415. struct net_device *dev, *pdev;
  416. struct br_mdb_entry *entry;
  417. struct net_bridge_port *p;
  418. struct net_bridge_vlan *v;
  419. struct net_bridge *br;
  420. int err;
  421. err = br_mdb_parse(skb, nlh, &dev, &entry);
  422. if (err < 0)
  423. return err;
  424. br = netdev_priv(dev);
  425. /* If vlan filtering is enabled and VLAN is not specified
  426. * install mdb entry on all vlans configured on the port.
  427. */
  428. pdev = __dev_get_by_index(net, entry->ifindex);
  429. if (!pdev)
  430. return -ENODEV;
  431. p = br_port_get_rtnl(pdev);
  432. if (!p || p->br != br || p->state == BR_STATE_DISABLED)
  433. return -EINVAL;
  434. vg = nbp_vlan_group(p);
  435. if (br_vlan_enabled(br) && vg && entry->vid == 0) {
  436. list_for_each_entry(v, &vg->vlan_list, vlist) {
  437. entry->vid = v->vid;
  438. err = __br_mdb_add(net, br, entry);
  439. if (err)
  440. break;
  441. __br_mdb_notify(dev, entry, RTM_NEWMDB);
  442. }
  443. } else {
  444. err = __br_mdb_add(net, br, entry);
  445. if (!err)
  446. __br_mdb_notify(dev, entry, RTM_NEWMDB);
  447. }
  448. return err;
  449. }
  450. static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
  451. {
  452. struct net_bridge_mdb_htable *mdb;
  453. struct net_bridge_mdb_entry *mp;
  454. struct net_bridge_port_group *p;
  455. struct net_bridge_port_group __rcu **pp;
  456. struct br_ip ip;
  457. int err = -EINVAL;
  458. if (!netif_running(br->dev) || br->multicast_disabled)
  459. return -EINVAL;
  460. memset(&ip, 0, sizeof(ip));
  461. ip.vid = entry->vid;
  462. ip.proto = entry->addr.proto;
  463. if (ip.proto == htons(ETH_P_IP))
  464. ip.u.ip4 = entry->addr.u.ip4;
  465. #if IS_ENABLED(CONFIG_IPV6)
  466. else
  467. ip.u.ip6 = entry->addr.u.ip6;
  468. #endif
  469. spin_lock_bh(&br->multicast_lock);
  470. mdb = mlock_dereference(br->mdb, br);
  471. mp = br_mdb_ip_get(mdb, &ip);
  472. if (!mp)
  473. goto unlock;
  474. for (pp = &mp->ports;
  475. (p = mlock_dereference(*pp, br)) != NULL;
  476. pp = &p->next) {
  477. if (!p->port || p->port->dev->ifindex != entry->ifindex)
  478. continue;
  479. if (p->port->state == BR_STATE_DISABLED)
  480. goto unlock;
  481. entry->state = p->state;
  482. rcu_assign_pointer(*pp, p->next);
  483. hlist_del_init(&p->mglist);
  484. del_timer(&p->timer);
  485. call_rcu_bh(&p->rcu, br_multicast_free_pg);
  486. err = 0;
  487. if (!mp->ports && !mp->mglist &&
  488. netif_running(br->dev))
  489. mod_timer(&mp->timer, jiffies);
  490. break;
  491. }
  492. unlock:
  493. spin_unlock_bh(&br->multicast_lock);
  494. return err;
  495. }
  496. static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh)
  497. {
  498. struct net *net = sock_net(skb->sk);
  499. struct net_bridge_vlan_group *vg;
  500. struct net_device *dev, *pdev;
  501. struct br_mdb_entry *entry;
  502. struct net_bridge_port *p;
  503. struct net_bridge_vlan *v;
  504. struct net_bridge *br;
  505. int err;
  506. err = br_mdb_parse(skb, nlh, &dev, &entry);
  507. if (err < 0)
  508. return err;
  509. br = netdev_priv(dev);
  510. /* If vlan filtering is enabled and VLAN is not specified
  511. * delete mdb entry on all vlans configured on the port.
  512. */
  513. pdev = __dev_get_by_index(net, entry->ifindex);
  514. if (!pdev)
  515. return -ENODEV;
  516. p = br_port_get_rtnl(pdev);
  517. if (!p || p->br != br || p->state == BR_STATE_DISABLED)
  518. return -EINVAL;
  519. vg = nbp_vlan_group(p);
  520. if (br_vlan_enabled(br) && vg && entry->vid == 0) {
  521. list_for_each_entry(v, &vg->vlan_list, vlist) {
  522. entry->vid = v->vid;
  523. err = __br_mdb_del(br, entry);
  524. if (!err)
  525. __br_mdb_notify(dev, entry, RTM_DELMDB);
  526. }
  527. } else {
  528. err = __br_mdb_del(br, entry);
  529. if (!err)
  530. __br_mdb_notify(dev, entry, RTM_DELMDB);
  531. }
  532. return err;
  533. }
  534. void br_mdb_init(void)
  535. {
  536. rtnl_register(PF_BRIDGE, RTM_GETMDB, NULL, br_mdb_dump, NULL);
  537. rtnl_register(PF_BRIDGE, RTM_NEWMDB, br_mdb_add, NULL, NULL);
  538. rtnl_register(PF_BRIDGE, RTM_DELMDB, br_mdb_del, NULL, NULL);
  539. }
  540. void br_mdb_uninit(void)
  541. {
  542. rtnl_unregister(PF_BRIDGE, RTM_GETMDB);
  543. rtnl_unregister(PF_BRIDGE, RTM_NEWMDB);
  544. rtnl_unregister(PF_BRIDGE, RTM_DELMDB);
  545. }