Skip to contentSkip to conversation

ipv6: avoid wraparound for expired preferred lifetime

PATCH Applied Jens Rosenboom 2 participants 2 messages Jun 25, 2009 – Jun 26, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: avoid wraparound for expired preferred lifetime

Avoid showing wrong high values when the preferred lifetime of an address is expired.

---

Revised patch, it should suffice to only check the preferred lifetime, as the address is deleted before the valid lifetime can wrap around.

net/ipv6/addrconf.c +4 -1
@@ -3361,7 +3361,10 @@ static int inet6_fill_ifaddr(struct sk_b
 		valid = ifa->valid_lft;
 		if (preferred != INFINITY_LIFE_TIME) {
 			long tval = (jiffies - ifa->tstamp)/HZ;
-			preferred -= tval;
+			if (preferred > tval)
+				preferred -= tval;
+			else
+				preferred = 0;
 			if (valid != INFINITY_LIFE_TIME)
 				valid -= tval;
 		}