🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
5 messages
5 total messages Started by Demos Ra via B4 Relay Sat, 24 Oct 2026 17:13
[PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications
#7094
Author: Demos Ra via B4 Relay
Date: Sat, 24 Oct 2026 17:13
27 lines
11491 bytes
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.

---
Demos Ra (2):
      tools: ynl-gen-c: handle classic notifications without a matching request
      tools: ynl: generate code for rt-nexthop bucket notifications

 tools/net/ynl/generated/Makefile | 1 -
 tools/net/ynl/pyynl/ynl_gen_c.py | 4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
change-id: 20261024-ynl-ntf-bucket-0fe8afb86ae4

Best regards,
-- 
Demos Ra <demosthenes.ra@gmail.com>
[PATCH net 1/2] tools: ynl-gen-c: handle classic notifications without a matching request
#7093
Author: Demos Ra via B4 Relay
Date: Sat, 24 Oct 2026 17:13
49 lines
12402 bytes
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
[PATCH net 2/2] tools: ynl: generate code for rt-nexthop bucket notifications
#7092
Author: Demos Ra via B4 Relay
Date: Sat, 24 Oct 2026 17:13
58 lines
12856 bytes
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
Re: [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications
#7653
Author: Jakub Kicinski
Date: Mon, 26 Oct 2026 22:59
17 lines
8546 bytes
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
Re: [PATCH net 0/2] tools: ynl: generate code for rt-nexthop bucket notifications
#7705
Author: Demos Ra
Date: Tue, 27 Oct 2026 01:29
10 lines
12517 bytes
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads