netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrea Claudi <aclaudi@redhat.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2 v4 2/2] vxlan: make option printing more consistent
Date: Fri, 26 May 2023 15:17:36 -0700	[thread overview]
Message-ID: <20230526151736.633919c0@hermes.local> (raw)
In-Reply-To: <ZHELme0yf4sDF3UW@renaissance-vector>

On Fri, 26 May 2023 21:42:17 +0200
Andrea Claudi <aclaudi@redhat.com> wrote:

> On Fri, May 26, 2023 at 10:41:41AM -0700, Stephen Hemminger wrote:
> > Add new helper function print_bool_opt() which prints
> > with no prefix and use it for vxlan options.
> > 
> > If the option matches the expected default value,
> > it is not printed if in non JSON mode unless the details
> > setting is repeated.
> > 
> > Use a table for the vxlan options. This will change
> > the order of the printing of options.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  include/json_print.h |   9 ++++
> >  ip/iplink_vxlan.c    | 110 +++++++++++++------------------------------
> >  lib/json_print.c     |  19 ++++++++
> >  3 files changed, 60 insertions(+), 78 deletions(-)
> > 
> > diff --git a/include/json_print.h b/include/json_print.h
> > index 91b34571ceb0..49d3cc14789c 100644
> > --- a/include/json_print.h
> > +++ b/include/json_print.h
> > @@ -101,6 +101,15 @@ static inline int print_rate(bool use_iec, enum output_type t,
> >  	return print_color_rate(use_iec, t, COLOR_NONE, key, fmt, rate);
> >  }
> >  
> > +int print_color_bool_opt(enum output_type type, enum color_attr color,
> > +			 const char *key, bool value, bool show);
> > +
> > +static inline int print_bool_opt(enum output_type type,
> > +				 const char *key, bool value, bool show)
> > +{
> > +	return print_color_bool_opt(type, COLOR_NONE, key, value, show);
> > +}
> > +
> >  /* A backdoor to the size formatter. Please use print_size() instead. */
> >  char *sprint_size(__u32 sz, char *buf);
> >  
> > diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
> > index cb6745c74507..e77c3aa2e3a5 100644
> > --- a/ip/iplink_vxlan.c
> > +++ b/ip/iplink_vxlan.c
> > @@ -19,6 +19,25 @@
> >  
> >  #define VXLAN_ATTRSET(attrs, type) (((attrs) & (1L << (type))) != 0)
> >  
> > +static const struct vxlan_bool_opt {
> > +	const char *key;
> > +	int type;
> > +	bool default_value;
> > +} vxlan_opts[] = {
> > +	{ "metadata",	IFLA_VXLAN_COLLECT_METADATA,	false },  
> 
> Here you are changing the output from "external" to "metadata", while
> continuing to use "external" to toggle the option. This may surprise a
> user which checks the output for this option after enabling it.
> 
> Moreover, looking at the man page for ip link, this option is used to
> specify "whether an external control plane (e.g. ip route encap) or the
> internal FDB should be used", so maybe "external" is more close to the
> true meaning of this option.
> 
> I would suggest either to continue using "external" or to switch to
> "metadata" also for option toggling (and update the manpage, too).
> 
> All the rest looks good to me.
>

Thanks will fix that.


  reply	other threads:[~2023-05-26 22:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 17:41 [PATCH iproute2 v4 0/2] vxlan: option printing Stephen Hemminger
2023-05-26 17:41 ` [PATCH iproute2 v4 1/2] vxlan: use print_nll for gbp and gpe Stephen Hemminger
2023-05-26 17:41 ` [PATCH iproute2 v4 2/2] vxlan: make option printing more consistent Stephen Hemminger
2023-05-26 19:42   ` Andrea Claudi
2023-05-26 22:17     ` Stephen Hemminger [this message]
2023-05-30 19:40 ` [PATCH iproute2 v4 0/2] vxlan: option printing patchwork-bot+netdevbpf

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=20230526151736.633919c0@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=aclaudi@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).