mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter
@ 2026-09-10 22:17 Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header Asbjørn Sloth Tønnesen
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

This RFC series adds a C-based linter for checking YNL/C alignment,
and as an example fixes the reported issues in rt-link.

The series is organized as follows:
  Patch 1-2) Prepares the last families for C code gen.
  Patch   3) Introduces the new linter.
  Patch 4-8) Fixes the reported issues in the rt-link family.

When run on net-next the linter reports the following:

$ make -C tools/net/ynl/generated lint 2>&1 > /dev/null |
	grep 'Linter summary'
conntrack: Linter summary: 48 errors, 0 warnings
devlink: Linter summary: 5 errors, 2 warnings
ethtool: Linter summary: 10 errors, 2 warnings
mptcp_pm: Linter summary: 0 errors, 4 warnings
nftables: Linter summary: 183 errors, 0 warnings
nl80211: Linter summary: 193 errors, 0 warnings
nlctrl: Linter summary: 23 errors, 0 warnings
ovs_flow: Linter summary: 2 errors, 3 warnings
rt-link: Linter summary: 173 errors, 8 warnings
rt-neigh: Linter summary: 31 errors, 0 warnings
rt-rule: Linter summary: 9 errors, 0 warnings
tc: Linter summary: 11 errors, 1 warnings

After this series rt-link has 2 false-positive warnings:

$ make -C tools/net/ynl/generated/ rt-link-lint 2>&1 > /dev/null
rt-link: WARN: vlan-protocols: Possible missing member before
ETH_P_8021AD (33024 -> 34984)
rt-link: WARN: netkit-policy: Possible missing member before
NETKIT_DROP (0 -> 2)
rt-link: Linter summary: 0 errors, 2 warnings

WDYT?

Asbjørn Sloth Tønnesen (8):
  netlink: specs: nftables: add uapi-header
  netlink: specs: conntrack: add uapi-header
  tools: ynl: add C-based YNL linter
  netlink: specs: rt-link: add C naming info
  netlink: specs: rt-link: re-align IPv4 devconf
  netlink: specs: rt-link: re-align ifla-inet6-stats
  netlink: specs: rt-link: fix ifinfo-flags names
  netlink: specs: rt-link: fix netkit-policy names

 Documentation/netlink/specs/conntrack.yaml |   1 +
 Documentation/netlink/specs/nftables.yaml  |   1 +
 Documentation/netlink/specs/rt-link.yaml   |  60 +++++---
 include/uapi/linux/snmp.h                  |   6 +-
 tools/net/ynl/Makefile.deps                |  11 +-
 tools/net/ynl/generated/.gitignore         |   3 +
 tools/net/ynl/generated/Makefile           |  27 +++-
 tools/net/ynl/linter/gen-h.sh              |  23 ++++
 tools/net/ynl/linter/linter.h              | 152 +++++++++++++++++++++
 tools/net/ynl/pyynl/ynl_gen_c.py           |  72 ++++++++--
 10 files changed, 316 insertions(+), 40 deletions(-)
 create mode 100755 tools/net/ynl/linter/gen-h.sh
 create mode 100644 tools/net/ynl/linter/linter.h


base-commit: 0abe8777490ebc008635ecb20297761d1b317697
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 2/8] netlink: specs: conntrack: " Asbjørn Sloth Tønnesen
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Define uAPI header, as needed for C code gen.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/nftables.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/netlink/specs/nftables.yaml b/Documentation/netlink/specs/nftables.yaml
index 21edf3d25f34..76f69ed82a24 100644
--- a/Documentation/netlink/specs/nftables.yaml
+++ b/Documentation/netlink/specs/nftables.yaml
@@ -2,6 +2,7 @@
 ---
 name: nftables
 protocol: netlink-raw
