aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c16
-rw-r--r--net/ipv6/route.c2
2 files changed, 13 insertions, 5 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 73a23b4130a5..4ea8cf7c0cc4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1596,9 +1596,17 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1596 not good. 1596 not good.
1597 */ 1597 */
1598 if (valid_lft >= 0x7FFFFFFF/HZ) 1598 if (valid_lft >= 0x7FFFFFFF/HZ)
1599 rt_expires = 0; 1599 rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ);
1600 else 1600 else
1601 rt_expires = jiffies + valid_lft * HZ; 1601 rt_expires = valid_lft * HZ;
1602
1603 /*
1604 * We convert this (in jiffies) to clock_t later.
1605 * Avoid arithmetic overflow there as well.
1606 * Overflow can happen only if HZ < USER_HZ.
1607 */
1608 if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ)
1609 rt_expires = 0x7FFFFFFF / USER_HZ;
1602 1610
1603 if (pinfo->onlink) { 1611 if (pinfo->onlink) {
1604 struct rt6_info *rt; 1612 struct rt6_info *rt;
@@ -1610,12 +1618,12 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1610 ip6_del_rt(rt, NULL, NULL, NULL); 1618 ip6_del_rt(rt, NULL, NULL, NULL);
1611 rt = NULL; 1619 rt = NULL;
1612 } else { 1620 } else {
1613 rt->rt6i_expires = rt_expires; 1621 rt->rt6i_expires = jiffies + rt_expires;
1614 } 1622 }
1615 } 1623 }
1616 } else if (valid_lft) { 1624 } else if (valid_lft) {
1617 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, 1625 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
1618 dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); 1626 dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT);
1619 } 1627 }
1620 if (rt) 1628 if (rt)
1621 dst_release(&rt->u.dst); 1629 dst_release(&rt->u.dst);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a7a537b50595..7c68bfbee361 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -829,7 +829,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh,
829 } 829 }
830 830
831 rt->u.dst.obsolete = -1; 831 rt->u.dst.obsolete = -1;
832 rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info); 832 rt->rt6i_expires = jiffies + clock_t_to_jiffies(rtmsg->rtmsg_info);
833 if (nlh && (r = NLMSG_DATA(nlh))) { 833 if (nlh && (r = NLMSG_DATA(nlh))) {
834 rt->rt6i_protocol = r->rtm_protocol; 834 rt->rt6i_protocol = r->rtm_protocol;
835 } else { 835 } else {