[PATCH] Neighbour Cache (ARP) State machine bug Fixed

Linux Kernel Mailing List <[email protected]> Fri, 12 May 2006 18:59:30 GMT
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
commit 43c4779f43e06f1b34f0da43610f0b33d7a2709a
tree 5af4636f659ca705dc0632395b108574f638d4a9
parent aaf1e07ac554b9674bf22394911ec8dd3a927826
author Pradeep Vincent <[email protected]> Mon, 28 Nov 2005 12:57:00 +0100
committer Willy TARREAU <willy@pcw.(none)> Sun, 07 May 2006 21:15:19 +0200

[PATCH] Neighbour Cache (ARP) State machine bug Fixed

In 2.4.21, arp code uses gc_timer to check for stale arp cache
entries. In 2.6, each entry has its own timer to check for stale arp
cache. 2.4.29 to 2.4.32 kernels (atleast) use neither of these timers.
This causes problems in environments where IPs or MACs are reassigned
- saw this problem on load balancing router based networks that use
VMACs. Tested this code on load balancing router based networks as
well as peer-linux systems.

Let me know if I need to contact someone else about this,

Thanks,

Pradeep Vincent

 net/core/neighbour.c |    9 +++++++++
 1 files changed, 9 insertions(+)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index b7e95f5..50b0ded 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -14,6 +14,7 @@
  *	Vitaly E. Lavrov	releasing NULL neighbor in neigh_add.
  *	Harald Welte		Add neighbour cache statistics like rtstat
  *	Harald Welte		port neighbour cache rework from 2.6.9-rcX
+ *	Pradeep Vincent		Move neighbour cache entry to stale state
  */
 
 #include <linux/config.h>
@@ -705,6 +706,14 @@ static void SMP_TIMER_NAME(neigh_periodi
 			neigh_release(n);
 			continue;
 		}
+
+		/* Mark it stale - To be reconfirmed later when used */
+		if (n->nud_state & NUD_REACHABLE &&
+		    now - n->confirmed > n->parms->reachable_time) {
+			n->nud_state = NUD_STALE;
+			neigh_suspect(n);
+		}
+
 		write_unlock(&n->lock);
 
 next_elt: