From: Stephen Hemminger <stephen@networkplumber.org>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
Date: Thu, 31 May 2018 11:46:15 -0400 [thread overview]
Message-ID: <20180531114615.3f10766f@shemminger-XPS-13-9360> (raw)
In-Reply-To: <20180531142848.377-1-nicolas.dichtel@6wind.com>
On Thu, 31 May 2018 16:28:48 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Parse and display those attributes.
> Example:
> ip l a type dummy
> ip netns add foo
> ip monitor link&
> ip l s dummy1 netns foo
> Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
> link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> ip/ipaddress.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 00da14c6f97c..c7c7e7df4e81 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
> }
> }
>
> + if (tb[IFLA_NEW_NETNSID]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
> +
> + print_int(PRINT_FP, NULL, " new-nsid %d", id);
> + }
> + if (tb[IFLA_NEW_IFINDEX]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
> +
> + print_int(PRINT_FP, NULL, " new-ifindex %d", id);
> + }
> +
> if (tb[IFLA_PROTO_DOWN]) {
> if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
> print_bool(PRINT_ANY,
This makes sense. All of linkinfo that is present should be displayed.
Both netns and ifindex are really unsigned values. Use __u32 and print_uint.
Also why not convert numeric values to names?
next prev parent reply other threads:[~2018-05-31 15:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 14:28 [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support Nicolas Dichtel
2018-05-31 14:31 ` Nicolas Dichtel
2018-05-31 15:46 ` Stephen Hemminger [this message]
2018-05-31 15:51 ` Nicolas Dichtel
2018-06-01 15:02 ` Nicolas Dichtel
2018-06-01 20:02 ` Stephen Hemminger
2018-06-04 12:12 ` [PATCH iproute2 0/2] display netns name instead of nsid Nicolas Dichtel
2018-06-04 12:12 ` [PATCH iproute2 1/2] ip: " Nicolas Dichtel
2018-06-04 21:12 ` Stephen Hemminger
2018-06-05 13:08 ` [PATCH iproute2 v2 0/2] " Nicolas Dichtel
2018-06-05 13:08 ` [PATCH iproute2 v2 1/2] ip: " Nicolas Dichtel
2018-06-05 16:52 ` Stephen Hemminger
2018-06-06 7:11 ` Nicolas Dichtel
2018-06-05 13:08 ` [PATCH iproute2 v2 2/2] iplink: enable to specify a name for the link-netns Nicolas Dichtel
2018-06-08 17:08 ` [PATCH iproute2 v2 0/2] display netns name instead of nsid Stephen Hemminger
2018-06-04 12:12 ` [PATCH iproute2 2/2] iplink: enable to specify a name for the link-netns Nicolas Dichtel
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=20180531114615.3f10766f@shemminger-XPS-13-9360 \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=shemminger@vyatta.com \
/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