Commit 251c42cc authored by Stephen Hemminger's avatar Stephen Hemminger

[IPV6]: Notifier replay changes

Change IPV6 to handle the new case where netdev events are replayed on registration:
* change code ordering so address configuration is ready before registration
  (this was actually a bug in existing code)
* take out code that capture's existing devices, this is now done in the replay
* make notifier code local to addrconf.c so it can be have smaller scope
parent 75bfe33f
......@@ -50,10 +50,6 @@ struct prefix_info {
extern void addrconf_init(void);
extern void addrconf_cleanup(void);
extern int addrconf_notify(struct notifier_block *this,
unsigned long event,
void * data);
extern int addrconf_add_ifaddr(void *arg);
extern int addrconf_del_ifaddr(void *arg);
extern int addrconf_set_dstaddr(void *arg);
......
......@@ -401,12 +401,8 @@ extern int ipv6_getsockopt(struct sock *sk, int level,
extern void ipv6_packet_init(void);
extern void ipv6_netdev_notif_init(void);
extern void ipv6_packet_cleanup(void);
extern void ipv6_netdev_notif_cleanup(void);
extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 port,
u32 info, u8 *payload);
......
......@@ -1858,7 +1858,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
addrconf_add_mroute(dev);
}
int addrconf_notify(struct notifier_block *this, unsigned long event,
static int addrconf_notify(struct notifier_block *this, unsigned long event,
void * data)
{
struct net_device *dev = (struct net_device *) data;
......@@ -1931,6 +1931,14 @@ int addrconf_notify(struct notifier_block *this, unsigned long event,
return NOTIFY_OK;
}
/*
* addrconf module should be notified of a device going up
*/
static struct notifier_block ipv6_dev_notf = {
.notifier_call = addrconf_notify,
.priority = 0
};
static int addrconf_ifdown(struct net_device *dev, int how)
{
struct inet6_dev *idev;
......@@ -3179,9 +3187,7 @@ int unregister_inet6addr_notifier(struct notifier_block *nb)
void __init addrconf_init(void)
{
#ifdef MODULE
struct net_device *dev;
#endif
register_netdevice_notifier(&ipv6_dev_notf);
#ifdef CONFIG_IPV6_PRIVACY
md5_tfm = crypto_alloc_tfm("md5", 0);
......@@ -3190,30 +3196,6 @@ void __init addrconf_init(void)
"failed to load transform for md5\n");
#endif
#ifdef MODULE
/* This takes sense only during module load. */
rtnl_lock();
for (dev = dev_base; dev; dev = dev->next) {
if (!(dev->flags&IFF_UP))
continue;
switch (dev->type) {
case ARPHRD_LOOPBACK:
init_loopback(dev);
break;
case ARPHRD_ETHER:
case ARPHRD_FDDI:
case ARPHRD_IEEE802_TR:
case ARPHRD_ARCNET:
addrconf_dev_config(dev);
break;
default:;
/* Ignore all other */
}
}
rtnl_unlock();
#endif
addrconf_verify(0);
rtnetlink_links[PF_INET6] = inet6_rtnetlink_table;
#ifdef CONFIG_SYSCTL
......@@ -3231,6 +3213,8 @@ void addrconf_cleanup(void)
struct inet6_ifaddr *ifa;
int i;
unregister_netdevice_notifier(&ipv6_dev_notf);
rtnetlink_links[PF_INET6] = NULL;
#ifdef CONFIG_SYSCTL
addrconf_sysctl_unregister(&ipv6_devconf_dflt);
......@@ -3284,3 +3268,4 @@ void addrconf_cleanup(void)
#endif
}
#endif /* MODULE */
......@@ -802,7 +802,6 @@ static int __init inet6_init(void)
if (if6_proc_init())
goto proc_if6_fail;
#endif
ipv6_netdev_notif_init();
ipv6_packet_init();
ip6_route_init();
ip6_flowlabel_init();
......@@ -869,7 +868,6 @@ static void inet6_exit(void)
#endif
/* Cleanup code parts. */
sit_cleanup();
ipv6_netdev_notif_cleanup();
ip6_flowlabel_cleanup();
addrconf_cleanup();
ip6_route_cleanup();
......
......@@ -62,14 +62,6 @@ static struct packet_type ipv6_packet_type = {
.func = ipv6_rcv,
};
/*
* addrconf module should be notified of a device going up
*/
static struct notifier_block ipv6_dev_notf = {
.notifier_call = addrconf_notify,
.priority = 0
};
struct ip6_ra_chain *ip6_ra_chain;
rwlock_t ip6_ra_lock = RW_LOCK_UNLOCKED;
......@@ -707,19 +699,9 @@ void __init ipv6_packet_init(void)
dev_add_pack(&ipv6_packet_type);
}
void __init ipv6_netdev_notif_init(void)
{
register_netdevice_notifier(&ipv6_dev_notf);
}
#ifdef MODULE
void ipv6_packet_cleanup(void)
{
dev_remove_pack(&ipv6_packet_type);
}
void ipv6_netdev_notif_cleanup(void)
{
unregister_netdevice_notifier(&ipv6_dev_notf);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment