ipv6 route: Fix route lifetime in netlink message.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, June 13, 2008 - 5:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=36e3de...
Commit:     36e3deae8ba84865fd9eb3f2f21bbc00d49b7544
Parent:     20c61fbd8deb2ada0ac3acecf6156a986dbfff2d
Author:     YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
AuthorDate: Tue May 13 02:52:55 2008 +0900
Committer:  YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
CommitDate: Thu Jun 12 09:19:08 2008 +0900

    ipv6 route: Fix route lifetime in netlink message.
    
    1) We may have route lifetime larger than INT_MAX.
    In that case we had wired value in lifetime.
    Use INT_MAX if lifetime does not fit in s32.
    
    2) Lifetime is valid iif RTF_EXPIRES is set.
    
    Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/ipv6/route.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 220cffe..d1f3e19 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2196,8 +2196,12 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
 
 	NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric);
 
-	expires = (rt->rt6i_flags & RTF_EXPIRES) ?
-			rt->rt6i_expires - jiffies : 0;
+	if (!(rt->rt6i_flags & RTF_EXPIRES))
+		expires = 0;
+	else if (rt->rt6i_expires - jiffies < INT_MAX)
+		expires = rt->rt6i_expires - jiffies;
+	else
+		expires = INT_MAX;
 
 	if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0,
 			       expires, rt->u.dst.error) < 0)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ipv6 route: Fix route lifetime in netlink message., Linux Kernel Mailing ..., (Fri Jun 13, 5:01 pm)