netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bug in ARP override timer near jiffies wrap
@ 2004-05-07 20:01 David Stevens
  2004-05-07 21:40 ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: David Stevens @ 2004-05-07 20:01 UTC (permalink / raw)
  To: davem, netdev

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

This patch fixes the calculation of "override" in ARP.

                                +-DLS

--- linux-2.6.6-rc2F1/net/ipv4/arp.c    2004-04-21 15:47:55.000000000 
-0700
+++ linux-2.6.6-rc2F2/net/ipv4/arp.c    2004-05-07 12:54:34.898406424 
-0700
@@ -891,15 +891,14 @@
 
        if (n) {
                int state = NUD_REACHABLE;
-               int override = 0;
+               int override;
 
                /* If several different ARP replies follows back-to-back,
                   use the FIRST one. It is possible, if several proxy
                   agents are active. Taking the first reply prevents
                   arp trashing and chooses the fastest router.
                 */
-               if (jiffies - n->updated >= n->parms->locktime)
-                       override = 1;
+               override = time_after(jiffies, n->updated + 
n->parms->locktime);
 
                /* Broadcast replies and request packets
                   do not assert neighbour reachability.


[-- Attachment #2: arpfix.patch --]
[-- Type: application/octet-stream, Size: 712 bytes --]

--- linux-2.6.6-rc2F1/net/ipv4/arp.c	2004-04-21 15:47:55.000000000 -0700
+++ linux-2.6.6-rc2F2/net/ipv4/arp.c	2004-05-07 12:54:34.898406424 -0700
@@ -891,15 +891,14 @@
 
 	if (n) {
 		int state = NUD_REACHABLE;
-		int override = 0;
+		int override;
 
 		/* If several different ARP replies follows back-to-back,
 		   use the FIRST one. It is possible, if several proxy
 		   agents are active. Taking the first reply prevents
 		   arp trashing and chooses the fastest router.
 		 */
-		if (jiffies - n->updated >= n->parms->locktime)
-			override = 1;
+		override = time_after(jiffies, n->updated + n->parms->locktime);
 
 		/* Broadcast replies and request packets
 		   do not assert neighbour reachability.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bug in ARP override timer near jiffies wrap
  2004-05-07 20:01 [PATCH] bug in ARP override timer near jiffies wrap David Stevens
@ 2004-05-07 21:40 ` David S. Miller
  2004-05-07 21:51   ` David Stevens
  0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-05-07 21:40 UTC (permalink / raw)
  To: David Stevens; +Cc: netdev

On Fri, 7 May 2004 14:01:10 -0600
David Stevens <dlstevens@us.ibm.com> wrote:

> This patch fixes the calculation of "override" in ARP.
 ...
> -               if (jiffies - n->updated >= n->parms->locktime)
> -                       override = 1;
> +               override = time_after(jiffies, n->updated + 
> n->parms->locktime);

David, do you realize that the existing formula is not only
correct, but also covers a greater time space than the
time_*() mechanisms do?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bug in ARP override timer near jiffies wrap
  2004-05-07 21:40 ` David S. Miller
@ 2004-05-07 21:51   ` David Stevens
  2004-05-07 21:55     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: David Stevens @ 2004-05-07 21:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, netdev-bounce

David S. Miller wrote on 05/07/2004 02:40:00 PM:

> David, do you realize that the existing formula is not only
> correct, but also covers a greater time space than the
> time_*() mechanisms do?

ARG! you're right, of course-- I noticed only that they are
different and didn't think about it actually be right! :-)

                                +-DLS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bug in ARP override timer near jiffies wrap
  2004-05-07 21:51   ` David Stevens
@ 2004-05-07 21:55     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-05-07 21:55 UTC (permalink / raw)
  To: David Stevens; +Cc: netdev, netdev-bounce

On Fri, 7 May 2004 14:51:13 -0700
David Stevens <dlstevens@us.ibm.com> wrote:

> David S. Miller wrote on 05/07/2004 02:40:00 PM:
> 
> > David, do you realize that the existing formula is not only
> > correct, but also covers a greater time space than the
> > time_*() mechanisms do?
> 
> ARG! you're right, of course-- I noticed only that they are
> different and didn't think about it actually be right! :-)

But note that the main point is also that your change is
still correct.

The only reason I know about the time space issue with these
tests is that Alexey mentioned it to me when I was converting
most of the TCP code over to use the time_*() macros.

It is a policy decision whether it is more valuable to be
more consistent or support the larger time space in tests
here and there.

I think it is more important to be consistent, so I'm going
to apply your patch.  And for ARP the larger time space would
never matter anyways :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-07 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-07 20:01 [PATCH] bug in ARP override timer near jiffies wrap David Stevens
2004-05-07 21:40 ` David S. Miller
2004-05-07 21:51   ` David Stevens
2004-05-07 21:55     ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).