From: Hangbin Liu <hangbin.liu@linux.dev>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Donald Hunter <donald.hunter@gmail.com>, netdev@vger.kernel.org
Subject: Re: [ynl] how to fix the order of selector and `_decode_sub_msg`
Date: Fri, 28 Aug 2026 09:41:40 +0800 [thread overview]
Message-ID: <apDnVCOroIPIhFWG@fedora> (raw)
In-Reply-To: <20260827101416.44f53ba5@kernel.org>
On Thu, Aug 27, 2026 at 10:14:16AM -0700, Jakub Kicinski wrote:
> On Tue, 25 Aug 2026 20:48:55 +0800 Hangbin Liu wrote:
> > Hi Donald, Jakub,
> >
> > Recently I have been trying to add encap decoding support for `rt‑route.yaml`,
> > with formats similar to:
> >
> > -
> > name: encap-type
> > type: u16
> > enum: encap-type
> > -
> > name: encap
> > type: sub-message
> > sub-message: encap-data
> > selector: encap-type
> >
> > However, sub‑message decoding is broken inside `ynl.py`. The root cause is
> > that `lwtunnel_fill_encap()` sets the encap‑type *after* the encap payload
> > data.
> >
> > In iproute2, `parse_rtattr()` extracts all attributes together. In contrast,
> > `ynl.py` stores attributes one‑by‑one into `search_attrs` after they get
> > decoded (_decode() -> self._rsp_add()). As a result, we cannot locate the
> > `selector` while decoding the "encap" payload.
> >
> > Should we decode sub‑messages after finishing first‑level attribute decoding?
> > Do you have any suggestions on how we can fix this?
>
> I'd change the kernel to output the type before the data.
> The code seems to be trying to cancel out cleanly on EOPNOTSUPP.
> Which is a good code pattern in principle but I don't think it makes
> sense for dump / get. And no existing ->fill_encap can return EOPNOTSUPP
> so instead of complicating things we should just move the type before
> the data in the kernel.
Thanks, that would be an easy fix.
Hangbin
prev parent reply other threads:[~2026-08-28 1:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 12:48 [ynl] how to fix the order of selector and `_decode_sub_msg` Hangbin Liu
2026-08-27 17:14 ` Jakub Kicinski
2026-08-28 1:41 ` Hangbin Liu [this message]
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=apDnVCOroIPIhFWG@fedora \
--to=hangbin.liu@linux.dev \
--cc=donald.hunter@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.