Skip to content

Commit

Permalink
[BRIDGE]: Use rtnl registration interface
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Graf <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tgraf authored and David S. Miller committed Apr 26, 2007
1 parent c127ea2 commit 32fe21c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
8 changes: 6 additions & 2 deletions net/bridge/br.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,19 @@ static int __init br_init(void)
if (err)
goto err_out2;

br_netlink_init();
err = br_netlink_init();
if (err)
goto err_out3;

brioctl_set(br_ioctl_deviceless_stub);
br_handle_frame_hook = br_handle_frame;

br_fdb_get_hook = br_fdb_get;
br_fdb_put_hook = br_fdb_put;

return 0;

err_out3:
unregister_netdevice_notifier(&br_device_notifier);
err_out2:
br_netfilter_fini();
err_out1:
Expand Down
20 changes: 10 additions & 10 deletions net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/

#include <linux/kernel.h>
#include <linux/rtnetlink.h>
#include <net/netlink.h>
#include <net/rtnetlink.h>
#include "br_private.h"

static inline size_t br_nlmsg_size(void)
Expand Down Expand Up @@ -179,18 +178,19 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
}


static struct rtnetlink_link bridge_rtnetlink_table[RTM_NR_MSGTYPES] = {
[RTM_GETLINK - RTM_BASE] = { .dumpit = br_dump_ifinfo, },
[RTM_SETLINK - RTM_BASE] = { .doit = br_rtm_setlink, },
};

void __init br_netlink_init(void)
int __init br_netlink_init(void)
{
rtnetlink_links[PF_BRIDGE] = bridge_rtnetlink_table;
if (__rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, br_dump_ifinfo))
return -ENOBUFS;

/* Only the first call to __rtnl_register can fail */
__rtnl_register(PF_BRIDGE, RTM_SETLINK, br_rtm_setlink, NULL);

return 0;
}

void __exit br_netlink_fini(void)
{
rtnetlink_links[PF_BRIDGE] = NULL;
rtnl_unregister_all(PF_BRIDGE);
}

2 changes: 1 addition & 1 deletion net/bridge/br_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);


/* br_netlink.c */
extern void br_netlink_init(void);
extern int br_netlink_init(void);
extern void br_netlink_fini(void);
extern void br_ifinfo_notify(int event, struct net_bridge_port *port);

Expand Down

0 comments on commit 32fe21c

Please sign in to comment.