+uapi-header: linux/netfilter/nf_tables.h
 protonum: 12
 
 doc: >-
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 2/8] netlink: specs: conntrack: add uapi-header
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-11  2:35   ` Jakub Kicinski
  2026-09-10 22:17 ` [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Define uAPI header, as needed for C code gen.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/conntrack.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/netlink/specs/conntrack.yaml b/Documentation/netlink/specs/conntrack.yaml
index b1eb102ab843..543dcddb0464 100644
--- a/Documentation/netlink/specs/conntrack.yaml
+++ b/Documentation/netlink/specs/conntrack.yaml
@@ -2,6 +2,7 @@
 ---
 name: conntrack
 protocol: netlink-raw
+uapi-header: linux/netfilter/nf_conntrack_common.h
 protonum: 12
 
 doc: >-
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 2/8] netlink: specs: conntrack: " Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-11  2:33   ` Jakub Kicinski
  2026-09-10 22:17 ` [RFC PATCH net-next 4/8] netlink: specs: rt-link: add C naming info Asbjørn Sloth Tønnesen
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Validate that structures described in YNL match their C counterpart,
currently focused on enums.

The aim is to protect against uAPI regressions, and the linter
output should be easy to digest in NIPA.

Building and execution happens in the following steps:

1) ynl_gen_c.py is used to generate C data structures.
   Example: make -C tools/net/ynl/generated rt-link-linter.c

2) gen-h.sh generates a header file with LINTER_HAS_* defines.
   Example: make -C tools/net/ynl/generated rt-link-linter.h

3) Build linter program.
   Example: make -C tools/net/ynl/generated rt-link-linter

4) Execute linter and report findings (if any).
   Example: make -C tools/net/ynl/generated rt-link-lint

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 tools/net/ynl/generated/.gitignore |   3 +
 tools/net/ynl/generated/Makefile   |  27 ++++-
 tools/net/ynl/linter/gen-h.sh      |  23 +++++
 tools/net/ynl/linter/linter.h      | 152 +++++++++++++++++++++++++++++
 tools/net/ynl/pyynl/ynl_gen_c.py   |  72 +++++++++++---
 5 files changed, 261 insertions(+), 16 deletions(-)
 create mode 100755 tools/net/ynl/linter/gen-h.sh
 create mode 100644 tools/net/ynl/linter/linter.h

diff --git a/tools/net/ynl/generated/.gitignore b/tools/net/ynl/generated/.gitignore
index 859a6fb446e1..20dd70cd709e 100644
--- a/tools/net/ynl/generated/.gitignore
+++ b/tools/net/ynl/generated/.gitignore
@@ -1,3 +1,6 @@
 *-user.c
 *-user.h
+*-linter.c
+*-linter.h
+*-linter
 *.rst
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 5a186349b5a8..bcf7f4556313 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -33,8 +33,9 @@ OBJS=$(patsubst %,%-user.o,${GENS})
 SPECS_PATHS=$(wildcard $(SPECS_DIR)/*.yaml)
 SPECS=$(patsubst $(SPECS_DIR)/%.yaml,%,${SPECS_PATHS})
 RSTS=$(patsubst %,%.rst,${SPECS})
+LINTS=$(patsubst %,%-lint,${SPECS})
 
-all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS)
+all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS) $(LINTS)
 
 protos.a: $(OBJS)
 	@echo -e "\tAR $@"
@@ -56,11 +57,29 @@ protos.a: $(OBJS)
 	@echo -e "\tGEN_RST $@"
 	@$(TOOL_RST) -o $@ -i $<
 
+%-linter.c: $(SPECS_DIR)/%.yaml $(TOOL) ../linter/linter.h
+	@echo -e "\tGEN $@"
+	@$(TOOL) --mode user --linter --spec $< -o $@ $(YNL_GEN_ARG_$*)
+
+%-linter.h: %-linter.c ../linter/gen-h.sh
+	@echo -e "\tGEN $@"
+	@../linter/gen-h.sh $(CFLAGS) $(CFLAGS_$*) < $< > $@
+
+%-linter: %-linter.c %-linter.h ../linter/linter.h
+	@echo -e "\tCC $@"
+	@$(CC) $(CFLAGS) $(CFLAGS_$*) -include $*-linter.h -o $@ $<
+
+%-lint: %-linter
+	@echo -e "\tLINT $@"
+	@./$< $*
+
+lint: $(LINTS)
+
 clean:
 	rm -f *.o
 
 distclean: clean
-	rm -f *.c *.h *.a *.rst
+	rm -f *.c *.h *.a *.rst *-linter
 
 regen:
 	@../ynl-regen.sh
@@ -68,7 +87,7 @@ regen:
 install-headers: $(HDRS)
 	@echo -e "\tINSTALL generated headers"
 	@$(INSTALL) -d $(DESTDIR)$(includedir)/ynl
-	@$(INSTALL) -m 0644 *.h $(DESTDIR)$(includedir)/ynl/
+	@$(INSTALL) -m 0644 $(KHDRS) $(DESTDIR)$(includedir)/ynl/
 
 install-rsts: $(RSTS)
 	@echo -e "\tINSTALL generated docs"
@@ -84,5 +103,5 @@ install-specs:
 
 install: install-headers install-rsts install-specs
 
-.PHONY: all clean distclean regen install install-headers install-rsts install-specs
+.PHONY: all clean distclean regen install install-headers install-rsts install-specs lint
 .DEFAULT_GOAL: all
diff --git a/tools/net/ynl/linter/gen-h.sh b/tools/net/ynl/linter/gen-h.sh
new file mode 100755
index 000000000000..247493600034
--- /dev/null
+++ b/tools/net/ynl/linter/gen-h.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+# Usage: ./gen-h.sh $CFLAGS < in.c > out.h
+#
+# Extract valid symbols, and define that they are available. This is a
+# workaround, to avoid compile failures due to non-existent enum members.
+#
+# Capitalized keywords found in the preprocessor output, are mostly enum
+# members.
+#
+# As an example, existence of FOO can be checked with:
+#   #if defined(FOO) || defined(LINTER_HAS_FOO)
+# thus checking for FOO either as a macro or as an enum members.
+
+set -e
+
+echo '/* This is an auto-generated file */'
+grep '^#include <linux/' |
+	cpp -x c "$@" - |
+	grep -wo '[A-Z][A-Z0-9_]\+' |
+	sort | uniq |
+	sed -e 's/^/#define LINTER_HAS_/g'
diff --git a/tools/net/ynl/linter/linter.h b/tools/net/ynl/linter/linter.h
new file mode 100644
index 000000000000..0d1c28c9f214
--- /dev/null
+++ b/tools/net/ynl/linter/linter.h
@@ -0,0 +1,152 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <stdio.h>
+#include <stdbool.h>
+
+struct enum_kv {
+	const char *name;
+	const long long val;
+	const bool is_undef:1;
+};
+
+struct enum_entry {
+	const struct enum_kv ynl;
+	const struct enum_kv c;
+	const bool is_sentinal:1;
+};
+
+#define YNL_ENUM_ENTRY(YNL_NAME, C_NAME, YNL_VALUE) \
+	{ \
+		.ynl = { .name = YNL_NAME, .val = YNL_VALUE }, \
+		.c = { .name = #C_NAME, .val = C_NAME }, \
+	}
+
+#define YNL_ENUM_BAD_ENTRY(YNL_NAME, C_NAME, YNL_VALUE) \
+	{ \
+		.ynl = { .name = YNL_NAME, .val = YNL_VALUE }, \
+		.c = { .name = #C_NAME, .is_undef = true }, \
+	}
+
+#define YNL_ENUM_SENTINAL(C_NAME, YNL_VALUE) \
+	{ \
+		.ynl = { .name = "MAX", .val = YNL_VALUE }, \
+		.c = { .name = #C_NAME, .val = C_NAME }, \
+		.is_sentinal = true, \
+	}
+
+enum ynl_enum_type {
+	YNL_ENUM,
+	YNL_FLAGS,
+};
+
+struct enum_set {
+	const char *name;
+	const struct enum_entry *entry;
+	enum ynl_enum_type type;
+};
+
+struct linter_ctx {
+	int errors;
+	int warnings;
+	const char *name;
+};
+
+#define errf(fmt, ...) \
+	do { \
+		fprintf(stderr, "%s: ERROR: " fmt, ctx->name, __VA_ARGS__); \
+		ctx->errors++; \
+	} while (0)
+
+#define warnf(fmt, ...) \
+	do { \
+		fprintf(stderr, "%s: WARN: " fmt, ctx->name, __VA_ARGS__); \
+		ctx->warnings++; \
+	} while (0)
+
+static inline long long find_next_value(const struct enum_set *es,
+					const long long last_val)
+{
+	switch (es->type) {
+	case YNL_ENUM:
+		return last_val + 1;
+	case YNL_FLAGS:
+		return last_val << 1;
+	default:
+		/* unreachable */
+		abort();
+	}
+}
+
+static inline void lint_enum_entry(struct linter_ctx *ctx,
+				   const struct enum_set *es,
+				   const struct enum_entry *entry,
+				   long long *last_val, const int i,
+				   const int cnt)
+{
+	const long long val = entry->c.val;
+
+	if (i > 0 && val != *last_val && val != find_next_value(es, *last_val))
+		warnf("%s: Possible missing member before %s (%lld -> %lld)\n",
+		      es->name, entry->c.name, *last_val, val);
+	*last_val = entry->c.val;
+
+	if (i == cnt - 1 && strcmp(entry->ynl.name, "max") == 0)
+		errf("%s: Sentinal used in YNL spec\n", es->name);
+
+	if (entry->c.is_undef) {
+		errf("%s: %s: %s not found\n", es->name, entry->ynl.name,
+		     entry->c.name);
+		return;
+	}
+
+	if (entry->ynl.val == entry->c.val)
+		return;
+
+	if (entry->is_sentinal) {
+		if (es->type == YNL_ENUM && entry->ynl.val + 1 == entry->c.val)
+			return; /* eg. DEVCONF_MAX is the storage size */
+		warnf("%s: Sentinal mismatch: %lld != %lld (Last YNL != %s)\n",
+		      es->name, entry->ynl.val, entry->c.val, entry->c.name);
+	} else {
+		errf("%s: Value mismatch: %lld != %lld (%s != %s)\n", es->name,
+		     entry->ynl.val, entry->c.val, entry->ynl.name,
+		     entry->c.name);
+	}
+}
+
+static inline void lint_enum(struct linter_ctx *ctx, const struct enum_set *es)
+{
+	const struct enum_entry *entry = es->entry;
+	long long last_val;
+	int cnt = 0;
+	int i = 0;
+
+	while (entry->ynl.name) {
+		if (!entry->is_sentinal)
+			cnt++;
+		entry++;
+	}
+	entry = es->entry;
+
+	while (entry->ynl.name)
+		lint_enum_entry(ctx, es, entry++, &last_val, i++, cnt);
+}
+
+static inline int linter_run(const int argc, const char **argv,
+			     const struct enum_set *es)
+{
+	struct linter_ctx ctx = {
+		.name = argv[argc > 1 ? 1 : 0],
+	};
+
+	while (es->name) {
+		lint_enum(&ctx, es);
+		es++;
+	}
+
+	if (ctx.errors || ctx.warnings)
+		fprintf(stderr, "%s: Linter summary: %d errors, %d warnings\n",
+			ctx.name, ctx.errors, ctx.warnings);
+
+	return EXIT_SUCCESS;
+}
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 2b3483db1b60..5bbe3cba8f75 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -1688,6 +1688,8 @@ class CodeWriter:
         self.close_out_file()
 
     def close_out_file(self):
+        if self._block_end:
+            self._out.write('\t' * self._ind + '}\n')
         if self._out == os.sys.stdout:
             return
         # Avoid modifying the file if contents didn't change
@@ -2084,6 +2086,30 @@ def put_enum_to_str(_family, cw, enum):
     _put_enum_to_str_helper(cw, enum.render_name, map_name, 'value', enum=enum)
 
 
+def put_enum_to_linter(family, cw, enum):
+    name_pfx = enum.get('name-prefix', f"{family.ident_name}-{enum['name']}-")
+    max_name = c_upper(name_pfx + 'max')
+    map_name = f'{enum.render_name}_entries'
+    cw.block_start(line=f"static const struct enum_entry {map_name}[] =")
+    val = 0
+    for entry in enum.entries.values():
+        val = entry.user_value()
+        c_name = entry.c_name
+        cw.p(f'#if defined({c_name}) || defined(LINTER_HAS_{c_name})')
+        cw.p(f'YNL_ENUM_ENTRY("{entry.name}", {c_name}, {val}),')
+        cw.p('#else')
+        cw.p(f'YNL_ENUM_BAD_ENTRY("{entry.name}", {c_name}, {val}),')
+        cw.p('#endif')
+    cw.p(f'#if defined({max_name}) || defined(LINTER_HAS_{max_name})')
+    cw.p(f'YNL_ENUM_SENTINAL({max_name}, {val}),')
+    cw.p('#endif')
+    cw.p('{},')
+    cw.block_end(line=';')
+    cw.nl()
+    enum_type = enum['type'].upper()
+    return f'{{"{enum.name}", &{map_name}[0], YNL_{enum_type}}},'
+
+
 def put_local_vars(struct):
     local_vars = []
     has_array = False
@@ -3462,6 +3488,7 @@ def main():
     parser.add_argument('--spec', dest='spec', type=str, required=True)
     parser.add_argument('--header', dest='header', action='store_true', default=None)
     parser.add_argument('--source', dest='header', action='store_false')
+    parser.add_argument('--linter', dest='linter', action='store_true')
     parser.add_argument('--user-header', nargs='+', default=[])
     parser.add_argument('--cmp-out', action='store_true', default=None,
                         help='Do not overwrite the output file if the new output is identical to the old')
@@ -3470,8 +3497,10 @@ def main():
     parser.add_argument('--function-prefix', dest='fn_prefix', type=str)
     args = parser.parse_args()
 
+    if args.linter:
+        args.header = False
     if args.header is None:
-        parser.error("--header or --source is required")
+        parser.error("--header, --source or --linter is required")
 
     exclude_ops = [re.compile(expr) for expr in args.exclude_op]
 
@@ -3494,17 +3523,19 @@ def main():
         cw.p(f'// SPDX-License-Identifier: {parsed.license}')
     cw.p("/* Do not edit directly, auto-generated from: */")
     cw.p(f"/*\t{spec_kernel} */")
-    cw.p(f"/* YNL-GEN {args.mode} {'header' if args.header else 'source'} */")
-    if args.exclude_op or args.user_header or args.fn_prefix:
-        line = ''
-        if args.user_header:
-            line += ' --user-header '.join([''] + args.user_header)
-        if args.exclude_op:
-            line += ' --exclude-op '.join([''] + args.exclude_op)
-        if args.fn_prefix:
-            line += f' --function-prefix {args.fn_prefix}'
-        cw.p(f'/* YNL-ARG{line} */')
-    cw.p('/* To regenerate run: tools/net/ynl/ynl-regen.sh */')
+    if not args.linter:
+        ynl_arg = 'header' if args.header else 'source'
+        cw.p(f"/* YNL-GEN {args.mode} {ynl_arg} */")
+        if args.exclude_op or args.user_header or args.fn_prefix:
+            line = ''
+            if args.user_header:
+                line += ' --user-header '.join([''] + args.user_header)
+            if args.exclude_op:
+                line += ' --exclude-op '.join([''] + args.exclude_op)
+            if args.fn_prefix:
+                line += f' --function-prefix {args.fn_prefix}'
+            cw.p(f'/* YNL-ARG{line} */')
+        cw.p('/* To regenerate run: tools/net/ynl/ynl-regen.sh */')
     cw.nl()
 
     if args.mode == 'uapi':
@@ -3539,6 +3570,8 @@ def main():
             cw.p('#include <linux/types.h>')
             if family_contains_bitfield32(parsed):
                 cw.p('#include <linux/netlink.h>')
+        elif args.linter:
+            cw.p('#include "../linter/linter.h"')
         else:
             cw.p(f'#include "{hdr_file}"')
             cw.p('#include "ynl.h"')
@@ -3690,6 +3723,21 @@ def main():
                     cw.nl()
                     print_wrapped_type(ri)
             cw.nl()
+        elif args.linter:
+            enum_sets = []
+            for name, const in parsed.consts.items():
+                if isinstance(const, EnumSet):
+                    enum_sets.append(put_enum_to_linter(parsed, cw, const))
+            cw.nl()
+            cw.block_start(line="static const struct enum_set enums[] =")
+            for enum_set in enum_sets:
+                cw.p(enum_set)
+            cw.p('{},')
+            cw.block_end(line=';')
+            cw.nl()
+            cw.write_func('int', 'main',
+                          args=['const int argc', 'const char **argv'],
+                          body=['return linter_run(argc, argv, &enums[0]);'])
         else:
             cw.p('/* Enums */')
             put_op_name(parsed, cw)
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 4/8] netlink: specs: rt-link: add C naming info
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (2 preceding siblings ...)
  2026-09-10 22:17 ` [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 5/8] netlink: specs: rt-link: re-align IPv4 devconf Asbjørn Sloth Tønnesen
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Add missing naming info needed for C code gen.

