* [PATCH net 1/2] tools: ynl-gen-c: handle classic notifications without a matching request
2026-10-24 17:13 [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
@ 2026-10-24 17:13 ` Demos Ra via B4 Relay
2026-10-24 17:13 ` [PATCH net 2/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
2026-10-26 22:59 ` [PATCH net 0/2] " Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Demos Ra via B4 Relay @ 2026-10-24 17:13 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni
Cc: Simon Horman, David Ahern, Ido Schimmel, netdev, Demos Ra
From: Demos Ra <demosthenes.ra@gmail.com>
For classic Netlink families the notification table in the generated
user code is indexed by the message type the kernel sends. Since
commit 49398830a4aa ("tools: ynl-gen: support CRUD-like notifications
for classic Netlink") ynl-gen writes each index as the name of the
request that has the same message type, and fails if no request has
it:
$ ./tools/net/ynl/pyynl/ynl_gen_c.py --mode user --source \
--spec Documentation/netlink/specs/rt-nexthop.yaml
...
crud_op = ri.family.req_by_value[op.rsp_value]
KeyError: 116
rt-nexthop's newnexthopbucket-ntf is the only such notification: the
kernel sends it as RTM_NEWNEXTHOPBUCKET (116), and no request uses
that message type.
When no request matches, write the message type as a number, as
put_op_name() already does for messages whose request and reply types
differ. The generated code for every spec in the tree is unchanged.
Signed-off-by: Demos Ra <demosthenes.ra@gmail.com>
---
tools/net/ynl/pyynl/ynl_gen_c.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 4aca51396a9e..a009a842fb36 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -3409,9 +3409,11 @@ def render_scoped_consts(family, cw, scope):
def _render_user_ntf_entry(ri, op):
if not ri.family.is_classic():
ri.cw.block_start(line=f"[{op.enum_name}] = ")
- else:
+ elif op.rsp_value in ri.family.req_by_value:
crud_op = ri.family.req_by_value[op.rsp_value]
ri.cw.block_start(line=f"[{crud_op.enum_name}] = ")
+ else:
+ ri.cw.block_start(line=f"[{op.rsp_value}] = ")
ri.cw.p(f".alloc_sz\t= sizeof({type_name(ri, 'event')}),")
ri.cw.p(f".cb\t\t= {op_prefix(ri, 'reply', deref=True)}_parse,")
ri.cw.p(f".policy\t\t= &{ri.struct['reply'].render_name}_nest,")
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net 2/2] tools: ynl: generate code for rt-nexthop bucket notifications
2026-10-24 17:13 [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
2026-10-24 17:13 ` [PATCH net 1/2] tools: ynl-gen-c: handle classic notifications without a matching request Demos Ra via B4 Relay
@ 2026-10-24 17:13 ` Demos Ra via B4 Relay
2026-10-26 22:59 ` [PATCH net 0/2] " Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Demos Ra via B4 Relay @ 2026-10-24 17:13 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni
Cc: Simon Horman, David Ahern, Ido Schimmel, netdev, Sashiko,
Demos Ra
From: Demos Ra <demosthenes.ra@gmail.com>
The kernel sends RTM_NEWNEXTHOPBUCKET to RTNLGRP_NEXTHOP when the
upkeep of a resilient nexthop group migrates a bucket. With
newnexthopbucket-ntf excluded from the code generation, the
notification table of the generated rt-nexthop code ends at
RTM_DELNEXTHOP. On a socket subscribed to the group, ynl_ntf_parse()
rejects the bucket notification without setting an error message, so
ynl_ntf_check() fails, and so does a request in flight when the
notification arrives, as ynl_check_alien() passes it to
ynl_ntf_parse() too.
ynl-gen can now generate the notification, so drop the exclusion.
Reproduced in a network namespace, with traffic through a resilient
group so that a weight change defers the bucket migrations to the
upkeep work:
ip link add dummy0 type dummy && ip link set dummy0 up
ip addr add 192.0.2.1/24 dev dummy0
ip nexthop add id 1 via 192.0.2.2 dev dummy0
ip nexthop add id 2 via 192.0.2.3 dev dummy0
ip nexthop add id 10 group 1/2 type resilient buckets 8 idle_timer 1
ip route add 198.51.100.0/24 nhid 10
for i in $(seq 64); do echo > /dev/udp/198.51.100.$i/9; done
ip nexthop replace id 10 group 1,3/2 type resilient
A C program that joins RTNLGRP_NEXTHOP by hand and then calls
ynl_ntf_check() or rt_nexthop_getnexthop() fails with an empty error
message before this patch, and parses the two bucket notifications
after it. The program is available on request. Reproducing it needed
no kernel changes. Tested on 7.0 with the reproducer and the YNL
selftests, which all pass.
Fixes: 457dc9fefe9a ("netlink: specs: Add a spec for nexthops in rtnetlink")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019-rt-nexthop-spec-v1-1-9c586edf86ab%40gmail.com
Signed-off-by: Demos Ra <demosthenes.ra@gmail.com>
---
tools/net/ynl/generated/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index d76d4ca94629..5a186349b5a8 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -18,7 +18,6 @@ include ../Makefile.deps
YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
--exclude-op stats-get
-YNL_GEN_ARG_rt-nexthop:=--exclude-op newnexthopbucket-ntf
TOOL:=../pyynl/ynl_gen_c.py
TOOL_RST:=../pyynl/ynl_gen_rst.py
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications
2026-10-24 17:13 [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
2026-10-24 17:13 ` [PATCH net 1/2] tools: ynl-gen-c: handle classic notifications without a matching request Demos Ra via B4 Relay
2026-10-24 17:13 ` [PATCH net 2/2] tools: ynl: generate code for rt-nexthop bucket notifications Demos Ra via B4 Relay
@ 2026-10-26 22:59 ` Jakub Kicinski
2026-10-27 1:29 ` Demos Ra
2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2026-10-26 22:59 UTC (permalink / raw)
To: Demos Ra via B4 Relay
Cc: demosthenes.ra, Donald Hunter, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, David Ahern, Ido Schimmel, netdev,
Sashiko
On Sun, 25 Oct 2026 00:13:54 +0700 Demos Ra via B4 Relay wrote:
> Commit 457dc9fefe9a ("netlink: specs: Add a spec for nexthops in
> rtnetlink") left newnexthopbucket-ntf out of the C code generation,
> because ynl-gen could not write a notification table entry for it.
> Sashiko pointed out that the generated library then fails at runtime
> when the kernel sends that notification to a subscribed socket.
>
> Patch 1 lets ynl-gen handle a classic notification that no request
> matches. Patch 2 drops the exclusion.
>
> 457dc9fefe9a was pulled in this merge window, hence net.
Unsupported functionality is not a bug. I suspect you just fed
the Sashiko report to an LLM and posted the output.
--
pw-bot: defer
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications
2026-10-26 22:59 ` [PATCH net 0/2] " Jakub Kicinski
@ 2026-10-27 1:29 ` Demos Ra
0 siblings, 0 replies; 5+ messages in thread
From: Demos Ra @ 2026-10-27 1:29 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Demos Ra via B4 Relay, Donald Hunter, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, David Ahern,
Ido Schimmel, netdev, Sashiko
On Tue, Oct 27, 2026 at 5:59 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> Unsupported functionality is not a bug. I suspect you just fed
> the Sashiko report to an LLM and posted the output.
Understood, I'll send it to net-next once it opens. It was LLM
assisted, under my direct intent as a follow up to 457dc9fefe9a, and I
take responsibility.
^ permalink raw reply [flat|nested] 5+ messages in thread