[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87cz2xt1rb.fsf@laptop.lockywolf.net>
Date: Fri, 19 May 2023 11:50:03 +0800
From: Vladimir Nikishkin <vladimir@...ishkin.pw>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, eng.alaamohamedsoliman.am@...il.com,
gnault@...hat.com, razor@...ckwall.org, idosch@...dia.com,
liuhangbin@...il.com, eyal.birger@...il.com, jtoppins@...hat.com
Subject: Re: [PATCH iproute2-next v4] ip-link: add support for nolocalbypass
in vxlan
Stephen Hemminger <stephen@...workplumber.org> writes:
> On Thu, 18 May 2023 21:46:01 +0800
> Vladimir Nikishkin <vladimir@...ishkin.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.
--
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)
--
Fastmail.
Powered by blists - more mailing lists