summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-12-11 18:57:22 -0700
committerDavid S. Miller <davem@davemloft.net>2018-12-14 15:44:47 -0800
commit758a7f0b32ab890831d321145c3fe72bb85c0350 (patch)
tree36eec8034afa8e82b1c1c90617322768c7b7d0fe /net/core
parent9c29a2f55ec05cc8b525ee3b2d75d3cd37911123 (diff)
neighbor: Fix state check in neigh_forced_gc
PERMANENT entries are not on the gc_list so the state check is now redundant. Also, the move to not purge entries until after 5 seconds should not apply to FAILED entries; those can be removed immediately to make way for newer ones. This restores the previous logic prior to the gc_list. Fixes: 58956317c8de ("neighbor: Improve garbage collection") Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 010784123bc1..acaa1a64150d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -204,7 +204,6 @@ static int neigh_forced_gc(struct neigh_table *tbl)
unsigned long tref = jiffies - 5 * HZ;
u8 flags = NTF_EXT_LEARNED;
struct neighbour *n, *tmp;
- u8 state = NUD_PERMANENT;
int shrunk = 0;
NEIGH_CACHE_STAT_INC(tbl, forced_gc_runs);
@@ -216,8 +215,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
bool remove = false;
write_lock(&n->lock);
- if (!(n->nud_state & state) && !(n->flags & flags) &&
- time_after(tref, n->updated))
+ if ((n->nud_state == NUD_FAILED) ||
+ (!(n->flags & flags) && time_after(tref, n->updated)))
remove = true;
write_unlock(&n->lock);