On 2/5/18 12:49 PM, Serhey Popovych wrote:
> There is at least three places implementing same things: two in
> ipaddress.c print_linkinfo() & print_linkinfo_brief() and one in
> bridge/link.c.
> 
> They are diverge from each other very little: bridge/link.c does not
> support JSON output at the moment and print_linkinfo_brief() does not
> handle IFLA_LINK_NETNS case.
> 
> Introduce and use print_name_and_link() routine to handle name@link
> output in all possible variations; respect IFLA_LINK_NETNS attribute to
> handle case when link is in different namespace; use ll_idx_n2a() for
> interface name instead of "<nil>" to share logic with other code (e.g.
> ll_name_to_index() and ll_index_to_name()) supporting such template.
> 
> Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com>
> ---
>  bridge/link.c   |   13 +++----------
>  include/utils.h |    4 ++++
>  ip/ipaddress.c  |   44 ++------------------------------------------
>  lib/utils.c     |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 58 insertions(+), 52 deletions(-)
> 

This patch is causing a diff on my system:

# ip  -br add sh > /tmp/1
# ip/ip  -br add sh > /tmp/2
# diff /tmp/1 /tmp/2
8c8
< veth-out@br3     UP             fe80::18a8:89ff:fee7:55c5/64
---
> veth-out@if7     UP             fe80::18a8:89ff:fee7:55c5/64

So the current ip resolves ifindex 7 to br3:

# ip li sh dev br3
7: br3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master
vrf3 state UP mode DEFAULT group default qlen 1000

where your patch causes if%d to be printed.

Reply via email to