Blame view
net/bridge/br.c
2.05 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 |
/* * Generic parts * Linux ethernet bridge * * Authors: * Lennert Buytenhek <buytenh@gnu.org> * |
1da177e4c Linux-2.6.12-rc2 |
8 9 10 11 12 |
* This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 16 17 |
#include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/init.h> |
cf0f02d04 [BRIDGE]: use llc... |
18 19 |
#include <linux/llc.h> #include <net/llc.h> |
7c85fbf06 bridge: Use STP d... |
20 |
#include <net/stp.h> |
1da177e4c Linux-2.6.12-rc2 |
21 22 |
#include "br_private.h" |
7c85fbf06 bridge: Use STP d... |
23 24 25 |
static const struct stp_proto br_stp_proto = { .rcv = br_stp_rcv, }; |
cf0f02d04 [BRIDGE]: use llc... |
26 |
|
712d6954e netns bridge: cle... |
27 28 29 |
static struct pernet_operations br_net_ops = { .exit = br_net_exit, }; |
1da177e4c Linux-2.6.12-rc2 |
30 31 |
static int __init br_init(void) { |
c09097132 [BRIDGE]: fix mod... |
32 |
int err; |
7c85fbf06 bridge: Use STP d... |
33 34 |
err = stp_proto_register(&br_stp_proto); if (err < 0) { |
28a16c979 bridge: change co... |
35 36 |
pr_err("bridge: can't register sap for STP "); |
7c85fbf06 bridge: Use STP d... |
37 |
return err; |
cf0f02d04 [BRIDGE]: use llc... |
38 |
} |
87a596e0b bridge: check kme... |
39 40 |
err = br_fdb_init(); if (err) |
17efdd457 [BRIDGE]: Lost ca... |
41 |
goto err_out; |
1da177e4c Linux-2.6.12-rc2 |
42 |
|
712d6954e netns bridge: cle... |
43 |
err = register_pernet_subsys(&br_net_ops); |
c09097132 [BRIDGE]: fix mod... |
44 45 |
if (err) goto err_out1; |
712d6954e netns bridge: cle... |
46 |
err = br_netfilter_init(); |
c09097132 [BRIDGE]: fix mod... |
47 48 |
if (err) goto err_out2; |
712d6954e netns bridge: cle... |
49 |
err = register_netdevice_notifier(&br_device_notifier); |
32fe21c0c [BRIDGE]: Use rtn... |
50 51 |
if (err) goto err_out3; |
712d6954e netns bridge: cle... |
52 53 54 |
err = br_netlink_init(); if (err) goto err_out4; |
1da177e4c Linux-2.6.12-rc2 |
55 |
brioctl_set(br_ioctl_deviceless_stub); |
1da177e4c Linux-2.6.12-rc2 |
56 |
|
e6373c4c0 net:bridge: use I... |
57 |
#if IS_ENABLED(CONFIG_ATM_LANE) |
da6782927 bridge: Simplify ... |
58 59 |
br_fdb_test_addr_hook = br_fdb_test_addr; #endif |
1da177e4c Linux-2.6.12-rc2 |
60 |
|
1da177e4c Linux-2.6.12-rc2 |
61 |
return 0; |
712d6954e netns bridge: cle... |
62 |
err_out4: |
32fe21c0c [BRIDGE]: Use rtn... |
63 |
unregister_netdevice_notifier(&br_device_notifier); |
712d6954e netns bridge: cle... |
64 |
err_out3: |
c09097132 [BRIDGE]: fix mod... |
65 |
br_netfilter_fini(); |
712d6954e netns bridge: cle... |
66 67 |
err_out2: unregister_pernet_subsys(&br_net_ops); |
c09097132 [BRIDGE]: fix mod... |
68 |
err_out1: |
17efdd457 [BRIDGE]: Lost ca... |
69 70 |
br_fdb_fini(); err_out: |
7c85fbf06 bridge: Use STP d... |
71 |
stp_proto_unregister(&br_stp_proto); |
c09097132 [BRIDGE]: fix mod... |
72 |
return err; |
1da177e4c Linux-2.6.12-rc2 |
73 74 75 76 |
} static void __exit br_deinit(void) { |
7c85fbf06 bridge: Use STP d... |
77 |
stp_proto_unregister(&br_stp_proto); |
cf0f02d04 [BRIDGE]: use llc... |
78 |
|
11dc1f36a [BRIDGE]: netlink... |
79 |
br_netlink_fini(); |
1da177e4c Linux-2.6.12-rc2 |
80 81 |
unregister_netdevice_notifier(&br_device_notifier); brioctl_set(NULL); |
712d6954e netns bridge: cle... |
82 |
unregister_pernet_subsys(&br_net_ops); |
1da177e4c Linux-2.6.12-rc2 |
83 |
|
473c22d75 bridge: Use rcu_b... |
84 |
rcu_barrier(); /* Wait for completion of call_rcu()'s */ |
1da177e4c Linux-2.6.12-rc2 |
85 |
|
d69efb168 bridge: kernel pa... |
86 |
br_netfilter_fini(); |
e6373c4c0 net:bridge: use I... |
87 |
#if IS_ENABLED(CONFIG_ATM_LANE) |
da6782927 bridge: Simplify ... |
88 89 |
br_fdb_test_addr_hook = NULL; #endif |
1da177e4c Linux-2.6.12-rc2 |
90 |
|
1da177e4c Linux-2.6.12-rc2 |
91 92 |
br_fdb_fini(); } |
1da177e4c Linux-2.6.12-rc2 |
93 94 95 |
module_init(br_init) module_exit(br_deinit) MODULE_LICENSE("GPL"); |
8cbb512e5 [BRIDGE]: add ver... |
96 |
MODULE_VERSION(BR_VERSION); |
bb900b27a bridge: allow cre... |
97 |
MODULE_ALIAS_RTNL_LINK("bridge"); |