aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-22 14:50:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:27:06 -0400
commitc8822a4e00442e65d42d50db8e529d75c2025630 (patch)
tree127ce686af9e562e997d75ecabb6c7acca4c0b12 /net
parent340d17fc9d577c93678850e46963e9b19b92db7e (diff)
[NEIGH]: 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/core/neighbour.c26
-rw-r--r--net/core/rtnetlink.c5
2 files changed, 19 insertions, 12 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 61a4713a5df3..6f3bb73053c2 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1441,7 +1441,7 @@ int neigh_table_clear(struct neigh_table *tbl)
1441 return 0; 1441 return 0;
1442} 1442}
1443 1443
1444int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 1444static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1445{ 1445{
1446 struct ndmsg *ndm; 1446 struct ndmsg *ndm;
1447 struct nlattr *dst_attr; 1447 struct nlattr *dst_attr;
@@ -1506,7 +1506,7 @@ out:
1506 return err; 1506 return err;
1507} 1507}
1508 1508
1509int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 1509static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1510{ 1510{
1511 struct ndmsg *ndm; 1511 struct ndmsg *ndm;
1512 struct nlattr *tb[NDA_MAX+1]; 1512 struct nlattr *tb[NDA_MAX+1];
@@ -1786,7 +1786,7 @@ static struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] __read_mostly = {
1786 [NDTPA_LOCKTIME] = { .type = NLA_U64 }, 1786 [NDTPA_LOCKTIME] = { .type = NLA_U64 },
1787}; 1787};
1788 1788
1789int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 1789static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1790{ 1790{
1791 struct neigh_table *tbl; 1791 struct neigh_table *tbl;
1792 struct ndtmsg *ndtmsg; 1792 struct ndtmsg *ndtmsg;
@@ -1910,7 +1910,7 @@ errout:
1910 return err; 1910 return err;
1911} 1911}
1912 1912
1913int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) 1913static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
1914{ 1914{
1915 int family, tidx, nidx = 0; 1915 int family, tidx, nidx = 0;
1916 int tbl_skip = cb->args[0]; 1916 int tbl_skip = cb->args[0];
@@ -2034,7 +2034,7 @@ out:
2034 return rc; 2034 return rc;
2035} 2035}
2036 2036
2037int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) 2037static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
2038{ 2038{
2039 struct neigh_table *tbl; 2039 struct neigh_table *tbl;
2040 int t, family, s_t; 2040 int t, family, s_t;
@@ -2746,14 +2746,26 @@ void neigh_sysctl_unregister(struct neigh_parms *p)
2746 2746
2747#endif /* CONFIG_SYSCTL */ 2747#endif /* CONFIG_SYSCTL */
2748 2748
2749static int __init neigh_init(void)
2750{
2751 rtnl_register(PF_UNSPEC, RTM_NEWNEIGH, neigh_add, NULL);
2752 rtnl_register(PF_UNSPEC, RTM_DELNEIGH, neigh_delete, NULL);
2753 rtnl_register(PF_UNSPEC, RTM_GETNEIGH, NULL, neigh_dump_info);
2754
2755 rtnl_register(PF_UNSPEC, RTM_GETNEIGHTBL, NULL, neightbl_dump_info);
2756 rtnl_register(PF_UNSPEC, RTM_SETNEIGHTBL, neightbl_set, NULL);
2757
2758 return 0;
2759}
2760
2761subsys_initcall(neigh_init);
2762
2749EXPORT_SYMBOL(__neigh_event_send); 2763EXPORT_SYMBOL(__neigh_event_send);
2750EXPORT_SYMBOL(neigh_changeaddr); 2764EXPORT_SYMBOL(neigh_changeaddr);
2751EXPORT_SYMBOL(neigh_compat_output); 2765EXPORT_SYMBOL(neigh_compat_output);
2752EXPORT_SYMBOL(neigh_connected_output); 2766EXPORT_SYMBOL(neigh_connected_output);
2753EXPORT_SYMBOL(neigh_create); 2767EXPORT_SYMBOL(neigh_create);
2754EXPORT_SYMBOL(neigh_delete);
2755EXPORT_SYMBOL(neigh_destroy); 2768EXPORT_SYMBOL(neigh_destroy);
2756EXPORT_SYMBOL(neigh_dump_info);
2757EXPORT_SYMBOL(neigh_event_ns); 2769EXPORT_SYMBOL(neigh_event_ns);
2758EXPORT_SYMBOL(neigh_ifdown); 2770EXPORT_SYMBOL(neigh_ifdown);
2759EXPORT_SYMBOL(neigh_lookup); 2771EXPORT_SYMBOL(neigh_lookup);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 835137320001..3044702f7d9b 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -963,16 +963,11 @@ static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
963{ 963{
964 [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all }, 964 [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
965 [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all }, 965 [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
966 [RTM_NEWNEIGH - RTM_BASE] = { .doit = neigh_add },
967 [RTM_DELNEIGH - RTM_BASE] = { .doit = neigh_delete },
968 [RTM_GETNEIGH - RTM_BASE] = { .dumpit = neigh_dump_info },
969#ifdef CONFIG_FIB_RULES 966#ifdef CONFIG_FIB_RULES
970 [RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule }, 967 [RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule },
971 [RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule }, 968 [RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule },
972#endif 969#endif
973 [RTM_GETRULE - RTM_BASE] = { .dumpit = rtnl_dump_all }, 970 [RTM_GETRULE - RTM_BASE] = { .dumpit = rtnl_dump_all },
974 [RTM_GETNEIGHTBL - RTM_BASE] = { .dumpit = neightbl_dump_info },
975 [RTM_SETNEIGHTBL - RTM_BASE] = { .doit = neightbl_set },
976}; 971};
977 972
978static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr) 973static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)