提交 36e3deae 编写于 作者: Y YOSHIFUJI Hideaki

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: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
上级 20c61fbd
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册