From nobody Thu Sep 24 20:38:30 2026 Received: from mta0.migadu.com (out-156.mta0.migadu.com [91.218.175.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EBC73E5EEB for ; Sun, 20 Sep 2026 10:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898813; cv=none; b=iyZWbbJQuaCrCZ8PHNhKFMC0XUeZ2guzeJm5Z4QEDB8XcbotcJvgI662J/mAAiBKyiLdrA/FA/XcQ9BAq1wiklKqx6bcW8DhOtpt5A/ExuFIt+JTKquqyPuIhe4YLN4bLdgZ1rdTRtZrnzvmks6dSv4Q53BnNfJH6eU3dkB+ZWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898813; c=relaxed/simple; bh=m13fKBwXp2ZBVg4n/AP/jBHBQzFloS0fFjdHVVMILEY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uNz42mQiw07srYXW0OSHKRvpAd7E6HNGD6vRqN8Obq8eVTgCxbnlVXoQ0686i80pm9OZ/YPagEmBqf7Xr7DIxXIU9lt1TkW4rieRN2iM/SPcCR7K7YNbxVf/jOFMgBw2MzOoSI+DkcOi61hYIGcX9KdMOOu+UXMjHk2wjGFFs+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xaoB+JLb; arc=none smtp.client-ip=91.218.175.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xaoB+JLb" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=m13fKBwXp2ZBVg4n/AP/jBHBQzFloS0fFjdHVVMILEY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898809; v=1; x=1790503609; b=xaoB+JLbs+0lkcTe344psiarBTr35gEWti5qpejMTlgegtlCo3xkN71Rq2QLUbMGbLJJY2jz b14otQJbK0wtkuKLGB3hvToALvONot0XFoOPyKDxD7z2HowFYJAmqlahJXLEtvbBropgH3ADfui /tsFnZ2ZufIdZs1zfeEUWRg8= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 38af924592db46e3; Sun, 20 Sep 2026 10:06:49 +0000 X-Mizu-Trace-ID: 38af924592db46e3 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:36 +0800 Subject: [PATCH net-next v2 1/6] net: lwtunnel: change encap fill order 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 Message-Id: <20260920-ynl_rt_encap-v2-1-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu When decoding sub=E2=80=91messages, YNL tries to fetch the "selector" (enca= p=E2=80=91type) first. However, lwtunnel fills encap=E2=80=91payload data first, which caus= es YNL to fail decoding the lwtunnel encap message. Fixing this inside YNL would be complex, so change the order in the kernel and emit encap_type first. Signed-off-by: Hangbin Liu --- net/core/lwtunnel.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c index b01a395d9a96..8223c44f10c8 100644 --- a/net/core/lwtunnel.c +++ b/net/core/lwtunnel.c @@ -231,7 +231,7 @@ int lwtunnel_fill_encap(struct sk_buff *skb, struct lwt= unnel_state *lwtstate, { const struct lwtunnel_encap_ops *ops; struct nlattr *nest; - int ret; + int ret =3D 0; =20 if (!lwtstate) return 0; @@ -240,30 +240,31 @@ int lwtunnel_fill_encap(struct sk_buff *skb, struct l= wtunnel_state *lwtstate, lwtstate->type > LWTUNNEL_ENCAP_MAX) return 0; =20 - nest =3D nla_nest_start_noflag(skb, encap_attr); - if (!nest) - return -EMSGSIZE; - - ret =3D -EOPNOTSUPP; rcu_read_lock(); + ops =3D rcu_dereference(lwtun_encaps[lwtstate->type]); - if (likely(ops && ops->fill_encap)) - ret =3D ops->fill_encap(skb, lwtstate); - rcu_read_unlock(); + if (unlikely(!ops || !ops->fill_encap)) + goto unlock_out; =20 - if (ret) - goto nla_put_failure; - nla_nest_end(skb, nest); ret =3D nla_put_u16(skb, encap_type_attr, lwtstate->type); if (ret) - goto nla_put_failure; + goto unlock_out; =20 - return 0; + nest =3D nla_nest_start_noflag(skb, encap_attr); + if (!nest) { + ret =3D -EMSGSIZE; + goto unlock_out; + } =20 -nla_put_failure: - nla_nest_cancel(skb, nest); + ret =3D ops->fill_encap(skb, lwtstate); + if (ret) + nla_nest_cancel(skb, nest); + else + nla_nest_end(skb, nest); =20 - return (ret =3D=3D -EOPNOTSUPP ? 0 : ret); +unlock_out: + rcu_read_unlock(); + return ret; } EXPORT_SYMBOL_GPL(lwtunnel_fill_encap); =20 --=20 2.55.0 From nobody Thu Sep 24 20:38:30 2026 Received: from mta1.migadu.com (out-121.mta1.migadu.com [95.215.58.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C1023E5EEB for ; Sun, 20 Sep 2026 10:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.121 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898822; cv=none; b=PnFwZW+3B6m3Y3EBNl/aOQIhWu5q1VX047p0HQY4N90Tj98CxHfAew0vb7HXI67J2CK06d2ThjCnuFfFfFAI3q7W7/ldqEzgs1ho5RjzMTrQARzVFslrHgDt2WikCY8o1zO1zZVhBJiVhMw9jdNAiaqfvfs7TDkrWH67CBHkNts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898822; c=relaxed/simple; bh=lkTu2I078JvJUNkX2Uv9XPGxBD6YKQ6TgYU1kWq2k7Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EjDbY+62vgxwhZ7norHU+Q2ejXieqOuAwkP4mXoavindy9aUU2QdFBETWvOI/TxE9/ZkTO2ipX3MtQrCHOqgp/hRl58GDS3VeLjp8NY9noYm3lpSuzBbvmvh9rbfw+qEllbLJ5Ealv9C8rCoKb9iAC7ZtXAPtdlmtKv+BYvJ9EY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=IB1KdGD2; arc=none smtp.client-ip=95.215.58.121 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="IB1KdGD2" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=lkTu2I078JvJUNkX2Uv9XPGxBD6YKQ6TgYU1kWq2k7Q=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898818; v=1; x=1790503618; b=IB1KdGD24a0gFa757xcK49/fzdjd139vQG95N1AeFrSp+ChQb34gH0kfjyQna9F1iHfp7fcV SWs4o8Weagf/bbS4pRMuwfd0oVmlditnlFG/mS0JB3ztoIw5zwFgR+HpE/zgOfBLUMy9n8TyA9p AOa0WxvXY1megbdeHCdQtmqs= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 70a898477898b523; Sun, 20 Sep 2026 10:06:58 +0000 X-Mizu-Trace-ID: 70a898477898b523 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:37 +0800 Subject: [PATCH net-next v2 2/6] tools: ynl: convert enum selector to string for sub-message parsing 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 Message-Id: <20260920-ynl_rt_encap-v2-2-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu YNL sub-message parsing expects a string selector for strcmp(). So for non-external enum selectors, convert the integer value to its string form via the family's {enum}_str() helper. This enables correct decoding of sub-messages keyed by enum values. After change, the new generated code looks like const char *encap_type_str; encap_type_str =3D rt_route_encap_type_str(dst->encap_type); if (!encap_type_str) return ynl_submsg_failed(yarg, "encap", "encap-type"); if (rt_route_encap_data_parse(&parg, encap_type_str, attr)) return YNL_PARSE_CB_ERROR; Signed-off-by: Hangbin Liu --- tools/net/ynl/pyynl/ynl_gen_c.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 2b3483db1b60..785e747e5865 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -951,10 +951,22 @@ class TypeSubMessage(TypeNest): sel_var =3D f"_sel_{sel}" else: sel_var =3D f"{var}->{sel}" - get_lines =3D [f'if (!{sel_var})', - f'return ynl_submsg_failed(yarg, "{self.name}", "{sel= ector}");', - f"if ({self.nested_render_name}_parse(&parg, {sel_var= }, attr))", - "return YNL_PARSE_CB_ERROR;"] + + parse_sel =3D sel_var + get_lines =3D [] + if not self.selector.is_external() and self.selector.attr and \ + "enum" in self.selector.attr.attr: + enum_name =3D self.selector.attr.attr["enum"] + str_fn =3D c_lower(self.family.ident_name + "-" + enum_name) += "_str" + sel_str_var =3D f"{sel}_str" + get_lines +=3D [f'const char *{sel_str_var};', + f'{sel_str_var} =3D {str_fn}({sel_var});'] + parse_sel =3D sel_str_var + + get_lines +=3D [f'if (!{parse_sel})', + f'return ynl_submsg_failed(yarg, "{self.name}", "{se= lector}");', + f"if ({self.nested_render_name}_parse(&parg, {parse_= sel}, attr))", + "return YNL_PARSE_CB_ERROR;"] init_lines =3D [f"parg.rsp_policy =3D &{self.nested_render_name}_n= est;", f"parg.data =3D &{var}->{self.c_name};"] return get_lines, init_lines, None --=20 2.55.0 From nobody Thu Sep 24 20:38:30 2026 Received: from mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE72C3F1070 for ; Sun, 20 Sep 2026 10:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898832; cv=none; b=Lq15XgL+H5J4kSpiojSvVoYp+UvJfxAtKwoZaejRBEFRItdN6Xdi8DoJQBai6MwS+2z/RlpyrdQK7PtTwsbweLpERcSGOZ70j3RikhjpBQ+LgKvuNJJsYP5WYftXreSSJXfGCq6btKusz1mU/+sDHmmNvSZGRjh3bKvQuWAKJXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898832; c=relaxed/simple; bh=lxjI5WL2VI/8GYLjbWn0aZcboNcse9NooNv4rNW8iUk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XpAhm+r6nQBeQ2UH+cDHdHhxuaWcbKiHzTVex4HhDxAFzxhYdpzLAJ4+x1+0U37GGghhLO2Y3XsANvgj9ne3v/ngMM6JGeXc7tW71VBTkdsLlxu+AoHByUbX/e7QoWa092QeFkSp8ZcvBYG2y7Nux+OP35WXlCtyEfW6gTnSV+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=nZyC1wpO; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="nZyC1wpO" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=lxjI5WL2VI/8GYLjbWn0aZcboNcse9NooNv4rNW8iUk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898828; v=1; x=1790503628; b=nZyC1wpOCsz8k1mUn3zFBnOZYS9mXWQAx9o2ZYa+w7arc2uCpTa1/ZmbrgpXxGtphFFQMZ9n RU6t8yw2s+J1tRQ6IIekaXn6MMJ7nCCMCx4nu1pB+7acQCYsU+kCNKaelN1P0mBsZlnjUV7wGFn eHJZhFh9+GLzVmgT3cKSZeLU= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 2e5532b02837b9d6; Sun, 20 Sep 2026 10:07:07 +0000 X-Mizu-Trace-ID: 2e5532b02837b9d6 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:38 +0800 Subject: [PATCH net-next v2 3/6] netlink: specs: rt-route: add lwtunnel encap sub-message support 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 Message-Id: <20260920-ynl_rt_encap-v2-3-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Define encap-type enum (LWTUNNEL_ENCAP_*) and add encap-data sub-message keyed by encap-type. Add tunnel attribute sets (mpls, ila, seg6, rpl, ioam6, xfrm) and IP/IP6 tunnel sets. Keep some nested option attributes as binary in this patch to simplify review; they will be converted in follow-up patches. Also add the Makefile to include uapi headers. Note the lwtunnel.h is guarded by _UAPI_LWTUNNEL_H_. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/rt-route.yaml | 285 ++++++++++++++++++++++++++= +++- tools/net/ynl/Makefile.deps | 9 +- 2 files changed, 292 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/rt-route.yaml b/Documentation/netl= ink/specs/rt-route.yaml index 253037ea5176..86fc52f856bf 100644 --- a/Documentation/netlink/specs/rt-route.yaml +++ b/Documentation/netlink/specs/rt-route.yaml @@ -99,6 +99,58 @@ definitions: name: ra-withdrawn doc: A Router Advertisement withdrew the route with a zero lifetime. + - + name: encap-type + type: enum + name-prefix: lwtunnel-encap- + enum-name: + entries: + - none + - mpls + - ip + - ila + - ip6 + - seg6 + - bpf + - seg6-local + - rpl + - ioam6 + - xfrm + +sub-messages: + - + name: encap-data + formats: + - + value: mpls + attribute-set: mpls-iptunnel + - + value: ip + attribute-set: lwtunnel-ip + - + value: ila + attribute-set: ila-attrs + - + value: ip6 + attribute-set: lwtunnel-ip6 + - + value: seg6 + attribute-set: seg6-iptunnel + - + value: bpf + attribute-set: lwt-bpf + - + value: seg6-local + attribute-set: seg6-local + - + value: rpl + attribute-set: rpl-iptunnel + - + value: ioam6 + attribute-set: ioam6-iptunnel + - + value: xfrm + attribute-set: lwt-xfrm =20 attribute-sets: - @@ -174,9 +226,12 @@ attribute-sets: - name: encap-type type: u16 + enum: encap-type - name: encap - type: binary # tunnel specific nest + type: sub-message + sub-message: encap-data + selector: encap-type - name: expires type: u32 @@ -277,6 +332,234 @@ attribute-sets: - name: fastopen-no-cookie type: u32 + - + name: mpls-iptunnel + name-prefix: mpls-iptunnel- + header: linux/mpls_iptunnel.h + attributes: + - + name: dst + type: binary + - + name: ttl + type: u8 + - + name: lwtunnel-ip + name-prefix: lwtunnel-ip- + header: linux/lwtunnel.h + attributes: + - + name: id + type: u64 + byte-order: big-endian + - + name: dst + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: src + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: ttl + type: u8 + - + name: tos + type: u8 + - + name: flags + type: u16 + byte-order: big-endian + - + name: pad + type: pad + - + name: opts + type: binary # lwtunnel ip nest options + - + name: ila-attrs + name-prefix: ila-attr- + header: linux/ila.h + attributes: + - + name: locator + type: u64 + - + name: identifier + type: u64 + - + name: locator-match + type: u64 + - + name: ifindex + type: s32 + - + name: dir + type: u32 + - + name: pad + type: pad + - + name: csum-mode + type: u8 + - + name: ident-type + type: u8 + - + name: hook-type + type: u8 + - + name: lwtunnel-ip6 + name-prefix: lwtunnel-ip6- + header: linux/lwtunnel.h + attributes: + - + name: id + type: u64 + byte-order: big-endian + - + name: dst + type: binary + display-hint: ipv6 + - + name: src + type: binary + display-hint: ipv6 + - + name: hoplimit + type: u8 + - + name: tc + type: u8 + - + name: flags + type: u16 + byte-order: big-endian + - + name: pad + type: pad + - + name: opts + type: binary # lwtunnel ip nest options + - + name: seg6-iptunnel + name-prefix: seg6-iptunnel- + header: linux/seg6_iptunnel.h + attributes: + - + name: srh + type: binary + - + name: src + type: binary + display-hint: ipv6 + - + name: table + type: u32 + - + name: lwt-bpf + name-prefix: lwt-bpf- + header: linux/lwtunnel.h + attributes: + - + name: in + type: binary # bpf prog + - + name: out + type: binary + - + name: xmit + type: binary + - + name: xmit-headroom + type: u32 + - + name: seg6-local + name-prefix: seg6-local- + header: linux/seg6_local.h + attributes: + - + name: action + type: u32 + - + name: srh + type: binary + - + name: table + type: u32 + - + name: nh4 + type: u32 + byte-order: big-endian + display-hint: ipv4 + - + name: nh6 + type: binary + display-hint: ipv6 + - + name: iif + type: u32 + - + name: oif + type: u32 + - + name: bpf + type: binary + - + name: vrftable + type: u32 + - + name: counters + type: binary + - + name: flavors + type: binary + - + name: rpl-iptunnel + name-prefix: rpl-iptunnel- + header: linux/rpl_iptunnel.h + attributes: + - + name: srh + type: binary + - + name: ioam6-iptunnel + name-prefix: ioam6-iptunnel- + header: linux/ioam6_iptunnel.h + attributes: + - + name: mode + type: u8 + - + name: dst + type: binary + display-hint: ipv6 + - + name: trace + type: binary + - + name: freq-k + type: u32 + - + name: freq-n + type: u32 + - + name: src + type: binary + display-hint: ipv6 + - + name: lwt-xfrm + name-prefix: lwt-xfrm- + header: linux/lwtunnel.h + attributes: + - + name: if-id + type: u32 + - + name: link + type: u32 =20 operations: enum-model: directional diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps index 1e746e25e2bc..904433761524 100644 --- a/tools/net/ynl/Makefile.deps +++ b/tools/net/ynl/Makefile.deps @@ -45,7 +45,14 @@ 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-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) +CFLAGS_rt-route:=3D$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ + $(call get_hdr_inc,_LINUX_IOAM6_IPTUNNEL_H,ioam6_iptunnel.h) \ + $(call get_hdr_inc,_LINUX_MPLS_IPTUNNEL_H,mpls_iptunnel.h) \ + $(call get_hdr_inc,_LINUX_SEG6_IPTUNNEL_H,seg6_iptunnel.h) \ + $(call get_hdr_inc,_LINUX_RPL_IPTUNNEL_H,rpl_iptunnel.h) \ + $(call get_hdr_inc,_LINUX_SEG6_LOCAL_H,seg6_local.h) \ + $(call get_hdr_inc,_LWTUNNEL_H_,lwtunnel.h) \ + $(call get_hdr_inc,_LINUX_ILA_H,ila.h) CFLAGS_rt-rule:=3D$(call get_hdr_inc,__LINUX_FIB_RULES_H,fib_rules.h) CFLAGS_tc:=3D $(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ $(call get_hdr_inc,__LINUX_PKT_SCHED_H,pkt_sched.h) \ --=20 2.55.0 From nobody Thu Sep 24 20:38:30 2026 Received: from mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E28B03F1640 for ; Sun, 20 Sep 2026 10:07:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898840; cv=none; b=lFmVqA1uriUIHWzigvcY5VTAAbOw8CE5eJkbCTsVJVmG/WgC7B7c3eUwrfeIlK1v+3pNw1INkGA3BybD0dYHDdlkcrEMPmYkZtsaHtWB5lN/AEKoykwj360TGcAmeAZghykORQjKnvdTX6VtaFNQXRY03FZzfmvp1CaUP5HzYD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898840; c=relaxed/simple; bh=SkOhf961FvRa1o4KrMZv9A+hJDOSCRZN5mUh5n/AvQ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b3NXDxq5NJbD351zU5LPVB6QVyajWh8fxv1uGpDZWplZLeQK/xHkzDP3Ms0vqRHxHZ2TY1QeaYDAfGV/1pBWiLkw3rFfdNoLvpxfX2ZjrtpLWbu5kZQ54k9P24NNAH9b7a2Tv6JDJ3keCtNmnMCrnzSLaTjmPCxmvvj+kFc+gNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=gDdiXhnB; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="gDdiXhnB" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=SkOhf961FvRa1o4KrMZv9A+hJDOSCRZN5mUh5n/AvQ4=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898836; v=1; x=1790503636; b=gDdiXhnBsCOTjIDY1YaIzfTA9IfkJAYlxG6P59nCmDklVYGgYTAO7BiciM/2JqCOF2edGvo2 GbK+//Nfofa859STofpkFyhCr46d83FS4HHRrzBySlEeVwcfRvge48tifmtr1EnsxwEMKvS4fpa qxb8nfxoZ8z2t9Ro6AmUj6PY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 34cfc2c7803b15d4; Sun, 20 Sep 2026 10:07:16 +0000 X-Mizu-Trace-ID: 34cfc2c7803b15d4 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:39 +0800 Subject: [PATCH net-next v2 4/6] netlink: specs: rt-route: describe lwtunnel IP options 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 Message-Id: <20260920-ynl_rt_encap-v2-4-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Replace binary opts in lwtunnel-ip and lwtunnel-ip6 with a nested lwtunnel-ip-opts set. Add attribute sets for geneve, vxlan, and erspan IP options to match linux/lwtunnel.h. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/rt-route.yaml | 62 +++++++++++++++++++++++++++= +++- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/rt-route.yaml b/Documentation/netl= ink/specs/rt-route.yaml index 86fc52f856bf..4b12a8a58652 100644 --- a/Documentation/netlink/specs/rt-route.yaml +++ b/Documentation/netlink/specs/rt-route.yaml @@ -377,7 +377,8 @@ attribute-sets: type: pad - name: opts - type: binary # lwtunnel ip nest options + type: nest + nested-attributes: lwtunnel-ip-opts - name: ila-attrs name-prefix: ila-attr- @@ -442,7 +443,8 @@ attribute-sets: type: pad - name: opts - type: binary # lwtunnel ip nest options + type: nest + nested-attributes: lwtunnel-ip-opts - name: seg6-iptunnel name-prefix: seg6-iptunnel- @@ -560,6 +562,62 @@ attribute-sets: - name: link type: u32 + - + name: lwtunnel-ip-opts + name-prefix: lwtunnel-ip-opts- + attributes: + - + name: geneve + type: nest + nested-attributes: lwtunnel-ip-opt-geneve + - + name: vxlan + type: nest + nested-attributes: lwtunnel-ip-opt-vxlan + - + name: erspan + type: nest + nested-attributes: lwtunnel-ip-opt-erspan + - + name: lwtunnel-ip-opt-geneve + name-prefix: lwtunnel-ip-opt-geneve- + attributes: + - + name: class + type: u16 + byte-order: big-endian + - + name: type + type: u8 + - + name: data + type: binary + checks: + max-len: 127 + - + name: lwtunnel-ip-opt-vxlan + name-prefix: lwtunnel-ip-opt-vxlan- + attributes: + - + name: gbp + type: u32 + - + name: lwtunnel-ip-opt-erspan + name-prefix: lwtunnel-ip-opt-erspan- + attributes: + - + name: ver + type: u8 + - + name: index + type: u32 + byte-order: big-endian + - + name: dir + type: u8 + - + name: hwid + type: u8 =20 operations: enum-model: directional --=20 2.55.0 From nobody Thu Sep 24 20:38:30 2026 Received: from mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F2973F3262 for ; Sun, 20 Sep 2026 10:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898845; cv=none; b=mInpCKq99nY3MSaNdAcNOiDqRBqL26R04oGPnIbzR31WcthIoYWl+BaLdFkHb4yiBCceW4MybsEyWZZXgkx8XAY/M2TwlLIDN5kEmR8YxrFB4MqFs/JwpeP2R0IrHSQGgufv2u016k42vwf8fSNFKcTL0sFPF98Sz7NncUDelHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898845; c=relaxed/simple; bh=mgJPAC3v5oZHApxysDsjs7UoU7Ogd9FRsEA5kIrL1JU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HuXLTFBy7EoDurli4IsN0HVu8F+4Fv+h/3cn5+4EsEq9+tRCk/sqbDhnIxqnBmyEwfiBBs6KPhFiqMHCteELDK9ivSOYFROU7xQVumsMJHl13/WW0XLfG/8eQxn+JF/XsgbQvpvhGC7oq2gL30kiADch0mXVoRiVUYXMtfps6aY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cS/8/f+t; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cS/8/f+t" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=mgJPAC3v5oZHApxysDsjs7UoU7Ogd9FRsEA5kIrL1JU=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898842; v=1; x=1790503642; b=cS/8/f+tSYJAOUrTLdNKvAdSTBUxXpScuYrWW+EMk2r6SakDLRMptxAnPuoaHZwDSW1pvBwk 2PSw4dGcZctDe7UPZm35gDtr0FK1mWE4mj484+H2wi2MDlF5uQlXJ9kwRwOkro/Q1zU2x8O/YQY xGbUAADH67QRuu+92OqwWdKU= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 59605f08593950cb; Sun, 20 Sep 2026 10:07:22 +0000 X-Mizu-Trace-ID: 59605f08593950cb X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:40 +0800 Subject: [PATCH net-next v2 5/6] netlink: specs: rt-route: describe lwt BPF program options 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 Message-Id: <20260920-ynl_rt_encap-v2-5-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Replace binary BPF attributes with a nested lwt-bpf-prog to support lwt bpf prog options. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/rt-route.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Documentation/netlink/specs/rt-route.yaml b/Documentation/netl= ink/specs/rt-route.yaml index 4b12a8a58652..4a3953c9e978 100644 --- a/Documentation/netlink/specs/rt-route.yaml +++ b/Documentation/netlink/specs/rt-route.yaml @@ -467,13 +467,16 @@ attribute-sets: attributes: - name: in - type: binary # bpf prog + type: nest + nested-attributes: lwt-bpf-prog - name: out - type: binary + type: nest + nested-attributes: lwt-bpf-prog - name: xmit - type: binary + type: nest + nested-attributes: lwt-bpf-prog - name: xmit-headroom type: u32 @@ -508,7 +511,8 @@ attribute-sets: type: u32 - name: bpf - type: binary + type: nest + nested-attributes: lwt-bpf-prog - name: vrftable type: u32 @@ -618,6 +622,17 @@ attribute-sets: - name: hwid type: u8 + - + name: lwt-bpf-prog + name-prefix: lwt-bpf-prog- + header: linux/lwtunnel.h + attributes: + - + name: fd + type: u32 + - + name: name + type: string =20 operations: enum-model: directional --=20 2.55.0 From nobody Thu Sep 24 20:38:30 2026 Received: from mta1.migadu.com (out-159.mta1.migadu.com [95.215.58.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 414AB3F23CC for ; Sun, 20 Sep 2026 10:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898854; cv=none; b=qRt49c1XUa8BJO9TlY26Kr004Q/zych1DEdr65uOH64OPYxDWfoKFY0VYwBVsoo8yA8K+oqFHEZRb56CaKtPpSEgcpz7DMBadVCNIx6kZikcwlss89g5r7DeO0noxjoQHx3aKR33g8R8blN4+CdkEcoPMvtQ6l98CoX/m8970DI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789898854; c=relaxed/simple; bh=r74M24yyCfstLi5sdyYdfj7aY4inWJJgNMM8Vg/Ti20=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EhHvwELbvaQQPdIVqoSMkgXZTxW3yjmi0GHXosojM5aF6+SYWRmI6HwW2sGfrECfEUmuFsdLUPULK2OepAbCSM9hblMdDmhfxxW4Z1TfjFoWNPl9dpZwj7Hpwmoy2bFyha1oPzhrvObrzKZ7cEE2iTNSDToxtC5UDB2u+79I1gQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=XA3ckq4z; arc=none smtp.client-ip=95.215.58.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XA3ckq4z" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=r74M24yyCfstLi5sdyYdfj7aY4inWJJgNMM8Vg/Ti20=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789898850; v=1; x=1790503650; b=XA3ckq4za7PgX4Ve8VK70Bz9TSVkyKqkN1sgwWw0tlq/EAHm82T06gBCQegR8e5APPzXEqXR 51yQb13ljw7jixyd8u1FSDosXRIQc5Pat+yodb46RDWWMoyQVkWCH6kziJEGmcTrzEcMNE4BEtX lJzsiC52M6bIuzVuu+NB7j0c= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id b7e704c66a0f4609; Sun, 20 Sep 2026 10:07:30 +0000 X-Mizu-Trace-ID: b7e704c66a0f4609 X-Migadu-Flow: FLOW_OUT From: Hangbin Liu Date: Sun, 20 Sep 2026 18:06:41 +0800 Subject: [PATCH net-next v2 6/6] netlink: specs: rt-route: describe seg6-local actions, counters and flavors 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 Message-Id: <20260920-ynl_rt_encap-v2-6-c664a3e726f6@kylinos.cn> References: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> In-Reply-To: <20260920-ynl_rt_encap-v2-0-c664a3e726f6@kylinos.cn> To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter Cc: Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu X-Mailer: b4 0.14.3 From: Hangbin Liu Add SEG6 local actions enum. Replace binary counters/flavors in seg6-local with nested seg6-local-cnt and seg6-local-flv. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/rt-route.yaml | 59 +++++++++++++++++++++++++++= ++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/rt-route.yaml b/Documentation/netl= ink/specs/rt-route.yaml index 4a3953c9e978..711c667bbc43 100644 --- a/Documentation/netlink/specs/rt-route.yaml +++ b/Documentation/netlink/specs/rt-route.yaml @@ -116,6 +116,29 @@ definitions: - rpl - ioam6 - xfrm + - + name: seg6-local-actions + type: enum + name-prefix: seg6-local-action- + enum-name: + entries: + - unspec + - end + - end-x + - end-t + - end-dx2 + - end-dx6 + - end-dx4 + - end-dt6 + - end-dt4 + - end-b6 + - end-b6-encap + - end-bm + - end-s + - end-as + - end-am + - end-bpf + - end-dt46 =20 sub-messages: - @@ -488,6 +511,7 @@ attribute-sets: - name: action type: u32 + enum: seg6-local-actions - name: srh type: binary @@ -518,10 +542,12 @@ attribute-sets: type: u32 - name: counters - type: binary + type: nest + nested-attributes: seg6-local-cnt - name: flavors - type: binary + type: nest + nested-attributes: seg6-local-flv - name: rpl-iptunnel name-prefix: rpl-iptunnel- @@ -633,6 +659,35 @@ attribute-sets: - name: name type: string + - + name: seg6-local-cnt + name-prefix: seg6-local-cnt- + attributes: + - + name: pad + type: pad + - + name: packets + type: u64 + - + name: bytes + type: u64 + - + name: errors + type: u64 + - + name: seg6-local-flv + name-prefix: seg6-local-flv- + attributes: + - + name: operation + type: u32 + - + name: lcblock-bits + type: u8 + - + name: lcnode-fn-bits + type: u8 =20 operations: enum-model: directional --=20 2.55.0