lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1522255934-497-3-git-send-email-jon.maloy@ericsson.com>
Date:   Wed, 28 Mar 2018 18:52:14 +0200
From:   Jon Maloy <jon.maloy@...csson.com>
To:     <davem@...emloft.net>, <netdev@...r.kernel.org>
CC:     <mohan.krishna.ghanta.krishnamurthy@...csson.com>,
        <tung.q.nguyen@...tech.com.au>, <hoang.h.le@...tech.com.au>,
        <jon.maloy@...csson.com>, <canh.d.luu@...tech.com.au>,
        <ying.xue@...driver.com>, <tipc-discussion@...ts.sourceforge.net>
Subject: [iproute2-next  2/2] tipc: change node address printout formats

Since a node address now per definition is only an unstructured 32-bit
integer it makes no sense print it out as a structured string.

In this commit, we replace all occurrences of "<Z.C.N>" printouts with
just an "%x".

Acked-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@...csson.com>
Signed-off-by: Jon Maloy <jon.maloy@...csson.com>
---
 tipc/link.c      |  3 +--
 tipc/nametable.c | 16 +++++-----------
 tipc/node.c      | 11 ++---------
 tipc/socket.c    |  3 +--
 4 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/tipc/link.c b/tipc/link.c
index 4ae1c91..02f14aa 100644
--- a/tipc/link.c
+++ b/tipc/link.c
@@ -616,8 +616,7 @@ static void link_mon_print_non_applied(uint16_t applied, uint16_t member_cnt,
 		if (i != applied)
 			printf(",");
 
-		sprintf(addr_str, "%u.%u.%u:", tipc_zone(members[i]),
-			tipc_cluster(members[i]), tipc_node(members[i]));
+		sprintf(addr_str, "%x:", members[i]);
 		state = map_get(up_map, i) ? 'U' : 'D';
 		printf("%s%c", addr_str, state);
 	}
diff --git a/tipc/nametable.c b/tipc/nametable.c
index 770a644..2578940 100644
--- a/tipc/nametable.c
+++ b/tipc/nametable.c
@@ -26,7 +26,6 @@
 static int nametable_show_cb(const struct nlmsghdr *nlh, void *data)
 {
 	int *iteration = data;
-	char port_id[PORTID_STR_LEN];
 	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
 	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
 	struct nlattr *attrs[TIPC_NLA_NAME_TABLE_MAX + 1] = {};
@@ -46,22 +45,17 @@ static int nametable_show_cb(const struct nlmsghdr *nlh, void *data)
 		return MNL_CB_ERROR;
 
 	if (!*iteration)
-		printf("%-10s %-10s %-10s %-26s %-10s\n",
-		       "Type", "Lower", "Upper", "Port Identity",
+		printf("%-10s %-10s %-10s %-10s %-10s %-10s\n",
+		       "Type", "Lower", "Upper", "Node", "Port",
 		       "Publication Scope");
 	(*iteration)++;
 
-	snprintf(port_id, sizeof(port_id), "<%u.%u.%u:%u>",
-		 tipc_zone(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
-		 tipc_cluster(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
-		 tipc_node(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
-		 mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF]));
-
-	printf("%-10u %-10u %-10u %-26s %-12u",
+	printf("%-10u %-10u %-10u %-10x %-10u %-12u",
 	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_TYPE]),
 	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_LOWER]),
 	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_UPPER]),
-	       port_id,
+	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE]),
+	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF]),
 	       mnl_attr_get_u32(publ[TIPC_NLA_PUBL_KEY]));
 
 	printf("%s\n", scope[mnl_attr_get_u32(publ[TIPC_NLA_PUBL_SCOPE])]);
diff --git a/tipc/node.c b/tipc/node.c
index 3ebbe0b..b73b644 100644
--- a/tipc/node.c
+++ b/tipc/node.c
@@ -40,10 +40,7 @@ static int node_list_cb(const struct nlmsghdr *nlh, void *data)
 		return MNL_CB_ERROR;
 
 	addr = mnl_attr_get_u32(attrs[TIPC_NLA_NODE_ADDR]);
-	printf("<%u.%u.%u>: ",
-		tipc_zone(addr),
-		tipc_cluster(addr),
-		tipc_node(addr));
+	printf("%x: ", addr);
 
 	if (attrs[TIPC_NLA_NODE_UP])
 		printf("up\n");
@@ -123,11 +120,7 @@ static int cmd_node_get_addr(struct nlmsghdr *nlh, const struct cmd *cmd,
 	}
 	close(sk);
 
-	printf("<%u.%u.%u>\n",
-		tipc_zone(addr.addr.id.node),
-		tipc_cluster(addr.addr.id.node),
-		tipc_node(addr.addr.id.node));
-
+	printf("%x\n", addr.addr.id.node);
 	return 0;
 }
 
diff --git a/tipc/socket.c b/tipc/socket.c
index 48ba821..852984e 100644
--- a/tipc/socket.c
+++ b/tipc/socket.c
@@ -84,8 +84,7 @@ static int sock_list_cb(const struct nlmsghdr *nlh, void *data)
 		mnl_attr_parse_nested(attrs[TIPC_NLA_SOCK_CON], parse_attrs, con);
 		node = mnl_attr_get_u32(con[TIPC_NLA_CON_NODE]);
 
-		printf("  connected to <%u.%u.%u:%u>", tipc_zone(node),
-			tipc_cluster(node), tipc_node(node),
+		printf("  connected to %x:%u", node,
 			mnl_attr_get_u32(con[TIPC_NLA_CON_SOCK]));
 
 		if (con[TIPC_NLA_CON_FLAG])
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