Fix BUG of ip_rt_send_redirect()
Subsystems (2)
Quoted 10 lines · Herbert Xu
Since
rate_lastcan also be zero if jiffies == 0 (OK that's extremely unlikely but I'm feeling picky today :), how about checkingrate_tokensinstead? The value ofrate_lastcan only be relevant ifrate_tokensis non-zero.BTW, please also check the other spots where rate_last/rate_token is used. They might need a similar fix.
Cheers,
Mr Herbert Xu
According to your advice, I have made another patch for the redirect bug.
I have also checked other spots where rate_last/rate_tokens is used. Those places need not be fixed.
Following is my patch:
--- linux-2.6.19.1/net/ipv4/route.c 2006-12-12 03:32:54.000000000
+0800
+++ linux-2.6.19.1/net/ipv4/route.org.c 2006-11-29 16:14:34.592058480 +0800
@@ -1327,7 +1327,8 @@ void ip_rt_send_redirect(struct sk_buff
/* Check for load limit; set rate_last to the latest sent
* redirect.
*/
- if (time_after(jiffies,
+ if (rt->u.dst.rate_tokens == 0 ||
+ time_after(jiffies,
(rt->u.dst.rate_last +
(ip_rt_redirect_load << rt-Quoted 1 line
u.dst.rate_tokens)))) {
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, rt-
Quoted 1 line
rt_gateway);
Quoted 3 lines · Li Yewang
I have also checked other spots where rate_last/rate_tokens is used. Those places need not be fixed.
Thanks.
Quoted 3 lines
Following is my patch:
Signed-off-by Li Yewang<[email protected]>
Looks good to me. You should cc David Miller <[email protected]> for patch submissions. Please also include a full description each time you submit the patch.
Quoted 14 lines
---
linux-2.6.19.1/net/ipv4/route.c2006-12-12 03:32:54.000000000
+0800
+++linux-2.6.19.1/net/ipv4/route.org.c2006-11-29 16:14:34.592058480 +0800(quoted diff) +2
-1@@ -1327,7 +1327,8 @@ void ip_rt_send_redirect(struct sk_buff /* Check for load limit; set rate_last to the latest sent * redirect. */ - if (time_after(jiffies, + if (rt->u.dst.rate_tokens == 0 || + time_after(jiffies, (rt->u.dst.rate_last + (ip_rt_redirect_load << rt- >u.dst.rate_tokens)))) {
Quoted 2 lines
icmp_send(skb,
ICMP_REDIRECT,ICMP_REDIR_HOST, rt-Quoted 1 line
rt_gateway);
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt