Thread (11 messages) flat view 11 messages, 2 authors, 2018-01-17

Re: [PATCH iproute2 1/9] iplink: Use ll_index_to_name() instead of if_indextoname()

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-01-17 18:54:08

On Fri, 12 Jan 2018 19:39:26 +0200
Serhey Popovych [off-list ref] wrote:

This looks fine, but minor nuisances from checkpatch
quoted hunk ↗ jump to hunk
diff --git a/bridge/fdb.c b/bridge/fdb.c
index 376713b..2cc0268 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -219,10 +219,10 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 		unsigned int ifindex = rta_getattr_u32(tb[NDA_IFINDEX]);
 
 		if (ifindex) {
-			char ifname[IF_NAMESIZE];
+			const char *ifname;
 
 			if (!tb[NDA_LINK_NETNSID] &&
-			    if_indextoname(ifindex, ifname)) {
+			    (ifname = ll_index_to_name(ifindex))) {
 				if (jw_global)
Please rearrange to avoid assignment in conditional.
			ifname = ll_index_to_name(ifindex);
			if (ifname && !tb[NDA_LINK_NETNSID]) {

quoted hunk ↗ jump to hunk
@@ -135,14 +132,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
 		print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
 
 	if (tb[IFLA_LINK]) {
-		SPRINT_BUF(b1);
 		int iflink = rta_getattr_u32(tb[IFLA_LINK]);
 
-		if (iflink == 0)
-			fprintf(fp, "@NONE: ");
-		else
-			fprintf(fp, "@%s: ",
-				if_indextoname(iflink, b1));
+		fprintf(fp, "@%s: ", iflink ? ll_index_to_name(iflink) : "NONE");
Break long line here.


ERROR: do not use assignment in if condition
#265: FILE: ip/link_gre6.c:418:
+	if (tb[IFLA_GRE_LINK] &&

ERROR: do not use assignment in if condition
#296: FILE: ip/link_ip6tnl.c:381:
+	if (tb[IFLA_IPTUN_LINK] &&

ERROR: do not use assignment in if condition
#327: FILE: ip/link_iptnl.c:411:
+	if (tb[IFLA_IPTUN_LINK] &&

ERROR: do not use assignment in if condition
#368: FILE: ip/link_vti6.c:193:
+	if (tb[IFLA_VTI_LINK] &&
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help