From: "Wei Yongjun" <yjwei@nanjing-fnst.com>
To: "Stephen Hemminger" <shemminger@osdl.org>,
"Li Yewang" <lyw@nanjing-fnst.com>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH]Fix BUG of ip_rt_send_redirect()
Date: Fri, 17 Nov 2006 13:45:40 +0800 [thread overview]
Message-ID: <009301c70a0b$9d6fdb20$6004a8c0@weiyongjun> (raw)
In-Reply-To: 20061116195122.144bc37f@localhost.localdomain
On Friday, November 17, 2006 11:51 AM
Stephen Hemminger <shemminger@osdl.org> wrote:
> On Thu, 16 Nov 2006 23:57:50 -0500
> Li Yewang <lyw@nanjing-fnst.com> wrote:
>
>> [1]Summary of the problem:
>> On IA32 system, If jiffies - b > 0x7fffffff, router can not send
>> redirect packet.unsigned long b = rt->u.dst.rate_last
>> +(ip_rt_redirect_load << rt->u.dst.rate_tokens)
>>
>> [2]Full description of the problem:
>> In linux kernel, if time_after(jiffies, (rt->u.dst.rate_last
>> +(ip_rt_redirect_load << rt->u.dst.rate_tokens)) == false,
>> router will not send redirect packet. Here define b = rt-
>> >u.dst.rate_last +(ip_rt_redirect_load << rt->u.dst.rate_tokens):
>>
>> 1. If (jiffies - b <= 0x7fffffff), time_after(jiffies, b) == true,
>> router will send redirect packet.
>>
>> 2. If (jiffies - b > 0x7fffffff), time_after(jiffies, b) == false,
>> router will not send redirect packet. For example: when I add a router
>> after system boot, jiffies = (unsigned long)(-300000),
>> rt->u.dst.rate_last = 0, rt->u.dst.rate_tokens = 0, b = 20,
>> time_after((unsigned long)(-300000), 20) == false, send redirect packet
>> can not be send even if router is used in the first time.
>>
>> When router send a redirect packet in time b, and before jiffies
>> increased to 0x7fffffff + b, router can send redirect packet.
>> But if a redirect packet must be send in 0x80000000+ b,
>> time_after(jiffies, b) == false, redirect packet will not be send also.
>> So between time (0x80000000+ b) to time b, router do not send redirect
>> packet. That is to say, in a circle of jiffies, router has 24.9 days can
>> not send redirect packet (0x80000000/1000/60/60/24=24.9).
>
> Wouldn't making ip_rt_redirect_load and other unsigned long instead of int fix
> the problem?
>
> Remember time_after() works correctly for values that wraparound.
Yes, time_after() works correctly for values that wraparound. For examples: if
time a = (unsigned long)(-1), and time b = 1; time_after(b, a) = true.
But if a is increaseing, after a circle of jiffies, a' = a + (unsigned long)(-1)
+ 1 = (unsigned long)(-1) = a,
this time a' is after b, but time_after(b, a') still equal to true,because
values that wraparound can not be making in time_after().
Regards
next prev parent reply other threads:[~2006-11-17 5:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-17 4:57 [PATCH]Fix BUG of ip_rt_send_redirect() Li Yewang
2006-11-17 3:51 ` Stephen Hemminger
2006-11-17 5:45 ` Wei Yongjun [this message]
2006-11-17 6:49 ` Herbert Xu
2006-11-21 3:07 ` Li Yewang
2006-11-29 2:55 ` Li Yewang
-- strict thread matches above, loose matches on Subject: below --
2006-11-29 8:08 Li Yewang
2006-12-18 3:02 ` [PATCH]Fix " Herbert Xu
2006-11-29 8:51 Li Yewang
2006-12-18 5:56 ` [PATCH]Fix " Herbert Xu
2006-12-19 1:45 Li Yewang
2006-12-19 2:13 ` [PATCH]Fix " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='009301c70a0b$9d6fdb20$6004a8c0@weiyongjun' \
--to=yjwei@nanjing-fnst.com \
--cc=lyw@nanjing-fnst.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox