Don't generate a temporary address for deprecated addresses
Subsystems (3)
PATCH 1/1 Don't generate a temporary address for deprecated addresses
The RFC states that if the preferred lifetime is less than REGEN_ADVANCE, no temporary address should be created.
Signed-off-by Benoit Boissinot <[email protected]>
net/ipv6/addrconf.c +17 -0
@@ -776,6 +776,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *istruct 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 )
Signature · 1 line
:wq
PATCH 1/1 convert to mod_timer
Convert addrconf_verify to mod_timer
Signed-off-by Benoit Boissinot <[email protected]>
net/ipv6/addrconf.c +1 -4
@@ -2922,8 +2943,6 @@ static void addrconf_verify(unsigned long foo) now = jiffies; next = now +ADDR_CHECK_FREQUENCY ; -del_timer (&addr_chk_timer); -for (i=0 ; i <IN6_ADDR_HSIZE ; i++) { restart:
@@ -3013,8 +3032,7 @@ restart:read_unlock (&addrconf_hash_lock); } - addr_chk_timer.expires =time_before (next, jiffies +HZ ) ? jiffies +HZ : next; -add_timer (&addr_chk_timer); +mod_timer (&addr_chk_timer,time_before (next, jiffies +HZ ) ? jiffies +HZ : next);spin_unlock_bh (&addrconf_verify_lock); }
Signature · 1 line
:wq
Re: [PATCH] [IPv6] [trivial] convert to mod_timer
Quoted 1 line · Benoit Boissinot
Convert
addrconf_verifytomod_timer
after some reflexion, this patch is probably wrong, since addrconf_verify is called from outside the timer too.
sorry,
Benoit
Quoted 29 lines
Signed-off-by Benoit Boissinot <[email protected]>net/ipv6/addrconf.c +1
-4@@ -2922,8 +2943,6 @@ static void addrconf_verify(unsigned long foo) now = jiffies; next = now +ADDR_CHECK_FREQUENCY ; -del_timer (&addr_chk_timer); -for (i=0 ; i <IN6_ADDR_HSIZE ; i++) { restart:@@ -3013,8 +3032,7 @@ restart:read_unlock (&addrconf_hash_lock); } - addr_chk_timer.expires =time_before (next, jiffies +HZ ) ? jiffies +HZ : next; -add_timer (&addr_chk_timer); +mod_timer (&addr_chk_timer,time_before (next, jiffies +HZ ) ? jiffies +HZ : next);spin_unlock_bh (&addrconf_verify_lock); }Signature · 2 lines
-- :wq
Signature · 1 line
:wq