From nobody Tue Feb 10 16:43:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547508769481929.92343535073; Mon, 14 Jan 2019 15:32:49 -0800 (PST) Received: from localhost ([127.0.0.1]:39456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBim-00030l-5F for importer@patchew.org; Mon, 14 Jan 2019 18:32:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7J-0004nN-M9 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7I-0001iF-AT for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:01 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37534) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7H-0001WR-TN for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:00 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 988F21BB6; Mon, 14 Jan 2019 23:53:42 +0100 (CET) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ROYTqmPGM3vU; Mon, 14 Jan 2019 23:53:41 +0100 (CET) Received: from function.home (lfbn-1-11161-124.w86-213.abo.wanadoo.fr [86.213.235.124]) by hera.aquilenet.fr (Postfix) with ESMTPSA id AAE9D1BF4; Mon, 14 Jan 2019 23:53:12 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6U-0005fh-Mt; Mon, 14 Jan 2019 23:53:10 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:52:48 +0100 Message-Id: <20190114225306.21569-48-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114225306.21569-1-samuel.thibault@ens-lyon.org> References: <20190114225306.21569-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 47/65] slirp: drop List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Since commit 12f8def0e02232d7c6416ad9b66640f973c531d1 (v2.9), qemu requires Vista. Let's remove some conditional code. Note that this introduces a missing declaration warning with mingw. warning: implicit declaration of function 'inet_ntop' See also: https://sourceforge.net/p/mingw-w64/mailman/message/36473782/ We could workaround it by declaring it ourself depending on __MINGW64_VERSI= ON_*: WINSOCK_API_LINKAGE INT WSAAPI inet_pton(int Family, PCTSTR pszAddrString, = PVOID pAddrBuf); Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 22 ---------------------- slirp/ip6_icmp.c | 10 ++++------ slirp/ndp_table.c | 14 ++++++-------- 3 files changed, 10 insertions(+), 36 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index b1c98b9470..2d5337da04 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -290,17 +290,6 @@ static int net_slirp_init(NetClientState *peer, const = char *model, } #endif =20 -#if defined(_WIN32) && (_WIN32_WINNT < 0x0600) - /* No inet_pton helper before Vista... */ - if (vprefix6) { - /* Unsupported */ - error_setg(errp, "IPv6 prefix not supported"); - return -1; - } - memset(&ip6_prefix, 0, sizeof(ip6_prefix)); - ip6_prefix.s6_addr[0] =3D 0xfe; - ip6_prefix.s6_addr[1] =3D 0xc0; -#else if (!vprefix6) { vprefix6 =3D "fec0::"; } @@ -308,7 +297,6 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, error_setg(errp, "Failed to parse IPv6 prefix"); return -1; } -#endif =20 if (!vprefix6_len) { vprefix6_len =3D 64; @@ -320,10 +308,6 @@ static int net_slirp_init(NetClientState *peer, const = char *model, } =20 if (vhost6) { -#if defined(_WIN32) && (_WIN32_WINNT < 0x0600) - error_setg(errp, "IPv6 host not supported"); - return -1; -#else if (!inet_pton(AF_INET6, vhost6, &ip6_host)) { error_setg(errp, "Failed to parse IPv6 host"); return -1; @@ -332,17 +316,12 @@ static int net_slirp_init(NetClientState *peer, const= char *model, error_setg(errp, "IPv6 Host doesn't belong to network"); return -1; } -#endif } else { ip6_host =3D ip6_prefix; ip6_host.s6_addr[15] |=3D 2; } =20 if (vnameserver6) { -#if defined(_WIN32) && (_WIN32_WINNT < 0x0600) - error_setg(errp, "IPv6 DNS not supported"); - return -1; -#else if (!inet_pton(AF_INET6, vnameserver6, &ip6_dns)) { error_setg(errp, "Failed to parse IPv6 DNS"); return -1; @@ -351,7 +330,6 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, error_setg(errp, "IPv6 DNS doesn't belong to network"); return -1; } -#endif } else { ip6_dns =3D ip6_prefix; ip6_dns.s6_addr[15] |=3D 3; diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 3f74d172f4..595a62c8d4 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -74,6 +74,7 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8= _t code) Slirp *slirp =3D m->slirp; struct mbuf *t; struct ip6 *ip =3D mtod(m, struct ip6 *); + char addrstr[INET6_ADDRSTRLEN]; =20 DEBUG_CALL("icmp6_send_error"); DEBUG_ARGS(" type =3D %d, code =3D %d\n", type, code); @@ -90,11 +91,8 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint= 8_t code) struct ip6 *rip =3D mtod(t, struct ip6 *); rip->ip_src =3D (struct in6_addr)LINKLOCAL_ADDR; rip->ip_dst =3D ip->ip_src; -#if !defined(_WIN32) || (_WIN32_WINNT >=3D 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &rip->ip_dst, addrstr, INET6_ADDRSTRLEN); DEBUG_ARG("target =3D %s", addrstr); -#endif =20 rip->ip_nh =3D IPPROTO_ICMPV6; const int error_data_len =3D MIN(m->m_len, @@ -222,12 +220,12 @@ void ndp_send_ra(Slirp *slirp) */ void ndp_send_ns(Slirp *slirp, struct in6_addr addr) { - DEBUG_CALL("ndp_send_ns"); -#if !defined(_WIN32) || (_WIN32_WINNT >=3D 0x0600) char addrstr[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, &addr, addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_send_ns"); DEBUG_ARG("target =3D %s", addrstr); -#endif =20 /* Build IPv6 packet */ struct mbuf *t =3D m_get(slirp); diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index a4e6421fd3..1401e1b322 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -10,15 +10,14 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, uint8_t ethaddr[ETH_ALEN]) { + char addrstr[INET6_ADDRSTRLEN]; NdpTable *ndp_table =3D &slirp->ndp_table; int i; =20 - DEBUG_CALL("ndp_table_add"); -#if !defined(_WIN32) || (_WIN32_WINNT >=3D 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_table_add"); DEBUG_ARG("ip =3D %s", addrstr); -#endif DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5]); @@ -50,15 +49,14 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_add= r, bool ndp_table_search(Slirp *slirp, struct in6_addr ip_addr, uint8_t out_ethaddr[ETH_ALEN]) { + char addrstr[INET6_ADDRSTRLEN]; NdpTable *ndp_table =3D &slirp->ndp_table; int i; =20 - DEBUG_CALL("ndp_table_search"); -#if !defined(_WIN32) || (_WIN32_WINNT >=3D 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_table_search"); DEBUG_ARG("ip =3D %s", addrstr); -#endif =20 assert(!in6_zero(&ip_addr)); =20 --=20 2.20.1