From: Jakub Kicinski <kuba@kernel.org>
To: Hangbin Liu <hangbin.liu@linux.dev>
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: Thu, 27 Aug 2026 10:14:16 -0700 [thread overview]
Message-ID: <20260827101416.44f53ba5@kernel.org> (raw)
In-Reply-To: <ao2PN6wp9A2SjRar@fedora>
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.
next prev parent reply other threads:[~2026-08-27 17:14 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 [this message]
2026-08-28 1:41 ` Hangbin Liu
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=20260827101416.44f53ba5@kernel.org \
--to=kuba@kernel.org \
--cc=donald.hunter@gmail.com \
--cc=hangbin.liu@linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox