mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: netdev-bot+sashiko@kernel.org
Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	donald.hunter@gmail.com, edumazet@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, liuhangbin@kylinos.cn
Subject: Re: [PATCH net-next v4 4/6] netlink: specs: rt-route: describe lwtunnel IP options
Date: Fri, 9 Oct 2026 17:44:56 +0800	[thread overview]
Message-ID: <asi3mNcz1H6wJPOB@fedora> (raw)
In-Reply-To: <179153682125.434549.6402494415316907824@kernel.org>

On Fri, Oct 09, 2026 at 09:07:01AM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 1 · Low: 2
> 
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
> 
> - [Medium] Under this spec, YNL cannot send a request that sets Geneve
>   tunnel options; the kernel rejects it.
> - [Low] The new `lwtunnel-ip-opts` set declares `geneve` as one `binary`
>   attribute without `multi-attr: true`.
> - [Low] The commit message contradicts itself.
> 
> --
> 
> netlink: specs: rt-route: describe lwtunnel IP options
> 
> This commit changes the binary opts attribute in lwtunnel-ip and
> lwtunnel-ip6 into a nest of a new lwtunnel-ip-opts set. It adds vxlan and
> erspan option sets. Geneve options stay binary because the kernel uses a
> different layout for requests and for dumps.
> 
> > 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.
> 
> [Severity: Low]
> The first paragraph says attribute sets are added for geneve, vxlan and
> erspan. The diff adds lwtunnel-ip-opts, lwtunnel-ip-opt-vxlan and
> lwtunnel-ip-opt-erspan, but no lwtunnel-ip-opt-geneve set, and the
> second paragraph says geneve is omitted.

I mean add geneve attr. I didn't add lwtunnel-ip-opt-geneve.

> 
> Could the first paragraph say something like "Add attribute sets for
> vxlan and erspan IP options; keep geneve as binary (see below)"?
> 
> > diff --git a/Documentation/netlink/specs/rt-route.yaml b/Documentation/netlink/specs/rt-route.yaml
> > index dc842a786794a..ea6711292c9b6 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-
> 
> [ ... ]
> 
> > @@ -562,6 +564,45 @@ attribute-sets:
> >        -
> >          name: link
> >          type: u32
> > +  -
> > +    name: lwtunnel-ip-opts
> > +    name-prefix: lwtunnel-ip-opts-
> > +    attributes:
> > +      -
> > +        name: geneve
> > +        type: binary
> 
> [Severity: Medium]
> With geneve declared as binary, can YNL still send a route request that
> carries Geneve options?

No, before this patch, the whole encap data is binary. We now support
all the encap types other than geneve, which encodes LWTUNNEL_IP_OPTS_GENEVE
differently for requests and dumps.

