netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ipv6: Clamp reported valid_lft to a minimum of 0
@ 2010-06-26 21:37 Ben Hutchings
  2010-06-26 21:42 ` [PATCH 2/2] ipv6: Use interface max_desync_factor instead of static default Ben Hutchings
  2010-06-30 17:28 ` [PATCH 1/2] ipv6: Clamp reported valid_lft to a minimum of 0 David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ben Hutchings @ 2010-06-26 21:37 UTC (permalink / raw)
  To: David Miller
  Cc: Hideaki YOSHIFUJI, Patrick McHardy, 514644, Piotr Lewandowski,
	netdev

Since addresses are only revalidated every 2 minutes, the reported
valid_lft can underflow shortly before the address is deleted.
Clamp it to a minimum of 0, as for prefered_lft.

Reported-by: Piotr Lewandowski <piotr.lewandowski@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This is compile-tested only.  I don't claim any familiarity with this
code.

Ben.

 net/ipv6/addrconf.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b97bb1f..1459eed 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3492,8 +3492,12 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
 				preferred -= tval;
 			else
 				preferred = 0;
-			if (valid != INFINITY_LIFE_TIME)
-				valid -= tval;
+			if (valid != INFINITY_LIFE_TIME) {
+				if (valid > tval)
+					valid -= tval;
+				else
+					valid = 0;
+			}
 		}
 	} else {
 		preferred = INFINITY_LIFE_TIME;
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-30 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-26 21:37 [PATCH 1/2] ipv6: Clamp reported valid_lft to a minimum of 0 Ben Hutchings
2010-06-26 21:42 ` [PATCH 2/2] ipv6: Use interface max_desync_factor instead of static default Ben Hutchings
2010-06-30 17:29   ` David Miller
2010-06-30 17:28 ` [PATCH 1/2] ipv6: Clamp reported valid_lft to a minimum of 0 David Miller

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).