Skip to contentSkip to conversation

neigh: recompute reachabletime before returning from neigh_periodic_work()

PATCH In review Duan Jiong 2 participants 2 messages Feb 27, 2014

Subsystems (2)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 neigh: recompute reachabletime before returning from neigh_periodic_work()

If the neigh table's entries is less than gc_thresh1, the function will return directly, and the reachabletime will not be recompute, so the reachabletime can be guessed.

---
 net/core/neighbour.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/neighbour.c +3 -3
index 026bfd1..7c62a34 100644
@@ -766,9 +766,6 @@ static void neigh_periodic_work(struct work_struct *work)
 	nht = rcu_dereference_protected(tbl->nht,
 					lockdep_is_held(&tbl->lock));
 
-	if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
-		goto out;
-
 	/*
 	 *	periodically recompute ReachableTime from random function
 	 */
@@ -781,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work)
 				neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
 	}
 
+	if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
+		goto out;
+
 	for (i = 0 ; i < (1 << nht->hash_shift); i++) {
 		np = &nht->hash_buckets[i];
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Duan Jiong <[email protected]>
Date: Thu, 27 Feb 2014 17:14:41 +0800

Quoted 5 lines

If the neigh table's entries is less than gc_thresh1, the function will return directly, and the reachabletime will not be recompute, so the reachabletime can be guessed.

It looks like this bug was unintentionally introduced by:

commit 2724680bceee94eac391552863771af105a7355c

Author: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date:   Tue Jan 22 05:20:05 2013 +0000

neigh: Keep neighbour cache entries if number of them is small enough.

Applied and queued up for -stable, thanks!