aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-22 14:58:32 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:27:13 -0400
commitc127ea2c45d1b13a672fde254679721bb282e90a (patch)
tree01569ce9d6a250b3f3e311a02ea1890327c3a36f
parentfa34ddd739cecf3999ec0b7562618e8321829d41 (diff)
[IPv6]: Use rtnl registration interface
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip6_fib.h2
-rw-r--r--include/net/ip6_route.h5
-rw-r--r--net/ipv6/addrconf.c35
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/fib6_rules.c4
-rw-r--r--net/ipv6/ip6_fib.c4
-rw-r--r--net/ipv6/route.c10
7 files changed, 31 insertions, 31 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index cf355a3c2ad5..c48ea873f1e0 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -219,8 +219,6 @@ extern void fib6_init(void);
219 219
220extern void fib6_rules_init(void); 220extern void fib6_rules_init(void);
221extern void fib6_rules_cleanup(void); 221extern void fib6_rules_cleanup(void);
222extern int fib6_rules_dump(struct sk_buff *,
223 struct netlink_callback *);
224 222
225#endif 223#endif
226#endif 224#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4e927ebd1cb3..5456fdd6d047 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr,
116 struct net_device *dev, 116 struct net_device *dev,
117 u32 pmtu); 117 u32 pmtu);
118 118
119struct nlmsghdr;
120struct netlink_callback; 119struct netlink_callback;
121extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
122extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
123extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
124extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
125 120
126struct rt6_rtnl_dump_arg 121struct rt6_rtnl_dump_arg
127{ 122{
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 38274c20eaa2..eecba1886b49 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3613,23 +3613,6 @@ errout:
3613 rtnl_set_sk_err(RTNLGRP_IPV6_PREFIX, err); 3613 rtnl_set_sk_err(RTNLGRP_IPV6_PREFIX, err);
3614} 3614}
3615 3615
3616static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = {
3617 [RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, },
3618 [RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, },
3619 [RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, },
3620 [RTM_GETADDR - RTM_BASE] = { .doit = inet6_rtm_getaddr,
3621 .dumpit = inet6_dump_ifaddr, },
3622 [RTM_GETMULTICAST - RTM_BASE] = { .dumpit = inet6_dump_ifmcaddr, },
3623 [RTM_GETANYCAST - RTM_BASE] = { .dumpit = inet6_dump_ifacaddr, },
3624 [RTM_NEWROUTE - RTM_BASE] = { .doit = inet6_rtm_newroute, },
3625 [RTM_DELROUTE - RTM_BASE] = { .doit = inet6_rtm_delroute, },
3626 [RTM_GETROUTE - RTM_BASE] = { .doit = inet6_rtm_getroute,
3627 .dumpit = inet6_dump_fib, },
3628#ifdef CONFIG_IPV6_MULTIPLE_TABLES
3629 [RTM_GETRULE - RTM_BASE] = { .dumpit = fib6_rules_dump, },
3630#endif
3631};
3632
3633static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3616static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
3634{ 3617{
3635 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 3618 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp);
@@ -4149,7 +4132,18 @@ int __init addrconf_init(void)
4149 register_netdevice_notifier(&ipv6_dev_notf); 4132 register_netdevice_notifier(&ipv6_dev_notf);
4150 4133
4151 addrconf_verify(0); 4134 addrconf_verify(0);
4152 rtnetlink_links[PF_INET6] = inet6_rtnetlink_table; 4135
4136 err = __rtnl_register(PF_INET6, RTM_GETLINK, NULL, inet6_dump_ifinfo);
4137 if (err < 0)
4138 goto errout;
4139
4140 /* Only the first call to __rtnl_register can fail */
4141 __rtnl_register(PF_INET6, RTM_NEWADDR, inet6_rtm_newaddr, NULL);
4142 __rtnl_register(PF_INET6, RTM_DELADDR, inet6_rtm_deladdr, NULL);
4143 __rtnl_register(PF_INET6, RTM_GETADDR, inet6_rtm_getaddr, inet6_dump_ifaddr);
4144 __rtnl_register(PF_INET6, RTM_GETMULTICAST, NULL, inet6_dump_ifmcaddr);
4145 __rtnl_register(PF_INET6, RTM_GETANYCAST, NULL, inet6_dump_ifacaddr);
4146
4153#ifdef CONFIG_SYSCTL 4147#ifdef CONFIG_SYSCTL
4154 addrconf_sysctl.sysctl_header = 4148 addrconf_sysctl.sysctl_header =
4155 register_sysctl_table(addrconf_sysctl.addrconf_root_dir); 4149 register_sysctl_table(addrconf_sysctl.addrconf_root_dir);
@@ -4157,6 +4151,10 @@ int __init addrconf_init(void)
4157#endif 4151#endif
4158 4152
4159 return 0; 4153 return 0;
4154errout:
4155 unregister_netdevice_notifier(&ipv6_dev_notf);
4156
4157 return err;
4160} 4158}
4161 4159
4162void __exit addrconf_cleanup(void) 4160void __exit addrconf_cleanup(void)
@@ -4168,7 +4166,6 @@ void __exit addrconf_cleanup(void)
4168 4166
4169 unregister_netdevice_notifier(&ipv6_dev_notf); 4167 unregister_netdevice_notifier(&ipv6_dev_notf);
4170 4168
4171 rtnetlink_links[PF_INET6] = NULL;
4172#ifdef CONFIG_SYSCTL 4169#ifdef CONFIG_SYSCTL
4173 addrconf_sysctl_unregister(&ipv6_devconf_dflt); 4170 addrconf_sysctl_unregister(&ipv6_devconf_dflt);
4174 addrconf_sysctl_unregister(&ipv6_devconf); 4171 addrconf_sysctl_unregister(&ipv6_devconf);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 7b917f856e1c..82572b507547 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -945,6 +945,8 @@ static void __exit inet6_exit(void)
945{ 945{
946 /* First of all disallow new sockets creation. */ 946 /* First of all disallow new sockets creation. */
947 sock_unregister(PF_INET6); 947 sock_unregister(PF_INET6);
948 /* Disallow any further netlink messages */
949 rtnl_unregister_all(PF_INET6);
948 950
949 /* Cleanup code parts. */ 951 /* Cleanup code parts. */
950 ipv6_packet_cleanup(); 952 ipv6_packet_cleanup();
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index ea3035b4e3e8..c74da4b6dd2f 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -216,7 +216,7 @@ nla_put_failure:
216 return -ENOBUFS; 216 return -ENOBUFS;
217} 217}
218 218
219int fib6_rules_dump(struct sk_buff *skb, struct netlink_callback *cb) 219static int fib6_rules_dump(struct sk_buff *skb, struct netlink_callback *cb)
220{ 220{
221 return fib_rules_dump(skb, cb, AF_INET6); 221 return fib_rules_dump(skb, cb, AF_INET6);
222} 222}
@@ -255,9 +255,11 @@ void __init fib6_rules_init(void)
255 list_add_tail(&main_rule.common.list, &fib6_rules); 255 list_add_tail(&main_rule.common.list, &fib6_rules);
256 256
257 fib_rules_register(&fib6_rules_ops); 257 fib_rules_register(&fib6_rules_ops);
258 __rtnl_register(PF_INET6, RTM_GETRULE, NULL, fib6_rules_dump);
258} 259}
259 260
260void fib6_rules_cleanup(void) 261void fib6_rules_cleanup(void)
261{ 262{
263 rtnl_unregister(PF_INET6, RTM_GETRULE);
262 fib_rules_unregister(&fib6_rules_ops); 264 fib_rules_unregister(&fib6_rules_ops);
263} 265}
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 268f476ef3db..ca08ee88d07f 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -359,7 +359,7 @@ end:
359 return res; 359 return res;
360} 360}
361 361
362int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) 362static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
363{ 363{
364 unsigned int h, s_h; 364 unsigned int h, s_h;
365 unsigned int e = 0, s_e; 365 unsigned int e = 0, s_e;
@@ -1486,6 +1486,8 @@ void __init fib6_init(void)
1486 NULL, NULL); 1486 NULL, NULL);
1487 1487
1488 fib6_tables_init(); 1488 fib6_tables_init();
1489
1490 __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
1489} 1491}
1490 1492
1491void fib6_gc_cleanup(void) 1493void fib6_gc_cleanup(void)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 52cbe1cd4045..70f760f069b1 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2015,7 +2015,7 @@ errout:
2015 return err; 2015 return err;
2016} 2016}
2017 2017
2018int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 2018static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2019{ 2019{
2020 struct fib6_config cfg; 2020 struct fib6_config cfg;
2021 int err; 2021 int err;
@@ -2027,7 +2027,7 @@ int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2027 return ip6_route_del(&cfg); 2027 return ip6_route_del(&cfg);
2028} 2028}
2029 2029
2030int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 2030static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
2031{ 2031{
2032 struct fib6_config cfg; 2032 struct fib6_config cfg;
2033 int err; 2033 int err;
@@ -2164,7 +2164,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
2164 prefix, NLM_F_MULTI); 2164 prefix, NLM_F_MULTI);
2165} 2165}
2166 2166
2167int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) 2167static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2168{ 2168{
2169 struct nlattr *tb[RTA_MAX+1]; 2169 struct nlattr *tb[RTA_MAX+1];
2170 struct rt6_info *rt; 2170 struct rt6_info *rt;
@@ -2508,6 +2508,10 @@ void __init ip6_route_init(void)
2508#ifdef CONFIG_IPV6_MULTIPLE_TABLES 2508#ifdef CONFIG_IPV6_MULTIPLE_TABLES
2509 fib6_rules_init(); 2509 fib6_rules_init();
2510#endif 2510#endif
2511
2512 __rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL);
2513 __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL);
2514 __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL);
2511} 2515}
2512 2516
2513void ip6_route_cleanup(void) 2517void ip6_route_cleanup(void)