From: Jens Rosenboom <me@jayr.de>
To: netdev@vger.kernel.org
Subject: PATCH: ipv6: avoid wraparound for expired lifetimes
Date: Thu, 25 Jun 2009 09:39:43 +0200 [thread overview]
Message-ID: <20090625073943.GO21357@jayr.de> (raw)
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;
next reply other threads:[~2009-06-25 7:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-25 7:39 Jens Rosenboom [this message]
2009-06-25 8:40 ` PATCH: ipv6: avoid wraparound for expired lifetimes Ilpo Järvinen
2009-06-25 8:42 ` David Miller
2009-06-25 9:06 ` Jens Rosenboom
2009-06-25 9:25 ` Wei Yongjun
2009-06-25 9:33 ` David Miller
2009-06-25 9:35 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090625073943.GO21357@jayr.de \
--to=me@jayr.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.