public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: David Ahern <dsahern@gmail•com>
Cc: Sabrina Dubroca <sd@queasysnail•net>,
	netdev@vger•kernel.org, sbrivio@redhat•com,
	serhe.popovych@gmail•com
Subject: Re: [PATCH iproute2-next v2] ip link: add support to display extended tun attributes
Date: Tue, 20 Feb 2018 10:40:48 -0800	[thread overview]
Message-ID: <20180220104048.3a22d668@xeon-e3> (raw)
In-Reply-To: <676f02bb-d2eb-8fdb-5c56-f16338ecc162@gmail.com>

On Tue, 20 Feb 2018 09:34:15 -0700
David Ahern <dsahern@gmail•com> wrote:

> On 2/20/18 5:43 AM, Sabrina Dubroca wrote:
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail•net>
> > Reviewed-by: Stefano Brivio <sbrivio@redhat•com>
> > ---
> > v2: define print_onoff to print flags, fix checkpatch warnings, drop
> > header changes
> > 
> >  ip/iptuntap.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 86 insertions(+)  
> 
> applied to iproute2-next.
> 
> > 
> > diff --git a/ip/iptuntap.c b/ip/iptuntap.c
> > index 4628db2832b4..07253870472f 100644
> > --- a/ip/iptuntap.c
> > +++ b/ip/iptuntap.c
> > @@ -469,3 +469,89 @@ int do_iptuntap(int argc, char **argv)
> >  		*argv);
> >  	exit(-1);
> >  }
> > +
> > +static void print_owner(FILE *f, uid_t uid)
> > +{
> > +	struct passwd *pw = getpwuid(uid);
> > +
> > +	if (pw)
> > +		fprintf(f, "user %s ", pw->pw_name);
> > +	else
> > +		fprintf(f, "user %u ", uid);
> > +}
> > +
> > +static void print_group(FILE *f, gid_t gid)
> > +{
> > +	struct group *group = getgrgid(gid);
> > +
> > +	if (group)
> > +		fprintf(f, "group %s ", group->gr_name);
> > +	else
> > +		fprintf(f, "group %u ", gid);
> > +}
> > +  
> 
> 
> Those helpers can be re-used to make 'ip tuntap show' better too.

These should support JSON output.

  parent reply	other threads:[~2018-02-20 18:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 12:43 [PATCH iproute2-next v2] ip link: add support to display extended tun attributes Sabrina Dubroca
2018-02-20 16:34 ` David Ahern
2018-02-20 17:18   ` Sabrina Dubroca
2018-02-20 18:40   ` Stephen Hemminger [this message]
2018-02-20 20:19     ` David Ahern

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=20180220104048.3a22d668@xeon-e3 \
    --to=stephen@networkplumber$(echo .)org \
    --cc=dsahern@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sbrivio@redhat$(echo .)com \
    --cc=sd@queasysnail$(echo .)net \
    --cc=serhe.popovych@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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