aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.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/addrconf.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/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6a3bb6077e19..7d5cb975cc6f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -803,8 +803,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
803 ip6_del_rt(rt); 803 ip6_del_rt(rt);
804 rt = NULL; 804 rt = NULL;
805 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 805 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
806 rt->dst.expires = expires; 806 rt6_set_expires(rt, expires);
807 rt->rt6i_flags |= RTF_EXPIRES;
808 } 807 }
809 } 808 }
810 dst_release(&rt->dst); 809 dst_release(&rt->dst);
@@ -1887,11 +1886,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
1887 rt = NULL; 1886 rt = NULL;
1888 } else if (addrconf_finite_timeout(rt_expires)) { 1887 } else if (addrconf_finite_timeout(rt_expires)) {
1889 /* not infinity */ 1888 /* not infinity */
1890 rt->dst.expires = jiffies + rt_expires; 1889 rt6_set_expires(rt, jiffies + rt_expires);
1891 rt->rt6i_flags |= RTF_EXPIRES;
1892 } else { 1890 } else {
1893 rt->rt6i_flags &= ~RTF_EXPIRES; 1891 rt6_clean_expires(rt);
1894 rt->dst.expires = 0;
1895 } 1892 }
1896 } else if (valid_lft) { 1893 } else if (valid_lft) {
1897 clock_t expires = 0; 1894 clock_t expires = 0;