diff options
author | Thomas Graf <tgraf@suug.ch> | 2007-03-22 14:55:17 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:27:08 -0400 |
commit | 63f3444fb9a54c024d55f1205f8b94e7d2786595 (patch) | |
tree | 41cde0c702a2b4400a34f02380eb3baf1cc72a2b /net | |
parent | 9d9e6a5819230b5a5cc036f213135cb123ab1e50 (diff) |
[IPv4]: 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/ipv4/devinet.c | 21 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 12 | ||||
-rw-r--r-- | net/ipv4/fib_rules.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
4 files changed, 20 insertions, 23 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 043857bd151c..9bdc79564cc6 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/netdevice.h> | 48 | #include <linux/netdevice.h> |
49 | #include <linux/etherdevice.h> | 49 | #include <linux/etherdevice.h> |
50 | #include <linux/skbuff.h> | 50 | #include <linux/skbuff.h> |
51 | #include <linux/rtnetlink.h> | ||
52 | #include <linux/init.h> | 51 | #include <linux/init.h> |
53 | #include <linux/notifier.h> | 52 | #include <linux/notifier.h> |
54 | #include <linux/inetdevice.h> | 53 | #include <linux/inetdevice.h> |
@@ -62,7 +61,7 @@ | |||
62 | #include <net/ip.h> | 61 | #include <net/ip.h> |
63 | #include <net/route.h> | 62 | #include <net/route.h> |
64 | #include <net/ip_fib.h> | 63 | #include <net/ip_fib.h> |
65 | #include <net/netlink.h> | 64 | #include <net/rtnetlink.h> |
66 | 65 | ||
67 | struct ipv4_devconf ipv4_devconf = { | 66 | struct ipv4_devconf ipv4_devconf = { |
68 | .accept_redirects = 1, | 67 | .accept_redirects = 1, |
@@ -1241,19 +1240,6 @@ errout: | |||
1241 | rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err); | 1240 | rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err); |
1242 | } | 1241 | } |
1243 | 1242 | ||
1244 | static struct rtnetlink_link inet_rtnetlink_table[RTM_NR_MSGTYPES] = { | ||
1245 | [RTM_NEWADDR - RTM_BASE] = { .doit = inet_rtm_newaddr, }, | ||
1246 | [RTM_DELADDR - RTM_BASE] = { .doit = inet_rtm_deladdr, }, | ||
1247 | [RTM_GETADDR - RTM_BASE] = { .dumpit = inet_dump_ifaddr, }, | ||
1248 | [RTM_NEWROUTE - RTM_BASE] = { .doit = inet_rtm_newroute, }, | ||
1249 | [RTM_DELROUTE - RTM_BASE] = { .doit = inet_rtm_delroute, }, | ||
1250 | [RTM_GETROUTE - RTM_BASE] = { .doit = inet_rtm_getroute, | ||
1251 | .dumpit = inet_dump_fib, }, | ||
1252 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
1253 | [RTM_GETRULE - RTM_BASE] = { .dumpit = fib4_rules_dump, }, | ||
1254 | #endif | ||
1255 | }; | ||
1256 | |||
1257 | #ifdef CONFIG_SYSCTL | 1243 | #ifdef CONFIG_SYSCTL |
1258 | 1244 | ||
1259 | void inet_forward_change(void) | 1245 | void inet_forward_change(void) |
@@ -1636,7 +1622,10 @@ void __init devinet_init(void) | |||
1636 | { | 1622 | { |
1637 | register_gifconf(PF_INET, inet_gifconf); | 1623 | register_gifconf(PF_INET, inet_gifconf); |
1638 | register_netdevice_notifier(&ip_netdev_notifier); | 1624 | register_netdevice_notifier(&ip_netdev_notifier); |
1639 | rtnetlink_links[PF_INET] = inet_rtnetlink_table; | 1625 | |
1626 | rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL); | ||
1627 | rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL); | ||
1628 | rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr); | ||
1640 | #ifdef CONFIG_SYSCTL | 1629 | #ifdef CONFIG_SYSCTL |
1641 | devinet_sysctl.sysctl_header = | 1630 | devinet_sysctl.sysctl_header = |
1642 | register_sysctl_table(devinet_sysctl.devinet_root_dir); | 1631 | register_sysctl_table(devinet_sysctl.devinet_root_dir); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3ff753c6f197..5bf718a3e49b 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/if_addr.h> | 34 | #include <linux/if_addr.h> |
35 | #include <linux/if_arp.h> | 35 | #include <linux/if_arp.h> |
36 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
37 | #include <linux/netlink.h> | ||
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <linux/list.h> | 38 | #include <linux/list.h> |
40 | 39 | ||
@@ -46,6 +45,7 @@ | |||
46 | #include <net/icmp.h> | 45 | #include <net/icmp.h> |
47 | #include <net/arp.h> | 46 | #include <net/arp.h> |
48 | #include <net/ip_fib.h> | 47 | #include <net/ip_fib.h> |
48 | #include <net/rtnetlink.h> | ||
49 | 49 | ||
50 | #define FFprint(a...) printk(KERN_DEBUG a) | 50 | #define FFprint(a...) printk(KERN_DEBUG a) |
51 | 51 | ||
@@ -540,7 +540,7 @@ errout: | |||
540 | return err; | 540 | return err; |
541 | } | 541 | } |
542 | 542 | ||
543 | int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 543 | static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
544 | { | 544 | { |
545 | struct fib_config cfg; | 545 | struct fib_config cfg; |
546 | struct fib_table *tb; | 546 | struct fib_table *tb; |
@@ -561,7 +561,7 @@ errout: | |||
561 | return err; | 561 | return err; |
562 | } | 562 | } |
563 | 563 | ||
564 | int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 564 | static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
565 | { | 565 | { |
566 | struct fib_config cfg; | 566 | struct fib_config cfg; |
567 | struct fib_table *tb; | 567 | struct fib_table *tb; |
@@ -582,7 +582,7 @@ errout: | |||
582 | return err; | 582 | return err; |
583 | } | 583 | } |
584 | 584 | ||
585 | int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) | 585 | static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) |
586 | { | 586 | { |
587 | unsigned int h, s_h; | 587 | unsigned int h, s_h; |
588 | unsigned int e = 0, s_e; | 588 | unsigned int e = 0, s_e; |
@@ -925,6 +925,10 @@ void __init ip_fib_init(void) | |||
925 | register_netdevice_notifier(&fib_netdev_notifier); | 925 | register_netdevice_notifier(&fib_netdev_notifier); |
926 | register_inetaddr_notifier(&fib_inetaddr_notifier); | 926 | register_inetaddr_notifier(&fib_inetaddr_notifier); |
927 | nl_fib_lookup_init(); | 927 | nl_fib_lookup_init(); |
928 | |||
929 | rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL); | ||
930 | rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL); | ||
931 | rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib); | ||
928 | } | 932 | } |
929 | 933 | ||
930 | EXPORT_SYMBOL(inet_addr_type); | 934 | EXPORT_SYMBOL(inet_addr_type); |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index c660c074c76c..a7f931ddfaad 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -274,7 +274,7 @@ nla_put_failure: | |||
274 | return -ENOBUFS; | 274 | return -ENOBUFS; |
275 | } | 275 | } |
276 | 276 | ||
277 | int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb) | 277 | static int fib4_rule_dump(struct sk_buff *skb, struct netlink_callback *cb) |
278 | { | 278 | { |
279 | return fib_rules_dump(skb, cb, AF_INET); | 279 | return fib_rules_dump(skb, cb, AF_INET); |
280 | } | 280 | } |
@@ -327,4 +327,6 @@ void __init fib4_rules_init(void) | |||
327 | list_add_tail(&default_rule.common.list, &fib4_rules); | 327 | list_add_tail(&default_rule.common.list, &fib4_rules); |
328 | 328 | ||
329 | fib_rules_register(&fib4_rules_ops); | 329 | fib_rules_register(&fib4_rules_ops); |
330 | |||
331 | rtnl_register(PF_INET, RTM_GETRULE, NULL, fib4_rule_dump); | ||
330 | } | 332 | } |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 58417393dec1..df9fe4f2e8cc 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -82,7 +82,6 @@ | |||
82 | #include <linux/proc_fs.h> | 82 | #include <linux/proc_fs.h> |
83 | #include <linux/init.h> | 83 | #include <linux/init.h> |
84 | #include <linux/skbuff.h> | 84 | #include <linux/skbuff.h> |
85 | #include <linux/rtnetlink.h> | ||
86 | #include <linux/inetdevice.h> | 85 | #include <linux/inetdevice.h> |
87 | #include <linux/igmp.h> | 86 | #include <linux/igmp.h> |
88 | #include <linux/pkt_sched.h> | 87 | #include <linux/pkt_sched.h> |
@@ -104,6 +103,7 @@ | |||
104 | #include <net/xfrm.h> | 103 | #include <net/xfrm.h> |
105 | #include <net/ip_mp_alg.h> | 104 | #include <net/ip_mp_alg.h> |
106 | #include <net/netevent.h> | 105 | #include <net/netevent.h> |
106 | #include <net/rtnetlink.h> | ||
107 | #ifdef CONFIG_SYSCTL | 107 | #ifdef CONFIG_SYSCTL |
108 | #include <linux/sysctl.h> | 108 | #include <linux/sysctl.h> |
109 | #endif | 109 | #endif |
@@ -2721,7 +2721,7 @@ nla_put_failure: | |||
2721 | return -EMSGSIZE; | 2721 | return -EMSGSIZE; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | 2724 | static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) |
2725 | { | 2725 | { |
2726 | struct rtmsg *rtm; | 2726 | struct rtmsg *rtm; |
2727 | struct nlattr *tb[RTA_MAX+1]; | 2727 | struct nlattr *tb[RTA_MAX+1]; |
@@ -3194,6 +3194,8 @@ int __init ip_rt_init(void) | |||
3194 | xfrm_init(); | 3194 | xfrm_init(); |
3195 | xfrm4_init(); | 3195 | xfrm4_init(); |
3196 | #endif | 3196 | #endif |
3197 | rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL); | ||
3198 | |||
3197 | return rc; | 3199 | return rc; |
3198 | } | 3200 | } |
3199 | 3201 | ||