Skip to contentSkip to conversation

neighbour: allow NUD_NOARP entries to be forced GCed

PATCH Applied David Ahern 4 participants 5 messages Jun 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 neighbour: allow NUD_NOARP entries to be forced GCed

IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to fill up the neighbour table with enough entries that it will overflow for valid connections after that.

This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.

Fixes 58956317c8de (neighbor: Improve garbage collection)

---
rebased to net tree

 net/core/neighbour.c | 1 +
 1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
index 98f20efbfadf..bf774575ad71 100644
@@ -238,6 +238,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
 
 			write_lock(&n->lock);
 			if ((n->nud_state == NUD_FAILED) ||
+			    (n->nud_state == NUD_NOARP) ||
 			    (tbl->is_multicast &&
 			     tbl->is_multicast(n->primary_key)) ||
 			    time_after(tref, n->updated))
Signature · 1 line
2.24.3 (Apple Git-128)
#1 lore raw
Quoted 8 lines · David Ahern

IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to fill up the neighbour table with enough entries that it will overflow for valid connections after that.

This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.

Quoted 6 lines
Fixes 58956317c8de (neighbor: Improve garbage collection)

---
rebased to net tree

There are other use-cases  that use NUD_NOARP as static neighbour entries which should be exempt from forced gc.

for example when qualified by NTF_EXT_LEARNED for the E-VPN use-case.

The check in your patch below should exclude NTF_EXT_LEARNED entries.

(unrelated to the neighbour code ,  but bridge driver also uses NUD_NOARP for static entries)

Quoted 16 lines
  net/core/neighbour.c | 1 +
  1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
index 98f20efbfadf..bf774575ad71 100644
@@ -238,6 +238,7 @@ static int neigh_forced_gc(struct neigh_table *tbl)
 
  			write_lock(&n->lock);
  			if ((n->nud_state == NUD_FAILED) ||
+			    (n->nud_state == NUD_NOARP) ||
  			    (tbl->is_multicast &&
  			     tbl->is_multicast(n->primary_key)) ||
  			    time_after(tref, n->updated))
#2 lore raw
Quoted 22 lines · Roopa Prabhu
Quoted 9 lines · David Ahern

IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to
fill up the neighbour table with enough entries that it will overflow for valid connections after that.

This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.

Quoted 6 lines
Fixes 58956317c8de (neighbor: Improve garbage collection)

---
rebased to net tree

There are other use-cases  that use NUD_NOARP as static neighbour entries which should be exempt from forced gc.

Quoted 9 lines

for example when qualified by NTF_EXT_LEARNED for the E-VPN use-case.

The check in your patch below should exclude NTF_EXT_LEARNED entries.

(unrelated to the neighbour code ,  but bridge driver also uses NUD_NOARP for static entries)

Maybe I misunderstand your comment: forced_gc does not apply to static entries; those were moved to a separate list to avoid walking them.

#3 lore raw
Quoted 26 lines · David Ahern
Quoted 25 lines · Roopa Prabhu
Quoted 9 lines · David Ahern

IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to
fill up the neighbour table with enough entries that it will overflow for valid connections after that.

This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.

Quoted 6 lines
Fixes 58956317c8de (neighbor: Improve garbage collection)

---
rebased to net tree

There are other use-cases  that use NUD_NOARP as static neighbour entries which should be exempt from forced gc.

for example when qualified by NTF_EXT_LEARNED for the E-VPN use-case.

The check in your patch below should exclude NTF_EXT_LEARNED entries.

Quoted 7 lines
Quoted 4 lines

(unrelated to the neighbour code ,  but bridge driver also uses NUD_NOARP for static entries)

Maybe I misunderstand your comment: forced_gc does not apply to static entries; those were moved to a separate list to avoid walking them.

I think you are right. so just to confirm, NUD_NOARP + NTF_EXT_LEARNED will never be included in the list for forced_gc and hence not affected by your patch ?

if yes, I am good.

maintainer Applied
#4 lore raw
In reply to David Ahern

From: David Ahern <[email protected]>
Date: Mon, 7 Jun 2021 11:35:30 -0600

Quoted 8 lines

IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to fill up the neighbour table with enough entries that it will overflow for valid connections after that.

This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.

Quoted 6 lines
Fixes 58956317c8de (neighbor: Improve garbage collection)

---
rebased to net tree

Applied, thanks.