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 8c1e86a..3883b40 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;
                }