Add headers to Makefile.deps, so that the local copy is used,
except for if.h which is non-trivial due to a compiler.h include.

Rename snmp.h header guard, for Makefile.deps compatibility, this
is opaque once installed by scripts/headers_install.sh.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/rt-link.yaml | 25 +++++++++++++++++++++---
 include/uapi/linux/snmp.h                |  6 +++---
 tools/net/ynl/Makefile.deps              | 11 +++++++++--
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml
index 61ebb9a2bad5..a74108072ce7 100644
--- a/Documentation/netlink/specs/rt-link.yaml
+++ b/Documentation/netlink/specs/rt-link.yaml
@@ -58,6 +58,7 @@ definitions:
     name: vlan-protocols
     type: enum
     enum-name:
+    name-prefix: eth-p-
     entries:
       -
         name: 8021q
@@ -305,6 +306,8 @@ definitions:
   -
     name: ipv4-devconf
     enum-name:
+    name-prefix: ipv4-devconf-
+    header: linux/ip.h
     type: enum
     entries:
       -
@@ -376,6 +379,8 @@ definitions:
   -
     name: ipv6-devconf
     enum-name:
+    name-prefix: devconf-
+    header: linux/ipv6.h
     type: enum
     entries:
       -
@@ -501,6 +506,8 @@ definitions:
   -
     name: ifla-icmp6-stats
     enum-name:
