[PATCH] [IPv6] Don't generate a temporary address for deprecated addresses

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <netdev@...>
Cc: <yoshfuji@...>
Date: Tuesday, March 18, 2008 - 8:40 am

The RFC states that if the preferred lifetime is less than
REGEN_ADVANCE, no temporary address should be created.

Signed-off-by: Benoit Boissinot <benoit.boissinot@ens-lyon.org>

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c 
index 101e0e7..5d0e404 100644 
--- a/net/ipv6/addrconf.c 
+++ b/net/ipv6/addrconf.c 
@@ -776,6 +776,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i 
        struct inet6_dev *idev = ifp->idev; 
        struct in6_addr addr, *tmpaddr; 
        unsigned long tmp_prefered_lft, tmp_valid_lft, tmp_cstamp, tmp_tstamp; 
+       unsigned long regen_advance; 
        int tmp_plen; 
        int ret = 0; 
        int max_addresses; 
@@ -838,6 +839,22 @@ retry: 
  
        write_unlock(&idev->lock); 
  
+       regen_advance = ifp->idev->cnf.regen_max_retry * 
+                       ifp->idev->cnf.dad_transmits * 
+                       ifp->idev->nd_parms->retrans_time / HZ; 
+ 
+       /* A temporary address is created only if this calculated Preferred 
+        * Lifetime is greater than REGEN_ADVANCE time units.  In particular, 
+        * an implementation must not create a temporary address with a zero 
+        * Preferred Lifetime. 
+        */ 
+       if (tmp_prefered_lft <= regen_advance) { 
+               in6_ifa_put(ifp); 
+               in6_dev_put(idev); 
+               ret = -1; 
+               goto out; 
+       } 
+ 
        addr_flags = IFA_F_TEMPORARY;
        /* set in addrconf_prefix_rcv() */
        if (ifp->flags & IFA_F_OPTIMISTIC)

-- 
:wq
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [IPv6] Don't generate a temporary address for deprec..., Benoit Boissinot, (Tue Mar 18, 8:40 am)
[PATCH] [IPv6] [trivial] convert to mod_timer, Benoit Boissinot, (Tue Mar 18, 8:42 am)
Re: [PATCH] [IPv6] [trivial] convert to mod_timer, Benoit Boissinot, (Tue Mar 18, 3:22 pm)