Subject: Re: [PATCH iproute2-next v4] ip-link: add support for nolocalbypass in vxlan

From: Stephen Hemminger <[email-masked]>
Date: Thu, 18 May 2023 08:49:08 -0700

On Thu, 18 May 2023 21:46:01 +0800
Vladimir Nikishkin <[email-masked]> 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.