From nobody Wed Apr 24 04:54:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520918875912782.8567995083031; Mon, 12 Mar 2018 22:27:55 -0700 (PDT) Received: from localhost ([::1]:37037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evcTa-0006oo-LM for importer@patchew.org; Tue, 13 Mar 2018 01:27:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evcSm-0006UU-HH for qemu-devel@nongnu.org; Tue, 13 Mar 2018 01:27:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evcSi-0000IN-2m for qemu-devel@nongnu.org; Tue, 13 Mar 2018 01:27:04 -0400 Received: from [107.173.13.209] (port=49697 helo=ozlabs.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evcSh-0000FL-SK for qemu-devel@nongnu.org; Tue, 13 Mar 2018 01:27:00 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 33A28AE80004; Tue, 13 Mar 2018 00:49:02 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 15:49:44 +1100 Message-Id: <20180313044944.21058-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v2] slirp/debug: Print IP addresses in human readable form X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Kardashevskiy --- 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; =20 DEBUG_CALL("arp_table_add"); - DEBUG_ARG("ip =3D 0x%x", ip_addr); + DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); DEBUG_ARGS((dfd, " hw addr =3D %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; =20 DEBUG_CALL("arp_table_search"); - DEBUG_ARG("ip =3D 0x%x", ip_addr); + DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); =20 /* If broadcast address */ if (ip_addr =3D=3D 0xffffffff || ip_addr =3D=3D 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); =20 DEBUG_CALL("tcp_listen"); - DEBUG_ARG("haddr =3D %x", haddr); - DEBUG_ARG("hport =3D %d", hport); - DEBUG_ARG("laddr =3D %x", laddr); - DEBUG_ARG("lport =3D %d", lport); + DEBUG_ARG("haddr =3D %s", inet_ntoa((struct in_addr){.s_addr =3D haddr})); + DEBUG_ARG("hport =3D %d", ntohs(hport)); + DEBUG_ARG("laddr =3D %s", inet_ntoa((struct in_addr){.s_addr =3D laddr})); + DEBUG_ARG("lport =3D %d", ntohs(lport)); DEBUG_ARG("flags =3D %x", flags); =20 so =3D 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 =3D %p", so); DEBUG_ARG("m =3D %p", m); - DEBUG_ARG("saddr =3D %lx", (long)saddr->sin_addr.s_addr); - DEBUG_ARG("daddr =3D %lx", (long)daddr->sin_addr.s_addr); + DEBUG_ARG("saddr =3D %s", inet_ntoa(saddr->sin_addr)); + DEBUG_ARG("daddr =3D %s", inet_ntoa(daddr->sin_addr)); =20 /* * Adjust for header --=20 2.11.0