mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-12-29 20:39:09 +00:00
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>
This commit is contained in:
parent
725ebfbf62
commit
5aad0baa3d
@ -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);
|
||||
}
|
||||
|
||||
@ -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])]);
|
||||
|
||||
11
tipc/node.c
11
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;
|
||||
}
|
||||
|
||||
|
||||
@ -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])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user