From: Jens Rosenboom <me@jayr.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Cc: Jens Rosenboom <me@jayr.de>, Netdev <netdev@vger.kernel.org>
Subject: Re: PATCH: ipv6: avoid wraparound for expired lifetimes
Date: Thu, 25 Jun 2009 11:06:03 +0200 [thread overview]
Message-ID: <20090625090603.GP21357@jayr.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0906251135410.917@melkinkari.cs.Helsinki.FI>
On Thu, Jun 25, 2009 at 11:40:19AM +0300, Ilpo Järvinen wrote:
> On Thu, 25 Jun 2009, Jens Rosenboom wrote:
>
> > If the valid or preferred lifetime for an address expires, the kernel
> > shows huge values for these due to a counter wrap,
>
> I suspect we have plenty of potentially counter-wrapped printouts all
> around the kernel. So you're fixing just a tip of the iceberg.
So are you implying that because I don't fix all of them at once, I
shouldn't bother to start at all?
On Thu, 2009-06-25 at 01:42 -0700, David Miller wrote:
...
> Jens, don't even bother posting patches that fail to
> build.
Sorry for that, here is the correct version.
--- 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 10:52:27.000000000 +0200
@@ -3361,9 +3361,18 @@
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;
And to show you where this appears:
Output with plain 2.6.30
# ip -6 addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:db8::202:a5ff:fee8:20be/64 scope global dynamic
valid_lft 870sec preferred_lft 7sec
inet6 fe80::202:a5ff:fee8:20be/64 scope link
valid_lft forever preferred_lft forever
# sleep 30
# ip -6 addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:db8::202:a5ff:fee8:20be/64 scope global deprecated dynamic
valid_lft 840sec preferred_lft 4294967266sec
inet6 fe80::202:a5ff:fee8:20be/64 scope link
valid_lft forever preferred_lft forever
Output with patched 2.6.30
# ip -6 addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:db8::202:a5ff:fee8:12e1/64 scope global dynamic
valid_lft 897sec preferred_lft 27sec
inet6 fe80::202:a5ff:fee8:12e1/64 scope link
valid_lft forever preferred_lft forever
# sleep 30
# ip -6 addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:db8::202:a5ff:fee8:12e1/64 scope global deprecated dynamic
valid_lft 862sec preferred_lft 0sec
inet6 fe80::202:a5ff:fee8:12e1/64 scope link
valid_lft forever preferred_lft forever
next prev parent reply other threads:[~2009-06-25 9:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-25 7:39 PATCH: ipv6: avoid wraparound for expired lifetimes Jens Rosenboom
2009-06-25 8:40 ` Ilpo Järvinen
2009-06-25 8:42 ` David Miller
2009-06-25 9:06 ` Jens Rosenboom [this message]
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=20090625090603.GP21357@jayr.de \
--to=me@jayr.de \
--cc=ilpo.jarvinen@helsinki.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).