[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090625073943.GO21357@jayr.de>
Date: Thu, 25 Jun 2009 09:39:43 +0200
From: Jens Rosenboom <me@...r.de>
To: netdev@...r.kernel.org
Subject: PATCH: ipv6: avoid wraparound for expired lifetimes
If the valid or preferred lifetime for an address expires, the kernel
shows huge values for these due to a counter wrap, the following patch
should fix this, at least it did in the test I ran.
--- linux-2.6.30.orig/net/ipv6/addrconf.c 2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.30/net/ipv6/addrconf.c 2009-06-25 09:33:38.000000000 +0200
@@ -3361,9 +3361,17 @@
valid = ifa->valid_lft;
if (preferred != INFINITY_LIFE_TIME) {
long tval = (jiffies - ifa->tstamp)/HZ;
- preferred -= tval;
- if (valid != INFINITY_LIFE_TIME)
- valid -= tval;
+ if (preferred > tval) {
+ preferred -= tval;
+ } else {
+ preferred = 0;
+ }
+ if (valid != INFINITY_LIFE_TIME) {
+ if (valid > tval) {
+ valid -= tval;
+ } else {
+ valid = 0;
+ }
}
} else {
preferred = INFINITY_LIFE_TIME;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists