From: Alexey Kardashevskiy Date: Tue, 13 Mar 2018 04:49:44 +0000 (+1100) Subject: slirp/debug: Print IP addresses in human readable form X-Git-Tag: v3.0.0-rc0~120^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ee2022b44e5bbc5360513957790c656824eec55;p=thirdparty%2Fqemu.git slirp/debug: Print IP addresses in human readable form Signed-off-by: Alexey Kardashevskiy Signed-off-by: Samuel Thibault --- diff --git a/slirp/arp_table.c b/slirp/arp_table.c index bac608f97f3..f81963bb88b 100644 --- a/slirp/arp_table.c +++ b/slirp/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])); @@ -67,7 +67,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/slirp/socket.c b/slirp/socket.c index 6f18e157a5e..e2a71c9b04d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -701,9 +701,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, 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);