summaryrefslogtreecommitdiff
path: root/tipc
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-03-28 18:52:14 +0200
committerDavid Ahern <dsahern@gmail.com>2018-03-28 20:41:15 -0700
commit5aad0baa3d45b49edd2322dd1d2df537e28e7169 (patch)
treea3accd94f0d892455d7f820bc6371bbd5a3fc66e /tipc
parent725ebfbf62547fcb1624f7961fd220cb028ba41f (diff)
downloadiproute2-5aad0baa3d45b49edd2322dd1d2df537e28e7169.tar.gz
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@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David Ahern <dsahern@gmail.com>
Diffstat (limited to 'tipc')
-rw-r--r--tipc/link.c3
-rw-r--r--tipc/nametable.c16
-rw-r--r--tipc/node.c11
-rw-r--r--tipc/socket.c3
4 files changed, 9 insertions, 24 deletions
diff --git a/tipc/link.c b/tipc/link.c
index 4ae1c915..02f14aad 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 770a644c..2578940f 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 3ebbe0b8..b73b644c 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 48ba8215..852984ec 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])