From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E0D44718D7; Thu, 10 Sep 2026 22:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078793; cv=none; b=YFprpOkFbsgC8U+8l/EX+n0nwdl5iqVIBU0CvVMTXhEQRgMFxD1ddywggzyePrWSld2+Ku6yf5XRuLSoIU5+UVg5yk2hiysbwVo06st15sviowsJRCZchvIeXzQuDeyNjtKDqniXuKto+yoBc/merNN00szNuUAcQIc+R/TICdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078793; c=relaxed/simple; bh=s+hOzkSuye3kU3kpk94W1+7penkRt7gxI4zAAVQeNLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XV90LV3k6VZuwa0/1Y74LK9VwyfapCy6DGkOBRuDvfWUmqUHCwJ5q3pfNH8QIDmBKp+lukXQc/wHZDpaDOtQcxmcAjOoqnapT7u+IsNKDxfdzJugvEjMvOy+rDZUTdl9z1/+UuuCODWJBWbIRCPIYZj51umy/6nZy9tQAAXljVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=iTLmFyb3; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="iTLmFyb3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=s+hOzkSuye3kU3kpk94W1+7penkRt7gxI4zAAVQeNLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTLmFyb3hVpMkawhgWEa68ONsJaWPNcNx984HoWKKBpDvitTY0HwLYcLu3Vnh5jER LRKC5cAAAQI/d6Uxvk+TUda/thCd7RU84bBuhyABoR2a9q0zEqigWQtvYt15kyF/5m a9NG75APPwNWAEGQpPkwGICisMBXMwFolyz5lsH0a8t2C1J5hTI8q688YUIMekpAvT NwEYQTuAFZYj9wI90kw34YCMk62tzEWvRg0jciabCVBXMtObz9ADC6ORaJRt33rOQF tplG5CyLcYhoYnAiYHAQniZLyV/xFVOEfwA5Fg29mCEoHmNobZ0yo5zAXKz3s9JtU8 GxWM3YBiKudFA== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 5685060114; Thu, 10 Sep 2026 22:19:38 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 57E3C201E22; Thu, 10 Sep 2026 22:17:35 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 1/8] netlink: specs: nftables: add uapi-header Date: Thu, 10 Sep 2026 22:17:21 +0000 Message-ID: <20260910221733.1021864-2-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Define uAPI header, as needed for C code gen. Signed-off-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen --- Documentation/netlink/specs/nftables.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/netlink/specs/nftables.yaml b/Documentation/netl= ink/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 =20 doc: >- --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9347A391846; Thu, 10 Sep 2026 22:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078789; cv=none; b=Y0iiGn7QHK/0UOHIvgdxIRcaojStQCfGPP2OwUJk/KMd4WIZock/bVeoPkxDHiSS5bjsNE+qEkxoT8BVv3meUU6v+xJG55ol/WxG2hQDrRkYnREF3qbLq4gFRM9Hmy2IrrhBkr/9s0oPoc7qMtoUFzcQTMUq0HjrDXZAE0lMfxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078789; c=relaxed/simple; bh=5SVbkqIRTJ6vFBojUaOqULhwVzhidmNYRFGSJ1RSPZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=riD+6Y3aHBocV2yM3+mEZU2aGYOSj/4nAEw0LYQiE/XW13r5Bm/KfCy/skvHXy6+iIc8SKYp9M5ldH04kZ6Og+vJS1/MUVrod24ERhXZKZyZTJIEU2Bl0Lh9NQxi63ARsTG8sP6rNbMl2ucamW0sCrxgd4qwww8+rpSUIzTEUhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=JYr9dWnk; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="JYr9dWnk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=5SVbkqIRTJ6vFBojUaOqULhwVzhidmNYRFGSJ1RSPZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYr9dWnkkntyKQp9kW8/kMvsgyBo34DoixPCEvWvW1LWUyUcSJzN4KyIAW+Oy0Elq 4SSTPCrm+dkRZIddIsDLAeTRp4TEjxSqMdSn/88jNmKttWkoy4+Ia4yBp84845ny4r UtNoTKDk8+TWKXlRK5y2F8lnU82m81XsWK2shfP92ORX2GQ/Psv64aDhkPmuIHD2su eH9l2Av5qIfXbh9NFpm3WjaAfHVNehKvgbE4YOTjQcnAkNS+JQ5hs6EPyT2fWDNwtp VCU+aPGqCacyIxdwCawWo4ZSoECltHrbyrvpZFdgqQCglG09767n73BnWsaywVDTbQ IqWnAB/XuOLDA== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 2D2F2600FC; Thu, 10 Sep 2026 22:19:19 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id DAFC9201FE5; Thu, 10 Sep 2026 22:17:35 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 2/8] netlink: specs: conntrack: add uapi-header Date: Thu, 10 Sep 2026 22:17:22 +0000 Message-ID: <20260910221733.1021864-3-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Define uAPI header, as needed for C code gen. Signed-off-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen --- Documentation/netlink/specs/conntrack.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/netlink/specs/conntrack.yaml b/Documentation/net= link/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 =20 doc: >- --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97A984718C6; Thu, 10 Sep 2026 22:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078794; cv=none; b=gwrElNV7osg1GP/MZ4QE4Xmt+yrQASfjGOGbDCd0DLkxH49jtDKgAzhKP26BFKK8NlaiQDZ/Qd72UgQnidaNgHzJsEmXiXMdjxCSyVqijfnDa7qd8sROMgZo7Cbssk/3IvTM8DY8b3gHu3+JzAPS4jnwGQDrBtkRywqsfIbqKfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078794; c=relaxed/simple; bh=92SoVv7TfxrFFZLu/7aM+Ig16jRWvHIVrK4F79FlPXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mcPk1WGs21dNwey9tMrPADQ7edJ0yZJDx9qBvsRzU6PqEfoTeiWgDGDhTaSD3DyngVnjKHni3WiRUwQT59YSTho7qSffxZrZDMJDOLi+F+wbvAk5lcnvy5ziHtIH3a64e4OackyGfhUw8Lj4id8R9WxT6MFgAW4EQeDpnKgd1Y4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=do33mMtk; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="do33mMtk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=92SoVv7TfxrFFZLu/7aM+Ig16jRWvHIVrK4F79FlPXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=do33mMtkU4b1/lxXxSJzOPCSqty2hp7lKl3oWsq9Wb5aPW9PmCPbikOoC4TB0RtIi pyOFQI9ZNun7hz5P/cOT1woihZcbvgd2sgJf7VtIxi5/fNUoPDS+87UgTevD5IQVN4 smopC9ZPgKscOZAlj+0IXA/v3Adfrymi4uFW1H2WerkzgnHlvruXU9PJSU9KkYqpzC f6l7UwZCGK+r4hfmjvMGRdDMQp5AgmTI6OoSRiUpO8F73aZFUOzd14AcodYbjvMnxF q0HeBdWe+n6NT+fC4aQl+hlhQZ7LTR48XL4rQEkCbuLidxmkRIDKqte8qWeMHc51s4 RCKPhcHaFyukw== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 464CC60113; Thu, 10 Sep 2026 22:19:38 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 5BA68202052; Thu, 10 Sep 2026 22:17:36 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 3/8] tools: ynl: add C-based YNL linter Date: Thu, 10 Sep 2026 22:17:23 +0000 Message-ID: <20260910221733.1021864-4-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=B8rn Sloth T=C3=B8nnesen --- 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/Mak= efile index 5a186349b5a8..bcf7f4556313 100644 --- a/tools/net/ynl/generated/Makefile +++ b/tools/net/ynl/generated/Makefile @@ -33,8 +33,9 @@ OBJS=3D$(patsubst %,%-user.o,${GENS}) SPECS_PATHS=3D$(wildcard $(SPECS_DIR)/*.yaml) SPECS=3D$(patsubst $(SPECS_DIR)/%.yaml,%,${SPECS_PATHS}) RSTS=3D$(patsubst %,%.rst,${SPECS}) +LINTS=3D$(patsubst %,%-lint,${SPECS}) =20 -all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS) +all: protos.a $(HDRS) $(SRCS) $(KHDRS) $(KSRCS) $(UAPI) $(RSTS) $(LINTS) =20 protos.a: $(OBJS) @echo -e "\tAR $@" @@ -56,11 +57,29 @@ protos.a: $(OBJS) @echo -e "\tGEN_RST $@" @$(TOOL_RST) -o $@ -i $< =20 +%-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 =20 distclean: clean - rm -f *.c *.h *.a *.rst + rm -f *.c *.h *.a *.rst *-linter =20 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/ =20 install-rsts: $(RSTS) @echo -e "\tINSTALL generated docs" @@ -84,5 +103,5 @@ install-specs: =20 install: install-headers install-rsts install-specs =20 -.PHONY: all clean distclean regen install install-headers install-rsts ins= tall-specs +.PHONY: all clean distclean regen install install-headers install-rsts ins= tall-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 +#include + +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 =3D { .name =3D YNL_NAME, .val =3D YNL_VALUE }, \ + .c =3D { .name =3D #C_NAME, .val =3D C_NAME }, \ + } + +#define YNL_ENUM_BAD_ENTRY(YNL_NAME, C_NAME, YNL_VALUE) \ + { \ + .ynl =3D { .name =3D YNL_NAME, .val =3D YNL_VALUE }, \ + .c =3D { .name =3D #C_NAME, .is_undef =3D true }, \ + } + +#define YNL_ENUM_SENTINAL(C_NAME, YNL_VALUE) \ + { \ + .ynl =3D { .name =3D "MAX", .val =3D YNL_VALUE }, \ + .c =3D { .name =3D #C_NAME, .val =3D C_NAME }, \ + .is_sentinal =3D 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 =3D entry->c.val; + + if (i > 0 && val !=3D *last_val && val !=3D 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 =3D entry->c.val; + + if (i =3D=3D cnt - 1 && strcmp(entry->ynl.name, "max") =3D=3D 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 =3D=3D entry->c.val) + return; + + if (entry->is_sentinal) { + if (es->type =3D=3D YNL_ENUM && entry->ynl.val + 1 =3D=3D entry->c.val) + return; /* eg. DEVCONF_MAX is the storage size */ + warnf("%s: Sentinal mismatch: %lld !=3D %lld (Last YNL !=3D %s)\n", + es->name, entry->ynl.val, entry->c.val, entry->c.name); + } else { + errf("%s: Value mismatch: %lld !=3D %lld (%s !=3D %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 =3D es->entry; + long long last_val; + int cnt =3D 0; + int i =3D 0; + + while (entry->ynl.name) { + if (!entry->is_sentinal) + cnt++; + entry++; + } + entry =3D 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 =3D { + .name =3D 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() =20 def close_out_file(self): + if self._block_end: + self._out.write('\t' * self._ind + '}\n') if self._out =3D=3D 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= =3Denum) =20 =20 +def put_enum_to_linter(family, cw, enum): + name_pfx =3D enum.get('name-prefix', f"{family.ident_name}-{enum['name= ']}-") + max_name =3D c_upper(name_pfx + 'max') + map_name =3D f'{enum.render_name}_entries' + cw.block_start(line=3Df"static const struct enum_entry {map_name}[] = =3D") + val =3D 0 + for entry in enum.entries.values(): + val =3D entry.user_value() + c_name =3D 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=3D';') + cw.nl() + enum_type =3D enum['type'].upper() + return f'{{"{enum.name}", &{map_name}[0], YNL_{enum_type}}},' + + def put_local_vars(struct): local_vars =3D [] has_array =3D False @@ -3462,6 +3488,7 @@ def main(): parser.add_argument('--spec', dest=3D'spec', type=3Dstr, required=3DTr= ue) parser.add_argument('--header', dest=3D'header', action=3D'store_true'= , default=3DNone) parser.add_argument('--source', dest=3D'header', action=3D'store_false= ') + parser.add_argument('--linter', dest=3D'linter', action=3D'store_true') parser.add_argument('--user-header', nargs=3D'+', default=3D[]) parser.add_argument('--cmp-out', action=3D'store_true', default=3DNone, help=3D'Do not overwrite the output file if the ne= w output is identical to the old') @@ -3470,8 +3497,10 @@ def main(): parser.add_argument('--function-prefix', dest=3D'fn_prefix', type=3Dst= r) args =3D parser.parse_args() =20 + if args.linter: + args.header =3D False if args.header is None: - parser.error("--header or --source is required") + parser.error("--header, --source or --linter is required") =20 exclude_ops =3D [re.compile(expr) for expr in args.exclude_op] =20 @@ -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 =3D '' - if args.user_header: - line +=3D ' --user-header '.join([''] + args.user_header) - if args.exclude_op: - line +=3D ' --exclude-op '.join([''] + args.exclude_op) - if args.fn_prefix: - line +=3D 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 =3D '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 =3D '' + if args.user_header: + line +=3D ' --user-header '.join([''] + args.user_header) + if args.exclude_op: + line +=3D ' --exclude-op '.join([''] + args.exclude_op) + if args.fn_prefix: + line +=3D 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() =20 if args.mode =3D=3D 'uapi': @@ -3539,6 +3570,8 @@ def main(): cw.p('#include ') if family_contains_bitfield32(parsed): cw.p('#include ') + 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 =3D [] + 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=3D"static const struct enum_set enums[] = =3D") + for enum_set in enum_sets: + cw.p(enum_set) + cw.p('{},') + cw.block_end(line=3D';') + cw.nl() + cw.write_func('int', 'main', + args=3D['const int argc', 'const char **argv'], + body=3D['return linter_run(argc, argv, &enums[0]= );']) else: cw.p('/* Enums */') put_op_name(parsed, cw) --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9333537FF54; Thu, 10 Sep 2026 22:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; cv=none; b=VsLkpOKx6D5sS+E9F8sYrzGhYe1XPSQC95MAt/yCwQw1LHDbMDKeplBbHNyJ4QrKVaOU8+mZmqTTGbu/VvQ4iKAJjJk08/pk84cFOo3/R0e/J+x51xsfkEF+zQRQ+JRSySgbwoj69r55WLyDHaqvdY2qrL6N72rtB8xhx0krpGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; c=relaxed/simple; bh=8jQRgMB/Vi8pb/uLewwm6d/XaELBNMozr2BCT2sv1Mk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N/KfQxVMC3lvFyozsW+0Wa+OyzZisAU4AmX7kljC95op2ol5wYg7ypP/fA+qIPiZhkFEEPRVoGVvHPIW0StgpFB9hcnYba3EpXI/4jBSnD6tzhbKZjythSgEGSF6iHPFhKTESAmrf1nKEL0qTcI4LB/OaJIOsIhl4xttCELfW1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=bioGOhLc; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="bioGOhLc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=8jQRgMB/Vi8pb/uLewwm6d/XaELBNMozr2BCT2sv1Mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bioGOhLc7DU4o1BjUvXH1vLmDmJ0657m2kDr7tXv74XY5d8ImFyG3mOOZPznk+IQU 28ffXMheWIkneozGACqXlC03lH+jq78U4OB49P8IjjugAAPugTJVxLmva6vMWtWUa7 0ffX+wHU0E9mzCA02crTG3ExxGco63WQVBghpisboY1sJRvEAZExic8gjnjte4+h1y xWWTV6klTomx0BIECDjHTbYEXBZvusxI09+sV6eibOMpzMNINdacIWJ95jyLha9SuM P0onbC9zpA+1PRj5DG3BjdC4LXx6FBciUneOKD8JilIaoYH0LBgUTzT3UDsT1Vritk J4qrHxFfZ4vUg== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 037B46010D; Thu, 10 Sep 2026 22:19:38 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id CF6F4202113; Thu, 10 Sep 2026 22:17:36 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 4/8] netlink: specs: rt-link: add C naming info Date: Thu, 10 Sep 2026 22:17:24 +0000 Message-ID: <20260910221733.1021864-5-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=B8rn Sloth T=C3=B8nnesen --- 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/netli= nk/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 */ =20 -#ifndef _LINUX_SNMP_H -#define _LINUX_SNMP_H +#ifndef _UAPI_LINUX_SNMP_H +#define _UAPI_LINUX_SNMP_H =20 /* ipstats mib definitions */ /* @@ -372,4 +372,4 @@ enum __LINUX_MIB_TLSMAX }; =20 -#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:=3D$(call get_hdr_inc,__LINUX_OPENVSWIT= CH_H,openvswitch.h) CFLAGS_psp:=3D$(call get_hdr_inc,_LINUX_PSP_H,psp.h) CFLAGS_rt-addr:=3D$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ $(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h) -CFLAGS_rt-link:=3D$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ - $(call get_hdr_inc,_LINUX_IF_LINK_H,if_link.h) +CFLAGS_rt-link:=3D$(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:=3D$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ $(call get_hdr_inc,__LINUX_NEIGHBOUR_H,neighbour.h) CFLAGS_rt-route:=3D$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BEAD4718CE; Thu, 10 Sep 2026 22:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078794; cv=none; b=tYxDHSSOY4/53PdlzCvjfbI65g+/nk8QxyCMRgc1fjoOkzICUem0heSFQvsu3m/koznQmFSu5lO2XPl9HL+GkUUtjYm30eajkyCb72sQo8RO0zKkIOY47lJwNxU5z0ote6/ncnmE4t4AxYAJ4uYxVtKYgypDFu5C00mx8/oEEx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078794; c=relaxed/simple; bh=4e+druWLoSy2UHuYMyQg4tDAmJG8hx9w/GmFCwb15S4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=keF78wjHbpKknwKL1WSG6M1GNz27lgPUUFwz5L566mVENgl0RnZ0K1biGAiOAripqxUcV02RE7pCRfERv30f5KEz5Js15wrVGIjvAKa5TtvrisHLYuDUEzGnfrqJGqDwXoFsrb5xk5roA3fb8vwRf9vQOjyF7qB4Szs+PBCvcZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=ge+Ffk52; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="ge+Ffk52" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=4e+druWLoSy2UHuYMyQg4tDAmJG8hx9w/GmFCwb15S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ge+Ffk525r2KWvpiyogarLwOvHbijIMNyCeQZRs8XgmFcblL08/Q5yl5t2FLSMLWb 9XfakllRdOtzMUKLc8O89EN1mOUjM2LZvDaBBmsvTEUPJqniKLU3mxetfkwCGxFgRG ldpjrJmtx3v7fP/becGBxtAAIFeDUYGBf/nglyy6FdnHUq6VCWrlbWpOvrPDOY9L1l RgLKMsoNPLQYir0OOb/kzbnxQfeDa5kdCqcSu0mwUlQTEi5lJzOccqQ73sUO9XTSWz WS3zplUxRe8OfsCz6nQJw2/1kJUn8oGopFVXwCTUoh7T660xJMx6xYWDC46Xye7/VJ X2qhBgCoU2MHw== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 30859600FF; Thu, 10 Sep 2026 22:19:19 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 429742022C6; Thu, 10 Sep 2026 22:17:37 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 5/8] netlink: specs: rt-link: re-align IPv4 devconf Date: Thu, 10 Sep 2026 22:17:25 +0000 Message-ID: <20260910221733.1021864-6-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=3D1, 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=C3=B8rn Sloth T=C3=B8nnesen --- Documentation/netlink/specs/rt-link.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/netlink/specs/rt-link.yaml b/Documentation/netli= nk/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 - --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9350F39524D; Thu, 10 Sep 2026 22:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; cv=none; b=XrNX78Icx56531G6ouBAV8zuLEzzCNAb7dP3HpIMUqc5wRZ2Xn9Mnl+WI3DPTsJpRtYqInwnufPVK+aLrkJccs5oAuB/MIAXifKwiL7QxLRNxIAr/eOMgy42ydLaCFUruwJSGFgWf6HRgEx79inO3csZTaevBjkvEBsEJXlx4zQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; c=relaxed/simple; bh=Dozir/3IJu939c5SnxFwdH9rgQY6CoLTFGtt7NTbXkg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GmztnMayCHCwzAzj56/m3vah9wcRAyXfjkY1P62vRvc/LnQY0elkVYPfXALDW6CeBfVNrauskwHOeNCVcjm5hPsE2S9+MWrQ5uju8ZqqjUY7YH8/KLtD3XSjKEDGAgzXLBP7Pr8fusBfdx+djCm7udFJaJI5IFRKoSoujO9e+k0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=v6E2o2FD; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="v6E2o2FD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078777; bh=Dozir/3IJu939c5SnxFwdH9rgQY6CoLTFGtt7NTbXkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v6E2o2FDGphZDQuycyiDhKYZ3u2j9teQLWeRgm7LE6YyVPL3xwD4wSIkejNWxC6WZ AZCLXL385YZHSSMhyfC69zQ7DphO8Nmmxn4Q8ZsgyKNFmLk9aLN4RiDUOSLdmVseZk P66MrVsoB9FEO8DGHBIyvjG4J/++YjlQpM8awoMNkapvy/IoONkO4ok5H9BeotsBqv JCfic86K0sFUw3s+J5bT+qgzPoNtdkTVSCvcgNK4FcO3v+aQd5Gw51YG5zHNQZKvu+ 3Xn97SKHCsPZbP+UCzTdMn9pTWHRnshn74R9eABovcSp3poAas8KSUYsg7rOb54Ysk dgh9KjTY3/K+A== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 3CEB260104; Thu, 10 Sep 2026 22:19:19 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id BBC632023F3; Thu, 10 Sep 2026 22:17:37 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org, Sashiko Subject: [RFC PATCH net-next 6/8] netlink: specs: rt-link: re-align ifla-inet6-stats Date: Thu, 10 Sep 2026 22:17:26 +0000 Message-ID: <20260910221733.1021864-7-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 Closes: https://sashiko.dev/#/patchset/20260831093458.472180-1-ast%40fiberb= y.net Signed-off-by: Asbj=C3=B8rn Sloth T=C3=B8nnesen --- 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/netli= nk/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 --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BDFC4718C8; Thu, 10 Sep 2026 22:19:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078793; cv=none; b=gjnIZec57jIhy0VdBzKD07KWv2CBZYmPt5uC/sDRSUpdnAyV4cfQOYvZWpCD2YlLcHrlFj7vevveOnBQObZsVAot14WncIpkEKg7y7/zoRQgA6cLoWPw9MA2m4Hopur/NNQKp/O8EVLcDybl7N/cjP5Cypjw0IM6oW605dFVzVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078793; c=relaxed/simple; bh=cVC8QHVdM1iUh3+MJEq40ZJsau0S+T8W1sAuPs+QtB4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a4WzY77DExvkALkyFZcrbgs0SLhNUnfsCXNJa2P5NaWg2TQyE8qGYlbxd8iIwuk9VSieyLf333noc/94EjBFetDM2LWNhCUbcrqlOvI3BTWZmdDxF5JF+ILkfHpUd0hQfI2nzlbeyCCOdmX3wQy8D1rFcenO4wPZMBCPQPIGEeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=VJUDXVHg; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="VJUDXVHg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=cVC8QHVdM1iUh3+MJEq40ZJsau0S+T8W1sAuPs+QtB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJUDXVHgflw2mdqLemKD4fLBcaLmlGQvqpNmizyaBwFYYhswJrTZ3BCLcvoKOlaKn bC+MwDrj/LOG8O9TJsOdtIJVX37RBOibphrYi4V46f5t7pEoCVA7ppXB6pLAVsb6zQ /F0QCVAa3yEOyVQqEQUIj5lEjloMOe3paIZZFKGQJydkX+pRLwpCjnriaMCKFaEUy2 bARYEEIb6OnUmakqk4jE5u6Dh1/DLTIIKgY2MEj5+DuSLrh6AOuNSZQleUHCE9EmzT 8/QkeqEwp2UQ+N6ShbGhSAvb23Z+DNhdMUmjNFaNF1QEgMOx0UbDJCX1OvTOrZFZ4k jWmacSilrh4lQ== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id EF7BD6010A; Thu, 10 Sep 2026 22:19:37 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 19516202556; Thu, 10 Sep 2026 22:17:39 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 7/8] netlink: specs: rt-link: fix ifinfo-flags names Date: Thu, 10 Sep 2026 22:17:27 +0000 Message-ID: <20260910221733.1021864-8-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=B8rn Sloth T=C3=B8nnesen --- 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/netli= nk/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 - --=20 2.55.0 From nobody Fri Sep 25 15:13:59 2026 Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 935C13AB496; Thu, 10 Sep 2026 22:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; cv=none; b=cydGsiMfm9aRxpDQoz+M53CoqKpFWcDoIVdeoEvF95tTr6qIas9qvnSiDhne2bB3o31cgA7lT7sjxnME/dwtrwJpw4wDywunGqLbBPkAW9Z3rvTO48NRiSfSc8zSyhrX/YFiJRM2Md7Nuzpda73ii7NiMMS5mTKeUwLM9h9yL2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789078790; c=relaxed/simple; bh=wfwCmT8DoKSSUntYp3RrEFWgEP9KlheUfTkbMuIxZTo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kdUXxI2tQMZZJ9bAoeHcPge3m+JFpme5NSLa8eajYRrY5yoo322dvGuhhFgXVNMP0FQ6eL0LrIUpqsWT3iF2eDVQ9DcE3WKVwrRe5sGDXYmggpxesN7AcznEIz+DGNChESqHIb+P7YHa7T06mYh1ovlP643NeAnaisvitUHUNCI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=tJDpaA3F; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="tJDpaA3F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1789078778; bh=wfwCmT8DoKSSUntYp3RrEFWgEP9KlheUfTkbMuIxZTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJDpaA3FkllyflGf/hu3IkoNB/2VeUyZAhg0cua1z3wUA6a6ZXU1ddTZO7jfN4VID GWlueKfdUTwTXt4I8CWYF6XXhLhRl1k/Az8PAJrctPCSrvIa8WOaUE4XWuSe3UXIH+ ElgW5Oflk7qBqmYF8zQtPtjfDnrLc/33cvLrxDNN23JDBXmpg+irMprSxlK6cRQIdu oVkYrU+fi6QAcAo/92MsGV19t3SE7ueE2SOuNCYCL07c48JL1S3cysLIytSZscdEf/ lqZoAqcUTMJBSYA9QJ7ONckPhhvDSL/VIGcH6cPzikbf5kSDXJBUmWPi0vjcrvJ9K/ u4F0hZs9h9Q2Q== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 3F2B260107; Thu, 10 Sep 2026 22:19:19 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id DCAEE2025B6; Thu, 10 Sep 2026 22:17:39 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , 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@vger.kernel.org Subject: [RFC PATCH net-next 8/8] netlink: specs: rt-link: fix netkit-policy names Date: Thu, 10 Sep 2026 22:17:28 +0000 Message-ID: <20260910221733.1021864-9-ast@fiberby.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260910221733.1021864-1-ast@fiberby.net> References: <20260910221733.1021864-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=B8rn Sloth T=C3=B8nnesen --- 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/netli= nk/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 --=20 2.55.0