From patchwork Tue Dec 18 23:03:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDHM2Qqbz9s3q for ; Wed, 19 Dec 2018 10:09:19 +1100 (AEDT) Received: from localhost ([::1]:56667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOUG-0002ZR-Pz for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:09:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQB-0007wK-Iu for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQ5-000447-SA for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:00 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQ3-000406-Nh for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:04:57 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 54473276F; Wed, 19 Dec 2018 00:04:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 Q_cLbCkA-8wU; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 70FAE212E; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007HY-9I; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:39 +0100 Message-Id: <20181218230442.27887-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 01/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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 f6dc03963a..1dbd34a9da 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 -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 = opaque; @@ -378,7 +378,8 @@ static int net_slirp_init(NetClientState *peer, const char *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); for (config = slirp_configs; config; config = 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 @@ typedef struct Slirp Slirp; +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); @@ -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); void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); @@ -26,9 +30,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error); void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); -/* 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 pkt_len) *pchecksum = htonl(checksum); ncsi_rsp_len += 4; - 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 322edf51eb..b0380c5eaa 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -287,12 +287,15 @@ 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) { Slirp *slirp = g_malloc0(sizeof(Slirp)); slirp_init_once(); + slirp->output = output; slirp->grand = g_rand_new(); slirp->restricted = restricted; @@ -832,7 +835,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) rah->ar_sip = ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip = 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, struct ethhdr *eh, /* target IP */ rah->ar_tip = iph->ip_dst.s_addr; slirp->client_ipaddr = iph->ip_dst; - slirp_output(slirp->opaque, arp_req, sizeof(arp_req)); + slirp->output(slirp->opaque, arp_req, sizeof(arp_req)); ifm->resolution_requested = true; /* 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; } 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; + slirp_output output; void *opaque; }; From patchwork Tue Dec 18 23:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDCb5MZnz9s8J for ; Wed, 19 Dec 2018 10:06:03 +1100 (AEDT) Received: from localhost ([::1]:56652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR7-0007yB-99 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:06:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQB-0007wJ-Hd for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQ5-00043s-OW for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:00 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57280) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQ1-0003yT-Ow for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:04:55 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9E6F82947; Wed, 19 Dec 2018 00:04:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 cL_Nn_e8dQpo; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8510F260D; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Ha-A7; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:40 +0100 Message-Id: <20181218230442.27887-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 02/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau QEMU uses fork_exec() with do_pty values 0 or 3. Let's clean up some unused code. Signed-off-by: Marc-André 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 *exec, #ifdef _WIN32 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 = 0 Fork/exec inetd style - * do_pty = 1 Fork/exec using slirp.telnetd - * do_ptr = 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_pty) DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %p", so); DEBUG_ARG("ex = %p", ex); - DEBUG_ARG("do_pty = %x", do_pty); - - if (do_pty == 2) { - return 0; - } else { - addr.sin_family = AF_INET; - addr.sin_port = 0; - addr.sin_addr.s_addr = INADDR_ANY; - if ((s = 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 >= 0) { - closesocket(s); - } + addr.sin_family = AF_INET; + addr.sin_port = 0; + addr.sin_addr.s_addr = INADDR_ANY; - return 0; - } - } + s = 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 >= 0) { + closesocket(s); + } + return 0; + } if (getsockname(s, (struct sockaddr *)&csaddr, &csaddrlen) < 0) { closesocket(s); @@ -166,13 +156,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) i = 0; bptr = g_strdup(ex); /* No need to free() this */ - if (do_pty == 1) { - /* Setup "slirp.telnetd -x" */ - argv[i++] = "slirp.telnetd"; - argv[i++] = "-x"; - argv[i++] = bptr; - } else - do { + do { /* Change the string into argv[] */ curarg = bptr; while (*bptr != ' ' && *bptr != (char)0) @@ -180,7 +164,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) c = *bptr; *bptr++ = (char)0; argv[i++] = g_strdup(curarg); - } while (c); + } while (c); argv[i] = NULL; execvp(argv[0], (char **)argv); @@ -206,13 +190,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty) opt = 1; qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); qemu_set_nonblock(so->s); - - /* Append the telnet options now */ - if (so->so_m != NULL && do_pty == 1) { - sbappend(so, so->so_m); - so->so_m = 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); #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 = so->slirp; struct sbuf *sb = &so->so_snd; struct ex_list *ex_ptr; - int do_pty; DEBUG_CALL("tcp_ctl"); DEBUG_ARG("so = %p", so); @@ -966,9 +965,8 @@ int tcp_ctl(struct socket *so) so->extra = (void *)ex_ptr->ex_exec; return 1; } - do_pty = 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); } } } From patchwork Tue Dec 18 23:03:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDCb4fNjz9s7W for ; Wed, 19 Dec 2018 10:06:02 +1100 (AEDT) Received: from localhost ([::1]:56651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR4-0007x6-TD for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:05:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQB-0007wM-LV for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQ5-00043r-OQ for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:00 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQ1-0003yX-P2 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:04:55 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 4121D260D; Wed, 19 Dec 2018 00:04:49 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 Y1n6W5PyGWKV; Wed, 19 Dec 2018 00:04:48 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 982A7272F; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hc-B8; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:41 +0100 Message-Id: <20181218230442.27887-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 03/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau do_pty == 3 means to talk to a chardev. Signed-off-by: Marc-André 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 *exec, *ex_ptr = g_new(struct ex_list, 1); (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = addr; - (*ex_ptr)->ex_pty = do_pty; + (*ex_ptr)->ex_chardev = do_pty == 3; (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : g_strdup(exec); (*ex_ptr)->ex_next = 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 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 b0380c5eaa..fd0b17e0d9 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1455,7 +1455,7 @@ static void slirp_state_save(QEMUFile *f, void *opaque) struct ex_list *ex_ptr; for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) - if (ex_ptr->ex_pty == 3) { + if (ex_ptr->ex_chardev) { struct socket *so; so = 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 = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { - if (ex_ptr->ex_pty == 3 && + if (ex_ptr->ex_chardev && so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr && so->so_fport == 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 = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if (ex_ptr->ex_fport == so->so_fport && so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) { - if (ex_ptr->ex_pty == 3) { + if (ex_ptr->ex_chardev) { so->s = -1; so->extra = (void *)ex_ptr->ex_exec; return 1; From patchwork Tue Dec 18 23:03:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDCg2pjJz9s3q for ; Wed, 19 Dec 2018 10:06:07 +1100 (AEDT) Received: from localhost ([::1]:56657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORA-00087V-TB for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQD-0007wS-13 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQ9-00046Y-96 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:04 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57302) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQ5-0003zA-O3 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:04:58 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 10ADA272F; Wed, 19 Dec 2018 00:04:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 mymNFDiYPYCV; Wed, 19 Dec 2018 00:04:49 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id AB7FA2752; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007He-CT; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:42 +0100 Message-Id: <20181218230442.27887-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Let's not mix command line and chardev pointers. Signed-off-by: Marc-André 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 1dbd34a9da..0bb12567fe 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -709,8 +709,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, CONFIG_SMBD_COMMAND, s->smb_dir, smb_conf); g_free(smb_conf); - 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 *config_str, Error **errp) snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port); 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 *config_str, Error **errp) return -1; } - 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); 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 = NULL; } -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, } tmp_ptr = *ex_ptr; - *ex_ptr = g_new(struct ex_list, 1); + *ex_ptr = g_new0(struct ex_list, 1); (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = addr; - (*ex_ptr)->ex_chardev = do_pty == 3; - (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : g_strdup(exec); + if (chardev) { + (*ex_ptr)->ex_chardev = chardev; + } else { + (*ex_ptr)->ex_exec = g_strdup(cmdline); + } (*ex_ptr)->ex_next = 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 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 { 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); #endif diff --git a/slirp/slirp.c b/slirp/slirp.c index fd0b17e0d9..06b5c76939 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1068,7 +1068,7 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, return 0; } -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 void *args, guest_addr->s_addr == 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)); } 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 == ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { so->s = -1; - so->extra = (void *)ex_ptr->ex_exec; + so->extra = ex_ptr->ex_chardev; return 1; } DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); From patchwork Tue Dec 18 23:03:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDLw4kWDz9s6w for ; Wed, 19 Dec 2018 10:12:24 +1100 (AEDT) Received: from localhost ([::1]:56684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOXG-00057d-5L for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:12:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081z-TG for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQD-0004D1-S1 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41398) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQC-00044I-41 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EC6B7279F; Wed, 19 Dec 2018 00:04:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 NcrdrrDLfi9i; Wed, 19 Dec 2018 00:04:51 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id D16692756; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hi-FC; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:44 +0100 Message-Id: <20181218230442.27887-7-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 06/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Now it's only used for the chardev pointer. Signed-off-by: Marc-André 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 e5968d9aea..4c9ba9d428 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1088,10 +1088,10 @@ int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags) { - if (so->s == -1 && so->extra) { + if (so->s == -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; } 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 { struct sbuf so_rcv; /* Receive buffer */ struct sbuf so_snd; /* Send buffer */ - void * extra; /* Extra pointer */ + void * chardev; }; 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 == ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { so->s = -1; - so->extra = ex_ptr->ex_chardev; + so->chardev = ex_ptr->ex_chardev; return 1; } DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); From patchwork Tue Dec 18 23:03:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDM12y1Xz9s3q for ; Wed, 19 Dec 2018 10:12:29 +1100 (AEDT) Received: from localhost ([::1]:56687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOXK-0005Ac-NV for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:12:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081U-L5 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQE-0004Ey-Tu for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:08 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57420) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQD-00044D-49 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:06 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8CFD5279B; Wed, 19 Dec 2018 00:04:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 fYu5JoWVtIZB; Wed, 19 Dec 2018 00:04:53 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 265E827AB; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hk-Gg; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:45 +0100 Message-Id: <20181218230442.27887-8-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 07/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Clarify that those functions are internal to slirp. Signed-off-by: Marc-André 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; 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); - 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; void if_start(Slirp *); +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); From patchwork Tue Dec 18 23:03:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDn31ntdz9s7W for ; Wed, 19 Dec 2018 10:31:34 +1100 (AEDT) Received: from localhost ([::1]:56784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOpo-00041R-GS for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:31:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081x-Tk for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQD-0004CH-H2 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQB-00044J-Tp for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 68683212E; Wed, 19 Dec 2018 00:04:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 a_TlejVupSxo; Wed, 19 Dec 2018 00:04:51 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id F02AE2776; Wed, 19 Dec 2018 00:04:43 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hm-IO; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:46 +0100 Message-Id: <20181218230442.27887-9-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 08/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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 0bb12567fe..dfc72cfc2e 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -828,10 +828,11 @@ void hmp_info_usernet(Monitor *mon, const QDict *qdict) QTAILQ_FOREACH(s, &slirp_stacks, entry) { int id; bool got_hub_id = net_hub_id_for_client(&s->nc, &id) == 0; - monitor_printf(mon, "Hub %d (%s):\n", + char *info = 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); } } 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); -void slirp_connection_info(Slirp *slirp, Monitor *mon); +char *slirp_connection_info(Slirp *slirp); 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" @@ -198,8 +197,9 @@ fork_exec(struct socket *so, const char *ex) } #endif -void slirp_connection_info(Slirp *slirp, Monitor *mon) +char *slirp_connection_info(Slirp *slirp) { + GString *str = g_string_new(NULL); const char * const tcpstates[] = { [TCPS_CLOSED] = "CLOSED", [TCPS_LISTEN] = "LISTEN", @@ -221,8 +221,9 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) const char *state; char buf[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"); for (so = slirp->tcb.so_next; so != &slirp->tcb; so = so->so_next) { if (so->so_state & SS_HOSTFWD) { @@ -244,10 +245,10 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon) dst_port = 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 = so->so_faddr; dst_port = 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 = so->so_laddr; dst_addr = 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); } From patchwork Tue Dec 18 23:03:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015695 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDHV5xnYz9s3q for ; Wed, 19 Dec 2018 10:09:26 +1100 (AEDT) Received: from localhost ([::1]:56670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOUO-0002eQ-5j for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:09:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQG-0007x7-1n for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQD-0004Bk-3Z for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQB-00044F-PT for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EBECF2776; Wed, 19 Dec 2018 00:04:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 yjLicM2M5XOy; Wed, 19 Dec 2018 00:04:52 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1DA97279B; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Ho-Jz; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:47 +0100 Message-Id: <20181218230442.27887-10-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Free the list elements allocated in add_exec(). Signed-off-by: Marc-André 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; }; diff --git a/slirp/slirp.c b/slirp/slirp.c index 4c9ba9d428..0e4ade3e4a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -342,6 +342,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, void slirp_cleanup(Slirp *slirp) { + struct ex_list *e, *next; + + for (e = slirp->exec_list; e; e = next) { + next = e->ex_next; + g_free(e->ex_exec); + g_free(e); + } + QTAILQ_REMOVE(&slirp_instances, slirp, entry); unregister_savevm(NULL, "slirp", slirp); From patchwork Tue Dec 18 23:03:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDdw0bCRz9s3Z for ; Wed, 19 Dec 2018 10:25:24 +1100 (AEDT) Received: from localhost ([::1]:56746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOjp-0007Gb-G9 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:25:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081y-TF for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQC-00049i-4L for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQB-00044Q-7K for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:03 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 894B82756; Wed, 19 Dec 2018 00:04:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 CDiI6v0YUJsq; Wed, 19 Dec 2018 00:04:53 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3263E27E1; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hq-Lc; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:48 +0100 Message-Id: <20181218230442.27887-11-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 10/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Use the glib function for the work, fix a potential crash on >256 words. Signed-off-by: Marc-André 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 = sizeof(addr); socklen_t csaddrlen = 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; DEBUG_CALL("fork_exec"); @@ -156,19 +153,7 @@ fork_exec(struct socket *so, const char *ex) for (s = getdtablesize() - 1; s >= 3; s--) close(s); - i = 0; - bptr = g_strdup(ex); /* No need to free() this */ - do { - /* Change the string into argv[] */ - curarg = bptr; - while (*bptr != ' ' && *bptr != (char)0) - bptr++; - c = *bptr; - *bptr++ = (char)0; - argv[i++] = g_strdup(curarg); - } while (c); - - argv[i] = NULL; + argv = g_strsplit(ex, " ", -1); execvp(argv[0], (char **)argv); /* Ooops, failed, let's tell the user why */ From patchwork Tue Dec 18 23:03:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDQT4c4hz9s4s for ; Wed, 19 Dec 2018 10:15:29 +1100 (AEDT) Received: from localhost ([::1]:56701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOaE-0007oX-NQ for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:15:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081T-KC for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQE-0004ED-AB for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQD-00044o-2Q for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E1A0227E1; Wed, 19 Dec 2018 00:04:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 fyHmIBydctEv; Wed, 19 Dec 2018 00:04:55 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 756E827ED; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hs-NH; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:49 +0100 Message-Id: <20181218230442.27887-12-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 11/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau An overdue cleanup. Remaining declarations could probably be moved in other headers, such as slirp.h. Signed-off-by: Marc-André 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 -#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 int if_encap(Slirp *slirp, struct mbuf *ifm); ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags); From patchwork Tue Dec 18 23:03:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDHN1Y3Vz9s6w for ; Wed, 19 Dec 2018 10:09:20 +1100 (AEDT) Received: from localhost ([::1]:56669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOUH-0002bF-P3 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:09:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQG-0007xF-6q for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQD-0004CU-Gw for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQC-00044b-17 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0216427AB; Wed, 19 Dec 2018 00:04:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 JhfoiE367ISN; Wed, 19 Dec 2018 00:04:54 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3835427E5; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hu-OX; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:50 +0100 Message-Id: <20181218230442.27887-13-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 12/64] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é Tested-by: Philippe Mathieu-Daudé 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 56af0347d3..7f777a4908 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -190,6 +190,7 @@ trace-events-subdirs += net trace-events-subdirs += qapi trace-events-subdirs += qom trace-events-subdirs += scsi +trace-events-subdirs += slirp trace-events-subdirs += target/arm trace-events-subdirs += target/i386 trace-events-subdirs += 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" 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; + trace_slirp_tftp_error(msg); m = m_get(spt->slirp); if (!m) { @@ -323,6 +325,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas, break; } } + trace_slirp_tftp_rrq(req_fname); /* 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" From patchwork Tue Dec 18 23:03:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDLy3RGVz9s3q for ; Wed, 19 Dec 2018 10:12:26 +1100 (AEDT) Received: from localhost ([::1]:56686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOXH-00058K-QA for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:12:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081V-LO for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQE-0004Dl-1u for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:08 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57434) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQC-00044j-DM for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BCEBC2764; Wed, 19 Dec 2018 00:04:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 SLiq6_tpoJe3; Wed, 19 Dec 2018 00:04:54 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7F61B2809; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hw-Pt; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:51 +0100 Message-Id: <20181218230442.27887-14-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 13/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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) #else -/* - * 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 = { + .sin_family = AF_INET, + .sin_port = 0, + .sin_addr.s_addr = INADDR_ANY, + }; + socklen_t addrlen = sizeof(addr); + int ret, s; + + sv[1] = -1; + s = 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] = 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 = connect(sv[1], (struct sockaddr *)&addr, addrlen); + } while (ret < 0 && errno == EINTR); + if (ret < 0) { + goto err; + } + + do { + sv[0] = accept(s, (struct sockaddr *)&addr, &addrlen); + } while (sv[0] < 0 && errno == EINTR); + if (sv[0] < 0) { + goto err; + } + + closesocket(s); + return 0; + +err: + error_report("Error: slirp_socketpair(): %s", strerror(errno)); + if (s >= 0) { + closesocket(s); + } + if (sv[1] >= 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 = sizeof(addr); - socklen_t csaddrlen = sizeof(csaddr); - int opt; char **argv; - int ret; + int opt, c, sp[2]; pid_t pid; DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %p", so); DEBUG_ARG("ex = %p", ex); - addr.sin_family = AF_INET; - addr.sin_port = 0; - addr.sin_addr.s_addr = INADDR_ANY; - - s = 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 >= 0) { - closesocket(s); - } + if (slirp_socketpair_with_oob(sp) < 0) { return 0; } - if (getsockname(s, (struct sockaddr *)&csaddr, &csaddrlen) < 0) { - closesocket(s); - return 0; - } - cs = qemu_socket(AF_INET, SOCK_STREAM, 0); - if (cs < 0) { - closesocket(s); - return 0; - } - csaddr.sin_addr = 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 = connect(cs, (struct sockaddr *)&csaddr, csaddrlen); - } while (ret < 0 && errno == EINTR); - if (ret < 0) { - closesocket(s); - closesocket(cs); - return 0; - } - pid = 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; case 0: - setsid(); - - /* Set the DISPLAY */ - close(s); - dup2(cs, 0); - dup2(cs, 1); - dup2(cs, 2); - for (s = getdtablesize() - 1; s >= 3; s--) - close(s); + setsid(); + dup2(sp[1], 0); + dup2(sp[1], 1); + dup2(sp[1], 2); + for (c = getdtablesize() - 1; c >= 3; c--) + close(c); argv = g_strsplit(ex, " ", -1); execvp(argv[0], (char **)argv); @@ -163,19 +170,12 @@ fork_exec(struct socket *so, const char *ex) exit(1); default: + so->s = 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 = accept(s, (struct sockaddr *)&addr, &addrlen); - } while (so->s < 0 && errno == EINTR); - closesocket(s); - socket_set_fast_reuse(so->s); - opt = 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + socket_set_fast_reuse(so->s); + opt = 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); qemu_set_nonblock(so->s); return 1; } From patchwork Tue Dec 18 23:03:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDVL2rfPz9s3Z for ; Wed, 19 Dec 2018 10:18:50 +1100 (AEDT) Received: from localhost ([::1]:56718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOdT-0001wm-Rx for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:18:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081w-So for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQF-0004H3-Tf for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41534) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQE-0004Bw-Hd for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id DAFF4276F; Wed, 19 Dec 2018 00:04:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 OJWVZtxNY9yT; Wed, 19 Dec 2018 00:04:57 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 881E7280C; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007Hy-RT; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:52 +0100 Message-Id: <20181218230442.27887-15-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 14/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 struct mbuf { /* XXX should union some of these! */ From patchwork Tue Dec 18 23:03:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDwY4FbFz9s2P for ; Wed, 19 Dec 2018 10:38:05 +1100 (AEDT) Received: from localhost ([::1]:56818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOw7-0000X0-4Q for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:38:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORD-0000Op-3s for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORA-00054P-JL for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR9-0004Cl-R2 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BDAB02871; Wed, 19 Dec 2018 00:05:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 iujI-s6MyyPs; Wed, 19 Dec 2018 00:04:58 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 28EEC2892; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007I0-T9; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:53 +0100 Message-Id: <20181218230442.27887-16-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 15/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau This will bring slirp a bit forward to the state of an independent project. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé 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 dfc72cfc2e..a7802ddbcc 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -140,6 +140,10 @@ static NetClientInfo net_slirp_info = { .cleanup = net_slirp_cleanup, }; +static const SlirpCb slirp_cb = { + .output = 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 *vhost, @@ -379,7 +383,7 @@ static int net_slirp_init(NetClientState *peer, const char *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); for (config = slirp_configs; config; config = 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 @@ typedef struct Slirp Slirp; -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_init(). + */ +typedef struct SlirpCb { + /* Send an ethernet frame to the guest network. */ + void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); +} SlirpCb; + 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); 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 pkt_len) *pchecksum = htonl(checksum); ncsi_rsp_len += 4; - 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 0e4ade3e4a..7213915bf3 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -288,14 +288,14 @@ 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) { Slirp *slirp = g_malloc0(sizeof(Slirp)); slirp_init_once(); - slirp->output = output; + slirp->cb = callbacks; slirp->grand = g_rand_new(); slirp->restricted = restricted; @@ -843,7 +843,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) rah->ar_sip = ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip = 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, struct ethhdr *eh, /* target IP */ rah->ar_tip = iph->ip_dst.s_addr; slirp->client_ipaddr = 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 = true; /* 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; } 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; - slirp_output output; + const SlirpCb *cb; void *opaque; }; From patchwork Tue Dec 18 23:03:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDjS6pgqz9s3Z for ; Wed, 19 Dec 2018 10:28:28 +1100 (AEDT) Received: from localhost ([::1]:56764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOmo-0001KH-4I for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:28:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00082e-WA for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQD-0004CQ-Ha for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQB-00046M-RC for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:05 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id DB24227E5; Wed, 19 Dec 2018 00:04:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 0HfxfgpZvgDl; Wed, 19 Dec 2018 00:04:56 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 94B3F2829; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPq-0007I2-V3; Wed, 19 Dec 2018 00:04:42 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:54 +0100 Message-Id: <20181218230442.27887-17-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 16/64] 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Nobody cares for over 14y. Somebody can revert or rewrite if interested by that. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé 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 7213915bf3..4fd957be89 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -699,47 +699,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error) } } } - - /* - * Probe a still-connecting, non-blocking socket - * to check if it's still alive - */ -#ifdef PROBE_CONN - if (so->so_state & SS_ISFCONNECTING) { - ret = qemu_recv(so->s, &ret, 0, 0); - - if (ret < 0) { - /* XXX */ - if (errno == EAGAIN || errno == EWOULDBLOCK || - errno == EINPROGRESS || errno == ENOTCONN) { - continue; /* Still connecting, continue */ - } - - /* else failed */ - so->so_state &= SS_PERSISTENT_MASK; - so->so_state |= SS_NOFDREF; - - /* tcp_input will take care of it */ - } else { - ret = send(so->s, &ret, 0, 0); - if (ret < 0) { - /* XXX */ - if (errno == EAGAIN || errno == EWOULDBLOCK || - errno == EINPROGRESS || errno == ENOTCONN) { - continue; - } - /* else failed */ - so->so_state &= SS_PERSISTENT_MASK; - so->so_state |= SS_NOFDREF; - } else { - so->so_state &= ~SS_ISFCONNECTING; - } - - } - tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, - so->so_ffamily); - } /* SS_ISFCONNECTING */ -#endif } /* 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 */ -/* 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 From patchwork Tue Dec 18 23:03:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDZF6nBmz9s7W for ; Wed, 19 Dec 2018 10:22:12 +1100 (AEDT) Received: from localhost ([::1]:56733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOgj-0004bz-9q for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:22:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081r-SQ for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQF-0004Fx-IB for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41508) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQD-0004A3-Oi for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CA1B3260D; Wed, 19 Dec 2018 00:04:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 n5rLSa-0saOG; Wed, 19 Dec 2018 00:04:56 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id BE7A02871; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007I9-0h; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:55 +0100 Message-Id: <20181218230442.27887-18-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 17/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é Lureau Reviewed-by: Daniel P. Berrangé 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: } } -#ifndef FULL_BOLT /* * This prevents us from malloc()ing too many mbufs */ if_start(ifm->slirp); -#endif } /* 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 -/* 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 From patchwork Tue Dec 18 23:03:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDWZ0fZ1z9s3q for ; Wed, 19 Dec 2018 10:19:54 +1100 (AEDT) Received: from localhost ([::1]:56720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOeV-0002ou-GK for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:19:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00082D-Uu for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQF-0004GJ-Kr for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41506) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQD-0004A2-9P for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2624A2752; Wed, 19 Dec 2018 00:04:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 xIZHI_YqHXui; Wed, 19 Dec 2018 00:04:57 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id DB279287A; Wed, 19 Dec 2018 00:04:44 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IC-2T; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:56 +0100 Message-Id: <20181218230442.27887-19-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 18/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é Lureau Reviewed-by: Daniel P. Berrangé 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 -/* 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); -#ifdef HAVE_READV - nn = readv(so->s, (struct iovec *)iov, n); - DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn)); -#else nn = qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0); -#endif if (nn <= 0) { if (nn < 0 && (errno == EINTR || errno == EAGAIN)) return 0; @@ -226,7 +221,6 @@ soread(struct socket *so) } } -#ifndef HAVE_READV /* * If there was no error, try and read the second time round * We read again if n = 2 (ie, there's another part of the buffer) @@ -244,7 +238,6 @@ soread(struct socket *so) } DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn)); -#endif /* Update fields */ sb->sb_cc += nn; @@ -452,13 +445,7 @@ sowrite(struct socket *so) } /* Check if there's urgent data to send, and if so, send it */ -#ifdef HAVE_READV - nn = writev(so->s, (const struct iovec *)iov, n); - - DEBUG_MISC((dfd, " ... wrote nn = %d bytes\n", nn)); -#else nn = 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 == EAGAIN || errno == EINTR)) return 0; @@ -467,7 +454,6 @@ sowrite(struct socket *so) goto err_disconnected; } -#ifndef HAVE_READV if (n == 2 && nn == iov[0].iov_len) { int ret; ret = slirp_send(so, iov[1].iov_base, iov[1].iov_len,0); @@ -475,7 +461,6 @@ sowrite(struct socket *so) nn += ret; } DEBUG_MISC((dfd, " ... wrote nn = %d bytes\n", nn)); -#endif /* Update sbuf */ sb->sb_cc -= nn; From patchwork Tue Dec 18 23:03:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDN73jf4z9s3q for ; Wed, 19 Dec 2018 10:13:27 +1100 (AEDT) Received: from localhost ([::1]:56689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOYH-0005xj-2b for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:13:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081q-SI for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQF-0004Gt-UA for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQE-0004Bx-2E for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2BCBE2809; Wed, 19 Dec 2018 00:04:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 C6Y4ebeBT6rg; Wed, 19 Dec 2018 00:04:58 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 103DF288A; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IE-3q; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:57 +0100 Message-Id: <20181218230442.27887-20-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 19/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -/* Define if you have sys/signal.h */ -#undef HAVE_SYS_SIGNAL_H - /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H From patchwork Tue Dec 18 23:03:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDQT2Hv3z9s3q for ; Wed, 19 Dec 2018 10:15:29 +1100 (AEDT) Received: from localhost ([::1]:56700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOaE-0007n8-CE for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:15:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-000822-Tc for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQG-0004Hp-66 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41550) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQF-0004DV-Cz for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 9BD09288A; Wed, 19 Dec 2018 00:05:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 Byw-l2b0XcrY; Wed, 19 Dec 2018 00:05:03 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 9C1F428AC; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IG-56; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:58 +0100 Message-Id: <20181218230442.27887-21-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 20/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#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 -/* Define if you have sys/bitypes.h */ -#undef HAVE_SYS_BITYPES_H - /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN From patchwork Tue Dec 18 23:03:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDg7609fz9s3Z for ; Wed, 19 Dec 2018 10:26:27 +1100 (AEDT) Received: from localhost ([::1]:56756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOkr-00088E-91 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:26:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQc-0008JH-Hf for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQY-0004Zh-T0 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:27 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQR-0004Cb-Q4 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:19 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 92A50286F; Wed, 19 Dec 2018 00:05:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 8WCen6n6SPyW; Wed, 19 Dec 2018 00:05:00 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3D4332898; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IJ-6a; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:03:59 +0100 Message-Id: <20181218230442.27887-22-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#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 From patchwork Tue Dec 18 23:04:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDpF3qwjz9s3q for ; Wed, 19 Dec 2018 10:32:37 +1100 (AEDT) Received: from localhost ([::1]:56789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOqp-0004nq-1o for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:32:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR8-0000KT-Gf for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR7-0004zO-FD for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004Ce-3l for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:01 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 08DCB2829; Wed, 19 Dec 2018 00:05:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 7zwxrX1D-vgV; Wed, 19 Dec 2018 00:04:59 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3A95C2896; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IM-82; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:00 +0100 Message-Id: <20181218230442.27887-23-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#ifdef HAVE_SYS_STROPTS_H -#include -#endif - - #include "debug.h" #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 -/* Define if you have sys/stropts.h */ -#undef HAVE_SYS_STROPTS_H - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) From patchwork Tue Dec 18 23:04:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDbV4N6Yz9s3q for ; Wed, 19 Dec 2018 10:23:18 +1100 (AEDT) Received: from localhost ([::1]:56738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOho-0005Pe-3W for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:23:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQK-00085P-4L for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQI-0004Nq-Ua for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57560) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQI-0004Cn-An for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id ACCDE272F; Wed, 19 Dec 2018 00:05:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 mgOOj0znsbNm; Wed, 19 Dec 2018 00:05:00 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5E30528A1; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IP-A0; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:01 +0100 Message-Id: <20181218230442.27887-24-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 23/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -/* 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) From patchwork Tue Dec 18 23:04:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDJc5tCMz9s3q for ; Wed, 19 Dec 2018 10:10:24 +1100 (AEDT) Received: from localhost ([::1]:56671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOVK-0003Ro-5e for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:10:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQI-00081s-SM for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQF-0004Gr-Tq for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQE-0004Cm-Q1 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id DC6D4287A; Wed, 19 Dec 2018 00:05:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 abSQywBNsrfV; Wed, 19 Dec 2018 00:05:00 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6576228A2; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IT-BO; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:02 +0100 Message-Id: <20181218230442.27887-25-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 24/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#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 -/* 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 From patchwork Tue Dec 18 23:04:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDzb6vMYz9s2P for ; Wed, 19 Dec 2018 10:40:43 +1100 (AEDT) Received: from localhost ([::1]:56834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOyf-0002ih-Hh for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:40:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR3-0000E7-4d for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR0-0004v8-Pw for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:56 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41548) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQy-0004Cp-KU for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:54 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E1913280C; Wed, 19 Dec 2018 00:05:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 at8ndSXL77si; Wed, 19 Dec 2018 00:05:01 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 78AC328A4; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IW-Cm; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:03 +0100 Message-Id: <20181218230442.27887-26-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 25/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#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 -#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 -/* 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) From patchwork Tue Dec 18 23:04:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDZF6n0sz9s3q for ; Wed, 19 Dec 2018 10:22:13 +1100 (AEDT) Received: from localhost ([::1]:56735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOgk-0004dD-If for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:22:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQo-0008Qy-2I for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQf-0004hO-Te for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:35 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQZ-0004DT-UH for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 27BE12756; Wed, 19 Dec 2018 00:05:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 vB7FmvT2HkQ7; Wed, 19 Dec 2018 00:05:02 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 8D4E428A9; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007IY-EC; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:04 +0100 Message-Id: <20181218230442.27887-27-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 26/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#if defined(HAVE_SYS_IOCTL_H) +#ifndef _WIN32 # include #endif 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 */ -/* 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__ From patchwork Tue Dec 18 23:04:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDkb1QK7z9s3Z for ; Wed, 19 Dec 2018 10:29:27 +1100 (AEDT) Received: from localhost ([::1]:56771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOnk-0002J6-Oc for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:29:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR5-0000Gg-5F for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR3-0004wN-0K for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:58 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR0-0004Jt-ST for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:55 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0AAEF279B; Wed, 19 Dec 2018 00:05:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 2O_f7B09gBfM; Wed, 19 Dec 2018 00:05:08 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 2089328BF; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007Ib-Fg; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:05 +0100 Message-Id: <20181218230442.27887-28-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 27/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#ifdef HAVE_SYS_FILIO_H +#ifdef __APPLE__ # include #endif 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 */ -/* 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 From patchwork Tue Dec 18 23:04:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDrM3PqJz9s3q for ; Wed, 19 Dec 2018 10:34:27 +1100 (AEDT) Received: from localhost ([::1]:56797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOsa-0006J4-T4 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:34:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR8-0000Kv-QN for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR7-0004zW-Hr for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57570) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004DS-7Q for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:01 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8139D2892; Wed, 19 Dec 2018 00:05:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 Gy9sP31rAa_U; Wed, 19 Dec 2018 00:05:03 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B5F6A28AF; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007Id-Ho; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:06 +0100 Message-Id: <20181218230442.27887-29-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 28/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau It's actually qemu configure CONFIG_IOVEC that is being used. slirp/ does not use it anyway Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -/* 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) From patchwork Tue Dec 18 23:04:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDRZ2mvDz9s4s for ; Wed, 19 Dec 2018 10:16:25 +1100 (AEDT) Received: from localhost ([::1]:56708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOb8-0000DN-Dj for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:16:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQJ-00084I-UU for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQI-0004Nw-Uu for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:11 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQG-0004DX-5C for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 078452898; Wed, 19 Dec 2018 00:05:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 seJIBcDOSKHo; Wed, 19 Dec 2018 00:05:04 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B7E1828B5; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007Ig-JB; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:07 +0100 Message-Id: <20181218230442.27887-30-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 29/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 @@ /* 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 From patchwork Tue Dec 18 23:04:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDVJ01pZz9s3Z for ; Wed, 19 Dec 2018 10:18:48 +1100 (AEDT) Received: from localhost ([::1]:56716 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOdR-0001sf-C9 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:18:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQf-0008MH-TO for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQZ-0004aW-Tw for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:29 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQT-0004EB-FB for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:23 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 1020D2764; Wed, 19 Dec 2018 00:05:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 qg081dJSHKtA; Wed, 19 Dec 2018 00:05:04 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C59C428B6; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007J9-Ka; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:08 +0100 Message-Id: <20181218230442.27887-31-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau One more step towards making the project independent from QEMU. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé 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 -#ifdef HOST_WORDS_BIGENDIAN +#include + +#if G_BYTE_ORDER == G_BIG_ENDIAN # undef NTOHL # undef NTOHS # undef HTONL @@ -69,7 +71,7 @@ typedef uint32_t n_long; /* long as received from the net */ * Structure of an internet header, naked of options. */ struct ip { -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER == 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 == 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 +#include #include "net/eth.h" #define ALLNODES_MULTICAST { .s6_addr = \ @@ -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 == 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 */ struct ndp_ra { /* Router Advertisement Message */ uint8_t chl; /* Cur Hop Limit */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER == G_BIG_ENDIAN uint8_t M:1, O:1, @@ -56,7 +56,7 @@ struct ndp_ns { /* Neighbor Solicitation Message */ } QEMU_PACKED; struct ndp_na { /* Neighbor Advertisement Message */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER == 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 == 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 */ -/* 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 +#include + typedef uint32_t tcp_seq; #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 == G_BIG_ENDIAN uint8_t th_off:4, /* data offset */ th_x2:4; /* (unused) */ #else From patchwork Tue Dec 18 23:04:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF2F66Slz9s2P for ; Wed, 19 Dec 2018 10:43:01 +1100 (AEDT) Received: from localhost ([::1]:56847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP0t-0004c8-BW for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:42:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR7-0000Ik-8p for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR4-0004xZ-Tx for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:01 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR2-0004EY-TX for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:57 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5A285212E; Wed, 19 Dec 2018 00:05:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 BLXJFeHk-jch; Wed, 19 Dec 2018 00:05:05 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id CF5C828B7; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JF-MD; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:09 +0100 Message-Id: <20181218230442.27887-32-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé 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 { #define IP_MSS 576 /* default maximum segment size */ -#if SIZEOF_CHAR_P == 4 +#if GLIB_SIZEOF_VOID_P == 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) From patchwork Tue Dec 18 23:04:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDZN1FQCz9s3Z for ; Wed, 19 Dec 2018 10:22:20 +1100 (AEDT) Received: from localhost ([::1]:56736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOgr-0004gf-3n for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:22:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORB-0000Om-PG for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORA-00053Y-5j for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:05 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57616) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR9-0004I9-Jo for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 607AE2752; Wed, 19 Dec 2018 00:05:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 JdqOeyttKUgG; Wed, 19 Dec 2018 00:05:06 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id D1C5128B9; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JI-O2; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:10 +0100 Message-Id: <20181218230442.27887-33-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Use a global variable instead (similar to slirp_debug) Signed-off-by: Marc-André 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 4fd957be89..3261a04236 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -35,6 +35,9 @@ #include #endif +/* 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 -#include "slirp_config.h" - #ifdef _WIN32 typedef char *caddr_t; @@ -219,7 +217,9 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); #include #endif -#define SO_OPTIONS DO_KEEPALIVE + +extern bool slirp_do_keepalive; + #define TCP_MAXIDLE (TCPTV_KEEPCNT * TCPTV_KEEPINTVL) /* 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 d073ef9525..922dbe32eb 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 = 0; - if (SO_OPTIONS) + if (slirp_do_keepalive) tp->t_timer[TCPT_KEEP] = TCPTV_KEEPINTVL; else tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_IDLE; diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c index 52ef5f9100..d953a16386 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; - if ((SO_OPTIONS) && tp->t_state <= TCPS_CLOSE_WAIT) { + if (slirp_do_keepalive && tp->t_state <= TCPS_CLOSE_WAIT) { if (tp->t_idle >= TCPTV_KEEP_IDLE + TCP_MAXIDLE) goto dropit; /* From patchwork Tue Dec 18 23:04:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDdy2d3tz9s3Z for ; Wed, 19 Dec 2018 10:25:26 +1100 (AEDT) Received: from localhost ([::1]:56747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOjr-0007HY-Rt for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:25:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQq-0008TN-BK for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQd-0004dx-PH for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:39 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQZ-0004GG-Or for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 6E4FE2776; Wed, 19 Dec 2018 00:05:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 1kfwoPktFTSA; Wed, 19 Dec 2018 00:05:06 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id EDEEC28BC; Wed, 19 Dec 2018 00:04:45 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JL-Pi; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:11 +0100 Message-Id: <20181218230442.27887-34-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 33/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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; }; -extern Slirp *slirp_instance; - #ifndef NULL #define NULL (void *)0 #endif From patchwork Tue Dec 18 23:04:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDjT0lVsz9s3q for ; Wed, 19 Dec 2018 10:28:29 +1100 (AEDT) Received: from localhost ([::1]:56765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOmo-0001L6-JL for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:28:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR3-0000EC-59 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR0-0004vD-Q7 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:56 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57606) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQy-0004Hy-Rw for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:54 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 19B66260D; Wed, 19 Dec 2018 00:05:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 uDnmxuGC4Fno; Wed, 19 Dec 2018 00:05:07 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0C8AF28BE; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JO-RL; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:12 +0100 Message-Id: <20181218230442.27887-35-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 34/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-André 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; 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; err: - error_report("Error: slirp_socketpair(): %s", strerror(errno)); + g_critical("slirp_socketpair(): %s", strerror(errno)); if (s >= 0) { closesocket(s); } diff --git a/slirp/slirp.c b/slirp/slirp.c index 3261a04236..238629228f 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1214,8 +1214,8 @@ static int sbuf_tmp_post_load(void *opaque, int version) } if (tmp->woff >= requested_len || tmp->roff >= requested_len) { - error_report("invalid sbuf offsets r/w=%u/%u len=%u", - tmp->roff, tmp->woff, requested_len); + g_critical("invalid sbuf offsets r/w=%u/%u len=%u", + tmp->roff, tmp->woff, requested_len); return -EINVAL; } @@ -1323,7 +1323,7 @@ static int ss_family_post_load(void *opaque, int version_id) tss->parent->ss.ss_family = 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; } From patchwork Tue Dec 18 23:04:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDVJ6RSYz9s7W for ; Wed, 19 Dec 2018 10:18:48 +1100 (AEDT) Received: from localhost ([::1]:56717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOdS-0001u8-Be for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:18:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR8-0000KH-CC for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR5-0004y4-51 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR3-0004Mn-2M for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:58 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 80A7027AB; Wed, 19 Dec 2018 00:05:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 O4S4pyXEOwgC; Wed, 19 Dec 2018 00:05:08 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3186728C2; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JR-TU; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:13 +0100 Message-Id: <20181218230442.27887-36-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 35/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Let them accept multiple arguments. Simplify the inner argument handling of DEBUG_ARGS/DEBUG_MISC_DEBUG_ERROR. Signed-off-by: Marc-André 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]) DEBUG_CALL("arp_table_add"); DEBUG_ARG("ip = %s", inet_ntoa((struct in_addr){.s_addr = ip_addr})); - DEBUG_ARGS((dfd, " hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5])); + DEBUG_ARGS(" hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); if (ip_addr == 0 || ip_addr == 0xffffffff || ip_addr == broadcast_addr) { /* Do not register broadcast addresses */ @@ -79,9 +79,9 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, for (i = 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip == ip_addr) { memcpy(out_ethaddr, arptbl->table[i].ar_sha, ETH_ALEN); - DEBUG_ARGS((dfd, " found hw addr = %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 = %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[] = { RFC1533_COOKIE }; #ifdef DEBUG -#define DPRINTF(fmt, ...) \ -do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflush(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 = %d\n", len)); + DEBUG_ERROR("cksum: out of data\n"); + DEBUG_ERROR(" len = %d\n", len); } #endif if (mlen == -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 @@ extern int slirp_debug; -#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); fprintf(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(dfd); } +#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) #else -#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, ...) #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, int olen, ri->want_boot_url = 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=%d\n", - option, len)); + DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=%d\n", + option, len); } odata += len + 4; @@ -203,7 +203,6 @@ void dhcpv6_input(struct sockaddr_in6 *srcsas, struct mbuf *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 = mtod(m, struct ip6 *); DEBUG_CALL("icmp6_send_error"); - DEBUG_ARGS((dfd, " type = %d, code = %d\n", type, code)); + DEBUG_ARGS(" type = %d, code = %d\n", type, code); 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, int hlen) if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - DEBUG_MISC((dfd, "icmp_input icmp sendto tx errno = %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC("icmp_input icmp sendto tx errno = %d-%s\n", + errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); icmp_detach(so); } @@ -165,8 +165,8 @@ icmp_input(struct mbuf *m, int hlen) return; } if (udp_attach(so, AF_INET) == -1) { - DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp_attach errno = %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) if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sockaddr_size(&addr)) == -1) { - DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp sendto tx errno = %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 = ICMP_UNREACH_HOST; } - DEBUG_MISC((dfd, " udp icmp rx errno = %d-%s\n", errno, - strerror(errno))); + DEBUG_MISC(" udp icmp rx errno = %d-%s\n", errno, + strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(errno)); } 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) } } - DEBUG_ERROR((dfd, "dtom failed")); + DEBUG_ERROR("dtom failed"); 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 = %s", addrstr); #endif - DEBUG_ARGS((dfd, " hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5])); + DEBUG_ARGS(" hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); 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] = ip_addr.s6_addr[13]; out_ethaddr[4] = ip_addr.s6_addr[14]; out_ethaddr[5] = ip_addr.s6_addr[15]; - DEBUG_ARGS((dfd, " multicast addr = %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(" multicast addr = %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; } for (i = 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 = %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 = %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 238629228f..8da528afaa 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -984,12 +984,12 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) } memcpy(eh->h_dest, ethaddr, ETH_ALEN); - DEBUG_ARGS((dfd, " src = %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 = %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 = %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 = %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) } } - DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno))); + DEBUG_MISC(" --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno)); sofcantrcvmore(so); if (err == ECONNRESET || err == ECONNREFUSED @@ -237,7 +237,7 @@ soread(struct socket *so) nn += ret; } - DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn)); + DEBUG_MISC(" ... read nn = %d bytes\n", nn); /* Update fields */ sb->sb_cc += nn; @@ -370,7 +370,7 @@ sosendoob(struct socket *so) n = slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ #ifdef DEBUG if (n != 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 -= 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); sb->sb_cc -= n; sb->sb_rptr += n; @@ -460,7 +460,7 @@ sowrite(struct socket *so) if (ret > 0) nn += ret; } - DEBUG_MISC((dfd, " ... wrote nn = %d bytes\n", nn)); + DEBUG_MISC(" ... wrote nn = %d bytes\n", nn); /* Update sbuf */ sb->sb_cc -= nn; @@ -478,8 +478,8 @@ sowrite(struct socket *so) return nn; err_disconnected: - DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state = %x, errno = %d\n", - so->so_state, errno)); + DEBUG_MISC(" --- sowrite disconnected, so->so_state = %x, errno = %d\n", + so->so_state, errno); sofcantsendmore(so); tcp_sockclosed(sototcpcb(so)); return -1; @@ -512,8 +512,8 @@ sorecvfrom(struct socket *so) if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST; else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET; - DEBUG_MISC((dfd," udp icmp rx errno = %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp icmp rx errno = %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) m->m_len = recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n", - m->m_len, errno,strerror(errno))); + DEBUG_MISC(" did recvfrom %d, errno = %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 = ICMP_UNREACH_NET; } - 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 = ICMP6_UNREACH_NO_ROUTE; } - 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) } } - DEBUG_MISC((dfd, " addr.sin_port=%d, " - "addr.sin_addr.s_addr=%.16s\n", - ntohs(sin->sin_port), inet_ntoa(sin->sin_addr))); + DEBUG_MISC(" addr.sin_port=%d, " + "addr.sin_addr.s_addr=%.16s\n", + ntohs(sin->sin_port), inet_ntoa(sin->sin_addr)); break; case AF_INET6: diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 922dbe32eb..e33fb83df5 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -236,8 +236,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, unsigned short af) Slirp *slirp; DEBUG_CALL("tcp_input"); - DEBUG_ARGS((dfd, " m = %p iphlen = %2d inso = %p\n", - m, iphlen, inso)); + DEBUG_ARGS(" m = %p iphlen = %2d inso = %p\n", + m, iphlen, inso); /* * If called with m == 0, then we're continuing the connect @@ -662,8 +662,8 @@ findso: (errno != EINPROGRESS) && (errno != EWOULDBLOCK) ) { uint8_t code; - DEBUG_MISC((dfd, " tcp fconnect errno = %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" tcp fconnect errno = %d-%s\n", + errno,strerror(errno)); if(errno == 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: if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { - DEBUG_MISC((dfd, " dup ack m = %p so = %p\n", - m, so)); + DEBUG_MISC(" dup ack m = %p so = %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; DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS((dfd, " tp = %p cnt=%i\n", tp, cnt)); + DEBUG_ARGS(" tp = %p cnt=%i\n", tp, cnt); for (; cnt > 0; cnt -= optlen, cp += optlen) { opt = cp[0]; @@ -1611,7 +1610,7 @@ tcp_mss(struct tcpcb *tp, u_int offer) (mss - (TCP_RCVSPACE % mss)) : 0)); - DEBUG_MISC((dfd, " returning mss = %d\n", mss)); + DEBUG_MISC(" returning mss = %d\n", mss); return mss; } diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 90b5c376f7..44da8a4e47 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -92,7 +92,7 @@ again: flags = tcp_outflags[tp->t_state]; - DEBUG_MISC((dfd, " --- tcp_output flags = 0x%x\n",flags)); + DEBUG_MISC(" --- tcp_output flags = 0x%x\n", flags); /* * 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)); addr = so->fhost.ss; - DEBUG_CALL(" connect()ing") + DEBUG_CALL(" connect()ing"); sotranslate_out(so, &addr); /* We don't care what port we get */ @@ -964,7 +964,7 @@ int tcp_ctl(struct socket *so) so->chardev = 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 c47870a61b..a45ad81dda 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -172,8 +172,8 @@ udp_input(register struct mbuf *m, int iphlen) */ so = socreate(slirp); if (udp_attach(so, AF_INET) == -1) { - DEBUG_MISC((dfd," udp_attach errno = %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp_attach errno = %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 += iphlen; m->m_data -= iphlen; *ip=save_ip; - DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno))); + DEBUG_MISC("udp tx errno = %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 = socreate(slirp); if (udp_attach(so, AF_INET6) == -1) { - DEBUG_MISC((dfd, " udp6_attach errno = %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC(" udp6_attach errno = %d-%s\n", + errno, strerror(errno)); sofree(so); goto bad; } @@ -119,7 +119,7 @@ void udp6_input(struct mbuf *m) m->m_len += iphlen; m->m_data -= iphlen; *ip = save_ip; - DEBUG_MISC((dfd, "udp tx errno = %d-%s\n", errno, strerror(errno))); + DEBUG_MISC("udp tx errno = %d-%s\n", errno, strerror(errno)); icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); goto bad; } From patchwork Tue Dec 18 23:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015726 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDrL1wp9z9s3q for ; Wed, 19 Dec 2018 10:34:26 +1100 (AEDT) Received: from localhost ([::1]:56796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOsZ-0006Ic-R3 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:34:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQh-0008N1-RX for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQb-0004cG-T4 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:33 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQW-0004Ls-Jq for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 144BB276F; Wed, 19 Dec 2018 00:05:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 zXdb38-soPky; Wed, 19 Dec 2018 00:05:09 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3B1C928C3; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPr-0007JT-V4; Wed, 19 Dec 2018 00:04:43 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:14 +0100 Message-Id: <20181218230442.27887-37-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 36/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André 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 a7802ddbcc..00f7306b69 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "net/slirp.h" @@ -140,8 +141,14 @@ static NetClientInfo net_slirp_info = { .cleanup = net_slirp_cleanup, }; +static void net_slirp_guest_error(const char *msg) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s", msg); +} + static const SlirpCb slirp_cb = { .output = net_slirp_output, + .guest_error = net_slirp_guest_error, }; 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 olen, 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 = odata[2] << 8 | odata[3]; 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; } @@ -121,7 +121,7 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas, struct mbuf *m; uint8_t *resp; - if (dhcpv6_parse_info_request(odata, olen, &ri) < 0) { + if (dhcpv6_parse_info_request(slirp, odata, olen, &ri) < 0) { return; } 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, struct ip6 *ip, case ICMP6_NDP_RA: DEBUG_CALL(" type = 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; case ICMP6_NDP_NS: @@ -376,8 +375,8 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, struct ip6 *ip, case ICMP6_NDP_REDIRECT: DEBUG_CALL(" type = 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; From patchwork Tue Dec 18 23:04:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDyP6YVGz9s2P for ; Wed, 19 Dec 2018 10:39:41 +1100 (AEDT) Received: from localhost ([::1]:56826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOxf-0001yu-Cu for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:39:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORB-0000Ok-KF for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR9-00052Q-BT for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:05 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41876) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR8-0004ax-NT for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F3D8727ED; Wed, 19 Dec 2018 00:05:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 avaKSbUJ0Lvg; Wed, 19 Dec 2018 00:05:13 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E893928EA; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007JY-0f; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:15 +0100 Message-Id: <20181218230442.27887-38-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 37/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 348e1dca5a..6831526320 100644 --- a/slirp/ip_input.c +++ b/slirp/ip_input.c @@ -447,206 +447,6 @@ ip_slowtimo(Slirp *slirp) } } -/* - * 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 = 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 = 0; - struct in_addr *sin, dst; -typedef uint32_t n_time; - n_time ntime; - - dst = ip->ip_dst; - cp = (u_char *)(ip + 1); - cnt = (ip->ip_hl << 2) - sizeof (struct ip); - for (; cnt > 0; cnt -= optlen, cp += optlen) { - opt = cp[IPOPT_OPTVAL]; - if (opt == IPOPT_EOL) - break; - if (opt == IPOPT_NOP) - optlen = 1; - else { - optlen = cp[IPOPT_OLEN]; - if (optlen <= 0 || optlen > cnt) { - code = &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 = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code = &cp[IPOPT_OFFSET] - (u_char *)ip; - goto bad; - } - ipaddr.sin_addr = ip->ip_dst; - ia = (struct in_ifaddr *) - ifa_ifwithaddr((struct sockaddr *)&ipaddr); - if (ia == 0) { - if (opt == IPOPT_SSRR) { - type = ICMP_UNREACH; - code = 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 == IPOPT_SSRR) { -#define INA struct in_ifaddr * -#define SA struct sockaddr * - if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) - ia = (INA)ifa_ifwithnet((SA)&ipaddr); - } else - ia = ip_rtaddr(ipaddr.sin_addr); - if (ia == 0) { - type = ICMP_UNREACH; - code = ICMP_UNREACH_SRCFAIL; - goto bad; - } - ip->ip_dst = ipaddr.sin_addr; - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] += sizeof(struct in_addr); - /* - * Let ip_intr's mcast routing check handle mcast pkts - */ - forward = !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); - break; - - case IPOPT_RR: - if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code = &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 = (INA)ifa_ifwithaddr((SA)&ipaddr)) == 0 && - (ia = ip_rtaddr(ipaddr.sin_addr)) == 0) { - type = ICMP_UNREACH; - code = ICMP_UNREACH_HOST; - goto bad; - } - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] += sizeof(struct in_addr); - break; - - case IPOPT_TS: - code = cp - (u_char *)ip; - ipt = (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 == 0) - goto bad; - break; - } - sin = (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 = dst; - ia = (INA)ifaof_ i f p foraddr((SA)&ipaddr, - m->m_pkthdr.rcvif); - if (ia == 0) - continue; - bcopy((caddr_t)&IA_SIN(ia)->sin_addr, - (caddr_t)sin, sizeof(struct in_addr)); - ipt->ipt_ptr += 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) == 0) - continue; - ipt->ipt_ptr += sizeof(struct in_addr); - break; - - default: - goto bad; - } - ntime = iptime(); - bcopy((caddr_t)&ntime, (caddr_t)cp + ipt->ipt_ptr - 1, - sizeof(n_time)); - ipt->ipt_ptr += 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 e33fb83df5..5b5355dd99 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) } } - -/* - * 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 = ti->ti_urp - 1; - - while (cnt >= 0) { - if (m->m_len > cnt) { - char *cp = mtod(m, caddr_t) + cnt; - struct tcpcb *tp = sototcpcb(so); - - tp->t_iobc = *cp; - tp->t_oobflags |= TCPOOB_HAVEDATA; - memcpy(sp, cp+1, (unsigned)(m->m_len - cnt - 1)); - m->m_len--; - return; - } - cnt -= m->m_len; - m = m->m_next; /* XXX WRONG! Fix it! */ - if (m == 0) - break; - } - panic("tcp_pulloutofband"); -} - -#endif /* notdef */ - /* * Collect new round-trip time estimate * and update averages and current timeout. From patchwork Tue Dec 18 23:04:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015743 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF4r1Tlhz9s3Z for ; Wed, 19 Dec 2018 10:45:16 +1100 (AEDT) Received: from localhost ([::1]:56858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP33-0006cf-Pb for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:45:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR9-0000Lo-IK for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR8-00050n-BF for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41640) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004OT-SH for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D9452272F; Wed, 19 Dec 2018 00:05:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 SRJlfmikCssV; Wed, 19 Dec 2018 00:05:10 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 61EA128C7; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007Jb-2e; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:16 +0100 Message-Id: <20181218230442.27887-39-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 38/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 -#define sbflush(sb) sbdrop((sb),(sb)->sb_cc) #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) struct sbuf { From patchwork Tue Dec 18 23:04:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDvW4Ft3z9s2P for ; Wed, 19 Dec 2018 10:37:11 +1100 (AEDT) Received: from localhost ([::1]:56815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOvE-0008MR-UE for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:37:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR9-0000Mp-Qg for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR8-00051G-Ew for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR8-0004Ro-2Q for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 77DE82809; Wed, 19 Dec 2018 00:05:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 qnKwzIBKaC2Y; Wed, 19 Dec 2018 00:05:13 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 68FAE28CA; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007Jd-4V; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:17 +0100 Message-Id: <20181218230442.27887-40-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 39/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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; }; -#ifndef NULL -#define NULL (void *)0 -#endif - void if_start(Slirp *); int get_dns_addr(struct in_addr *pdns_addr); From patchwork Tue Dec 18 23:04:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDsb5mrKz9sBZ for ; Wed, 19 Dec 2018 10:35:31 +1100 (AEDT) Received: from localhost ([::1]:56801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOtd-0006zI-E7 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:35:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR9-0000LI-6B for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR7-000502-TW for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57666) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004PR-I1 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:01 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7E108279F; Wed, 19 Dec 2018 00:05:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 6wviYuyndMi7; Wed, 19 Dec 2018 00:05:10 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6DB1828CC; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007Ji-6Y; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:18 +0100 Message-Id: <20181218230442.27887-41-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Untouched since original introduction in 2004. Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé 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 5b5355dd99..b67ec24075 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 == (tp)->rcv_nxt && \ - tcpfrag_list_empty(tp) && \ - (tp)->t_state == TCPS_ESTABLISHED) {\ - if (ti->ti_flags & TH_PUSH) \ - tp->t_flags |= TF_ACKNOW; \ - else \ - tp->t_flags |= TF_DELACK; \ - (tp)->rcv_nxt += (ti)->ti_len; \ - flags = (ti)->ti_flags & TH_FIN; \ - if (so->so_emu) { \ - if (tcp_emu((so),(m))) sbappend((so), (m)); \ - } else \ - sbappend((so), (m)); \ - } else {\ - (flags) = tcp_reass((tp), (ti), (m)); \ - tp->t_flags |= TF_ACKNOW; \ - } \ -} -#else #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq == (tp)->rcv_nxt && \ tcpfrag_list_empty(tp) && \ @@ -97,7 +76,7 @@ tp->t_flags |= 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); From patchwork Tue Dec 18 23:04:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF7Q4MYpz9s2P for ; Wed, 19 Dec 2018 10:47:30 +1100 (AEDT) Received: from localhost ([::1]:56873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP5E-0008Uw-6J for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:47:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR9-0000Lj-Gm for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR8-00050a-9o for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004Pz-Qg for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F023D27E5; Wed, 19 Dec 2018 00:05:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 wjzInrQodO6c; Wed, 19 Dec 2018 00:05:10 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7475328D5; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KD-8C; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:19 +0100 Message-Id: <20181218230442.27887-42-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 41/64] 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Do not require QEMU macro. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé 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 pkt_len) memset(reh->h_source, 0xff, ETH_ALEN); reh->h_proto = htons(ETH_P_NCSI); - for (i = 0; i < ARRAY_SIZE(ncsi_rsp_handlers); i++) { + for (i = 0; i < G_N_ELEMENTS(ncsi_rsp_handlers); i++) { if (ncsi_rsp_handlers[i].type == nh->type + 0x80) { handler = &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 sockaddr_storage *srcsas, return; } - while (k < pktlen && nb_options < ARRAY_SIZE(option_name)) { + while (k < pktlen && nb_options < G_N_ELEMENTS(option_name)) { const char *key, *value; key = &tp->x.tp_buf[k]; @@ -403,7 +403,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas, } if (nb_options > 0) { - assert(nb_options <= ARRAY_SIZE(option_name)); + assert(nb_options <= G_N_ELEMENTS(option_name)); tftp_send_oack(spt, option_name, option_value, nb_options, tp); return; } From patchwork Tue Dec 18 23:04:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDwj5z2Tz9s2P for ; Wed, 19 Dec 2018 10:38:13 +1100 (AEDT) Received: from localhost ([::1]:56819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOwF-0000dR-BK for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:38:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOQy-00007T-Nq for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOQq-0004pB-Ax for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:50 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOQh-0004S2-MB for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:39 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id D2F89287A; Wed, 19 Dec 2018 00:05:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 HA9LSipxULQD; Wed, 19 Dec 2018 00:05:11 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 916F128E0; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KF-9y; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:20 +0100 Message-Id: <20181218230442.27887-43-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 42/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é Lureau Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé 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" #define TYPE_COLO_COMPARE "colo-compare" #define COLO_COMPARE(obj) \ @@ -129,19 +130,19 @@ static int compare_chr_send(CompareState *s, static gint seq_sorter(Packet *a, Packet *b, gpointer data) { - struct tcphdr *atcp, *btcp; + struct tcp_hdr *atcp, *btcp; - atcp = (struct tcphdr *)(a->transport_header); - btcp = (struct tcphdr *)(b->transport_header); + atcp = (struct tcp_hdr *)(a->transport_header); + btcp = (struct tcp_hdr *)(b->transport_header); return ntohl(atcp->th_seq) - ntohl(btcp->th_seq); } static void fill_pkt_tcp_info(void *data, uint32_t *max_ack) { Packet *pkt = data; - struct tcphdr *tcphd; + struct tcp_hdr *tcphd; - tcphd = (struct tcphdr *)pkt->transport_header; + tcphd = (struct tcp_hdr *)pkt->transport_header; pkt->tcp_seq = ntohl(tcphd->th_seq); pkt->tcp_ack = 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" 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 -#include "slirp/slirp.h" #include "qemu/jhash.h" #include "qemu/timer.h" -#include "slirp/tcp.h" +#include "net/eth.h" #define HASHTABLE_MAX_SIZE 16384 @@ -81,10 +80,10 @@ typedef struct Connection { /* the maximum of acknowledgement number in secondary_list queue */ uint32_t sack; /* offset = secondary_seq - primary_seq */ - tcp_seq offset; + uint32_t offset; int tcp_state; /* TCP FSM state */ - tcp_seq fin_ack_seq; /* the seq of 'fin=1,ack=1' */ + uint32_t fin_ack_seq; /* the seq of 'fin=1,ack=1' */ } Connection; 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" #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; - tcp_pkt = (struct tcphdr *)pkt->transport_header; + tcp_pkt = (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; - tcp_pkt = (struct tcphdr *)pkt->transport_header; + tcp_pkt = (struct tcp_hdr *)pkt->transport_header; 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 00f7306b69..30eda2cca1 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" 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 +/* + * 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) != 0) { + return 0; + } + + if (prefix_len % 8 == 0) { + return 1; + } + + return a->s6_addr[prefix_len / 8] >> (8 - (prefix_len % 8)) + == 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 ACK */ +/* 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); #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" void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) { From patchwork Tue Dec 18 23:04:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDn31kjQz9s3q for ; Wed, 19 Dec 2018 10:31:34 +1100 (AEDT) Received: from localhost ([::1]:56783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOpo-00041K-F7 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:31:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOR8-0000KI-CY for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR5-0004xz-51 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41670) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR4-0004R1-90 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:05:58 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E64E027E1; Wed, 19 Dec 2018 00:05:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 FputqsPhdHmL; Wed, 19 Dec 2018 00:05:12 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A072728E4; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KK-Br; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:21 +0100 Message-Id: <20181218230442.27887-44-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 43/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André 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) +#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 = (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_fd, + error); +#else + QemuGSpawnFds setup = { + .child_setup = child_setup, + .user_data = user_data, + .stdin_fd = stdin_fd, + .stdout_fd = stdout_fd, + .stderr_fd = 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, err) \ + g_spawn_async_with_fds_qemu(wd, argv, env, f, c, d, p, ifd, ofd, efd, err) #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* From patchwork Tue Dec 18 23:04:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFHK5cp8z9s2P for ; Wed, 19 Dec 2018 10:54:21 +1100 (AEDT) Received: from localhost ([::1]:56911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPBr-0005qB-AK for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:54:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORC-0000Oo-P5 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORB-00055N-A3 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:06 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57890) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORA-0004Zv-KA for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CB1432898; Wed, 19 Dec 2018 00:05:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 fOFDOqqc2kDf; Wed, 19 Dec 2018 00:05:13 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id F3C8028EB; Wed, 19 Dec 2018 00:04:46 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KO-Dl; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:22 +0100 Message-Id: <20181218230442.27887-45-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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; } +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 = NULL; + char **argv; + int opt, sp[2]; - DEBUG_CALL("fork_exec"); - DEBUG_ARG("so = %p", so); - DEBUG_ARG("ex = %p", ex); + DEBUG_CALL("fork_exec"); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("ex = %p", ex); if (slirp_socketpair_with_oob(sp) < 0) { return 0; } - pid = 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 = getdtablesize() - 1; c >= 3; c--) - close(c); + argv = 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); - argv = 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; + } - default: - so->s = sp[0]; - closesocket(sp[1]); - qemu_add_child_watch(pid); - socket_set_fast_reuse(so->s); - opt = 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); - qemu_set_nonblock(so->s); - return 1; - } + so->s = sp[0]; + closesocket(sp[1]); + socket_set_fast_reuse(so->s); + opt = 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + qemu_set_nonblock(so->s); + return 1; } #endif From patchwork Tue Dec 18 23:04:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFBF1qm3z9sD4 for ; Wed, 19 Dec 2018 10:49:57 +1100 (AEDT) Received: from localhost ([::1]:56882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP7a-0001xB-PH for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:49:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORD-0000Oq-6Y for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORA-00054V-Jz for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:07 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR9-0004hZ-Vt for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id ACECE28A1; Wed, 19 Dec 2018 00:05:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 n8Gm9J0A6KVz; Wed, 19 Dec 2018 00:05:15 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0CD9528F9; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KR-FW; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:23 +0100 Message-Id: <20181218230442.27887-46-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-André 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); if (err) { - error_report("%s", err->message); + g_critical("fork_exec: %s", err->message); g_error_free(err); closesocket(sp[0]); closesocket(sp[1]); From patchwork Tue Dec 18 23:04:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF1B43SMz9s2P for ; Wed, 19 Dec 2018 10:42:06 +1100 (AEDT) Received: from localhost ([::1]:56843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP00-0003sl-3Z for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:42:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORB-0000On-Pw for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORA-00054D-G0 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:05 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41878) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR9-0004cT-Ub for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CD4CA288A; Wed, 19 Dec 2018 00:05:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 cMSOxGUPX3U2; Wed, 19 Dec 2018 00:05:15 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1244728FC; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KV-HD; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:24 +0100 Message-Id: <20181218230442.27887-47-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 46/64] 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 , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" g_spawn_async_with_fds is portable on Windows, so we can now enable fork_exec support there. Thanks Daniel P. Berrangé for the notice! Signed-off-by: Samuel Thibault Reviewed-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- 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, const char *cmdline, } -#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 } int @@ -177,7 +168,6 @@ fork_exec(struct socket *so, const char *ex) qemu_set_nonblock(so->s); return 1; } -#endif char *slirp_connection_info(Slirp *slirp) { From patchwork Tue Dec 18 23:04:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015752 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFHM2Ktzz9s2P for ; Wed, 19 Dec 2018 10:54:23 +1100 (AEDT) Received: from localhost ([::1]:56912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPBs-0005rR-W9 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:54:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORd-0000jk-2X for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005Ja-5f for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:32 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-0004e7-Ik for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 1D0642896; Wed, 19 Dec 2018 00:05:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 R-hovU9cbKBe; Wed, 19 Dec 2018 00:05:14 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 098D128F3; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007KY-J8; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:25 +0100 Message-Id: <20181218230442.27887-48-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] slirp: drop List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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_VERSION_*: WINSOCK_API_LINKAGE INT WSAAPI inet_pton(int Family, PCTSTR pszAddrString, PVOID pAddrBuf); Signed-off-by: Marc-André 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 30eda2cca1..4d890287ba 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -290,17 +290,6 @@ static int net_slirp_init(NetClientState *peer, const char *model, } #endif -#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] = 0xfe; - ip6_prefix.s6_addr[1] = 0xc0; -#else if (!vprefix6) { vprefix6 = "fec0::"; } @@ -308,7 +297,6 @@ static int net_slirp_init(NetClientState *peer, const char *model, error_setg(errp, "Failed to parse IPv6 prefix"); return -1; } -#endif if (!vprefix6_len) { vprefix6_len = 64; @@ -320,10 +308,6 @@ static int net_slirp_init(NetClientState *peer, const char *model, } 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 = ip6_prefix; ip6_host.s6_addr[15] |= 2; } 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 char *model, error_setg(errp, "IPv6 DNS doesn't belong to network"); return -1; } -#endif } else { ip6_dns = ip6_prefix; ip6_dns.s6_addr[15] |= 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 = m->slirp; struct mbuf *t; struct ip6 *ip = mtod(m, struct ip6 *); + char addrstr[INET6_ADDRSTRLEN]; DEBUG_CALL("icmp6_send_error"); DEBUG_ARGS(" type = %d, code = %d\n", type, code); @@ -90,11 +91,8 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8_t code) struct ip6 *rip = mtod(t, struct ip6 *); rip->ip_src = (struct in6_addr)LINKLOCAL_ADDR; rip->ip_dst = ip->ip_src; -#if !defined(_WIN32) || (_WIN32_WINNT >= 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &rip->ip_dst, addrstr, INET6_ADDRSTRLEN); DEBUG_ARG("target = %s", addrstr); -#endif rip->ip_nh = IPPROTO_ICMPV6; const int error_data_len = 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 >= 0x0600) char addrstr[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, &addr, addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_send_ns"); DEBUG_ARG("target = %s", addrstr); -#endif /* Build IPv6 packet */ struct mbuf *t = 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 = &slirp->ndp_table; int i; - DEBUG_CALL("ndp_table_add"); -#if !defined(_WIN32) || (_WIN32_WINNT >= 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_table_add"); DEBUG_ARG("ip = %s", addrstr); -#endif DEBUG_ARGS(" hw addr = %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_addr, bool ndp_table_search(Slirp *slirp, struct in6_addr ip_addr, uint8_t out_ethaddr[ETH_ALEN]) { + char addrstr[INET6_ADDRSTRLEN]; NdpTable *ndp_table = &slirp->ndp_table; int i; - DEBUG_CALL("ndp_table_search"); -#if !defined(_WIN32) || (_WIN32_WINNT >= 0x0600) - char addrstr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); + + DEBUG_CALL("ndp_table_search"); DEBUG_ARG("ip = %s", addrstr); -#endif assert(!in6_zero(&ip_addr)); From patchwork Tue Dec 18 23:04:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFDp37TKz9s2P for ; Wed, 19 Dec 2018 10:52:10 +1100 (AEDT) Received: from localhost ([::1]:56899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP9k-0003yt-0m for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:52:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORA-0000O1-KI for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZOR8-000512-DC for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:04 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZOR7-0004pQ-TX for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:02 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 78F1028A4; Wed, 19 Dec 2018 00:05:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 bj0g2T46fgty; Wed, 19 Dec 2018 00:05:16 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1E7E32901; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007Kb-Lm; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:26 +0100 Message-Id: <20181218230442.27887-49-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 48/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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 = NULL; } -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; /* First, check if the port is "bound" */ for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) { @@ -49,7 +49,7 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline, } tmp_ptr = *ex_ptr; - *ex_ptr = g_new0(struct ex_list, 1); + *ex_ptr = g_new0(struct gfwd_list, 1); (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = 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 -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; }; #define EMU_NONE 0x0 @@ -51,7 +51,7 @@ struct slirp_quehead { 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, int); int fork_exec(struct socket *so, const char *ex); #endif diff --git a/slirp/slirp.c b/slirp/slirp.c index 8da528afaa..4949d17c73 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -345,9 +345,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, void slirp_cleanup(Slirp *slirp) { - struct ex_list *e, *next; + struct gfwd_list *e, *next; - for (e = slirp->exec_list; e; e = next) { + for (e = slirp->guestfwd_list; e; e = next) { next = 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 = (struct ethhdr *)arp_reply; struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN); int ar_op; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; 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 == slirp->vnameserver_addr.s_addr || ah->ar_tip == slirp->vhost_addr.s_addr) goto arp_ok; - for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if (ex_ptr->ex_addr.s_addr == ah->ar_tip) goto arp_ok; } @@ -1052,7 +1052,7 @@ int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, return -1; } - return add_exec(&slirp->exec_list, chardev, cmdline, *guest_addr, + return add_exec(&slirp->guestfwd_list, chardev, cmdline, *guest_addr, htons(guest_port)); } @@ -1423,9 +1423,9 @@ static const VMStateDescription vmstate_slirp = { static void slirp_state_save(QEMUFile *f, void *opaque) { Slirp *slirp = opaque; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; - for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) if (ex_ptr->ex_chardev) { struct socket *so; so = slirp_find_ctl_socket(slirp, ex_ptr->ex_addr, @@ -1445,7 +1445,7 @@ static void slirp_state_save(QEMUFile *f, void *opaque) static int slirp_state_load(QEMUFile *f, void *opaque, int version_id) { Slirp *slirp = opaque; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; 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 = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if (ex_ptr->ex_chardev && so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr && so->so_fport == 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]; int restricted; - struct ex_list *exec_list; + struct gfwd_list *guestfwd_list; /* mbuf states */ struct quehead m_freelist; diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index b67ec24075..bc4aa60046 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -211,7 +211,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, 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; DEBUG_CALL("tcp_input"); @@ -394,7 +394,7 @@ findso: * for non-hostfwd connections. These should be dropped, unless it * happens to be a guestfwd. */ - for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if (ex_ptr->ex_fport == ti->ti_dport && ti->ti_dst.s_addr == ex_ptr->ex_addr.s_addr) { break; @@ -616,7 +616,7 @@ findso: if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr && so->so_faddr.s_addr != slirp->vnameserver_addr.s_addr) { /* May be an add exec */ - for (ex_ptr = slirp->exec_list; ex_ptr; + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if(ex_ptr->ex_fport == so->so_fport && so->so_faddr.s_addr == 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 = so->slirp; struct sbuf *sb = &so->so_snd; - struct ex_list *ex_ptr; + struct gfwd_list *ex_ptr; DEBUG_CALL("tcp_ctl"); DEBUG_ARG("so = %p", so); if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) { /* Check if it's pty_exec */ - for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { + for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) { if (ex_ptr->ex_fport == so->so_fport && so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) { if (ex_ptr->ex_chardev) { From patchwork Tue Dec 18 23:04:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFMk40Ryz9s3Z for ; Wed, 19 Dec 2018 10:58:08 +1100 (AEDT) Received: from localhost ([::1]:56939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPFT-0000ZL-5n for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:58:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORX-0000gN-GK for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORW-0005FY-H4 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57916) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORP-0004yG-7Z for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:21 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 3BD0428AF; Wed, 19 Dec 2018 00:05:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 qYmelRiBO67z; Wed, 19 Dec 2018 00:05:19 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 2E18D290A; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007L4-NU; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:27 +0100 Message-Id: <20181218230442.27887-50-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 49/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Make all packets expiration time based on virtual clock. Suggested-by: Paolo Bonzini Signed-off-by: Marc-André 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 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); + uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); bool from_batchq = false; struct mbuf *ifm, *ifm_next, *ifqt; diff --git a/slirp/slirp.c b/slirp/slirp.c index 4949d17c73..91210dc00a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -582,7 +582,7 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error) return; } - curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + curtime = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* @@ -909,7 +909,8 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, ifm->resolution_requested = true; /* Expire request and drop outgoing packet after 1 second */ - ifm->expiration_date = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL; + ifm->expiration_date = + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; } return 0; } else { @@ -936,7 +937,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, ndp_send_ns(slirp, ip6h->ip_dst); ifm->resolution_requested = true; ifm->expiration_date = - qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL; + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; } return 0; } else { From patchwork Tue Dec 18 23:04:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF4g2gjWz9sCQ for ; Wed, 19 Dec 2018 10:45:07 +1100 (AEDT) Received: from localhost ([::1]:56855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP2v-0006Tm-0K for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:45:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORa-0000jd-VT for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005KC-Ak for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:30 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41894) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-0004vV-S9 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7E9A028AC; Wed, 19 Dec 2018 00:05:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 uAA8Ezcum4oS; Wed, 19 Dec 2018 00:05:16 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 3ACA7290B; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007L9-PI; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:28 +0100 Message-Id: <20181218230442.27887-51-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 50/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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: sofcantrcvmore(so); tcp_sockclosed(sototcpcb(so)); - fprintf(stderr, "soreadbuf buffer to small"); + g_critical("soreadbuf buffer too small"); return -1; } From patchwork Tue Dec 18 23:04:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFKf075mz9s2P for ; Wed, 19 Dec 2018 10:56:22 +1100 (AEDT) Received: from localhost ([::1]:56932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPDn-0007hz-KD for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:56:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORJ-0000We-IQ for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORD-00058P-T5 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:09 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORD-0004vU-0E for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:07 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 260AB28A2; Wed, 19 Dec 2018 00:05:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 KHLK9KMwfr6V; Wed, 19 Dec 2018 00:05:17 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 469322918; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007LC-Rg; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:29 +0100 Message-Id: <20181218230442.27887-52-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Remove some clutter, and avoids direct call to fprintf(). Signed-off-by: Marc-André 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 91210dc00a..84f6b05974 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; -#ifdef DEBUG - fprintf(stderr, "IP address of your DNS(s): "); -#endif + DEBUG_MISC("IP address of your DNS(s): "); while (fgets(buff, 512, f) != NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { char *c = strchr(buff2, '%'); @@ -188,15 +186,12 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr, *scope_id = if_index; } *cached_time = 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 = "(string conversion error)"; } - fprintf(stderr, "%s", res); + DEBUG_MISC("%s", res); } #endif } From patchwork Tue Dec 18 23:04:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFPj3XCFz9s2P for ; Wed, 19 Dec 2018 10:59:53 +1100 (AEDT) Received: from localhost ([::1]:56945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPHC-0002On-Uz for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:59:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORY-0000gz-5Y for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORT-0005EK-1O for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORL-0004wt-Fu for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:17 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 339DB28A9; Wed, 19 Dec 2018 00:05:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 kttiGQRXScq8; Wed, 19 Dec 2018 00:05:18 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5327D291B; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007LG-U0; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:30 +0100 Message-Id: <20181218230442.27887-53-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 52/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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" +#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[] = "This is a pseudo-PING packet used by 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); -#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=strlen(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+=message_len; } -#endif icp->icmp_cksum = 0; icp->icmp_cksum = cksum(m, m->m_len); From patchwork Tue Dec 18 23:04:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDf701SZz9s3Z for ; Wed, 19 Dec 2018 10:25:34 +1100 (AEDT) Received: from localhost ([::1]:56749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOk0-0007M1-As for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:25:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORa-0000j5-6E for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORY-0005IF-Cm for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-0004xm-1J for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 747B528B5; Wed, 19 Dec 2018 00:05:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 8OYDMLQUnoVu; Wed, 19 Dec 2018 00:05:18 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5D6EC2922; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPs-0007LL-W0; Wed, 19 Dec 2018 00:04:44 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:31 +0100 Message-Id: <20181218230442.27887-54-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 53/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau DEBUG_CALL is already handled conditionally. Signed-off-by: Marc-André 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 @@ static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE }; -#ifdef DEBUG #define DPRINTF(fmt, ...) DEBUG_CALL(fmt, ##__VA_ARGS__) -#else -#define DPRINTF(fmt, ...) do{}while(0) -#endif 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 bootp_t *bp) DPRINTF("bootp packet op=%d msgtype=%d", bp->bp_op, dhcp_msg_type); if (preq_addr.s_addr != htonl(0L)) DPRINTF(" req_addr=%08" PRIx32 "\n", ntohl(preq_addr.s_addr)); - else + else { DPRINTF("\n"); + } if (dhcp_msg_type == 0) dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */ From patchwork Tue Dec 18 23:04:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015742 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF4p1xrZz9s3Z for ; Wed, 19 Dec 2018 10:45:14 +1100 (AEDT) Received: from localhost ([::1]:56857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP31-0006b3-Qm for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:45:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORY-0000gr-29 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORX-0005GK-5X for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57920) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORW-0004zg-G6 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:26 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2A65928B6; Wed, 19 Dec 2018 00:05:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 2Krf2uFG9FQM; Wed, 19 Dec 2018 00:05:20 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A3E8C2928; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007LO-2C; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:32 +0100 Message-Id: <20181218230442.27887-55-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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. */ -//#define DEBUG 1 - -#ifdef DEBUG +#ifndef DEBUG_H_ +#define DEBUG_H_ #define DBG_CALL 0x1 #define DBG_MISC 0x2 @@ -50,12 +49,4 @@ extern int slirp_debug; } \ } while (0) -#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" #ifdef DEBUG -int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR; +#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR) +#else +#define SLIRP_DEBUG 0 #endif +int slirp_debug = SLIRP_DEBUG; + inline void insque(void *a, void *b) { From patchwork Tue Dec 18 23:04:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFRr5y5Fz9s2P for ; Wed, 19 Dec 2018 11:01:44 +1100 (AEDT) Received: from localhost ([::1]:56963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPJ0-0003nU-Eb for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 19:01:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORY-0000h2-7E for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORV-0005F3-1b for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORN-0004zl-9u for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:19 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5D24E28BC; Wed, 19 Dec 2018 00:05:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 1Ts-c8tE-t71; Wed, 19 Dec 2018 00:05:20 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A2E372926; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007LR-4T; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:33 +0100 Message-Id: <20181218230442.27887-56-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 55/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Learn to read SLIRP_DEBUG=call,misc,error (all or help also handled) to set the slirp_debug flags. Signed-off-by: Marc-André 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" -#ifdef DEBUG -#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR) -#else -#define SLIRP_DEBUG 0 -#endif - -int slirp_debug = SLIRP_DEBUG; - inline void insque(void *a, void *b) { diff --git a/slirp/slirp.c b/slirp/slirp.c index 84f6b05974..abc573e6de 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -35,6 +35,8 @@ #include #endif +int slirp_debug; + /* Define to 1 if you want KEEPALIVE timers */ bool slirp_do_keepalive; @@ -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) loopback_addr.s_addr = htonl(INADDR_LOOPBACK); loopback_mask = htonl(IN_CLASSA_NET); + + debug = g_getenv("SLIRP_DEBUG"); + if (debug) { + const GDebugKey keys[] = { + { "call", DBG_CALL }, + { "misc", DBG_MISC }, + { "error", DBG_ERROR }, + }; + slirp_debug = g_parse_debug_string(debug, keys, G_N_ELEMENTS(keys)); + } + + } static void slirp_state_save(QEMUFile *f, void *opaque); From patchwork Tue Dec 18 23:04:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF7P5Wn2z9s3Z for ; Wed, 19 Dec 2018 10:47:29 +1100 (AEDT) Received: from localhost ([::1]:56872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP5D-0008Uf-BM for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:47:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORc-0000jh-FB for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005Ku-Pr for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:32 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57918) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORZ-0004yH-5s for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 67FEA28B7; Wed, 19 Dec 2018 00:05:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 iN3BajE5RBUZ; Wed, 19 Dec 2018 00:05:19 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id A163E2925; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007Lo-6C; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:34 +0100 Message-Id: <20181218230442.27887-57-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau This fixes some compilation warnings on mingw64. Signed-off-by: Marc-André 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 = sizeof(struct ip6); DEBUG_CALL("icmp6_input"); - DEBUG_ARG("m = %lx", (long) m); + DEBUG_ARG("m = %p", m); DEBUG_ARG("m_len = %d", m->m_len); 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) } DEBUG_CALL("ip6_input"); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("m = %p", m); DEBUG_ARG("m_len = %d", m->m_len); 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 fast) struct ip6 *ip = mtod(m, struct ip6 *); DEBUG_CALL("ip6_output"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); /* Fill IPv6 header */ ip->ip_v = 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; DEBUG_CALL("udp6_input"); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("m = %p", m); if (slirp->restricted) { goto bad; @@ -144,8 +144,8 @@ int udp6_output(struct socket *so, struct mbuf *m, struct udphdr *uh; DEBUG_CALL("udp6_output"); - DEBUG_ARG("so = %lx", (long)so); - DEBUG_ARG("m = %lx", (long)m); + DEBUG_ARG("so = %p", so); + DEBUG_ARG("m = %p", m); /* adjust for header */ m->m_data -= sizeof(struct udphdr); From patchwork Tue Dec 18 23:04:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015738 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF260Chcz9s2P for ; Wed, 19 Dec 2018 10:42:52 +1100 (AEDT) Received: from localhost ([::1]:56845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP0j-0004UP-Hq for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:42:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORZ-0000hq-2c for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORX-0005Gx-PW for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41918) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORX-00052c-5u for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F1EBA28C2; Wed, 19 Dec 2018 00:05:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 s25DQ1f6ygJe; Wed, 19 Dec 2018 00:05:24 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 019AD293B; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007M0-8m; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:35 +0100 Message-Id: <20181218230442.27887-58-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 57/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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) if (len < mlen) mlen = len; -#ifdef DEBUG len -= mlen; -#endif /* * Force to even boundary. */ @@ -122,12 +120,10 @@ int cksum(struct mbuf *m, int len) s_util.c[0] = *(uint8_t *)w; cont: -#ifdef DEBUG if (len) { DEBUG_ERROR("cksum: out of data\n"); DEBUG_ERROR(" len = %d\n", len); } -#endif if (mlen == -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_char code, int minsize, /* check msrc */ if(!msrc) goto end_error; ip = 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 */ /* Do not reply to source-only IPs */ diff --git a/slirp/slirp.c b/slirp/slirp.c index abc573e6de..31af2efbd5 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 = 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); From patchwork Tue Dec 18 23:04:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFMk40Sqz9sCQ for ; Wed, 19 Dec 2018 10:58:08 +1100 (AEDT) Received: from localhost ([::1]:56940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPFV-0000ar-6s for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:58:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORa-0000j0-4G for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORY-0005HR-0S for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57926) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORX-00051F-D6 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7518028BE; Wed, 19 Dec 2018 00:05:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 NEerdC3bRG6j; Wed, 19 Dec 2018 00:05:21 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B4D342931; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007M4-B0; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:36 +0100 Message-Id: <20181218230442.27887-59-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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]) DEBUG_CALL("arp_table_add"); DEBUG_ARG("ip = %s", inet_ntoa((struct in_addr){.s_addr = ip_addr})); - DEBUG_ARGS(" hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5]); + DEBUG_ARG("hw addr = %02x:%02x:%02x:%02x:%02x:%02x", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); if (ip_addr == 0 || ip_addr == 0xffffffff || ip_addr == broadcast_addr) { /* Do not register broadcast addresses */ @@ -79,9 +79,9 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, for (i = 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip == ip_addr) { memcpy(out_ethaddr, arptbl->table[i].ar_sha, ETH_ALEN); - DEBUG_ARGS(" found hw addr = %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 = %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) -#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]; DEBUG_CALL("icmp6_send_error"); - DEBUG_ARGS(" type = %d, code = %d\n", type, code); + DEBUG_ARG("type = %d, code = %d", type, code); 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, DEBUG_CALL("ndp_table_add"); DEBUG_ARG("ip = %s", addrstr); - DEBUG_ARGS(" hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5]); + DEBUG_ARG("hw addr = %02x:%02x:%02x:%02x:%02x:%02x", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); 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] = ip_addr.s6_addr[13]; out_ethaddr[4] = ip_addr.s6_addr[14]; out_ethaddr[5] = ip_addr.s6_addr[15]; - DEBUG_ARGS(" multicast addr = %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 = %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; } for (i = 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 = %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 = %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 31af2efbd5..c022644888 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -992,12 +992,12 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) } memcpy(eh->h_dest, ethaddr, ETH_ALEN); - DEBUG_ARGS(" src = %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 = %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 = %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 = %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 bc4aa60046..d24295813a 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -215,8 +215,8 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, unsigned short af) Slirp *slirp; DEBUG_CALL("tcp_input"); - DEBUG_ARGS(" m = %p iphlen = %2d inso = %p\n", - m, iphlen, inso); + DEBUG_ARG("m = %p iphlen = %2d inso = %p", + m, iphlen, inso); /* * If called with m == 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; DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS(" tp = %p cnt=%i\n", tp, cnt); + DEBUG_ARG("tp = %p cnt=%i", tp, cnt); for (; cnt > 0; cnt -= optlen, cp += optlen) { opt = cp[0]; From patchwork Tue Dec 18 23:04:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFBG09zvz9sD9 for ; Wed, 19 Dec 2018 10:49:57 +1100 (AEDT) Received: from localhost ([::1]:56883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP7b-0001xE-D5 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:49:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORc-0000jg-Cj for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005Kz-Oc for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:32 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57924) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORZ-00050D-6b for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 4774F28B9; Wed, 19 Dec 2018 00:05:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 xKDur4kkzaQ4; Wed, 19 Dec 2018 00:05:21 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id BEFA12935; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007M7-Cy; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:37 +0100 Message-Id: <20181218230442.27887-60-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau This will allow reusing the function in a following patch. Signed-off-by: Marc-André 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, const char *cmdline, { struct gfwd_list *tmp_ptr; - /* First, check if the port is "bound" */ - for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) { - if (port == tmp_ptr->ex_fport && - addr.s_addr == tmp_ptr->ex_addr.s_addr) - return -1; - } - tmp_ptr = *ex_ptr; *ex_ptr = g_new0(struct gfwd_list, 1); (*ex_ptr)->ex_fport = port; diff --git a/slirp/slirp.c b/slirp/slirp.c index c022644888..6a4d506d49 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1046,9 +1046,11 @@ int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, return 0; } -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 = slirp->vnetwork_addr.s_addr | (htonl(0x0204) & ~slirp->vnetwork_mask.s_addr); @@ -1057,6 +1059,23 @@ int slirp_add_exec(Slirp *slirp, void *chardev, const char *cmdline, slirp->vnetwork_addr.s_addr || guest_addr->s_addr == slirp->vhost_addr.s_addr || guest_addr->s_addr == slirp->vnameserver_addr.s_addr) { + return false; + } + + /* check if the port is "bound" */ + for (tmp_ptr = slirp->guestfwd_list; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) { + if (guest_port == tmp_ptr->ex_fport && + guest_addr->s_addr == 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; } From patchwork Tue Dec 18 23:04:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFTy0wFDz9sCQ for ; Wed, 19 Dec 2018 11:03:32 +1100 (AEDT) Received: from localhost ([::1]:56972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPKj-00053m-2P for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 19:03:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORZ-0000i8-8v for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORX-0005H6-Qc for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57928) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORX-00051M-B1 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 6028928BF; Wed, 19 Dec 2018 00:05:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 98R8Xbl3ZQwe; Wed, 19 Dec 2018 00:05:22 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id BEAA12932; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007MB-Et; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:38 +0100 Message-Id: <20181218230442.27887-61-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Signed-off-by: Marc-André 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 4d890287ba..0c06d6f3c1 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); } +static int64_t net_slirp_clock_get_ns(void) +{ + return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); +} + static const SlirpCb slirp_cb = { .output = net_slirp_output, .guest_error = net_slirp_guest_error, + .clock_get_ns = net_slirp_clock_get_ns, }; 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 = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + uint64_t now = slirp->cb->clock_get_ns(); bool from_batchq = false; struct mbuf *ifm, *ifm_next, *ifqt; 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 = 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); } @@ -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); } 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; diff --git a/slirp/slirp.c b/slirp/slirp.c index 6a4d506d49..dcab564a79 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -581,15 +581,15 @@ void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) void slirp_pollfds_poll(GArray *pollfds, int select_error) { - Slirp *slirp; + Slirp *slirp = QTAILQ_FIRST(&slirp_instances); struct socket *so, *so_next; int ret; - if (QTAILQ_EMPTY(&slirp_instances)) { + if (!slirp) { return; } - curtime = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); + curtime = slirp->cb->clock_get_ns() / SCALE_MS; QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* @@ -916,8 +916,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, ifm->resolution_requested = true; /* Expire request and drop outgoing packet after 1 second */ - ifm->expiration_date = - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; + ifm->expiration_date = slirp->cb->clock_get_ns() + 1000000000ULL; } return 0; } else { @@ -943,8 +942,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, if (!ifm->resolution_requested) { ndp_send_ns(slirp, ip6h->ip_dst); ifm->resolution_requested = true; - ifm->expiration_date = - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1000000000ULL; + ifm->expiration_date = slirp->cb->clock_get_ns() + 1000000000ULL; } return 0; } else { From patchwork Tue Dec 18 23:04:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFDq6L7Xz9s2P for ; Wed, 19 Dec 2018 10:52:11 +1100 (AEDT) Received: from localhost ([::1]:56900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP9l-0003zW-FO for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:52:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORZ-0000iL-G5 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORY-0005Hl-6m for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41916) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORX-00051Z-JP for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:27 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 185A928C7; Wed, 19 Dec 2018 00:05:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 3jQfJ7g4wuFP; Wed, 19 Dec 2018 00:05:22 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C44DB2937; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007ME-Gr; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:39 +0100 Message-Id: <20181218230442.27887-62-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 61/64] build-sys: use a seperate 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é Lureau Signed-off-by: Samuel Thibault --- Makefile.objs | 3 +-- Makefile.target | 5 ++++- slirp/Makefile.objs | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 7f777a4908..47b3896ceb 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -16,6 +16,7 @@ util-obj-y += $(QAPI_MODULES:%=qapi/qapi-events-%.o) util-obj-y += qapi/qapi-introspect.o chardev-obj-y = chardev/ +slirp-obj-$(CONFIG_SLIRP) = slirp/ ####################################################################### # block-obj-y is code used by both qemu system emulation and qemu-img @@ -78,8 +79,6 @@ common-obj-y += vl.o vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) common-obj-$(CONFIG_TPM) += tpm.o -common-obj-$(CONFIG_SLIRP) += slirp/ - common-obj-y += backends/ common-obj-y += chardev/ diff --git a/Makefile.target b/Makefile.target index 44ec4b630c..37e2fc449b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -165,6 +165,7 @@ target-obj-y := block-obj-y := common-obj-y := chardev-obj-y := +slirp-obj-y := include $(SRC_PATH)/Makefile.objs dummy := $(call unnest-vars,,target-obj-y) target-obj-y-save := $(target-obj-y) @@ -177,9 +178,11 @@ dummy := $(call unnest-vars,.., \ qom-obj-y \ io-obj-y \ common-obj-y \ - common-obj-m) + common-obj-m \ + slirp-obj-y) target-obj-y := $(target-obj-y-save) all-obj-y += $(common-obj-y) +all-obj-y += $(slirp-obj-y) all-obj-y += $(target-obj-y) all-obj-y += $(qom-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y) 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 = 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 += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o -common-obj-y += tcp_subr.o tcp_timer.o udp.o udp6.o bootp.o tftp.o arp_table.o \ - ndp_table.o ncsi.o +slirp-obj-y = slirp.mo + +slirp.mo-objs = \ + 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) From patchwork Tue Dec 18 23:04:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KDzM4Vpbz9s2P for ; Wed, 19 Dec 2018 10:40:31 +1100 (AEDT) Received: from localhost ([::1]:56830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZOyT-0002cj-6Z for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:40:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORb-0000je-9h for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005Jp-8c for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:31 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57930) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-00051U-P6 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:29 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id DD64C28C3; Wed, 19 Dec 2018 00:05:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 8ZEQJKHEK-6I; Wed, 19 Dec 2018 00:05:23 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id E38182939; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007MH-J4; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:40 +0100 Message-Id: <20181218230442.27887-63-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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 = \ udp.o \ udp6.o \ $(NULL) + +slirp.mo-cflags = -DG_LOG_DOMAIN=\"Slirp\" From patchwork Tue Dec 18 23:04:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KF7G4CnFz9s2P for ; Wed, 19 Dec 2018 10:47:22 +1100 (AEDT) Received: from localhost ([::1]:56869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZP56-0008NE-7V for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:47:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORd-0000jj-2D for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORZ-0005JT-4w for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:32 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:41922) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-00054d-I0 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BBA8028D5; Wed, 19 Dec 2018 00:05:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 VAnW-yWmDGBP; Wed, 19 Dec 2018 00:05:24 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id EFDFE293A; Wed, 19 Dec 2018 00:04:47 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007MK-Ko; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:41 +0100 Message-Id: <20181218230442.27887-64-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 63/64] 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_Lureau?= , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André 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é 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) cont: if (len) { - DEBUG_ERROR("cksum: out of data\n"); - DEBUG_ERROR(" len = %d\n", len); + DEBUG_ERROR("cksum: out of data"); + DEBUG_ERROR(" len = %d", len); } if (mlen == -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 -#define dfd stderr - extern int slirp_debug; #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) #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) #define DEBUG_MISC(fmt, ...) do { \ if (slirp_debug & DBG_MISC) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_ERROR(fmt, ...) do { \ if (slirp_debug & DBG_ERROR) { \ - fprintf(dfd, fmt, ##__VA_ARGS__); \ - fflush(dfd); \ + g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) 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, uint8_t *odata, int olen, ri->want_boot_url = 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=%d\n", + DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=%d", option, len); } @@ -203,6 +203,6 @@ void dhcpv6_input(struct sockaddr_in6 *srcsas, struct mbuf *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) if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - DEBUG_MISC("icmp_input icmp sendto tx errno = %d-%s\n", + DEBUG_MISC("icmp_input icmp sendto tx errno = %d-%s", errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); icmp_detach(so); @@ -169,7 +169,7 @@ icmp_input(struct mbuf *m, int hlen) return; } if (udp_attach(so, AF_INET) == -1) { - DEBUG_MISC("icmp_input udp_attach errno = %d-%s\n", + DEBUG_MISC("icmp_input udp_attach errno = %d-%s", errno,strerror(errno)); sofree(so); m_free(m); @@ -192,7 +192,7 @@ icmp_input(struct mbuf *m, int hlen) if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sockaddr_size(&addr)) == -1) { - DEBUG_MISC("icmp_input udp sendto tx errno = %d-%s\n", + DEBUG_MISC("icmp_input udp sendto tx errno = %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 */ @@ -458,7 +458,7 @@ void icmp_receive(struct socket *so) } else { error_code = ICMP_UNREACH_HOST; } - DEBUG_MISC(" udp icmp rx errno = %d-%s\n", errno, + DEBUG_MISC(" udp icmp rx errno = %d-%s", errno, strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(errno)); } else { diff --git a/slirp/slirp.c b/slirp/slirp.c index dcab564a79..a91cda8ce5 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; - DEBUG_MISC("IP address of your DNS(s): "); + DEBUG_MISC("IP address of your DNS(s):"); while (fgets(buff, 512, f) != NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { char *c = strchr(buff2, '%'); @@ -188,20 +188,18 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr, *scope_id = if_index; } *cached_time = curtime; - } else { - DEBUG_MISC(", "); } if (++found > 3) { - DEBUG_MISC("(more)"); + DEBUG_MISC(" (more)"); break; } else if (slirp_debug & DBG_MISC) { char s[INET6_ADDRSTRLEN]; const char *res = inet_ntop(af, tmp_addr, s, sizeof(s)); if (!res) { - res = "(string conversion error)"; + res = " (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) } } - DEBUG_MISC(" --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno)); + DEBUG_MISC(" --- soread() disconnected, nn = %d, errno = %d-%s", + nn, errno,strerror(errno)); sofcantrcvmore(so); if (err == ECONNRESET || err == ECONNREFUSED @@ -237,7 +238,7 @@ soread(struct socket *so) nn += ret; } - DEBUG_MISC(" ... read nn = %d bytes\n", nn); + DEBUG_MISC(" ... read nn = %d bytes", nn); /* Update fields */ sb->sb_cc += nn; @@ -370,7 +371,7 @@ sosendoob(struct socket *so) n = slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ #ifdef DEBUG if (n != 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 -= 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); sb->sb_cc -= n; sb->sb_rptr += n; @@ -460,7 +461,7 @@ sowrite(struct socket *so) if (ret > 0) nn += ret; } - DEBUG_MISC(" ... wrote nn = %d bytes\n", nn); + DEBUG_MISC(" ... wrote nn = %d bytes", nn); /* Update sbuf */ sb->sb_cc -= nn; @@ -478,7 +479,7 @@ sowrite(struct socket *so) return nn; err_disconnected: - DEBUG_MISC(" --- sowrite disconnected, so->so_state = %x, errno = %d\n", + DEBUG_MISC(" --- sowrite disconnected, so->so_state = %x, errno = %d", so->so_state, errno); sofcantsendmore(so); tcp_sockclosed(sototcpcb(so)); @@ -512,7 +513,7 @@ sorecvfrom(struct socket *so) if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST; else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET; - DEBUG_MISC(" udp icmp rx errno = %d-%s\n", + DEBUG_MISC(" udp icmp rx errno = %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) m->m_len = recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC(" did recvfrom %d, errno = %d-%s\n", + DEBUG_MISC(" did recvfrom %d, errno = %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 = ICMP_UNREACH_NET; } - 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 = ICMP6_UNREACH_NO_ROUTE; } - 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) } } - DEBUG_MISC(" addr.sin_port=%d, " - "addr.sin_addr.s_addr=%.16s\n", + DEBUG_MISC(" addr.sin_port=%d, addr.sin_addr.s_addr=%.16s", ntohs(sin->sin_port), inet_ntoa(sin->sin_addr)); break; diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index d24295813a..a6596b63ac 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -641,8 +641,7 @@ findso: (errno != EINPROGRESS) && (errno != EWOULDBLOCK) ) { uint8_t code; - DEBUG_MISC(" tcp fconnect errno = %d-%s\n", - errno,strerror(errno)); + DEBUG_MISC(" tcp fconnect errno = %d-%s", errno, strerror(errno)); if(errno == 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: if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { - DEBUG_MISC(" dup ack m = %p so = %p\n", m, so); + DEBUG_MISC(" dup ack m = %p so = %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)); - DEBUG_MISC(" returning mss = %d\n", mss); + DEBUG_MISC(" returning mss = %d", mss); return mss; } diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 44da8a4e47..2f7f90d67e 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -92,7 +92,7 @@ again: flags = tcp_outflags[tp->t_state]; - DEBUG_MISC(" --- tcp_output flags = 0x%x\n", flags); + DEBUG_MISC(" --- tcp_output flags = 0x%x", flags); /* * 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 = 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 a45ad81dda..4cf0d34d64 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -172,8 +172,7 @@ udp_input(register struct mbuf *m, int iphlen) */ so = socreate(slirp); if (udp_attach(so, AF_INET) == -1) { - DEBUG_MISC(" udp_attach errno = %d-%s\n", - errno, strerror(errno)); + DEBUG_MISC(" udp_attach errno = %d-%s", errno, strerror(errno)); sofree(so); goto bad; } @@ -209,7 +208,7 @@ udp_input(register struct mbuf *m, int iphlen) m->m_len += iphlen; m->m_data -= iphlen; *ip=save_ip; - DEBUG_MISC("udp tx errno = %d-%s\n", errno, strerror(errno)); + DEBUG_MISC("udp tx errno = %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 = socreate(slirp); if (udp_attach(so, AF_INET6) == -1) { - DEBUG_MISC(" udp6_attach errno = %d-%s\n", - errno, strerror(errno)); + DEBUG_MISC(" udp6_attach errno = %d-%s", errno, strerror(errno)); sofree(so); goto bad; } @@ -119,7 +118,7 @@ void udp6_input(struct mbuf *m) m->m_len += iphlen; m->m_data -= iphlen; *ip = save_ip; - DEBUG_MISC("udp tx errno = %d-%s\n", errno, strerror(errno)); + DEBUG_MISC("udp tx errno = %d-%s", errno, strerror(errno)); icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); goto bad; } From patchwork Tue Dec 18 23:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1015754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43KFKh0VGQz9s2P for ; Wed, 19 Dec 2018 10:56:24 +1100 (AEDT) Received: from localhost ([::1]:56933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZPDp-0007kO-Lu for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 18:56:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZORa-0000jY-J5 for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZORY-0005J5-TM for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:30 -0500 Received: from hera.aquilenet.fr ([2a0c:e300::1]:57936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZORY-00053s-Eo for qemu-devel@nongnu.org; Tue, 18 Dec 2018 18:06:28 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id CA1E428CC; Wed, 19 Dec 2018 00:05:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 1I5Gx4AplKMt; Wed, 19 Dec 2018 00:05:25 +0100 (CET) Received: from function.home (unknown [IPv6:2a01:cb19:181:c200:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 07A9A2944; Wed, 19 Dec 2018 00:04:48 +0100 (CET) Received: from samy by function.home with local (Exim 4.91) (envelope-from ) id 1gZOPt-0007MM-Ma; Wed, 19 Dec 2018 00:04:45 +0100 From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 19 Dec 2018 00:04:42 +0100 Message-Id: <20181218230442.27887-65-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> References: <20181218230442.27887-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 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/64] 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 , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" to get them out of the hot path. Signed-off-by: Samuel Thibault Reviewed-by: Marc-André 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; #define DEBUG_CALL(fmt, ...) do { \ - if (slirp_debug & DBG_CALL) { \ + if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ g_debug(fmt "...", ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_ARG(fmt, ...) do { \ - if (slirp_debug & DBG_CALL) { \ + if (G_UNLIKELY(slirp_debug & DBG_CALL)) { \ g_debug(" " fmt, ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_MISC(fmt, ...) do { \ - if (slirp_debug & DBG_MISC) { \ + if (G_UNLIKELY(slirp_debug & DBG_MISC)) { \ g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0) #define DEBUG_ERROR(fmt, ...) do { \ - if (slirp_debug & DBG_ERROR) { \ + if (G_UNLIKELY(slirp_debug & DBG_ERROR)) { \ g_debug(fmt, ##__VA_ARGS__); \ } \ } while (0)