aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2018-03-13 15:49:44 +1100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-05-31 21:19:24 +0200
commita34ff158595f29cb904a3fc05a3ecd815ef0c8b7 (patch)
tree9aa76a3fd2482fa27538576212d7ebe3a0369bf6
parent577977799ca5af74cd64911a8b3044c572fe6bdd (diff)
downloadslirp-a34ff158595f29cb904a3fc05a3ecd815ef0c8b7.zip
slirp-a34ff158595f29cb904a3fc05a3ecd815ef0c8b7.tar.gz
slirp-a34ff158595f29cb904a3fc05a3ecd815ef0c8b7.tar.bz2
slirp/debug: Print IP addresses in human readable form
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--arp_table.c4
-rw-r--r--socket.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/arp_table.c b/arp_table.c
index b4e96c2..9c25f1d 100644
--- a/arp_table.c
+++ b/arp_table.c
@@ -33,7 +33,7 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])
int i;
DEBUG_CALL("arp_table_add");
- DEBUG_ARG("ip = %s", inet_ntoa(*(struct in_addr *)&ip_addr));
+ DEBUG_ARG("ip = %s", inet_ntoa((struct in_addr){ .s_addr = ip_addr }));
DEBUG_ARGS((dfd, " hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", ethaddr[0],
ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5]));
@@ -66,7 +66,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr,
int i;
DEBUG_CALL("arp_table_search");
- DEBUG_ARG("ip = %s", inet_ntoa(*(struct in_addr *)&ip_addr));
+ DEBUG_ARG("ip = %s", inet_ntoa((struct in_addr){ .s_addr = ip_addr }));
/* If broadcast address */
if (ip_addr == 0xffffffff || ip_addr == broadcast_addr) {
diff --git a/socket.c b/socket.c
index 65998e0..160b460 100644
--- a/socket.c
+++ b/socket.c
@@ -701,9 +701,9 @@ struct socket *tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport,
memset(&addr, 0, addrlen);
DEBUG_CALL("tcp_listen");
- DEBUG_ARG("haddr = %s", inet_ntoa(*(struct in_addr *)&haddr));
+ DEBUG_ARG("haddr = %s", inet_ntoa((struct in_addr){ .s_addr = haddr }));
DEBUG_ARG("hport = %d", ntohs(hport));
- DEBUG_ARG("laddr = %s", inet_ntoa(*(struct in_addr *)&laddr));
+ DEBUG_ARG("laddr = %s", inet_ntoa((struct in_addr){ .s_addr = laddr }));
DEBUG_ARG("lport = %d", ntohs(lport));
DEBUG_ARG("flags = %x", flags);