Re: [PATCH iproute2-next v2 5/6] utils: Introduce and use print_name_and_link() to print name@link
From: David Ahern <hidden>
Date: 2018-02-01 15:41:06
From: David Ahern <hidden>
Date: 2018-02-01 15:41:06
On 2/1/18 4:09 AM, Serhey Popovych wrote:
David Ahern wrote:quoted
quoted
diff --git a/bridge/link.c b/bridge/link.c index a11cbb1..90c9734 100644 --- a/bridge/link.c +++ b/bridge/link.c@@ -125,20 +125,13 @@ int print_linkinfo(const struct sockaddr_nl *who, if (n->nlmsg_type == RTM_DELLINK) fprintf(fp, "Deleted "); - fprintf(fp, "%d: %s ", ifi->ifi_index, - tb[IFLA_IFNAME] ? rta_getattr_str(tb[IFLA_IFNAME]) : "<nil>"); + fprintf(fp, "%d: ", ifi->ifi_index); + + print_name_and_link("%s: ", COLOR_NONE, name, tb);It only needs tb[IFLA_LINK] so just pass it. Makes the arg list consistent with the function name too.Unfortunately not only: it uses IFLA_LINK_NETNSID too. May be adding "_rta" suffix to this routine as we did in the past when introducing get_addr_rta() and similar routines? In my opinion this is preferred than adding one more parameters to the routine.
ok, tb arg is fine. I missed the IFLA_LINK_NETNSID case.