From nobody Tue Oct 14 13:30:44 2025 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 1547507107635703.0492002594252; Mon, 14 Jan 2019 15:05:07 -0800 (PST) Received: from localhost ([127.0.0.1]:60741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBI2-0005Bd-FE for importer@patchew.org; Mon, 14 Jan 2019 18:05:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6h-0004Bb-Mk for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6g-00019q-EF for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40194) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6g-000146-2N for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:22 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 6DFEF1C0F; Mon, 14 Jan 2019 23:53:14 +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 yNloI48nKmGr; Mon, 14 Jan 2019 23:53:10 +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 AE2DF1BB6; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005df-BY; Mon, 14 Jan 2019 23:53:08 +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:02 +0100 Message-Id: <20190114225306.21569-2-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 01/65] slirp: associate slirp_output callback with the Slirp context 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: =?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 Let's make the slirp interface a bit more library-like. Associate the slirp_output() with a Slirp context. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 5 +++-- slirp/libslirp.h | 9 +++++---- slirp/ncsi.c | 2 +- slirp/slirp.c | 11 +++++++---- slirp/slirp.h | 1 + 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 38ae65e4a9..dd06b0189e 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -99,7 +99,7 @@ static void slirp_smb_cleanup(SlirpState *s); static inline void slirp_smb_cleanup(SlirpState *s) { } #endif =20 -void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len) +static void net_slirp_output(void *opaque, const uint8_t *pkt, int pkt_len) { SlirpState *s =3D opaque; =20 @@ -378,7 +378,8 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, ipv6, ip6_prefix, vprefix6_len, ip6_host, vhostname, tftp_server_name, tftp_export, bootfile, dhcp, - dns, ip6_dns, dnssearch, vdomainname, s); + dns, ip6_dns, dnssearch, vdomainname, + net_slirp_output, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); =20 for (config =3D slirp_configs; config; config =3D config->next) { diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 42e42e9a2a..52dbb9feb5 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -5,6 +5,8 @@ =20 typedef struct Slirp Slirp; =20 +typedef void (*slirp_output)(void *opaque, const uint8_t *pkt, int pkt_len= ); + int get_dns_addr(struct in_addr *pdns_addr); int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); =20 @@ -17,7 +19,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct= in_addr vnetwork, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, - const char *vdomainname, void *opaque); + const char *vdomainname, + slirp_output output, + void *opaque); void slirp_cleanup(Slirp *slirp); =20 void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); @@ -26,9 +30,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error= ); =20 void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); =20 -/* you must provide the following functions: */ -void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len); - int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, int host_port, struct in_addr guest_addr, int guest_port); diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 7116034afc..d7701f7785 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -163,5 +163,5 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) *pchecksum =3D htonl(checksum); ncsi_rsp_len +=3D 4; =20 - slirp_output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); + slirp->output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); } diff --git a/slirp/slirp.c b/slirp/slirp.c index ab2fc4eb8b..4d4c2c13b5 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -287,12 +287,15 @@ Slirp *slirp_init(int restricted, bool in_enabled, st= ruct in_addr vnetwork, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, - const char *vdomainname, void *opaque) + const char *vdomainname, + slirp_output output, + void *opaque) { Slirp *slirp =3D g_malloc0(sizeof(Slirp)); =20 slirp_init_once(); =20 + slirp->output =3D output; slirp->grand =3D g_rand_new(); slirp->restricted =3D restricted; =20 @@ -832,7 +835,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt,= int pkt_len) rah->ar_sip =3D ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip =3D ah->ar_sip; - slirp_output(slirp->opaque, arp_reply, sizeof(arp_reply)); + slirp->output(slirp->opaque, arp_reply, sizeof(arp_reply)); } break; case ARPOP_REPLY: @@ -932,7 +935,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, /* target IP */ rah->ar_tip =3D iph->ip_dst.s_addr; slirp->client_ipaddr =3D iph->ip_dst; - slirp_output(slirp->opaque, arp_req, sizeof(arp_req)); + slirp->output(slirp->opaque, arp_req, sizeof(arp_req)); ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ @@ -1018,7 +1021,7 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); - slirp_output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); + slirp->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; } =20 diff --git a/slirp/slirp.h b/slirp/slirp.h index b80725a0d6..e3d65d68ec 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -220,6 +220,7 @@ struct Slirp { GRand *grand; QEMUTimer *ra_timer; =20 + slirp_output output; void *opaque; }; =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547506549521279.1869498217791; Mon, 14 Jan 2019 14:55:49 -0800 (PST) Received: from localhost ([127.0.0.1]:58337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB8o-0005iq-23 for importer@patchew.org; Mon, 14 Jan 2019 17:55:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6h-0004BZ-GA for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6g-00019v-EZ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6g-00014h-2M for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:22 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CFE8C130C; Mon, 14 Jan 2019 23:53:15 +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 0vlQr4X6jxKQ; Mon, 14 Jan 2019 23:53:14 +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 BD32F1BB7; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dh-CV; Mon, 14 Jan 2019 23:53:08 +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:03 +0100 Message-Id: <20190114225306.21569-3-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 02/65] slirp: remove do_pty from fork_exec() 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: =?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 QEMU uses fork_exec() with do_pty values 0 or 3. Let's clean up some unused code. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 55 ++++++++++++++---------------------------------- slirp/misc.h | 2 +- slirp/tcp_subr.c | 4 +--- 3 files changed, 18 insertions(+), 43 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index 57bdd808e2..e69d5f42c3 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -63,7 +63,7 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *e= xec, #ifdef _WIN32 =20 int -fork_exec(struct socket *so, const char *ex, int do_pty) +fork_exec(struct socket *so, const char *ex) { /* not implemented */ return 0; @@ -77,13 +77,9 @@ fork_exec(struct socket *so, const char *ex, int do_pty) * process, which connects to this socket, after which we * exec the wanted program. If something (strange) happens, * the accept() call could block us forever. - * - * do_pty =3D 0 Fork/exec inetd style - * do_pty =3D 1 Fork/exec using slirp.telnetd - * do_ptr =3D 2 Fork/exec using pty */ int -fork_exec(struct socket *so, const char *ex, int do_pty) +fork_exec(struct socket *so, const char *ex) { int s, cs; struct sockaddr_in addr, csaddr; @@ -100,26 +96,20 @@ fork_exec(struct socket *so, const char *ex, int do_pt= y) DEBUG_CALL("fork_exec"); DEBUG_ARG("so =3D %p", so); DEBUG_ARG("ex =3D %p", ex); - DEBUG_ARG("do_pty =3D %x", do_pty); - - if (do_pty =3D=3D 2) { - return 0; - } else { - addr.sin_family =3D AF_INET; - addr.sin_port =3D 0; - addr.sin_addr.s_addr =3D INADDR_ANY; =20 - if ((s =3D qemu_socket(AF_INET, SOCK_STREAM, 0)) < 0 || - bind(s, (struct sockaddr *)&addr, addrlen) < 0 || - listen(s, 1) < 0) { - error_report("Error: inet socket: %s", strerror(errno)); - if (s >=3D 0) { - closesocket(s); - } + addr.sin_family =3D AF_INET; + addr.sin_port =3D 0; + addr.sin_addr.s_addr =3D INADDR_ANY; =20 - return 0; - } - } + s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || + listen(s, 1) < 0) { + error_report("Error: inet socket: %s", strerror(errno)); + if (s >=3D 0) { + closesocket(s); + } + return 0; + } =20 if (getsockname(s, (struct sockaddr *)&csaddr, &csaddrlen) < 0) { closesocket(s); @@ -166,13 +156,7 @@ fork_exec(struct socket *so, const char *ex, int do_pt= y) =20 i =3D 0; bptr =3D g_strdup(ex); /* No need to free() this */ - if (do_pty =3D=3D 1) { - /* Setup "slirp.telnetd -x" */ - argv[i++] =3D "slirp.telnetd"; - argv[i++] =3D "-x"; - argv[i++] =3D bptr; - } else - do { + do { /* Change the string into argv[] */ curarg =3D bptr; while (*bptr !=3D ' ' && *bptr !=3D (char)0) @@ -180,7 +164,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) c =3D *bptr; *bptr++ =3D (char)0; argv[i++] =3D g_strdup(curarg); - } while (c); + } while (c); =20 argv[i] =3D NULL; execvp(argv[0], (char **)argv); @@ -206,13 +190,6 @@ fork_exec(struct socket *so, const char *ex, int do_pt= y) opt =3D 1; qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, siz= eof(int)); qemu_set_nonblock(so->s); - - /* Append the telnet options now */ - if (so->so_m !=3D NULL && do_pty =3D=3D 1) { - sbappend(so, so->so_m); - so->so_m =3D NULL; - } - return 1; } } diff --git a/slirp/misc.h b/slirp/misc.h index 5211bbd30a..897650aea1 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -53,6 +53,6 @@ struct slirp_quehead { void slirp_insque(void *, void *); void slirp_remque(void *); int add_exec(struct ex_list **, int, char *, struct in_addr, int); -int fork_exec(struct socket *so, const char *ex, int do_pty); +int fork_exec(struct socket *so, const char *ex); =20 #endif diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index fa61349cbb..0ccd8e1a96 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -951,7 +951,6 @@ int tcp_ctl(struct socket *so) Slirp *slirp =3D so->slirp; struct sbuf *sb =3D &so->so_snd; struct ex_list *ex_ptr; - int do_pty; =20 DEBUG_CALL("tcp_ctl"); DEBUG_ARG("so =3D %p", so); @@ -966,9 +965,8 @@ int tcp_ctl(struct socket *so) so->extra =3D (void *)ex_ptr->ex_exec; return 1; } - do_pty =3D ex_ptr->ex_pty; DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); - return fork_exec(so, ex_ptr->ex_exec, do_pty); + return fork_exec(so, ex_ptr->ex_exec); } } } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506909481649.9214155083458; Mon, 14 Jan 2019 15:01:49 -0800 (PST) Received: from localhost ([127.0.0.1]:59985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBEj-0002bq-TU for importer@patchew.org; Mon, 14 Jan 2019 18:01:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Be-Up for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6h-0001CJ-NB for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001A7-9z for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C4ADF1BBB; Mon, 14 Jan 2019 23:53:17 +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 XsBMO9YRGYLd; Mon, 14 Jan 2019 23:53:16 +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 AB1C81BB2; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dj-E6; Mon, 14 Jan 2019 23:53:08 +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:04 +0100 Message-Id: <20190114225306.21569-4-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 03/65] slirp: replace ex_pty with ex_chardev 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: =?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 do_pty =3D=3D 3 means to talk to a chardev. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 2 +- slirp/misc.h | 2 +- slirp/slirp.c | 4 ++-- slirp/tcp_subr.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index e69d5f42c3..8f0b6004bd 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -53,7 +53,7 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char *e= xec, *ex_ptr =3D g_new(struct ex_list, 1); (*ex_ptr)->ex_fport =3D port; (*ex_ptr)->ex_addr =3D addr; - (*ex_ptr)->ex_pty =3D do_pty; + (*ex_ptr)->ex_chardev =3D do_pty =3D=3D 3; (*ex_ptr)->ex_exec =3D (do_pty =3D=3D 3) ? exec : g_strdup(exec); (*ex_ptr)->ex_next =3D tmp_ptr; return 0; diff --git a/slirp/misc.h b/slirp/misc.h index 897650aea1..1f8d11def6 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -9,7 +9,7 @@ #define MISC_H =20 struct ex_list { - int ex_pty; /* Do we want a pty? */ + int ex_chardev; struct in_addr ex_addr; /* Server address */ int ex_fport; /* Port to telnet to */ const char *ex_exec; /* Command line of what to exec */ diff --git a/slirp/slirp.c b/slirp/slirp.c index 4d4c2c13b5..0498a092b9 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1455,7 +1455,7 @@ static void slirp_state_save(QEMUFile *f, void *opaqu= e) struct ex_list *ex_ptr; =20 for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_next) - if (ex_ptr->ex_pty =3D=3D 3) { + if (ex_ptr->ex_chardev) { struct socket *so; so =3D slirp_find_ctl_socket(slirp, ex_ptr->ex_addr, ntohs(ex_ptr->ex_fport)); @@ -1490,7 +1490,7 @@ static int slirp_state_load(QEMUFile *f, void *opaque= , int version_id) return -EINVAL; } for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { - if (ex_ptr->ex_pty =3D=3D 3 && + if (ex_ptr->ex_chardev && so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr && so->so_fport =3D=3D ex_ptr->ex_fport) { break; diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 0ccd8e1a96..dc19eea55a 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -960,7 +960,7 @@ int tcp_ctl(struct socket *so) for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { if (ex_ptr->ex_fport =3D=3D so->so_fport && so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { - if (ex_ptr->ex_pty =3D=3D 3) { + if (ex_ptr->ex_chardev) { so->s =3D -1; so->extra =3D (void *)ex_ptr->ex_exec; return 1; --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506715608368.201821641635; Mon, 14 Jan 2019 14:58:35 -0800 (PST) Received: from localhost ([127.0.0.1]:59139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBBg-0008J5-G6 for importer@patchew.org; Mon, 14 Jan 2019 17:58:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6h-0004Ba-LI for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6g-0001A1-Fu for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37192) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6g-00015B-4u for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:22 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id ED8C11BB9; Mon, 14 Jan 2019 23:53:16 +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 Pi1oNj0Rz46E; Mon, 14 Jan 2019 23:53:15 +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 E18E61BBB; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dl-FY; Mon, 14 Jan 2019 23:53:08 +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:05 +0100 Message-Id: <20190114225306.21569-5-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 04/65] slirp: use a dedicated field for chardev pointer 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: =?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 Let's not mix command line and chardev pointers. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 8 ++++---- slirp/libslirp.h | 2 +- slirp/misc.c | 11 +++++++---- slirp/misc.h | 4 ++-- slirp/slirp.c | 5 +++-- slirp/tcp_subr.c | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index dd06b0189e..58d880de8d 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -709,8 +709,8 @@ static int slirp_smb(SlirpState* s, const char *exporte= d_dir, CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf); g_free(smb_conf); =20 - if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0 || - slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 445) < 0) { + if (slirp_add_exec(s->slirp, NULL, smb_cmdline, &vserver_addr, 139) < = 0 || + slirp_add_exec(s->slirp, NULL, smb_cmdline, &vserver_addr, 445) < = 0) { slirp_smb_cleanup(s); g_free(smb_cmdline); error_setg(errp, "Conflicting/invalid smbserver address"); @@ -774,7 +774,7 @@ static int slirp_guestfwd(SlirpState *s, const char *co= nfig_str, Error **errp) snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port); =20 if ((strlen(p) > 4) && !strncmp(p, "cmd:", 4)) { - if (slirp_add_exec(s->slirp, 0, &p[4], &server, port) < 0) { + if (slirp_add_exec(s->slirp, NULL, &p[4], &server, port) < 0) { error_setg(errp, "Conflicting/invalid host:port in guest " "forwarding rule '%s'", config_str); return -1; @@ -801,7 +801,7 @@ static int slirp_guestfwd(SlirpState *s, const char *co= nfig_str, Error **errp) return -1; } =20 - if (slirp_add_exec(s->slirp, 3, &fwd->hd, &server, port) < 0) { + if (slirp_add_exec(s->slirp, &fwd->hd, NULL, &server, port) < 0) { error_setg(errp, "Conflicting/invalid host:port in guest " "forwarding rule '%s'", config_str); g_free(fwd); diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 52dbb9feb5..3e88dbaa01 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -35,7 +35,7 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr guest_addr, int guest_port); int slirp_remove_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, int host_port); -int slirp_add_exec(Slirp *slirp, int do_pty, const void *args, +int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, struct in_addr *guest_addr, int guest_port); =20 void slirp_connection_info(Slirp *slirp, Monitor *mon); diff --git a/slirp/misc.c b/slirp/misc.c index 8f0b6004bd..2784fc420f 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -37,7 +37,7 @@ remque(void *a) element->qh_rlink =3D NULL; } =20 -int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, +int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline, struct in_addr addr, int port) { struct ex_list *tmp_ptr; @@ -50,11 +50,14 @@ int add_exec(struct ex_list **ex_ptr, int do_pty, char = *exec, } =20 tmp_ptr =3D *ex_ptr; - *ex_ptr =3D g_new(struct ex_list, 1); + *ex_ptr =3D g_new0(struct ex_list, 1); (*ex_ptr)->ex_fport =3D port; (*ex_ptr)->ex_addr =3D addr; - (*ex_ptr)->ex_chardev =3D do_pty =3D=3D 3; - (*ex_ptr)->ex_exec =3D (do_pty =3D=3D 3) ? exec : g_strdup(exec); + if (chardev) { + (*ex_ptr)->ex_chardev =3D chardev; + } else { + (*ex_ptr)->ex_exec =3D g_strdup(cmdline); + } (*ex_ptr)->ex_next =3D tmp_ptr; return 0; } diff --git a/slirp/misc.h b/slirp/misc.h index 1f8d11def6..64ca88c3b7 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -9,7 +9,7 @@ #define MISC_H =20 struct ex_list { - int ex_chardev; + void *ex_chardev; struct in_addr ex_addr; /* Server address */ int ex_fport; /* Port to telnet to */ const char *ex_exec; /* Command line of what to exec */ @@ -52,7 +52,7 @@ struct slirp_quehead { =20 void slirp_insque(void *, void *); void slirp_remque(void *); -int add_exec(struct ex_list **, int, char *, struct in_addr, int); +int add_exec(struct ex_list **, void *, const char *, struct in_addr, int); int fork_exec(struct socket *so, const char *ex); =20 #endif diff --git a/slirp/slirp.c b/slirp/slirp.c index 0498a092b9..0de46084c0 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1068,7 +1068,7 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struc= t in_addr host_addr, return 0; } =20 -int slirp_add_exec(Slirp *slirp, int do_pty, const void *args, +int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, struct in_addr *guest_addr, int guest_port) { if (!guest_addr->s_addr) { @@ -1081,7 +1081,8 @@ int slirp_add_exec(Slirp *slirp, int do_pty, const vo= id *args, guest_addr->s_addr =3D=3D slirp->vnameserver_addr.s_addr) { return -1; } - return add_exec(&slirp->exec_list, do_pty, (char *)args, *guest_addr, + + return add_exec(&slirp->exec_list, chardev, cmdline, *guest_addr, htons(guest_port)); } =20 diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index dc19eea55a..e7b2baa087 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -962,7 +962,7 @@ int tcp_ctl(struct socket *so) so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { so->s =3D -1; - so->extra =3D (void *)ex_ptr->ex_exec; + so->extra =3D ex_ptr->ex_chardev; return 1; } DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506573348971.9096192192039; Mon, 14 Jan 2019 14:56:13 -0800 (PST) Received: from localhost ([127.0.0.1]:58527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB9Q-0006OJ-Aq for importer@patchew.org; Mon, 14 Jan 2019 17:56:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6h-0004BY-7R for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6g-00019f-CD for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6g-000156-2S for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:22 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B22B81BB7; Mon, 14 Jan 2019 23:53:16 +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 MorBXIUT8MGc; Mon, 14 Jan 2019 23:53:14 +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 CC9351BB9; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dn-H5; Mon, 14 Jan 2019 23:53:08 +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:06 +0100 Message-Id: <20190114225306.21569-6-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 05/65] slirp: remove unused EMU_RSH 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: =?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 EMU_RSH handling was dropped in commit 0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a. The assignment, and subsequent free() of ex_ptr->ex_exec to so->extra looks unsafe (double free is likely to occur). Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.h | 1 - slirp/slirp.c | 2 -- slirp/socket.c | 4 ---- slirp/tcp_subr.c | 1 - 4 files changed, 8 deletions(-) diff --git a/slirp/misc.h b/slirp/misc.h index 64ca88c3b7..94829722cd 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -26,7 +26,6 @@ struct ex_list { #define EMU_REALAUDIO 0x5 #define EMU_RLOGIN 0x6 #define EMU_IDENT 0x7 -#define EMU_RSH 0x8 =20 #define EMU_NOCONNECT 0x10 /* Don't connect */ =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index 0de46084c0..fac7849195 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1499,8 +1499,6 @@ static int slirp_state_load(QEMUFile *f, void *opaque= , int version_id) } if (!ex_ptr) return -EINVAL; - - so->extra =3D (void *)ex_ptr->ex_exec; } =20 return vmstate_load_state(f, &vmstate_slirp, slirp, version_id); diff --git a/slirp/socket.c b/slirp/socket.c index c01d8696af..041ec5061a 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -89,10 +89,6 @@ sofree(struct socket *so) soqfree(so, &slirp->if_fastq); soqfree(so, &slirp->if_batchq); =20 - if (so->so_emu=3D=3DEMU_RSH && so->extra) { - sofree(so->extra); - so->extra=3DNULL; - } if (so =3D=3D slirp->tcp_last_so) { slirp->tcp_last_so =3D &slirp->tcb; } else if (so =3D=3D slirp->udp_last_so) { diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index e7b2baa087..fd7521854e 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -541,7 +541,6 @@ static const struct tos_t tcptos[] =3D { {0, 23, IPTOS_LOWDELAY, 0}, /* telnet */ {0, 80, IPTOS_THROUGHPUT, 0}, /* WWW */ {0, 513, IPTOS_LOWDELAY, EMU_RLOGIN|EMU_NOCONNECT}, /* rlogin */ - {0, 514, IPTOS_LOWDELAY, EMU_RSH|EMU_NOCONNECT}, /* shell */ {0, 544, IPTOS_LOWDELAY, EMU_KSH}, /* kshell */ {0, 543, IPTOS_LOWDELAY, 0}, /* klogin */ {0, 6667, IPTOS_THROUGHPUT, EMU_IRC}, /* IRC */ --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547506553178642.9597117163114; Mon, 14 Jan 2019 14:55:53 -0800 (PST) Received: from localhost ([127.0.0.1]:58369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB8t-0005nZ-5u for importer@patchew.org; Mon, 14 Jan 2019 17:55:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bj-Us for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001DI-5N for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AB-Oq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C75711BBF; Mon, 14 Jan 2019 23:53:18 +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 Yh2BsQ2vpNaX; Mon, 14 Jan 2019 23:53:17 +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 30B621BBC; Mon, 14 Jan 2019 23:53:09 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dp-Ih; Mon, 14 Jan 2019 23:53:08 +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:07 +0100 Message-Id: <20190114225306.21569-7-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 06/65] slirp: rename /extra/chardev 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: =?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 Now it's only used for the chardev pointer. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/slirp.c | 4 ++-- slirp/socket.h | 2 +- slirp/tcp_subr.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index fac7849195..ab08694e37 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1088,10 +1088,10 @@ int slirp_add_exec(Slirp *slirp, void *chardev, con= st char *cmdline, =20 ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int fla= gs) { - if (so->s =3D=3D -1 && so->extra) { + if (so->s =3D=3D -1 && so->chardev) { /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ - qemu_chr_fe_write_all(so->extra, buf, len); + qemu_chr_fe_write_all(so->chardev, buf, len); return len; } =20 diff --git a/slirp/socket.h b/slirp/socket.h index 2f224bc34f..930ed95972 100644 --- a/slirp/socket.h +++ b/slirp/socket.h @@ -67,7 +67,7 @@ struct socket { =20 struct sbuf so_rcv; /* Receive buffer */ struct sbuf so_snd; /* Send buffer */ - void * extra; /* Extra pointer */ + void * chardev; }; =20 =20 diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index fd7521854e..4b40850c7a 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -961,7 +961,7 @@ int tcp_ctl(struct socket *so) so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { so->s =3D -1; - so->extra =3D ex_ptr->ex_chardev; + so->chardev =3D ex_ptr->ex_chardev; return 1; } DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507105471345.3319696748466; Mon, 14 Jan 2019 15:05:05 -0800 (PST) Received: from localhost ([127.0.0.1]:60745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBI0-0005CJ-Eu for importer@patchew.org; Mon, 14 Jan 2019 18:05:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6l-0004Bo-3Y for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001DN-5F for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AV-QL for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:24 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D11B31BBD; Mon, 14 Jan 2019 23:53:21 +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 fFRLMvsFVrF5; Mon, 14 Jan 2019 23:53:21 +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 5A6791BBE; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dr-KU; Mon, 14 Jan 2019 23:53:08 +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:08 +0100 Message-Id: <20190114225306.21569-8-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 07/65] slirp: move internal function declarations 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: =?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 Clarify that those functions are internal to slirp. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/libslirp.h | 3 --- slirp/slirp.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 3e88dbaa01..a4f390ee89 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -7,9 +7,6 @@ typedef struct Slirp Slirp; =20 typedef void (*slirp_output)(void *opaque, const uint8_t *pkt, int pkt_len= ); =20 -int get_dns_addr(struct in_addr *pdns_addr); -int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); - Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, bool in6_enabled, diff --git a/slirp/slirp.h b/slirp/slirp.h index e3d65d68ec..de299aa36c 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -232,6 +232,9 @@ extern Slirp *slirp_instance; =20 void if_start(Slirp *); =20 +int get_dns_addr(struct in_addr *pdns_addr); +int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); + /* ncsi.c */ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547506909485272.95804673711245; Mon, 14 Jan 2019 15:01:49 -0800 (PST) Received: from localhost ([127.0.0.1]:59957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBEe-0002WB-Pn for importer@patchew.org; Mon, 14 Jan 2019 18:01:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6l-0004CF-B6 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001DW-9S for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AA-Rr for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:24 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A14431BBC; Mon, 14 Jan 2019 23:53:19 +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 8qVZQHFIrqkT; Mon, 14 Jan 2019 23:53:18 +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 5F3251BC0; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dt-NB; Mon, 14 Jan 2019 23:53:08 +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:09 +0100 Message-Id: <20190114225306.21569-9-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 08/65] slirp: remove Monitor dependency, return a string for info 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: =?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 There is nothing performance-sensitive in returning an allocated string for info, and handling the monitor_printf() on the caller side. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 7 ++++--- slirp/libslirp.h | 2 +- slirp/misc.c | 23 +++++++++++++---------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 58d880de8d..b7319ca6b2 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -828,10 +828,11 @@ void hmp_info_usernet(Monitor *mon, const QDict *qdic= t) QTAILQ_FOREACH(s, &slirp_stacks, entry) { int id; bool got_hub_id =3D net_hub_id_for_client(&s->nc, &id) =3D=3D 0; - monitor_printf(mon, "Hub %d (%s):\n", + char *info =3D slirp_connection_info(s->slirp); + monitor_printf(mon, "Hub %d (%s):\n%s", got_hub_id ? id : -1, - s->nc.name); - slirp_connection_info(s->slirp, mon); + s->nc.name, info); + g_free(info); } } =20 diff --git a/slirp/libslirp.h b/slirp/libslirp.h index a4f390ee89..04b6db9f49 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -35,7 +35,7 @@ int slirp_remove_hostfwd(Slirp *slirp, int is_udp, int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, struct in_addr *guest_addr, int guest_port); =20 -void slirp_connection_info(Slirp *slirp, Monitor *mon); +char *slirp_connection_info(Slirp *slirp); =20 void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, int guest_port, const uint8_t *buf, int size); diff --git a/slirp/misc.c b/slirp/misc.c index 2784fc420f..ce323ef92e 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -8,7 +8,6 @@ #include "qemu/osdep.h" #include "slirp.h" #include "libslirp.h" -#include "monitor/monitor.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" =20 @@ -198,8 +197,9 @@ fork_exec(struct socket *so, const char *ex) } #endif =20 -void slirp_connection_info(Slirp *slirp, Monitor *mon) +char *slirp_connection_info(Slirp *slirp) { + GString *str =3D g_string_new(NULL); const char * const tcpstates[] =3D { [TCPS_CLOSED] =3D "CLOSED", [TCPS_LISTEN] =3D "LISTEN", @@ -221,8 +221,9 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) const char *state; char buf[20]; =20 - monitor_printf(mon, " Protocol[State] FD Source Address Port " - "Dest. Address Port RecvQ SendQ\n"); + g_string_append_printf(str, + " Protocol[State] FD Source Address Port " + "Dest. Address Port RecvQ SendQ\n"); =20 for (so =3D slirp->tcb.so_next; so !=3D &slirp->tcb; so =3D so->so_nex= t) { if (so->so_state & SS_HOSTFWD) { @@ -244,10 +245,10 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) dst_port =3D so->so_fport; } snprintf(buf, sizeof(buf), " TCP[%s]", state); - monitor_printf(mon, "%-19s %3d %15s %5d ", buf, so->s, + g_string_append_printf(str, "%-19s %3d %15s %5d ", buf, so->s, src.sin_addr.s_addr ? inet_ntoa(src.sin_addr) : "*", ntohs(src.sin_port)); - monitor_printf(mon, "%15s %5d %5d %5d\n", + g_string_append_printf(str, "%15s %5d %5d %5d\n", inet_ntoa(dst_addr), ntohs(dst_port), so->so_rcv.sb_cc, so->so_snd.sb_cc); } @@ -267,10 +268,10 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) dst_addr =3D so->so_faddr; dst_port =3D so->so_fport; } - monitor_printf(mon, "%-19s %3d %15s %5d ", buf, so->s, + g_string_append_printf(str, "%-19s %3d %15s %5d ", buf, so->s, src.sin_addr.s_addr ? inet_ntoa(src.sin_addr) : "*", ntohs(src.sin_port)); - monitor_printf(mon, "%15s %5d %5d %5d\n", + g_string_append_printf(str, "%15s %5d %5d %5d\n", inet_ntoa(dst_addr), ntohs(dst_port), so->so_rcv.sb_cc, so->so_snd.sb_cc); } @@ -280,9 +281,11 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) (so->so_expire - curtime) / 1000); src.sin_addr =3D so->so_laddr; dst_addr =3D so->so_faddr; - monitor_printf(mon, "%-19s %3d %15s - ", buf, so->s, + g_string_append_printf(str, "%-19s %3d %15s - ", buf, so->s, src.sin_addr.s_addr ? inet_ntoa(src.sin_addr) : "*"= ); - monitor_printf(mon, "%15s - %5d %5d\n", inet_ntoa(dst_addr), + g_string_append_printf(str, "%15s - %5d %5d\n", inet_ntoa(dst_= addr), so->so_rcv.sb_cc, so->so_snd.sb_cc); } + + return g_string_free(str, FALSE); } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506550904179.40070120871553; Mon, 14 Jan 2019 14:55:50 -0800 (PST) Received: from localhost ([127.0.0.1]:58348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB8q-0005l0-5n for importer@patchew.org; Mon, 14 Jan 2019 17:55:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bg-Uq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001D7-2y for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37270) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001Ag-Mq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5B8171BBE; Mon, 14 Jan 2019 23:53:22 +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 kwWZW5EJEr51; Mon, 14 Jan 2019 23:53:21 +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 BF2431BC5; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dv-Pl; Mon, 14 Jan 2019 23:53:08 +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:10 +0100 Message-Id: <20190114225306.21569-10-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 09/65] slirp: fix slirp_add_exec() leaks 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: =?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 Free the list elements allocated in add_exec(). Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.h | 2 +- slirp/slirp.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/slirp/misc.h b/slirp/misc.h index 94829722cd..0bc5e74bc5 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -12,7 +12,7 @@ struct ex_list { void *ex_chardev; struct in_addr ex_addr; /* Server address */ int ex_fport; /* Port to telnet to */ - const char *ex_exec; /* Command line of what to exec */ + char *ex_exec; /* Command line of what to exec */ struct ex_list *ex_next; }; =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index ab08694e37..1627436e7d 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -342,6 +342,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, str= uct in_addr vnetwork, =20 void slirp_cleanup(Slirp *slirp) { + struct ex_list *e, *next; + + for (e =3D slirp->exec_list; e; e =3D next) { + next =3D e->ex_next; + g_free(e->ex_exec); + g_free(e); + } + QTAILQ_REMOVE(&slirp_instances, slirp, entry); =20 unregister_savevm(NULL, "slirp", slirp); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507485694470.3581270969971; Mon, 14 Jan 2019 15:11:25 -0800 (PST) Received: from localhost ([127.0.0.1]:34098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBO6-00025h-Lz for importer@patchew.org; Mon, 14 Jan 2019 18:11:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bd-Uo for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6h-0001Cc-Qd for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:24 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37260) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AJ-HG for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CDB991BC0; Mon, 14 Jan 2019 23:53:19 +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 ik_aaZleJuHe; Mon, 14 Jan 2019 23:53:18 +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 6EF171BC2; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005dx-RV; Mon, 14 Jan 2019 23:53:08 +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:11 +0100 Message-Id: <20190114225306.21569-11-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 10/65] slirp: replace the poor-man string split with g_strsplit() 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: =?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 Use the glib function for the work, fix a potential crash on >256 words. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index ce323ef92e..4840187750 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -88,11 +88,8 @@ fork_exec(struct socket *so, const char *ex) socklen_t addrlen =3D sizeof(addr); socklen_t csaddrlen =3D sizeof(csaddr); int opt; - const char *argv[256]; - /* don't want to clobber the original */ - char *bptr; - const char *curarg; - int c, i, ret; + char **argv; + int ret; pid_t pid; =20 DEBUG_CALL("fork_exec"); @@ -156,19 +153,7 @@ fork_exec(struct socket *so, const char *ex) for (s =3D getdtablesize() - 1; s >=3D 3; s--) close(s); =20 - i =3D 0; - bptr =3D g_strdup(ex); /* No need to free() this */ - do { - /* Change the string into argv[] */ - curarg =3D bptr; - while (*bptr !=3D ' ' && *bptr !=3D (char)0) - bptr++; - c =3D *bptr; - *bptr++ =3D (char)0; - argv[i++] =3D g_strdup(curarg); - } while (c); - - argv[i] =3D NULL; + argv =3D g_strsplit(ex, " ", -1); execvp(argv[0], (char **)argv); =20 /* Ooops, failed, let's tell the user why */ --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506751505444.0324060502579; Mon, 14 Jan 2019 14:59:11 -0800 (PST) Received: from localhost ([127.0.0.1]:59302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBCI-0000MX-EA for importer@patchew.org; Mon, 14 Jan 2019 17:59:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bf-V0 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001DD-4A for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40284) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001A9-NL for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5AC1F1BB2; Mon, 14 Jan 2019 23:53:18 +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 oiWUj_2saFp3; Mon, 14 Jan 2019 23:53:17 +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 5CA111BBF; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005e1-T4; Mon, 14 Jan 2019 23:53:08 +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:12 +0100 Message-Id: <20190114225306.21569-12-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 11/65] slirp: remove dead declarations 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: =?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 An overdue cleanup. Remaining declarations could probably be moved in other headers, such as slirp.h. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/main.h | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/slirp/main.h b/slirp/main.h index 90053ce5ec..e04677944f 100644 --- a/slirp/main.h +++ b/slirp/main.h @@ -12,38 +12,9 @@ #include #endif =20 -#define TOWRITEMAX 512 - -extern int slirp_socket; -extern int slirp_socket_unit; -extern int slirp_socket_port; -extern uint32_t slirp_socket_addr; -extern char *slirp_socket_passwd; -extern int ctty_closed; - -/* - * Get the difference in 2 times from updtim() - * Allow for wraparound times, "just in case" - * x is the greater of the 2 (current time) and y is - * what it's being compared against. - */ -#define TIME_DIFF(x,y) (x)-(y) < 0 ? ~0-(y)+(x) : (x)-(y) - -extern char *slirp_tty; -extern char *exec_shell; extern u_int curtime; extern struct in_addr loopback_addr; extern unsigned long loopback_mask; -extern char *username; -extern char *socket_path; -extern int towrite_max; -extern int ppp_exit; -extern int tcp_keepintvl; - -#define PROTO_SLIP 0x1 -#ifdef USE_PPP -#define PROTO_PPP 0x2 -#endif =20 int if_encap(Slirp *slirp, struct mbuf *ifm); ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int fla= gs); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507309206878.3089704322485; Mon, 14 Jan 2019 15:08:29 -0800 (PST) Received: from localhost ([127.0.0.1]:33317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBLB-0007pa-DE for importer@patchew.org; Mon, 14 Jan 2019 18:08:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bh-V0 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6i-0001D2-44 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40302) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AO-Nq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 6EBE41BC3; Mon, 14 Jan 2019 23:53:21 +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 L1DH713HcvfL; Mon, 14 Jan 2019 23:53:19 +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 8D20F1BBD; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6S-0005e6-Uu; Mon, 14 Jan 2019 23:53:08 +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:13 +0100 Message-Id: <20190114225306.21569-13-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 12/65] slirp: add tftp tracing 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: jan.kiszka@siemens.com, Gerd Hoffmann , stefanha@redhat.com, Samuel Thibault , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Useful when debugging pxeboot, to see what the guest tries to do. Signed-off-by: Gerd Hoffmann Reviewed-by: Liam Merwick Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Samuel Thibault --- Makefile.objs | 1 + slirp/tftp.c | 3 +++ slirp/trace-events | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 slirp/trace-events diff --git a/Makefile.objs b/Makefile.objs index 456115992a..2121120492 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -193,6 +193,7 @@ trace-events-subdirs +=3D net trace-events-subdirs +=3D qapi trace-events-subdirs +=3D qom trace-events-subdirs +=3D scsi +trace-events-subdirs +=3D slirp trace-events-subdirs +=3D target/arm trace-events-subdirs +=3D target/i386 trace-events-subdirs +=3D target/mips diff --git a/slirp/tftp.c b/slirp/tftp.c index a9bc4bb1b6..735b57aa55 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -26,6 +26,7 @@ #include "slirp.h" #include "qemu-common.h" #include "qemu/cutils.h" +#include "trace.h" =20 static inline int tftp_session_in_use(struct tftp_session *spt) { @@ -204,6 +205,7 @@ static void tftp_send_error(struct tftp_session *spt, struct mbuf *m; struct tftp_t *tp; =20 + trace_slirp_tftp_error(msg); m =3D m_get(spt->slirp); =20 if (!m) { @@ -323,6 +325,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, break; } } + trace_slirp_tftp_rrq(req_fname); =20 /* check mode */ if ((pktlen - k) < 6) { diff --git a/slirp/trace-events b/slirp/trace-events new file mode 100644 index 0000000000..ff8f656e8c --- /dev/null +++ b/slirp/trace-events @@ -0,0 +1,5 @@ +# See docs/devel/tracing.txt for syntax documentation. + +# slirp/tftp.c +slirp_tftp_rrq(const char *file) "file: %s" +slirp_tftp_error(const char *file) "msg: %s" --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507846477756.9213668832951; Mon, 14 Jan 2019 15:17:26 -0800 (PST) Received: from localhost ([127.0.0.1]:35569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBTx-00071x-9c for importer@patchew.org; Mon, 14 Jan 2019 18:17:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bi-Us for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6h-0001Cl-Up for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40300) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6h-0001AM-HM for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E74B61BC1; Mon, 14 Jan 2019 23:53:20 +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 WgJrttHf7kFH; Mon, 14 Jan 2019 23:53:19 +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 719AF1BC3; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005e8-0J; Mon, 14 Jan 2019 23:53:09 +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:14 +0100 Message-Id: <20190114225306.21569-14-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 13/65] slirp: move socket pair creation in helper function 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: =?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 Originally, the patch was fixing a bunch of issues, but Peter beat me to it with earlier commit "slirp: fork_exec(): create and connect child socket before fork()". Factor out socket pair creation, to simplify the fork_exec() code. Use the name socketpair_with_oob() since the code is actually similar to what socketpair() would do, except that it uses TCP sockets, for SLIRP to be able to call send with MSG_OOB (since SO_OOBINLINE is set, this could probably be faked instead on regular unix sockets though). Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 142 +++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index 4840187750..7362e14339 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -73,85 +73,92 @@ fork_exec(struct socket *so, const char *ex) =20 #else =20 -/* - * XXX This is ugly - * We create and bind a socket, then fork off to another - * process, which connects to this socket, after which we - * exec the wanted program. If something (strange) happens, - * the accept() call could block us forever. - */ +static int +slirp_socketpair_with_oob(int sv[2]) +{ + struct sockaddr_in addr =3D { + .sin_family =3D AF_INET, + .sin_port =3D 0, + .sin_addr.s_addr =3D INADDR_ANY, + }; + socklen_t addrlen =3D sizeof(addr); + int ret, s; + + sv[1] =3D -1; + s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || + listen(s, 1) < 0 || + getsockname(s, (struct sockaddr *)&addr, &addrlen) < 0) { + goto err; + } + + sv[1] =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + if (sv[1] < 0) { + goto err; + } + /* + * This connect won't block because we've already listen()ed on + * the server end (even though we won't accept() the connection + * until later on). + */ + do { + ret =3D connect(sv[1], (struct sockaddr *)&addr, addrlen); + } while (ret < 0 && errno =3D=3D EINTR); + if (ret < 0) { + goto err; + } + + do { + sv[0] =3D accept(s, (struct sockaddr *)&addr, &addrlen); + } while (sv[0] < 0 && errno =3D=3D EINTR); + if (sv[0] < 0) { + goto err; + } + + closesocket(s); + return 0; + +err: + error_report("Error: slirp_socketpair(): %s", strerror(errno)); + if (s >=3D 0) { + closesocket(s); + } + if (sv[1] >=3D 0) { + closesocket(sv[1]); + } + return -1; +} + int fork_exec(struct socket *so, const char *ex) { - int s, cs; - struct sockaddr_in addr, csaddr; - socklen_t addrlen =3D sizeof(addr); - socklen_t csaddrlen =3D sizeof(csaddr); - int opt; char **argv; - int ret; + int opt, c, sp[2]; pid_t pid; =20 DEBUG_CALL("fork_exec"); DEBUG_ARG("so =3D %p", so); DEBUG_ARG("ex =3D %p", ex); =20 - addr.sin_family =3D AF_INET; - addr.sin_port =3D 0; - addr.sin_addr.s_addr =3D INADDR_ANY; - - s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); - if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || - listen(s, 1) < 0) { - error_report("Error: inet socket: %s", strerror(errno)); - if (s >=3D 0) { - closesocket(s); - } + if (slirp_socketpair_with_oob(sp) < 0) { return 0; } =20 - if (getsockname(s, (struct sockaddr *)&csaddr, &csaddrlen) < 0) { - closesocket(s); - return 0; - } - cs =3D qemu_socket(AF_INET, SOCK_STREAM, 0); - if (cs < 0) { - closesocket(s); - return 0; - } - csaddr.sin_addr =3D loopback_addr; - /* - * This connect won't block because we've already listen()ed on - * the server end (even though we won't accept() the connection - * until later on). - */ - do { - ret =3D connect(cs, (struct sockaddr *)&csaddr, csaddrlen); - } while (ret < 0 && errno =3D=3D EINTR); - if (ret < 0) { - closesocket(s); - closesocket(cs); - return 0; - } - pid =3D fork(); switch(pid) { case -1: error_report("Error: fork failed: %s", strerror(errno)); - closesocket(cs); - close(s); + closesocket(sp[0]); + closesocket(sp[1]); return 0; =20 case 0: - setsid(); - - /* Set the DISPLAY */ - close(s); - dup2(cs, 0); - dup2(cs, 1); - dup2(cs, 2); - for (s =3D getdtablesize() - 1; s >=3D 3; s--) - close(s); + setsid(); + dup2(sp[1], 0); + dup2(sp[1], 1); + dup2(sp[1], 2); + for (c =3D getdtablesize() - 1; c >=3D 3; c--) + close(c); =20 argv =3D g_strsplit(ex, " ", -1); execvp(argv[0], (char **)argv); @@ -163,19 +170,12 @@ fork_exec(struct socket *so, const char *ex) exit(1); =20 default: + so->s =3D sp[0]; + closesocket(sp[1]); qemu_add_child_watch(pid); - closesocket(cs); - /* - * This should never block, because we already connect()ed - * on the child end before we forked. - */ - do { - so->s =3D accept(s, (struct sockaddr *)&addr, &addrlen= ); - } while (so->s < 0 && errno =3D=3D EINTR); - closesocket(s); - socket_set_fast_reuse(so->s); - opt =3D 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, siz= eof(int)); + socket_set_fast_reuse(so->s); + opt =3D 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); qemu_set_nonblock(so->s); return 1; } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506712212711.4178651919491; Mon, 14 Jan 2019 14:58:32 -0800 (PST) Received: from localhost ([127.0.0.1]:59133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBBf-0008IE-1t for importer@patchew.org; Mon, 14 Jan 2019 17:58:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6k-0004Bk-Uz for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6k-0001If-0n for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:26 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6j-0001Ea-Pv for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:25 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B2BD81BB7; Mon, 14 Jan 2019 23:53:24 +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 4cm2Dpxa8pSo; Mon, 14 Jan 2019 23:53:22 +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 DA1DA1BC8; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eB-1z; Mon, 14 Jan 2019 23:53:09 +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:15 +0100 Message-Id: <20190114225306.21569-15-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 14/65] slirp: remove unused M_TRAILINGSPACE 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/mbuf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/slirp/mbuf.h b/slirp/mbuf.h index bfdf8c4577..cbf17e136b 100644 --- a/slirp/mbuf.h +++ b/slirp/mbuf.h @@ -72,7 +72,6 @@ * How much free room there is */ #define M_FREEROOM(m) (M_ROOM(m) - (m)->m_len) -#define M_TRAILINGSPACE M_FREEROOM =20 struct mbuf { /* XXX should union some of these! */ --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506943387212.9595832250825; Mon, 14 Jan 2019 15:02:23 -0800 (PST) Received: from localhost ([127.0.0.1]:60145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBFO-00038H-6N for importer@patchew.org; Mon, 14 Jan 2019 18:02:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6l-0004CP-K2 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6j-0001El-2B for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40312) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6i-0001CY-Mb for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:24 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 89C0B130C; Mon, 14 Jan 2019 23:53:23 +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 2BVQlIU5OW8h; Mon, 14 Jan 2019 23:53:21 +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 D41811BC6; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eE-38; Mon, 14 Jan 2019 23:53:09 +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:16 +0100 Message-Id: <20190114225306.21569-16-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 15/65] slirp: use a callback structure to interface with qemu 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 This will bring slirp a bit forward to the state of an independent project. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Samuel Thibault --- net/slirp.c | 6 +++++- slirp/libslirp.h | 13 +++++++++++-- slirp/ncsi.c | 2 +- slirp/slirp.c | 10 +++++----- slirp/slirp.h | 2 +- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index b7319ca6b2..031c324f02 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -140,6 +140,10 @@ static NetClientInfo net_slirp_info =3D { .cleanup =3D net_slirp_cleanup, }; =20 +static const SlirpCb slirp_cb =3D { + .output =3D net_slirp_output, +}; + static int net_slirp_init(NetClientState *peer, const char *model, const char *name, int restricted, bool ipv4, const char *vnetwork, const char *vho= st, @@ -379,7 +383,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, vhostname, tftp_server_name, tftp_export, bootfile, dhcp, dns, ip6_dns, dnssearch, vdomainname, - net_slirp_output, s); + &slirp_cb, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); =20 for (config =3D slirp_configs; config; config =3D config->next) { diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 04b6db9f49..a5d1b27b5e 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -5,7 +5,16 @@ =20 typedef struct Slirp Slirp; =20 -typedef void (*slirp_output)(void *opaque, const uint8_t *pkt, int pkt_len= ); +/* + * Callbacks from slirp + * + * The opaque parameter comes from the opaque parameter given to slirp_ini= t(). + */ +typedef struct SlirpCb { + /* Send an ethernet frame to the guest network. */ + void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); +} SlirpCb; + =20 Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, @@ -17,7 +26,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct= in_addr vnetwork, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, const char *vdomainname, - slirp_output output, + const SlirpCb *callbacks, void *opaque); void slirp_cleanup(Slirp *slirp); =20 diff --git a/slirp/ncsi.c b/slirp/ncsi.c index d7701f7785..10decfb5ef 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -163,5 +163,5 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) *pchecksum =3D htonl(checksum); ncsi_rsp_len +=3D 4; =20 - slirp->output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); + slirp->cb->output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); } diff --git a/slirp/slirp.c b/slirp/slirp.c index 1627436e7d..bab49e83e3 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -288,14 +288,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, st= ruct in_addr vnetwork, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, const char *vdomainname, - slirp_output output, + const SlirpCb *callbacks, void *opaque) { Slirp *slirp =3D g_malloc0(sizeof(Slirp)); =20 slirp_init_once(); =20 - slirp->output =3D output; + slirp->cb =3D callbacks; slirp->grand =3D g_rand_new(); slirp->restricted =3D restricted; =20 @@ -843,7 +843,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt,= int pkt_len) rah->ar_sip =3D ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip =3D ah->ar_sip; - slirp->output(slirp->opaque, arp_reply, sizeof(arp_reply)); + slirp->cb->output(slirp->opaque, arp_reply, sizeof(arp_reply)); } break; case ARPOP_REPLY: @@ -943,7 +943,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, /* target IP */ rah->ar_tip =3D iph->ip_dst.s_addr; slirp->client_ipaddr =3D iph->ip_dst; - slirp->output(slirp->opaque, arp_req, sizeof(arp_req)); + slirp->cb->output(slirp->opaque, arp_req, sizeof(arp_req)); ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ @@ -1029,7 +1029,7 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); - slirp->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); + slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; } =20 diff --git a/slirp/slirp.h b/slirp/slirp.h index de299aa36c..f7c087456a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -220,7 +220,7 @@ struct Slirp { GRand *grand; QEMUTimer *ra_timer; =20 - slirp_output output; + const SlirpCb *cb; void *opaque; }; =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507105185180.6221331795258; Mon, 14 Jan 2019 15:05:05 -0800 (PST) Received: from localhost ([127.0.0.1]:60724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBHx-00057r-Qm for importer@patchew.org; Mon, 14 Jan 2019 18:05:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6n-0004Dq-4Y for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6m-0001MU-1a for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6l-0001Jf-Ll for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9760F130C; Mon, 14 Jan 2019 23:53:26 +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 ZqkoefEnuzTu; Mon, 14 Jan 2019 23:53:25 +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 4C55F1BD5; Mon, 14 Jan 2019 23:53:10 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eH-4E; Mon, 14 Jan 2019 23:53:09 +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:17 +0100 Message-Id: <20190114225306.21569-17-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 16/65] slirp: remove PROBE_CONN dead-code 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: jan.kiszka@siemens.com, stefanha@redhat.com, Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Nobody cares for over 14y. Somebody can revert or rewrite if interested by that. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.c | 41 ----------------------------------------- slirp/slirp_config.h | 4 ---- 2 files changed, 45 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index bab49e83e3..76e94eb1cd 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -699,47 +699,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_er= ror) } } } - - /* - * Probe a still-connecting, non-blocking socket - * to check if it's still alive - */ -#ifdef PROBE_CONN - if (so->so_state & SS_ISFCONNECTING) { - ret =3D qemu_recv(so->s, &ret, 0, 0); - - if (ret < 0) { - /* XXX */ - if (errno =3D=3D EAGAIN || errno =3D=3D EWOULDBLOC= K || - errno =3D=3D EINPROGRESS || errno =3D=3D ENOTC= ONN) { - continue; /* Still connecting, continue */ - } - - /* else failed */ - so->so_state &=3D SS_PERSISTENT_MASK; - so->so_state |=3D SS_NOFDREF; - - /* tcp_input will take care of it */ - } else { - ret =3D send(so->s, &ret, 0, 0); - if (ret < 0) { - /* XXX */ - if (errno =3D=3D EAGAIN || errno =3D=3D EWOULD= BLOCK || - errno =3D=3D EINPROGRESS || errno =3D=3D E= NOTCONN) { - continue; - } - /* else failed */ - so->so_state &=3D SS_PERSISTENT_MASK; - so->so_state |=3D SS_NOFDREF; - } else { - so->so_state &=3D ~SS_ISFCONNECTING; - } - - } - tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, - so->so_ffamily); - } /* SS_ISFCONNECTING */ -#endif } =20 /* diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index c59f655207..721667e3ef 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -2,10 +2,6 @@ * User definable configuration options */ =20 -/* Define if you want the connection to be probed */ -/* XXX Not working yet, so ignore this for now */ -#undef PROBE_CONN - /* Define to 1 if you want KEEPALIVE timers */ #define DO_KEEPALIVE 0 =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507520012471.9971854631067; Mon, 14 Jan 2019 15:12:00 -0800 (PST) Received: from localhost ([127.0.0.1]:34247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBOg-0002XS-T5 for importer@patchew.org; Mon, 14 Jan 2019 18:11:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6u-0004OK-6i for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6t-0001Re-Hr for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:36 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40320) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6t-0001Df-Aj for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:35 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2D5AA1BB2; Mon, 14 Jan 2019 23:53:24 +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 NjzZ3TcO0fmu; Mon, 14 Jan 2019 23:53:23 +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 01D911BC9; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eK-5k; Mon, 14 Jan 2019 23:53:09 +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:18 +0100 Message-Id: <20190114225306.21569-18-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 17/65] slirp: remove FULL_BOLT 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: =?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 Looking at git history, this looks like something from the past, when there was a tty layer. Let's remove it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/if.c | 2 -- slirp/slirp_config.h | 7 ------- 2 files changed, 9 deletions(-) diff --git a/slirp/if.c b/slirp/if.c index 590753c658..aa88cc4e76 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -131,12 +131,10 @@ diddit: } } =20 -#ifndef FULL_BOLT /* * This prevents us from malloc()ing too many mbufs */ if_start(ifm->slirp); -#endif } =20 /* diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 721667e3ef..f0cc1c781b 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -5,13 +5,6 @@ /* Define to 1 if you want KEEPALIVE timers */ #define DO_KEEPALIVE 0 =20 -/* Define this if you want slirp to write to the tty as fast as it can */ -/* This should only be set if you are using load-balancing, slirp does a */ -/* pretty good job on single modems already, and seting this will make */ -/* interactive sessions less responsive */ -/* XXXXX Talk about having fast modem as unit 0 */ -#undef FULL_BOLT - /*********************************************************/ /* * Autoconf defined configuration options --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507147921197.12099568883377; Mon, 14 Jan 2019 15:05:47 -0800 (PST) Received: from localhost ([127.0.0.1]:60910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBIg-0005nU-Sk for importer@patchew.org; Mon, 14 Jan 2019 18:05:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6o-0004Ez-4C for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6n-0001O3-A9 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:30 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37336) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6m-0001MY-Ue for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C2AEC1BB6; Mon, 14 Jan 2019 23:53:27 +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 9UL9Hsx28Hzz; Mon, 14 Jan 2019 23:53:26 +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 0591A1BCC; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eM-72; Mon, 14 Jan 2019 23:53:09 +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:19 +0100 Message-Id: <20190114225306.21569-19-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 18/65] slirp: remove the disabled readv()/writev() code path 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: =?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 The soread() function may be used on datagram sockets, and would provide different behaviour if HAVE_READV was set, on empty datagrams. This looks like a minor optimization, that never has been a strong goal for slirp. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp_config.h | 3 --- slirp/socket.c | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index f0cc1c781b..3ce64e088e 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -29,9 +29,6 @@ /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 -/* Define if you have readv */ -#undef HAVE_READV - /* Define if iovec needs to be declared */ #undef DECLARE_IOVEC #ifdef _WIN32 diff --git a/slirp/socket.c b/slirp/socket.c index 041ec5061a..7012c7c07d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -187,12 +187,7 @@ soread(struct socket *so) */ sopreprbuf(so, iov, &n); =20 -#ifdef HAVE_READV - nn =3D readv(so->s, (struct iovec *)iov, n); - DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); -#else nn =3D qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0); -#endif if (nn <=3D 0) { if (nn < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)) return 0; @@ -226,7 +221,6 @@ soread(struct socket *so) } } =20 -#ifndef HAVE_READV /* * If there was no error, try and read the second time round * We read again if n =3D 2 (ie, there's another part of the buffer) @@ -244,7 +238,6 @@ soread(struct socket *so) } =20 DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); -#endif =20 /* Update fields */ sb->sb_cc +=3D nn; @@ -452,13 +445,7 @@ sowrite(struct socket *so) } /* Check if there's urgent data to send, and if so, send it */ =20 -#ifdef HAVE_READV - nn =3D writev(so->s, (const struct iovec *)iov, n); - - DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); -#else nn =3D slirp_send(so, iov[0].iov_base, iov[0].iov_len,0); -#endif /* This should never happen, but people tell me it does *shrug* */ if (nn < 0 && (errno =3D=3D EAGAIN || errno =3D=3D EINTR)) return 0; @@ -467,7 +454,6 @@ sowrite(struct socket *so) goto err_disconnected; } =20 -#ifndef HAVE_READV if (n =3D=3D 2 && nn =3D=3D iov[0].iov_len) { int ret; ret =3D slirp_send(so, iov[1].iov_base, iov[1].iov_len,0); @@ -475,7 +461,6 @@ sowrite(struct socket *so) nn +=3D ret; } DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); -#endif =20 /* Update sbuf */ sb->sb_cc -=3D nn; --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547507668624576.5910374933787; Mon, 14 Jan 2019 15:14:28 -0800 (PST) Received: from localhost ([127.0.0.1]:34778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBQx-0004Sa-RW for importer@patchew.org; Mon, 14 Jan 2019 18:14:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6l-0004Bm-15 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6k-0001JE-Cq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:26 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6k-0001Fa-6U for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:26 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2A87E1BB6; Mon, 14 Jan 2019 23:53:25 +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 wrCo1zolshuo; Mon, 14 Jan 2019 23:53:24 +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 0E0FD1BD0; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eP-8N; Mon, 14 Jan 2019 23:53:09 +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:20 +0100 Message-Id: <20190114225306.21569-20-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 19/65] slirp: remove HAVE_SYS_SIGNAL_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 3 --- slirp/slirp_config.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index f7c087456a..4c3c672ee6 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -35,9 +35,6 @@ typedef char *caddr_t; #ifndef NO_UNIX_SOCKETS #include #endif -#ifdef HAVE_SYS_SIGNAL_H -# include -#endif #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 3ce64e088e..2605c4222b 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -50,9 +50,6 @@ #define HAVE_ARPA_INET_H #endif =20 -/* Define if you have sys/signal.h */ -#undef HAVE_SYS_SIGNAL_H - /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547506717738507.3767917321602; Mon, 14 Jan 2019 14:58:37 -0800 (PST) Received: from localhost ([127.0.0.1]:59162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBBk-0008Me-NU for importer@patchew.org; Mon, 14 Jan 2019 17:58:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6l-0004CR-LD for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6k-0001Jb-Qv for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6k-0001Hn-KJ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:26 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9DB741BBB; Mon, 14 Jan 2019 23:53:25 +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 8dEAR0heVxm1; Mon, 14 Jan 2019 23:53:24 +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 1590F1BD3; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eS-AG; Mon, 14 Jan 2019 23:53:09 +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:21 +0100 Message-Id: <20190114225306.21569-21-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 20/65] slirp: remove unused HAVE_SYS_BITYPES_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 4 ---- slirp/slirp_config.h | 3 --- 2 files changed, 7 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 4c3c672ee6..57955a8965 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -19,10 +19,6 @@ typedef char *caddr_t; # endif #endif =20 -#ifdef HAVE_SYS_BITYPES_H -# include -#endif - #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 2605c4222b..a205dc8c28 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -23,9 +23,6 @@ #define HAVE_SYS_FILIO_H #endif =20 -/* Define if you have sys/bitypes.h */ -#undef HAVE_SYS_BITYPES_H - /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547507309200977.4289706217753; Mon, 14 Jan 2019 15:08:29 -0800 (PST) Received: from localhost ([127.0.0.1]:33311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBL9-0007oe-Dt for importer@patchew.org; Mon, 14 Jan 2019 18:08:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6m-0004Cx-EN for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6l-0001Kk-C2 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37314) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6l-0001JA-2m for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0F42A1BB9; Mon, 14 Jan 2019 23:53:26 +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 Oo2VIZVREZHr; Mon, 14 Jan 2019 23:53:25 +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 436E41BD4; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eV-BP; Mon, 14 Jan 2019 23:53:09 +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:22 +0100 Message-Id: <20190114225306.21569-22-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 21/65] slirp: remove NO_UNIX_SOCKETS 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 3 --- slirp/slirp_config.h | 6 ------ 2 files changed, 9 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 57955a8965..fba77d0c3d 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -28,9 +28,6 @@ typedef char *caddr_t; #include #endif =20 -#ifndef NO_UNIX_SOCKETS -#include -#endif #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index a205dc8c28..4417b05d1c 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -58,9 +58,3 @@ #ifndef _WIN32 #define HAVE_INET_ATON #endif - -/* Define if you DON'T have unix-domain sockets */ -#undef NO_UNIX_SOCKETS -#ifdef _WIN32 -#define NO_UNIX_SOCKETS -#endif --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547508039692171.02662532409693; Mon, 14 Jan 2019 15:20:39 -0800 (PST) Received: from localhost ([127.0.0.1]:36332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBWs-00014a-GI for importer@patchew.org; Mon, 14 Jan 2019 18:20:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6n-0004Dt-4p for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6m-0001N5-8t for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:29 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37330) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6m-0001KK-1W for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:28 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EDC2B1BB7; Mon, 14 Jan 2019 23:53:26 +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 41pXWUMCZxQe; Mon, 14 Jan 2019 23:53:26 +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 5DE681BD6; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eX-Ck; Mon, 14 Jan 2019 23:53:09 +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:23 +0100 Message-Id: <20190114225306.21569-23-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 22/65] slirp: remove unused HAVE_SYS_STROPTS_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 5 ----- slirp/slirp_config.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index fba77d0c3d..400f585cec 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -54,11 +54,6 @@ typedef char *caddr_t; #define remque slirp_remque #define quehead slirp_quehead =20 -#ifdef HAVE_SYS_STROPTS_H -#include -#endif - - #include "debug.h" =20 #include "qemu/queue.h" diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 4417b05d1c..47811e36dc 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -47,9 +47,6 @@ #define HAVE_ARPA_INET_H #endif =20 -/* Define if you have sys/stropts.h */ -#undef HAVE_SYS_STROPTS_H - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507692460702.127653460583; Mon, 14 Jan 2019 15:14:52 -0800 (PST) Received: from localhost ([127.0.0.1]:34902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBRT-0004wb-A6 for importer@patchew.org; Mon, 14 Jan 2019 18:14:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6x-0004Se-Ug for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6x-0001TM-6V for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:39 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40384) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6w-0001Mw-Ve for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:39 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E98841BBC; Mon, 14 Jan 2019 23:53:27 +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 73U34W3LrA9W; Mon, 14 Jan 2019 23:53:27 +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 631871BD7; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eZ-ED; Mon, 14 Jan 2019 23:53:09 +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:24 +0100 Message-Id: <20190114225306.21569-24-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 23/65] slirp: remove unused HAVE_ARPA_INET_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 47811e36dc..e95284071a 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -41,12 +41,6 @@ #define HAVE_SYS_SELECT_H #endif =20 -/* Define if you have arpa/inet.h */ -#undef HAVE_ARPA_INET_H -#ifndef _WIN32 -#define HAVE_ARPA_INET_H -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547507669874442.2357204312427; Mon, 14 Jan 2019 15:14:29 -0800 (PST) Received: from localhost ([127.0.0.1]:34757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBQt-0004PG-34 for importer@patchew.org; Mon, 14 Jan 2019 18:14:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB71-0004Wk-Dp for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB70-0001Vx-4h for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:42 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6z-0001PI-SH for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:42 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C37171BB7; Mon, 14 Jan 2019 23:53:30 +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 V4F6QenROOLr; Mon, 14 Jan 2019 23:53:29 +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 D2C961BDE; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eb-Fr; Mon, 14 Jan 2019 23:53:09 +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:25 +0100 Message-Id: <20190114225306.21569-25-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 24/65] slirp: remove unused HAVE_SYS_WAIT_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 4 ---- slirp/slirp_config.h | 3 --- 2 files changed, 7 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 400f585cec..1f47848271 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -40,10 +40,6 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_WAIT_H -# include -#endif - #ifdef HAVE_SYS_FILIO_H # include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index e95284071a..9becb98e11 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -32,9 +32,6 @@ #define DECLARE_IOVEC #endif =20 -/* Define if you have a POSIX.1 sys/wait.h */ -#undef HAVE_SYS_WAIT_H - /* Define if you have sys/select.h */ #undef HAVE_SYS_SELECT_H #ifndef _WIN32 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508278633371.19886089172394; Mon, 14 Jan 2019 15:24:38 -0800 (PST) Received: from localhost ([127.0.0.1]:37383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBav-0004Zx-KJ for importer@patchew.org; Mon, 14 Jan 2019 18:24:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6z-0004Tq-08 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6y-0001UF-5W for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:40 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6x-0001Ny-V1 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:40 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EFCEB1BB9; Mon, 14 Jan 2019 23:53:28 +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 ZG2KIl17vRDh; Mon, 14 Jan 2019 23:53:28 +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 78C1D1BD9; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005ee-HL; Mon, 14 Jan 2019 23:53:09 +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:26 +0100 Message-Id: <20190114225306.21569-26-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 25/65] slirp: remove unused HAVE_SYS_SELECT_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/main.h | 4 ---- slirp/slirp.h | 4 ---- slirp/slirp_config.h | 6 ------ 3 files changed, 14 deletions(-) diff --git a/slirp/main.h b/slirp/main.h index e04677944f..4bc05fb904 100644 --- a/slirp/main.h +++ b/slirp/main.h @@ -8,10 +8,6 @@ #ifndef SLIRP_MAIN_H #define SLIRP_MAIN_H =20 -#ifdef HAVE_SYS_SELECT_H -#include -#endif - extern u_int curtime; extern struct in_addr loopback_addr; extern unsigned long loopback_mask; diff --git a/slirp/slirp.h b/slirp/slirp.h index 1f47848271..7606de962f 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -36,10 +36,6 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_SELECT_H -# include -#endif - #ifdef HAVE_SYS_FILIO_H # include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 9becb98e11..68e75f3873 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -32,12 +32,6 @@ #define DECLARE_IOVEC #endif =20 -/* Define if you have sys/select.h */ -#undef HAVE_SYS_SELECT_H -#ifndef _WIN32 -#define HAVE_SYS_SELECT_H -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 154750730920163.358943901868315; Mon, 14 Jan 2019 15:08:29 -0800 (PST) Received: from localhost ([127.0.0.1]:33300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBL8-0007n2-3M for importer@patchew.org; Mon, 14 Jan 2019 18:08:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6y-0004Tl-T4 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6x-0001Tx-Uf for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:40 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40394) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6x-0001Nj-Nb for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:39 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BB0E1836; Mon, 14 Jan 2019 23:53:28 +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 lRSzBrHELbZT; Mon, 14 Jan 2019 23:53:27 +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 73A0B1BD8; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005ei-Im; Mon, 14 Jan 2019 23:53:09 +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:27 +0100 Message-Id: <20190114225306.21569-27-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 26/65] slirp: remove HAVE_SYS_IOCTL_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 2 +- slirp/slirp_config.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 7606de962f..226bced429 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -32,7 +32,7 @@ typedef char *caddr_t; #include #endif =20 -#if defined(HAVE_SYS_IOCTL_H) +#ifndef _WIN32 # include #endif =20 diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 68e75f3873..0e78e92d94 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,12 +11,6 @@ * You shouldn't need to touch any of these */ =20 -/* Define if you have sys/ioctl.h */ -#undef HAVE_SYS_IOCTL_H -#ifndef _WIN32 -#define HAVE_SYS_IOCTL_H -#endif - /* Define if you have sys/filio.h */ #undef HAVE_SYS_FILIO_H #ifdef __APPLE__ --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508646293965.1986213993418; Mon, 14 Jan 2019 15:30:46 -0800 (PST) Received: from localhost ([127.0.0.1]:38973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBgr-0001T1-6H for importer@patchew.org; Mon, 14 Jan 2019 18:30:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6z-0004Uo-R1 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6z-0001Uy-5a for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40412) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6y-0001Oa-QI for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9F90A94F; Mon, 14 Jan 2019 23:53:29 +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 rkdYKfRmA3-A; Mon, 14 Jan 2019 23:53:28 +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 AFBDE1BDA; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005el-KG; Mon, 14 Jan 2019 23:53:09 +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:28 +0100 Message-Id: <20190114225306.21569-28-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 27/65] slirp: remove HAVE_SYS_FILIO_H 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 2 +- slirp/slirp_config.h | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 226bced429..4bbbba046e 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -36,7 +36,7 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_FILIO_H +#ifdef __APPLE__ # include #endif =20 diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 0e78e92d94..f1ee927c15 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,12 +11,6 @@ * You shouldn't need to touch any of these */ =20 -/* Define if you have sys/filio.h */ -#undef HAVE_SYS_FILIO_H -#ifdef __APPLE__ -#define HAVE_SYS_FILIO_H -#endif - /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507481111996.3245954864714; Mon, 14 Jan 2019 15:11:21 -0800 (PST) Received: from localhost ([127.0.0.1]:34076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBO3-00022u-Vx for importer@patchew.org; Mon, 14 Jan 2019 18:11:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB70-0004Vj-IF for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6z-0001VT-PZ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:42 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40428) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6z-0001PD-Fd for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7FEA51BB6; Mon, 14 Jan 2019 23:53:30 +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 JwX8-J-oNhga; Mon, 14 Jan 2019 23:53:29 +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 BF1D11BDC; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005en-Lc; Mon, 14 Jan 2019 23:53:09 +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:29 +0100 Message-Id: <20190114225306.21569-29-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 28/65] slirp: remove unused DECLARE_IOVEC 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: =?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 It's actually qemu configure CONFIG_IOVEC that is being used. slirp/ does not use it anyway Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index f1ee927c15..833f25a965 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -14,12 +14,6 @@ /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 -/* Define if iovec needs to be declared */ -#undef DECLARE_IOVEC -#ifdef _WIN32 -#define DECLARE_IOVEC -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508462667811.1031092284029; Mon, 14 Jan 2019 15:27:42 -0800 (PST) Received: from localhost ([127.0.0.1]:38174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBdt-0007Fd-IX for importer@patchew.org; Mon, 14 Jan 2019 18:27:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6z-0004Um-PX for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6z-0001Ur-5G for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6y-0001Oj-T1 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:41 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D11F4130C; Mon, 14 Jan 2019 23:53:29 +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 1s6ixNHcn2b4; Mon, 14 Jan 2019 23:53:29 +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 B764A1BDB; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eq-NZ; Mon, 14 Jan 2019 23:53:09 +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:30 +0100 Message-Id: <20190114225306.21569-30-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 29/65] slirp: remove unused HAVE_INET_ATON 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 833f25a965..5126711849 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -16,9 +16,3 @@ =20 /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) - -/* Define if you have inet_aton */ -#undef HAVE_INET_ATON -#ifndef _WIN32 -#define HAVE_INET_ATON -#endif --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507340942892.895086623668; Mon, 14 Jan 2019 15:09:00 -0800 (PST) Received: from localhost ([127.0.0.1]:33464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBLk-0008Hd-KN for importer@patchew.org; Mon, 14 Jan 2019 18:08:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB6s-0004JN-4h for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB6r-0001QC-3g for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:34 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB6q-0001Pm-QE for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:33 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D79EC1BBB; Mon, 14 Jan 2019 23:53:31 +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 pFn3nk227O2B; Mon, 14 Jan 2019 23:53:30 +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 E15F41BDF; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005eu-PP; Mon, 14 Jan 2019 23:53:09 +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:31 +0100 Message-Id: <20190114225306.21569-31-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 30/65] slirp: replace HOST_WORDS_BIGENDIAN with glib equivalent 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: jan.kiszka@siemens.com, stefanha@redhat.com, Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 One more step towards making the project independent from QEMU. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/ip.h | 8 +++++--- slirp/ip6.h | 3 ++- slirp/ip6_icmp.h | 6 +++--- slirp/slirp_config.h | 3 --- slirp/tcp.h | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/slirp/ip.h b/slirp/ip.h index 59cf4aa918..83fc9cdfbf 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -33,7 +33,9 @@ #ifndef IP_H #define IP_H =20 -#ifdef HOST_WORDS_BIGENDIAN +#include + +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN # undef NTOHL # undef NTOHS # undef HTONL @@ -69,7 +71,7 @@ typedef uint32_t n_long; /* long as recei= ved from the net */ * Structure of an internet header, naked of options. */ struct ip { -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t ip_v:4, /* version */ ip_hl:4; /* header length */ #else @@ -135,7 +137,7 @@ struct ip_timestamp { uint8_t ipt_code; /* IPOPT_TS */ uint8_t ipt_len; /* size of structure (variable) */ uint8_t ipt_ptr; /* index of current entry */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t ipt_oflw:4, /* overflow counter */ ipt_flg:4; /* flags, see below */ #else diff --git a/slirp/ip6.h b/slirp/ip6.h index b1bea43b3c..14e9c78735 100644 --- a/slirp/ip6.h +++ b/slirp/ip6.h @@ -6,6 +6,7 @@ #ifndef SLIRP_IP6_H #define SLIRP_IP6_H =20 +#include #include "net/eth.h" =20 #define ALLNODES_MULTICAST { .s6_addr =3D \ @@ -113,7 +114,7 @@ static inline void in6_compute_ethaddr(struct in6_addr = ip, * Structure of an internet header, naked of options. */ struct ip6 { -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint32_t ip_v:4, /* version */ ip_tc_hi:4, /* traffic class */ diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h index b3378b17b5..32b0914055 100644 --- a/slirp/ip6_icmp.h +++ b/slirp/ip6_icmp.h @@ -34,7 +34,7 @@ struct ndp_rs { /* Router Solicitation Message */ =20 struct ndp_ra { /* Router Advertisement Message */ uint8_t chl; /* Cur Hop Limit */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t M:1, O:1, @@ -56,7 +56,7 @@ struct ndp_ns { /* Neighbor Solicitation Message */ } QEMU_PACKED; =20 struct ndp_na { /* Neighbor Advertisement Message */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint32_t R:1, /* Router Flag */ S:1, /* Solicited Flag */ @@ -125,7 +125,7 @@ struct ndpopt { #define ndpopt_linklayer ndpopt_body.linklayer_addr struct prefixinfo { /* Prefix Information */ uint8_t prefix_length; -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t L:1, A:1, reserved1:6; #else uint8_t reserved1:6, A:1, L:1; diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 5126711849..b2def6d20c 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,8 +11,5 @@ * You shouldn't need to touch any of these */ =20 -/* Define if the machine is big endian */ -//#undef HOST_WORDS_BIGENDIAN - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) diff --git a/slirp/tcp.h b/slirp/tcp.h index 174d3d960c..47aaea6c5b 100644 --- a/slirp/tcp.h +++ b/slirp/tcp.h @@ -33,6 +33,8 @@ #ifndef TCP_H #define TCP_H =20 +#include + typedef uint32_t tcp_seq; =20 #define PR_SLOWHZ 2 /* 2 slow timeouts per second= (approx) */ @@ -51,7 +53,7 @@ struct tcphdr { uint16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t th_off:4, /* data offset */ th_x2:4; /* (unused) */ #else --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507848965316.2596215208366; Mon, 14 Jan 2019 15:17:28 -0800 (PST) Received: from localhost ([127.0.0.1]:35561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBTw-00070w-UQ for importer@patchew.org; Mon, 14 Jan 2019 18:17:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB77-0004fT-G1 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB75-0001Yj-5p for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:48 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB72-0001Pw-Ke for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:46 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8125A1BBE; Mon, 14 Jan 2019 23:53:32 +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 ws4rKlGIxLEO; Mon, 14 Jan 2019 23:53:31 +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 EC7941BE0; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005ew-RK; Mon, 14 Jan 2019 23:53:09 +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:32 +0100 Message-Id: <20190114225306.21569-32-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 31/65] slirp: replace SIZEOF_CHAR_P with glib equivalent 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Samuel Thibault --- slirp/ip.h | 2 +- slirp/slirp_config.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/slirp/ip.h b/slirp/ip.h index 83fc9cdfbf..243b6c8b24 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -177,7 +177,7 @@ struct ip_timestamp { =20 #define IP_MSS 576 /* default maximum segment size */ =20 -#if SIZEOF_CHAR_P =3D=3D 4 +#if GLIB_SIZEOF_VOID_P =3D=3D 4 struct mbuf_ptr { struct mbuf *mptr; uint32_t dummy; diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index b2def6d20c..7147e0de04 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -10,6 +10,3 @@ * Autoconf defined configuration options * You shouldn't need to touch any of these */ - -/* Define to sizeof(char *) */ -#define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509038097271.3245757464085; Mon, 14 Jan 2019 15:37:18 -0800 (PST) Received: from localhost ([127.0.0.1]:40560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBnA-0006Wj-Qd for importer@patchew.org; Mon, 14 Jan 2019 18:37:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7A-0004fn-3o for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB77-0001a2-Gs for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB75-0001QJ-5H for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:48 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id ED2791BBF; Mon, 14 Jan 2019 23:53:32 +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 KqWULu77ZxYJ; Mon, 14 Jan 2019 23:53:30 +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 EFED41BE2; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005ez-Sp; Mon, 14 Jan 2019 23:53:09 +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:33 +0100 Message-Id: <20190114225306.21569-33-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 32/65] slirp: replace compile time DO_KEEPALIVE 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: =?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 Use a global variable instead (similar to slirp_debug) Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/slirp.c | 3 +++ slirp/slirp.h | 6 +++--- slirp/slirp_config.h | 12 ------------ slirp/tcp_input.c | 2 +- slirp/tcp_timer.c | 2 +- 5 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 slirp/slirp_config.h diff --git a/slirp/slirp.c b/slirp/slirp.c index 76e94eb1cd..f11f9e9e51 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -35,6 +35,9 @@ #include #endif =20 +/* Define to 1 if you want KEEPALIVE timers */ +bool slirp_do_keepalive; + /* host loopback address */ struct in_addr loopback_addr; /* host loopback network mask */ diff --git a/slirp/slirp.h b/slirp/slirp.h index 4bbbba046e..05c203c8c7 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -1,8 +1,6 @@ #ifndef SLIRP_H #define SLIRP_H =20 -#include "slirp_config.h" - #ifdef _WIN32 =20 typedef char *caddr_t; @@ -219,7 +217,9 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len); #include #endif =20 -#define SO_OPTIONS DO_KEEPALIVE + +extern bool slirp_do_keepalive; + #define TCP_MAXIDLE (TCPTV_KEEPCNT * TCPTV_KEEPINTVL) =20 /* dnssearch.c */ diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h deleted file mode 100644 index 7147e0de04..0000000000 --- a/slirp/slirp_config.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * User definable configuration options - */ - -/* Define to 1 if you want KEEPALIVE timers */ -#define DO_KEEPALIVE 0 - -/*********************************************************/ -/* - * Autoconf defined configuration options - * You shouldn't need to touch any of these - */ diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 09bdf9b482..6af63469da 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -481,7 +481,7 @@ findso: * Reset idle time and keep-alive timer. */ tp->t_idle =3D 0; - if (SO_OPTIONS) + if (slirp_do_keepalive) tp->t_timer[TCPT_KEEP] =3D TCPTV_KEEPINTVL; else tp->t_timer[TCPT_KEEP] =3D TCPTV_KEEP_IDLE; diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c index dc8288b511..a843e57a2b 100644 --- a/slirp/tcp_timer.c +++ b/slirp/tcp_timer.c @@ -262,7 +262,7 @@ tcp_timers(register struct tcpcb *tp, int timer) if (tp->t_state < TCPS_ESTABLISHED) goto dropit; =20 - if ((SO_OPTIONS) && tp->t_state <=3D TCPS_CLOSE_WAIT) { + if (slirp_do_keepalive && tp->t_state <=3D TCPS_CLOSE_WAIT) { if (tp->t_idle >=3D TCPTV_KEEP_IDLE + TCP_MAXIDLE) goto dropit; /* --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508851785720.8665940945049; Mon, 14 Jan 2019 15:34:11 -0800 (PST) Received: from localhost ([127.0.0.1]:39755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBkA-0003uJ-OE for importer@patchew.org; Mon, 14 Jan 2019 18:34:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7A-0004fm-2g for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB77-0001Zv-Gq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:50 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40468) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB75-0001QY-4k for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:48 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 74F601BBD; Mon, 14 Jan 2019 23:53:33 +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 3zUoZOCKK6d8; Mon, 14 Jan 2019 23:53:32 +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 ED2DC1BE1; Mon, 14 Jan 2019 23:53:11 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6T-0005f2-W0; Mon, 14 Jan 2019 23:53:09 +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:34 +0100 Message-Id: <20190114225306.21569-34-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 33/65] slirp: remove unused global slirp_instance 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 05c203c8c7..d1b6bcefbb 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -199,8 +199,6 @@ struct Slirp { void *opaque; }; =20 -extern Slirp *slirp_instance; - #ifndef NULL #define NULL (void *)0 #endif --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547508406481284.96775305179733; Mon, 14 Jan 2019 15:26:46 -0800 (PST) Received: from localhost ([127.0.0.1]:37882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBcm-0006I1-5a for importer@patchew.org; Mon, 14 Jan 2019 18:26:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004l9-Uj for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7E-0001eY-7n for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7D-0001UB-HP for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:56 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C0C181BBC; Mon, 14 Jan 2019 23:53:39 +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 7DTsJzwGWMvQ; Mon, 14 Jan 2019 23:53:38 +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 8E48B1BEF; 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-0005f5-1d; 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:35 +0100 Message-Id: <20190114225306.21569-35-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 34/65] slirp: replace error_report() with g_critical() 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: =?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 Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/ip6_icmp.c | 2 +- slirp/misc.c | 2 +- slirp/slirp.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index cd1e0b9fe1..3c424df591 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -417,7 +417,7 @@ void icmp6_input(struct mbuf *m) icmp6_send_echoreply(m, slirp, ip, icmp); } else { /* TODO */ - error_report("external icmpv6 not supported yet"); + g_critical("external icmpv6 not supported yet"); } break; =20 diff --git a/slirp/misc.c b/slirp/misc.c index 7362e14339..ee3492a2ae 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -119,7 +119,7 @@ slirp_socketpair_with_oob(int sv[2]) return 0; =20 err: - error_report("Error: slirp_socketpair(): %s", strerror(errno)); + g_critical("slirp_socketpair(): %s", strerror(errno)); if (s >=3D 0) { closesocket(s); } diff --git a/slirp/slirp.c b/slirp/slirp.c index f11f9e9e51..8391d18faf 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1214,8 +1214,8 @@ static int sbuf_tmp_post_load(void *opaque, int versi= on) } if (tmp->woff >=3D requested_len || tmp->roff >=3D requested_len) { - error_report("invalid sbuf offsets r/w=3D%u/%u len=3D%u", - tmp->roff, tmp->woff, requested_len); + g_critical("invalid sbuf offsets r/w=3D%u/%u len=3D%u", + tmp->roff, tmp->woff, requested_len); return -EINVAL; } =20 @@ -1323,7 +1323,7 @@ static int ss_family_post_load(void *opaque, int vers= ion_id) tss->parent->ss.ss_family =3D AF_INET6; break; default: - error_report("invalid ss_family type %x", tss->portable_family); + g_critical("invalid ss_family type %x", tss->portable_family); return -EINVAL; } =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547508038471745.4032806171839; Mon, 14 Jan 2019 15:20:38 -0800 (PST) Received: from localhost ([127.0.0.1]:36329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBWu-00014F-N7 for importer@patchew.org; Mon, 14 Jan 2019 18:20:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7H-0004n4-SG 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 1gjB7E-0001e8-1p for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:59 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37446) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7A-0001RZ-2c for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:54 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 414F51BC0; Mon, 14 Jan 2019 23:53:35 +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 ITyALPqMht1D; Mon, 14 Jan 2019 23:53:33 +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 0F7F01BE3; 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-0005f8-3O; 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:36 +0100 Message-Id: <20190114225306.21569-36-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 35/65] slirp: improve a bit the debug macros 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: =?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 Let them accept multiple arguments. Simplify the inner argument handling of DEBUG_ARGS/DEBUG_MISC_DEBUG_ERROR. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/arp_table.c | 12 ++++++------ slirp/bootp.c | 3 +-- slirp/cksum.c | 4 ++-- slirp/debug.h | 47 ++++++++++++++++++++++++++++++++++++---------- slirp/dhcpv6.c | 11 +++++------ slirp/ip6_icmp.c | 2 +- slirp/ip_icmp.c | 18 +++++++++--------- slirp/mbuf.c | 2 +- slirp/ndp_table.c | 18 +++++++++--------- slirp/slirp.c | 12 ++++++------ slirp/socket.c | 32 +++++++++++++++---------------- slirp/tcp_input.c | 15 +++++++-------- slirp/tcp_output.c | 2 +- slirp/tcp_subr.c | 4 ++-- slirp/udp.c | 6 +++--- slirp/udp6.c | 6 +++--- 16 files changed, 109 insertions(+), 85 deletions(-) diff --git a/slirp/arp_table.c b/slirp/arp_table.c index f81963bb88..ce19e6e7c0 100644 --- a/slirp/arp_table.c +++ b/slirp/arp_table.c @@ -34,9 +34,9 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_= t ethaddr[ETH_ALEN]) =20 DEBUG_CALL("arp_table_add"); 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])); + DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (ip_addr =3D=3D 0 || ip_addr =3D=3D 0xffffffff || ip_addr =3D=3D br= oadcast_addr) { /* Do not register broadcast addresses */ @@ -79,9 +79,9 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, for (i =3D 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip =3D=3D ip_addr) { memcpy(out_ethaddr, arptbl->table[i].ar_sha, ETH_ALEN); - DEBUG_ARGS((dfd, " found hw addr =3D %02x:%02x:%02x:%02x:%02x:= %02x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/bootp.c b/slirp/bootp.c index 7b1af73c95..5ab6692038 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -37,8 +37,7 @@ static const uint8_t rfc1533_cookie[] =3D { RFC1533_COOKIE }; =20 #ifdef DEBUG -#define DPRINTF(fmt, ...) \ -do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflus= h(dfd); } while (0) +#define DPRINTF(fmt, ...) DEBUG_CALL(fmt, ##__VA_ARGS__) #else #define DPRINTF(fmt, ...) do{}while(0) #endif diff --git a/slirp/cksum.c b/slirp/cksum.c index 6d73abf4a0..b9466485b5 100644 --- a/slirp/cksum.c +++ b/slirp/cksum.c @@ -124,8 +124,8 @@ int cksum(struct mbuf *m, int len) cont: #ifdef DEBUG if (len) { - DEBUG_ERROR((dfd, "cksum: out of data\n")); - DEBUG_ERROR((dfd, " len =3D %d\n", len)); + DEBUG_ERROR("cksum: out of data\n"); + DEBUG_ERROR(" len =3D %d\n", len); } #endif if (mlen =3D=3D -1) { diff --git a/slirp/debug.h b/slirp/debug.h index 6cfa61edb3..ca3a4b04da 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -17,18 +17,45 @@ =20 extern int slirp_debug; =20 -#define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n"= , x); fflush(dfd); } -#define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fpr= intf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } -#define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd= ); } -#define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd= ); } -#define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(df= d); } +#define DEBUG_CALL(fmt, ...) do { \ + if (slirp_debug & DBG_CALL) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fprintf(dfd, "...\n"); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ARG(fmt, ...) do { \ + if (slirp_debug & DBG_CALL) { \ + fputc(' ', dfd); \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fputc('\n', dfd); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ARGS(fmt, ...) DEBUG_ARG(fmt, ##__VA_ARGS__) + +#define DEBUG_MISC(fmt, ...) do { \ + if (slirp_debug & DBG_MISC) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ERROR(fmt, ...) do { \ + if (slirp_debug & DBG_ERROR) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fflush(dfd); \ + } \ +} while (0) =20 #else =20 -#define DEBUG_CALL(x) -#define DEBUG_ARG(x, y) -#define DEBUG_ARGS(x) -#define DEBUG_MISC(x) -#define DEBUG_ERROR(x) +#define DEBUG_CALL(fmt, ...) +#define DEBUG_ARG(fmt, ...) +#define DEBUG_ARGS(fmt, ...) +#define DEBUG_MISC(fmt, ...) +#define DEBUG_ERROR(fmt, ...) =20 #endif diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index d266611e85..943a13bca8 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -92,14 +92,14 @@ static int dhcpv6_parse_info_request(uint8_t *odata, in= t olen, ri->want_boot_url =3D true; break; default: - DEBUG_MISC((dfd, "dhcpv6: Unsupported option request %= d\n", - req_opt)); + DEBUG_MISC("dhcpv6: Unsupported option request %d\n", + req_opt); } } break; default: - DEBUG_MISC((dfd, "dhcpv6 info req: Unsupported option %d, len= =3D%d\n", - option, len)); + DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=3D%d\n= ", + option, len); } =20 odata +=3D len + 4; @@ -203,7 +203,6 @@ void dhcpv6_input(struct sockaddr_in6 *srcsas, struct m= buf *m) dhcpv6_info_request(m->slirp, srcsas, xid, &data[4], data_len - 4); break; default: - DEBUG_MISC((dfd, "dhcpv6_input: Unsupported message type 0x%x\n", - data[0])); + DEBUG_MISC("dhcpv6_input: Unsupported message type 0x%x\n", data[0= ]); } } diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 3c424df591..595647b1b1 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -76,7 +76,7 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8= _t code) struct ip6 *ip =3D mtod(m, struct ip6 *); =20 DEBUG_CALL("icmp6_send_error"); - DEBUG_ARGS((dfd, " type =3D %d, code =3D %d\n", type, code)); + DEBUG_ARGS(" type =3D %d, code =3D %d\n", type, code); =20 if (IN6_IS_ADDR_MULTICAST(&ip->ip_src) || in6_zero(&ip->ip_src)) { diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index 9210eef3f3..af11cfcefe 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -99,8 +99,8 @@ static int icmp_send(struct socket *so, struct mbuf *m, i= nt hlen) =20 if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) =3D=3D -1) { - DEBUG_MISC((dfd, "icmp_input icmp sendto tx errno =3D %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC("icmp_input icmp sendto tx errno =3D %d-%s\n", + errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(err= no)); icmp_detach(so); } @@ -165,8 +165,8 @@ icmp_input(struct mbuf *m, int hlen) return; } if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC((dfd,"icmp_input udp_attach errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp_attach errno =3D %d-%s\n", + errno,strerror(errno)); sofree(so); m_free(m); goto end_error; @@ -188,8 +188,8 @@ icmp_input(struct mbuf *m, int hlen) =20 if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sockaddr_size(&addr)) =3D=3D -1) { - DEBUG_MISC((dfd,"icmp_input udp sendto tx errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp sendto tx errno =3D %d-%s\n", + errno,strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); udp_detach(so); } @@ -257,7 +257,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char = code, int minsize, { char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); - DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb)); + DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb); } #endif if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment= 0 */ @@ -457,8 +457,8 @@ void icmp_receive(struct socket *so) } else { error_code =3D ICMP_UNREACH_HOST; } - DEBUG_MISC((dfd, " udp icmp rx errno =3D %d-%s\n", errno, - strerror(errno))); + DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", errno, + strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(er= rno)); } else { icmp_reflect(so->so_m); diff --git a/slirp/mbuf.c b/slirp/mbuf.c index aa1f28afb1..d8d275e0e7 100644 --- a/slirp/mbuf.c +++ b/slirp/mbuf.c @@ -232,7 +232,7 @@ dtom(Slirp *slirp, void *dat) } } =20 - DEBUG_ERROR((dfd, "dtom failed")); + DEBUG_ERROR("dtom failed"); =20 return (struct mbuf *)0; } diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index e1676a0a7b..a4e6421fd3 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -19,9 +19,9 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); DEBUG_ARG("ip =3D %s", addrstr); #endif - 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])); + DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (IN6_IS_ADDR_MULTICAST(&ip_addr) || in6_zero(&ip_addr)) { /* Do not register multicast or unspecified addresses */ @@ -69,18 +69,18 @@ bool ndp_table_search(Slirp *slirp, struct in6_addr ip_= addr, out_ethaddr[3] =3D ip_addr.s6_addr[13]; out_ethaddr[4] =3D ip_addr.s6_addr[14]; out_ethaddr[5] =3D ip_addr.s6_addr[15]; - DEBUG_ARGS((dfd, " multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02= x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } =20 for (i =3D 0; i < NDP_TABLE_SIZE; i++) { if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) { memcpy(out_ethaddr, ndp_table->table[i].eth_addr, ETH_ALEN); - DEBUG_ARGS((dfd, " found hw addr =3D %02x:%02x:%02x:%02x:%02x:= %02x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/slirp.c b/slirp/slirp.c index 8391d18faf..591dd1fcb4 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -984,12 +984,12 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) } =20 memcpy(eh->h_dest, ethaddr, ETH_ALEN); - DEBUG_ARGS((dfd, " src =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_source[0], eh->h_source[1], eh->h_source[2], - eh->h_source[3], eh->h_source[4], eh->h_source[5])); - DEBUG_ARGS((dfd, " dst =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], - eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); + DEBUG_ARGS(" src =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + eh->h_source[0], eh->h_source[1], eh->h_source[2], + eh->h_source[3], eh->h_source[4], eh->h_source[5]); + DEBUG_ARGS(" dst =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], + eh->h_dest[3], eh->h_dest[4], eh->h_dest[5]); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; diff --git a/slirp/socket.c b/slirp/socket.c index 7012c7c07d..677fd20c9d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -208,7 +208,7 @@ soread(struct socket *so) } } =20 - DEBUG_MISC((dfd, " --- soread() disconnected, nn =3D %d, errno =3D %d-%= s\n", nn, errno,strerror(errno))); + DEBUG_MISC(" --- soread() disconnected, nn =3D %d, errno =3D %d-%s\n", = nn, errno,strerror(errno)); sofcantrcvmore(so); =20 if (err =3D=3D ECONNRESET || err =3D=3D ECONNREFUSED @@ -237,7 +237,7 @@ soread(struct socket *so) nn +=3D ret; } =20 - DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); + DEBUG_MISC(" ... read nn =3D %d bytes\n", nn); =20 /* Update fields */ sb->sb_cc +=3D nn; @@ -370,7 +370,7 @@ sosendoob(struct socket *so) n =3D slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ #ifdef DEBUG if (n !=3D len) { - DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n")); + DEBUG_ERROR("Didn't send all data urgently XXXXX\n"); } #endif } @@ -379,7 +379,7 @@ sosendoob(struct socket *so) return n; } so->so_urgc -=3D n; - DEBUG_MISC((dfd, " ---2 sent %d bytes urgent data, %d urgent bytes left\n= ", n, so->so_urgc)); + DEBUG_MISC(" ---2 sent %d bytes urgent data, %d urgent bytes left\n", n, = so->so_urgc); =20 sb->sb_cc -=3D n; sb->sb_rptr +=3D n; @@ -460,7 +460,7 @@ sowrite(struct socket *so) if (ret > 0) nn +=3D ret; } - DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); + DEBUG_MISC(" ... wrote nn =3D %d bytes\n", nn); =20 /* Update sbuf */ sb->sb_cc -=3D nn; @@ -478,8 +478,8 @@ sowrite(struct socket *so) return nn; =20 err_disconnected: - DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state =3D %x, errno = =3D %d\n", - so->so_state, errno)); + DEBUG_MISC(" --- sowrite disconnected, so->so_state =3D %x, errno =3D %d\= n", + so->so_state, errno); sofcantsendmore(so); tcp_sockclosed(sototcpcb(so)); return -1; @@ -512,8 +512,8 @@ sorecvfrom(struct socket *so) if(errno =3D=3D EHOSTUNREACH) code=3DICMP_UNREACH_HOST; else if(errno =3D=3D ENETUNREACH) code=3DICMP_UNREACH_NET; =20 - DEBUG_MISC((dfd," udp icmp rx errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", + errno,strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); } else { icmp_reflect(so->so_m); @@ -564,8 +564,8 @@ sorecvfrom(struct socket *so) =20 m->m_len =3D recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC((dfd, " did recvfrom %d, errno =3D %d-%s\n", - m->m_len, errno,strerror(errno))); + DEBUG_MISC(" did recvfrom %d, errno =3D %d-%s\n", + m->m_len, errno,strerror(errno)); if(m->m_len<0) { /* Report error as ICMP */ switch (so->so_lfamily) { @@ -579,7 +579,7 @@ sorecvfrom(struct socket *so) code =3D ICMP_UNREACH_NET; } =20 - DEBUG_MISC((dfd, " rx error, tx icmp ICMP_UNREACH:%i\n", code)); + DEBUG_MISC(" rx error, tx icmp ICMP_UNREACH:%i\n", code); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); break; case AF_INET6: @@ -591,7 +591,7 @@ sorecvfrom(struct socket *so) code =3D ICMP6_UNREACH_NO_ROUTE; } =20 - DEBUG_MISC((dfd, " rx error, tx icmp6 ICMP_UNREACH:%i\n", code)); + DEBUG_MISC(" rx error, tx icmp6 ICMP_UNREACH:%i\n", code); icmp6_send_error(so->so_m, ICMP6_UNREACH, code); break; default: @@ -839,9 +839,9 @@ void sotranslate_out(struct socket *so, struct sockaddr= _storage *addr) } } =20 - DEBUG_MISC((dfd, " addr.sin_port=3D%d, " - "addr.sin_addr.s_addr=3D%.16s\n", - ntohs(sin->sin_port), inet_ntoa(sin->sin_addr))); + DEBUG_MISC(" addr.sin_port=3D%d, " + "addr.sin_addr.s_addr=3D%.16s\n", + ntohs(sin->sin_port), inet_ntoa(sin->sin_addr)); break; =20 case AF_INET6: diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 6af63469da..39821e5a34 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -236,8 +236,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *in= so, unsigned short af) Slirp *slirp; =20 DEBUG_CALL("tcp_input"); - DEBUG_ARGS((dfd, " m =3D %p iphlen =3D %2d inso =3D %p\n", - m, iphlen, inso)); + DEBUG_ARGS(" m =3D %p iphlen =3D %2d inso =3D %p\n", + m, iphlen, inso); =20 /* * If called with m =3D=3D 0, then we're continuing the connect @@ -662,8 +662,8 @@ findso: (errno !=3D EINPROGRESS) && (errno !=3D EWOULDBLOCK) ) { uint8_t code; - DEBUG_MISC((dfd, " tcp fconnect errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" tcp fconnect errno =3D %d-%s\n", + errno,strerror(errno)); if(errno =3D=3D ECONNREFUSED) { /* ACK the SYN, send RST to refuse the connection */ tcp_respond(tp, ti, m, ti->ti_seq + 1, (tcp_seq) 0, @@ -1032,8 +1032,7 @@ trimthenstep6: =20 if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len =3D=3D 0 && tiwin =3D=3D tp->snd_wnd) { - DEBUG_MISC((dfd, " dup ack m =3D %p so =3D %p\n", - m, so)); + DEBUG_MISC(" dup ack m =3D %p so =3D %p\n", m, so); /* * If we have outstanding data (other than * a window probe), this is a completely @@ -1411,7 +1410,7 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, = struct tcpiphdr *ti) int opt, optlen; =20 DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS((dfd, " tp =3D %p cnt=3D%i\n", tp, cnt)); + DEBUG_ARGS(" tp =3D %p cnt=3D%i\n", tp, cnt); =20 for (; cnt > 0; cnt -=3D optlen, cp +=3D optlen) { opt =3D cp[0]; @@ -1611,7 +1610,7 @@ tcp_mss(struct tcpcb *tp, u_int offer) (mss - (TCP_RCVSPACE % mss)= ) : 0)); =20 - DEBUG_MISC((dfd, " returning mss =3D %d\n", mss)); + DEBUG_MISC(" returning mss =3D %d\n", mss); =20 return mss; } diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index c835432812..ecc2d506b6 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -92,7 +92,7 @@ again: =20 flags =3D tcp_outflags[tp->t_state]; =20 - DEBUG_MISC((dfd, " --- tcp_output flags =3D 0x%x\n",flags)); + DEBUG_MISC(" --- tcp_output flags =3D 0x%x\n", flags); =20 /* * If in persist timeout with window of 0, send 1 byte. diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 4b40850c7a..00cee73163 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -420,7 +420,7 @@ int tcp_fconnect(struct socket *so, unsigned short af) qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); =20 addr =3D so->fhost.ss; - DEBUG_CALL(" connect()ing") + DEBUG_CALL(" connect()ing"); sotranslate_out(so, &addr); =20 /* We don't care what port we get */ @@ -964,7 +964,7 @@ int tcp_ctl(struct socket *so) so->chardev =3D ex_ptr->ex_chardev; return 1; } - DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); + DEBUG_MISC(" executing %s\n", ex_ptr->ex_exec); return fork_exec(so, ex_ptr->ex_exec); } } diff --git a/slirp/udp.c b/slirp/udp.c index 5bb196c907..4853243d87 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -172,8 +172,8 @@ udp_input(register struct mbuf *m, int iphlen) */ so =3D socreate(slirp); if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC((dfd," udp_attach errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp_attach errno =3D %d-%s\n", + errno, strerror(errno)); sofree(so); goto bad; } @@ -209,7 +209,7 @@ udp_input(register struct mbuf *m, int iphlen) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip=3Dsave_ip; - DEBUG_MISC((dfd,"udp tx errno =3D %d-%s\n",errno,strerror(errno))); + DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); goto bad; diff --git a/slirp/udp6.c b/slirp/udp6.c index 986010f0d3..473ba1586e 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -92,8 +92,8 @@ void udp6_input(struct mbuf *m) /* If there's no socket for this packet, create one. */ so =3D socreate(slirp); if (udp_attach(so, AF_INET6) =3D=3D -1) { - DEBUG_MISC((dfd, " udp6_attach errno =3D %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC(" udp6_attach errno =3D %d-%s\n", + errno, strerror(errno)); sofree(so); goto bad; } @@ -119,7 +119,7 @@ void udp6_input(struct mbuf *m) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip =3D save_ip; - DEBUG_MISC((dfd, "udp tx errno =3D %d-%s\n", errno, strerror(errno= ))); + DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); goto bad; } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507484908773.7781678272999; Mon, 14 Jan 2019 15:11:24 -0800 (PST) Received: from localhost ([127.0.0.1]:34085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBO4-000243-RX for importer@patchew.org; Mon, 14 Jan 2019 18:11:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7D-0004in-Ot for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7A-0001bX-3a for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40474) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB77-0001RF-Fn for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:50 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8A8F91BBB; Mon, 14 Jan 2019 23:53:34 +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 EqnE2jWmG47g; Mon, 14 Jan 2019 23:53:33 +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 345401BE5; 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-0005fB-4s; 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:37 +0100 Message-Id: <20190114225306.21569-37-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 36/65] slirp: add a callback to log guest errors 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 7 +++++++ slirp/dhcpv6.c | 6 +++--- slirp/ip6_icmp.c | 7 +++---- slirp/libslirp.h | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 031c324f02..ea8b04e007 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/log.h" #include "net/slirp.h" =20 =20 @@ -140,8 +141,14 @@ static NetClientInfo net_slirp_info =3D { .cleanup =3D net_slirp_cleanup, }; =20 +static void net_slirp_guest_error(const char *msg) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s", msg); +} + static const SlirpCb slirp_cb =3D { .output =3D net_slirp_output, + .guest_error =3D net_slirp_guest_error, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index 943a13bca8..5d703e8ae6 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -50,7 +50,7 @@ struct requested_infos { * the odata region, thus the caller must keep odata valid as long as it * needs to access the requested_infos struct. */ -static int dhcpv6_parse_info_request(uint8_t *odata, int olen, +static int dhcpv6_parse_info_request(Slirp *slirp, uint8_t *odata, int ole= n, struct requested_infos *ri) { int i, req_opt; @@ -61,7 +61,7 @@ static int dhcpv6_parse_info_request(uint8_t *odata, int = olen, int len =3D odata[2] << 8 | odata[3]; =20 if (len + 4 > olen) { - qemu_log_mask(LOG_GUEST_ERROR, "Guest sent bad DHCPv6 packet!\= n"); + slirp->cb->guest_error("Guest sent bad DHCPv6 packet!"); return -E2BIG; } =20 @@ -121,7 +121,7 @@ static void dhcpv6_info_request(Slirp *slirp, struct so= ckaddr_in6 *srcsas, struct mbuf *m; uint8_t *resp; =20 - if (dhcpv6_parse_info_request(odata, olen, &ri) < 0) { + if (dhcpv6_parse_info_request(slirp, odata, olen, &ri) < 0) { return; } =20 diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 595647b1b1..3f74d172f4 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -342,8 +342,7 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, str= uct ip6 *ip, =20 case ICMP6_NDP_RA: DEBUG_CALL(" type =3D Router Advertisement"); - qemu_log_mask(LOG_GUEST_ERROR, - "Warning: guest sent NDP RA, but shouldn't"); + slirp->cb->guest_error("Warning: guest sent NDP RA, but shouldn't"= ); break; =20 case ICMP6_NDP_NS: @@ -376,8 +375,8 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, str= uct ip6 *ip, =20 case ICMP6_NDP_REDIRECT: DEBUG_CALL(" type =3D Redirect"); - qemu_log_mask(LOG_GUEST_ERROR, - "Warning: guest sent NDP REDIRECT, but shouldn't"); + slirp->cb->guest_error( + "Warning: guest sent NDP REDIRECT, but shouldn't"); break; } } diff --git a/slirp/libslirp.h b/slirp/libslirp.h index a5d1b27b5e..3e0aa19f4b 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -13,6 +13,8 @@ typedef struct Slirp Slirp; typedef struct SlirpCb { /* Send an ethernet frame to the guest network. */ void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); + /* Print a message for an error due to guest misbehavior. */ + void (*guest_error)(const char *msg); } SlirpCb; =20 =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509227300750.1177725758808; Mon, 14 Jan 2019 15:40:27 -0800 (PST) Received: from localhost ([127.0.0.1]:41347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBqB-0000Uq-5g for importer@patchew.org; Mon, 14 Jan 2019 18:40:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7D-0004im-Ot for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7A-0001bt-6Z for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB78-0001S6-5S for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 4132B1BB2; Mon, 14 Jan 2019 23:53:36 +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 eb1wLl3huTJT; Mon, 14 Jan 2019 23:53:34 +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 304571BE4; 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-0005fD-6X; 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:38 +0100 Message-Id: <20190114225306.21569-38-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 37/65] slirp: remove #if notdef dead code 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/ip_input.c | 200 ---------------------------------------------- slirp/tcp_input.c | 39 --------- 2 files changed, 239 deletions(-) diff --git a/slirp/ip_input.c b/slirp/ip_input.c index 094a807d41..d360620838 100644 --- a/slirp/ip_input.c +++ b/slirp/ip_input.c @@ -447,206 +447,6 @@ ip_slowtimo(Slirp *slirp) } } =20 -/* - * Do option processing on a datagram, - * possibly discarding it if bad options are encountered, - * or forwarding it if source-routed. - * Returns 1 if packet has been forwarded/freed, - * 0 if the packet should be processed further. - */ - -#ifdef notdef - -int -ip_dooptions(m) - struct mbuf *m; -{ - register struct ip *ip =3D mtod(m, struct ip *); - register u_char *cp; - register struct ip_timestamp *ipt; - register struct in_ifaddr *ia; - int opt, optlen, cnt, off, code, type, forward =3D 0; - struct in_addr *sin, dst; -typedef uint32_t n_time; - n_time ntime; - - dst =3D ip->ip_dst; - cp =3D (u_char *)(ip + 1); - cnt =3D (ip->ip_hl << 2) - sizeof (struct ip); - for (; cnt > 0; cnt -=3D optlen, cp +=3D optlen) { - opt =3D cp[IPOPT_OPTVAL]; - if (opt =3D=3D IPOPT_EOL) - break; - if (opt =3D=3D IPOPT_NOP) - optlen =3D 1; - else { - optlen =3D cp[IPOPT_OLEN]; - if (optlen <=3D 0 || optlen > cnt) { - code =3D &cp[IPOPT_OLEN] - (u_char *)ip; - goto bad; - } - } - switch (opt) { - - default: - break; - - /* - * Source routing with record. - * Find interface with current destination address. - * If none on this machine then drop if strictly routed, - * or do nothing if loosely routed. - * Record interface address and bring up next address - * component. If strictly routed make sure next - * address is on directly accessible net. - */ - case IPOPT_LSRR: - case IPOPT_SSRR: - if ((off =3D cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code =3D &cp[IPOPT_OFFSET] - (u_char *)ip; - goto bad; - } - ipaddr.sin_addr =3D ip->ip_dst; - ia =3D (struct in_ifaddr *) - ifa_ifwithaddr((struct sockaddr *)&ipaddr); - if (ia =3D=3D 0) { - if (opt =3D=3D IPOPT_SSRR) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_SRCFAIL; - goto bad; - } - /* - * Loose routing, and not at next destination - * yet; nothing to do except forward. - */ - break; - } - off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) { - /* - * End of source route. Should be for us. - */ - save_rte(cp, ip->ip_src); - break; - } - /* - * locate outgoing interface - */ - bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, - sizeof(ipaddr.sin_addr)); - if (opt =3D=3D IPOPT_SSRR) { -#define INA struct in_ifaddr * -#define SA struct sockaddr * - if ((ia =3D (INA)ifa_ifwithdstaddr((SA)&ipaddr)) =3D=3D 0) - ia =3D (INA)ifa_ifwithnet((SA)&ipaddr); - } else - ia =3D ip_rtaddr(ipaddr.sin_addr); - if (ia =3D=3D 0) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_SRCFAIL; - goto bad; - } - ip->ip_dst =3D ipaddr.sin_addr; - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] +=3D sizeof(struct in_addr); - /* - * Let ip_intr's mcast routing check handle mcast pkts - */ - forward =3D !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); - break; - - case IPOPT_RR: - if ((off =3D cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code =3D &cp[IPOPT_OFFSET] - (u_char *)ip; - goto bad; - } - /* - * If no space remains, ignore. - */ - off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) - break; - bcopy((caddr_t)(&ip->ip_dst), (caddr_t)&ipaddr.sin_addr, - sizeof(ipaddr.sin_addr)); - /* - * locate outgoing interface; if we're the destination, - * use the incoming interface (should be same). - */ - if ((ia =3D (INA)ifa_ifwithaddr((SA)&ipaddr)) =3D=3D 0 && - (ia =3D ip_rtaddr(ipaddr.sin_addr)) =3D=3D 0) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_HOST; - goto bad; - } - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] +=3D sizeof(struct in_addr); - break; - - case IPOPT_TS: - code =3D cp - (u_char *)ip; - ipt =3D (struct ip_timestamp *)cp; - if (ipt->ipt_len < 5) - goto bad; - if (ipt->ipt_ptr > ipt->ipt_len - sizeof (int32_t)) { - if (++ipt->ipt_oflw =3D=3D 0) - goto bad; - break; - } - sin =3D (struct in_addr *)(cp + ipt->ipt_ptr - 1); - switch (ipt->ipt_flg) { - - case IPOPT_TS_TSONLY: - break; - - case IPOPT_TS_TSANDADDR: - if (ipt->ipt_ptr + sizeof(n_time) + - sizeof(struct in_addr) > ipt->ipt_len) - goto bad; - ipaddr.sin_addr =3D dst; - ia =3D (INA)ifaof_ i f p foraddr((SA)&ipaddr, - m->m_pkthdr.rcvif); - if (ia =3D=3D 0) - continue; - bcopy((caddr_t)&IA_SIN(ia)->sin_addr, - (caddr_t)sin, sizeof(struct in_addr)); - ipt->ipt_ptr +=3D sizeof(struct in_addr); - break; - - case IPOPT_TS_PRESPEC: - if (ipt->ipt_ptr + sizeof(n_time) + - sizeof(struct in_addr) > ipt->ipt_len) - goto bad; - bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr, - sizeof(struct in_addr)); - if (ifa_ifwithaddr((SA)&ipaddr) =3D=3D 0) - continue; - ipt->ipt_ptr +=3D sizeof(struct in_addr); - break; - - default: - goto bad; - } - ntime =3D iptime(); - bcopy((caddr_t)&ntime, (caddr_t)cp + ipt->ipt_ptr - 1, - sizeof(n_time)); - ipt->ipt_ptr +=3D sizeof(n_time); - } - } - if (forward) { - ip_forward(m, 1); - return (1); - } - return (0); -bad: - icmp_send_error(m, type, code, 0, 0); - - return (1); -} - -#endif /* notdef */ - /* * Strip out IP options, at higher * level protocol in the kernel. diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 39821e5a34..0f073d4b38 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -1441,45 +1441,6 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt,= struct tcpiphdr *ti) } } =20 - -/* - * Pull out of band byte out of a segment so - * it doesn't appear in the user's data queue. - * It is still reflected in the segment length for - * sequencing purposes. - */ - -#ifdef notdef - -void -tcp_pulloutofband(so, ti, m) - struct socket *so; - struct tcpiphdr *ti; - register struct mbuf *m; -{ - int cnt =3D ti->ti_urp - 1; - - while (cnt >=3D 0) { - if (m->m_len > cnt) { - char *cp =3D mtod(m, caddr_t) + cnt; - struct tcpcb *tp =3D sototcpcb(so); - - tp->t_iobc =3D *cp; - tp->t_oobflags |=3D TCPOOB_HAVEDATA; - memcpy(sp, cp+1, (unsigned)(m->m_len - cnt - 1)); - m->m_len--; - return; - } - cnt -=3D m->m_len; - m =3D m->m_next; /* XXX WRONG! Fix it! */ - if (m =3D=3D 0) - break; - } - panic("tcp_pulloutofband"); -} - -#endif /* notdef */ - /* * Collect new round-trip time estimate * and update averages and current timeout. --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 15475080431241012.7894284243213; Mon, 14 Jan 2019 15:20:43 -0800 (PST) Received: from localhost ([127.0.0.1]:36337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBWt-00015H-Dy for importer@patchew.org; Mon, 14 Jan 2019 18:20:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004l7-Uf for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7D-0001dj-TR for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37470) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7A-0001SV-5c for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5A7AC1BC2; Mon, 14 Jan 2019 23:53:37 +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 ZTKzpxTJcVRc; Mon, 14 Jan 2019 23:53:35 +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 5FDB21BE6; 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-8D; 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:39 +0100 Message-Id: <20190114225306.21569-39-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 38/65] slirp: remove unused sbflush() 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/sbuf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/slirp/sbuf.h b/slirp/sbuf.h index a722ecb629..644c201341 100644 --- a/slirp/sbuf.h +++ b/slirp/sbuf.h @@ -8,7 +8,6 @@ #ifndef SBUF_H #define SBUF_H =20 -#define sbflush(sb) sbdrop((sb),(sb)->sb_cc) #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) =20 struct sbuf { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 154750821049252.67080286909868; Mon, 14 Jan 2019 15:23:30 -0800 (PST) Received: from localhost ([127.0.0.1]:37088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBZn-0003d0-EP for importer@patchew.org; Mon, 14 Jan 2019 18:23:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004l6-UD for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7E-0001dy-0S for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7B-0001SN-Uj for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:55 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F03A11BC1; Mon, 14 Jan 2019 23:53:36 +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 90SRSJrBNnth; Mon, 14 Jan 2019 23:53:36 +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 63B151BE9; 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-0005fK-A9; 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:40 +0100 Message-Id: <20190114225306.21569-40-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 39/65] slirp: NULL is defined by stddef.h 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/slirp.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index d1b6bcefbb..fdf397256b 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -199,10 +199,6 @@ struct Slirp { void *opaque; }; =20 -#ifndef NULL -#define NULL (void *)0 -#endif - void if_start(Slirp *); =20 int get_dns_addr(struct in_addr *pdns_addr); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507848724337.56129356765746; Mon, 14 Jan 2019 15:17:28 -0800 (PST) Received: from localhost ([127.0.0.1]:35554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBTw-000708-CT for importer@patchew.org; Mon, 14 Jan 2019 18:17:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7D-0004il-Oq for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7A-0001bj-62 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37490) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB79-0001Tc-HR for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 385971BC3; Mon, 14 Jan 2019 23:53:38 +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 ZX9bRRAmarTD; Mon, 14 Jan 2019 23:53:37 +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 6BD421BEA; 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-0005fN-Bo; 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:41 +0100 Message-Id: <20190114225306.21569-41-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 40/65] slirp: remove dead TCP_ACK_HACK code 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: =?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 Untouched since original introduction in 2004. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/tcp_input.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 0f073d4b38..c4d7abf1fa 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -60,27 +60,6 @@ * Set DELACK for segments received in order, but ack immediately * when segments are out of order (so fast retransmit can work). */ -#ifdef TCP_ACK_HACK -#define TCP_REASS(tp, ti, m, so, flags) {\ - if ((ti)->ti_seq =3D=3D (tp)->rcv_nxt && \ - tcpfrag_list_empty(tp) && \ - (tp)->t_state =3D=3D TCPS_ESTABLISHED) {\ - if (ti->ti_flags & TH_PUSH) \ - tp->t_flags |=3D TF_ACKNOW; \ - else \ - tp->t_flags |=3D TF_DELACK; \ - (tp)->rcv_nxt +=3D (ti)->ti_len; \ - flags =3D (ti)->ti_flags & TH_FIN; \ - if (so->so_emu) { \ - if (tcp_emu((so),(m))) sbappend((so), (m)); \ - } else \ - sbappend((so), (m)); \ - } else {\ - (flags) =3D tcp_reass((tp), (ti), (m)); \ - tp->t_flags |=3D TF_ACKNOW; \ - } \ -} -#else #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq =3D=3D (tp)->rcv_nxt && \ tcpfrag_list_empty(tp) && \ @@ -97,7 +76,7 @@ tp->t_flags |=3D TF_ACKNOW; \ } \ } -#endif + static void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti); static void tcp_xmit_timer(register struct tcpcb *tp, int rtt); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547507668625854.1210222998848; Mon, 14 Jan 2019 15:14:28 -0800 (PST) Received: from localhost ([127.0.0.1]:34763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBQs-0004QH-Tp for importer@patchew.org; Mon, 14 Jan 2019 18:14:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7D-0004io-Ou for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7A-0001bo-6A for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB78-0001Ta-6X for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:52 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 80A4B1BC6; Mon, 14 Jan 2019 23:53:38 +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 IY7JGWyprkcW; Mon, 14 Jan 2019 23:53:37 +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 837481BEE; 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-0005fQ-D9; 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:42 +0100 Message-Id: <20190114225306.21569-42-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 41/65] slirp: replace ARRAY_SIZE with G_N_ELEMENTS 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: jan.kiszka@siemens.com, stefanha@redhat.com, Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Do not require QEMU macro. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Samuel Thibault --- slirp/ncsi.c | 2 +- slirp/tftp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 10decfb5ef..8594382270 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -128,7 +128,7 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) memset(reh->h_source, 0xff, ETH_ALEN); reh->h_proto =3D htons(ETH_P_NCSI); =20 - for (i =3D 0; i < ARRAY_SIZE(ncsi_rsp_handlers); i++) { + for (i =3D 0; i < G_N_ELEMENTS(ncsi_rsp_handlers); i++) { if (ncsi_rsp_handlers[i].type =3D=3D nh->type + 0x80) { handler =3D &ncsi_rsp_handlers[i]; break; diff --git a/slirp/tftp.c b/slirp/tftp.c index 735b57aa55..a9ba1480db 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -359,7 +359,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, return; } =20 - while (k < pktlen && nb_options < ARRAY_SIZE(option_name)) { + while (k < pktlen && nb_options < G_N_ELEMENTS(option_name)) { const char *key, *value; =20 key =3D &tp->x.tp_buf[k]; @@ -403,7 +403,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, } =20 if (nb_options > 0) { - assert(nb_options <=3D ARRAY_SIZE(option_name)); + assert(nb_options <=3D G_N_ELEMENTS(option_name)); tftp_send_oack(spt, option_name, option_value, nb_options, tp); return; } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508067635421.537922160598; Mon, 14 Jan 2019 15:21:07 -0800 (PST) Received: from localhost ([127.0.0.1]:36497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBXW-0001fd-Di for importer@patchew.org; Mon, 14 Jan 2019 18:21:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004l5-U3 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7E-0001dt-1D for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37502) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7A-0001UQ-4A for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:54 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 3F1EA836; Mon, 14 Jan 2019 23:53:40 +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 lLjSIUHQ20r6; Mon, 14 Jan 2019 23:53:38 +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 831AF1BED; 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-0005fS-EQ; 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:43 +0100 Message-Id: <20190114225306.21569-43-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 42/65] net: do not depend on slirp internals 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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 Only slirp/libslirp.h should be included. Instead of using some slirp declarations and utility functions directly, let's copy them in net/util.h. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Samuel Thibault --- net/colo-compare.c | 11 +++++---- net/colo.c | 1 + net/colo.h | 7 +++--- net/filter-rewriter.c | 9 +++---- net/slirp.c | 2 +- net/util.h | 55 +++++++++++++++++++++++++++++++++++++++++++ stubs/slirp.c | 2 +- 7 files changed, 72 insertions(+), 15 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 9156ab3349..3e515f3023 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -30,6 +30,7 @@ #include "net/colo-compare.h" #include "migration/colo.h" #include "migration/migration.h" +#include "util.h" =20 #define TYPE_COLO_COMPARE "colo-compare" #define COLO_COMPARE(obj) \ @@ -129,19 +130,19 @@ static int compare_chr_send(CompareState *s, =20 static gint seq_sorter(Packet *a, Packet *b, gpointer data) { - struct tcphdr *atcp, *btcp; + struct tcp_hdr *atcp, *btcp; =20 - atcp =3D (struct tcphdr *)(a->transport_header); - btcp =3D (struct tcphdr *)(b->transport_header); + atcp =3D (struct tcp_hdr *)(a->transport_header); + btcp =3D (struct tcp_hdr *)(b->transport_header); return ntohl(atcp->th_seq) - ntohl(btcp->th_seq); } =20 static void fill_pkt_tcp_info(void *data, uint32_t *max_ack) { Packet *pkt =3D data; - struct tcphdr *tcphd; + struct tcp_hdr *tcphd; =20 - tcphd =3D (struct tcphdr *)pkt->transport_header; + tcphd =3D (struct tcp_hdr *)pkt->transport_header; =20 pkt->tcp_seq =3D ntohl(tcphd->th_seq); pkt->tcp_ack =3D ntohl(tcphd->th_ack); diff --git a/net/colo.c b/net/colo.c index 49176bf07b..8196b35837 100644 --- a/net/colo.c +++ b/net/colo.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "trace.h" #include "colo.h" +#include "util.h" =20 uint32_t connection_key_hash(const void *opaque) { diff --git a/net/colo.h b/net/colo.h index 11c5226488..b21c6830b5 100644 --- a/net/colo.h +++ b/net/colo.h @@ -15,10 +15,9 @@ #ifndef QEMU_COLO_PROXY_H #define QEMU_COLO_PROXY_H =20 -#include "slirp/slirp.h" #include "qemu/jhash.h" #include "qemu/timer.h" -#include "slirp/tcp.h" +#include "net/eth.h" =20 #define HASHTABLE_MAX_SIZE 16384 =20 @@ -81,10 +80,10 @@ typedef struct Connection { /* the maximum of acknowledgement number in secondary_list queue */ uint32_t sack; /* offset =3D secondary_seq - primary_seq */ - tcp_seq offset; + uint32_t offset; =20 int tcp_state; /* TCP FSM state */ - tcp_seq fin_ack_seq; /* the seq of 'fin=3D1,ack=3D1' */ + uint32_t fin_ack_seq; /* the seq of 'fin=3D1,ack=3D1' */ } Connection; =20 uint32_t connection_key_hash(const void *opaque); diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 2e26839bc2..b464abe5e8 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -22,6 +22,7 @@ #include "net/checksum.h" #include "net/colo.h" #include "migration/colo.h" +#include "util.h" =20 #define FILTER_COLO_REWRITER(obj) \ OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER) @@ -73,9 +74,9 @@ static int handle_primary_tcp_pkt(RewriterState *rf, Connection *conn, Packet *pkt, ConnectionKey *key) { - struct tcphdr *tcp_pkt; + struct tcp_hdr *tcp_pkt; =20 - tcp_pkt =3D (struct tcphdr *)pkt->transport_header; + tcp_pkt =3D (struct tcp_hdr *)pkt->transport_header; if (trace_event_get_state_backends(TRACE_COLO_FILTER_REWRITER_DEBUG)) { trace_colo_filter_rewriter_pkt_info(__func__, inet_ntoa(pkt->ip->ip_src), inet_ntoa(pkt->ip->ip_dst), @@ -176,9 +177,9 @@ static int handle_secondary_tcp_pkt(RewriterState *rf, Connection *conn, Packet *pkt, ConnectionKey *key) { - struct tcphdr *tcp_pkt; + struct tcp_hdr *tcp_pkt; =20 - tcp_pkt =3D (struct tcphdr *)pkt->transport_header; + tcp_pkt =3D (struct tcp_hdr *)pkt->transport_header; =20 if (trace_event_get_state_backends(TRACE_COLO_FILTER_REWRITER_DEBUG)) { trace_colo_filter_rewriter_pkt_info(__func__, diff --git a/net/slirp.c b/net/slirp.c index ea8b04e007..b1c98b9470 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -38,12 +38,12 @@ #include "qemu/error-report.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" -#include "slirp/ip6.h" #include "chardev/char-fe.h" #include "sysemu/sysemu.h" #include "qemu/cutils.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" +#include "util.h" =20 static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { diff --git a/net/util.h b/net/util.h index 60b73d372d..358185fd50 100644 --- a/net/util.h +++ b/net/util.h @@ -26,6 +26,61 @@ #define QEMU_NET_UTIL_H =20 =20 +/* + * Structure of an internet header, naked of options. + */ +struct ip { +#ifdef HOST_WORDS_BIGENDIAN + uint8_t ip_v:4, /* version */ + ip_hl:4; /* header length */ +#else + uint8_t ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif + uint8_t ip_tos; /* type of service */ + uint16_t ip_len; /* total length */ + uint16_t ip_id; /* identification */ + uint16_t ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* don't fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + uint8_t ip_ttl; /* time to live */ + uint8_t ip_p; /* protocol */ + uint16_t ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +} QEMU_PACKED; + +static inline bool in6_equal_net(const struct in6_addr *a, + const struct in6_addr *b, + int prefix_len) +{ + if (memcmp(a, b, prefix_len / 8) !=3D 0) { + return 0; + } + + if (prefix_len % 8 =3D=3D 0) { + return 1; + } + + return a->s6_addr[prefix_len / 8] >> (8 - (prefix_len % 8)) + =3D=3D b->s6_addr[prefix_len / 8] >> (8 - (prefix_len % 8)); +} + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK = */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN AC= K */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close= */ + int net_parse_macaddr(uint8_t *macaddr, const char *p); =20 #endif /* QEMU_NET_UTIL_H */ diff --git a/stubs/slirp.c b/stubs/slirp.c index 42f7e1afd0..70704346fd 100644 --- a/stubs/slirp.c +++ b/stubs/slirp.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/host-utils.h" -#include "slirp/slirp.h" +#include "slirp/libslirp.h" =20 void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509469587380.89353531938855; Mon, 14 Jan 2019 15:44:29 -0800 (PST) Received: from localhost ([127.0.0.1]:42409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBu8-0003uR-Hv for importer@patchew.org; Mon, 14 Jan 2019 18:44:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004lA-Uu for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7E-0001ee-AK for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7D-0001W8-Sh for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:56 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0DE0F94F; 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 iIcpfhzlDtko; 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 A19491BF1; 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-0005fV-Gc; 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:44 +0100 Message-Id: <20190114225306.21569-44-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 43/65] glib-compat: add g_spawn_async_with_fds() fallback 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- include/glib-compat.h | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/include/glib-compat.h b/include/glib-compat.h index fdf95a255d..8a078c5288 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -83,6 +83,62 @@ static inline gboolean g_strv_contains_qemu(const gchar = *const *strv, } #define g_strv_contains(a, b) g_strv_contains_qemu(a, b) =20 +#if !GLIB_CHECK_VERSION(2, 58, 0) +typedef struct QemuGSpawnFds { + GSpawnChildSetupFunc child_setup; + gpointer user_data; + gint stdin_fd; + gint stdout_fd; + gint stderr_fd; +} QemuGSpawnFds; + +static inline void +qemu_gspawn_fds_setup(gpointer user_data) +{ + QemuGSpawnFds *q =3D (QemuGSpawnFds *)user_data; + + dup2(q->stdin_fd, 0); + dup2(q->stdout_fd, 1); + dup2(q->stderr_fd, 2); + q->child_setup(q->user_data); +} +#endif + +static inline gboolean +g_spawn_async_with_fds_qemu(const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint stdin_fd, + gint stdout_fd, + gint stderr_fd, + GError **error) +{ +#if GLIB_CHECK_VERSION(2, 58, 0) + return g_spawn_async_with_fds(working_directory, argv, envp, flags, + child_setup, user_data, + child_pid, stdin_fd, stdout_fd, stderr_f= d, + error); +#else + QemuGSpawnFds setup =3D { + .child_setup =3D child_setup, + .user_data =3D user_data, + .stdin_fd =3D stdin_fd, + .stdout_fd =3D stdout_fd, + .stderr_fd =3D stderr_fd, + }; + + return g_spawn_async(working_directory, argv, envp, flags, + qemu_gspawn_fds_setup, &setup, + child_pid, error); +#endif +} + +#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, e= rr) \ + g_spawn_async_with_fds_qemu(wd, argv, env, f, c, d, p, ifd, ofd, efd, = err) =20 #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 15475082530791017.005258124219; Mon, 14 Jan 2019 15:24:13 -0800 (PST) Received: from localhost ([127.0.0.1]:37267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBaW-0004At-19 for importer@patchew.org; Mon, 14 Jan 2019 18:24:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7H-0004n1-Q1 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 1gjB7E-0001el-Bf for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37510) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7D-0001Us-VI for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:56 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E8C671BB9; Mon, 14 Jan 2019 23:53:40 +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 9YOcN8k7DSpM; Mon, 14 Jan 2019 23:53:39 +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 9FCA31BF0; 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-0005fY-IV; 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:45 +0100 Message-Id: <20190114225306.21569-45-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 44/65] slirp: simplify fork_exec() 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: =?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 Use g_spawn_async_with_fds() to setup the child. GSpawn handles reaping the child, and closing parent file descriptors. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 75 +++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index ee3492a2ae..753b3da25b 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -129,56 +129,53 @@ err: return -1; } =20 +static void +fork_exec_child_setup(gpointer data) +{ + setsid(); +} + int fork_exec(struct socket *so, const char *ex) { - char **argv; - int opt, c, sp[2]; - pid_t pid; + GError *err =3D NULL; + char **argv; + int opt, sp[2]; =20 - DEBUG_CALL("fork_exec"); - DEBUG_ARG("so =3D %p", so); - DEBUG_ARG("ex =3D %p", ex); + DEBUG_CALL("fork_exec"); + DEBUG_ARG("so =3D %p", so); + DEBUG_ARG("ex =3D %p", ex); =20 if (slirp_socketpair_with_oob(sp) < 0) { return 0; } =20 - pid =3D fork(); - switch(pid) { - case -1: - error_report("Error: fork failed: %s", strerror(errno)); - closesocket(sp[0]); - closesocket(sp[1]); - return 0; - - case 0: - setsid(); - dup2(sp[1], 0); - dup2(sp[1], 1); - dup2(sp[1], 2); - for (c =3D getdtablesize() - 1; c >=3D 3; c--) - close(c); + argv =3D g_strsplit(ex, " ", -1); + g_spawn_async_with_fds(NULL /* cwd */, + argv, + NULL /* env */, + G_SPAWN_SEARCH_PATH, + fork_exec_child_setup, NULL /* data */, + NULL /* child_pid */, + sp[1], sp[1], sp[1], + &err); + g_strfreev(argv); =20 - argv =3D g_strsplit(ex, " ", -1); - execvp(argv[0], (char **)argv); - - /* Ooops, failed, let's tell the user why */ - fprintf(stderr, "Error: execvp of %s failed: %s\n", - argv[0], strerror(errno)); - close(0); close(1); close(2); /* XXX */ - exit(1); + if (err) { + error_report("%s", err->message); + g_error_free(err); + closesocket(sp[0]); + closesocket(sp[1]); + return 0; + } =20 - default: - so->s =3D sp[0]; - closesocket(sp[1]); - qemu_add_child_watch(pid); - socket_set_fast_reuse(so->s); - opt =3D 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); - qemu_set_nonblock(so->s); - return 1; - } + so->s =3D sp[0]; + closesocket(sp[1]); + socket_set_fast_reuse(so->s); + opt =3D 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + qemu_set_nonblock(so->s); + return 1; } #endif =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547507884181232.1054996788414; Mon, 14 Jan 2019 15:18:04 -0800 (PST) Received: from localhost ([127.0.0.1]:35728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBUZ-0007Xb-4w for importer@patchew.org; Mon, 14 Jan 2019 18:18:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7F-0004l4-Tm for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7E-0001e3-1V for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:57 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37518) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7A-0001VE-6d for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:53 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2E3BD130C; Mon, 14 Jan 2019 23:53:41 +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 LvHadRFasz4C; Mon, 14 Jan 2019 23:53:40 +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 A1C461BF2; 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-0005fb-K1; 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:46 +0100 Message-Id: <20190114225306.21569-46-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 45/65] slirp: replace error_report() with g_critical() 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: =?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 Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slirp/misc.c b/slirp/misc.c index 753b3da25b..b141446319 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -162,7 +162,7 @@ fork_exec(struct socket *so, const char *ex) g_strfreev(argv); =20 if (err) { - error_report("%s", err->message); + g_critical("fork_exec: %s", err->message); g_error_free(err); closesocket(sp[0]); closesocket(sp[1]); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508573498458.31384528186686; Mon, 14 Jan 2019 15:29:33 -0800 (PST) Received: from localhost ([127.0.0.1]:38648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBfg-0000O8-8M for importer@patchew.org; Mon, 14 Jan 2019 18:29:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7J-0004nM-05 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-0001i4-6T for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:00 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37596) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7H-0001Yq-Se 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 B74DB1BC7; Mon, 14 Jan 2019 23:53:45 +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 03zXdi1Z6NhV; Mon, 14 Jan 2019 23:53:44 +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 0AC801BFA; 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-0005fe-LP; 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:47 +0100 Message-Id: <20190114225306.21569-47-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 46/65] slirp: Enable fork_exec support on Windows 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: Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , 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" g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there. Thanks Daniel P. Berrang=C3=A9 for the notice! Signed-off-by: Samuel Thibault Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/misc.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index b141446319..2d092624d3 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -62,17 +62,6 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, con= st char *cmdline, } =20 =20 -#ifdef _WIN32 - -int -fork_exec(struct socket *so, const char *ex) -{ - /* not implemented */ - return 0; -} - -#else - static int slirp_socketpair_with_oob(int sv[2]) { @@ -132,7 +121,9 @@ err: static void fork_exec_child_setup(gpointer data) { +#ifndef _WIN32 setsid(); +#endif } =20 int @@ -177,7 +168,6 @@ fork_exec(struct socket *so, const char *ex) qemu_set_nonblock(so->s); return 1; } -#endif =20 char *slirp_connection_info(Slirp *slirp) { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547509713034443.17129362055994; Mon, 14 Jan 2019 15:48:33 -0800 (PST) Received: from localhost ([127.0.0.1]:43545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBxz-0007GI-18 for importer@patchew.org; Mon, 14 Jan 2019 18:48:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7J-0004nQ-PL for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7I-0001iU-CZ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:01 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7H-0001X0-Vc 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 7CAE21BC5; Mon, 14 Jan 2019 23:53:43 +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 8WbLqPbF663d; Mon, 14 Jan 2019 23:53:42 +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 D9CDF1BF5; 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-0005fk-OH; 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:49 +0100 Message-Id: <20190114225306.21569-49-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 48/65] slirp: rename exec_list 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: =?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 This list is not only used to handle command to execute on guest connection, it can also redirect to an arbitrary object, such as a chardev. Let's rename the struct and the field to "guestfwd". Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 6 +++--- slirp/misc.h | 6 +++--- slirp/slirp.c | 18 +++++++++--------- slirp/slirp.h | 2 +- slirp/tcp_input.c | 6 +++--- slirp/tcp_subr.c | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index 2d092624d3..526cefa0f1 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -36,10 +36,10 @@ remque(void *a) element->qh_rlink =3D NULL; } =20 -int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline, +int add_exec(struct gfwd_list **ex_ptr, void *chardev, const char *cmdline, struct in_addr addr, int port) { - struct ex_list *tmp_ptr; + struct gfwd_list *tmp_ptr; =20 /* First, check if the port is "bound" */ for (tmp_ptr =3D *ex_ptr; tmp_ptr; tmp_ptr =3D tmp_ptr->ex_next) { @@ -49,7 +49,7 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, cons= t char *cmdline, } =20 tmp_ptr =3D *ex_ptr; - *ex_ptr =3D g_new0(struct ex_list, 1); + *ex_ptr =3D g_new0(struct gfwd_list, 1); (*ex_ptr)->ex_fport =3D port; (*ex_ptr)->ex_addr =3D addr; if (chardev) { diff --git a/slirp/misc.h b/slirp/misc.h index 0bc5e74bc5..1df707c052 100644 --- a/slirp/misc.h +++ b/slirp/misc.h @@ -8,12 +8,12 @@ #ifndef MISC_H #define MISC_H =20 -struct ex_list { +struct gfwd_list { void *ex_chardev; struct in_addr ex_addr; /* Server address */ int ex_fport; /* Port to telnet to */ char *ex_exec; /* Command line of what to exec */ - struct ex_list *ex_next; + struct gfwd_list *ex_next; }; =20 #define EMU_NONE 0x0 @@ -51,7 +51,7 @@ struct slirp_quehead { =20 void slirp_insque(void *, void *); void slirp_remque(void *); -int add_exec(struct ex_list **, void *, const char *, struct in_addr, int); +int add_exec(struct gfwd_list **, void *, const char *, struct in_addr, in= t); int fork_exec(struct socket *so, const char *ex); =20 #endif diff --git a/slirp/slirp.c b/slirp/slirp.c index 591dd1fcb4..e860750f72 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -345,9 +345,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, stru= ct in_addr vnetwork, =20 void slirp_cleanup(Slirp *slirp) { - struct ex_list *e, *next; + struct gfwd_list *e, *next; =20 - for (e =3D slirp->exec_list; e; e =3D next) { + for (e =3D slirp->guestfwd_list; e; e =3D next) { next =3D e->ex_next; g_free(e->ex_exec); g_free(e); @@ -760,7 +760,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt,= int pkt_len) struct ethhdr *reh =3D (struct ethhdr *)arp_reply; struct slirp_arphdr *rah =3D (struct slirp_arphdr *)(arp_reply + ETH_H= LEN); int ar_op; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; =20 if (!slirp->in_enabled) { return; @@ -780,7 +780,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt,= int pkt_len) if (ah->ar_tip =3D=3D slirp->vnameserver_addr.s_addr || ah->ar_tip =3D=3D slirp->vhost_addr.s_addr) goto arp_ok; - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->e= x_next) { + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_pt= r->ex_next) { if (ex_ptr->ex_addr.s_addr =3D=3D ah->ar_tip) goto arp_ok; } @@ -1052,7 +1052,7 @@ int slirp_add_exec(Slirp *slirp, void *chardev, const= char *cmdline, return -1; } =20 - return add_exec(&slirp->exec_list, chardev, cmdline, *guest_addr, + return add_exec(&slirp->guestfwd_list, chardev, cmdline, *guest_addr, htons(guest_port)); } =20 @@ -1423,9 +1423,9 @@ static const VMStateDescription vmstate_slirp =3D { static void slirp_state_save(QEMUFile *f, void *opaque) { Slirp *slirp =3D opaque; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; =20 - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_next) + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) if (ex_ptr->ex_chardev) { struct socket *so; so =3D slirp_find_ctl_socket(slirp, ex_ptr->ex_addr, @@ -1445,7 +1445,7 @@ static void slirp_state_save(QEMUFile *f, void *opaqu= e) static int slirp_state_load(QEMUFile *f, void *opaque, int version_id) { Slirp *slirp =3D opaque; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; =20 while (qemu_get_byte(f)) { int ret; @@ -1460,7 +1460,7 @@ static int slirp_state_load(QEMUFile *f, void *opaque= , int version_id) slirp->vnetwork_addr.s_addr) { return -EINVAL; } - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_ptr->e= x_next) { if (ex_ptr->ex_chardev && so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr && so->so_fport =3D=3D ex_ptr->ex_fport) { diff --git a/slirp/slirp.h b/slirp/slirp.h index fdf397256b..9aa245715d 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -147,7 +147,7 @@ struct Slirp { char client_hostname[33]; =20 int restricted; - struct ex_list *exec_list; + struct gfwd_list *guestfwd_list; =20 /* mbuf states */ struct quehead m_freelist; diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index c4d7abf1fa..f1cddce992 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -211,7 +211,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *in= so, unsigned short af) struct sockaddr_storage lhost, fhost; struct sockaddr_in *lhost4, *fhost4; struct sockaddr_in6 *lhost6, *fhost6; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; Slirp *slirp; =20 DEBUG_CALL("tcp_input"); @@ -394,7 +394,7 @@ findso: * for non-hostfwd connections. These should be dropped, unles= s it * happens to be a guestfwd. */ - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->e= x_next) { + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_pt= r->ex_next) { if (ex_ptr->ex_fport =3D=3D ti->ti_dport && ti->ti_dst.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { break; @@ -616,7 +616,7 @@ findso: if (so->so_faddr.s_addr !=3D slirp->vhost_addr.s_addr && so->so_faddr.s_addr !=3D slirp->vnameserver_addr.s_addr) { /* May be an add exec */ - for (ex_ptr =3D slirp->exec_list; ex_ptr; + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_ptr->ex_next) { if(ex_ptr->ex_fport =3D=3D so->so_fport && so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 00cee73163..3b14684107 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -949,14 +949,14 @@ int tcp_ctl(struct socket *so) { Slirp *slirp =3D so->slirp; struct sbuf *sb =3D &so->so_snd; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; =20 DEBUG_CALL("tcp_ctl"); DEBUG_ARG("so =3D %p", so); =20 if (so->so_faddr.s_addr !=3D slirp->vhost_addr.s_addr) { /* Check if it's pty_exec */ - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { + for (ex_ptr =3D slirp->guestfwd_list; ex_ptr; ex_ptr =3D ex_ptr->e= x_next) { if (ex_ptr->ex_fport =3D=3D so->so_fport && so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547508406482437.6253937873887; Mon, 14 Jan 2019 15:26:46 -0800 (PST) Received: from localhost ([127.0.0.1]:37908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBct-0006Lw-UJ for importer@patchew.org; Mon, 14 Jan 2019 18:26:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7K-0004nX-C5 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7I-0001iM-B5 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:02 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40604) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7I-0001Xo-1C 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 00F701BC8; Mon, 14 Jan 2019 23:53:45 +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 MiLQ1yU_yGRr; Mon, 14 Jan 2019 23:53:42 +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 E0D431BF6; 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-0005fn-Q3; 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:50 +0100 Message-Id: <20190114225306.21569-50-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 49/65] slirp: use virtual time for packet expiration 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , 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 Make all packets expiration time based on virtual clock. Suggested-by: Paolo Bonzini Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/if.c | 2 +- slirp/slirp.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/slirp/if.c b/slirp/if.c index aa88cc4e76..ce4f5fac53 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -148,7 +148,7 @@ diddit: */ void if_start(Slirp *slirp) { - uint64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); + uint64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); bool from_batchq =3D false; struct mbuf *ifm, *ifm_next, *ifqt; =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index e860750f72..7091c3998a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -582,7 +582,7 @@ void slirp_pollfds_poll(GArray *pollfds, int select_err= or) return; } =20 - curtime =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + curtime =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); =20 QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* @@ -909,7 +909,8 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ - ifm->expiration_date =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME= ) + 1000000000ULL; + ifm->expiration_date =3D + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; } return 0; } else { @@ -936,7 +937,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, ndp_send_ns(slirp, ip6h->ip_dst); ifm->resolution_requested =3D true; ifm->expiration_date =3D - qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL; + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; } return 0; } else { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509632100847.6371305019437; Mon, 14 Jan 2019 15:47:12 -0800 (PST) Received: from localhost ([127.0.0.1]:43177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBwl-0006YE-1D for importer@patchew.org; Mon, 14 Jan 2019 18:47:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7I-0004nK-No 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 1gjB7H-0001hb-TJ for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:00 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7F-0001XM-V3 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:59 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 1A0DA1BB7; Mon, 14 Jan 2019 23:53:44 +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 O3oP9XM4ixyY; Mon, 14 Jan 2019 23:53:43 +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 F1DAD1BF7; 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-0005fp-Ru; 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:51 +0100 Message-Id: <20190114225306.21569-51-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 50/65] slirp: replace a fprintf with g_critical() 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: =?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 Reduce dependency on QEMU. QEMU could use a custom glib log handler if it wants to redirect/filter it. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slirp/socket.c b/slirp/socket.c index 677fd20c9d..08a065f6a7 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -285,7 +285,7 @@ err: =20 sofcantrcvmore(so); tcp_sockclosed(sototcpcb(so)); - fprintf(stderr, "soreadbuf buffer to small"); + g_critical("soreadbuf buffer too small"); return -1; } =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508214823588.6698491195688; Mon, 14 Jan 2019 15:23:34 -0800 (PST) Received: from localhost ([127.0.0.1]:37106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBZr-0003fo-JG for importer@patchew.org; Mon, 14 Jan 2019 18:23:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7I-0004nL-U1 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-0001hk-1I for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:00 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7H-0001Xd-O0 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:53:59 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id B7E191BC9; Mon, 14 Jan 2019 23:53:44 +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 ufCrb67bXfUB; Mon, 14 Jan 2019 23:53:44 +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 F232C1BF8; 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-0005fs-U4; 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:52 +0100 Message-Id: <20190114225306.21569-52-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 51/65] slirp: replace some fprintf() with DEBUG_MISC 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: =?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 Remove some clutter, and avoids direct call to fprintf(). Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/slirp.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index 7091c3998a..ce5f571d0f 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -164,9 +164,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_= addr, void *cached_addr, if (!f) return -1; =20 -#ifdef DEBUG - fprintf(stderr, "IP address of your DNS(s): "); -#endif + DEBUG_MISC("IP address of your DNS(s): "); while (fgets(buff, 512, f) !=3D NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) =3D=3D 1) { char *c =3D strchr(buff2, '%'); @@ -188,15 +186,12 @@ static int get_dns_addr_resolv_conf(int af, void *pdn= s_addr, void *cached_addr, *scope_id =3D if_index; } *cached_time =3D curtime; + } else { + DEBUG_MISC(", "); } -#ifdef DEBUG - else - fprintf(stderr, ", "); -#endif + if (++found > 3) { -#ifdef DEBUG - fprintf(stderr, "(more)"); -#endif + DEBUG_MISC("(more)"); break; } #ifdef DEBUG @@ -206,7 +201,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_= addr, void *cached_addr, if (!res) { res =3D "(string conversion error)"; } - fprintf(stderr, "%s", res); + DEBUG_MISC("%s", res); } #endif } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508584241247.24877607279382; Mon, 14 Jan 2019 15:29:44 -0800 (PST) Received: from localhost ([127.0.0.1]:38683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBfr-0000eZ-5I for importer@patchew.org; Mon, 14 Jan 2019 18:29:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7L-0004p4-6K for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7K-0001lb-Da for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:03 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7K-0001aE-49 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EF0891BD0; Mon, 14 Jan 2019 23:53:45 +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 R64mWqDCE2P1; Mon, 14 Jan 2019 23:53:45 +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 110631BFB; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6U-0005fv-Vd; 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:53 +0100 Message-Id: <20190114225306.21569-53-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 52/65] slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG 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: =?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 icmp_send_error() doesnt actually log messages when DEBUG is enabled. Let's use a different define that describes better the tweaked behaviour of the function, and avoid uncompiled code. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/ip_icmp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index af11cfcefe..6c7e375ff8 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -34,6 +34,10 @@ #include "slirp.h" #include "ip_icmp.h" =20 +#ifndef WITH_ICMP_ERROR_MSG +#define WITH_ICMP_ERROR_MSG 0 +#endif + /* The message sent when emulating PING */ /* Be nice and tell them it's just a pseudo-ping packet */ static const char icmp_ping_msg[] =3D "This is a pseudo-PING packet used b= y Slirp to emulate ICMP ECHO-REQUEST packets.\n"; @@ -319,8 +323,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char = code, int minsize, HTONS(icp->icmp_ip.ip_id); HTONS(icp->icmp_ip.ip_off); =20 -#ifdef DEBUG - if(message) { /* DEBUG : append message to ICMP packet */ + if (message && WITH_ICMP_ERROR_MSG) { /* append message to ICMP packet */ int message_len; char *cpnt; message_len=3Dstrlen(message); @@ -329,7 +332,6 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char = code, int minsize, memcpy(cpnt, message, message_len); m->m_len+=3Dmessage_len; } -#endif =20 icp->icmp_cksum =3D 0; icp->icmp_cksum =3D cksum(m, m->m_len); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509788518978.3842027357734; Mon, 14 Jan 2019 15:49:48 -0800 (PST) Received: from localhost ([127.0.0.1]:43874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBzH-0007yg-K9 for importer@patchew.org; Mon, 14 Jan 2019 18:49:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7O-0004ui-CU for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7N-0001ns-NB for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37624) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7N-0001aF-Gp for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A1AE01BCC; Mon, 14 Jan 2019 23:53:46 +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 k_Wf4l7Rq2Hk; Mon, 14 Jan 2019 23:53:45 +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 2324F1BFD; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005fy-1G; Mon, 14 Jan 2019 23:53:11 +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:54 +0100 Message-Id: <20190114225306.21569-54-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 53/65] slirp: no need to make DPRINTF conditional on DEBUG 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: =?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 DEBUG_CALL is already handled conditionally. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/bootp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/slirp/bootp.c b/slirp/bootp.c index 5ab6692038..4c9a77eb98 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -36,11 +36,7 @@ =20 static const uint8_t rfc1533_cookie[] =3D { RFC1533_COOKIE }; =20 -#ifdef DEBUG #define DPRINTF(fmt, ...) DEBUG_CALL(fmt, ##__VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do{}while(0) -#endif =20 static BOOTPClient *get_new_addr(Slirp *slirp, struct in_addr *paddr, const uint8_t *macaddr) @@ -166,8 +162,9 @@ static void bootp_reply(Slirp *slirp, const struct boot= p_t *bp) DPRINTF("bootp packet op=3D%d msgtype=3D%d", bp->bp_op, dhcp_msg_type); if (preq_addr.s_addr !=3D htonl(0L)) DPRINTF(" req_addr=3D%08" PRIx32 "\n", ntohl(preq_addr.s_addr)); - else + else { DPRINTF("\n"); + } =20 if (dhcp_msg_type =3D=3D 0) dhcp_msg_type =3D DHCPREQUEST; /* Force reply for old BOOTP client= s */ --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508621628107.0109556254215; Mon, 14 Jan 2019 15:30:21 -0800 (PST) Received: from localhost ([127.0.0.1]:38857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBgS-00017j-Ie for importer@patchew.org; Mon, 14 Jan 2019 18:30:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7P-0004vW-1a for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7O-0001oI-8x for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37650) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7O-0001c3-00 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D54621BD4; Mon, 14 Jan 2019 23:53:46 +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 SubOFUsKGpRV; Mon, 14 Jan 2019 23:53:46 +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 2A3F81BFE; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005g1-2Z; Mon, 14 Jan 2019 23:53:11 +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:55 +0100 Message-Id: <20190114225306.21569-55-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 54/65] slirp: always build with debug statements 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: =?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 Make debug statements condiitonal only on slirp_debug flags, instead of the pre-processor DEBUG blocks, as it may introduce breakage easily, since the debug code isn't always compiled. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/debug.h | 15 +++------------ slirp/misc.c | 6 +++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/slirp/debug.h b/slirp/debug.h index ca3a4b04da..ff920f0b87 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -5,9 +5,8 @@ * terms and conditions of the copyright. */ =20 -//#define DEBUG 1 - -#ifdef DEBUG +#ifndef DEBUG_H_ +#define DEBUG_H_ =20 #define DBG_CALL 0x1 #define DBG_MISC 0x2 @@ -50,12 +49,4 @@ extern int slirp_debug; } \ } while (0) =20 -#else - -#define DEBUG_CALL(fmt, ...) -#define DEBUG_ARG(fmt, ...) -#define DEBUG_ARGS(fmt, ...) -#define DEBUG_MISC(fmt, ...) -#define DEBUG_ERROR(fmt, ...) - -#endif +#endif /* DEBUG_H_ */ diff --git a/slirp/misc.c b/slirp/misc.c index 526cefa0f1..e30d2ceb2a 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -12,9 +12,13 @@ #include "qemu/main-loop.h" =20 #ifdef DEBUG -int slirp_debug =3D DBG_CALL|DBG_MISC|DBG_ERROR; +#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR) +#else +#define SLIRP_DEBUG 0 #endif =20 +int slirp_debug =3D SLIRP_DEBUG; + inline void insque(void *a, void *b) { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547509874036837.7093492388993; Mon, 14 Jan 2019 15:51:14 -0800 (PST) Received: from localhost ([127.0.0.1]:44224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjC0Z-0000Mn-S7 for importer@patchew.org; Mon, 14 Jan 2019 18:51:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7P-0004vV-15 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7O-0001oU-9j for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7O-0001c6-1P for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A44EB1BBE; Mon, 14 Jan 2019 23:53:47 +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 ghyZ_F4JrB9x; Mon, 14 Jan 2019 23:53:46 +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 2DDDA1BFF; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005g4-3p; Mon, 14 Jan 2019 23:53:11 +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:56 +0100 Message-Id: <20190114225306.21569-56-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 55/65] slirp: introduce SLIRP_DEBUG environment variable 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: =?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 Learn to read SLIRP_DEBUG=3Dcall,misc,error (all or help also handled) to set the slirp_debug flags. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 8 -------- slirp/slirp.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index e30d2ceb2a..a0f104be5e 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -11,14 +11,6 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" =20 -#ifdef DEBUG -#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR) -#else -#define SLIRP_DEBUG 0 -#endif - -int slirp_debug =3D SLIRP_DEBUG; - inline void insque(void *a, void *b) { diff --git a/slirp/slirp.c b/slirp/slirp.c index ce5f571d0f..0b70cb9fb6 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -35,6 +35,8 @@ #include #endif =20 +int slirp_debug; + /* Define to 1 if you want KEEPALIVE timers */ bool slirp_do_keepalive; =20 @@ -250,6 +252,7 @@ int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t= *scope_id) static void slirp_init_once(void) { static int initialized; + const char *debug; #ifdef _WIN32 WSADATA Data; #endif @@ -266,6 +269,18 @@ static void slirp_init_once(void) =20 loopback_addr.s_addr =3D htonl(INADDR_LOOPBACK); loopback_mask =3D htonl(IN_CLASSA_NET); + + debug =3D g_getenv("SLIRP_DEBUG"); + if (debug) { + const GDebugKey keys[] =3D { + { "call", DBG_CALL }, + { "misc", DBG_MISC }, + { "error", DBG_ERROR }, + }; + slirp_debug =3D g_parse_debug_string(debug, keys, G_N_ELEMENTS(key= s)); + } + + } =20 static void slirp_state_save(QEMUFile *f, void *opaque); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509945010248.89695095783247; Mon, 14 Jan 2019 15:52:25 -0800 (PST) Received: from localhost ([127.0.0.1]:44580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjC1o-000138-43 for importer@patchew.org; Mon, 14 Jan 2019 18:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7S-00050K-UA for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001r4-5m for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7R-0001eW-TS for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id AB6841BD8; Mon, 14 Jan 2019 23:53:51 +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 WzyP2eYrOFFV; Mon, 14 Jan 2019 23:53:50 +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 968501C08; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005g7-5x; Mon, 14 Jan 2019 23:53:11 +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:57 +0100 Message-Id: <20190114225306.21569-57-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 56/65] slirp: use %p for pointers format 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: =?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 This fixes some compilation warnings on mingw64. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/ip6_icmp.c | 2 +- slirp/ip6_input.c | 2 +- slirp/ip6_output.c | 4 ++-- slirp/udp6.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 595a62c8d4..bce075913c 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -390,7 +390,7 @@ void icmp6_input(struct mbuf *m) int hlen =3D sizeof(struct ip6); =20 DEBUG_CALL("icmp6_input"); - DEBUG_ARG("m =3D %lx", (long) m); + DEBUG_ARG("m =3D %p", m); DEBUG_ARG("m_len =3D %d", m->m_len); =20 if (ntohs(ip->ip_pl) < ICMP6_MINLEN) { diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c index ac2e3ea882..ab656a0a9d 100644 --- a/slirp/ip6_input.c +++ b/slirp/ip6_input.c @@ -31,7 +31,7 @@ void ip6_input(struct mbuf *m) } =20 DEBUG_CALL("ip6_input"); - DEBUG_ARG("m =3D %lx", (long)m); + DEBUG_ARG("m =3D %p", m); DEBUG_ARG("m_len =3D %d", m->m_len); =20 if (m->m_len < sizeof(struct ip6)) { diff --git a/slirp/ip6_output.c b/slirp/ip6_output.c index 762cbfe89c..52c88ad691 100644 --- a/slirp/ip6_output.c +++ b/slirp/ip6_output.c @@ -19,8 +19,8 @@ int ip6_output(struct socket *so, struct mbuf *m, int fas= t) struct ip6 *ip =3D mtod(m, struct ip6 *); =20 DEBUG_CALL("ip6_output"); - DEBUG_ARG("so =3D %lx", (long)so); - DEBUG_ARG("m =3D %lx", (long)m); + DEBUG_ARG("so =3D %p", so); + DEBUG_ARG("m =3D %p", m); =20 /* Fill IPv6 header */ ip->ip_v =3D IP6VERSION; diff --git a/slirp/udp6.c b/slirp/udp6.c index 473ba1586e..8cdb1892e2 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -20,7 +20,7 @@ void udp6_input(struct mbuf *m) struct sockaddr_in6 lhost; =20 DEBUG_CALL("udp6_input"); - DEBUG_ARG("m =3D %lx", (long)m); + DEBUG_ARG("m =3D %p", m); =20 if (slirp->restricted) { goto bad; @@ -144,8 +144,8 @@ int udp6_output(struct socket *so, struct mbuf *m, struct udphdr *uh; =20 DEBUG_CALL("udp6_output"); - DEBUG_ARG("so =3D %lx", (long)so); - DEBUG_ARG("m =3D %lx", (long)m); + DEBUG_ARG("so =3D %p", so); + DEBUG_ARG("m =3D %p", m); =20 /* adjust for header */ m->m_data -=3D sizeof(struct udphdr); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508776140997.7442974728285; Mon, 14 Jan 2019 15:32:56 -0800 (PST) Received: from localhost ([127.0.0.1]:39483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBix-00034z-3T for importer@patchew.org; Mon, 14 Jan 2019 18:32:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7Q-0004xP-WB for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7Q-0001pd-6S for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:08 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:40716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7P-0001eJ-Ro for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:08 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 6D1481BD6; Mon, 14 Jan 2019 23:53:49 +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 zYbtEXwGuZlK; Mon, 14 Jan 2019 23:53:48 +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 5B0771C02; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gA-86; Mon, 14 Jan 2019 23:53:11 +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:58 +0100 Message-Id: <20190114225306.21569-58-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 57/65] slirp: remove remaining DEBUG blocks 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: =?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 Instead, rely on slirp_debug flags, or compile unconditionally (the substraction in cksum is unlikely to affect any benchmark result). Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/cksum.c | 4 ---- slirp/ip_icmp.c | 5 ++--- slirp/slirp.c | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/slirp/cksum.c b/slirp/cksum.c index b9466485b5..0a988b845d 100644 --- a/slirp/cksum.c +++ b/slirp/cksum.c @@ -70,9 +70,7 @@ int cksum(struct mbuf *m, int len) =20 if (len < mlen) mlen =3D len; -#ifdef DEBUG len -=3D mlen; -#endif /* * Force to even boundary. */ @@ -122,12 +120,10 @@ int cksum(struct mbuf *m, int len) s_util.c[0] =3D *(uint8_t *)w; =20 cont: -#ifdef DEBUG if (len) { DEBUG_ERROR("cksum: out of data\n"); DEBUG_ERROR(" len =3D %d\n", len); } -#endif if (mlen =3D=3D -1) { /* The last mbuf has odd # of bytes. Follow the standard (the odd byte may be shifted left by 8 bits diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index 6c7e375ff8..cd2faeacb6 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -257,13 +257,12 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_cha= r code, int minsize, /* check msrc */ if(!msrc) goto end_error; ip =3D mtod(msrc, struct ip *); -#ifdef DEBUG - { char bufa[20], bufb[20]; + if (slirp_debug & DBG_MISC) { + char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb); } -#endif if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment= 0 */ =20 /* Do not reply to source-only IPs */ diff --git a/slirp/slirp.c b/slirp/slirp.c index 0b70cb9fb6..6c732cd15b 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -195,9 +195,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_= addr, void *cached_addr, if (++found > 3) { DEBUG_MISC("(more)"); break; - } -#ifdef DEBUG - else { + } else if (slirp_debug & DBG_MISC) { char s[INET6_ADDRSTRLEN]; const char *res =3D inet_ntop(af, tmp_addr, s, sizeof(s)); if (!res) { @@ -205,7 +203,6 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_= addr, void *cached_addr, } DEBUG_MISC("%s", res); } -#endif } } fclose(f); --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508972559630.4238367480143; Mon, 14 Jan 2019 15:36:12 -0800 (PST) Received: from localhost ([127.0.0.1]:40284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBm7-0005fG-Ek for importer@patchew.org; Mon, 14 Jan 2019 18:36:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7O-0004v2-JW for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7N-0001nm-G9 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7N-0001c7-6C for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5CBCF1BD3; Mon, 14 Jan 2019 23:53:48 +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 PZVdHSa9rEzl; Mon, 14 Jan 2019 23:53:46 +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 589EA1C00; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gD-9a; Mon, 14 Jan 2019 23:53:11 +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:59 +0100 Message-Id: <20190114225306.21569-59-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 58/65] slirp: replace DEBUG_ARGS with DEBUG_ARG 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: =?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 There is no clear benefit in calling an alias DEBUG_ARGS(). Replace calls with DEBUG_ARG(), and fix the white-spacing while at it. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/arp_table.c | 12 ++++++------ slirp/debug.h | 2 -- slirp/ip6_icmp.c | 2 +- slirp/ndp_table.c | 18 +++++++++--------- slirp/slirp.c | 12 ++++++------ slirp/tcp_input.c | 6 +++--- 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/slirp/arp_table.c b/slirp/arp_table.c index ce19e6e7c0..bf71b984ad 100644 --- a/slirp/arp_table.c +++ b/slirp/arp_table.c @@ -34,9 +34,9 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_= t ethaddr[ETH_ALEN]) =20 DEBUG_CALL("arp_table_add"); DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); - DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5]); + DEBUG_ARG("hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (ip_addr =3D=3D 0 || ip_addr =3D=3D 0xffffffff || ip_addr =3D=3D br= oadcast_addr) { /* Do not register broadcast addresses */ @@ -79,9 +79,9 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, for (i =3D 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip =3D=3D ip_addr) { memcpy(out_ethaddr, arptbl->table[i].ar_sha, ETH_ALEN); - DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); + DEBUG_ARG("found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/debug.h b/slirp/debug.h index ff920f0b87..50f30898fb 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -33,8 +33,6 @@ extern int slirp_debug; } \ } while (0) =20 -#define DEBUG_ARGS(fmt, ...) DEBUG_ARG(fmt, ##__VA_ARGS__) - #define DEBUG_MISC(fmt, ...) do { \ if (slirp_debug & DBG_MISC) { \ fprintf(dfd, fmt, ##__VA_ARGS__); \ diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index bce075913c..97304a9dd9 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -77,7 +77,7 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8= _t code) char addrstr[INET6_ADDRSTRLEN]; =20 DEBUG_CALL("icmp6_send_error"); - DEBUG_ARGS(" type =3D %d, code =3D %d\n", type, code); + DEBUG_ARG("type =3D %d, code =3D %d", type, code); =20 if (IN6_IS_ADDR_MULTICAST(&ip->ip_src) || in6_zero(&ip->ip_src)) { diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index 1401e1b322..b7b73722f7 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -18,9 +18,9 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, =20 DEBUG_CALL("ndp_table_add"); DEBUG_ARG("ip =3D %s", addrstr); - DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5]); + DEBUG_ARG("hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (IN6_IS_ADDR_MULTICAST(&ip_addr) || in6_zero(&ip_addr)) { /* Do not register multicast or unspecified addresses */ @@ -67,18 +67,18 @@ bool ndp_table_search(Slirp *slirp, struct in6_addr ip_= addr, out_ethaddr[3] =3D ip_addr.s6_addr[13]; out_ethaddr[4] =3D ip_addr.s6_addr[14]; out_ethaddr[5] =3D ip_addr.s6_addr[15]; - DEBUG_ARGS(" multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); + DEBUG_ARG("multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02x", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } =20 for (i =3D 0; i < NDP_TABLE_SIZE; i++) { if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) { memcpy(out_ethaddr, ndp_table->table[i].eth_addr, ETH_ALEN); - DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); + DEBUG_ARG("found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/slirp.c b/slirp/slirp.c index 6c732cd15b..851462a4cd 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -992,12 +992,12 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) } =20 memcpy(eh->h_dest, ethaddr, ETH_ALEN); - DEBUG_ARGS(" src =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_source[0], eh->h_source[1], eh->h_source[2], - eh->h_source[3], eh->h_source[4], eh->h_source[5]); - DEBUG_ARGS(" dst =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], - eh->h_dest[3], eh->h_dest[4], eh->h_dest[5]); + DEBUG_ARG("src =3D %02x:%02x:%02x:%02x:%02x:%02x", + eh->h_source[0], eh->h_source[1], eh->h_source[2], + eh->h_source[3], eh->h_source[4], eh->h_source[5]); + DEBUG_ARG("dst =3D %02x:%02x:%02x:%02x:%02x:%02x", + eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], + eh->h_dest[3], eh->h_dest[4], eh->h_dest[5]); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index f1cddce992..585ed1cb2f 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -215,8 +215,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *in= so, unsigned short af) Slirp *slirp; =20 DEBUG_CALL("tcp_input"); - DEBUG_ARGS(" m =3D %p iphlen =3D %2d inso =3D %p\n", - m, iphlen, inso); + DEBUG_ARG("m =3D %p iphlen =3D %2d inso =3D %p", + m, iphlen, inso); =20 /* * If called with m =3D=3D 0, then we're continuing the connect @@ -1389,7 +1389,7 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, = struct tcpiphdr *ti) int opt, optlen; =20 DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS(" tp =3D %p cnt=3D%i\n", tp, cnt); + DEBUG_ARG("tp =3D %p cnt=3D%i", tp, cnt); =20 for (; cnt > 0; cnt -=3D optlen, cp +=3D optlen) { opt =3D cp[0]; --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 154750890632596.74299930387872; Mon, 14 Jan 2019 15:35:06 -0800 (PST) Received: from localhost ([127.0.0.1]:39964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBl0-0004iX-1t for importer@patchew.org; Mon, 14 Jan 2019 18:35:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7S-0004zo-Qe for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001qo-1i for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37684) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7R-0001eU-PX for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:09 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 102F01BBD; Mon, 14 Jan 2019 23:53:50 +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 5Af0yP6ZTrXR; Mon, 14 Jan 2019 23:53:49 +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 5AFDD1C01; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gF-B3; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:00 +0100 Message-Id: <20190114225306.21569-60-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 59/65] slirp: factor out guestfwd addition checks 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: =?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 This will allow reusing the function in a following patch. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/misc.c | 7 ------- slirp/slirp.c | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index a0f104be5e..eae9596a55 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -37,13 +37,6 @@ int add_exec(struct gfwd_list **ex_ptr, void *chardev, c= onst char *cmdline, { struct gfwd_list *tmp_ptr; =20 - /* First, check if the port is "bound" */ - for (tmp_ptr =3D *ex_ptr; tmp_ptr; tmp_ptr =3D tmp_ptr->ex_next) { - if (port =3D=3D tmp_ptr->ex_fport && - addr.s_addr =3D=3D tmp_ptr->ex_addr.s_addr) - return -1; - } - tmp_ptr =3D *ex_ptr; *ex_ptr =3D g_new0(struct gfwd_list, 1); (*ex_ptr)->ex_fport =3D port; diff --git a/slirp/slirp.c b/slirp/slirp.c index 851462a4cd..882d28a4de 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1046,9 +1046,11 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, stru= ct in_addr host_addr, return 0; } =20 -int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, - struct in_addr *guest_addr, int guest_port) +static bool +check_guestfwd(Slirp *slirp, struct in_addr *guest_addr, int guest_port) { + struct gfwd_list *tmp_ptr; + if (!guest_addr->s_addr) { guest_addr->s_addr =3D slirp->vnetwork_addr.s_addr | (htonl(0x0204) & ~slirp->vnetwork_mask.s_addr); @@ -1057,6 +1059,23 @@ int slirp_add_exec(Slirp *slirp, void *chardev, cons= t char *cmdline, slirp->vnetwork_addr.s_addr || guest_addr->s_addr =3D=3D slirp->vhost_addr.s_addr || guest_addr->s_addr =3D=3D slirp->vnameserver_addr.s_addr) { + return false; + } + + /* check if the port is "bound" */ + for (tmp_ptr =3D slirp->guestfwd_list; tmp_ptr; tmp_ptr =3D tmp_ptr->e= x_next) { + if (guest_port =3D=3D tmp_ptr->ex_fport && + guest_addr->s_addr =3D=3D tmp_ptr->ex_addr.s_addr) + return false; + } + + return true; +} + +int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, + struct in_addr *guest_addr, int guest_port) +{ + if (!check_guestfwd(slirp, guest_addr, guest_port)) { return -1; } =20 --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508440073597.8320185855141; Mon, 14 Jan 2019 15:27:20 -0800 (PST) Received: from localhost ([127.0.0.1]:38068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBdX-0006tW-28 for importer@patchew.org; Mon, 14 Jan 2019 18:27:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7N-0004t4-4g for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7M-0001mu-8p for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:05 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7L-0001cA-VY for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 12AF71BD5; Mon, 14 Jan 2019 23:53:49 +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 FxP4TuNuou60; Mon, 14 Jan 2019 23:53:47 +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 5B0E61C04; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gJ-Ce; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:01 +0100 Message-Id: <20190114225306.21569-61-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 60/65] slirp: add clock_get_ns() callback 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: =?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 Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- net/slirp.c | 6 ++++++ slirp/if.c | 2 +- slirp/ip6_icmp.c | 4 ++-- slirp/libslirp.h | 2 ++ slirp/slirp.c | 12 +++++------- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 2d5337da04..f98425ee9f 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -146,9 +146,15 @@ static void net_slirp_guest_error(const char *msg) qemu_log_mask(LOG_GUEST_ERROR, "%s", msg); } =20 +static int64_t net_slirp_clock_get_ns(void) +{ + return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); +} + static const SlirpCb slirp_cb =3D { .output =3D net_slirp_output, .guest_error =3D net_slirp_guest_error, + .clock_get_ns =3D net_slirp_clock_get_ns, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/if.c b/slirp/if.c index ce4f5fac53..73e3705740 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -148,7 +148,7 @@ diddit: */ void if_start(Slirp *slirp) { - uint64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + uint64_t now =3D slirp->cb->clock_get_ns(); bool from_batchq =3D false; struct mbuf *ifm, *ifm_next, *ifqt; =20 diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 97304a9dd9..5261baae27 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -17,7 +17,7 @@ static void ra_timer_handler(void *opaque) { Slirp *slirp =3D opaque; timer_mod(slirp->ra_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + NDP_Interval); + slirp->cb->clock_get_ns() / SCALE_MS + NDP_Interval); ndp_send_ra(slirp); } =20 @@ -31,7 +31,7 @@ void icmp6_init(Slirp *slirp) SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL, ra_timer_handler, slirp); timer_mod(slirp->ra_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + NDP_Interval); + slirp->cb->clock_get_ns() / SCALE_MS + NDP_Interval); } =20 void icmp6_cleanup(Slirp *slirp) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 3e0aa19f4b..4611a7447b 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -15,6 +15,8 @@ typedef struct SlirpCb { void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); /* Print a message for an error due to guest misbehavior. */ void (*guest_error)(const char *msg); + /* Return the virtual clock value in nanoseconds */ + int64_t (*clock_get_ns)(void); } SlirpCb; =20 =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index 882d28a4de..535c8ad5f9 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -581,15 +581,15 @@ void slirp_pollfds_fill(GArray *pollfds, uint32_t *ti= meout) =20 void slirp_pollfds_poll(GArray *pollfds, int select_error) { - Slirp *slirp; + Slirp *slirp =3D QTAILQ_FIRST(&slirp_instances); struct socket *so, *so_next; int ret; =20 - if (QTAILQ_EMPTY(&slirp_instances)) { + if (!slirp) { return; } =20 - curtime =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); + curtime =3D slirp->cb->clock_get_ns() / SCALE_MS; =20 QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* @@ -916,8 +916,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ - ifm->expiration_date =3D - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; + ifm->expiration_date =3D slirp->cb->clock_get_ns() + 100000000= 0ULL; } return 0; } else { @@ -943,8 +942,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, if (!ifm->resolution_requested) { ndp_send_ns(slirp, ip6h->ip_dst); ifm->resolution_requested =3D true; - ifm->expiration_date =3D - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; + ifm->expiration_date =3D slirp->cb->clock_get_ns() + 100000000= 0ULL; } return 0; } else { --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547509535680851.5870062036647; Mon, 14 Jan 2019 15:45:35 -0800 (PST) Received: from localhost ([127.0.0.1]:42648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBv7-0004yK-KE for importer@patchew.org; Mon, 14 Jan 2019 18:45:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7T-00050o-6X for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001r0-5o for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7R-0001eT-QR for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A58F41BD7; Mon, 14 Jan 2019 23:53:50 +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 94kIPujpx03u; Mon, 14 Jan 2019 23:53:49 +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 6FD791C05; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gL-EH; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:02 +0100 Message-Id: <20190114225306.21569-62-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 61/65] build-sys: use a separate slirp-obj-y && slirp.mo 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: =?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 This will allow to have cflags for the whole slirp.mo -objs. It makes it possible to build tests that links only with slirp-obj-y (and not the whole common-obj). It is also a step towards building slirp as a shared library, although this requires a bit more thoughts to build with net/slirp.o (CONFIG_SLIRP would need to be 'm') and other build issues. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- Makefile | 5 +++-- Makefile.objs | 3 +-- Makefile.target | 5 ++++- slirp/Makefile.objs | 35 ++++++++++++++++++++++++++++++----- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index a9ac16d94e..dccba1dca2 100644 --- a/Makefile +++ b/Makefile @@ -379,7 +379,8 @@ dummy :=3D $(call unnest-vars,, \ ui-obj-m \ audio-obj-y \ audio-obj-m \ - trace-obj-y) + trace-obj-y \ + slirp-obj-y) =20 include $(SRC_PATH)/tests/Makefile.include =20 @@ -452,7 +453,7 @@ CAP_CFLAGS +=3D -DCAPSTONE_HAS_X86 subdir-capstone: .git-submodule-status $(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=3Dno= BUILDDIR=3D"$(BUILD_DIR)/capstone" CC=3D"$(CC)" AR=3D"$(AR)" LD=3D"$(LD)" = RANLIB=3D"$(RANLIB)" CFLAGS=3D"$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_D= IR)/capstone/$(LIBCAPSTONE)) =20 -$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \ +$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) $(slirp-ob= j-y) \ $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) =20 ROMSUBDIR_RULES=3D$(patsubst %,romsubdir-%, $(ROMS)) diff --git a/Makefile.objs b/Makefile.objs index 2121120492..67a054b08a 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -17,6 +17,7 @@ util-obj-y +=3D $(QAPI_MODULES:%=3Dqapi/qapi-events-%.o) util-obj-y +=3D qapi/qapi-introspect.o =20 chardev-obj-y =3D chardev/ +slirp-obj-$(CONFIG_SLIRP) =3D slirp/ =20 ####################################################################### # block-obj-y is code used by both qemu system emulation and qemu-img @@ -79,8 +80,6 @@ common-obj-y +=3D vl.o vl.o-cflags :=3D $(GPROF_CFLAGS) $(SDL_CFLAGS) common-obj-$(CONFIG_TPM) +=3D tpm.o =20 -common-obj-$(CONFIG_SLIRP) +=3D slirp/ - common-obj-y +=3D backends/ common-obj-y +=3D chardev/ =20 diff --git a/Makefile.target b/Makefile.target index 44ec4b630c..39f72e81be 100644 --- a/Makefile.target +++ b/Makefile.target @@ -165,6 +165,7 @@ target-obj-y :=3D block-obj-y :=3D common-obj-y :=3D chardev-obj-y :=3D +slirp-obj-y :=3D include $(SRC_PATH)/Makefile.objs dummy :=3D $(call unnest-vars,,target-obj-y) target-obj-y-save :=3D $(target-obj-y) @@ -177,7 +178,8 @@ dummy :=3D $(call unnest-vars,.., \ qom-obj-y \ io-obj-y \ common-obj-y \ - common-obj-m) + common-obj-m \ + slirp-obj-y) target-obj-y :=3D $(target-obj-y-save) all-obj-y +=3D $(common-obj-y) all-obj-y +=3D $(target-obj-y) @@ -186,6 +188,7 @@ all-obj-$(CONFIG_SOFTMMU) +=3D $(block-obj-y) $(chardev= -obj-y) all-obj-$(CONFIG_USER_ONLY) +=3D $(crypto-aes-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(crypto-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(io-obj-y) +all-obj-$(CONFIG_SOFTMMU) +=3D $(slirp-obj-y) =20 $(QEMU_PROG_BUILD): config-devices.mak =20 diff --git a/slirp/Makefile.objs b/slirp/Makefile.objs index 28049b03cd..21653f69e9 100644 --- a/slirp/Makefile.objs +++ b/slirp/Makefile.objs @@ -1,5 +1,30 @@ -common-obj-y =3D cksum.o if.o ip_icmp.o ip6_icmp.o ip6_input.o ip6_output.= o \ - ip_input.o ip_output.o dnssearch.o dhcpv6.o -common-obj-y +=3D slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_ou= tput.o -common-obj-y +=3D tcp_subr.o tcp_timer.o udp.o udp6.o bootp.o tftp.o arp_t= able.o \ - ndp_table.o ncsi.o +slirp-obj-y =3D slirp.mo + +slirp.mo-objs =3D \ + arp_table.o \ + bootp.o \ + cksum.o \ + dhcpv6.o \ + dnssearch.o \ + if.o \ + ip6_icmp.o \ + ip6_input.o \ + ip6_output.o \ + ip_icmp.o \ + ip_input.o \ + ip_output.o \ + mbuf.o \ + misc.o \ + ncsi.o \ + ndp_table.o \ + sbuf.o \ + slirp.o \ + socket.o \ + tcp_input.o \ + tcp_output.o \ + tcp_subr.o \ + tcp_timer.o \ + tftp.o \ + udp.o \ + udp6.o \ + $(NULL) --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547510027779901.8976069034766; Mon, 14 Jan 2019 15:53:47 -0800 (PST) Received: from localhost ([127.0.0.1]:44924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjC30-0001g1-Ke for importer@patchew.org; Mon, 14 Jan 2019 18:53:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7T-000517-Ka for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001qg-1H for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37682) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7R-0001eV-Oz for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:09 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D37D01BBF; Mon, 14 Jan 2019 23:53:50 +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 EbYLH05nJsUZ; Mon, 14 Jan 2019 23:53:50 +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 7DC521C06; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gP-G8; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:03 +0100 Message-Id: <20190114225306.21569-63-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 62/65] slirp: set G_LOG_DOMAIN 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: =?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 We are moving to g_log() facilities to log errors and probably debug messages too. Let's have the "Slirp" prefix on messages slirp produces. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/Makefile.objs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slirp/Makefile.objs b/slirp/Makefile.objs index 21653f69e9..959558c732 100644 --- a/slirp/Makefile.objs +++ b/slirp/Makefile.objs @@ -28,3 +28,5 @@ slirp.mo-objs =3D \ udp.o \ udp6.o \ $(NULL) + +slirp.mo-cflags =3D -DG_LOG_DOMAIN=3D\"Slirp\" --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547508977806494.81757304493067; Mon, 14 Jan 2019 15:36:17 -0800 (PST) Received: from localhost ([127.0.0.1]:40311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBmC-0005jj-Lr for importer@patchew.org; Mon, 14 Jan 2019 18:36:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7S-0004yh-0e for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7Q-0001pk-9I for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:09 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7P-0001eu-Ut for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:08 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F34231BC3; Mon, 14 Jan 2019 23:53:53 +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 4BU4ptPw-Sk1; Mon, 14 Jan 2019 23:53:50 +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 99D1F1C09; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gR-Hj; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:04 +0100 Message-Id: <20190114225306.21569-64-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 63/65] slirp: call into g_debug() for DEBUG macros 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: =?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 Make slirp use GLib logging, instead of fprintf(), so that applications can filter log, process it etc. With recent versions of glib, G_MESSAGES_DEBUG must be set to "all" or "Slirp" to see slirp debug messages. Reformat DEBUG_MISC & DEBUG_ERROR calls to not need \n ending. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Samuel Thibault --- slirp/cksum.c | 4 ++-- slirp/debug.h | 17 ++++------------- slirp/dhcpv6.c | 6 +++--- slirp/ip_icmp.c | 10 +++++----- slirp/slirp.c | 10 ++++------ slirp/socket.c | 24 ++++++++++++------------ slirp/tcp_input.c | 7 +++---- slirp/tcp_output.c | 2 +- slirp/tcp_subr.c | 2 +- slirp/udp.c | 5 ++--- slirp/udp6.c | 5 ++--- 11 files changed, 39 insertions(+), 53 deletions(-) diff --git a/slirp/cksum.c b/slirp/cksum.c index 0a988b845d..84c858fafb 100644 --- a/slirp/cksum.c +++ b/slirp/cksum.c @@ -121,8 +121,8 @@ int cksum(struct mbuf *m, int len) =20 cont: if (len) { - DEBUG_ERROR("cksum: out of data\n"); - DEBUG_ERROR(" len =3D %d\n", len); + DEBUG_ERROR("cksum: out of data"); + DEBUG_ERROR(" len =3D %d", len); } if (mlen =3D=3D -1) { /* The last mbuf has odd # of bytes. Follow the diff --git a/slirp/debug.h b/slirp/debug.h index 50f30898fb..25a5d59439 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -12,38 +12,29 @@ #define DBG_MISC 0x2 #define DBG_ERROR 0x4 =20 -#define dfd stderr - extern int slirp_debug; =20 #define DEBUG_CALL(fmt, ...) do { \ if (slirp_debug & DBG_CALL) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fprintf(dfd, "...\n"); \ - fflush(dfd); \ + g_debug(fmt "...", ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_ARG(fmt, ...) do { \ if (slirp_debug & DBG_CALL) { \ - fputc(' ', dfd); \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fputc('\n', dfd); \ - fflush(dfd); \ + g_debug(" " fmt, ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_MISC(fmt, ...) do { \ if (slirp_debug & DBG_MISC) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_ERROR(fmt, ...) do { \ if (slirp_debug & DBG_ERROR) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) =20 diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index 5d703e8ae6..752df40536 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -92,13 +92,13 @@ static int dhcpv6_parse_info_request(Slirp *slirp, uint= 8_t *odata, int olen, ri->want_boot_url =3D true; break; default: - DEBUG_MISC("dhcpv6: Unsupported option request %d\n", + DEBUG_MISC("dhcpv6: Unsupported option request %d", req_opt); } } break; default: - DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=3D%d\n= ", + DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=3D%d", option, len); } =20 @@ -203,6 +203,6 @@ void dhcpv6_input(struct sockaddr_in6 *srcsas, struct m= buf *m) dhcpv6_info_request(m->slirp, srcsas, xid, &data[4], data_len - 4); break; default: - DEBUG_MISC("dhcpv6_input: Unsupported message type 0x%x\n", data[0= ]); + DEBUG_MISC("dhcpv6_input: Unsupported message type 0x%x", data[0]); } } diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index cd2faeacb6..7c7e042049 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -103,7 +103,7 @@ static int icmp_send(struct socket *so, struct mbuf *m,= int hlen) =20 if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) =3D=3D -1) { - DEBUG_MISC("icmp_input icmp sendto tx errno =3D %d-%s\n", + DEBUG_MISC("icmp_input icmp sendto tx errno =3D %d-%s", errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(err= no)); icmp_detach(so); @@ -169,7 +169,7 @@ icmp_input(struct mbuf *m, int hlen) return; } if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC("icmp_input udp_attach errno =3D %d-%s\n", + DEBUG_MISC("icmp_input udp_attach errno =3D %d-%s", errno,strerror(errno)); sofree(so); m_free(m); @@ -192,7 +192,7 @@ icmp_input(struct mbuf *m, int hlen) =20 if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sockaddr_size(&addr)) =3D=3D -1) { - DEBUG_MISC("icmp_input udp sendto tx errno =3D %d-%s\n", + DEBUG_MISC("icmp_input udp sendto tx errno =3D %d-%s", errno,strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); udp_detach(so); @@ -261,7 +261,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char = code, int minsize, char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); - DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb); + DEBUG_MISC(" %.16s to %.16s", bufa, bufb); } if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment= 0 */ =20 @@ -458,7 +458,7 @@ void icmp_receive(struct socket *so) } else { error_code =3D ICMP_UNREACH_HOST; } - DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", errno, + DEBUG_MISC(" udp icmp rx errno =3D %d-%s", errno, strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(er= rno)); } else { diff --git a/slirp/slirp.c b/slirp/slirp.c index 535c8ad5f9..a9674ab090 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -166,7 +166,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_= addr, void *cached_addr, if (!f) return -1; =20 - DEBUG_MISC("IP address of your DNS(s): "); + DEBUG_MISC("IP address of your DNS(s):"); while (fgets(buff, 512, f) !=3D NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) =3D=3D 1) { char *c =3D strchr(buff2, '%'); @@ -188,20 +188,18 @@ static int get_dns_addr_resolv_conf(int af, void *pdn= s_addr, void *cached_addr, *scope_id =3D if_index; } *cached_time =3D curtime; - } else { - DEBUG_MISC(", "); } =20 if (++found > 3) { - DEBUG_MISC("(more)"); + DEBUG_MISC(" (more)"); break; } else if (slirp_debug & DBG_MISC) { char s[INET6_ADDRSTRLEN]; const char *res =3D inet_ntop(af, tmp_addr, s, sizeof(s)); if (!res) { - res =3D "(string conversion error)"; + res =3D " (string conversion error)"; } - DEBUG_MISC("%s", res); + DEBUG_MISC(" %s", res); } } } diff --git a/slirp/socket.c b/slirp/socket.c index 08a065f6a7..5ffbaa064a 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -208,7 +208,8 @@ soread(struct socket *so) } } =20 - DEBUG_MISC(" --- soread() disconnected, nn =3D %d, errno =3D %d-%s\n", = nn, errno,strerror(errno)); + DEBUG_MISC(" --- soread() disconnected, nn =3D %d, errno =3D %d-%s", + nn, errno,strerror(errno)); sofcantrcvmore(so); =20 if (err =3D=3D ECONNRESET || err =3D=3D ECONNREFUSED @@ -237,7 +238,7 @@ soread(struct socket *so) nn +=3D ret; } =20 - DEBUG_MISC(" ... read nn =3D %d bytes\n", nn); + DEBUG_MISC(" ... read nn =3D %d bytes", nn); =20 /* Update fields */ sb->sb_cc +=3D nn; @@ -370,7 +371,7 @@ sosendoob(struct socket *so) n =3D slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ #ifdef DEBUG if (n !=3D len) { - DEBUG_ERROR("Didn't send all data urgently XXXXX\n"); + DEBUG_ERROR("Didn't send all data urgently XXXXX"); } #endif } @@ -379,7 +380,7 @@ sosendoob(struct socket *so) return n; } so->so_urgc -=3D n; - DEBUG_MISC(" ---2 sent %d bytes urgent data, %d urgent bytes left\n", n, = so->so_urgc); + DEBUG_MISC(" ---2 sent %d bytes urgent data, %d urgent bytes left", n, so= ->so_urgc); =20 sb->sb_cc -=3D n; sb->sb_rptr +=3D n; @@ -460,7 +461,7 @@ sowrite(struct socket *so) if (ret > 0) nn +=3D ret; } - DEBUG_MISC(" ... wrote nn =3D %d bytes\n", nn); + DEBUG_MISC(" ... wrote nn =3D %d bytes", nn); =20 /* Update sbuf */ sb->sb_cc -=3D nn; @@ -478,7 +479,7 @@ sowrite(struct socket *so) return nn; =20 err_disconnected: - DEBUG_MISC(" --- sowrite disconnected, so->so_state =3D %x, errno =3D %d\= n", + DEBUG_MISC(" --- sowrite disconnected, so->so_state =3D %x, errno =3D %d", so->so_state, errno); sofcantsendmore(so); tcp_sockclosed(sototcpcb(so)); @@ -512,7 +513,7 @@ sorecvfrom(struct socket *so) if(errno =3D=3D EHOSTUNREACH) code=3DICMP_UNREACH_HOST; else if(errno =3D=3D ENETUNREACH) code=3DICMP_UNREACH_NET; =20 - DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", + DEBUG_MISC(" udp icmp rx errno =3D %d-%s", errno,strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); } else { @@ -564,7 +565,7 @@ sorecvfrom(struct socket *so) =20 m->m_len =3D recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC(" did recvfrom %d, errno =3D %d-%s\n", + DEBUG_MISC(" did recvfrom %d, errno =3D %d-%s", m->m_len, errno,strerror(errno)); if(m->m_len<0) { /* Report error as ICMP */ @@ -579,7 +580,7 @@ sorecvfrom(struct socket *so) code =3D ICMP_UNREACH_NET; } =20 - DEBUG_MISC(" rx error, tx icmp ICMP_UNREACH:%i\n", code); + DEBUG_MISC(" rx error, tx icmp ICMP_UNREACH:%i", code); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); break; case AF_INET6: @@ -591,7 +592,7 @@ sorecvfrom(struct socket *so) code =3D ICMP6_UNREACH_NO_ROUTE; } =20 - DEBUG_MISC(" rx error, tx icmp6 ICMP_UNREACH:%i\n", code); + DEBUG_MISC(" rx error, tx icmp6 ICMP_UNREACH:%i", code); icmp6_send_error(so->so_m, ICMP6_UNREACH, code); break; default: @@ -839,8 +840,7 @@ void sotranslate_out(struct socket *so, struct sockaddr= _storage *addr) } } =20 - DEBUG_MISC(" addr.sin_port=3D%d, " - "addr.sin_addr.s_addr=3D%.16s\n", + DEBUG_MISC(" addr.sin_port=3D%d, addr.sin_addr.s_addr=3D%.16s", ntohs(sin->sin_port), inet_ntoa(sin->sin_addr)); break; =20 diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 585ed1cb2f..de5b74a52b 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -641,8 +641,7 @@ findso: (errno !=3D EINPROGRESS) && (errno !=3D EWOULDBLOCK) ) { uint8_t code; - DEBUG_MISC(" tcp fconnect errno =3D %d-%s\n", - errno,strerror(errno)); + DEBUG_MISC(" tcp fconnect errno =3D %d-%s", errno, strerror(errno)); if(errno =3D=3D ECONNREFUSED) { /* ACK the SYN, send RST to refuse the connection */ tcp_respond(tp, ti, m, ti->ti_seq + 1, (tcp_seq) 0, @@ -1011,7 +1010,7 @@ trimthenstep6: =20 if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len =3D=3D 0 && tiwin =3D=3D tp->snd_wnd) { - DEBUG_MISC(" dup ack m =3D %p so =3D %p\n", m, so); + DEBUG_MISC(" dup ack m =3D %p so =3D %p", m, so); /* * If we have outstanding data (other than * a window probe), this is a completely @@ -1550,7 +1549,7 @@ tcp_mss(struct tcpcb *tp, u_int offer) (mss - (TCP_RCVSPACE % mss)= ) : 0)); =20 - DEBUG_MISC(" returning mss =3D %d\n", mss); + DEBUG_MISC(" returning mss =3D %d", mss); =20 return mss; } diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index ecc2d506b6..6dd1ecf5d9 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -92,7 +92,7 @@ again: =20 flags =3D tcp_outflags[tp->t_state]; =20 - DEBUG_MISC(" --- tcp_output flags =3D 0x%x\n", flags); + DEBUG_MISC(" --- tcp_output flags =3D 0x%x", flags); =20 /* * If in persist timeout with window of 0, send 1 byte. diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 3b14684107..4a9a5b5edc 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -964,7 +964,7 @@ int tcp_ctl(struct socket *so) so->chardev =3D ex_ptr->ex_chardev; return 1; } - DEBUG_MISC(" executing %s\n", ex_ptr->ex_exec); + DEBUG_MISC(" executing %s", ex_ptr->ex_exec); return fork_exec(so, ex_ptr->ex_exec); } } diff --git a/slirp/udp.c b/slirp/udp.c index 4853243d87..309feb9aae 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -172,8 +172,7 @@ udp_input(register struct mbuf *m, int iphlen) */ so =3D socreate(slirp); if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC(" udp_attach errno =3D %d-%s\n", - errno, strerror(errno)); + DEBUG_MISC(" udp_attach errno =3D %d-%s", errno, strerror(errno)); sofree(so); goto bad; } @@ -209,7 +208,7 @@ udp_input(register struct mbuf *m, int iphlen) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip=3Dsave_ip; - DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); + DEBUG_MISC("udp tx errno =3D %d-%s", errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); goto bad; diff --git a/slirp/udp6.c b/slirp/udp6.c index 8cdb1892e2..fa531e03c4 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -92,8 +92,7 @@ void udp6_input(struct mbuf *m) /* If there's no socket for this packet, create one. */ so =3D socreate(slirp); if (udp_attach(so, AF_INET6) =3D=3D -1) { - DEBUG_MISC(" udp6_attach errno =3D %d-%s\n", - errno, strerror(errno)); + DEBUG_MISC(" udp6_attach errno =3D %d-%s", errno, strerror(err= no)); sofree(so); goto bad; } @@ -119,7 +118,7 @@ void udp6_input(struct mbuf *m) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip =3D save_ip; - DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); + DEBUG_MISC("udp tx errno =3D %d-%s", errno, strerror(errno)); icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); goto bad; } --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 1547509165129807.6549369099347; Mon, 14 Jan 2019 15:39:25 -0800 (PST) Received: from localhost ([127.0.0.1]:41101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBpE-00089S-3T for importer@patchew.org; Mon, 14 Jan 2019 18:39:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7S-00050F-Tz for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001rG-7y for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7S-0001ep-0t for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8345B1BB2; Mon, 14 Jan 2019 23:53:52 +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 7iMCvGVUAPx5; Mon, 14 Jan 2019 23:53:51 +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 A68441C0A; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gU-JC; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:05 +0100 Message-Id: <20190114225306.21569-65-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 64/65] slirp: Mark debugging calls as unlikely 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: Samuel Thibault , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , 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" to get them out of the hot path. Signed-off-by: Samuel Thibault Reviewed-by: Marc-Andr=C3=A9 Lureau --- slirp/debug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slirp/debug.h b/slirp/debug.h index 25a5d59439..269d97d807 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -15,25 +15,25 @@ extern int slirp_debug; =20 #define DEBUG_CALL(fmt, ...) do { \ - if (slirp_debug & DBG_CALL) { \ + if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ g_debug(fmt "...", ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_ARG(fmt, ...) do { \ - if (slirp_debug & DBG_CALL) { \ + if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ g_debug(" " fmt, ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_MISC(fmt, ...) do { \ - if (slirp_debug & DBG_MISC) { \ + if (G_UNLIKELY(slirp_debug & DBG_MISC)) { \ g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) =20 #define DEBUG_ERROR(fmt, ...) do { \ - if (slirp_debug & DBG_ERROR) { \ + if (G_UNLIKELY(slirp_debug & DBG_ERROR)) { \ g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) --=20 2.20.1 From nobody Tue Oct 14 13:30:44 2025 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 15475093480921023.0675426462789; Mon, 14 Jan 2019 15:42:28 -0800 (PST) Received: from localhost ([127.0.0.1]:41874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjBs6-0002BS-TE for importer@patchew.org; Mon, 14 Jan 2019 18:42:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjB7T-00050r-7m for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjB7S-0001rA-67 for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:11 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:37692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gjB7R-0001ew-Un for qemu-devel@nongnu.org; Mon, 14 Jan 2019 17:54:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 213921BBB; Mon, 14 Jan 2019 23:53:54 +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 ps-mOgUlC6M3; Mon, 14 Jan 2019 23:53:52 +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 A9B651C0B; Mon, 14 Jan 2019 23:53:13 +0100 (CET) Received: from samy by function.home with local (Exim 4.92-RC4) (envelope-from ) id 1gjB6V-0005gX-Kv; Mon, 14 Jan 2019 23:53:11 +0100 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2019 23:53:06 +0100 Message-Id: <20190114225306.21569-66-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 65/65] slirp: check data length while emulating ident function 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: jan.kiszka@siemens.com, Kira <864786842@qq.com>, Prasad J Pandit , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Prasad J Pandit While emulating identification protocol, tcp_emu() does not check available space in the 'sc_rcv->sb_data' buffer. It could lead to heap buffer overflow issue. Add check to avoid it. Reported-by: Kira <864786842@qq.com> Signed-off-by: Prasad J Pandit Signed-off-by: Samuel Thibault --- slirp/tcp_subr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 4a9a5b5edc..23a841f26e 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -634,6 +634,11 @@ tcp_emu(struct socket *so, struct mbuf *m) socklen_t addrlen =3D sizeof(struct sockaddr_in); struct sbuf *so_rcv =3D &so->so_rcv; =20 + if (m->m_len > so_rcv->sb_datalen + - (so_rcv->sb_wptr - so_rcv->sb_data)) { + return 1; + } + memcpy(so_rcv->sb_wptr, m->m_data, m->m_len); so_rcv->sb_wptr +=3D m->m_len; so_rcv->sb_rptr +=3D m->m_len; --=20 2.20.1