Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / net / ipv6 / route.c
index b7a4a87..efe036a 100644 (file)
@@ -5,8 +5,6 @@
  *     Authors:
  *     Pedro Roque             <roque@di.fc.ul.pt>
  *
- *     $Id: route.c,v 1.56 2001/10/31 21:55:55 davem Exp $
- *
  *     This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
  *      as published by the Free Software Foundation; either version
@@ -109,7 +107,7 @@ static struct dst_ops ip6_dst_ops_template = {
        .negative_advice        =       ip6_negative_advice,
        .link_failure           =       ip6_link_failure,
        .update_pmtu            =       ip6_rt_update_pmtu,
-       .local_out              =       ip6_local_out,
+       .local_out              =       __ip6_local_out,
        .entry_size             =       sizeof(struct rt6_info),
        .entries                =       ATOMIC_INIT(0),
 };
@@ -446,7 +444,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
        struct route_info *rinfo = (struct route_info *) opt;
        struct in6_addr prefix_buf, *prefix;
        unsigned int pref;
-       u32 lifetime;
+       unsigned long lifetime;
        struct rt6_info *rt;
 
        if (len < sizeof(struct route_info)) {
@@ -472,13 +470,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
        if (pref == ICMPV6_ROUTER_PREF_INVALID)
                pref = ICMPV6_ROUTER_PREF_MEDIUM;
 
-       lifetime = ntohl(rinfo->lifetime);
-       if (lifetime == 0xffffffff) {
-               /* infinity */
-       } else if (lifetime > 0x7fffffff/HZ - 1) {
-               /* Avoid arithmetic overflow */
-               lifetime = 0x7fffffff/HZ - 1;
-       }
+       lifetime = addrconf_timeout_fixup(ntohl(rinfo->lifetime), HZ);
 
        if (rinfo->length == 3)
                prefix = (struct in6_addr *)rinfo->prefix;
@@ -506,7 +498,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
                                 (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
 
        if (rt) {
-               if (lifetime == 0xffffffff) {
+               if (!addrconf_finite_timeout(lifetime)) {
                        rt->rt6i_flags &= ~RTF_EXPIRES;
                } else {
                        rt->rt6i_expires = jiffies + HZ * lifetime;
@@ -2202,8 +2194,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)