From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [Qemu-devel] [PATCH qemu v2] slirp/debug: Print IP addresses in human readable form
Date: Tue, 13 Mar 2018 15:49:44 +1100 [thread overview]
Message-ID: <20180313044944.21058-1-aik@ozlabs.ru> (raw)
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
checkpatch.pl complains on every single changed line as it keeps
using tabs - do I need to post 's/\t/ /g'?
---
Changes:
v2:
* replaced static cast to (in_addr*) with temporary structs
---
slirp/arp_table.c | 4 ++--
slirp/socket.c | 8 ++++----
slirp/udp.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/slirp/arp_table.c b/slirp/arp_table.c
index 3547043..f81963b 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 = 0x%x", 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 = 0x%x", 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 cb7b5b6..318301f 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -701,10 +701,10 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
memset(&addr, 0, addrlen);
DEBUG_CALL("tcp_listen");
- DEBUG_ARG("haddr = %x", haddr);
- DEBUG_ARG("hport = %d", hport);
- DEBUG_ARG("laddr = %x", laddr);
- DEBUG_ARG("lport = %d", lport);
+ 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){.s_addr = laddr}));
+ DEBUG_ARG("lport = %d", ntohs(lport));
DEBUG_ARG("flags = %x", flags);
so = socreate(slirp);
diff --git a/slirp/udp.c b/slirp/udp.c
index 227d779..e5bf065 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -241,8 +241,8 @@ int udp_output(struct socket *so, struct mbuf *m,
DEBUG_CALL("udp_output");
DEBUG_ARG("so = %p", so);
DEBUG_ARG("m = %p", m);
- DEBUG_ARG("saddr = %lx", (long)saddr->sin_addr.s_addr);
- DEBUG_ARG("daddr = %lx", (long)daddr->sin_addr.s_addr);
+ DEBUG_ARG("saddr = %s", inet_ntoa(saddr->sin_addr));
+ DEBUG_ARG("daddr = %s", inet_ntoa(daddr->sin_addr));
/*
* Adjust for header
--
2.11.0
next reply other threads:[~2018-03-13 5:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 4:49 Alexey Kardashevskiy [this message]
2018-03-13 7:44 ` [Qemu-devel] [PATCH qemu v2] slirp/debug: Print IP addresses in human readable form Samuel Thibault
2018-05-14 7:00 ` Alexey Kardashevskiy
2018-05-14 7:05 ` Samuel Thibault
2018-05-15 14:30 ` Eric Blake
2018-05-16 3:00 ` Alexey Kardashevskiy
2018-03-13 8:10 ` no-reply
2018-03-13 16:25 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180313044944.21058-1-aik@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).