aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
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 /net/ipv6/addrconf.c
parentfa34ddd739cecf3999ec0b7562618e8321829d41 (diff)
[IPv6]: 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/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c35
1 files changed, 16 insertions, 19 deletions
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);