* [PATCH net 0/2] neighbour: fix update of proxy neighbour
@ 2026-03-10 21:59 Sabrina Dubroca
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Sabrina Dubroca @ 2026-03-10 21:59 UTC (permalink / raw)
To: netdev; +Cc: Sabrina Dubroca, Kuniyuki Iwashima, David Ahern
While re-reading some "old" patches I ran into a small change of
behavior in commit dc2a27e524ac ("neighbour: Update pneigh_entry in
pneigh_create().").
The old behavior was not consistent between ->protocol and ->flags,
and didn't offer a way to clear protocol, so maybe it's better to
change that (7-years-old [1]) behavior. But then we should change
non-proxy neighbours as well to keep neigh/pneigh consistent.
[1] df9b0e30d44c ("neighbor: Add protocol attribute")
Sabrina Dubroca (2):
neighbour: restore protocol != 0 check in pneigh update
selftests: rtnetlink: add neighbour update test
net/core/neighbour.c | 3 +-
tools/testing/selftests/net/rtnetlink.sh | 55 ++++++++++++++++++++++++
2 files changed, 57 insertions(+), 1 deletion(-)
--
2.51.2
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update
2026-03-10 21:59 [PATCH net 0/2] neighbour: fix update of proxy neighbour Sabrina Dubroca
@ 2026-03-10 21:59 ` Sabrina Dubroca
2026-03-10 23:16 ` David Ahern
2026-03-11 4:04 ` Kuniyuki Iwashima
2026-03-10 21:59 ` [PATCH net 2/2] selftests: rtnetlink: add neighbour update test Sabrina Dubroca
2026-03-12 2:10 ` [PATCH net 0/2] neighbour: fix update of proxy neighbour patchwork-bot+netdevbpf
2 siblings, 2 replies; 7+ messages in thread
From: Sabrina Dubroca @ 2026-03-10 21:59 UTC (permalink / raw)
To: netdev; +Cc: Sabrina Dubroca, Kuniyuki Iwashima, David Ahern
Prior to commit dc2a27e524ac ("neighbour: Update pneigh_entry in
pneigh_create()."), a pneigh's protocol was updated only when the
value of the NDA_PROTOCOL attribute was non-0. While moving the code,
that check was removed. This is a small change of user-visible
behavior, and inconsistent with the (non-proxy) neighbour behavior.
Fixes: dc2a27e524ac ("neighbour: Update pneigh_entry in pneigh_create().")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
net/core/neighbour.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a95cfe77f7f0..c56a4e7bf790 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -820,7 +820,8 @@ int pneigh_create(struct neigh_table *tbl, struct net *net,
update:
WRITE_ONCE(n->flags, flags);
n->permanent = permanent;
- WRITE_ONCE(n->protocol, protocol);
+ if (protocol)
+ WRITE_ONCE(n->protocol, protocol);
out:
mutex_unlock(&tbl->phash_lock);
return err;
--
2.51.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
@ 2026-03-10 23:16 ` David Ahern
2026-03-11 4:04 ` Kuniyuki Iwashima
1 sibling, 0 replies; 7+ messages in thread
From: David Ahern @ 2026-03-10 23:16 UTC (permalink / raw)
To: Sabrina Dubroca, netdev; +Cc: Kuniyuki Iwashima
On 3/10/26 3:59 PM, Sabrina Dubroca wrote:
> Prior to commit dc2a27e524ac ("neighbour: Update pneigh_entry in
> pneigh_create()."), a pneigh's protocol was updated only when the
> value of the NDA_PROTOCOL attribute was non-0. While moving the code,
> that check was removed. This is a small change of user-visible
> behavior, and inconsistent with the (non-proxy) neighbour behavior.
>
> Fixes: dc2a27e524ac ("neighbour: Update pneigh_entry in pneigh_create().")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> net/core/neighbour.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
good find. Thanks, Sabrina
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
2026-03-10 23:16 ` David Ahern
@ 2026-03-11 4:04 ` Kuniyuki Iwashima
1 sibling, 0 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2026-03-11 4:04 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev, David Ahern
On Tue, Mar 10, 2026 at 2:59 PM Sabrina Dubroca <sd@queasysnail.net> wrote:
>
> Prior to commit dc2a27e524ac ("neighbour: Update pneigh_entry in
> pneigh_create()."), a pneigh's protocol was updated only when the
> value of the NDA_PROTOCOL attribute was non-0. While moving the code,
> that check was removed. This is a small change of user-visible
> behavior, and inconsistent with the (non-proxy) neighbour behavior.
>
> Fixes: dc2a27e524ac ("neighbour: Update pneigh_entry in pneigh_create().")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Thanks for catching this !
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net 2/2] selftests: rtnetlink: add neighbour update test
2026-03-10 21:59 [PATCH net 0/2] neighbour: fix update of proxy neighbour Sabrina Dubroca
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
@ 2026-03-10 21:59 ` Sabrina Dubroca
2026-03-11 4:10 ` Kuniyuki Iwashima
2026-03-12 2:10 ` [PATCH net 0/2] neighbour: fix update of proxy neighbour patchwork-bot+netdevbpf
2 siblings, 1 reply; 7+ messages in thread
From: Sabrina Dubroca @ 2026-03-10 21:59 UTC (permalink / raw)
To: netdev
Cc: Sabrina Dubroca, Shuah Khan, linux-kselftest, Kuniyuki Iwashima,
David Ahern
Check that protocol and flags are updated correctly for
neighbour and pneigh entries.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
tools/testing/selftests/net/rtnetlink.sh | 55 ++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 248c2b91fe42..5a5ff88321d5 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -28,6 +28,7 @@ ALL_TESTS="
kci_test_fdb_get
kci_test_fdb_del
kci_test_neigh_get
+ kci_test_neigh_update
kci_test_bridge_parent_id
kci_test_address_proto
kci_test_enslave_bonding
@@ -1160,6 +1161,60 @@ kci_test_neigh_get()
end_test "PASS: neigh get"
}
+kci_test_neigh_update()
+{
+ dstip=10.0.2.4
+ dstmac=de:ad:be:ef:13:37
+ local ret=0
+
+ for proxy in "" "proxy" ; do
+ # add a neighbour entry without any flags
+ run_cmd ip neigh add $proxy $dstip dev "$devdummy" lladdr $dstmac nud permanent
+ run_cmd_grep $dstip ip neigh show $proxy
+ run_cmd_grep_fail "$dstip dev $devdummy .*\(managed\|use\|router\|extern\)" ip neigh show $proxy
+
+ # set the extern_learn flag, but no other
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy" extern_learn
+ run_cmd_grep "$dstip dev $devdummy .* extern_learn" ip neigh show $proxy
+ run_cmd_grep_fail "$dstip dev $devdummy .* \(managed\|use\|router\)" ip neigh show $proxy
+
+ # flags are reset when not provided
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy"
+ run_cmd_grep $dstip ip neigh show $proxy
+ run_cmd_grep_fail "$dstip dev $devdummy .* extern_learn" ip neigh show $proxy
+
+ # add a protocol
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy" protocol boot
+ run_cmd_grep "$dstip dev $devdummy .* proto boot" ip neigh show $proxy
+
+ # protocol is retained when not provided
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy"
+ run_cmd_grep "$dstip dev $devdummy .* proto boot" ip neigh show $proxy
+
+ # change protocol
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy" protocol static
+ run_cmd_grep "$dstip dev $devdummy .* proto static" ip neigh show $proxy
+
+ # also check an extended flag for non-proxy neighs
+ if [ "$proxy" = "" ]; then
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy" managed
+ run_cmd_grep "$dstip dev $devdummy managed" ip neigh show $proxy
+
+ run_cmd ip neigh change $proxy $dstip dev "$devdummy" lladdr $dstmac
+ run_cmd_grep_fail "$dstip dev $devdummy managed" ip neigh show $proxy
+ fi
+
+ run_cmd ip neigh del $proxy $dstip dev "$devdummy"
+ done
+
+ if [ $ret -ne 0 ];then
+ end_test "FAIL: neigh update"
+ return 1
+ fi
+
+ end_test "PASS: neigh update"
+}
+
kci_test_bridge_parent_id()
{
local ret=0
--
2.51.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net 0/2] neighbour: fix update of proxy neighbour
2026-03-10 21:59 [PATCH net 0/2] neighbour: fix update of proxy neighbour Sabrina Dubroca
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
2026-03-10 21:59 ` [PATCH net 2/2] selftests: rtnetlink: add neighbour update test Sabrina Dubroca
@ 2026-03-12 2:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-12 2:10 UTC (permalink / raw)
To: Sabrina Dubroca; +Cc: netdev, kuniyu, dsahern
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 10 Mar 2026 22:59:15 +0100 you wrote:
> While re-reading some "old" patches I ran into a small change of
> behavior in commit dc2a27e524ac ("neighbour: Update pneigh_entry in
> pneigh_create().").
>
> The old behavior was not consistent between ->protocol and ->flags,
> and didn't offer a way to clear protocol, so maybe it's better to
> change that (7-years-old [1]) behavior. But then we should change
> non-proxy neighbours as well to keep neigh/pneigh consistent.
>
> [...]
Here is the summary with links:
- [net,1/2] neighbour: restore protocol != 0 check in pneigh update
https://git.kernel.org/netdev/net/c/cbada1048847
- [net,2/2] selftests: rtnetlink: add neighbour update test
https://git.kernel.org/netdev/net/c/68e76fc12df0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-12 2:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 21:59 [PATCH net 0/2] neighbour: fix update of proxy neighbour Sabrina Dubroca
2026-03-10 21:59 ` [PATCH net 1/2] neighbour: restore protocol != 0 check in pneigh update Sabrina Dubroca
2026-03-10 23:16 ` David Ahern
2026-03-11 4:04 ` Kuniyuki Iwashima
2026-03-10 21:59 ` [PATCH net 2/2] selftests: rtnetlink: add neighbour update test Sabrina Dubroca
2026-03-11 4:10 ` Kuniyuki Iwashima
2026-03-12 2:10 ` [PATCH net 0/2] neighbour: fix update of proxy neighbour patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox