/[linux-patches]/genpatches-2.6/trunk/2.6.14/1170_5_route-lifetime-fix.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1170_5_route-lifetime-fix.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 292 - (show annotations) (download) (as text)
Tue Jan 31 21:50:53 2006 UTC (14 years, 9 months ago) by johnm
File MIME type: text/x-diff
File size: 2436 byte(s)
Large update - thanks goes to Kerin Millar for the legwork.
1 From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
2 Date: Tue, 20 Dec 2005 01:01:49 +0000 (-0800)
3 Subject: [PATCH] Fix route lifetime.
4 X-Git-Url: http://kernel.org/git/?p=linux/kernel/git/gregkh/linux-2.6.14.y.git;a=commitdiff;h=974674b84fe907035254bc0a5257a4e1c511f156
5
6 [PATCH] Fix route lifetime.
7
8 The route expiration time is stored in rt6i_expires in jiffies.
9 The argument of rt6_route_add() for adding a route is not the
10 expiration time in jiffies nor in clock_t, but the lifetime
11 (or time left before expiration) in clock_t.
12
13 Because of the confusion, we sometimes saw several strange errors
14 (FAILs) in TAHI IPv6 Ready Logo Phase-2 Self Test.
15 The symptoms were analyzed by Mitsuru Chinen <CHINEN@jp.ibm.com>.
16
17 Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Chris Wright <chrisw@redhat.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21 ---
22
23 --- a/net/ipv6/addrconf.c
24 +++ b/net/ipv6/addrconf.c
25 @@ -1456,9 +1456,17 @@ void addrconf_prefix_rcv(struct net_devi
26 not good.
27 */
28 if (valid_lft >= 0x7FFFFFFF/HZ)
29 - rt_expires = 0;
30 + rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ);
31 else
32 - rt_expires = jiffies + valid_lft * HZ;
33 + rt_expires = valid_lft * HZ;
34 +
35 + /*
36 + * We convert this (in jiffies) to clock_t later.
37 + * Avoid arithmetic overflow there as well.
38 + * Overflow can happen only if HZ < USER_HZ.
39 + */
40 + if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ)
41 + rt_expires = 0x7FFFFFFF / USER_HZ;
42
43 if (pinfo->onlink) {
44 struct rt6_info *rt;
45 @@ -1470,12 +1478,12 @@ void addrconf_prefix_rcv(struct net_devi
46 ip6_del_rt(rt, NULL, NULL, NULL);
47 rt = NULL;
48 } else {
49 - rt->rt6i_expires = rt_expires;
50 + rt->rt6i_expires = jiffies + rt_expires;
51 }
52 }
53 } else if (valid_lft) {
54 addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
55 - dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT);
56 + dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT);
57 }
58 if (rt)
59 dst_release(&rt->u.dst);
60 --- a/net/ipv6/route.c
61 +++ b/net/ipv6/route.c
62 @@ -829,7 +829,7 @@ int ip6_route_add(struct in6_rtmsg *rtms
63 }
64
65 rt->u.dst.obsolete = -1;
66 - rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info);
67 + rt->rt6i_expires = jiffies + clock_t_to_jiffies(rtmsg->rtmsg_info);
68 if (nlh && (r = NLMSG_DATA(nlh))) {
69 rt->rt6i_protocol = r->rtm_protocol;
70 } else {

  ViewVC Help
Powered by ViewVC 1.1.20