From: Demos Ra 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 --- 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