+    name-prefix: icmp6-mib-
+    header: linux/snmp.h
     type: enum
     entries:
       -
@@ -520,6 +527,8 @@ definitions:
   -
     name: ifla-inet6-stats
     enum-name:
+    name-prefix: ipstats-mib-
+    header: linux/snmp.h
     type: enum
     entries:
       -
@@ -640,6 +649,8 @@ definitions:
     name: vlan-flags
     type: flags
     enum-name:
+    name-prefix: vlan-flag-
+    header: linux/if_vlan.h
     entries:
       - reorder-hdr
       - gvrp
@@ -727,6 +738,8 @@ definitions:
     name: ifla-vf-link-state-enum
     type: enum
     enum-name:
+    name-prefix: ifla-vf-link-state-
+    header: linux/if_link.h
     entries:
       - auto
       - enable
@@ -794,6 +807,7 @@ definitions:
     name: rtext-filter
     type: flags
     enum-name:
+    name-prefix: rtext-filter-
     entries:
       - vf
       - brvlan
@@ -806,7 +820,8 @@ definitions:
   -
     name: netkit-policy
     type: enum
-    enum-name:
+    enum-name: netkit-action
+    name-prefix: netkit-
     entries:
       -
         name: forward
@@ -818,6 +833,7 @@ definitions:
     name: netkit-mode
     type: enum
     enum-name: netkit-mode
