From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrea Claudi <aclaudi@redhat.com>
Cc: Vladimir Nikishkin <vladimir@nikishkin.pw>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com,
eng.alaamohamedsoliman.am@gmail.com, gnault@redhat.com,
razor@blackwall.org, idosch@nvidia.com, liuhangbin@gmail.com,
eyal.birger@gmail.com, jtoppins@redhat.com
Subject: Re: [PATCH iproute2-next v4] ip-link: add support for nolocalbypass in vxlan
Date: Fri, 19 May 2023 09:19:07 -0700 [thread overview]
Message-ID: <20230519091907.6af1b3b1@hermes.local> (raw)
In-Reply-To: <ZGc9MHUkZ7nS7q+o@renaissance-vector>
On Fri, 19 May 2023 11:11:12 +0200
Andrea Claudi <aclaudi@redhat.com> wrote:
> On Fri, May 19, 2023 at 11:50:03AM +0800, Vladimir Nikishkin wrote:
> >
> > Stephen Hemminger <stephen@networkplumber.org> writes:
> >
> > > On Thu, 18 May 2023 21:46:01 +0800
> > > Vladimir Nikishkin <vladimir@nikishkin.pw> wrote:
> > >
> > >> + if (tb[IFLA_VXLAN_LOCALBYPASS]) {
> > >> + __u8 localbypass = rta_getattr_u8(tb[IFLA_VXLAN_LOCALBYPASS]);
> > >> +
> > >> + print_bool(PRINT_JSON, "localbypass", NULL, localbypass);
> > >> + if (localbypass) {
> > >> + print_string(PRINT_FP, NULL, "localbypass ", NULL);
> > >> + } else {
> > >> + print_string(PRINT_FP, NULL, "nolocalbypass ", NULL);
> > >> + }
> > >> + }
> > >
> > > You don't have to print anything if nolocalbypass. Use presence as
> > > a boolean in JSON.
> > >
> > > I.e.
> > > if (tb[IFLA_VXLAN_LOCALBYPASS] &&
> > > rta_getattr_u8(tb[IFLA_VXLAN_LOCALBYPASS])) {
> > > print_bool(PRINT_ANY, "localbypass", "localbypass", true);
> > > }
> > >
> > > That is what other options do.
> > > Follows the best practices for changes to existing programs: your
> > > new feature should look like all the others.
> >
> > Sorry, I do not understand. I intended to do exactly that, and I copied
> > and adjusted for the option name the code currently used for the
> > "udpcsum" option. Which is exactly
> >
> > if (is_json_context()) {
> > print_bool(PRINT_ANY, "udp_csum", NULL, udp_csum);
> > } else {
> > if (!udp_csum)
> > fputs("no", f);
> > fputs("udpcsum ", f);
> > }
> > I just replaced that option name with [no]localbypass. Fairly
> > straightforward, prints noudpcsum or udpcsum. Later Andrea C
> >
> > Then Andrea Claudi suggested that print_bool knows about the json
> > context itself, so the outer check is not needed, so I removed that.
> > But the "model option" I used (really the simplest one), does have
> > output both when set to true, and when set to false. I have neither an
> > opinion on this nor an understanding what is better for scripting. But I
> > do not understand the suggestion "do like the other options do", when
> > seemingly, other options do what I suggest in the first place.
> >
>
> If I get Stephen corretly, he is simply suggesting that printing
> "nolocalbypass" is unnecessary. If you find don't find "localbypass" in
> the output, you know it's not enabled.
>
> Unfortunately iplink_vxlan does not work according to this logic, as you
> are pointing out, but there are several places where this happens, like
> link_gre6.c:543. So you can do that for "localbypass" here.
>
> Fixing old options, on the other hand, is not easy, as we may end up
> breaking user scripts relying on "no<whatever>" option. I can work on a
> patch for that, but we probably need some kind of deprecation warning to
> users.
>
> Stephen, what do you think?
>
Scripts parsing non-json output are fragile. There was never a hard
guarantee that non-json output was stable.
I was looking at the existing vxlan_print_opts() and it already does
this for several options.
static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
...
if (tb[IFLA_VXLAN_COLLECT_METADATA] &&
rta_getattr_u8(tb[IFLA_VXLAN_COLLECT_METADATA])) {
print_bool(PRINT_ANY, "external", "external ", true);
}
if (tb[IFLA_VXLAN_VNIFILTER] &&
rta_getattr_u8(tb[IFLA_VXLAN_VNIFILTER])) {
print_bool(PRINT_ANY, "vnifilter", "vnifilter", true);
}
prev parent reply other threads:[~2023-05-19 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 13:46 [PATCH iproute2-next v4] ip-link: add support for nolocalbypass in vxlan Vladimir Nikishkin
2023-05-18 15:49 ` Stephen Hemminger
2023-05-19 3:50 ` Vladimir Nikishkin
2023-05-19 9:11 ` Andrea Claudi
2023-05-19 16:19 ` Stephen Hemminger [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=20230519091907.6af1b3b1@hermes.local \
--to=stephen@networkplumber.org \
--cc=aclaudi@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eng.alaamohamedsoliman.am@gmail.com \
--cc=eyal.birger@gmail.com \
--cc=gnault@redhat.com \
--cc=idosch@nvidia.com \
--cc=jtoppins@redhat.com \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=vladimir@nikishkin.pw \
/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;
as well as URLs for NNTP newsgroup(s).