Thanks
Hangbin
> 
> In tools/net/ynl/pyynl/lib/ynl.py, YnlFamily._add_attr() sets
> NLA_F_NESTED only in the nest branch. The binary branch copies the payload
> and leaves the flag out of the header:
> 
>     if attr["type"] == 'nest':
>         nl_type |= Netlink.NLA_F_NESTED
>     ...
>     elif attr["type"] == 'binary':
>         ...
>             attr_payload = value
> 
> In the kernel, ip_opts_policy types GENEVE as nested:
> 
> net/ipv4/ip_tunnel_core.c:
>     [LWTUNNEL_IP_OPTS_GENEVE]	= { .type = NLA_NESTED },
> 
> ip_tun_parse_opts() validates the payload in strict mode:
> 
>     err = nla_validate(nla_data(attr), nla_len(attr), LWTUNNEL_IP_OPTS_MAX,
>                        ip_opts_policy, extack);
> 
> NL_VALIDATE_STRICT includes NL_VALIDATE_NESTED, so validate_nla() in
> lib/nlattr.c rejects the attribute:
> 
>     if (validate & NL_VALIDATE_NESTED) {
>         if ((pt->type == NLA_NESTED || pt->type == NLA_NESTED_ARRAY) &&
>             !(nla->nla_type & NLA_F_NESTED)) {
> 
> ip_tun_parse_opts_geneve() then calls nla_parse_nested(), which does the
> same check. So a newroute with encap type ip or ip6 and encap.opts.geneve
> set to bytes fails with -EINVAL, even if the bytes hold a well-formed
> CLASS/TYPE/DATA triplet.
> 
> Before this patch the whole opts attribute was binary. A caller could
> pass the raw LWTUNNEL_IP_OPTS payload with NLA_F_NESTED already set on the
> inner GENEVE header. The outer attribute is parsed with
> nla_parse_nested_deprecated(), so the missing flag there was not checked.
> 
> Is this a regression for YNL users who configure Geneve options? Dumps
> still decode, because ip_tun_fill_encap_opts_geneve() uses
> nla_nest_start_noflag(). Later patches in the series do not change this,
> and the final rt-route.yaml still has geneve as binary.
> 
> [Severity: Low]
> Can this spec describe a request with more than one Geneve option?
> 
> On the request path, ip_tun_parse_opts() walks every attribute in the
> opts nest. It passes each LWTUNNEL_IP_OPTS_GENEVE to
> ip_tun_parse_opts_geneve(), which reads exactly one CLASS/TYPE/DATA
> option:
> 
>     nla_for_each_attr(nla, nla_data(attr), nla_len(attr), rem) {
>         switch (nla_type(nla)) {
>         case LWTUNNEL_IP_OPTS_GENEVE:
>             ...
>             opts_len += opt_len;
>             if (opts_len > IP_TUNNEL_OPTS_MAX)
> 
> So a request sends several Geneve options by repeating the GENEVE
> attribute. The uAPI also defines a structured inner set for it, which
> geneve_opt_policy enforces:
> 
>     [LWTUNNEL_IP_OPT_GENEVE_CLASS]	= { .type = NLA_U16 },
>     [LWTUNNEL_IP_OPT_GENEVE_TYPE]	= { .type = NLA_U8 },
>     [LWTUNNEL_IP_OPT_GENEVE_DATA]	= { .type = NLA_BINARY, .len = 127 },
> 
> The geneve entry here has no multi-attr. YnlFamily._add_attr() only turns
> a list value into repeated attributes when attr.is_multi is set, so two
> Geneve options on one route cannot be expressed.
> 
> Adding multi-attr alone would not make requests work, because of the
> NLA_F_NESTED problem above. Nothing later in the series changes this.
> 
> > +      -
> > +        name: vxlan
> > +        type: nest
> > +        nested-attributes: lwtunnel-ip-opt-vxlan
> 
> [ ... ]
> 
> -- 
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261008-ynl_rt_encap-v4-0-4ed2ccf7f949%40kylinos.cn

  reply	other threads:[~2026-10-09  9:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  8:24 [PATCH net-next v4 0/6] netlink: add lwtunnel encap sub-message support to rt-route Hangbin Liu
2026-10-08  8:24 ` [PATCH net-next v4 1/6] net: lwtunnel: change encap fill order Hangbin Liu
2026-10-08  8:24 ` [PATCH net-next v4 2/6] tools: ynl: convert enum selector to string for sub-message parsing Hangbin Liu
2026-10-09  9:06   ` netdev-bot+sashiko
2026-10-09  9:40     ` Hangbin Liu
2026-10-08  8:24 ` [PATCH net-next v4 3/6] netlink: specs: rt-route: add lwtunnel encap sub-message support Hangbin Liu
2026-10-09  9:06   ` netdev-bot+sashiko
2026-10-08  8:24 ` [PATCH net-next v4 4/6] netlink: specs: rt-route: describe lwtunnel IP options Hangbin Liu
2026-10-09  9:07   ` netdev-bot+sashiko
2026-10-09  9:44     ` Hangbin Liu [this message]
2026-10-08  8:24 ` [PATCH net-next v4 5/6] netlink: specs: rt-route: describe lwt BPF program options Hangbin Liu
2026-10-08  8:24 ` [PATCH net-next v4 6/6] netlink: specs: rt-route: describe seg6-local attrs Hangbin Liu
2026-10-09  9:07   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=asi3mNcz1H6wJPOB@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®