+    name-prefix: netkit-
     entries:
       - name: l2
       - name: l3
@@ -825,7 +841,8 @@ definitions:
   -
     name: netkit-scrub
     type: enum
-    enum-name:
+    enum-name: netkit-scrub
+    name-prefix: netkit-scrub-
     entries:
       - name: none
       - name: default
@@ -833,13 +850,14 @@ definitions:
     name: netkit-pairing
     type: enum
     enum-name: netkit-pairing
+    name-prefix: netkit-device-
     entries:
       - name: pair
       - name: single
   -
     name: ovpn-mode
     enum-name: ovpn-mode
-    name-prefix: ovpn-mode
+    name-prefix: ovpn-mode-
     type: enum
     entries:
       - p2p
@@ -848,6 +866,7 @@ definitions:
     name: br-stp-mode
     type: enum
     enum-name: br-stp-mode
+    name-prefix: br-stp-mode-
     entries:
       - auto
       - user
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index 49f5640092a0..26bdabc502fe 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -5,8 +5,8 @@
  * Author: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
  */
 
-#ifndef _LINUX_SNMP_H
-#define _LINUX_SNMP_H
+#ifndef _UAPI_LINUX_SNMP_H
+#define _UAPI_LINUX_SNMP_H
 
 /* ipstats mib definitions */
 /*
@@ -372,4 +372,4 @@ enum
 	__LINUX_MIB_TLSMAX
 };
 
-#endif	/* _LINUX_SNMP_H */
+#endif	/* _UAPI_LINUX_SNMP_H */
diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index 2771375339d9..8e136a5df899 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -40,8 +40,15 @@ CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)
 CFLAGS_psp:=$(call get_hdr_inc,_LINUX_PSP_H,psp.h)
 CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
 	$(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h)
