Skip to content

Commit f6a6f20

Browse files
roopa-prabhudavem330
authored andcommitted
neighbour: skip NTF_EXT_LEARNED entries during forced gc
Commit 9ce33e4 ("neighbour: support for NTF_EXT_LEARNED flag") added support for NTF_EXT_LEARNED for neighbour entries. NTF_EXT_LEARNED entries are neigh entries managed by control plane (eg: Ethernet VPN implementation in FRR routing suite). Periodic gc already excludes these entries. This patch extends it to forced gc which the earlier patch missed. Fixes: 9ce33e4 ("neighbour: support for NTF_EXT_LEARNED flag") Signed-off-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c09977 commit f6a6f20

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/core/neighbour.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,14 @@ unsigned long neigh_rand_reach_time(unsigned long base)
119119
EXPORT_SYMBOL(neigh_rand_reach_time);
120120

121121

122-
static bool neigh_del(struct neighbour *n, __u8 state,
122+
static bool neigh_del(struct neighbour *n, __u8 state, __u8 flags,
123123
struct neighbour __rcu **np, struct neigh_table *tbl)
124124
{
125125
bool retval = false;
126126

127127
write_lock(&n->lock);
128-
if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state)) {
128+
if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state) &&
129+
!(n->flags & flags)) {
129130
struct neighbour *neigh;
130131

131132
neigh = rcu_dereference_protected(n->next,
@@ -157,7 +158,7 @@ bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl)
157158
while ((n = rcu_dereference_protected(*np,
158159
lockdep_is_held(&tbl->lock)))) {
159160
if (n == ndel)
160-
return neigh_del(n, 0, np, tbl);
161+
return neigh_del(n, 0, 0, np, tbl);
161162
np = &n->next;
162163
}
163164
return false;
@@ -185,7 +186,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
185186
* - nobody refers to it.
186187
* - it is not permanent
187188
*/
188-
if (neigh_del(n, NUD_PERMANENT, np, tbl)) {
189+
if (neigh_del(n, NUD_PERMANENT, NTF_EXT_LEARNED, np,
190+
tbl)) {
189191
shrunk = 1;
190192
continue;
191193
}

0 commit comments

Comments
 (0)