diff options
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a770df2493d2..54fd68c14c87 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1441,7 +1441,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1441 | dev_hold(rt->u.dst.dev); | 1441 | dev_hold(rt->u.dst.dev); |
1442 | if (rt->idev) | 1442 | if (rt->idev) |
1443 | in_dev_hold(rt->idev); | 1443 | in_dev_hold(rt->idev); |
1444 | rt->u.dst.obsolete = 0; | 1444 | rt->u.dst.obsolete = -1; |
1445 | rt->u.dst.lastuse = jiffies; | 1445 | rt->u.dst.lastuse = jiffies; |
1446 | rt->u.dst.path = &rt->u.dst; | 1446 | rt->u.dst.path = &rt->u.dst; |
1447 | rt->u.dst.neighbour = NULL; | 1447 | rt->u.dst.neighbour = NULL; |
@@ -1506,11 +1506,12 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
1506 | struct dst_entry *ret = dst; | 1506 | struct dst_entry *ret = dst; |
1507 | 1507 | ||
1508 | if (rt) { | 1508 | if (rt) { |
1509 | if (dst->obsolete) { | 1509 | if (dst->obsolete > 0) { |
1510 | ip_rt_put(rt); | 1510 | ip_rt_put(rt); |
1511 | ret = NULL; | 1511 | ret = NULL; |
1512 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || | 1512 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || |
1513 | rt->u.dst.expires) { | 1513 | (rt->u.dst.expires && |
1514 | time_after_eq(jiffies, rt->u.dst.expires))) { | ||
1514 | unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, | 1515 | unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, |
1515 | rt->fl.oif, | 1516 | rt->fl.oif, |
1516 | rt_genid(dev_net(dst->dev))); | 1517 | rt_genid(dev_net(dst->dev))); |
@@ -1726,7 +1727,9 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
1726 | 1727 | ||
1727 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1728 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) |
1728 | { | 1729 | { |
1729 | return NULL; | 1730 | if (rt_is_expired((struct rtable *)dst)) |
1731 | return NULL; | ||
1732 | return dst; | ||
1730 | } | 1733 | } |
1731 | 1734 | ||
1732 | static void ipv4_dst_destroy(struct dst_entry *dst) | 1735 | static void ipv4_dst_destroy(struct dst_entry *dst) |
@@ -1888,7 +1891,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1888 | if (!rth) | 1891 | if (!rth) |
1889 | goto e_nobufs; | 1892 | goto e_nobufs; |
1890 | 1893 | ||
1891 | rth->u.dst.output= ip_rt_bug; | 1894 | rth->u.dst.output = ip_rt_bug; |
1895 | rth->u.dst.obsolete = -1; | ||
1892 | 1896 | ||
1893 | atomic_set(&rth->u.dst.__refcnt, 1); | 1897 | atomic_set(&rth->u.dst.__refcnt, 1); |
1894 | rth->u.dst.flags= DST_HOST; | 1898 | rth->u.dst.flags= DST_HOST; |
@@ -2054,6 +2058,7 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2054 | rth->fl.oif = 0; | 2058 | rth->fl.oif = 0; |
2055 | rth->rt_spec_dst= spec_dst; | 2059 | rth->rt_spec_dst= spec_dst; |
2056 | 2060 | ||
2061 | rth->u.dst.obsolete = -1; | ||
2057 | rth->u.dst.input = ip_forward; | 2062 | rth->u.dst.input = ip_forward; |
2058 | rth->u.dst.output = ip_output; | 2063 | rth->u.dst.output = ip_output; |
2059 | rth->rt_genid = rt_genid(dev_net(rth->u.dst.dev)); | 2064 | rth->rt_genid = rt_genid(dev_net(rth->u.dst.dev)); |
@@ -2218,6 +2223,7 @@ local_input: | |||
2218 | goto e_nobufs; | 2223 | goto e_nobufs; |
2219 | 2224 | ||
2220 | rth->u.dst.output= ip_rt_bug; | 2225 | rth->u.dst.output= ip_rt_bug; |
2226 | rth->u.dst.obsolete = -1; | ||
2221 | rth->rt_genid = rt_genid(net); | 2227 | rth->rt_genid = rt_genid(net); |
2222 | 2228 | ||
2223 | atomic_set(&rth->u.dst.__refcnt, 1); | 2229 | atomic_set(&rth->u.dst.__refcnt, 1); |
@@ -2444,6 +2450,7 @@ static int __mkroute_output(struct rtable **result, | |||
2444 | rth->rt_spec_dst= fl->fl4_src; | 2450 | rth->rt_spec_dst= fl->fl4_src; |
2445 | 2451 | ||
2446 | rth->u.dst.output=ip_output; | 2452 | rth->u.dst.output=ip_output; |
2453 | rth->u.dst.obsolete = -1; | ||
2447 | rth->rt_genid = rt_genid(dev_net(dev_out)); | 2454 | rth->rt_genid = rt_genid(dev_net(dev_out)); |
2448 | 2455 | ||
2449 | RT_CACHE_STAT_INC(out_slow_tot); | 2456 | RT_CACHE_STAT_INC(out_slow_tot); |