Previously, only the interface index was printed. It is helpful to display the interface name, instead of letting the reader doing the translation from the index to the name. Because the index was already displayed before, keep it instead of replacing it, just not to break some possible scripts parsing this output. Signed-off-by: Matthieu Baerts (NGI0) --- ip/ipmptcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index acd008f3..5f194aca 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -471,6 +471,17 @@ static void print_addr(const char *key, int af, struct rtattr *value) printf(" %s=%s", key, str); } +static void print_iface(int index) +{ + const char *ifname; + + printf(" ifindex=%d", index); + + ifname = index ? ll_index_to_name(index) : NULL; + if (ifname) + printf(" dev=%s", ifname); +} + static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { @@ -530,7 +541,7 @@ static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl, if (tb[MPTCP_ATTR_TIMEOUT]) printf(" timeout=%u", rta_getattr_u32(tb[MPTCP_ATTR_TIMEOUT])); if (tb[MPTCP_ATTR_IF_IDX]) - printf(" ifindex=%d", rta_getattr_s32(tb[MPTCP_ATTR_IF_IDX])); + print_iface(rta_getattr_s32(tb[MPTCP_ATTR_IF_IDX])); if (tb[MPTCP_ATTR_RESET_REASON]) printf(" reset_reason=%u", rta_getattr_u32(tb[MPTCP_ATTR_RESET_REASON])); if (tb[MPTCP_ATTR_RESET_FLAGS]) -- 2.51.0