Skip to content

Commit 3626898

Browse files
Guillaume Naultdavem330
authored andcommitted
Revert "ipv6: Honor all IPv6 PIO Valid Lifetime values"
This reverts commit b75326c. This commit breaks Linux compatibility with USGv6 tests. The RFC this commit was based on is actually an expired draft: no published RFC currently allows the new behaviour it introduced. Without full IETF endorsement, the flash renumbering scenario this patch was supposed to enable is never going to work, as other IPv6 equipements on the same LAN will keep the 2 hours limit. Fixes: b75326c ("ipv6: Honor all IPv6 PIO Valid Lifetime values") Signed-off-by: Guillaume Nault <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c7ec845 commit 3626898

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

include/net/addrconf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define RTR_SOLICITATION_INTERVAL (4*HZ)
77
#define RTR_SOLICITATION_MAX_INTERVAL (3600*HZ) /* 1 hour */
88

9+
#define MIN_VALID_LIFETIME (2*3600) /* 2 hours */
10+
911
#define TEMP_VALID_LIFETIME (7*86400)
1012
#define TEMP_PREFERRED_LIFETIME (86400)
1113
#define REGEN_MAX_RETRY (3)

net/ipv6/addrconf.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
25892589
__u32 valid_lft, u32 prefered_lft)
25902590
{
25912591
struct inet6_ifaddr *ifp = ipv6_get_ifaddr(net, addr, dev, 1);
2592-
int create = 0;
2592+
int create = 0, update_lft = 0;
25932593

25942594
if (!ifp && valid_lft) {
25952595
int max_addresses = in6_dev->cnf.max_addresses;
@@ -2633,19 +2633,32 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
26332633
unsigned long now;
26342634
u32 stored_lft;
26352635

2636-
/* Update lifetime (RFC4862 5.5.3 e)
2637-
* We deviate from RFC4862 by honoring all Valid Lifetimes to
2638-
* improve the reaction of SLAAC to renumbering events
2639-
* (draft-gont-6man-slaac-renum-06, Section 4.2)
2640-
*/
2636+
/* update lifetime (RFC2462 5.5.3 e) */
26412637
spin_lock_bh(&ifp->lock);
26422638
now = jiffies;
26432639
if (ifp->valid_lft > (now - ifp->tstamp) / HZ)
26442640
stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ;
26452641
else
26462642
stored_lft = 0;
2647-
26482643
if (!create && stored_lft) {
2644+
const u32 minimum_lft = min_t(u32,
2645+
stored_lft, MIN_VALID_LIFETIME);
2646+
valid_lft = max(valid_lft, minimum_lft);
2647+
2648+
/* RFC4862 Section 5.5.3e:
2649+
* "Note that the preferred lifetime of the
2650+
* corresponding address is always reset to
2651+
* the Preferred Lifetime in the received
2652+
* Prefix Information option, regardless of
2653+
* whether the valid lifetime is also reset or
2654+
* ignored."
2655+
*
2656+
* So we should always update prefered_lft here.
2657+
*/
2658+
update_lft = 1;
2659+
}
2660+
2661+
if (update_lft) {
26492662
ifp->valid_lft = valid_lft;
26502663
ifp->prefered_lft = prefered_lft;
26512664
ifp->tstamp = now;

0 commit comments

Comments
 (0)