diff mbox series

[v4,4/4] ibacm: Use alias name when possible

Message ID 20190201185049.239177-5-haakon.bugge@oracle.com (mailing list archive)
State Not Applicable
Headers show
Series ibacm: Replace ioctl with netlink and fix inablity to resurrect an interface | expand

Commit Message

Haakon Bugge Feb. 1, 2019, 6:50 p.m. UTC
When using ipoib child interfaces, the names displayed by the ip
utility show:

 # ip addr show | grep inet' ' | grep ib
    inet 192.168.200.201/24 scope global stib1
    inet 192.168.200.200/24 scope global secondary stib1:P03

However, the logging of ibacm uses the device names (slightly edited
for better brevity):

 # grep acm_ep_ip_iter_cb /usr/local/var/log/ibacm.log
Added 192.168.200.201/24 mlx4_0 2 0x84b4 from stib1
Added 192.168.200.200/24 mlx4_0 2 0x84b4 from stib1

This commit changes this by using the alias name when possible, and
the above would read:

 # grep acm_ep_ip_iter_cb /usr/local/var/log/ibacm.log
Added 192.168.200.201/24 mlx4_0 2 0x84b4 from stib1
Added 192.168.200.200/24 mlx4_0 2 0x84b4 from stib1:P03

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>

---

v1 -> v2:
   * Added Ira's r-b
   * Removed Gerrit's Change-Id tag (Håkon)
---
 ibacm/src/acm_util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ibacm/src/acm_util.c b/ibacm/src/acm_util.c
index 8807579d..828501df 100644
--- a/ibacm/src/acm_util.c
+++ b/ibacm/src/acm_util.c
@@ -216,7 +216,8 @@  static void acm_if_iter(struct nl_object *obj, void *_ctx_and_cb)
 		be64toh(sgid.global.interface_id));
 
 	memcpy(&bin_addr, nl_addr_get_binary_addr(a), addr_len);
-	ctx_cb->cb(rtnl_link_get_name(link), &sgid, pkey, af2acm_addr_type(af), bin_addr, ip_str, ctx_cb->ctx);
+	ctx_cb->cb(label ? label : rtnl_link_get_name(link),
+		   &sgid, pkey, af2acm_addr_type(af), bin_addr, ip_str, ctx_cb->ctx);
 }