-CFLAGS_rt-link:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
-	$(call get_hdr_inc,_LINUX_IF_LINK_H,if_link.h)
+CFLAGS_rt-link:=$(call get_hdr_inc,_LINUX_IF_LINK_H,if_link.h) \
+	$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
+	$(call get_hdr_inc,_LINUX_IP_H,ip.h) \
+	$(call get_hdr_inc,_IPV6_H,ipv6.h) \
+	$(call get_hdr_inc,_LINUX_IF_BRIDGE_H,if_bridge.h) \
+	$(call get_hdr_inc,_IF_TUNNEL_H_,if_tunnel.h) \
+	$(call get_hdr_inc,_LINUX_IF_VLAN_H_,if_vlan.h) \
+	$(call get_hdr_inc,_LINUX_SNMP_H,snmp.h) \
+	$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h)
 CFLAGS_rt-neigh:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
 	$(call get_hdr_inc,__LINUX_NEIGHBOUR_H,neighbour.h)
 CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h)
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 5/8] netlink: specs: rt-link: re-align IPv4 devconf
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (3 preceding siblings ...)
  2026-09-10 22:17 ` [RFC PATCH net-next 4/8] netlink: specs: rt-link: add C naming info Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 6/8] netlink: specs: rt-link: re-align ifla-inet6-stats Asbjørn Sloth Tønnesen
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

The YNL "ipv4-devconf" enum is misaligned with the IPV4_DEVCONF_* enum.

IPV4_DEVCONF_* starts at 1, ipv4-devconf starts at 0.

$ git grep -B3 -A1 IPV4_DEVCONF_FORWARDING include/
inc../uapi/linux/ip.h-/* index values for the variables in ipv4_devconf */
inc../uapi/linux/ip.h-enum
inc../uapi/linux/ip.h-{
inc../uapi/linux/ip.h:        IPV4_DEVCONF_FORWARDING=1,
inc../uapi/linux/ip.h-        IPV4_DEVCONF_MC_FORWARDING,

Re-align the YNL spec by explicitly setting the first value to 1.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/rt-link.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml
index a74108072ce7..aee516e87b89 100644
--- a/Documentation/netlink/specs/rt-link.yaml
+++ b/Documentation/netlink/specs/rt-link.yaml
@@ -312,6 +312,7 @@ definitions:
     entries:
       -
         name: forwarding
+        value: 1
       -
         name: mc-forwarding
       -
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 6/8] netlink: specs: rt-link: re-align ifla-inet6-stats
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (4 preceding siblings ...)
  2026-09-10 22:17 ` [RFC PATCH net-next 5/8] netlink: specs: rt-link: re-align IPv4 devconf Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 7/8] netlink: specs: rt-link: fix ifinfo-flags names Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 8/8] netlink: specs: rt-link: fix netkit-policy names Asbjørn Sloth Tønnesen
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel, Sashiko

YNL enum ifla-inet6-stats got mis-aligned with C, as two commits
reordered the enum.

