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>
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);
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);