Skip to content

Commit

Permalink
ndmp: print ip addresses in human readable format
Browse files Browse the repository at this point in the history
Previously NDMP showed ip addresses in hex-format.
This patch makes sure they are always formatted in
a human readable way.
  • Loading branch information
arogge committed Mar 26, 2019
1 parent 273e7f0 commit 81a4253
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions core/src/ndmp/ndmos.h
Expand Up @@ -328,9 +328,6 @@
#define NDMOS_OPTION_ROBOT_SIMULATOR 1
#define NDMOS_OPTION_GAP_SIMULATOR 1

/* Convert IP to human readable string instead of HEX String */
/* #define NDMOS_OPTION_PRETTYPRINT_HUMAN_READABLE_IP 1 */

/*
* Constants
*/
Expand Down
6 changes: 1 addition & 5 deletions core/src/ndmp/ndmp4_pp.c
Expand Up @@ -80,17 +80,13 @@ ndmp4_pp_addr (char *buf, ndmp4_addr *ma)
for (i = 0; i < ma->ndmp4_addr_u.tcp_addr.tcp_addr_len; i++) {
tcp = &ma->ndmp4_addr_u.tcp_addr.tcp_addr_val[i];

#ifndef NDMOS_OPTION_PRETTYPRINT_HUMAN_READABLE_IP
sprintf (NDMOS_API_STREND(buf), " #%d(%lx,%d",
i, tcp->ip_addr, tcp->port);
#else
char ip_addr[100];
ip_in_host_order = ntohl(tcp->ip_addr);
sprintf (NDMOS_API_STREND(buf), "%d(%s:%u",
i,
inet_ntop (AF_INET, &ip_in_host_order, ip_addr, sizeof(ip_addr)),
tcp->port);
#endif /* NDMOS_OPTION_PRETTYPRINT_HUMAN_READABLE_IP */

for (j = 0; j < tcp->addr_env.addr_env_len; j++) {
sprintf (NDMOS_API_STREND(buf), ",%s=%s",
tcp->addr_env.addr_env_val[j].name,
Expand Down

0 comments on commit 81a4253

Please sign in to comment.