In commit b4a11b2033b7 ("net: fix IPSTATS_MIB_OUTPKGS increment in
OutForwDatagrams."), IPSTATS_MIB_OUTPKTS was renamed to _OUTREQUESTS
and a new _OUTPKTS was as the last entry.

In commit 652e2c777862 ("net: reorganize IP MIB values (II)"), the
IPSTATS_MIB_* enum was reorganized for data locality.

Neither of these commits updated the YNL spec.

This changed uAPI, as IPSTATS_MIB_* is used as indicies in an u64 array,
exported as IFLA_INET6_STATS by inet6_fill_ifla6_stats_attrs().

This patch updates ifla-inet6-stats to reflect both of these commits.
Next time we want to reorganize these counters we should properly apply
mapping as to maintain the current order on the netlink side.

This pre-existing issue was identified by Sashiko during review of
commit 2b0aecb7b2b1 ("netlink: specs: rt-link: add accept-ra-min-lft").

Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260831093458.472180-1-ast%40fiberby.net
Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/rt-link.yaml | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml
index aee516e87b89..c84bbd58cfcb 100644
--- a/Documentation/netlink/specs/rt-link.yaml
+++ b/Documentation/netlink/specs/rt-link.yaml
@@ -541,11 +541,21 @@ definitions:
       -
         name: indelivers
       -
-        name: outforwdatagrams
+        name: noectpkts
+      -
+        name: ect1pkts
+      -
+        name: ect0pkts
+      -
+        name: cepkts
+      -
+        name: outrequests
       -
         name: outpkts
       -
         name: outoctets
+      -
+        name: outforwdatagrams
       -
         name: inhdrerrors
       -
@@ -596,14 +606,6 @@ definitions:
         name: outbcastoctets
       -
         name: csumerrors
-      -
-        name: noectpkts
-      -
-        name: ect1-pkts
-      -
-        name: ect0-pkts
-      -
-        name: cepkts
       -
         name: reasm-overlaps
   - name: br-boolopt-multi
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 7/8] netlink: specs: rt-link: fix ifinfo-flags names
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (5 preceding siblings ...)
  2026-09-10 22:17 ` [RFC PATCH net-next 6/8] netlink: specs: rt-link: re-align ifla-inet6-stats Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  2026-09-10 22:17 ` [RFC PATCH net-next 8/8] netlink: specs: rt-link: fix netkit-policy names Asbjørn Sloth Tønnesen
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Correct the names of `enum net_device_flags` constants:

- IFF_POINTOPOINT should be "pointopoint", not "point-to-point".
- IFF_NOTRAILERS should be "notrailers", not "no-trailers".
- IFF_NOARP should be "noarp", not "no-arp".
- IFF_ALLMULTI should be "allmulti", not "all-multi".
- IFF_AUTOMEDIA should be "automedia", not "auto-media".

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/rt-link.yaml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml
index c84bbd58cfcb..6639b7f5677b 100644
--- a/Documentation/netlink/specs/rt-link.yaml
+++ b/Documentation/netlink/specs/rt-link.yaml
@@ -25,17 +25,17 @@ definitions:
       -
         name: loopback
       -
-        name: point-to-point
+        name: pointopoint
       -
-        name: no-trailers
+        name: notrailers
       -
         name: running
       -
-        name: no-arp
+        name: noarp
       -
         name: promisc
       -
-        name: all-multi
+        name: allmulti
       -
         name: master
       -
@@ -45,7 +45,7 @@ definitions:
       -
         name: portsel
       -
-        name: auto-media
+        name: automedia
       -
         name: dynamic
       -
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH net-next 8/8] netlink: specs: rt-link: fix netkit-policy names
  2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
                   ` (6 preceding siblings ...)
  2026-09-10 22:17 ` [RFC PATCH net-next 7/8] netlink: specs: rt-link: fix ifinfo-flags names Asbjørn Sloth Tønnesen
@ 2026-09-10 22:17 ` Asbjørn Sloth Tønnesen
  7 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-10 22:17 UTC (permalink / raw)
  To: netdev
  Cc: Asbjørn Sloth Tønnesen, Jakub Kicinski, Donald Hunter,
	Danielle Ratson, David S. Miller, Eric Dumazet, Greg Thelen,
	Ilya Maximets, Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

Correct the names of these `enum netkit_action` constants:

- NETKIT_PASS is 0, so "pass", not "forward".
- NETKIT_DROP is 2, so "drop", not "blackhole".

Note, the other enum members are not used in netlink, and
are not allowed by netkit_check_policy().

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
---
 Documentation/netlink/specs/rt-link.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netlink/specs/rt-link.yaml
index 6639b7f5677b..fe52d508d607 100644
--- a/Documentation/netlink/specs/rt-link.yaml
+++ b/Documentation/netlink/specs/rt-link.yaml
@@ -827,10 +827,10 @@ definitions:
     name-prefix: netkit-
     entries:
       -
-        name: forward
+        name: pass
         value: 0
       -
-        name: blackhole
+        name: drop
         value: 2
   -
     name: netkit-mode
-- 
2.55.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter
  2026-09-10 22:17 ` [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter Asbjørn Sloth Tønnesen
@ 2026-09-11  2:33   ` Jakub Kicinski
  2026-09-11 22:27     ` Asbjørn Sloth Tønnesen
  0 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2026-09-11  2:33 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: netdev, Donald Hunter, Danielle Ratson, David S. Miller,
	Eric Dumazet, Greg Thelen, Ilya Maximets,
	Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

On Thu, 10 Sep 2026 22:17:23 +0000 Asbjørn Sloth Tønnesen wrote:
> Validate that structures described in YNL match their C counterpart,
> currently focused on enums.

I don't see the point of this. LLMs will catch most of the problems
and for the hundredth time classic netlink is not the focus for YNL.
Anything genetlink can have YNL generate the code and uAPI so problems
do no exist.

Feel free to keep the code OOT and let's see if you can prove my
assertion wrong within a couple of release :)

