diff options
author | Thomas Graf <tgraf@suug.ch> | 2007-03-22 14:57:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:27:12 -0400 |
commit | fa34ddd739cecf3999ec0b7562618e8321829d41 (patch) | |
tree | ddc3534b56faca48077922cddbbb79e9b5b0c1ea | |
parent | 708914cc5e1657eb1a1f9eefc6333dfd2df8c73a (diff) |
[DECNet]: Use rtnl registration interface
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/dn_fib.h | 9 | ||||
-rw-r--r-- | include/net/dn_route.h | 1 | ||||
-rw-r--r-- | net/decnet/af_decnet.c | 1 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 24 | ||||
-rw-r--r-- | net/decnet/dn_fib.c | 8 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 9 | ||||
-rw-r--r-- | net/decnet/dn_rules.c | 4 |
7 files changed, 20 insertions, 36 deletions
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index f01626cbbed6..30125119c950 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void); | |||
148 | extern unsigned dnet_addr_type(__le16 addr); | 148 | extern unsigned dnet_addr_type(__le16 addr); |
149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
150 | 150 | ||
151 | /* | ||
152 | * rtnetlink interface | ||
153 | */ | ||
154 | extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
155 | extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
156 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 151 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
157 | 152 | ||
158 | extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
159 | extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
160 | extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
161 | |||
162 | extern void dn_fib_free_info(struct dn_fib_info *fi); | 153 | extern void dn_fib_free_info(struct dn_fib_info *fi); |
163 | 154 | ||
164 | static inline void dn_fib_info_put(struct dn_fib_info *fi) | 155 | static inline void dn_fib_info_put(struct dn_fib_info *fi) |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index a566944c4962..c10e8e7e59a7 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -18,7 +18,6 @@ | |||
18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); | 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); |
19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); | 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); |
20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
21 | extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
22 | extern void dn_rt_cache_flush(int delay); | 21 | extern void dn_rt_cache_flush(int delay); |
23 | 22 | ||
24 | /* Masks for flags field */ | 23 | /* Masks for flags field */ |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index c6568d637e1a..a205eaa87f52 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -2413,6 +2413,7 @@ module_init(decnet_init); | |||
2413 | static void __exit decnet_exit(void) | 2413 | static void __exit decnet_exit(void) |
2414 | { | 2414 | { |
2415 | sock_unregister(AF_DECnet); | 2415 | sock_unregister(AF_DECnet); |
2416 | rtnl_unregister_all(PF_DECnet); | ||
2416 | dev_remove_pack(&dn_dix_packet_type); | 2417 | dev_remove_pack(&dn_dix_packet_type); |
2417 | 2418 | ||
2418 | dn_unregister_sysctl(); | 2419 | dn_unregister_sysctl(); |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 95871a669dc4..61be2caddc57 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -1447,24 +1447,6 @@ static const struct file_operations dn_dev_seq_fops = { | |||
1447 | 1447 | ||
1448 | #endif /* CONFIG_PROC_FS */ | 1448 | #endif /* CONFIG_PROC_FS */ |
1449 | 1449 | ||
1450 | static struct rtnetlink_link dnet_rtnetlink_table[RTM_NR_MSGTYPES] = | ||
1451 | { | ||
1452 | [RTM_NEWADDR - RTM_BASE] = { .doit = dn_nl_newaddr, }, | ||
1453 | [RTM_DELADDR - RTM_BASE] = { .doit = dn_nl_deladdr, }, | ||
1454 | [RTM_GETADDR - RTM_BASE] = { .dumpit = dn_nl_dump_ifaddr, }, | ||
1455 | #ifdef CONFIG_DECNET_ROUTER | ||
1456 | [RTM_NEWROUTE - RTM_BASE] = { .doit = dn_fib_rtm_newroute, }, | ||
1457 | [RTM_DELROUTE - RTM_BASE] = { .doit = dn_fib_rtm_delroute, }, | ||
1458 | [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute, | ||
1459 | .dumpit = dn_fib_dump, }, | ||
1460 | [RTM_GETRULE - RTM_BASE] = { .dumpit = dn_fib_dump_rules, }, | ||
1461 | #else | ||
1462 | [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute, | ||
1463 | .dumpit = dn_cache_dump, }, | ||
1464 | #endif | ||
1465 | |||
1466 | }; | ||
1467 | |||
1468 | static int __initdata addr[2]; | 1450 | static int __initdata addr[2]; |
1469 | module_param_array(addr, int, NULL, 0444); | 1451 | module_param_array(addr, int, NULL, 0444); |
1470 | MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); | 1452 | MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); |
@@ -1485,7 +1467,9 @@ void __init dn_dev_init(void) | |||
1485 | 1467 | ||
1486 | dn_dev_devices_on(); | 1468 | dn_dev_devices_on(); |
1487 | 1469 | ||
1488 | rtnetlink_links[PF_DECnet] = dnet_rtnetlink_table; | 1470 | rtnl_register(PF_DECnet, RTM_NEWADDR, dn_nl_newaddr, NULL); |
1471 | rtnl_register(PF_DECnet, RTM_DELADDR, dn_nl_deladdr, NULL); | ||
1472 | rtnl_register(PF_DECnet, RTM_GETADDR, NULL, dn_nl_dump_ifaddr); | ||
1489 | 1473 | ||
1490 | proc_net_fops_create("decnet_dev", S_IRUGO, &dn_dev_seq_fops); | 1474 | proc_net_fops_create("decnet_dev", S_IRUGO, &dn_dev_seq_fops); |
1491 | 1475 | ||
@@ -1500,8 +1484,6 @@ void __init dn_dev_init(void) | |||
1500 | 1484 | ||
1501 | void __exit dn_dev_cleanup(void) | 1485 | void __exit dn_dev_cleanup(void) |
1502 | { | 1486 | { |
1503 | rtnetlink_links[PF_DECnet] = NULL; | ||
1504 | |||
1505 | #ifdef CONFIG_SYSCTL | 1487 | #ifdef CONFIG_SYSCTL |
1506 | { | 1488 | { |
1507 | int i; | 1489 | int i; |
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 82d58a977e6f..310a86268d2b 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -504,7 +504,7 @@ static int dn_fib_check_attr(struct rtmsg *r, struct rtattr **rta) | |||
504 | return 0; | 504 | return 0; |
505 | } | 505 | } |
506 | 506 | ||
507 | int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 507 | static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
508 | { | 508 | { |
509 | struct dn_fib_table *tb; | 509 | struct dn_fib_table *tb; |
510 | struct rtattr **rta = arg; | 510 | struct rtattr **rta = arg; |
@@ -520,7 +520,7 @@ int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
520 | return -ESRCH; | 520 | return -ESRCH; |
521 | } | 521 | } |
522 | 522 | ||
523 | int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 523 | static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
524 | { | 524 | { |
525 | struct dn_fib_table *tb; | 525 | struct dn_fib_table *tb; |
526 | struct rtattr **rta = arg; | 526 | struct rtattr **rta = arg; |
@@ -748,11 +748,13 @@ void __exit dn_fib_cleanup(void) | |||
748 | 748 | ||
749 | void __init dn_fib_init(void) | 749 | void __init dn_fib_init(void) |
750 | { | 750 | { |
751 | |||
752 | dn_fib_table_init(); | 751 | dn_fib_table_init(); |
753 | dn_fib_rules_init(); | 752 | dn_fib_rules_init(); |
754 | 753 | ||
755 | register_dnaddr_notifier(&dn_fib_dnaddr_notifier); | 754 | register_dnaddr_notifier(&dn_fib_dnaddr_notifier); |
755 | |||
756 | rtnl_register(PF_DECnet, RTM_NEWROUTE, dn_fib_rtm_newroute, NULL); | ||
757 | rtnl_register(PF_DECnet, RTM_DELROUTE, dn_fib_rtm_delroute, NULL); | ||
756 | } | 758 | } |
757 | 759 | ||
758 | 760 | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 2ae35ef1f077..5d7337bcf0fe 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1522,7 +1522,7 @@ rtattr_failure: | |||
1522 | /* | 1522 | /* |
1523 | * This is called by both endnodes and routers now. | 1523 | * This is called by both endnodes and routers now. |
1524 | */ | 1524 | */ |
1525 | int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg) | 1525 | static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg) |
1526 | { | 1526 | { |
1527 | struct rtattr **rta = arg; | 1527 | struct rtattr **rta = arg; |
1528 | struct rtmsg *rtm = NLMSG_DATA(nlh); | 1528 | struct rtmsg *rtm = NLMSG_DATA(nlh); |
@@ -1813,6 +1813,13 @@ void __init dn_route_init(void) | |||
1813 | dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); | 1813 | dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1); |
1814 | 1814 | ||
1815 | proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); | 1815 | proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops); |
1816 | |||
1817 | #ifdef CONFIG_DECNET_ROUTER | ||
1818 | rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump); | ||
1819 | #else | ||
1820 | rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, | ||
1821 | dn_cache_dump); | ||
1822 | #endif | ||
1816 | } | 1823 | } |
1817 | 1824 | ||
1818 | void __exit dn_route_cleanup(void) | 1825 | void __exit dn_route_cleanup(void) |
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index 5e86dd542302..a7a7da9b35c3 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c | |||
@@ -239,7 +239,7 @@ static u32 dn_fib_rule_default_pref(void) | |||
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
241 | 241 | ||
242 | int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb) | 242 | static int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb) |
243 | { | 243 | { |
244 | return fib_rules_dump(skb, cb, AF_DECnet); | 244 | return fib_rules_dump(skb, cb, AF_DECnet); |
245 | } | 245 | } |
@@ -264,10 +264,12 @@ void __init dn_fib_rules_init(void) | |||
264 | { | 264 | { |
265 | list_add_tail(&default_rule.common.list, &dn_fib_rules); | 265 | list_add_tail(&default_rule.common.list, &dn_fib_rules); |
266 | fib_rules_register(&dn_fib_rules_ops); | 266 | fib_rules_register(&dn_fib_rules_ops); |
267 | rtnl_register(PF_DECnet, RTM_GETRULE, NULL, dn_fib_dump_rules); | ||
267 | } | 268 | } |
268 | 269 | ||
269 | void __exit dn_fib_rules_cleanup(void) | 270 | void __exit dn_fib_rules_cleanup(void) |
270 | { | 271 | { |
272 | rtnl_unregister(PF_DECnet, RTM_GETRULE); | ||
271 | fib_rules_unregister(&dn_fib_rules_ops); | 273 | fib_rules_unregister(&dn_fib_rules_ops); |
272 | } | 274 | } |
273 | 275 | ||