ipv6: avoid wraparound for expired preferred lifetime
authorJens Rosenboom <me@jayr.de>
Thu, 25 Jun 2009 04:55:50 +0000 (04:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Jun 2009 03:03:50 +0000 (20:03 -0700)
Avoid showing wrong high values when the preferred lifetime of an address
is expired.

Signed-off-by: Jens Rosenboom <me@jayr.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c

index 8c1e86afbbf5208c4eeadee48ce407dbf3b0016f..3883b4036a74c45b9b2864bc7e837a7688a9fe6a 100644 (file)
@@ -3362,7 +3362,10 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
                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;
                }