aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2012-04-05 20:13:10 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-13 12:58:29 -0400
commit1716a96101c49186bb0b8491922fd3e69030235f (patch)
tree43794d2f033f439d25c63b1796e138d65fd746a8 /net/ipv6/ndisc.c
parentd62f8dbb5b7771910f7c4657345df8ac93acb832 (diff)
ipv6: fix problem with expired dst cache
If the ipv6 dst cache which copy from the dst generated by ICMPV6 RA packet. this dst cache will not check expire because it has no RTF_EXPIRES flag. So this dst cache will always be used until the dst gc run. Change the struct dst_entry,add a union contains new pointer from and expires. When rt6_info.rt6i_flags has no RTF_EXPIRES flag,the dst.expires has no use. we can use this field to point to where the dst cache copy from. The dst.from is only used in IPV6. rt6_check_expired check if rt6_info.dst.from is expired. ip6_rt_copy only set dst.from when the ort has flag RTF_ADDRCONF and RTF_DEFAULT.then hold the ort. ip6_dst_destroy release the ort. Add some functions to operate the RTF_EXPIRES flag and expires(from) together. and change the code to use these new adding functions. Changes from v5: modify ip6_route_add and ndisc_router_discovery to use new adding functions. Only set dst.from when the ort has flag RTF_ADDRCONF and RTF_DEFAULT.then hold the ort. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 3dcdb81ec3e8..176b469322ac 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1264,8 +1264,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1264 } 1264 }
1265 1265
1266 if (rt) 1266 if (rt)
1267 rt->dst.expires = jiffies + (HZ * lifetime); 1267 rt6_set_expires(rt, jiffies + (HZ * lifetime));
1268
1269 if (ra_msg->icmph.icmp6_hop_limit) { 1268 if (ra_msg->icmph.icmp6_hop_limit) {
1270 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; 1269 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
1271 if (rt) 1270 if (rt)