]> git.proxmox.com Git - mirror_iproute2.git/commit
iplink: Use ll_index_to_name() instead of if_indextoname()
authorSerhey Popovych <serhe.popovych@gmail.com>
Thu, 18 Jan 2018 14:04:28 +0000 (16:04 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 19 Jan 2018 00:34:37 +0000 (16:34 -0800)
commit45d3a6efb20d62cd5c618898a32906dcfd5a08d2
tree4e0f750a7c19a1d9cf63f1f4b21f74c0e09801e6
parentc619f2be8b7824ab8e19203d8040fbc5e766a183
iplink: Use ll_index_to_name() instead of if_indextoname()

There are two reasons for switching to cached variant:

  1) ll_index_to_name() may return result from cache,
     eliminating expensive ioctl() to the kernel.

     Note that most of the code already switched from plain
     if_indextoname() to ll_index_to_name() to cached variant
     in print path because in most cases cache populated.

  2) It always return name in the form "if%d", even if
     entry is not in cache and ioctl() fails. This drops
     "link_index" from JSON output.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/fdb.c
bridge/link.c
ip/iplink_bond.c
ip/iplink_vxlan.c
ip/iproute_lwtunnel.c
ip/link_gre.c
ip/link_gre6.c
ip/link_ip6tnl.c
ip/link_iptnl.c
ip/link_vti.c
ip/link_vti6.c