aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-22 14:59:03 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:27:14 -0400
commit32fe21c0c0a3091552fea8f2f7e4905f547a3433 (patch)
tree179ec6ee7c2a40d06cab648ff32ade987c81e05c /net
parentc127ea2c45d1b13a672fde254679721bb282e90a (diff)
[BRIDGE]: Use rtnl registration interface
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br.c8
-rw-r--r--net/bridge/br_netlink.c20
-rw-r--r--net/bridge/br_private.h2
3 files changed, 17 insertions, 13 deletions
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 2994387999a8..601c37d61c03 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -47,7 +47,10 @@ static int __init br_init(void)
47 if (err) 47 if (err)
48 goto err_out2; 48 goto err_out2;
49 49
50 br_netlink_init(); 50 err = br_netlink_init();
51 if (err)
52 goto err_out3;
53
51 brioctl_set(br_ioctl_deviceless_stub); 54 brioctl_set(br_ioctl_deviceless_stub);
52 br_handle_frame_hook = br_handle_frame; 55 br_handle_frame_hook = br_handle_frame;
53 56
@@ -55,7 +58,8 @@ static int __init br_init(void)
55 br_fdb_put_hook = br_fdb_put; 58 br_fdb_put_hook = br_fdb_put;
56 59
57 return 0; 60 return 0;
58 61err_out3:
62 unregister_netdevice_notifier(&br_device_notifier);
59err_out2: 63err_out2:
60 br_netfilter_fini(); 64 br_netfilter_fini();
61err_out1: 65err_out1:
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 7d68b24b5654..a14ac51753e6 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -11,8 +11,7 @@
11 */ 11 */
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/rtnetlink.h> 14#include <net/rtnetlink.h>
15#include <net/netlink.h>
16#include "br_private.h" 15#include "br_private.h"
17 16
18static inline size_t br_nlmsg_size(void) 17static inline size_t br_nlmsg_size(void)
@@ -179,18 +178,19 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
179} 178}
180 179
181 180
182static struct rtnetlink_link bridge_rtnetlink_table[RTM_NR_MSGTYPES] = { 181int __init br_netlink_init(void)
183 [RTM_GETLINK - RTM_BASE] = { .dumpit = br_dump_ifinfo, },
184 [RTM_SETLINK - RTM_BASE] = { .doit = br_rtm_setlink, },
185};
186
187void __init br_netlink_init(void)
188{ 182{
189 rtnetlink_links[PF_BRIDGE] = bridge_rtnetlink_table; 183 if (__rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, br_dump_ifinfo))
184 return -ENOBUFS;
185
186 /* Only the first call to __rtnl_register can fail */
187 __rtnl_register(PF_BRIDGE, RTM_SETLINK, br_rtm_setlink, NULL);
188
189 return 0;
190} 190}
191 191
192void __exit br_netlink_fini(void) 192void __exit br_netlink_fini(void)
193{ 193{
194 rtnetlink_links[PF_BRIDGE] = NULL; 194 rtnl_unregister_all(PF_BRIDGE);
195} 195}
196 196
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index cc3f1c99261a..2b73de6c0b47 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -235,7 +235,7 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
235 235
236 236
237/* br_netlink.c */ 237/* br_netlink.c */
238extern void br_netlink_init(void); 238extern int br_netlink_init(void);
239extern void br_netlink_fini(void); 239extern void br_netlink_fini(void);
240extern void br_ifinfo_notify(int event, struct net_bridge_port *port); 240extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
241 241