Skip to content

Commit

Permalink
IPv6: addrconf cleanup addrconf_verify
Browse files Browse the repository at this point in the history
The variable regen_advance is only used in the privacy case.
Move it to simplify code and eliminate ifdef's

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Mar 20, 2010
1 parent e21e846 commit 88949cf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3124,22 +3124,13 @@ static void addrconf_verify(unsigned long foo)
hlist_for_each_entry_rcu(ifp, node,
&inet6_addr_lst[i], addr_lst) {
unsigned long age;
#ifdef CONFIG_IPV6_PRIVACY
unsigned long regen_advance;
#endif

if (ifp->flags & IFA_F_PERMANENT)
continue;

spin_lock(&ifp->lock);
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 (ifp->valid_lft != INFINITY_LIFE_TIME &&
age >= ifp->valid_lft) {
spin_unlock(&ifp->lock);
Expand Down Expand Up @@ -3173,6 +3164,10 @@ static void addrconf_verify(unsigned long foo)
#ifdef CONFIG_IPV6_PRIVACY
} else if ((ifp->flags&IFA_F_TEMPORARY) &&
!(ifp->flags&IFA_F_TENTATIVE)) {
unsigned long regen_advance = ifp->idev->cnf.regen_max_retry *
ifp->idev->cnf.dad_transmits *
ifp->idev->nd_parms->retrans_time / HZ;

if (age >= ifp->prefered_lft - regen_advance) {
struct inet6_ifaddr *ifpub = ifp->ifpub;
if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next))
Expand Down

0 comments on commit 88949cf

Please sign in to comment.