If you have any ready fixes to the spec please post them.
I'm also sitting on a bunch of fixes based on LLM scans, I'm just
blocked on the "15 outstanding patches" limit :(

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH net-next 2/8] netlink: specs: conntrack: add uapi-header
  2026-09-10 22:17 ` [RFC PATCH net-next 2/8] netlink: specs: conntrack: " Asbjørn Sloth Tønnesen
@ 2026-09-11  2:35   ` Jakub Kicinski
  0 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2026-09-11  2:35 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: netdev, Donald Hunter, Danielle Ratson, David S. Miller,
	Eric Dumazet, Greg Thelen, Ilya Maximets,
	Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

On Thu, 10 Sep 2026 22:17:22 +0000 Asbjørn Sloth Tønnesen wrote:
> Define uAPI header, as needed for C code gen.

You mean your own code gen? We don't support real codegen on conntrack

tools/net/ynl/generated/Makefile:27:GENS_UNSUP=conntrack nftables


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter
  2026-09-11  2:33   ` Jakub Kicinski
@ 2026-09-11 22:27     ` Asbjørn Sloth Tønnesen
  0 siblings, 0 replies; 12+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2026-09-11 22:27 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, Donald Hunter, Danielle Ratson, David S. Miller,
	Eric Dumazet, Greg Thelen, Ilya Maximets,
	Matthieu Baerts (Netdev Foundation),
	Maxime Chevallier (Netdev Foundation),
	Paolo Abeni, Remy D. Farley, Simon Horman, Stanislav Fomichev,
	Heng Guo, linux-kernel

On 9/11/26 2:33 AM, Jakub Kicinski wrote:
> On Thu, 10 Sep 2026 22:17:23 +0000 Asbjørn Sloth Tønnesen wrote:
>> Validate that structures described in YNL match their C counterpart,
>> currently focused on enums.
> 
> I don't see the point of this. LLMs will catch most of the problems
> and for the hundredth time classic netlink is not the focus for YNL.
> Anything genetlink can have YNL generate the code and uAPI so problems
> do no exist.

FTR, I didn't intent to imply any "regular" C code gen on classic families,
the --linter was a very limited output mode, only for validating enum alignment.

I like to also have deterministic checks, the LLM didn't catch the
IPV4_DEVCONF_* alignment issue, while reviewing commit 5e63ade19044
("netlink: specs: rt-link: update ipv6 devconf doc"), where I claimed
that IPV4_DEVCONF_FORWARDING = 1 (while it was 0 in YNL) in patch 1/3.

Now reading the raw log, the closest it got was "... which means there could
be an existing bug in `ipv4-devconf`!", but then it forgot about it, and
that was for patch 3/3. I can't find it in the Clashiko log for that series.

https://sashiko.dev/#/log/148492

> Feel free to keep the code OOT and let's see if you can prove my
> assertion wrong within a couple of release :)

I will keep it OOT for now. Thank you for your review!

> If you have any ready fixes to the spec please post them.
> I'm also sitting on a bunch of fixes based on LLM scans, I'm just
> blocked on the "15 outstanding patches" limit :(

I have posted my fixes for most severe issues now, and left out adding
extra enum-prefix and header entries. I skimmed your new devlink spec
patches, to look for duplicates, but will do a review tomorrow.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-09-11 22:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 22:17 [RFC PATCH net-next 0/8] tools: ynl: C-based YNL linter Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 2/8] netlink: specs: conntrack: " Asbjørn Sloth Tønnesen
2026-09-11  2:35   ` Jakub Kicinski
2026-09-10 22:17 ` [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter Asbjørn Sloth Tønnesen
2026-09-11  2:33   ` Jakub Kicinski
2026-09-11 22:27     ` Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 4/8] netlink: specs: rt-link: add C naming info Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 5/8] netlink: specs: rt-link: re-align IPv4 devconf Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 6/8] netlink: specs: rt-link: re-align ifla-inet6-stats Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 7/8] netlink: specs: rt-link: fix ifinfo-flags names Asbjørn Sloth Tønnesen
2026-09-10 22:17 ` [RFC PATCH net-next 8/8] netlink: specs: rt-link: fix netkit-policy names Asbjørn Sloth Tønnesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®