Commit 97d10a80 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[IPV6]: Make sure temporary addresses are regenerated properly.

parent 506371b1
...@@ -2015,6 +2015,9 @@ static void addrconf_verify(unsigned long foo) ...@@ -2015,6 +2015,9 @@ static void addrconf_verify(unsigned long foo)
write_lock(&addrconf_hash_lock); write_lock(&addrconf_hash_lock);
for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) { for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) {
unsigned long age; unsigned long age;
#ifdef CONFIG_IPV6_PRIVACY
unsigned long regen_advance;
#endif
if (ifp->flags & IFA_F_PERMANENT) if (ifp->flags & IFA_F_PERMANENT)
continue; continue;
...@@ -2022,6 +2025,12 @@ static void addrconf_verify(unsigned long foo) ...@@ -2022,6 +2025,12 @@ static void addrconf_verify(unsigned long foo)
spin_lock(&ifp->lock); spin_lock(&ifp->lock);
age = (now - ifp->tstamp) / HZ; age = (now - ifp->tstamp) / HZ;
#ifdef CONFIG_IPV6_PRIVACY
regen_advance = ifp->idev->cnf.regen_max_retry *
ifp->idev->cnf.dad_transmits *
ifp->idev->nd_parms->retrans_time / HZ;
#endif
if (age >= ifp->valid_lft) { if (age >= ifp->valid_lft) {
spin_unlock(&ifp->lock); spin_unlock(&ifp->lock);
in6_ifa_hold(ifp); in6_ifa_hold(ifp);
...@@ -2050,6 +2059,28 @@ static void addrconf_verify(unsigned long foo) ...@@ -2050,6 +2059,28 @@ static void addrconf_verify(unsigned long foo)
in6_ifa_put(ifp); in6_ifa_put(ifp);
goto restart; goto restart;
} }
#ifdef CONFIG_IPV6_PRIVACY
} else if ((ifp->flags&IFA_F_TEMPORARY) &&
!(ifp->flags&IFA_F_TENTATIVE)) {
if (age >= ifp->prefered_lft - regen_advance) {
struct inet6_ifaddr *ifpub = ifp->ifpub;
if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next))
next = ifp->tstamp + ifp->prefered_lft * HZ;
if (!ifp->regen_count && ifpub) {
ifp->regen_count++;
in6_ifa_hold(ifp);
in6_ifa_hold(ifpub);
spin_unlock(&ifp->lock);
write_unlock(&addrconf_hash_lock);
ipv6_create_tempaddr(ifpub, ifp);
in6_ifa_put(ifpub);
in6_ifa_put(ifp);
goto restart;
}
} else if (time_before(ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ, next))
next = ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ;
spin_unlock(&ifp->lock);
#endif
} else { } else {
/* ifp->prefered_lft <= ifp->valid_lft */ /* ifp->prefered_lft <= ifp->valid_lft */
if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next)) if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next))
......
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