From: Hangbin Liu <hangbin.liu@linux.dev>
To: Justin Iurman <justin.iurman@gmail.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>,
Hangbin Liu <liuhangbin@kylinos.cn>
Subject: Re: [PATCH iproute2-next] lwt: ioam6: allow options in any order
Date: Mon, 26 Oct 2026 09:46:59 +0800 [thread overview]
Message-ID: <at6xE1zwuKqeO8yv@fedora> (raw)
In-Reply-To: <1d0887eb-2ce1-4768-a1ee-6c05a0830f52@gmail.com>
Hi Justin,
On Sat, Oct 24, 2026 at 05:26:28PM +0200, Justin Iurman wrote:
> On 10/22/26 04:53, Hangbin Liu wrote:
> > From: Hangbin Liu <liuhangbin@kylinos.cn>
> >
> > The ioam6 encap options must be given in a fixed order (freq, mode,
> > tunsrc, tundst, trace, prealloc, type, ns, size). If a user uses a
> > different order, the command fails with a misleading error even
> > though every option is present:
> >
> > # ip -6 route change 2001:db8:2:1::/64 encap ioam6 mode encap \
> > trace prealloc tundst 2001:db8:2:1::2 type 0x800000 ns 0 size 12 \
> > via 2001:db8:1::3 dev dummy0
> > Error: argument "tundst" is required
> >
> > Parse all options in a single while loop instead, then run the
> > cross-option and missing-argument checks after the loop, reporting
> > the missing arguments in the order the options are documented in
> > ip-route(8).
>
> The current order is not arbitrary by intent:
>
> 1. freq
> 2. mode
> 3. tunsrc
> 4. tundst
> 5. trace
> 6. prealloc
> 7. type|ns|size
>
> While I agree some could be swappable and the above order is too strict,
> most are dependent on context (i.e., a previous keyword). For example,
> (type|ns|size) are only valid in a 'prealloc' context, which one is only
> valid in a 'trace' context. They form a group and their current order should
> remain inside this group.
>
> OTOH, as mentioned, some could be swapped. For example, both tunsrc and
> tundst could come in whatever order. However, they are only valid in a
> specific 'mode' context, so they should appear after it. With 'mode', they
> form another group. 'freq' forms another group by itself.
>
> So, I guess a new accepted (relaxed) order should accept groups in whatever
> order, but the order inside a same group should remain. That said, I'd be
> open to this proposal if other iproute2 commands also accept parameters in
> any order, regardless of their scope or dependencies.
Thanks for the reply. I agree your explanation about the ordering makes sense.
Personally, though, I still think the ordering constraint is too strict. And
the new patch also validates for mode mismatches and missing parameters.
I’ve checked all encap types: only mpls and ila require the address to be the
first parameter, seg6 has an error info about the tunsrc order. All others allow
arbitrary order.
I’m fine with keeping the existing behavior, as I can read the source code and
know the order is fixed. But new users will likely hit this same issue again.
Thanks
Hangbin
prev parent reply other threads:[~2026-10-26 1:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 2:53 [PATCH iproute2-next] lwt: ioam6: allow options in any order Hangbin Liu
2026-10-24 15:26 ` Justin Iurman
2026-10-26 1:46 ` 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=at6xE1zwuKqeO8yv@fedora \
--to=hangbin.liu@linux.dev \
--cc=dsahern@kernel.org \
--cc=justin.iurman@gmail.com \
--cc=liuhangbin@kylinos.cn \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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