Netdev List
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: Donald Hunter <donald.hunter@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Subject: [ynl] how to fix the order of selector and `_decode_sub_msg`
Date: Tue, 25 Aug 2026 20:48:55 +0800	[thread overview]
Message-ID: <ao2PN6wp9A2SjRar@fedora> (raw)

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?

Thanks
Hangbin

             reply	other threads:[~2026-08-25 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 12:48 Hangbin Liu [this message]
2026-08-27 17:14 ` [ynl] how to fix the order of selector and `_decode_sub_msg` Jakub Kicinski
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=ao2PN6wp9A2SjRar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox