From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 154219914854077.07008708554906; Wed, 14 Nov 2018 04:39:08 -0800 (PST) Received: from localhost ([::1]:59799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuRn-0000Sj-7C for importer@patchew.org; Wed, 14 Nov 2018 07:39:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuPy-0007fc-4m for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuPu-0000fJ-UH for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34112) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuPu-0000en-Mk for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:10 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC1EE8A004; Wed, 14 Nov 2018 12:37:09 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F5FF60C62; Wed, 14 Nov 2018 12:37:00 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:03 +0400 Message-Id: <20181114123643.24091-2-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 12:37:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 01/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Originally, the patch was fixing a bunch of issues, but Peter beat me to it with earlier commit "slirp: fork_exec(): create and connect child socket before fork()". Factor out socket pair creation, to simplify the fork_exec() code. Use the name socketpair_with_oob() since the code is actually similar to what socketpair() would do, except that it uses TCP sockets, for SLIRP to be able to call send with MSG_OOB (since SO_OOBINLINE is set, this could probably be faked instead on regular unix sockets though). Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/misc.c | 142 +++++++++++++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index 4840187750..7362e14339 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -73,85 +73,92 @@ fork_exec(struct socket *so, const char *ex) =20 #else =20 -/* - * XXX This is ugly - * We create and bind a socket, then fork off to another - * process, which connects to this socket, after which we - * exec the wanted program. If something (strange) happens, - * the accept() call could block us forever. - */ +static int +slirp_socketpair_with_oob(int sv[2]) +{ + struct sockaddr_in addr =3D { + .sin_family =3D AF_INET, + .sin_port =3D 0, + .sin_addr.s_addr =3D INADDR_ANY, + }; + socklen_t addrlen =3D sizeof(addr); + int ret, s; + + sv[1] =3D -1; + s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || + listen(s, 1) < 0 || + getsockname(s, (struct sockaddr *)&addr, &addrlen) < 0) { + goto err; + } + + sv[1] =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + if (sv[1] < 0) { + goto err; + } + /* + * This connect won't block because we've already listen()ed on + * the server end (even though we won't accept() the connection + * until later on). + */ + do { + ret =3D connect(sv[1], (struct sockaddr *)&addr, addrlen); + } while (ret < 0 && errno =3D=3D EINTR); + if (ret < 0) { + goto err; + } + + do { + sv[0] =3D accept(s, (struct sockaddr *)&addr, &addrlen); + } while (sv[0] < 0 && errno =3D=3D EINTR); + if (sv[0] < 0) { + goto err; + } + + closesocket(s); + return 0; + +err: + error_report("Error: slirp_socketpair(): %s", strerror(errno)); + if (s >=3D 0) { + closesocket(s); + } + if (sv[1] >=3D 0) { + closesocket(sv[1]); + } + return -1; +} + int fork_exec(struct socket *so, const char *ex) { - int s, cs; - struct sockaddr_in addr, csaddr; - socklen_t addrlen =3D sizeof(addr); - socklen_t csaddrlen =3D sizeof(csaddr); - int opt; char **argv; - int ret; + int opt, c, sp[2]; pid_t pid; =20 DEBUG_CALL("fork_exec"); DEBUG_ARG("so =3D %p", so); DEBUG_ARG("ex =3D %p", ex); =20 - addr.sin_family =3D AF_INET; - addr.sin_port =3D 0; - addr.sin_addr.s_addr =3D INADDR_ANY; - - s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); - if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || - listen(s, 1) < 0) { - error_report("Error: inet socket: %s", strerror(errno)); - if (s >=3D 0) { - closesocket(s); - } + if (slirp_socketpair_with_oob(sp) < 0) { return 0; } =20 - if (getsockname(s, (struct sockaddr *)&csaddr, &csaddrlen) < 0) { - closesocket(s); - return 0; - } - cs =3D qemu_socket(AF_INET, SOCK_STREAM, 0); - if (cs < 0) { - closesocket(s); - return 0; - } - csaddr.sin_addr =3D loopback_addr; - /* - * This connect won't block because we've already listen()ed on - * the server end (even though we won't accept() the connection - * until later on). - */ - do { - ret =3D connect(cs, (struct sockaddr *)&csaddr, csaddrlen); - } while (ret < 0 && errno =3D=3D EINTR); - if (ret < 0) { - closesocket(s); - closesocket(cs); - return 0; - } - pid =3D fork(); switch(pid) { case -1: error_report("Error: fork failed: %s", strerror(errno)); - closesocket(cs); - close(s); + closesocket(sp[0]); + closesocket(sp[1]); return 0; =20 case 0: - setsid(); - - /* Set the DISPLAY */ - close(s); - dup2(cs, 0); - dup2(cs, 1); - dup2(cs, 2); - for (s =3D getdtablesize() - 1; s >=3D 3; s--) - close(s); + setsid(); + dup2(sp[1], 0); + dup2(sp[1], 1); + dup2(sp[1], 2); + for (c =3D getdtablesize() - 1; c >=3D 3; c--) + close(c); =20 argv =3D g_strsplit(ex, " ", -1); execvp(argv[0], (char **)argv); @@ -163,19 +170,12 @@ fork_exec(struct socket *so, const char *ex) exit(1); =20 default: + so->s =3D sp[0]; + closesocket(sp[1]); qemu_add_child_watch(pid); - closesocket(cs); - /* - * This should never block, because we already connect()ed - * on the child end before we forked. - */ - do { - so->s =3D accept(s, (struct sockaddr *)&addr, &addrlen= ); - } while (so->s < 0 && errno =3D=3D EINTR); - closesocket(s); - socket_set_fast_reuse(so->s); - opt =3D 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, siz= eof(int)); + socket_set_fast_reuse(so->s); + opt =3D 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); qemu_set_nonblock(so->s); return 1; } --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199304461510.415428519015; Wed, 14 Nov 2018 04:41:44 -0800 (PST) Received: from localhost ([::1]:59816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUJ-0002WF-6u for importer@patchew.org; Wed, 14 Nov 2018 07:41:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQL-0007uK-TC for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQC-0000mw-Ke for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQ6-0000jq-5V for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:22 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63D6589AF5; Wed, 14 Nov 2018 12:37:20 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5F585C21A; Wed, 14 Nov 2018 12:37:13 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:04 +0400 Message-Id: <20181114123643.24091-3-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 12:37:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 02/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Samuel Thibault --- include/glib-compat.h | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/include/glib-compat.h b/include/glib-compat.h index fdf95a255d..8a078c5288 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -83,6 +83,62 @@ static inline gboolean g_strv_contains_qemu(const gchar = *const *strv, } #define g_strv_contains(a, b) g_strv_contains_qemu(a, b) =20 +#if !GLIB_CHECK_VERSION(2, 58, 0) +typedef struct QemuGSpawnFds { + GSpawnChildSetupFunc child_setup; + gpointer user_data; + gint stdin_fd; + gint stdout_fd; + gint stderr_fd; +} QemuGSpawnFds; + +static inline void +qemu_gspawn_fds_setup(gpointer user_data) +{ + QemuGSpawnFds *q =3D (QemuGSpawnFds *)user_data; + + dup2(q->stdin_fd, 0); + dup2(q->stdout_fd, 1); + dup2(q->stderr_fd, 2); + q->child_setup(q->user_data); +} +#endif + +static inline gboolean +g_spawn_async_with_fds_qemu(const gchar *working_directory, + gchar **argv, + gchar **envp, + GSpawnFlags flags, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GPid *child_pid, + gint stdin_fd, + gint stdout_fd, + gint stderr_fd, + GError **error) +{ +#if GLIB_CHECK_VERSION(2, 58, 0) + return g_spawn_async_with_fds(working_directory, argv, envp, flags, + child_setup, user_data, + child_pid, stdin_fd, stdout_fd, stderr_f= d, + error); +#else + QemuGSpawnFds setup =3D { + .child_setup =3D child_setup, + .user_data =3D user_data, + .stdin_fd =3D stdin_fd, + .stdout_fd =3D stdout_fd, + .stderr_fd =3D stderr_fd, + }; + + return g_spawn_async(working_directory, argv, envp, flags, + qemu_gspawn_fds_setup, &setup, + child_pid, error); +#endif +} + +#define g_spawn_async_with_fds(wd, argv, env, f, c, d, p, ifd, ofd, efd, e= rr) \ + g_spawn_async_with_fds_qemu(wd, argv, env, f, c, d, p, ifd, ofd, efd, = err) =20 #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154219933359186.90859158614717; Wed, 14 Nov 2018 04:42:13 -0800 (PST) Received: from localhost ([::1]:59817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUm-0002qy-Ap for importer@patchew.org; Wed, 14 Nov 2018 07:42:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQR-00087n-Na for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQP-0000th-Of for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36935) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQL-0000lj-TS for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D4F189AF6; Wed, 14 Nov 2018 12:37:25 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24C765C1A1; Wed, 14 Nov 2018 12:37:23 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:05 +0400 Message-Id: <20181114123643.24091-4-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 12:37:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 03/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Use g_spawn_async_with_fds() to setup the child. GSpawn handles reaping the child, and closing parent file descriptors. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/misc.c | 75 +++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/slirp/misc.c b/slirp/misc.c index 7362e14339..7972b9b05b 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -129,56 +129,53 @@ err: return -1; } =20 +static void +fork_exec_child_setup(gpointer data) +{ + setsid(); +} + int fork_exec(struct socket *so, const char *ex) { - char **argv; - int opt, c, sp[2]; - pid_t pid; + GError *err =3D NULL; + char **argv; + int opt, sp[2]; =20 - DEBUG_CALL("fork_exec"); - DEBUG_ARG("so =3D %p", so); - DEBUG_ARG("ex =3D %p", ex); + DEBUG_CALL("fork_exec"); + DEBUG_ARG("so =3D %p", so); + DEBUG_ARG("ex =3D %p", ex); =20 if (slirp_socketpair_with_oob(sp) < 0) { return 0; } =20 - pid =3D fork(); - switch(pid) { - case -1: - error_report("Error: fork failed: %s", strerror(errno)); - closesocket(sp[0]); - closesocket(sp[1]); - return 0; - - case 0: - setsid(); - dup2(sp[1], 0); - dup2(sp[1], 1); - dup2(sp[1], 2); - for (c =3D getdtablesize() - 1; c >=3D 3; c--) - close(c); + argv =3D g_strsplit(ex, " ", -1); + g_spawn_async_with_fds(NULL /* cwd */, + argv, + NULL /* env */, + G_SPAWN_SEARCH_PATH, + fork_exec_child_setup, NULL /* data */, + NULL /* child_pid */, + sp[1], sp[1], sp[1], + &err); + g_strfreev(argv); =20 - argv =3D g_strsplit(ex, " ", -1); - execvp(argv[0], (char **)argv); - - /* Ooops, failed, let's tell the user why */ - fprintf(stderr, "Error: execvp of %s failed: %s\n", - argv[0], strerror(errno)); - close(0); close(1); close(2); /* XXX */ - exit(1); + if (err) { + error_report("%s", err->message); + g_error_free(err); + closesocket(sp[0]); + closesocket(sp[1]); + return 0; + } =20 - default: - so->s =3D sp[0]; - closesocket(sp[1]); - qemu_add_child_watch(pid); - socket_set_fast_reuse(so->s); - opt =3D 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); - qemu_set_nonblock(so->s); - return 1; - } + so->s =3D sp[0]; + closesocket(sp[1]); + socket_set_fast_reuse(so->s); + opt =3D 1; + qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + qemu_set_nonblock(so->s); + return 1; } #endif =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199192694964.4334296543628; Wed, 14 Nov 2018 04:39:52 -0800 (PST) Received: from localhost ([::1]:59800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSV-00012U-7A for importer@patchew.org; Wed, 14 Nov 2018 07:39:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQT-0008HB-Lj for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQR-0000vR-OW for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52000) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQP-0000sH-QL for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 857383164666; Wed, 14 Nov 2018 12:37:38 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1983B5D773; Wed, 14 Nov 2018 12:37:28 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:06 +0400 Message-Id: <20181114123643.24091-5-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 12:37:38 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 04/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/mbuf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/slirp/mbuf.h b/slirp/mbuf.h index bfdf8c4577..cbf17e136b 100644 --- a/slirp/mbuf.h +++ b/slirp/mbuf.h @@ -72,7 +72,6 @@ * How much free room there is */ #define M_FREEROOM(m) (M_ROOM(m) - (m)->m_len) -#define M_TRAILINGSPACE M_FREEROOM =20 struct mbuf { /* XXX should union some of these! */ --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199204634690.4250201802283; Wed, 14 Nov 2018 04:40:04 -0800 (PST) Received: from localhost ([::1]:59802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSh-00018s-Cw for importer@patchew.org; Wed, 14 Nov 2018 07:40:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQd-0008QS-Q5 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQZ-00010m-KG for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52913) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQZ-0000zd-CE for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:37:51 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA0E7C07224C; Wed, 14 Nov 2018 12:37:49 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C8685C1A1; Wed, 14 Nov 2018 12:37:41 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:07 +0400 Message-Id: <20181114123643.24091-6-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:37:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 05/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This will bring slirp a bit forward to the state of an independent project. This could be squashed with earlier submitted "slirp: associate slirp_output". Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/libslirp.h | 7 +++++-- slirp/slirp.h | 2 +- net/slirp.c | 6 +++++- slirp/ncsi.c | 2 +- slirp/slirp.c | 10 +++++----- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 04b6db9f49..36d5fb9163 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -5,7 +5,10 @@ =20 typedef struct Slirp Slirp; =20 -typedef void (*slirp_output)(void *opaque, const uint8_t *pkt, int pkt_len= ); +typedef struct SlirpCb { + void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); +} SlirpCb; + =20 Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, @@ -17,7 +20,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct= in_addr vnetwork, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, const char *vdomainname, - slirp_output output, + const SlirpCb *callbacks, void *opaque); void slirp_cleanup(Slirp *slirp); =20 diff --git a/slirp/slirp.h b/slirp/slirp.h index de299aa36c..f7c087456a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -220,7 +220,7 @@ struct Slirp { GRand *grand; QEMUTimer *ra_timer; =20 - slirp_output output; + const SlirpCb *cb; void *opaque; }; =20 diff --git a/net/slirp.c b/net/slirp.c index dfc72cfc2e..233f66b1ef 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -140,6 +140,10 @@ static NetClientInfo net_slirp_info =3D { .cleanup =3D net_slirp_cleanup, }; =20 +static SlirpCb slirp_cb =3D { + .output =3D net_slirp_output, +}; + static int net_slirp_init(NetClientState *peer, const char *model, const char *name, int restricted, bool ipv4, const char *vnetwork, const char *vho= st, @@ -379,7 +383,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, vhostname, tftp_server_name, tftp_export, bootfile, dhcp, dns, ip6_dns, dnssearch, vdomainname, - net_slirp_output, s); + &slirp_cb, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); =20 for (config =3D slirp_configs; config; config =3D config->next) { diff --git a/slirp/ncsi.c b/slirp/ncsi.c index d7701f7785..10decfb5ef 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -163,5 +163,5 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) *pchecksum =3D htonl(checksum); ncsi_rsp_len +=3D 4; =20 - slirp->output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); + slirp->cb->output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); } diff --git a/slirp/slirp.c b/slirp/slirp.c index 0e4ade3e4a..7213915bf3 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -288,14 +288,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, st= ruct in_addr vnetwork, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, const char *vdomainname, - slirp_output output, + const SlirpCb *callbacks, void *opaque) { Slirp *slirp =3D g_malloc0(sizeof(Slirp)); =20 slirp_init_once(); =20 - slirp->output =3D output; + slirp->cb =3D callbacks; slirp->grand =3D g_rand_new(); slirp->restricted =3D restricted; =20 @@ -843,7 +843,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt,= int pkt_len) rah->ar_sip =3D ah->ar_tip; memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); rah->ar_tip =3D ah->ar_sip; - slirp->output(slirp->opaque, arp_reply, sizeof(arp_reply)); + slirp->cb->output(slirp->opaque, arp_reply, sizeof(arp_reply)); } break; case ARPOP_REPLY: @@ -943,7 +943,7 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, /* target IP */ rah->ar_tip =3D iph->ip_dst.s_addr; slirp->client_ipaddr =3D iph->ip_dst; - slirp->output(slirp->opaque, arp_req, sizeof(arp_req)); + slirp->cb->output(slirp->opaque, arp_req, sizeof(arp_req)); ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ @@ -1029,7 +1029,7 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); - slirp->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); + slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; } =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15421993875162.227757022719743; Wed, 14 Nov 2018 04:43:07 -0800 (PST) Received: from localhost ([::1]:59820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVe-0003ZF-9R for importer@patchew.org; Wed, 14 Nov 2018 07:43:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQn-00007S-Bm for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQi-00016M-Ly for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59246) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQi-000166-F2 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:00 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C09A43078AB6; Wed, 14 Nov 2018 12:37:59 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B5DB60BF6; Wed, 14 Nov 2018 12:37:53 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:08 +0400 Message-Id: <20181114123643.24091-7-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 14 Nov 2018 12:37:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 06/41] slirp: add a callback for qemu_chr_fe_write_all() 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Replace strong dependency on QEMU. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 1 + net/slirp.c | 6 ++++++ slirp/slirp.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 36d5fb9163..16ced2aa0f 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -7,6 +7,7 @@ typedef struct Slirp Slirp; =20 typedef struct SlirpCb { void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); + int (*chr_write_all)(void *chr, const void *buf, size_t len); } SlirpCb; =20 =20 diff --git a/net/slirp.c b/net/slirp.c index 233f66b1ef..5c1f676487 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -140,8 +140,14 @@ static NetClientInfo net_slirp_info =3D { .cleanup =3D net_slirp_cleanup, }; =20 +static int net_slirp_chr_write_all(void *chr, const void *buf, size_t len) +{ + return qemu_chr_fe_write_all(chr, buf, len); +} + static SlirpCb slirp_cb =3D { .output =3D net_slirp_output, + .chr_write_all =3D net_slirp_chr_write_all, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/slirp.c b/slirp/slirp.c index 7213915bf3..4e809e5d7f 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1099,7 +1099,7 @@ ssize_t slirp_send(struct socket *so, const void *buf= , size_t len, int flags) if (so->s =3D=3D -1 && so->chardev) { /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ - qemu_chr_fe_write_all(so->chardev, buf, len); + so->slirp->cb->chr_write_all(so->chardev, buf, len); return len; } =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199510934524.6477640524178; Wed, 14 Nov 2018 04:45:10 -0800 (PST) Received: from localhost ([::1]:59832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuXd-0005c6-Ms for importer@patchew.org; Wed, 14 Nov 2018 07:45:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuQr-0000BW-5J for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuQp-0001Ek-Jg for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44802) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuQp-0001CN-7R for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7C4BC07C56F; Wed, 14 Nov 2018 12:38:05 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F1B160C5F; Wed, 14 Nov 2018 12:38:03 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:09 +0400 Message-Id: <20181114123643.24091-8-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:38:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 07/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 6 ++++++ net/slirp.c | 19 +++++++++++++++++++ slirp/if.c | 2 +- slirp/ip6_icmp.c | 6 ++++-- slirp/slirp.c | 11 ++++++----- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 16ced2aa0f..fcebcd1e58 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -5,9 +5,15 @@ =20 typedef struct Slirp Slirp; =20 +typedef enum SlirpClockType { + SLIRP_CLOCK_VIRTUAL, + SLIRP_CLOCK_REALTIME, +} SlirpClockType; + typedef struct SlirpCb { void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); int (*chr_write_all)(void *chr, const void *buf, size_t len); + int64_t (*clock_get_ns)(SlirpClockType type); } SlirpCb; =20 =20 diff --git a/net/slirp.c b/net/slirp.c index 5c1f676487..af6c643b82 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -145,9 +145,28 @@ static int net_slirp_chr_write_all(void *chr, const vo= id *buf, size_t len) return qemu_chr_fe_write_all(chr, buf, len); } =20 +static QEMUClockType slirp_clock_to_qemu(SlirpClockType type) +{ + switch (type) { + case SLIRP_CLOCK_VIRTUAL: + return QEMU_CLOCK_VIRTUAL; + case SLIRP_CLOCK_REALTIME: + return QEMU_CLOCK_REALTIME; + } + + g_warn_if_reached(); + return QEMU_CLOCK_REALTIME; +} + +static int64_t net_slirp_clock_get_ns(SlirpClockType type) +{ + return qemu_clock_get_ns(slirp_clock_to_qemu(type)); +} + static SlirpCb slirp_cb =3D { .output =3D net_slirp_output, .chr_write_all =3D net_slirp_chr_write_all, + .clock_get_ns =3D net_slirp_clock_get_ns, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/if.c b/slirp/if.c index 590753c658..1c96869831 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -150,7 +150,7 @@ diddit: */ void if_start(Slirp *slirp) { - uint64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); + uint64_t now =3D slirp->cb->clock_get_ns(SLIRP_CLOCK_REALTIME); bool from_batchq =3D false; struct mbuf *ifm, *ifm_next, *ifqt; =20 diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index cd1e0b9fe1..0f80d49ef9 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -17,7 +17,8 @@ static void ra_timer_handler(void *opaque) { Slirp *slirp =3D opaque; timer_mod(slirp->ra_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + NDP_Interval); + slirp->cb->clock_get_ns(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + + NDP_Interval); ndp_send_ra(slirp); } =20 @@ -31,7 +32,8 @@ 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(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + + NDP_Interval); } =20 void icmp6_cleanup(Slirp *slirp) diff --git a/slirp/slirp.c b/slirp/slirp.c index 4e809e5d7f..979495e88b 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -571,15 +571,15 @@ void slirp_pollfds_fill(GArray *pollfds, uint32_t *ti= meout) =20 void slirp_pollfds_poll(GArray *pollfds, int select_error) { - Slirp *slirp; + Slirp *slirp =3D QTAILQ_FIRST(&slirp_instances); struct socket *so, *so_next; int ret; =20 - if (QTAILQ_EMPTY(&slirp_instances)) { + if (!slirp) { return; } =20 - curtime =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + curtime =3D slirp->cb->clock_get_ns(SLIRP_CLOCK_REALTIME) / SCALE_MS; =20 QTAILQ_FOREACH(slirp, &slirp_instances, entry) { /* @@ -947,7 +947,8 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, ifm->resolution_requested =3D true; =20 /* Expire request and drop outgoing packet after 1 second */ - ifm->expiration_date =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME= ) + 1000000000ULL; + ifm->expiration_date =3D slirp->cb->clock_get_ns(SLIRP_CLOCK_R= EALTIME) + + 1000000000ULL; } return 0; } else { @@ -974,7 +975,7 @@ static int if_encap6(Slirp *slirp, struct mbuf *ifm, st= ruct ethhdr *eh, ndp_send_ns(slirp, ip6h->ip_dst); ifm->resolution_requested =3D true; ifm->expiration_date =3D - qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + 1000000000ULL; + slirp->cb->clock_get_ns(SLIRP_CLOCK_REALTIME) + 1000000000= ULL; } return 0; } else { --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199567584253.7546798532817; Wed, 14 Nov 2018 04:46:07 -0800 (PST) Received: from localhost ([::1]:59839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuYY-0006MY-It for importer@patchew.org; Wed, 14 Nov 2018 07:46:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuRX-0000iQ-IE for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuRR-0001Z3-U3 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52342) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuRP-0001JT-DA for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63EEB31524FE; Wed, 14 Nov 2018 12:38:18 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 774585D788; Wed, 14 Nov 2018 12:38:09 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:10 +0400 Message-Id: <20181114123643.24091-9-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 12:38:18 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 08/41] slirp: add callbacks for timer 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 6 ++++++ slirp/slirp.h | 2 +- net/slirp.c | 23 +++++++++++++++++++++++ slirp/ip6_icmp.c | 21 ++++++++++----------- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index fcebcd1e58..88185e6c33 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -10,10 +10,16 @@ typedef enum SlirpClockType { SLIRP_CLOCK_REALTIME, } SlirpClockType; =20 +typedef void (*SlirpTimerCb)(void *opaque); + typedef struct SlirpCb { void (*output)(void *opaque, const uint8_t *pkt, int pkt_len); int (*chr_write_all)(void *chr, const void *buf, size_t len); int64_t (*clock_get_ns)(SlirpClockType type); + void *(*timer_new)(SlirpClockType type, int scale, + SlirpTimerCb cb, void *opaque); + void (*timer_free)(void *timer); + void (*timer_mod)(void *timer, int64_t expire_timer); } SlirpCb; =20 =20 diff --git a/slirp/slirp.h b/slirp/slirp.h index f7c087456a..e5abf1c594 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -218,7 +218,7 @@ struct Slirp { NdpTable ndp_table; =20 GRand *grand; - QEMUTimer *ra_timer; + void *ra_timer; =20 const SlirpCb *cb; void *opaque; diff --git a/net/slirp.c b/net/slirp.c index af6c643b82..7b28886802 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -163,10 +163,33 @@ static int64_t net_slirp_clock_get_ns(SlirpClockType = type) return qemu_clock_get_ns(slirp_clock_to_qemu(type)); } =20 +static void *net_slirp_timer_new(SlirpClockType type, + int scale, + SlirpTimerCb cb, void *opaque) +{ + return timer_new_full(NULL, slirp_clock_to_qemu(type), + scale, QEMU_TIMER_ATTR_EXTERNAL, + cb, opaque); +} + +static void net_slirp_timer_free(void *timer) +{ + timer_del(timer); + timer_free(timer); +} + +static void net_slirp_timer_mod(void *timer, int64_t expire_timer) +{ + timer_mod(timer, expire_timer); +} + static SlirpCb slirp_cb =3D { .output =3D net_slirp_output, .chr_write_all =3D net_slirp_chr_write_all, .clock_get_ns =3D net_slirp_clock_get_ns, + .timer_new =3D net_slirp_timer_new, + .timer_free =3D net_slirp_timer_free, + .timer_mod =3D net_slirp_timer_mod, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 0f80d49ef9..71d95daef0 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -16,9 +16,10 @@ static void ra_timer_handler(void *opaque) { Slirp *slirp =3D opaque; - timer_mod(slirp->ra_timer, - slirp->cb->clock_get_ns(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + - NDP_Interval); + + slirp->cb->timer_mod(slirp->ra_timer, + slirp->cb->clock_get_ns(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + + NDP_Interval); ndp_send_ra(slirp); } =20 @@ -28,12 +29,11 @@ void icmp6_init(Slirp *slirp) return; } =20 - slirp->ra_timer =3D timer_new_full(NULL, QEMU_CLOCK_VIRTUAL, - SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL, - ra_timer_handler, slirp); - timer_mod(slirp->ra_timer, - slirp->cb->clock_get_ns(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + - NDP_Interval); + slirp->ra_timer =3D slirp->cb->timer_new(SLIRP_CLOCK_VIRTUAL, SCALE_MS, + ra_timer_handler, slirp); + slirp->cb->timer_mod(slirp->ra_timer, + slirp->cb->clock_get_ns(SLIRP_CLOCK_VIRTUAL) / SCALE_MS + + NDP_Interval); } =20 void icmp6_cleanup(Slirp *slirp) @@ -42,8 +42,7 @@ void icmp6_cleanup(Slirp *slirp) return; } =20 - timer_del(slirp->ra_timer); - timer_free(slirp->ra_timer); + slirp->cb->timer_free(slirp->ra_timer); } =20 static void icmp6_send_echoreply(struct mbuf *m, Slirp *slirp, struct ip6 = *ip, --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199498849652.2211060948155; Wed, 14 Nov 2018 04:44:58 -0800 (PST) Received: from localhost ([::1]:59830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuXG-0005GK-8C for importer@patchew.org; Wed, 14 Nov 2018 07:44:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuRV-0000gq-J0 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuRN-0001X6-1T for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuRH-0001SN-Ja for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:38 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEFE73164667; Wed, 14 Nov 2018 12:38:30 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01CF66091F; Wed, 14 Nov 2018 12:38:21 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:11 +0400 Message-Id: <20181114123643.24091-10-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 12:38:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 09/41] slirp: add a set_nonblock() 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" qemu_set_nonblock() does some event registration with the main loop on win32, let's have a callback. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 1 + net/slirp.c | 1 + slirp/misc.c | 2 +- slirp/tcp_subr.c | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 88185e6c33..f2e7f94ebb 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -20,6 +20,7 @@ typedef struct SlirpCb { SlirpTimerCb cb, void *opaque); void (*timer_free)(void *timer); void (*timer_mod)(void *timer, int64_t expire_timer); + void (*set_nonblock)(int fd); } SlirpCb; =20 =20 diff --git a/net/slirp.c b/net/slirp.c index 7b28886802..5ea8c255f6 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -190,6 +190,7 @@ static SlirpCb slirp_cb =3D { .timer_new =3D net_slirp_timer_new, .timer_free =3D net_slirp_timer_free, .timer_mod =3D net_slirp_timer_mod, + .set_nonblock =3D qemu_set_nonblock, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/misc.c b/slirp/misc.c index 7972b9b05b..dd2b3512a8 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -174,7 +174,7 @@ fork_exec(struct socket *so, const char *ex) socket_set_fast_reuse(so->s); opt =3D 1; qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); - qemu_set_nonblock(so->s); + so->slirp->cb->set_nonblock(so->s); return 1; } #endif diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 4b40850c7a..8d97f1f54e 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -412,7 +412,7 @@ int tcp_fconnect(struct socket *so, unsigned short af) int opt, s=3Dso->s; struct sockaddr_storage addr; =20 - qemu_set_nonblock(s); + so->slirp->cb->set_nonblock(s); socket_set_fast_reuse(s); opt =3D 1; qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt)); @@ -484,7 +484,7 @@ void tcp_connect(struct socket *inso) tcp_close(sototcpcb(so)); /* This will sofree() as well */ return; } - qemu_set_nonblock(s); + so->slirp->cb->set_nonblock(s); socket_set_fast_reuse(s); opt =3D 1; qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199677639550.5047330571608; Wed, 14 Nov 2018 04:47:57 -0800 (PST) Received: from localhost ([::1]:59850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuaK-0007eZ-A1 for importer@patchew.org; Wed, 14 Nov 2018 07:47:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuRX-0000iN-FL for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuRP-0001YC-Bj for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52590) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuRN-0001UC-0e for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:41 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A971131500B8; Wed, 14 Nov 2018 12:38:35 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0BB360851; Wed, 14 Nov 2018 12:38:34 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:12 +0400 Message-Id: <20181114123643.24091-11-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 12:38:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 10/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Nobody cares for over 14y. Somebody can revert or rewrite if interested by that. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/slirp_config.h | 4 ---- slirp/slirp.c | 41 ----------------------------------------- 2 files changed, 45 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index c59f655207..721667e3ef 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -2,10 +2,6 @@ * User definable configuration options */ =20 -/* Define if you want the connection to be probed */ -/* XXX Not working yet, so ignore this for now */ -#undef PROBE_CONN - /* Define to 1 if you want KEEPALIVE timers */ #define DO_KEEPALIVE 0 =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index 979495e88b..2d32debf2a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -699,47 +699,6 @@ void slirp_pollfds_poll(GArray *pollfds, int select_er= ror) } } } - - /* - * Probe a still-connecting, non-blocking socket - * to check if it's still alive - */ -#ifdef PROBE_CONN - if (so->so_state & SS_ISFCONNECTING) { - ret =3D qemu_recv(so->s, &ret, 0, 0); - - if (ret < 0) { - /* XXX */ - if (errno =3D=3D EAGAIN || errno =3D=3D EWOULDBLOC= K || - errno =3D=3D EINPROGRESS || errno =3D=3D ENOTC= ONN) { - continue; /* Still connecting, continue */ - } - - /* else failed */ - so->so_state &=3D SS_PERSISTENT_MASK; - so->so_state |=3D SS_NOFDREF; - - /* tcp_input will take care of it */ - } else { - ret =3D send(so->s, &ret, 0, 0); - if (ret < 0) { - /* XXX */ - if (errno =3D=3D EAGAIN || errno =3D=3D EWOULD= BLOCK || - errno =3D=3D EINPROGRESS || errno =3D=3D E= NOTCONN) { - continue; - } - /* else failed */ - so->so_state &=3D SS_PERSISTENT_MASK; - so->so_state |=3D SS_NOFDREF; - } else { - so->so_state &=3D ~SS_ISFCONNECTING; - } - - } - tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, - so->so_ffamily); - } /* SS_ISFCONNECTING */ -#endif } =20 /* --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199378921554.0574780369376; Wed, 14 Nov 2018 04:42:58 -0800 (PST) Received: from localhost ([::1]:59818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVV-0003Sc-Rl for importer@patchew.org; Wed, 14 Nov 2018 07:42:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuRZ-0000kA-4A for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuRX-0001cl-FZ for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41712) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuRV-0001ZN-J0 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:38:50 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 479EA30A697A; Wed, 14 Nov 2018 12:38:46 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 253B32A2F2; Wed, 14 Nov 2018 12:38:38 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:13 +0400 Message-Id: <20181114123643.24091-12-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 14 Nov 2018 12:38:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 11/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Looking at git history, this looks like something from the past, when there was a tty layer. Let's remove it. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp_config.h | 7 ------- slirp/if.c | 2 -- 2 files changed, 9 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 721667e3ef..f0cc1c781b 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -5,13 +5,6 @@ /* Define to 1 if you want KEEPALIVE timers */ #define DO_KEEPALIVE 0 =20 -/* Define this if you want slirp to write to the tty as fast as it can */ -/* This should only be set if you are using load-balancing, slirp does a */ -/* pretty good job on single modems already, and seting this will make */ -/* interactive sessions less responsive */ -/* XXXXX Talk about having fast modem as unit 0 */ -#undef FULL_BOLT - /*********************************************************/ /* * Autoconf defined configuration options diff --git a/slirp/if.c b/slirp/if.c index 1c96869831..1a9122a732 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -131,12 +131,10 @@ diddit: } } =20 -#ifndef FULL_BOLT /* * This prevents us from malloc()ing too many mbufs */ if_start(ifm->slirp); -#endif } =20 /* --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199767761672.0270056709516; Wed, 14 Nov 2018 04:49:27 -0800 (PST) Received: from localhost ([::1]:59852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMubh-0000ZR-Gc for importer@patchew.org; Wed, 14 Nov 2018 07:49:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSg-0001cQ-1u for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuSZ-00029O-7l for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35056) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuSX-0001n8-Ct for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:55 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64D568E251; Wed, 14 Nov 2018 12:39:10 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 104A316D2C; Wed, 14 Nov 2018 12:38:49 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:14 +0400 Message-Id: <20181114123643.24091-13-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 12:39:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 12/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The soread() function may be used on datagram sockets, and would provide different behaviour if HAVE_READV was set, on empty datagrams. This looks like a minor optimization, that never has been a strong goal for slirp. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp_config.h | 3 --- slirp/socket.c | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index f0cc1c781b..3ce64e088e 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -29,9 +29,6 @@ /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 -/* Define if you have readv */ -#undef HAVE_READV - /* Define if iovec needs to be declared */ #undef DECLARE_IOVEC #ifdef _WIN32 diff --git a/slirp/socket.c b/slirp/socket.c index 041ec5061a..7012c7c07d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -187,12 +187,7 @@ soread(struct socket *so) */ sopreprbuf(so, iov, &n); =20 -#ifdef HAVE_READV - nn =3D readv(so->s, (struct iovec *)iov, n); - DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); -#else nn =3D qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0); -#endif if (nn <=3D 0) { if (nn < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)) return 0; @@ -226,7 +221,6 @@ soread(struct socket *so) } } =20 -#ifndef HAVE_READV /* * If there was no error, try and read the second time round * We read again if n =3D 2 (ie, there's another part of the buffer) @@ -244,7 +238,6 @@ soread(struct socket *so) } =20 DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); -#endif =20 /* Update fields */ sb->sb_cc +=3D nn; @@ -452,13 +445,7 @@ sowrite(struct socket *so) } /* Check if there's urgent data to send, and if so, send it */ =20 -#ifdef HAVE_READV - nn =3D writev(so->s, (const struct iovec *)iov, n); - - DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); -#else nn =3D slirp_send(so, iov[0].iov_base, iov[0].iov_len,0); -#endif /* This should never happen, but people tell me it does *shrug* */ if (nn < 0 && (errno =3D=3D EAGAIN || errno =3D=3D EINTR)) return 0; @@ -467,7 +454,6 @@ sowrite(struct socket *so) goto err_disconnected; } =20 -#ifndef HAVE_READV if (n =3D=3D 2 && nn =3D=3D iov[0].iov_len) { int ret; ret =3D slirp_send(so, iov[1].iov_base, iov[1].iov_len,0); @@ -475,7 +461,6 @@ sowrite(struct socket *so) nn +=3D ret; } DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); -#endif =20 /* Update sbuf */ sb->sb_cc -=3D nn; --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199874772522.8508274265994; Wed, 14 Nov 2018 04:51:14 -0800 (PST) Received: from localhost ([::1]:59868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMudU-0001zH-To for importer@patchew.org; Wed, 14 Nov 2018 07:51:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSg-0001cR-1v for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuSa-0002AJ-PT for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuSa-0001t3-I4 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D473312E9D4; Wed, 14 Nov 2018 12:39:23 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45B6C18A5F; Wed, 14 Nov 2018 12:39:13 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:15 +0400 Message-Id: <20181114123643.24091-14-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 14 Nov 2018 12:39:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 13/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 e5abf1c594..1dbe39bc9a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -35,9 +35,6 @@ typedef char *caddr_t; #ifndef NO_UNIX_SOCKETS #include #endif -#ifdef HAVE_SYS_SIGNAL_H -# include -#endif #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 3ce64e088e..2605c4222b 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -50,9 +50,6 @@ #define HAVE_ARPA_INET_H #endif =20 -/* Define if you have sys/signal.h */ -#undef HAVE_SYS_SIGNAL_H - /* Define if you have sys/stropts.h */ #undef HAVE_SYS_STROPTS_H =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199711450840.6366152146027; Wed, 14 Nov 2018 04:48:31 -0800 (PST) Received: from localhost ([::1]:59851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuar-00083M-Vh for importer@patchew.org; Wed, 14 Nov 2018 07:48:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSQ-0001S7-IA for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuSO-00022F-Kl for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54026) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuSJ-0001zK-HN for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:39 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD6C3B162; Wed, 14 Nov 2018 12:39:37 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29E575D787; Wed, 14 Nov 2018 12:39:26 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:16 +0400 Message-Id: <20181114123643.24091-15-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 14 Nov 2018 12:39:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 14/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 1dbe39bc9a..7c0bcd9e1c 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -19,10 +19,6 @@ typedef char *caddr_t; # endif #endif =20 -#ifdef HAVE_SYS_BITYPES_H -# include -#endif - #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 2605c4222b..a205dc8c28 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -23,9 +23,6 @@ #define HAVE_SYS_FILIO_H #endif =20 -/* Define if you have sys/bitypes.h */ -#undef HAVE_SYS_BITYPES_H - /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199558327432.8218198826305; Wed, 14 Nov 2018 04:45:58 -0800 (PST) Received: from localhost ([::1]:59836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuYP-0006Dm-5d for importer@patchew.org; Wed, 14 Nov 2018 07:45:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuSg-0001cP-1n for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuSb-0002Ay-Ch for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46496) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuSb-000262-3U for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:39:57 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 425959F749; Wed, 14 Nov 2018 12:39:49 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B5CD1057066; Wed, 14 Nov 2018 12:39:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:17 +0400 Message-Id: <20181114123643.24091-16-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 14 Nov 2018 12:39:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 15/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 7c0bcd9e1c..424151b99b 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -28,9 +28,6 @@ typedef char *caddr_t; #include #endif =20 -#ifndef NO_UNIX_SOCKETS -#include -#endif #ifndef _WIN32 #include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index a205dc8c28..4417b05d1c 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -58,9 +58,3 @@ #ifndef _WIN32 #define HAVE_INET_ATON #endif - -/* Define if you DON'T have unix-domain sockets */ -#undef NO_UNIX_SOCKETS -#ifdef _WIN32 -#define NO_UNIX_SOCKETS -#endif --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200046113161.0724398661065; Wed, 14 Nov 2018 04:54:06 -0800 (PST) Received: from localhost ([::1]:59880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMugG-0004Qr-Nt for importer@patchew.org; Wed, 14 Nov 2018 07:54:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuT2-0001zr-8X for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuSt-0002PS-QC for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60136) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuSt-0002Od-Jp for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5B8A307D992; Wed, 14 Nov 2018 12:40:13 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE94461482; Wed, 14 Nov 2018 12:39:52 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:18 +0400 Message-Id: <20181114123643.24091-17-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 14 Nov 2018 12:40:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 16/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 424151b99b..92abb2d78d 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -54,11 +54,6 @@ typedef char *caddr_t; #define remque slirp_remque #define quehead slirp_quehead =20 -#ifdef HAVE_SYS_STROPTS_H -#include -#endif - - #include "debug.h" =20 #include "qemu/queue.h" diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 4417b05d1c..47811e36dc 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -47,9 +47,6 @@ #define HAVE_ARPA_INET_H #endif =20 -/* Define if you have sys/stropts.h */ -#undef HAVE_SYS_STROPTS_H - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200227512570.4289337358198; Wed, 14 Nov 2018 04:57:07 -0800 (PST) Received: from localhost ([::1]:59897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMujA-0006wf-3b for importer@patchew.org; Wed, 14 Nov 2018 07:57:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuTZ-0002Px-Mp for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTU-0002rx-Q5 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTU-0002Tb-J0 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9428B8E5B6; Wed, 14 Nov 2018 12:40:26 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B91E05D75C; Wed, 14 Nov 2018 12:40:17 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:19 +0400 Message-Id: <20181114123643.24091-18-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 14 Nov 2018 12:40:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 17/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 47811e36dc..e95284071a 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -41,12 +41,6 @@ #define HAVE_SYS_SELECT_H #endif =20 -/* Define if you have arpa/inet.h */ -#undef HAVE_ARPA_INET_H -#ifndef _WIN32 -#define HAVE_ARPA_INET_H -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199773346268.6843011276296; Wed, 14 Nov 2018 04:49:33 -0800 (PST) Received: from localhost ([::1]:59853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMubl-0000e8-17 for importer@patchew.org; Wed, 14 Nov 2018 07:49:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuTZ-0002Py-N1 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTU-0002rH-BM for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46280) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTU-0002gK-4h for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 255F4C04B2EF; Wed, 14 Nov 2018 12:40:42 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 379E960C6B; Wed, 14 Nov 2018 12:40:29 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:20 +0400 Message-Id: <20181114123643.24091-19-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:40:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 18/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 92abb2d78d..7aa14feeb6 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -40,10 +40,6 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_WAIT_H -# include -#endif - #ifdef HAVE_SYS_FILIO_H # include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index e95284071a..9becb98e11 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -32,9 +32,6 @@ #define DECLARE_IOVEC #endif =20 -/* Define if you have a POSIX.1 sys/wait.h */ -#undef HAVE_SYS_WAIT_H - /* Define if you have sys/select.h */ #undef HAVE_SYS_SELECT_H #ifndef _WIN32 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199945996353.3380270200065; Wed, 14 Nov 2018 04:52:25 -0800 (PST) Received: from localhost ([::1]:59870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuef-0002wY-0h for importer@patchew.org; Wed, 14 Nov 2018 07:52:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuTZ-0002Pw-Me for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTU-0002rX-FT for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTU-0002jl-6h for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CBF430C4193; Wed, 14 Nov 2018 12:40:47 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 074FA600D6; Wed, 14 Nov 2018 12:40:45 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:21 +0400 Message-Id: <20181114123643.24091-20-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 14 Nov 2018 12:40:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 19/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/main.h | 4 ---- slirp/slirp.h | 4 ---- slirp/slirp_config.h | 6 ------ 3 files changed, 14 deletions(-) diff --git a/slirp/main.h b/slirp/main.h index e04677944f..4bc05fb904 100644 --- a/slirp/main.h +++ b/slirp/main.h @@ -8,10 +8,6 @@ #ifndef SLIRP_MAIN_H #define SLIRP_MAIN_H =20 -#ifdef HAVE_SYS_SELECT_H -#include -#endif - extern u_int curtime; extern struct in_addr loopback_addr; extern unsigned long loopback_mask; diff --git a/slirp/slirp.h b/slirp/slirp.h index 7aa14feeb6..abe87618af 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -36,10 +36,6 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_SELECT_H -# include -#endif - #ifdef HAVE_SYS_FILIO_H # include #endif diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 9becb98e11..68e75f3873 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -32,12 +32,6 @@ #define DECLARE_IOVEC #endif =20 -/* Define if you have sys/select.h */ -#undef HAVE_SYS_SELECT_H -#ifndef _WIN32 -#define HAVE_SYS_SELECT_H -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200391582766.8185270814295; Wed, 14 Nov 2018 04:59:51 -0800 (PST) Received: from localhost ([::1]:59909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuln-0001Cz-3J for importer@patchew.org; Wed, 14 Nov 2018 07:59:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuTZ-0002Q0-Nt for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTV-0002sD-3n for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTU-0002rD-SO for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AF39C049D5B; Wed, 14 Nov 2018 12:40:52 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2256B6147A; Wed, 14 Nov 2018 12:40:50 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:22 +0400 Message-Id: <20181114123643.24091-21-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 14 Nov 2018 12:40:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 20/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 abe87618af..a2e7c50361 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -32,7 +32,7 @@ typedef char *caddr_t; #include #endif =20 -#if defined(HAVE_SYS_IOCTL_H) +#ifndef _WIN32 # include #endif =20 diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 68e75f3873..0e78e92d94 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,12 +11,6 @@ * You shouldn't need to touch any of these */ =20 -/* Define if you have sys/ioctl.h */ -#undef HAVE_SYS_IOCTL_H -#ifndef _WIN32 -#define HAVE_SYS_IOCTL_H -#endif - /* Define if you have sys/filio.h */ #undef HAVE_SYS_FILIO_H #ifdef __APPLE__ --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199951335265.70855430993004; Wed, 14 Nov 2018 04:52:31 -0800 (PST) Received: from localhost ([::1]:59871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuej-000318-WF for importer@patchew.org; Wed, 14 Nov 2018 07:52:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuTb-0002RH-3C for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTZ-0002v8-Vv for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63251) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTZ-0002u8-OG for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:40:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C818688E6E; Wed, 14 Nov 2018 12:40:56 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B73C1600D6; Wed, 14 Nov 2018 12:40:55 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:23 +0400 Message-Id: <20181114123643.24091-22-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:40:56 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 21/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 a2e7c50361..1a336b2cf1 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -36,7 +36,7 @@ typedef char *caddr_t; # include #endif =20 -#ifdef HAVE_SYS_FILIO_H +#ifdef __APPLE__ # include #endif =20 diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 0e78e92d94..f1ee927c15 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,12 +11,6 @@ * You shouldn't need to touch any of these */ =20 -/* Define if you have sys/filio.h */ -#undef HAVE_SYS_FILIO_H -#ifdef __APPLE__ -#define HAVE_SYS_FILIO_H -#endif - /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200124788330.80588391722017; Wed, 14 Nov 2018 04:55:24 -0800 (PST) Received: from localhost ([::1]:59883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuhW-0005Te-Tu for importer@patchew.org; Wed, 14 Nov 2018 07:55:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuU4-0002mP-JR for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuTm-00035X-8B for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTj-0002xF-8H for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:08 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 14348C0C234F; Wed, 14 Nov 2018 12:41:02 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 791CD620C4; Wed, 14 Nov 2018 12:41:00 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:24 +0400 Message-Id: <20181114123643.24091-23-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:41:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 22/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It's actually qemu configure CONFIG_IOVEC that is being used. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index f1ee927c15..833f25a965 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -14,12 +14,6 @@ /* Define if the machine is big endian */ //#undef HOST_WORDS_BIGENDIAN =20 -/* Define if iovec needs to be declared */ -#undef DECLARE_IOVEC -#ifdef _WIN32 -#define DECLARE_IOVEC -#endif - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542199897516348.25575312273486; Wed, 14 Nov 2018 04:51:37 -0800 (PST) Received: from localhost ([::1]:59869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuds-0002LH-Ar for importer@patchew.org; Wed, 14 Nov 2018 07:51:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUF-0002xP-OG for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUA-0003IJ-9a for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40948) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuTy-00037z-8m for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4DB93D15; Wed, 14 Nov 2018 12:41:11 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAA1760927; Wed, 14 Nov 2018 12:41:05 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:25 +0400 Message-Id: <20181114123643.24091-24-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 14 Nov 2018 12:41:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 23/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp_config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 833f25a965..5126711849 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -16,9 +16,3 @@ =20 /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) - -/* Define if you have inet_aton */ -#undef HAVE_INET_ATON -#ifndef _WIN32 -#define HAVE_INET_ATON -#endif --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15422001934457.111092031881753; Wed, 14 Nov 2018 04:56:33 -0800 (PST) Received: from localhost ([::1]:59893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuia-0006M1-Vy for importer@patchew.org; Wed, 14 Nov 2018 07:56:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUH-0002zI-Ro for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUE-0003NH-SF for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuU8-0003Bz-74 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5401F8E675; Wed, 14 Nov 2018 12:41:17 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6D75611A0; Wed, 14 Nov 2018 12:41:15 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:26 +0400 Message-Id: <20181114123643.24091-25-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:41:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 24/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" One more step towards making the project independent from QEMU. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/ip.h | 8 +++++--- slirp/ip6.h | 3 ++- slirp/ip6_icmp.h | 6 +++--- slirp/slirp_config.h | 3 --- slirp/tcp.h | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/slirp/ip.h b/slirp/ip.h index 59cf4aa918..83fc9cdfbf 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -33,7 +33,9 @@ #ifndef IP_H #define IP_H =20 -#ifdef HOST_WORDS_BIGENDIAN +#include + +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN # undef NTOHL # undef NTOHS # undef HTONL @@ -69,7 +71,7 @@ typedef uint32_t n_long; /* long as recei= ved from the net */ * Structure of an internet header, naked of options. */ struct ip { -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t ip_v:4, /* version */ ip_hl:4; /* header length */ #else @@ -135,7 +137,7 @@ struct ip_timestamp { uint8_t ipt_code; /* IPOPT_TS */ uint8_t ipt_len; /* size of structure (variable) */ uint8_t ipt_ptr; /* index of current entry */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t ipt_oflw:4, /* overflow counter */ ipt_flg:4; /* flags, see below */ #else diff --git a/slirp/ip6.h b/slirp/ip6.h index b1bea43b3c..14e9c78735 100644 --- a/slirp/ip6.h +++ b/slirp/ip6.h @@ -6,6 +6,7 @@ #ifndef SLIRP_IP6_H #define SLIRP_IP6_H =20 +#include #include "net/eth.h" =20 #define ALLNODES_MULTICAST { .s6_addr =3D \ @@ -113,7 +114,7 @@ static inline void in6_compute_ethaddr(struct in6_addr = ip, * Structure of an internet header, naked of options. */ struct ip6 { -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint32_t ip_v:4, /* version */ ip_tc_hi:4, /* traffic class */ diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h index b3378b17b5..32b0914055 100644 --- a/slirp/ip6_icmp.h +++ b/slirp/ip6_icmp.h @@ -34,7 +34,7 @@ struct ndp_rs { /* Router Solicitation Message */ =20 struct ndp_ra { /* Router Advertisement Message */ uint8_t chl; /* Cur Hop Limit */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t M:1, O:1, @@ -56,7 +56,7 @@ struct ndp_ns { /* Neighbor Solicitation Message */ } QEMU_PACKED; =20 struct ndp_na { /* Neighbor Advertisement Message */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint32_t R:1, /* Router Flag */ S:1, /* Solicited Flag */ @@ -125,7 +125,7 @@ struct ndpopt { #define ndpopt_linklayer ndpopt_body.linklayer_addr struct prefixinfo { /* Prefix Information */ uint8_t prefix_length; -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t L:1, A:1, reserved1:6; #else uint8_t reserved1:6, A:1, L:1; diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 5126711849..b2def6d20c 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -11,8 +11,5 @@ * You shouldn't need to touch any of these */ =20 -/* Define if the machine is big endian */ -//#undef HOST_WORDS_BIGENDIAN - /* Define to sizeof(char *) */ #define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) diff --git a/slirp/tcp.h b/slirp/tcp.h index 174d3d960c..47aaea6c5b 100644 --- a/slirp/tcp.h +++ b/slirp/tcp.h @@ -33,6 +33,8 @@ #ifndef TCP_H #define TCP_H =20 +#include + typedef uint32_t tcp_seq; =20 #define PR_SLOWHZ 2 /* 2 slow timeouts per second= (approx) */ @@ -51,7 +53,7 @@ struct tcphdr { uint16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ -#ifdef HOST_WORDS_BIGENDIAN +#if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN uint8_t th_off:4, /* data offset */ th_x2:4; /* (unused) */ #else --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200357150792.2218637099895; Wed, 14 Nov 2018 04:59:17 -0800 (PST) Received: from localhost ([::1]:59906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMulI-0000nB-0q for importer@patchew.org; Wed, 14 Nov 2018 07:59:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUK-000313-Qs for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUJ-0003PH-1M for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33320) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuUI-0003HI-Lc for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:42 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85872307D856; Wed, 14 Nov 2018 12:41:31 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2324D60C5F; Wed, 14 Nov 2018 12:41:20 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:27 +0400 Message-Id: <20181114123643.24091-26-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 14 Nov 2018 12:41:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 25/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/ip.h | 2 +- slirp/slirp_config.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/slirp/ip.h b/slirp/ip.h index 83fc9cdfbf..243b6c8b24 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -177,7 +177,7 @@ struct ip_timestamp { =20 #define IP_MSS 576 /* default maximum segment size */ =20 -#if SIZEOF_CHAR_P =3D=3D 4 +#if GLIB_SIZEOF_VOID_P =3D=3D 4 struct mbuf_ptr { struct mbuf *mptr; uint32_t dummy; diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index b2def6d20c..7147e0de04 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -10,6 +10,3 @@ * Autoconf defined configuration options * You shouldn't need to touch any of these */ - -/* Define to sizeof(char *) */ -#define SIZEOF_CHAR_P (HOST_LONG_BITS / 8) --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200583288596.7284571451182; Wed, 14 Nov 2018 05:03:03 -0800 (PST) Received: from localhost ([::1]:59930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuow-0003bD-6u for importer@patchew.org; Wed, 14 Nov 2018 08:03:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUO-000356-Oy for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUM-0003X3-Rn for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuUM-0003SB-F3 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:41:46 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1010796FD; Wed, 14 Nov 2018 12:41:45 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43BDB5D773; Wed, 14 Nov 2018 12:41:34 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:28 +0400 Message-Id: <20181114123643.24091-27-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:41:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 26/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Use a global variable instead (similar to slirp_debug) Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/slirp.h | 6 +++--- slirp/slirp_config.h | 12 ------------ slirp/slirp.c | 3 +++ 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.h b/slirp/slirp.h index 1a336b2cf1..c328aac88a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -1,8 +1,6 @@ #ifndef SLIRP_H #define SLIRP_H =20 -#include "slirp_config.h" - #ifdef _WIN32 =20 typedef char *caddr_t; @@ -219,7 +217,9 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len); #include #endif =20 -#define SO_OPTIONS DO_KEEPALIVE + +extern bool slirp_do_keepalive; + #define TCP_MAXIDLE (TCPTV_KEEPCNT * TCPTV_KEEPINTVL) =20 /* dnssearch.c */ diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h deleted file mode 100644 index 7147e0de04..0000000000 --- a/slirp/slirp_config.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * User definable configuration options - */ - -/* Define to 1 if you want KEEPALIVE timers */ -#define DO_KEEPALIVE 0 - -/*********************************************************/ -/* - * Autoconf defined configuration options - * You shouldn't need to touch any of these - */ diff --git a/slirp/slirp.c b/slirp/slirp.c index 2d32debf2a..864a9b5a7a 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -35,6 +35,9 @@ #include #endif =20 +/* Define to 1 if you want KEEPALIVE timers */ +bool slirp_do_keepalive; + /* host loopback address */ struct in_addr loopback_addr; /* host loopback network mask */ diff --git a/slirp/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 =3D 0; - if (SO_OPTIONS) + if (slirp_do_keepalive) tp->t_timer[TCPT_KEEP] =3D TCPTV_KEEPINTVL; else tp->t_timer[TCPT_KEEP] =3D TCPTV_KEEP_IDLE; diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c index 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; =20 - if ((SO_OPTIONS) && tp->t_state <=3D TCPS_CLOSE_WAIT) { + if (slirp_do_keepalive && tp->t_state <=3D TCPS_CLOSE_WAIT) { if (tp->t_idle >=3D TCPTV_KEEP_IDLE + TCP_MAXIDLE) goto dropit; /* --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200078547542.959328720322; Wed, 14 Nov 2018 04:54:38 -0800 (PST) Received: from localhost ([::1]:59881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMugi-0004nE-Tx for importer@patchew.org; Wed, 14 Nov 2018 07:54:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUj-0003JA-A7 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUe-0003hR-9F for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuUc-0003g2-BY for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:02 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37D3630024A2; Wed, 14 Nov 2018 12:42:01 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90CA461492; Wed, 14 Nov 2018 12:41:49 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:29 +0400 Message-Id: <20181114123643.24091-28-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 14 Nov 2018 12:42:01 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 27/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index c328aac88a..4356b2f427 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -199,8 +199,6 @@ struct Slirp { void *opaque; }; =20 -extern Slirp *slirp_instance; - #ifndef NULL #define NULL (void *)0 #endif --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200747241848.3248796612353; Wed, 14 Nov 2018 05:05:47 -0800 (PST) Received: from localhost ([::1]:59976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMurY-0005qW-5a for importer@patchew.org; Wed, 14 Nov 2018 08:05:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuUm-0003ME-G2 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuUl-0003m0-MQ for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuUl-0003ll-HE for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:11 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE7F85D697; Wed, 14 Nov 2018 12:42:10 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 121C75D759; Wed, 14 Nov 2018 12:42:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:30 +0400 Message-Id: <20181114123643.24091-29-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 14 Nov 2018 12:42:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 28/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reduce dependency on QEMU. QEMU could use a custom log handler if it wants to redirect/filter it. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/ip6_icmp.c | 2 +- slirp/misc.c | 4 ++-- slirp/slirp.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 71d95daef0..e2e23d57bd 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -418,7 +418,7 @@ void icmp6_input(struct mbuf *m) icmp6_send_echoreply(m, slirp, ip, icmp); } else { /* TODO */ - error_report("external icmpv6 not supported yet"); + g_critical("external icmpv6 not supported yet"); } break; =20 diff --git a/slirp/misc.c b/slirp/misc.c index dd2b3512a8..17361b79a4 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -119,7 +119,7 @@ slirp_socketpair_with_oob(int sv[2]) return 0; =20 err: - error_report("Error: slirp_socketpair(): %s", strerror(errno)); + g_critical("slirp_socketpair(): %s", strerror(errno)); if (s >=3D 0) { closesocket(s); } @@ -162,7 +162,7 @@ fork_exec(struct socket *so, const char *ex) g_strfreev(argv); =20 if (err) { - error_report("%s", err->message); + g_critical("fork_exec: %s", err->message); g_error_free(err); closesocket(sp[0]); closesocket(sp[1]); diff --git a/slirp/slirp.c b/slirp/slirp.c index 864a9b5a7a..b1270a0309 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -1215,8 +1215,8 @@ static int sbuf_tmp_post_load(void *opaque, int versi= on) } if (tmp->woff >=3D requested_len || tmp->roff >=3D requested_len) { - error_report("invalid sbuf offsets r/w=3D%u/%u len=3D%u", - tmp->roff, tmp->woff, requested_len); + g_critical("invalid sbuf offsets r/w=3D%u/%u len=3D%u", + tmp->roff, tmp->woff, requested_len); return -EINVAL; } =20 @@ -1324,7 +1324,7 @@ static int ss_family_post_load(void *opaque, int vers= ion_id) tss->parent->ss.ss_family =3D AF_INET6; break; default: - error_report("invalid ss_family type %x", tss->portable_family); + g_critical("invalid ss_family type %x", tss->portable_family); return -EINVAL; } =20 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200415825926.4194762706898; Wed, 14 Nov 2018 05:00:15 -0800 (PST) Received: from localhost ([::1]:59910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMumE-0001bo-II for importer@patchew.org; Wed, 14 Nov 2018 08:00:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVO-000474-QK for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVK-00040e-NZ for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVI-0003qX-Tr for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F39430AAD78; Wed, 14 Nov 2018 12:42:23 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8871E60BF6; Wed, 14 Nov 2018 12:42:14 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:31 +0400 Message-Id: <20181114123643.24091-30-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 14 Nov 2018 12:42:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 29/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Let them accept multiple arguments. Simplify the inner argument handling of DEBUG_ARGS/DEBUG_MISC_DEBUG_ERROR. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/debug.h | 47 ++++++++++++++++++++++++++++++++++++---------- slirp/arp_table.c | 12 ++++++------ slirp/bootp.c | 3 +-- slirp/cksum.c | 4 ++-- 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/debug.h b/slirp/debug.h index 6cfa61edb3..ca3a4b04da 100644 --- a/slirp/debug.h +++ b/slirp/debug.h @@ -17,18 +17,45 @@ =20 extern int slirp_debug; =20 -#define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n"= , x); fflush(dfd); } -#define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fpr= intf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } -#define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd= ); } -#define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd= ); } -#define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(df= d); } +#define DEBUG_CALL(fmt, ...) do { \ + if (slirp_debug & DBG_CALL) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fprintf(dfd, "...\n"); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ARG(fmt, ...) do { \ + if (slirp_debug & DBG_CALL) { \ + fputc(' ', dfd); \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fputc('\n', dfd); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ARGS(fmt, ...) DEBUG_ARG(fmt, ##__VA_ARGS__) + +#define DEBUG_MISC(fmt, ...) do { \ + if (slirp_debug & DBG_MISC) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fflush(dfd); \ + } \ +} while (0) + +#define DEBUG_ERROR(fmt, ...) do { \ + if (slirp_debug & DBG_ERROR) { \ + fprintf(dfd, fmt, ##__VA_ARGS__); \ + fflush(dfd); \ + } \ +} while (0) =20 #else =20 -#define DEBUG_CALL(x) -#define DEBUG_ARG(x, y) -#define DEBUG_ARGS(x) -#define DEBUG_MISC(x) -#define DEBUG_ERROR(x) +#define DEBUG_CALL(fmt, ...) +#define DEBUG_ARG(fmt, ...) +#define DEBUG_ARGS(fmt, ...) +#define DEBUG_MISC(fmt, ...) +#define DEBUG_ERROR(fmt, ...) =20 #endif diff --git a/slirp/arp_table.c b/slirp/arp_table.c index f81963bb88..ce19e6e7c0 100644 --- a/slirp/arp_table.c +++ b/slirp/arp_table.c @@ -34,9 +34,9 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_= t ethaddr[ETH_ALEN]) =20 DEBUG_CALL("arp_table_add"); DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); - DEBUG_ARGS((dfd, " hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5])); + DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (ip_addr =3D=3D 0 || ip_addr =3D=3D 0xffffffff || ip_addr =3D=3D br= oadcast_addr) { /* Do not register broadcast addresses */ @@ -79,9 +79,9 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, for (i =3D 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip =3D=3D ip_addr) { memcpy(out_ethaddr, arptbl->table[i].ar_sha, ETH_ALEN); - DEBUG_ARGS((dfd, " found hw addr =3D %02x:%02x:%02x:%02x:%02x:= %02x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/bootp.c b/slirp/bootp.c index 7b1af73c95..5ab6692038 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -37,8 +37,7 @@ static const uint8_t rfc1533_cookie[] =3D { RFC1533_COOKIE }; =20 #ifdef DEBUG -#define DPRINTF(fmt, ...) \ -do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflus= h(dfd); } while (0) +#define DPRINTF(fmt, ...) DEBUG_CALL(fmt, ##__VA_ARGS__) #else #define DPRINTF(fmt, ...) do{}while(0) #endif diff --git a/slirp/cksum.c b/slirp/cksum.c index 6d73abf4a0..b9466485b5 100644 --- a/slirp/cksum.c +++ b/slirp/cksum.c @@ -124,8 +124,8 @@ int cksum(struct mbuf *m, int len) cont: #ifdef DEBUG if (len) { - DEBUG_ERROR((dfd, "cksum: out of data\n")); - DEBUG_ERROR((dfd, " len =3D %d\n", len)); + DEBUG_ERROR("cksum: out of data\n"); + DEBUG_ERROR(" len =3D %d\n", len); } #endif if (mlen =3D=3D -1) { diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index d266611e85..943a13bca8 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -92,14 +92,14 @@ static int dhcpv6_parse_info_request(uint8_t *odata, in= t olen, ri->want_boot_url =3D true; break; default: - DEBUG_MISC((dfd, "dhcpv6: Unsupported option request %= d\n", - req_opt)); + DEBUG_MISC("dhcpv6: Unsupported option request %d\n", + req_opt); } } break; default: - DEBUG_MISC((dfd, "dhcpv6 info req: Unsupported option %d, len= =3D%d\n", - option, len)); + DEBUG_MISC("dhcpv6 info req: Unsupported option %d, len=3D%d\n= ", + option, len); } =20 odata +=3D len + 4; @@ -203,7 +203,6 @@ void dhcpv6_input(struct sockaddr_in6 *srcsas, struct m= buf *m) dhcpv6_info_request(m->slirp, srcsas, xid, &data[4], data_len - 4); break; default: - DEBUG_MISC((dfd, "dhcpv6_input: Unsupported message type 0x%x\n", - data[0])); + DEBUG_MISC("dhcpv6_input: Unsupported message type 0x%x\n", data[0= ]); } } diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index e2e23d57bd..6f20190a0a 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) struct ip6 *ip =3D mtod(m, struct ip6 *); =20 DEBUG_CALL("icmp6_send_error"); - DEBUG_ARGS((dfd, " type =3D %d, code =3D %d\n", type, code)); + DEBUG_ARGS(" type =3D %d, code =3D %d\n", type, code); =20 if (IN6_IS_ADDR_MULTICAST(&ip->ip_src) || in6_zero(&ip->ip_src)) { diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index 9210eef3f3..af11cfcefe 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -99,8 +99,8 @@ static int icmp_send(struct socket *so, struct mbuf *m, i= nt hlen) =20 if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) =3D=3D -1) { - DEBUG_MISC((dfd, "icmp_input icmp sendto tx errno =3D %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC("icmp_input icmp sendto tx errno =3D %d-%s\n", + errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(err= no)); icmp_detach(so); } @@ -165,8 +165,8 @@ icmp_input(struct mbuf *m, int hlen) return; } if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC((dfd,"icmp_input udp_attach errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp_attach errno =3D %d-%s\n", + errno,strerror(errno)); sofree(so); m_free(m); goto end_error; @@ -188,8 +188,8 @@ icmp_input(struct mbuf *m, int hlen) =20 if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sockaddr_size(&addr)) =3D=3D -1) { - DEBUG_MISC((dfd,"icmp_input udp sendto tx errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC("icmp_input udp sendto tx errno =3D %d-%s\n", + errno,strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); udp_detach(so); } @@ -257,7 +257,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char = code, int minsize, { char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); - DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb)); + DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb); } #endif if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment= 0 */ @@ -457,8 +457,8 @@ void icmp_receive(struct socket *so) } else { error_code =3D ICMP_UNREACH_HOST; } - DEBUG_MISC((dfd, " udp icmp rx errno =3D %d-%s\n", errno, - strerror(errno))); + DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", errno, + strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(er= rno)); } else { icmp_reflect(so->so_m); diff --git a/slirp/mbuf.c b/slirp/mbuf.c index aa1f28afb1..d8d275e0e7 100644 --- a/slirp/mbuf.c +++ b/slirp/mbuf.c @@ -232,7 +232,7 @@ dtom(Slirp *slirp, void *dat) } } =20 - DEBUG_ERROR((dfd, "dtom failed")); + DEBUG_ERROR("dtom failed"); =20 return (struct mbuf *)0; } diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index e1676a0a7b..a4e6421fd3 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -19,9 +19,9 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, inet_ntop(AF_INET6, &(ip_addr), addrstr, INET6_ADDRSTRLEN); DEBUG_ARG("ip =3D %s", addrstr); #endif - DEBUG_ARGS((dfd, " hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - ethaddr[0], ethaddr[1], ethaddr[2], - ethaddr[3], ethaddr[4], ethaddr[5])); + DEBUG_ARGS(" hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + ethaddr[0], ethaddr[1], ethaddr[2], + ethaddr[3], ethaddr[4], ethaddr[5]); =20 if (IN6_IS_ADDR_MULTICAST(&ip_addr) || in6_zero(&ip_addr)) { /* Do not register multicast or unspecified addresses */ @@ -69,18 +69,18 @@ bool ndp_table_search(Slirp *slirp, struct in6_addr ip_= addr, out_ethaddr[3] =3D ip_addr.s6_addr[13]; out_ethaddr[4] =3D ip_addr.s6_addr[14]; out_ethaddr[5] =3D ip_addr.s6_addr[15]; - DEBUG_ARGS((dfd, " multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02= x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" multicast addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } =20 for (i =3D 0; i < NDP_TABLE_SIZE; i++) { if (in6_equal(&ndp_table->table[i].ip_addr, &ip_addr)) { memcpy(out_ethaddr, ndp_table->table[i].eth_addr, ETH_ALEN); - DEBUG_ARGS((dfd, " found hw addr =3D %02x:%02x:%02x:%02x:%02x:= %02x\n", - out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], - out_ethaddr[3], out_ethaddr[4], out_ethaddr[5])); + DEBUG_ARGS(" found hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n= ", + out_ethaddr[0], out_ethaddr[1], out_ethaddr[2], + out_ethaddr[3], out_ethaddr[4], out_ethaddr[5]); return 1; } } diff --git a/slirp/slirp.c b/slirp/slirp.c index b1270a0309..9a87abee27 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -985,12 +985,12 @@ int if_encap(Slirp *slirp, struct mbuf *ifm) } =20 memcpy(eh->h_dest, ethaddr, ETH_ALEN); - DEBUG_ARGS((dfd, " src =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_source[0], eh->h_source[1], eh->h_source[2], - eh->h_source[3], eh->h_source[4], eh->h_source[5])); - DEBUG_ARGS((dfd, " dst =3D %02x:%02x:%02x:%02x:%02x:%02x\n", - eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], - eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); + DEBUG_ARGS(" src =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + eh->h_source[0], eh->h_source[1], eh->h_source[2], + eh->h_source[3], eh->h_source[4], eh->h_source[5]); + DEBUG_ARGS(" dst =3D %02x:%02x:%02x:%02x:%02x:%02x\n", + eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], + eh->h_dest[3], eh->h_dest[4], eh->h_dest[5]); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp->cb->output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; diff --git a/slirp/socket.c b/slirp/socket.c index 7012c7c07d..677fd20c9d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -208,7 +208,7 @@ soread(struct socket *so) } } =20 - DEBUG_MISC((dfd, " --- soread() disconnected, nn =3D %d, errno =3D %d-%= s\n", nn, errno,strerror(errno))); + DEBUG_MISC(" --- soread() disconnected, nn =3D %d, errno =3D %d-%s\n", = nn, errno,strerror(errno)); sofcantrcvmore(so); =20 if (err =3D=3D ECONNRESET || err =3D=3D ECONNREFUSED @@ -237,7 +237,7 @@ soread(struct socket *so) nn +=3D ret; } =20 - DEBUG_MISC((dfd, " ... read nn =3D %d bytes\n", nn)); + DEBUG_MISC(" ... read nn =3D %d bytes\n", nn); =20 /* Update fields */ sb->sb_cc +=3D nn; @@ -370,7 +370,7 @@ sosendoob(struct socket *so) n =3D slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ #ifdef DEBUG if (n !=3D len) { - DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n")); + DEBUG_ERROR("Didn't send all data urgently XXXXX\n"); } #endif } @@ -379,7 +379,7 @@ sosendoob(struct socket *so) return n; } so->so_urgc -=3D n; - DEBUG_MISC((dfd, " ---2 sent %d bytes urgent data, %d urgent bytes left\n= ", n, so->so_urgc)); + DEBUG_MISC(" ---2 sent %d bytes urgent data, %d urgent bytes left\n", n, = so->so_urgc); =20 sb->sb_cc -=3D n; sb->sb_rptr +=3D n; @@ -460,7 +460,7 @@ sowrite(struct socket *so) if (ret > 0) nn +=3D ret; } - DEBUG_MISC((dfd, " ... wrote nn =3D %d bytes\n", nn)); + DEBUG_MISC(" ... wrote nn =3D %d bytes\n", nn); =20 /* Update sbuf */ sb->sb_cc -=3D nn; @@ -478,8 +478,8 @@ sowrite(struct socket *so) return nn; =20 err_disconnected: - DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state =3D %x, errno = =3D %d\n", - so->so_state, errno)); + DEBUG_MISC(" --- sowrite disconnected, so->so_state =3D %x, errno =3D %d\= n", + so->so_state, errno); sofcantsendmore(so); tcp_sockclosed(sototcpcb(so)); return -1; @@ -512,8 +512,8 @@ sorecvfrom(struct socket *so) if(errno =3D=3D EHOSTUNREACH) code=3DICMP_UNREACH_HOST; else if(errno =3D=3D ENETUNREACH) code=3DICMP_UNREACH_NET; =20 - DEBUG_MISC((dfd," udp icmp rx errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp icmp rx errno =3D %d-%s\n", + errno,strerror(errno)); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); } else { icmp_reflect(so->so_m); @@ -564,8 +564,8 @@ sorecvfrom(struct socket *so) =20 m->m_len =3D recvfrom(so->s, m->m_data, len, 0, (struct sockaddr *)&addr, &addrlen); - DEBUG_MISC((dfd, " did recvfrom %d, errno =3D %d-%s\n", - m->m_len, errno,strerror(errno))); + DEBUG_MISC(" did recvfrom %d, errno =3D %d-%s\n", + m->m_len, errno,strerror(errno)); if(m->m_len<0) { /* Report error as ICMP */ switch (so->so_lfamily) { @@ -579,7 +579,7 @@ sorecvfrom(struct socket *so) code =3D ICMP_UNREACH_NET; } =20 - DEBUG_MISC((dfd, " rx error, tx icmp ICMP_UNREACH:%i\n", code)); + DEBUG_MISC(" rx error, tx icmp ICMP_UNREACH:%i\n", code); icmp_send_error(so->so_m, ICMP_UNREACH, code, 0, strerror(errno)); break; case AF_INET6: @@ -591,7 +591,7 @@ sorecvfrom(struct socket *so) code =3D ICMP6_UNREACH_NO_ROUTE; } =20 - DEBUG_MISC((dfd, " rx error, tx icmp6 ICMP_UNREACH:%i\n", code)); + DEBUG_MISC(" rx error, tx icmp6 ICMP_UNREACH:%i\n", code); icmp6_send_error(so->so_m, ICMP6_UNREACH, code); break; default: @@ -839,9 +839,9 @@ void sotranslate_out(struct socket *so, struct sockaddr= _storage *addr) } } =20 - DEBUG_MISC((dfd, " addr.sin_port=3D%d, " - "addr.sin_addr.s_addr=3D%.16s\n", - ntohs(sin->sin_port), inet_ntoa(sin->sin_addr))); + DEBUG_MISC(" addr.sin_port=3D%d, " + "addr.sin_addr.s_addr=3D%.16s\n", + ntohs(sin->sin_port), inet_ntoa(sin->sin_addr)); break; =20 case AF_INET6: diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 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 *in= so, unsigned short af) Slirp *slirp; =20 DEBUG_CALL("tcp_input"); - DEBUG_ARGS((dfd, " m =3D %p iphlen =3D %2d inso =3D %p\n", - m, iphlen, inso)); + DEBUG_ARGS(" m =3D %p iphlen =3D %2d inso =3D %p\n", + m, iphlen, inso); =20 /* * If called with m =3D=3D 0, then we're continuing the connect @@ -662,8 +662,8 @@ findso: (errno !=3D EINPROGRESS) && (errno !=3D EWOULDBLOCK) ) { uint8_t code; - DEBUG_MISC((dfd, " tcp fconnect errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" tcp fconnect errno =3D %d-%s\n", + errno,strerror(errno)); if(errno =3D=3D ECONNREFUSED) { /* ACK the SYN, send RST to refuse the connection */ tcp_respond(tp, ti, m, ti->ti_seq + 1, (tcp_seq) 0, @@ -1032,8 +1032,7 @@ trimthenstep6: =20 if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { if (ti->ti_len =3D=3D 0 && tiwin =3D=3D tp->snd_wnd) { - DEBUG_MISC((dfd, " dup ack m =3D %p so =3D %p\n", - m, so)); + DEBUG_MISC(" dup ack m =3D %p so =3D %p\n", m, so); /* * If we have outstanding data (other than * a window probe), this is a completely @@ -1411,7 +1410,7 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, = struct tcpiphdr *ti) int opt, optlen; =20 DEBUG_CALL("tcp_dooptions"); - DEBUG_ARGS((dfd, " tp =3D %p cnt=3D%i\n", tp, cnt)); + DEBUG_ARGS(" tp =3D %p cnt=3D%i\n", tp, cnt); =20 for (; cnt > 0; cnt -=3D optlen, cp +=3D optlen) { opt =3D cp[0]; @@ -1611,7 +1610,7 @@ tcp_mss(struct tcpcb *tp, u_int offer) (mss - (TCP_RCVSPACE % mss)= ) : 0)); =20 - DEBUG_MISC((dfd, " returning mss =3D %d\n", mss)); + DEBUG_MISC(" returning mss =3D %d\n", mss); =20 return mss; } diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 90b5c376f7..44da8a4e47 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -92,7 +92,7 @@ again: =20 flags =3D tcp_outflags[tp->t_state]; =20 - DEBUG_MISC((dfd, " --- tcp_output flags =3D 0x%x\n",flags)); + DEBUG_MISC(" --- tcp_output flags =3D 0x%x\n", flags); =20 /* * If in persist timeout with window of 0, send 1 byte. diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 8d97f1f54e..98bceea9f6 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -420,7 +420,7 @@ int tcp_fconnect(struct socket *so, unsigned short af) qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); =20 addr =3D so->fhost.ss; - DEBUG_CALL(" connect()ing") + DEBUG_CALL(" connect()ing"); sotranslate_out(so, &addr); =20 /* We don't care what port we get */ @@ -964,7 +964,7 @@ int tcp_ctl(struct socket *so) so->chardev =3D ex_ptr->ex_chardev; return 1; } - DEBUG_MISC((dfd, " executing %s\n", ex_ptr->ex_exec)); + DEBUG_MISC(" executing %s\n", ex_ptr->ex_exec); return fork_exec(so, ex_ptr->ex_exec); } } diff --git a/slirp/udp.c b/slirp/udp.c index c47870a61b..a45ad81dda 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -172,8 +172,8 @@ udp_input(register struct mbuf *m, int iphlen) */ so =3D socreate(slirp); if (udp_attach(so, AF_INET) =3D=3D -1) { - DEBUG_MISC((dfd," udp_attach errno =3D %d-%s\n", - errno,strerror(errno))); + DEBUG_MISC(" udp_attach errno =3D %d-%s\n", + errno, strerror(errno)); sofree(so); goto bad; } @@ -209,7 +209,7 @@ udp_input(register struct mbuf *m, int iphlen) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip=3Dsave_ip; - DEBUG_MISC((dfd,"udp tx errno =3D %d-%s\n",errno,strerror(errno))); + DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); goto bad; diff --git a/slirp/udp6.c b/slirp/udp6.c index 986010f0d3..473ba1586e 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -92,8 +92,8 @@ void udp6_input(struct mbuf *m) /* If there's no socket for this packet, create one. */ so =3D socreate(slirp); if (udp_attach(so, AF_INET6) =3D=3D -1) { - DEBUG_MISC((dfd, " udp6_attach errno =3D %d-%s\n", - errno, strerror(errno))); + DEBUG_MISC(" udp6_attach errno =3D %d-%s\n", + errno, strerror(errno)); sofree(so); goto bad; } @@ -119,7 +119,7 @@ void udp6_input(struct mbuf *m) m->m_len +=3D iphlen; m->m_data -=3D iphlen; *ip =3D save_ip; - DEBUG_MISC((dfd, "udp tx errno =3D %d-%s\n", errno, strerror(errno= ))); + DEBUG_MISC("udp tx errno =3D %d-%s\n", errno, strerror(errno)); icmp6_send_error(m, ICMP6_UNREACH, ICMP6_UNREACH_NO_ROUTE); goto bad; } --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154220090148076.98687764461204; Wed, 14 Nov 2018 05:08:21 -0800 (PST) Received: from localhost ([::1]:59990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuu4-0007r6-9b for importer@patchew.org; Wed, 14 Nov 2018 08:08:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVO-00046w-Pd for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVI-0003zZ-QP for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVG-0003sL-VT for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA8473D95A; Wed, 14 Nov 2018 12:42:27 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3DE26147F; Wed, 14 Nov 2018 12:42:26 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:32 +0400 Message-Id: <20181114123643.24091-31-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 14 Nov 2018 12:42:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 30/41] slirp: replace trace functions with DEBUG calls 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Remove a dependency on QEMU. Use the existing logging facilities. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/tftp.c | 7 ++++--- Makefile.objs | 1 - slirp/trace-events | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 slirp/trace-events diff --git a/slirp/tftp.c b/slirp/tftp.c index 735b57aa55..dddb614b8a 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -26,7 +26,6 @@ #include "slirp.h" #include "qemu-common.h" #include "qemu/cutils.h" -#include "trace.h" =20 static inline int tftp_session_in_use(struct tftp_session *spt) { @@ -205,7 +204,8 @@ static void tftp_send_error(struct tftp_session *spt, struct mbuf *m; struct tftp_t *tp; =20 - trace_slirp_tftp_error(msg); + DEBUG_ERROR("tftp error msg: %s", msg); + m =3D m_get(spt->slirp); =20 if (!m) { @@ -325,7 +325,8 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, break; } } - trace_slirp_tftp_rrq(req_fname); + + DEBUG_MISC("tftp rrq file: %s", req_fname); =20 /* check mode */ if ((pktlen - k) < 6) { diff --git a/Makefile.objs b/Makefile.objs index 31852eaf8f..1e1ff387d7 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -251,7 +251,6 @@ trace-events-subdirs +=3D net trace-events-subdirs +=3D qapi trace-events-subdirs +=3D qom trace-events-subdirs +=3D scsi -trace-events-subdirs +=3D slirp trace-events-subdirs +=3D target/arm trace-events-subdirs +=3D target/i386 trace-events-subdirs +=3D target/mips diff --git a/slirp/trace-events b/slirp/trace-events deleted file mode 100644 index ff8f656e8c..0000000000 --- a/slirp/trace-events +++ /dev/null @@ -1,5 +0,0 @@ -# See docs/devel/tracing.txt for syntax documentation. - -# slirp/tftp.c -slirp_tftp_rrq(const char *file) "file: %s" -slirp_tftp_error(const char *file) "msg: %s" --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200303059888.0631072372494; Wed, 14 Nov 2018 04:58:23 -0800 (PST) Received: from localhost ([::1]:59901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMukP-0008Rl-PY for importer@patchew.org; Wed, 14 Nov 2018 07:58:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVO-000475-QN for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVK-00040Z-NI for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVI-0003xa-VH for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:45 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B21B3164666; Wed, 14 Nov 2018 12:42:39 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A86A5D985; Wed, 14 Nov 2018 12:42:31 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:33 +0400 Message-Id: <20181114123643.24091-32-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 14 Nov 2018 12:42:39 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 31/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 1 + net/slirp.c | 7 +++++++ slirp/dhcpv6.c | 6 +++--- slirp/ip6_icmp.c | 7 +++---- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index f2e7f94ebb..c7582e6516 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -21,6 +21,7 @@ typedef struct SlirpCb { void (*timer_free)(void *timer); void (*timer_mod)(void *timer, int64_t expire_timer); void (*set_nonblock)(int fd); + void (*guest_error)(const char *msg); } SlirpCb; =20 =20 diff --git a/net/slirp.c b/net/slirp.c index 5ea8c255f6..b36092c948 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/log.h" #include "net/slirp.h" =20 =20 @@ -183,6 +184,11 @@ static void net_slirp_timer_mod(void *timer, int64_t e= xpire_timer) timer_mod(timer, expire_timer); } =20 +static void net_slirp_guest_error(const char *msg) +{ + qemu_log_mask(LOG_GUEST_ERROR, "%s", msg); +} + static SlirpCb slirp_cb =3D { .output =3D net_slirp_output, .chr_write_all =3D net_slirp_chr_write_all, @@ -191,6 +197,7 @@ static SlirpCb slirp_cb =3D { .timer_free =3D net_slirp_timer_free, .timer_mod =3D net_slirp_timer_mod, .set_nonblock =3D qemu_set_nonblock, + .guest_error =3D net_slirp_guest_error, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index 943a13bca8..5d703e8ae6 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -50,7 +50,7 @@ struct requested_infos { * the odata region, thus the caller must keep odata valid as long as it * needs to access the requested_infos struct. */ -static int dhcpv6_parse_info_request(uint8_t *odata, int olen, +static int dhcpv6_parse_info_request(Slirp *slirp, uint8_t *odata, int ole= n, struct requested_infos *ri) { int i, req_opt; @@ -61,7 +61,7 @@ static int dhcpv6_parse_info_request(uint8_t *odata, int = olen, int len =3D odata[2] << 8 | odata[3]; =20 if (len + 4 > olen) { - qemu_log_mask(LOG_GUEST_ERROR, "Guest sent bad DHCPv6 packet!\= n"); + slirp->cb->guest_error("Guest sent bad DHCPv6 packet!"); return -E2BIG; } =20 @@ -121,7 +121,7 @@ static void dhcpv6_info_request(Slirp *slirp, struct so= ckaddr_in6 *srcsas, struct mbuf *m; uint8_t *resp; =20 - if (dhcpv6_parse_info_request(odata, olen, &ri) < 0) { + if (dhcpv6_parse_info_request(slirp, odata, olen, &ri) < 0) { return; } =20 diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 6f20190a0a..d523852a1f 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -343,8 +343,7 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, str= uct ip6 *ip, =20 case ICMP6_NDP_RA: DEBUG_CALL(" type =3D Router Advertisement"); - qemu_log_mask(LOG_GUEST_ERROR, - "Warning: guest sent NDP RA, but shouldn't"); + slirp->cb->guest_error("Warning: guest sent NDP RA, but shouldn't"= ); break; =20 case ICMP6_NDP_NS: @@ -377,8 +376,8 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, str= uct ip6 *ip, =20 case ICMP6_NDP_REDIRECT: DEBUG_CALL(" type =3D Redirect"); - qemu_log_mask(LOG_GUEST_ERROR, - "Warning: guest sent NDP REDIRECT, but shouldn't"); + slirp->cb->guest_error( + "Warning: guest sent NDP REDIRECT, but shouldn't"); break; } } --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200250495669.4307272200717; Wed, 14 Nov 2018 04:57:30 -0800 (PST) Received: from localhost ([::1]:59898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMujZ-0007Mh-Eq for importer@patchew.org; Wed, 14 Nov 2018 07:57:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVO-000478-QQ for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVK-00040t-Rg for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVK-0003zR-MK for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D7743082E52; Wed, 14 Nov 2018 12:42:44 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FCF2600D6; Wed, 14 Nov 2018 12:42:42 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:34 +0400 Message-Id: <20181114123643.24091-33-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 14 Nov 2018 12:42:44 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 32/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/sbuf.h | 1 - 1 file changed, 1 deletion(-) diff --git a/slirp/sbuf.h b/slirp/sbuf.h index a722ecb629..644c201341 100644 --- a/slirp/sbuf.h +++ b/slirp/sbuf.h @@ -8,7 +8,6 @@ #ifndef SBUF_H #define SBUF_H =20 -#define sbflush(sb) sbdrop((sb),(sb)->sb_cc) #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) =20 struct sbuf { --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200614508323.01825631741383; Wed, 14 Nov 2018 05:03:34 -0800 (PST) Received: from localhost ([::1]:59966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMupR-0004Aa-6k for importer@patchew.org; Wed, 14 Nov 2018 08:03:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVZ-0004Nl-5F for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVU-00047W-5U for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVT-00046v-UH for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:42:56 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3D0EA3002C72; Wed, 14 Nov 2018 12:42:55 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DDA35D738; Wed, 14 Nov 2018 12:42:47 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:35 +0400 Message-Id: <20181114123643.24091-34-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 14 Nov 2018 12:42:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 33/41] slirp: replace qemu_notify_event() with a 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Use a "slirp socket" helper function to call the callback when sbdrop() returns true. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/libslirp.h | 1 + slirp/sbuf.h | 2 +- slirp/socket.h | 1 + net/slirp.c | 1 + slirp/sbuf.c | 6 ++++-- slirp/socket.c | 7 +++++++ slirp/tcp_input.c | 6 +++--- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/slirp/libslirp.h b/slirp/libslirp.h index c7582e6516..7d04404340 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -22,6 +22,7 @@ typedef struct SlirpCb { void (*timer_mod)(void *timer, int64_t expire_timer); void (*set_nonblock)(int fd); void (*guest_error)(const char *msg); + void (*notify)(void); } SlirpCb; =20 =20 diff --git a/slirp/sbuf.h b/slirp/sbuf.h index 644c201341..1cb9a42834 100644 --- a/slirp/sbuf.h +++ b/slirp/sbuf.h @@ -21,7 +21,7 @@ struct sbuf { }; =20 void sbfree(struct sbuf *); -void sbdrop(struct sbuf *, int); +bool sbdrop(struct sbuf *, int); void sbreserve(struct sbuf *, int); void sbappend(struct socket *, struct mbuf *); void sbcopy(struct sbuf *, int, int, char *); diff --git a/slirp/socket.h b/slirp/socket.h index 930ed95972..79b6fbd4c1 100644 --- a/slirp/socket.h +++ b/slirp/socket.h @@ -154,6 +154,7 @@ int soreadbuf(struct socket *so, const char *buf, int s= ize); void sotranslate_out(struct socket *, struct sockaddr_storage *); void sotranslate_in(struct socket *, struct sockaddr_storage *); void sotranslate_accept(struct socket *); +void sodrop(struct socket *, int num); =20 =20 #endif /* SLIRP_SOCKET_H */ diff --git a/net/slirp.c b/net/slirp.c index b36092c948..4c39878933 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -198,6 +198,7 @@ static SlirpCb slirp_cb =3D { .timer_mod =3D net_slirp_timer_mod, .set_nonblock =3D qemu_set_nonblock, .guest_error =3D net_slirp_guest_error, + .notify =3D qemu_notify_event, }; =20 static int net_slirp_init(NetClientState *peer, const char *model, diff --git a/slirp/sbuf.c b/slirp/sbuf.c index 912f235f65..17f28e97a6 100644 --- a/slirp/sbuf.c +++ b/slirp/sbuf.c @@ -17,7 +17,7 @@ sbfree(struct sbuf *sb) free(sb->sb_data); } =20 -void +bool sbdrop(struct sbuf *sb, int num) { int limit =3D sb->sb_datalen / 2; @@ -34,8 +34,10 @@ sbdrop(struct sbuf *sb, int num) sb->sb_rptr -=3D sb->sb_datalen; =20 if (sb->sb_cc < limit && sb->sb_cc + num >=3D limit) { - qemu_notify_event(); + return true; } + + return false; } =20 void diff --git a/slirp/socket.c b/slirp/socket.c index 677fd20c9d..2b1b5052c4 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -928,3 +928,10 @@ void sotranslate_accept(struct socket *so) break; } } + +void sodrop(struct socket *s, int num) +{ + if (sbdrop(&s->so_snd, num)) { + s->slirp->cb->notify(); + } +} diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index e33fb83df5..456d5829e7 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -527,7 +527,7 @@ findso: SEQ_GT(ti->ti_ack, tp->t_rtseq)) tcp_xmit_timer(tp, tp->t_rtt); acked =3D ti->ti_ack - tp->snd_una; - sbdrop(&so->so_snd, acked); + sodrop(so, acked); tp->snd_una =3D ti->ti_ack; m_free(m); =20 @@ -1140,10 +1140,10 @@ trimthenstep6: } if (acked > so->so_snd.sb_cc) { tp->snd_wnd -=3D so->so_snd.sb_cc; - sbdrop(&so->so_snd, (int )so->so_snd.sb_cc); + sodrop(so, (int)so->so_snd.sb_cc); ourfinisacked =3D 1; } else { - sbdrop(&so->so_snd, acked); + sodrop(so, acked); tp->snd_wnd -=3D acked; ourfinisacked =3D 0; } --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200775123896.970526346675; Wed, 14 Nov 2018 05:06:15 -0800 (PST) Received: from localhost ([::1]:59981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMus1-0006Fb-VJ for importer@patchew.org; Wed, 14 Nov 2018 08:06:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVa-0004Ox-Ep for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVZ-0004AB-8L for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35492) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVZ-00049X-0a for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F88C796F1; Wed, 14 Nov 2018 12:43:00 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA27260150; Wed, 14 Nov 2018 12:42:58 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:36 +0400 Message-Id: <20181114123643.24091-35-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:43:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 34/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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) } } =20 -/* - * Do option processing on a datagram, - * possibly discarding it if bad options are encountered, - * or forwarding it if source-routed. - * Returns 1 if packet has been forwarded/freed, - * 0 if the packet should be processed further. - */ - -#ifdef notdef - -int -ip_dooptions(m) - struct mbuf *m; -{ - register struct ip *ip =3D mtod(m, struct ip *); - register u_char *cp; - register struct ip_timestamp *ipt; - register struct in_ifaddr *ia; - int opt, optlen, cnt, off, code, type, forward =3D 0; - struct in_addr *sin, dst; -typedef uint32_t n_time; - n_time ntime; - - dst =3D ip->ip_dst; - cp =3D (u_char *)(ip + 1); - cnt =3D (ip->ip_hl << 2) - sizeof (struct ip); - for (; cnt > 0; cnt -=3D optlen, cp +=3D optlen) { - opt =3D cp[IPOPT_OPTVAL]; - if (opt =3D=3D IPOPT_EOL) - break; - if (opt =3D=3D IPOPT_NOP) - optlen =3D 1; - else { - optlen =3D cp[IPOPT_OLEN]; - if (optlen <=3D 0 || optlen > cnt) { - code =3D &cp[IPOPT_OLEN] - (u_char *)ip; - goto bad; - } - } - switch (opt) { - - default: - break; - - /* - * Source routing with record. - * Find interface with current destination address. - * If none on this machine then drop if strictly routed, - * or do nothing if loosely routed. - * Record interface address and bring up next address - * component. If strictly routed make sure next - * address is on directly accessible net. - */ - case IPOPT_LSRR: - case IPOPT_SSRR: - if ((off =3D cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code =3D &cp[IPOPT_OFFSET] - (u_char *)ip; - goto bad; - } - ipaddr.sin_addr =3D ip->ip_dst; - ia =3D (struct in_ifaddr *) - ifa_ifwithaddr((struct sockaddr *)&ipaddr); - if (ia =3D=3D 0) { - if (opt =3D=3D IPOPT_SSRR) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_SRCFAIL; - goto bad; - } - /* - * Loose routing, and not at next destination - * yet; nothing to do except forward. - */ - break; - } - off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) { - /* - * End of source route. Should be for us. - */ - save_rte(cp, ip->ip_src); - break; - } - /* - * locate outgoing interface - */ - bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, - sizeof(ipaddr.sin_addr)); - if (opt =3D=3D IPOPT_SSRR) { -#define INA struct in_ifaddr * -#define SA struct sockaddr * - if ((ia =3D (INA)ifa_ifwithdstaddr((SA)&ipaddr)) =3D=3D 0) - ia =3D (INA)ifa_ifwithnet((SA)&ipaddr); - } else - ia =3D ip_rtaddr(ipaddr.sin_addr); - if (ia =3D=3D 0) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_SRCFAIL; - goto bad; - } - ip->ip_dst =3D ipaddr.sin_addr; - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] +=3D sizeof(struct in_addr); - /* - * Let ip_intr's mcast routing check handle mcast pkts - */ - forward =3D !IN_MULTICAST(ntohl(ip->ip_dst.s_addr)); - break; - - case IPOPT_RR: - if ((off =3D cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { - code =3D &cp[IPOPT_OFFSET] - (u_char *)ip; - goto bad; - } - /* - * If no space remains, ignore. - */ - off--; /* 0 origin */ - if (off > optlen - sizeof(struct in_addr)) - break; - bcopy((caddr_t)(&ip->ip_dst), (caddr_t)&ipaddr.sin_addr, - sizeof(ipaddr.sin_addr)); - /* - * locate outgoing interface; if we're the destination, - * use the incoming interface (should be same). - */ - if ((ia =3D (INA)ifa_ifwithaddr((SA)&ipaddr)) =3D=3D 0 && - (ia =3D ip_rtaddr(ipaddr.sin_addr)) =3D=3D 0) { - type =3D ICMP_UNREACH; - code =3D ICMP_UNREACH_HOST; - goto bad; - } - bcopy((caddr_t)&(IA_SIN(ia)->sin_addr), - (caddr_t)(cp + off), sizeof(struct in_addr)); - cp[IPOPT_OFFSET] +=3D sizeof(struct in_addr); - break; - - case IPOPT_TS: - code =3D cp - (u_char *)ip; - ipt =3D (struct ip_timestamp *)cp; - if (ipt->ipt_len < 5) - goto bad; - if (ipt->ipt_ptr > ipt->ipt_len - sizeof (int32_t)) { - if (++ipt->ipt_oflw =3D=3D 0) - goto bad; - break; - } - sin =3D (struct in_addr *)(cp + ipt->ipt_ptr - 1); - switch (ipt->ipt_flg) { - - case IPOPT_TS_TSONLY: - break; - - case IPOPT_TS_TSANDADDR: - if (ipt->ipt_ptr + sizeof(n_time) + - sizeof(struct in_addr) > ipt->ipt_len) - goto bad; - ipaddr.sin_addr =3D dst; - ia =3D (INA)ifaof_ i f p foraddr((SA)&ipaddr, - m->m_pkthdr.rcvif); - if (ia =3D=3D 0) - continue; - bcopy((caddr_t)&IA_SIN(ia)->sin_addr, - (caddr_t)sin, sizeof(struct in_addr)); - ipt->ipt_ptr +=3D sizeof(struct in_addr); - break; - - case IPOPT_TS_PRESPEC: - if (ipt->ipt_ptr + sizeof(n_time) + - sizeof(struct in_addr) > ipt->ipt_len) - goto bad; - bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr, - sizeof(struct in_addr)); - if (ifa_ifwithaddr((SA)&ipaddr) =3D=3D 0) - continue; - ipt->ipt_ptr +=3D sizeof(struct in_addr); - break; - - default: - goto bad; - } - ntime =3D iptime(); - bcopy((caddr_t)&ntime, (caddr_t)cp + ipt->ipt_ptr - 1, - sizeof(n_time)); - ipt->ipt_ptr +=3D sizeof(n_time); - } - } - if (forward) { - ip_forward(m, 1); - return (1); - } - return (0); -bad: - icmp_send_error(m, type, code, 0, 0); - - return (1); -} - -#endif /* notdef */ - /* * Strip out IP options, at higher * level protocol in the kernel. diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 456d5829e7..de4ef92aba 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -1441,45 +1441,6 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt,= struct tcpiphdr *ti) } } =20 - -/* - * Pull out of band byte out of a segment so - * it doesn't appear in the user's data queue. - * It is still reflected in the segment length for - * sequencing purposes. - */ - -#ifdef notdef - -void -tcp_pulloutofband(so, ti, m) - struct socket *so; - struct tcpiphdr *ti; - register struct mbuf *m; -{ - int cnt =3D ti->ti_urp - 1; - - while (cnt >=3D 0) { - if (m->m_len > cnt) { - char *cp =3D mtod(m, caddr_t) + cnt; - struct tcpcb *tp =3D sototcpcb(so); - - tp->t_iobc =3D *cp; - tp->t_oobflags |=3D TCPOOB_HAVEDATA; - memcpy(sp, cp+1, (unsigned)(m->m_len - cnt - 1)); - m->m_len--; - return; - } - cnt -=3D m->m_len; - m =3D m->m_next; /* XXX WRONG! Fix it! */ - if (m =3D=3D 0) - break; - } - panic("tcp_pulloutofband"); -} - -#endif /* notdef */ - /* * Collect new round-trip time estimate * and update averages and current timeout. --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200548786562.4135749051612; Wed, 14 Nov 2018 05:02:28 -0800 (PST) Received: from localhost ([::1]:59929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuoI-000399-OV for importer@patchew.org; Wed, 14 Nov 2018 08:02:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuVq-0004bu-Tv for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuVk-0004FS-Uq for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVk-0004F4-Pw for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:12 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BDE11555A; Wed, 14 Nov 2018 12:43:12 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DB6060BE4; Wed, 14 Nov 2018 12:43:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:37 +0400 Message-Id: <20181114123643.24091-36-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 14 Nov 2018 12:43:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 35/41] slirp: NULL is defined by glib (at least) 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- slirp/slirp.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/slirp/slirp.h b/slirp/slirp.h index 4356b2f427..2a61a85995 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -199,10 +199,6 @@ struct Slirp { void *opaque; }; =20 -#ifndef NULL -#define NULL (void *)0 -#endif - void if_start(Slirp *); =20 int get_dns_addr(struct in_addr *pdns_addr); --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200712688730.0413956437721; Wed, 14 Nov 2018 05:05:12 -0800 (PST) Received: from localhost ([::1]:59974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuqx-0005SJ-QY for importer@patchew.org; Wed, 14 Nov 2018 08:05:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuW7-0004my-Fl for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuW2-0004NO-Dj for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuVz-0004L8-Hw for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:28 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F21DC0C112B; Wed, 14 Nov 2018 12:43:25 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3DC85D762; Wed, 14 Nov 2018 12:43:15 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:38 +0400 Message-Id: <20181114123643.24091-37-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:43:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 36/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Untouched since original introduction in 2004. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 de4ef92aba..0d34abf8d7 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -60,27 +60,6 @@ * Set DELACK for segments received in order, but ack immediately * when segments are out of order (so fast retransmit can work). */ -#ifdef TCP_ACK_HACK -#define TCP_REASS(tp, ti, m, so, flags) {\ - if ((ti)->ti_seq =3D=3D (tp)->rcv_nxt && \ - tcpfrag_list_empty(tp) && \ - (tp)->t_state =3D=3D TCPS_ESTABLISHED) {\ - if (ti->ti_flags & TH_PUSH) \ - tp->t_flags |=3D TF_ACKNOW; \ - else \ - tp->t_flags |=3D TF_DELACK; \ - (tp)->rcv_nxt +=3D (ti)->ti_len; \ - flags =3D (ti)->ti_flags & TH_FIN; \ - if (so->so_emu) { \ - if (tcp_emu((so),(m))) sbappend((so), (m)); \ - } else \ - sbappend((so), (m)); \ - } else {\ - (flags) =3D tcp_reass((tp), (ti), (m)); \ - tp->t_flags |=3D TF_ACKNOW; \ - } \ -} -#else #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq =3D=3D (tp)->rcv_nxt && \ tcpfrag_list_empty(tp) && \ @@ -97,7 +76,7 @@ tp->t_flags |=3D TF_ACKNOW; \ } \ } -#endif + static void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti); static void tcp_xmit_timer(register struct tcpcb *tp, int rtt); --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15422009262971017.213215250235; Wed, 14 Nov 2018 05:08:46 -0800 (PST) Received: from localhost ([::1]:59991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuuS-0008LH-Vo for importer@patchew.org; Wed, 14 Nov 2018 08:08:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuWE-0004vI-Km for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuWC-0004TE-PF for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60718) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuWA-0004Rh-V9 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:39 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1873307EA8A; Wed, 14 Nov 2018 12:43:37 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AAE21054FAE; Wed, 14 Nov 2018 12:43:28 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:39 +0400 Message-Id: <20181114123643.24091-38-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 14 Nov 2018 12:43:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 37/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Do not require QEMU macro. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/ncsi.c | 2 +- slirp/tftp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 10decfb5ef..8594382270 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -128,7 +128,7 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) memset(reh->h_source, 0xff, ETH_ALEN); reh->h_proto =3D htons(ETH_P_NCSI); =20 - for (i =3D 0; i < ARRAY_SIZE(ncsi_rsp_handlers); i++) { + for (i =3D 0; i < G_N_ELEMENTS(ncsi_rsp_handlers); i++) { if (ncsi_rsp_handlers[i].type =3D=3D nh->type + 0x80) { handler =3D &ncsi_rsp_handlers[i]; break; diff --git a/slirp/tftp.c b/slirp/tftp.c index dddb614b8a..ef8d0352b4 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -360,7 +360,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, return; } =20 - while (k < pktlen && nb_options < ARRAY_SIZE(option_name)) { + while (k < pktlen && nb_options < G_N_ELEMENTS(option_name)) { const char *key, *value; =20 key =3D &tp->x.tp_buf[k]; @@ -404,7 +404,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockad= dr_storage *srcsas, } =20 if (nb_options > 0) { - assert(nb_options <=3D ARRAY_SIZE(option_name)); + assert(nb_options <=3D G_N_ELEMENTS(option_name)); tftp_send_oack(spt, option_name, option_value, nb_options, tp); return; } --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542201073243436.2988227581843; Wed, 14 Nov 2018 05:11:13 -0800 (PST) Received: from localhost ([::1]:60044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuwq-0001jn-0U for importer@patchew.org; Wed, 14 Nov 2018 08:11:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuWJ-0004zH-P2 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuWG-0004VO-OU for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50076) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuWG-0004UO-H8 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3232C0BEA8F; Wed, 14 Nov 2018 12:43:42 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 508FD1019632; Wed, 14 Nov 2018 12:43:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:40 +0400 Message-Id: <20181114123643.24091-39-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Nov 2018 12:43:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 38/41] 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: samuel.thibault@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Only slirp/libslirp.h should be included. Instead of using some slirp declarations and utility functions directly, let's copy them in net/util.h. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- net/colo.h | 3 +-- net/util.h | 55 +++++++++++++++++++++++++++++++++++++++++++ net/colo-compare.c | 1 + net/colo.c | 1 + net/filter-rewriter.c | 1 + net/slirp.c | 2 +- stubs/slirp.c | 2 +- 7 files changed, 61 insertions(+), 4 deletions(-) diff --git a/net/colo.h b/net/colo.h index 11c5226488..420d916af2 100644 --- a/net/colo.h +++ b/net/colo.h @@ -15,10 +15,9 @@ #ifndef QEMU_COLO_PROXY_H #define QEMU_COLO_PROXY_H =20 -#include "slirp/slirp.h" #include "qemu/jhash.h" #include "qemu/timer.h" -#include "slirp/tcp.h" +#include "net/eth.h" =20 #define HASHTABLE_MAX_SIZE 16384 =20 diff --git a/net/util.h b/net/util.h index 60b73d372d..358185fd50 100644 --- a/net/util.h +++ b/net/util.h @@ -26,6 +26,61 @@ #define QEMU_NET_UTIL_H =20 =20 +/* + * Structure of an internet header, naked of options. + */ +struct ip { +#ifdef HOST_WORDS_BIGENDIAN + uint8_t ip_v:4, /* version */ + ip_hl:4; /* header length */ +#else + uint8_t ip_hl:4, /* header length */ + ip_v:4; /* version */ +#endif + uint8_t ip_tos; /* type of service */ + uint16_t ip_len; /* total length */ + uint16_t ip_id; /* identification */ + uint16_t ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* don't fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + uint8_t ip_ttl; /* time to live */ + uint8_t ip_p; /* protocol */ + uint16_t ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ +} QEMU_PACKED; + +static inline bool in6_equal_net(const struct in6_addr *a, + const struct in6_addr *b, + int prefix_len) +{ + if (memcmp(a, b, prefix_len / 8) !=3D 0) { + return 0; + } + + if (prefix_len % 8 =3D=3D 0) { + return 1; + } + + return a->s6_addr[prefix_len / 8] >> (8 - (prefix_len % 8)) + =3D=3D b->s6_addr[prefix_len / 8] >> (8 - (prefix_len % 8)); +} + +#define TCPS_CLOSED 0 /* closed */ +#define TCPS_LISTEN 1 /* listening for connection */ +#define TCPS_SYN_SENT 2 /* active, have sent syn */ +#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define TCPS_ESTABLISHED 4 /* established */ +#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK = */ +#define TCPS_LAST_ACK 8 /* had fin and close; await FIN AC= K */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close= */ + int net_parse_macaddr(uint8_t *macaddr, const char *p); =20 #endif /* QEMU_NET_UTIL_H */ diff --git a/net/colo-compare.c b/net/colo-compare.c index a39191d522..3b6f596432 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -30,6 +30,7 @@ #include "net/colo-compare.h" #include "migration/colo.h" #include "migration/migration.h" +#include "util.h" =20 #define TYPE_COLO_COMPARE "colo-compare" #define COLO_COMPARE(obj) \ diff --git a/net/colo.c b/net/colo.c index 49176bf07b..8196b35837 100644 --- a/net/colo.c +++ b/net/colo.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "trace.h" #include "colo.h" +#include "util.h" =20 uint32_t connection_key_hash(const void *opaque) { diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index bb8f4d93b1..9ccd8947db 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -22,6 +22,7 @@ #include "net/checksum.h" #include "net/colo.h" #include "migration/colo.h" +#include "util.h" =20 #define FILTER_COLO_REWRITER(obj) \ OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER) diff --git a/net/slirp.c b/net/slirp.c index 4c39878933..7524049e49 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -38,12 +38,12 @@ #include "qemu/error-report.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" -#include "slirp/ip6.h" #include "chardev/char-fe.h" #include "sysemu/sysemu.h" #include "qemu/cutils.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" +#include "util.h" =20 static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { diff --git a/stubs/slirp.c b/stubs/slirp.c index 42f7e1afd0..70704346fd 100644 --- a/stubs/slirp.c +++ b/stubs/slirp.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/host-utils.h" -#include "slirp/slirp.h" +#include "slirp/libslirp.h" =20 void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout) { --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200881871681.7318015185427; Wed, 14 Nov 2018 05:08:01 -0800 (PST) Received: from localhost ([::1]:59989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMutd-0007Mg-Bw for importer@patchew.org; Wed, 14 Nov 2018 08:07:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuWP-00054m-Hq for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuWM-0004Yb-SL for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36618) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuWM-0004Xu-IP for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:43:50 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2C097F406; Wed, 14 Nov 2018 12:43:48 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54DC71019632; Wed, 14 Nov 2018 12:43:45 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:41 +0400 Message-Id: <20181114123643.24091-40-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:43:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 39/41] slirp: move QEMU state saving to a separate unit 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Make state saving optional: this will allow to build SLIRP without QEMU. (eventually, the vmstate helpers will be extracted, so an external project & process could save its state) Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/slirp.h | 3 + slirp/state.h | 9 + slirp/slirp.c | 371 ++--------------------------------------- slirp/state.c | 394 ++++++++++++++++++++++++++++++++++++++++++++ slirp/Makefile.objs | 4 +- 5 files changed, 420 insertions(+), 361 deletions(-) create mode 100644 slirp/state.h create mode 100644 slirp/state.c diff --git a/slirp/slirp.h b/slirp/slirp.h index 2a61a85995..e5cd0cd334 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -270,4 +270,7 @@ int tcp_emu(struct socket *, struct mbuf *); int tcp_ctl(struct socket *); struct tcpcb *tcp_drop(struct tcpcb *tp, int err); =20 +struct socket * +slirp_find_ctl_socket(Slirp *slirp, struct in_addr guest_addr, int guest_p= ort); + #endif diff --git a/slirp/state.h b/slirp/state.h new file mode 100644 index 0000000000..154866898f --- /dev/null +++ b/slirp/state.h @@ -0,0 +1,9 @@ +#ifndef SLIRP_STATE_H_ +#define SLIRP_STATE_H_ + +#include "libslirp.h" + +void slirp_state_register(Slirp *slirp); +void slirp_state_unregister(Slirp *slirp); + +#endif /* SLIRP_STATE_H_ */ diff --git a/slirp/slirp.c b/slirp/slirp.c index 9a87abee27..8b56f28d77 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -31,6 +31,10 @@ #include "hw/hw.h" #include "qemu/cutils.h" =20 +#ifdef WITH_STATE +#include "state.h" +#endif + #ifndef _WIN32 #include #endif @@ -273,14 +277,6 @@ static void slirp_init_once(void) loopback_mask =3D htonl(IN_CLASSA_NET); } =20 -static void slirp_state_save(QEMUFile *f, void *opaque); -static int slirp_state_load(QEMUFile *f, void *opaque, int version_id); - -static SaveVMHandlers savevm_slirp_state =3D { - .save_state =3D slirp_state_save, - .load_state =3D slirp_state_load, -}; - Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in_addr vnetmask, struct in_addr vhost, bool in6_enabled, @@ -336,8 +332,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, stru= ct in_addr vnetwork, =20 slirp->opaque =3D opaque; =20 - register_savevm_live(NULL, "slirp", 0, 4, &savevm_slirp_state, slirp); - +#ifdef WITH_STATE + slirp_state_register(slirp); +#endif QTAILQ_INSERT_TAIL(&slirp_instances, slirp, entry); =20 return slirp; @@ -354,9 +351,9 @@ void slirp_cleanup(Slirp *slirp) } =20 QTAILQ_REMOVE(&slirp_instances, slirp, entry); - - unregister_savevm(NULL, "slirp", slirp); - +#ifdef WITH_STATE + slirp_state_unregister(slirp); +#endif ip_cleanup(slirp); ip6_cleanup(slirp); m_cleanup(slirp); @@ -1080,7 +1077,7 @@ ssize_t slirp_send(struct socket *so, const void *buf= , size_t len, int flags) return send(so->s, buf, len, flags); } =20 -static struct socket * +struct socket * slirp_find_ctl_socket(Slirp *slirp, struct in_addr guest_addr, int guest_p= ort) { struct socket *so; @@ -1128,349 +1125,3 @@ void slirp_socket_recv(Slirp *slirp, struct in_addr= guest_addr, int guest_port, tcp_output(sototcpcb(so)); } =20 -static int slirp_tcp_post_load(void *opaque, int version) -{ - tcp_template((struct tcpcb *)opaque); - - return 0; -} - -static const VMStateDescription vmstate_slirp_tcp =3D { - .name =3D "slirp-tcp", - .version_id =3D 0, - .post_load =3D slirp_tcp_post_load, - .fields =3D (VMStateField[]) { - VMSTATE_INT16(t_state, struct tcpcb), - VMSTATE_INT16_ARRAY(t_timer, struct tcpcb, TCPT_NTIMERS), - VMSTATE_INT16(t_rxtshift, struct tcpcb), - VMSTATE_INT16(t_rxtcur, struct tcpcb), - VMSTATE_INT16(t_dupacks, struct tcpcb), - VMSTATE_UINT16(t_maxseg, struct tcpcb), - VMSTATE_UINT8(t_force, struct tcpcb), - VMSTATE_UINT16(t_flags, struct tcpcb), - VMSTATE_UINT32(snd_una, struct tcpcb), - VMSTATE_UINT32(snd_nxt, struct tcpcb), - VMSTATE_UINT32(snd_up, struct tcpcb), - VMSTATE_UINT32(snd_wl1, struct tcpcb), - VMSTATE_UINT32(snd_wl2, struct tcpcb), - VMSTATE_UINT32(iss, struct tcpcb), - VMSTATE_UINT32(snd_wnd, struct tcpcb), - VMSTATE_UINT32(rcv_wnd, struct tcpcb), - VMSTATE_UINT32(rcv_nxt, struct tcpcb), - VMSTATE_UINT32(rcv_up, struct tcpcb), - VMSTATE_UINT32(irs, struct tcpcb), - VMSTATE_UINT32(rcv_adv, struct tcpcb), - VMSTATE_UINT32(snd_max, struct tcpcb), - VMSTATE_UINT32(snd_cwnd, struct tcpcb), - VMSTATE_UINT32(snd_ssthresh, struct tcpcb), - VMSTATE_INT16(t_idle, struct tcpcb), - VMSTATE_INT16(t_rtt, struct tcpcb), - VMSTATE_UINT32(t_rtseq, struct tcpcb), - VMSTATE_INT16(t_srtt, struct tcpcb), - VMSTATE_INT16(t_rttvar, struct tcpcb), - VMSTATE_UINT16(t_rttmin, struct tcpcb), - VMSTATE_UINT32(max_sndwnd, struct tcpcb), - VMSTATE_UINT8(t_oobflags, struct tcpcb), - VMSTATE_UINT8(t_iobc, struct tcpcb), - VMSTATE_INT16(t_softerror, struct tcpcb), - VMSTATE_UINT8(snd_scale, struct tcpcb), - VMSTATE_UINT8(rcv_scale, struct tcpcb), - VMSTATE_UINT8(request_r_scale, struct tcpcb), - VMSTATE_UINT8(requested_s_scale, struct tcpcb), - VMSTATE_UINT32(ts_recent, struct tcpcb), - VMSTATE_UINT32(ts_recent_age, struct tcpcb), - VMSTATE_UINT32(last_ack_sent, struct tcpcb), - VMSTATE_END_OF_LIST() - } -}; - -/* The sbuf has a pair of pointers that are migrated as offsets; - * we calculate the offsets and restore the pointers using - * pre_save/post_load on a tmp structure. - */ -struct sbuf_tmp { - struct sbuf *parent; - uint32_t roff, woff; -}; - -static int sbuf_tmp_pre_save(void *opaque) -{ - struct sbuf_tmp *tmp =3D opaque; - tmp->woff =3D tmp->parent->sb_wptr - tmp->parent->sb_data; - tmp->roff =3D tmp->parent->sb_rptr - tmp->parent->sb_data; - - return 0; -} - -static int sbuf_tmp_post_load(void *opaque, int version) -{ - struct sbuf_tmp *tmp =3D opaque; - uint32_t requested_len =3D tmp->parent->sb_datalen; - - /* Allocate the buffer space used by the field after the tmp */ - sbreserve(tmp->parent, tmp->parent->sb_datalen); - - if (tmp->parent->sb_datalen !=3D requested_len) { - return -ENOMEM; - } - if (tmp->woff >=3D requested_len || - tmp->roff >=3D requested_len) { - g_critical("invalid sbuf offsets r/w=3D%u/%u len=3D%u", - tmp->roff, tmp->woff, requested_len); - return -EINVAL; - } - - tmp->parent->sb_wptr =3D tmp->parent->sb_data + tmp->woff; - tmp->parent->sb_rptr =3D tmp->parent->sb_data + tmp->roff; - - return 0; -} - - -static const VMStateDescription vmstate_slirp_sbuf_tmp =3D { - .name =3D "slirp-sbuf-tmp", - .post_load =3D sbuf_tmp_post_load, - .pre_save =3D sbuf_tmp_pre_save, - .version_id =3D 0, - .fields =3D (VMStateField[]) { - VMSTATE_UINT32(woff, struct sbuf_tmp), - VMSTATE_UINT32(roff, struct sbuf_tmp), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_slirp_sbuf =3D { - .name =3D "slirp-sbuf", - .version_id =3D 0, - .fields =3D (VMStateField[]) { - VMSTATE_UINT32(sb_cc, struct sbuf), - VMSTATE_UINT32(sb_datalen, struct sbuf), - VMSTATE_WITH_TMP(struct sbuf, struct sbuf_tmp, vmstate_slirp_sbuf_= tmp), - VMSTATE_VBUFFER_UINT32(sb_data, struct sbuf, 0, NULL, sb_datalen), - VMSTATE_END_OF_LIST() - } -}; - -static bool slirp_older_than_v4(void *opaque, int version_id) -{ - return version_id < 4; -} - -static bool slirp_family_inet(void *opaque, int version_id) -{ - union slirp_sockaddr *ssa =3D (union slirp_sockaddr *)opaque; - return ssa->ss.ss_family =3D=3D AF_INET; -} - -static int slirp_socket_pre_load(void *opaque) -{ - struct socket *so =3D opaque; - if (tcp_attach(so) < 0) { - return -ENOMEM; - } - /* Older versions don't load these fields */ - so->so_ffamily =3D AF_INET; - so->so_lfamily =3D AF_INET; - return 0; -} - -#ifndef _WIN32 -#define VMSTATE_SIN4_ADDR(f, s, t) VMSTATE_UINT32_TEST(f, s, t) -#else -/* Win uses u_long rather than uint32_t - but it's still 32bits long */ -#define VMSTATE_SIN4_ADDR(f, s, t) VMSTATE_SINGLE_TEST(f, s, t, 0, \ - vmstate_info_uint32, u_long) -#endif - -/* The OS provided ss_family field isn't that portable; it's size - * and type varies (16/8 bit, signed, unsigned) - * and the values it contains aren't fully portable. - */ -typedef struct SS_FamilyTmpStruct { - union slirp_sockaddr *parent; - uint16_t portable_family; -} SS_FamilyTmpStruct; - -#define SS_FAMILY_MIG_IPV4 2 /* Linux, BSD, Win... */ -#define SS_FAMILY_MIG_IPV6 10 /* Linux */ -#define SS_FAMILY_MIG_OTHER 0xffff - -static int ss_family_pre_save(void *opaque) -{ - SS_FamilyTmpStruct *tss =3D opaque; - - tss->portable_family =3D SS_FAMILY_MIG_OTHER; - - if (tss->parent->ss.ss_family =3D=3D AF_INET) { - tss->portable_family =3D SS_FAMILY_MIG_IPV4; - } else if (tss->parent->ss.ss_family =3D=3D AF_INET6) { - tss->portable_family =3D SS_FAMILY_MIG_IPV6; - } - - return 0; -} - -static int ss_family_post_load(void *opaque, int version_id) -{ - SS_FamilyTmpStruct *tss =3D opaque; - - switch (tss->portable_family) { - case SS_FAMILY_MIG_IPV4: - tss->parent->ss.ss_family =3D AF_INET; - break; - case SS_FAMILY_MIG_IPV6: - case 23: /* compatibility: AF_INET6 from mingw */ - case 28: /* compatibility: AF_INET6 from FreeBSD sys/socket.h */ - tss->parent->ss.ss_family =3D AF_INET6; - break; - default: - g_critical("invalid ss_family type %x", tss->portable_family); - return -EINVAL; - } - - return 0; -} - -static const VMStateDescription vmstate_slirp_ss_family =3D { - .name =3D "slirp-socket-addr/ss_family", - .pre_save =3D ss_family_pre_save, - .post_load =3D ss_family_post_load, - .fields =3D (VMStateField[]) { - VMSTATE_UINT16(portable_family, SS_FamilyTmpStruct), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_slirp_socket_addr =3D { - .name =3D "slirp-socket-addr", - .version_id =3D 4, - .fields =3D (VMStateField[]) { - VMSTATE_WITH_TMP(union slirp_sockaddr, SS_FamilyTmpStruct, - vmstate_slirp_ss_family), - VMSTATE_SIN4_ADDR(sin.sin_addr.s_addr, union slirp_sockaddr, - slirp_family_inet), - VMSTATE_UINT16_TEST(sin.sin_port, union slirp_sockaddr, - slirp_family_inet), - -#if 0 - /* Untested: Needs checking by someone with IPv6 test */ - VMSTATE_BUFFER_TEST(sin6.sin6_addr, union slirp_sockaddr, - slirp_family_inet6), - VMSTATE_UINT16_TEST(sin6.sin6_port, union slirp_sockaddr, - slirp_family_inet6), - VMSTATE_UINT32_TEST(sin6.sin6_flowinfo, union slirp_sockaddr, - slirp_family_inet6), - VMSTATE_UINT32_TEST(sin6.sin6_scope_id, union slirp_sockaddr, - slirp_family_inet6), -#endif - - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_slirp_socket =3D { - .name =3D "slirp-socket", - .version_id =3D 4, - .pre_load =3D slirp_socket_pre_load, - .fields =3D (VMStateField[]) { - VMSTATE_UINT32(so_urgc, struct socket), - /* Pre-v4 versions */ - VMSTATE_SIN4_ADDR(so_faddr.s_addr, struct socket, - slirp_older_than_v4), - VMSTATE_SIN4_ADDR(so_laddr.s_addr, struct socket, - slirp_older_than_v4), - VMSTATE_UINT16_TEST(so_fport, struct socket, slirp_older_than_v4), - VMSTATE_UINT16_TEST(so_lport, struct socket, slirp_older_than_v4), - /* v4 and newer */ - VMSTATE_STRUCT(fhost, struct socket, 4, vmstate_slirp_socket_addr, - union slirp_sockaddr), - VMSTATE_STRUCT(lhost, struct socket, 4, vmstate_slirp_socket_addr, - union slirp_sockaddr), - - VMSTATE_UINT8(so_iptos, struct socket), - VMSTATE_UINT8(so_emu, struct socket), - VMSTATE_UINT8(so_type, struct socket), - VMSTATE_INT32(so_state, struct socket), - VMSTATE_STRUCT(so_rcv, struct socket, 0, vmstate_slirp_sbuf, - struct sbuf), - VMSTATE_STRUCT(so_snd, struct socket, 0, vmstate_slirp_sbuf, - struct sbuf), - VMSTATE_STRUCT_POINTER(so_tcpcb, struct socket, vmstate_slirp_tcp, - struct tcpcb), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_slirp_bootp_client =3D { - .name =3D "slirp_bootpclient", - .fields =3D (VMStateField[]) { - VMSTATE_UINT16(allocated, BOOTPClient), - VMSTATE_BUFFER(macaddr, BOOTPClient), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_slirp =3D { - .name =3D "slirp", - .version_id =3D 4, - .fields =3D (VMStateField[]) { - VMSTATE_UINT16_V(ip_id, Slirp, 2), - VMSTATE_STRUCT_ARRAY(bootp_clients, Slirp, NB_BOOTP_CLIENTS, 3, - vmstate_slirp_bootp_client, BOOTPClient), - VMSTATE_END_OF_LIST() - } -}; - -static void slirp_state_save(QEMUFile *f, void *opaque) -{ - Slirp *slirp =3D opaque; - struct ex_list *ex_ptr; - - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_next) - if (ex_ptr->ex_chardev) { - struct socket *so; - so =3D slirp_find_ctl_socket(slirp, ex_ptr->ex_addr, - ntohs(ex_ptr->ex_fport)); - if (!so) - continue; - - qemu_put_byte(f, 42); - vmstate_save_state(f, &vmstate_slirp_socket, so, NULL); - } - qemu_put_byte(f, 0); - - vmstate_save_state(f, &vmstate_slirp, slirp, NULL); -} - - -static int slirp_state_load(QEMUFile *f, void *opaque, int version_id) -{ - Slirp *slirp =3D opaque; - struct ex_list *ex_ptr; - - while (qemu_get_byte(f)) { - int ret; - struct socket *so =3D socreate(slirp); - - ret =3D vmstate_load_state(f, &vmstate_slirp_socket, so, version_i= d); - - if (ret < 0) - return ret; - - if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=3D - slirp->vnetwork_addr.s_addr) { - return -EINVAL; - } - for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { - if (ex_ptr->ex_chardev && - so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr && - so->so_fport =3D=3D ex_ptr->ex_fport) { - break; - } - } - if (!ex_ptr) - return -EINVAL; - } - - return vmstate_load_state(f, &vmstate_slirp, slirp, version_id); -} diff --git a/slirp/state.c b/slirp/state.c new file mode 100644 index 0000000000..1572761aa1 --- /dev/null +++ b/slirp/state.c @@ -0,0 +1,394 @@ +/* + * libslirp + * + * Copyright (c) 2004-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#include "qemu/osdep.h" + +#include "slirp.h" +#include "state.h" +#include "migration/vmstate.h" +#include "migration/qemu-file-types.h" +#include "migration/register.h" + +static int slirp_tcp_post_load(void *opaque, int version) +{ + tcp_template((struct tcpcb *)opaque); + + return 0; +} + +static const VMStateDescription vmstate_slirp_tcp =3D { + .name =3D "slirp-tcp", + .version_id =3D 0, + .post_load =3D slirp_tcp_post_load, + .fields =3D (VMStateField[]) { + VMSTATE_INT16(t_state, struct tcpcb), + VMSTATE_INT16_ARRAY(t_timer, struct tcpcb, TCPT_NTIMERS), + VMSTATE_INT16(t_rxtshift, struct tcpcb), + VMSTATE_INT16(t_rxtcur, struct tcpcb), + VMSTATE_INT16(t_dupacks, struct tcpcb), + VMSTATE_UINT16(t_maxseg, struct tcpcb), + VMSTATE_UINT8(t_force, struct tcpcb), + VMSTATE_UINT16(t_flags, struct tcpcb), + VMSTATE_UINT32(snd_una, struct tcpcb), + VMSTATE_UINT32(snd_nxt, struct tcpcb), + VMSTATE_UINT32(snd_up, struct tcpcb), + VMSTATE_UINT32(snd_wl1, struct tcpcb), + VMSTATE_UINT32(snd_wl2, struct tcpcb), + VMSTATE_UINT32(iss, struct tcpcb), + VMSTATE_UINT32(snd_wnd, struct tcpcb), + VMSTATE_UINT32(rcv_wnd, struct tcpcb), + VMSTATE_UINT32(rcv_nxt, struct tcpcb), + VMSTATE_UINT32(rcv_up, struct tcpcb), + VMSTATE_UINT32(irs, struct tcpcb), + VMSTATE_UINT32(rcv_adv, struct tcpcb), + VMSTATE_UINT32(snd_max, struct tcpcb), + VMSTATE_UINT32(snd_cwnd, struct tcpcb), + VMSTATE_UINT32(snd_ssthresh, struct tcpcb), + VMSTATE_INT16(t_idle, struct tcpcb), + VMSTATE_INT16(t_rtt, struct tcpcb), + VMSTATE_UINT32(t_rtseq, struct tcpcb), + VMSTATE_INT16(t_srtt, struct tcpcb), + VMSTATE_INT16(t_rttvar, struct tcpcb), + VMSTATE_UINT16(t_rttmin, struct tcpcb), + VMSTATE_UINT32(max_sndwnd, struct tcpcb), + VMSTATE_UINT8(t_oobflags, struct tcpcb), + VMSTATE_UINT8(t_iobc, struct tcpcb), + VMSTATE_INT16(t_softerror, struct tcpcb), + VMSTATE_UINT8(snd_scale, struct tcpcb), + VMSTATE_UINT8(rcv_scale, struct tcpcb), + VMSTATE_UINT8(request_r_scale, struct tcpcb), + VMSTATE_UINT8(requested_s_scale, struct tcpcb), + VMSTATE_UINT32(ts_recent, struct tcpcb), + VMSTATE_UINT32(ts_recent_age, struct tcpcb), + VMSTATE_UINT32(last_ack_sent, struct tcpcb), + VMSTATE_END_OF_LIST() + } +}; + +/* The sbuf has a pair of pointers that are migrated as offsets; + * we calculate the offsets and restore the pointers using + * pre_save/post_load on a tmp structure. + */ +struct sbuf_tmp { + struct sbuf *parent; + uint32_t roff, woff; +}; + +static int sbuf_tmp_pre_save(void *opaque) +{ + struct sbuf_tmp *tmp =3D opaque; + tmp->woff =3D tmp->parent->sb_wptr - tmp->parent->sb_data; + tmp->roff =3D tmp->parent->sb_rptr - tmp->parent->sb_data; + + return 0; +} + +static int sbuf_tmp_post_load(void *opaque, int version) +{ + struct sbuf_tmp *tmp =3D opaque; + uint32_t requested_len =3D tmp->parent->sb_datalen; + + /* Allocate the buffer space used by the field after the tmp */ + sbreserve(tmp->parent, tmp->parent->sb_datalen); + + if (tmp->parent->sb_datalen !=3D requested_len) { + return -ENOMEM; + } + if (tmp->woff >=3D requested_len || + tmp->roff >=3D requested_len) { + g_critical("invalid sbuf offsets r/w=3D%u/%u len=3D%u", + tmp->roff, tmp->woff, requested_len); + return -EINVAL; + } + + tmp->parent->sb_wptr =3D tmp->parent->sb_data + tmp->woff; + tmp->parent->sb_rptr =3D tmp->parent->sb_data + tmp->roff; + + return 0; +} + + +static const VMStateDescription vmstate_slirp_sbuf_tmp =3D { + .name =3D "slirp-sbuf-tmp", + .post_load =3D sbuf_tmp_post_load, + .pre_save =3D sbuf_tmp_pre_save, + .version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(woff, struct sbuf_tmp), + VMSTATE_UINT32(roff, struct sbuf_tmp), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_slirp_sbuf =3D { + .name =3D "slirp-sbuf", + .version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(sb_cc, struct sbuf), + VMSTATE_UINT32(sb_datalen, struct sbuf), + VMSTATE_WITH_TMP(struct sbuf, struct sbuf_tmp, vmstate_slirp_sbuf_= tmp), + VMSTATE_VBUFFER_UINT32(sb_data, struct sbuf, 0, NULL, sb_datalen), + VMSTATE_END_OF_LIST() + } +}; + +static bool slirp_older_than_v4(void *opaque, int version_id) +{ + return version_id < 4; +} + +static bool slirp_family_inet(void *opaque, int version_id) +{ + union slirp_sockaddr *ssa =3D (union slirp_sockaddr *)opaque; + return ssa->ss.ss_family =3D=3D AF_INET; +} + +static int slirp_socket_pre_load(void *opaque) +{ + struct socket *so =3D opaque; + if (tcp_attach(so) < 0) { + return -ENOMEM; + } + /* Older versions don't load these fields */ + so->so_ffamily =3D AF_INET; + so->so_lfamily =3D AF_INET; + return 0; +} + +#ifndef _WIN32 +#define VMSTATE_SIN4_ADDR(f, s, t) VMSTATE_UINT32_TEST(f, s, t) +#else +/* Win uses u_long rather than uint32_t - but it's still 32bits long */ +#define VMSTATE_SIN4_ADDR(f, s, t) VMSTATE_SINGLE_TEST(f, s, t, 0, \ + vmstate_info_uint32, u_long) +#endif + +/* The OS provided ss_family field isn't that portable; it's size + * and type varies (16/8 bit, signed, unsigned) + * and the values it contains aren't fully portable. + */ +typedef struct SS_FamilyTmpStruct { + union slirp_sockaddr *parent; + uint16_t portable_family; +} SS_FamilyTmpStruct; + +#define SS_FAMILY_MIG_IPV4 2 /* Linux, BSD, Win... */ +#define SS_FAMILY_MIG_IPV6 10 /* Linux */ +#define SS_FAMILY_MIG_OTHER 0xffff + +static int ss_family_pre_save(void *opaque) +{ + SS_FamilyTmpStruct *tss =3D opaque; + + tss->portable_family =3D SS_FAMILY_MIG_OTHER; + + if (tss->parent->ss.ss_family =3D=3D AF_INET) { + tss->portable_family =3D SS_FAMILY_MIG_IPV4; + } else if (tss->parent->ss.ss_family =3D=3D AF_INET6) { + tss->portable_family =3D SS_FAMILY_MIG_IPV6; + } + + return 0; +} + +static int ss_family_post_load(void *opaque, int version_id) +{ + SS_FamilyTmpStruct *tss =3D opaque; + + switch (tss->portable_family) { + case SS_FAMILY_MIG_IPV4: + tss->parent->ss.ss_family =3D AF_INET; + break; + case SS_FAMILY_MIG_IPV6: + case 23: /* compatibility: AF_INET6 from mingw */ + case 28: /* compatibility: AF_INET6 from FreeBSD sys/socket.h */ + tss->parent->ss.ss_family =3D AF_INET6; + break; + default: + g_critical("invalid ss_family type %x", tss->portable_family); + return -EINVAL; + } + + return 0; +} + +static const VMStateDescription vmstate_slirp_ss_family =3D { + .name =3D "slirp-socket-addr/ss_family", + .pre_save =3D ss_family_pre_save, + .post_load =3D ss_family_post_load, + .fields =3D (VMStateField[]) { + VMSTATE_UINT16(portable_family, SS_FamilyTmpStruct), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_slirp_socket_addr =3D { + .name =3D "slirp-socket-addr", + .version_id =3D 4, + .fields =3D (VMStateField[]) { + VMSTATE_WITH_TMP(union slirp_sockaddr, SS_FamilyTmpStruct, + vmstate_slirp_ss_family), + VMSTATE_SIN4_ADDR(sin.sin_addr.s_addr, union slirp_sockaddr, + slirp_family_inet), + VMSTATE_UINT16_TEST(sin.sin_port, union slirp_sockaddr, + slirp_family_inet), + +#if 0 + /* Untested: Needs checking by someone with IPv6 test */ + VMSTATE_BUFFER_TEST(sin6.sin6_addr, union slirp_sockaddr, + slirp_family_inet6), + VMSTATE_UINT16_TEST(sin6.sin6_port, union slirp_sockaddr, + slirp_family_inet6), + VMSTATE_UINT32_TEST(sin6.sin6_flowinfo, union slirp_sockaddr, + slirp_family_inet6), + VMSTATE_UINT32_TEST(sin6.sin6_scope_id, union slirp_sockaddr, + slirp_family_inet6), +#endif + + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_slirp_socket =3D { + .name =3D "slirp-socket", + .version_id =3D 4, + .pre_load =3D slirp_socket_pre_load, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(so_urgc, struct socket), + /* Pre-v4 versions */ + VMSTATE_SIN4_ADDR(so_faddr.s_addr, struct socket, + slirp_older_than_v4), + VMSTATE_SIN4_ADDR(so_laddr.s_addr, struct socket, + slirp_older_than_v4), + VMSTATE_UINT16_TEST(so_fport, struct socket, slirp_older_than_v4), + VMSTATE_UINT16_TEST(so_lport, struct socket, slirp_older_than_v4), + /* v4 and newer */ + VMSTATE_STRUCT(fhost, struct socket, 4, vmstate_slirp_socket_addr, + union slirp_sockaddr), + VMSTATE_STRUCT(lhost, struct socket, 4, vmstate_slirp_socket_addr, + union slirp_sockaddr), + + VMSTATE_UINT8(so_iptos, struct socket), + VMSTATE_UINT8(so_emu, struct socket), + VMSTATE_UINT8(so_type, struct socket), + VMSTATE_INT32(so_state, struct socket), + VMSTATE_STRUCT(so_rcv, struct socket, 0, vmstate_slirp_sbuf, + struct sbuf), + VMSTATE_STRUCT(so_snd, struct socket, 0, vmstate_slirp_sbuf, + struct sbuf), + VMSTATE_STRUCT_POINTER(so_tcpcb, struct socket, vmstate_slirp_tcp, + struct tcpcb), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_slirp_bootp_client =3D { + .name =3D "slirp_bootpclient", + .fields =3D (VMStateField[]) { + VMSTATE_UINT16(allocated, BOOTPClient), + VMSTATE_BUFFER(macaddr, BOOTPClient), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_slirp =3D { + .name =3D "slirp", + .version_id =3D 4, + .fields =3D (VMStateField[]) { + VMSTATE_UINT16_V(ip_id, Slirp, 2), + VMSTATE_STRUCT_ARRAY(bootp_clients, Slirp, NB_BOOTP_CLIENTS, 3, + vmstate_slirp_bootp_client, BOOTPClient), + VMSTATE_END_OF_LIST() + } +}; + +static void slirp_state_save(QEMUFile *f, void *opaque) +{ + Slirp *slirp =3D opaque; + struct ex_list *ex_ptr; + + for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_next) + if (ex_ptr->ex_chardev) { + struct socket *so; + so =3D slirp_find_ctl_socket(slirp, ex_ptr->ex_addr, + ntohs(ex_ptr->ex_fport)); + if (!so) { + continue; + } + + qemu_put_byte(f, 42); + vmstate_save_state(f, &vmstate_slirp_socket, so, NULL); + } + qemu_put_byte(f, 0); + + vmstate_save_state(f, &vmstate_slirp, slirp, NULL); +} + + +static int slirp_state_load(QEMUFile *f, void *opaque, int version_id) +{ + Slirp *slirp =3D opaque; + struct ex_list *ex_ptr; + + while (qemu_get_byte(f)) { + int ret; + struct socket *so =3D socreate(slirp); + + ret =3D vmstate_load_state(f, &vmstate_slirp_socket, so, version_i= d); + if (ret < 0) { + return ret; + } + + if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=3D + slirp->vnetwork_addr.s_addr) { + return -EINVAL; + } + for (ex_ptr =3D slirp->exec_list; ex_ptr; ex_ptr =3D ex_ptr->ex_ne= xt) { + if (ex_ptr->ex_chardev && + so->so_faddr.s_addr =3D=3D ex_ptr->ex_addr.s_addr && + so->so_fport =3D=3D ex_ptr->ex_fport) { + break; + } + } + if (!ex_ptr) { + return -EINVAL; + } + } + + return vmstate_load_state(f, &vmstate_slirp, slirp, version_id); +} + +void slirp_state_register(Slirp *slirp) +{ + static SaveVMHandlers savevm_slirp_state =3D { + .save_state =3D slirp_state_save, + .load_state =3D slirp_state_load, + }; + + register_savevm_live(NULL, "slirp", 0, 4, &savevm_slirp_state, slirp); +} + +void slirp_state_unregister(Slirp *slirp) +{ + unregister_savevm(NULL, "slirp", slirp); +} diff --git a/slirp/Makefile.objs b/slirp/Makefile.objs index 28049b03cd..98a82d2615 100644 --- a/slirp/Makefile.objs +++ b/slirp/Makefile.objs @@ -2,4 +2,6 @@ common-obj-y =3D cksum.o if.o ip_icmp.o ip6_icmp.o ip6_inpu= t.o ip6_output.o \ ip_input.o ip_output.o dnssearch.o dhcpv6.o common-obj-y +=3D slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_ou= tput.o common-obj-y +=3D tcp_subr.o tcp_timer.o udp.o udp6.o bootp.o tftp.o arp_t= able.o \ - ndp_table.o ncsi.o + ndp_table.o ncsi.o state.o + +slirp.o-cflags :=3D -DWITH_STATE=3D1 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542200486969486.5794617081723; Wed, 14 Nov 2018 05:01:26 -0800 (PST) Received: from localhost ([::1]:59921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMunN-0002SD-JK for importer@patchew.org; Wed, 14 Nov 2018 08:01:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuWf-0005Gu-Pi for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuWa-0004gd-IZ for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuWa-0004fr-5y for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:04 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5691D3091D69; Wed, 14 Nov 2018 12:44:03 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C4421019632; Wed, 14 Nov 2018 12:43:52 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:42 +0400 Message-Id: <20181114123643.24091-41-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 14 Nov 2018 12:44:03 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 40/41] slirp: replace remaining QEMU dependency 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Introduce utility header/object, and replace remaining qemu functions with SLIRP helpers. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/ip.h | 14 +-- slirp/ip6.h | 5 +- slirp/ip6_icmp.h | 16 ++-- slirp/libslirp.h | 12 ++- slirp/qtailq.h | 218 ++++++++++++++++++++++++++++++++++++++++++++ slirp/slirp.h | 12 +-- slirp/util.h | 145 +++++++++++++++++++++++++++++ slirp/arp_table.c | 1 - slirp/bootp.c | 1 - slirp/cksum.c | 1 - slirp/dhcpv6.c | 2 - slirp/dnssearch.c | 1 - slirp/if.c | 2 - slirp/ip6_icmp.c | 4 - slirp/ip6_input.c | 1 - slirp/ip6_output.c | 2 - slirp/ip_icmp.c | 7 +- slirp/ip_input.c | 1 - slirp/ip_output.c | 1 - slirp/mbuf.c | 1 - slirp/misc.c | 21 ++--- slirp/ncsi.c | 1 - slirp/ndp_table.c | 2 - slirp/sbuf.c | 2 - slirp/slirp.c | 8 -- slirp/socket.c | 18 ++-- slirp/tcp_input.c | 1 - slirp/tcp_output.c | 1 - slirp/tcp_subr.c | 13 ++- slirp/tcp_timer.c | 1 - slirp/tftp.c | 7 +- slirp/udp.c | 7 +- slirp/udp6.c | 2 - slirp/util.c | 176 +++++++++++++++++++++++++++++++++++ slirp/Makefile.objs | 2 +- 35 files changed, 606 insertions(+), 103 deletions(-) create mode 100644 slirp/qtailq.h create mode 100644 slirp/util.h create mode 100644 slirp/util.c diff --git a/slirp/ip.h b/slirp/ip.h index 243b6c8b24..cd6ddf2bb7 100644 --- a/slirp/ip.h +++ b/slirp/ip.h @@ -89,7 +89,7 @@ struct ip { uint8_t ip_p; /* protocol */ uint16_t ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 #define IP_MAXPACKET 65535 /* maximum packet size */ =20 @@ -151,7 +151,7 @@ struct ip_timestamp { n_long ipt_time; } ipt_ta[1]; } ipt_timestamp; -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* flag bits for ipt_flg */ #define IPOPT_TS_TSONLY 0 /* timestamps only */ @@ -181,11 +181,11 @@ struct ip_timestamp { struct mbuf_ptr { struct mbuf *mptr; uint32_t dummy; -} QEMU_PACKED; +} SLIRP_PACKED; #else struct mbuf_ptr { struct mbuf *mptr; -} QEMU_PACKED; +} SLIRP_PACKED; #endif struct qlink { void *next, *prev; @@ -201,7 +201,7 @@ struct ipovly { uint16_t ih_len; /* protocol length */ struct in_addr ih_src; /* source internet address */ struct in_addr ih_dst; /* destination internet address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* * Ip reassembly queue structure. Each fragment @@ -217,7 +217,7 @@ struct ipq { uint8_t ipq_p; /* protocol of this fragment */ uint16_t ipq_id; /* sequence id for reassembly */ struct in_addr ipq_src,ipq_dst; -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* * Ip header, when holding a fragment. @@ -227,7 +227,7 @@ struct ipq { struct ipasfrag { struct qlink ipf_link; struct ip ipf_ip; -} QEMU_PACKED; +} SLIRP_PACKED; =20 #define ipf_off ipf_ip.ip_off #define ipf_tos ipf_ip.ip_tos diff --git a/slirp/ip6.h b/slirp/ip6.h index 14e9c78735..e0a13dec1c 100644 --- a/slirp/ip6.h +++ b/slirp/ip6.h @@ -7,7 +7,6 @@ #define SLIRP_IP6_H =20 #include -#include "net/eth.h" =20 #define ALLNODES_MULTICAST { .s6_addr =3D \ { 0xff, 0x02, 0x00, 0x00,\ @@ -133,7 +132,7 @@ struct ip6 { uint8_t ip_nh; /* next header */ uint8_t ip_hl; /* hop limit */ struct in6_addr ip_src, ip_dst; /* source and dest address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* * IPv6 pseudo-header used by upper-layer protocols @@ -145,7 +144,7 @@ struct ip6_pseudohdr { uint16_t ih_zero_hi; /* zero */ uint8_t ih_zero_lo; /* zero */ uint8_t ih_nh; /* next header */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 =20 #endif diff --git a/slirp/ip6_icmp.h b/slirp/ip6_icmp.h index 32b0914055..1f09b485e3 100644 --- a/slirp/ip6_icmp.h +++ b/slirp/ip6_icmp.h @@ -48,12 +48,12 @@ struct ndp_ra { /* Router Advertisement Message */ uint16_t lifetime; /* Router Lifetime */ uint32_t reach_time; /* Reachable Time */ uint32_t retrans_time; /* Retrans Timer */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 struct ndp_ns { /* Neighbor Solicitation Message */ uint32_t reserved; struct in6_addr target; /* Target Address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 struct ndp_na { /* Neighbor Advertisement Message */ #if G_BYTE_ORDER =3D=3D G_BIG_ENDIAN @@ -72,13 +72,13 @@ struct ndp_na { /* Neighbor Advertisement Message */ reserved_lo:24; #endif struct in6_addr target; /* Target Address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 struct ndp_redirect { uint32_t reserved; struct in6_addr target; /* Target Address */ struct in6_addr dest; /* Destination Address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* * Structure of an icmpv6 header. @@ -103,7 +103,7 @@ struct icmp6 { #define icmp6_nns icmp6_body.ndp_ns #define icmp6_nna icmp6_body.ndp_na #define icmp6_redirect icmp6_body.ndp_redirect -} QEMU_PACKED; +} SLIRP_PACKED; =20 #define ICMP6_MINLEN 4 #define ICMP6_ERROR_MINLEN 8 @@ -134,16 +134,16 @@ struct ndpopt { uint32_t pref_lt; /* Preferred Lifetime */ uint32_t reserved2; struct in6_addr prefix; - } QEMU_PACKED prefixinfo; + } SLIRP_PACKED prefixinfo; #define ndpopt_prefixinfo ndpopt_body.prefixinfo struct rdnss { uint16_t reserved; uint32_t lifetime; struct in6_addr addr; - } QEMU_PACKED rdnss; + } SLIRP_PACKED rdnss; #define ndpopt_rdnss ndpopt_body.rdnss } ndpopt_body; -} QEMU_PACKED; +} SLIRP_PACKED; =20 /* NDP options type */ #define NDPOPT_LINKLAYER_SOURCE 1 /* Source Link-Layer Address */ diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 7d04404340..419f7a7712 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -1,7 +1,17 @@ #ifndef LIBSLIRP_H #define LIBSLIRP_H =20 -#include "qemu-common.h" +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#else +#include +#include +#endif =20 typedef struct Slirp Slirp; =20 diff --git a/slirp/qtailq.h b/slirp/qtailq.h new file mode 100644 index 0000000000..7c1d73a5bd --- /dev/null +++ b/slirp/qtailq.h @@ -0,0 +1,218 @@ +/* $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */ + +/* + * slirp version: Copy from QEMU, removed all but tail queues. + */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP= OSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT= IAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STR= ICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY W= AY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef QTAILQ_H +#define QTAILQ_H + +/* + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + */ + +#define Q_TAILQ_HEAD(name, type, qual) = \ + struct name { = \ + qual type *tqh_first; /* first element */ = \ + qual type *qual *tqh_last; /* addr of last next element */ = \ + } +#define QTAILQ_HEAD(name, type) Q_TAILQ_HEAD(name, struct type, ) + +#define QTAILQ_HEAD_INITIALIZER(head) = \ + { = \ + NULL, &(head).tqh_first = \ + } + +#define Q_TAILQ_ENTRY(type, qual) = \ + struct { = \ + qual type *tqe_next; /* next element */ = \ + qual type *qual *tqe_prev; /* address of previous next element */ = \ + } +#define QTAILQ_ENTRY(type) Q_TAILQ_ENTRY(struct type, ) + +/* + * Tail queue functions. + */ +#define QTAILQ_INIT(head) = \ + do { = \ + (head)->tqh_first =3D NULL; = \ + (head)->tqh_last =3D &(head)->tqh_first; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_INSERT_HEAD(head, elm, field) = \ + do { = \ + if (((elm)->field.tqe_next =3D (head)->tqh_first) !=3D NULL) = \ + (head)->tqh_first->field.tqe_prev =3D &(elm)->field.tqe_next; = \ + else = \ + (head)->tqh_last =3D &(elm)->field.tqe_next; = \ + (head)->tqh_first =3D (elm); = \ + (elm)->field.tqe_prev =3D &(head)->tqh_first; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_INSERT_TAIL(head, elm, field) = \ + do { = \ + (elm)->field.tqe_next =3D NULL; = \ + (elm)->field.tqe_prev =3D (head)->tqh_last; = \ + *(head)->tqh_last =3D (elm); = \ + (head)->tqh_last =3D &(elm)->field.tqe_next; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_INSERT_AFTER(head, listelm, elm, field) = \ + do { = \ + if (((elm)->field.tqe_next =3D (listelm)->field.tqe_next) !=3D NUL= L) \ + (elm)->field.tqe_next->field.tqe_prev =3D &(elm)->field.tqe_ne= xt; \ + else = \ + (head)->tqh_last =3D &(elm)->field.tqe_next; = \ + (listelm)->field.tqe_next =3D (elm); = \ + (elm)->field.tqe_prev =3D &(listelm)->field.tqe_next; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_INSERT_BEFORE(listelm, elm, field) = \ + do { = \ + (elm)->field.tqe_prev =3D (listelm)->field.tqe_prev; = \ + (elm)->field.tqe_next =3D (listelm); = \ + *(listelm)->field.tqe_prev =3D (elm); = \ + (listelm)->field.tqe_prev =3D &(elm)->field.tqe_next; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_REMOVE(head, elm, field) = \ + do { = \ + if (((elm)->field.tqe_next) !=3D NULL) = \ + (elm)->field.tqe_next->field.tqe_prev =3D (elm)->field.tqe_pre= v; \ + else = \ + (head)->tqh_last =3D (elm)->field.tqe_prev; = \ + *(elm)->field.tqe_prev =3D (elm)->field.tqe_next; = \ + (elm)->field.tqe_prev =3D NULL; = \ + } while (/*CONSTCOND*/ 0) + +#define QTAILQ_FOREACH(var, head, field) = \ + for ((var) =3D ((head)->tqh_first); (var); (var) =3D ((var)->field.tqe= _next)) + +#define QTAILQ_FOREACH_SAFE(var, head, field, next_var) = \ + for ((var) =3D ((head)->tqh_first); = \ + (var) && ((next_var) =3D ((var)->field.tqe_next), 1); = \ + (var) =3D (next_var)) + +#define QTAILQ_FOREACH_REVERSE(var, head, headname, field) = \ + for ((var) =3D (*(((struct headname *)((head)->tqh_last))->tqh_last));= \ + (var); = \ + (var) =3D (*(((struct headname *)((var)->field.tqe_prev))->tqh_la= st))) + +#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) = \ + for ((var) =3D (*(((struct headname *)((head)->tqh_last))->tqh_last));= \ + (var) && = \ + ((prev_var) =3D = \ + (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)),= \ + 1); = \ + (var) =3D (prev_var)) + +/* + * Tail queue access methods. + */ +#define QTAILQ_EMPTY(head) ((head)->tqh_first =3D=3D NULL) +#define QTAILQ_FIRST(head) ((head)->tqh_first) +#define QTAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_prev !=3D NULL) + +#define QTAILQ_LAST(head, headname) = \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) +#define QTAILQ_PREV(elm, headname, field) = \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define field_at_offset(base, offset, type) = \ + ((type)(((char *)(base)) + (offset))) + +typedef struct DUMMY_Q_ENTRY DUMMY_Q_ENTRY; +typedef struct DUMMY_Q DUMMY_Q; + +struct DUMMY_Q_ENTRY { + QTAILQ_ENTRY(DUMMY_Q_ENTRY) next; +}; + +struct DUMMY_Q { + QTAILQ_HEAD(DUMMY_Q_HEAD, DUMMY_Q_ENTRY) head; +}; + +#define dummy_q ((DUMMY_Q *)0) +#define dummy_qe ((DUMMY_Q_ENTRY *)0) + +/* + * Offsets of layout of a tail queue head. + */ +#define QTAILQ_FIRST_OFFSET (offsetof(typeof(dummy_q->head), tqh_first)) +#define QTAILQ_LAST_OFFSET (offsetof(typeof(dummy_q->head), tqh_last)) +/* + * Raw access of elements of a tail queue + */ +#define QTAILQ_RAW_FIRST(head) = \ + (*field_at_offset(head, QTAILQ_FIRST_OFFSET, void **)) +#define QTAILQ_RAW_TQH_LAST(head) = \ + (*field_at_offset(head, QTAILQ_LAST_OFFSET, void ***)) + +/* + * Offsets of layout of a tail queue element. + */ +#define QTAILQ_NEXT_OFFSET (offsetof(typeof(dummy_qe->next), tqe_next)) +#define QTAILQ_PREV_OFFSET (offsetof(typeof(dummy_qe->next), tqe_prev)) + +/* + * Raw access of elements of a tail entry + */ +#define QTAILQ_RAW_NEXT(elm, entry) = \ + (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **)) +#define QTAILQ_RAW_TQE_PREV(elm, entry) = \ + (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***)) +/* + * Tail queue tranversal using pointer arithmetic. + */ +#define QTAILQ_RAW_FOREACH(elm, head, entry) = \ + for ((elm) =3D QTAILQ_RAW_FIRST(head); (elm); = \ + (elm) =3D QTAILQ_RAW_NEXT(elm, entry)) +/* + * Tail queue insertion using pointer arithmetic. + */ +#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) = \ + do { = \ + QTAILQ_RAW_NEXT(elm, entry) =3D NULL; = \ + QTAILQ_RAW_TQE_PREV(elm, entry) =3D QTAILQ_RAW_TQH_LAST(head); = \ + *QTAILQ_RAW_TQH_LAST(head) =3D (elm); = \ + QTAILQ_RAW_TQH_LAST(head) =3D &QTAILQ_RAW_NEXT(elm, entry); = \ + } while (/*CONSTCOND*/ 0) + +#endif /* QTAILQ_H */ diff --git a/slirp/slirp.h b/slirp/slirp.h index e5cd0cd334..f82d295834 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -5,8 +5,8 @@ =20 typedef char *caddr_t; =20 -# include # include +# include # include # include # include @@ -45,10 +45,8 @@ typedef char *caddr_t; #define quehead slirp_quehead =20 #include "debug.h" - -#include "qemu/queue.h" -#include "qemu/sockets.h" -#include "net/eth.h" +#include "util.h" +#include "qtailq.h" =20 #include "libslirp.h" #include "ip.h" @@ -93,7 +91,7 @@ struct slirp_arphdr { uint32_t ar_sip; /* sender IP address */ unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ uint32_t ar_tip; /* target IP address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 #define ARP_TABLE_SIZE 16 =20 @@ -110,7 +108,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, struct ndpentry { unsigned char eth_addr[ETH_ALEN]; /* sender hardware address */ struct in6_addr ip_addr; /* sender IP address */ -} QEMU_PACKED; +} SLIRP_PACKED; =20 #define NDP_TABLE_SIZE 16 =20 diff --git a/slirp/util.h b/slirp/util.h new file mode 100644 index 0000000000..d8f52c87b0 --- /dev/null +++ b/slirp/util.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2010-2016 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#ifndef UTIL_H_ +#define UTIL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#else +#include +#include +#include +#endif + +#if defined(_WIN32) +# define SLIRP_PACKED __attribute__((gcc_struct, packed)) +#else +# define SLIRP_PACKED __attribute__((packed)) +#endif + +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#endif + +#define SCALE_MS 1000000 + +#ifndef container_of +#define container_of(ptr, type, member) (__extension__({ \ + const typeof(((type *) 0)->member) *__mptr =3D (ptr); \ + (type *) ((char *) __mptr - offsetof(type, member));})) +#endif + +#ifndef glue +#define xglue(x, y) x ## y +#define glue(x, y) xglue(x, y) +#define stringify(s) tostring(s) +#define tostring(s) #s +#endif + +#if defined(_WIN32) /* CONFIG_IOVEC */ +struct iovec { + void *iov_base; + size_t iov_len; +}; +#else +#include +#endif + +#define ETH_ALEN 6 +#define ETH_HLEN 6 +#define ETH_P_IP (0x0800) /* Internet Protocol packe= t */ +#define ETH_P_ARP (0x0806) /* Address Resolution pack= et */ +#define ETH_P_IPV6 (0x86dd) +#define ETH_P_VLAN (0x8100) +#define ETH_P_DVLAN (0x88a8) +#define ETH_P_NCSI (0x88f8) +#define ETH_P_UNKNOWN (0xffff) + +#ifdef _WIN32 +int slirp_closesocket(int fd); +int slirp_ioctlsocket(int fd, int req, void *val); +int inet_aton(const char *cp, struct in_addr *ia); +#define slirp_getsockopt(sockfd, level, optname, optval, optlen) \ + getsockopt(sockfd, level, optname, (void *)optval, optlen) +#define slirp_setsockopt(sockfd, level, optname, optval, optlen) \ + setsockopt(sockfd, level, optname, (const void *)optval, optlen) +#define slirp_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len,= flags) +#else +#define slirp_setsockopt setsockopt +#define slirp_getsockopt getsockopt +#define slirp_recv recv +#define slirp_closesocket close +#define slirp_ioctlsocket ioctl +#endif + +int slirp_socket(int domain, int type, int protocol); + +static inline int socket_set_nodelay(int fd) +{ + int v =3D 1; + return slirp_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v)); +} + +static inline int socket_set_fast_reuse(int fd) +{ +#ifndef _WIN32 + int v =3D 1; + return slirp_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(v)); +#else + /* Enabling the reuse of an endpoint that was used by a socket still in + * TIME_WAIT state is usually performed by setting SO_REUSEADDR. On Wi= ndows + * fast reuse is the default and SO_REUSEADDR does strange things. So = we + * don't have to do anything here. More info can be found at: + * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.as= px */ + return 0; +#endif +} + +static inline void pstrcpy(char *buf, int buf_size, const char *str) +{ + int c; + char *q =3D buf; + + if (buf_size <=3D 0) + return; + + for(;;) { + c =3D *str++; + if (c =3D=3D 0 || q >=3D buf + buf_size - 1) + break; + *q++ =3D c; + } + *q =3D '\0'; +} + +#endif diff --git a/slirp/arp_table.c b/slirp/arp_table.c index ce19e6e7c0..d657b559d1 100644 --- a/slirp/arp_table.c +++ b/slirp/arp_table.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALE= N]) diff --git a/slirp/bootp.c b/slirp/bootp.c index 5ab6692038..083dd58984 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN * THE SOFTWARE. */ -#include "qemu/osdep.h" #include "slirp.h" =20 #if defined(_WIN32) diff --git a/slirp/cksum.c b/slirp/cksum.c index b9466485b5..2cd3589297 100644 --- a/slirp/cksum.c +++ b/slirp/cksum.c @@ -30,7 +30,6 @@ * in_cksum.c,v 1.2 1994/08/02 07:48:16 davidg Exp */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 /* diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c index 5d703e8ae6..01b5916b1e 100644 --- a/slirp/dhcpv6.c +++ b/slirp/dhcpv6.c @@ -20,8 +20,6 @@ * along with this program; if not, see . */ =20 -#include "qemu/osdep.h" -#include "qemu/log.h" #include "slirp.h" #include "dhcpv6.h" =20 diff --git a/slirp/dnssearch.c b/slirp/dnssearch.c index 8fb563321b..c459cece8d 100644 --- a/slirp/dnssearch.c +++ b/slirp/dnssearch.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 static const uint8_t RFC3397_OPT_DOMAIN_SEARCH =3D 119; diff --git a/slirp/if.c b/slirp/if.c index 1a9122a732..ec29a926f0 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -5,9 +5,7 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" -#include "qemu/timer.h" =20 static void ifs_insque(struct mbuf *ifm, struct mbuf *ifmhead) diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index d523852a1f..328926f328 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -3,12 +3,8 @@ * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip6_icmp.h" -#include "qemu/timer.h" -#include "qemu/error-report.h" -#include "qemu/log.h" =20 #define NDP_Interval g_rand_int_range(slirp->grand, \ NDP_MinRtrAdvInterval, NDP_MaxRtrAdvInterval) diff --git a/slirp/ip6_input.c b/slirp/ip6_input.c index ac2e3ea882..4aa9f2eadc 100644 --- a/slirp/ip6_input.c +++ b/slirp/ip6_input.c @@ -3,7 +3,6 @@ * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip6_icmp.h" =20 diff --git a/slirp/ip6_output.c b/slirp/ip6_output.c index 762cbfe89c..2dd80f4649 100644 --- a/slirp/ip6_output.c +++ b/slirp/ip6_output.c @@ -3,8 +3,6 @@ * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. */ =20 -#include "qemu/osdep.h" -#include "qemu-common.h" #include "slirp.h" =20 /* Number of packets queued before we start sending diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c index af11cfcefe..41cdf665ce 100644 --- a/slirp/ip_icmp.c +++ b/slirp/ip_icmp.c @@ -30,7 +30,6 @@ * ip_icmp.c,v 1.7 1995/05/30 08:09:42 rgrimes Exp */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip_icmp.h" =20 @@ -79,7 +78,7 @@ static int icmp_send(struct socket *so, struct mbuf *m, i= nt hlen) struct ip *ip =3D mtod(m, struct ip *); struct sockaddr_in addr; =20 - so->s =3D qemu_socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); + so->s =3D slirp_socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); if (so->s =3D=3D -1) { return -1; } @@ -110,7 +109,7 @@ static int icmp_send(struct socket *so, struct mbuf *m,= int hlen) =20 void icmp_detach(struct socket *so) { - closesocket(so->s); + slirp_closesocket(so->s); sofree(so); } =20 @@ -420,7 +419,7 @@ void icmp_receive(struct socket *so) icp =3D mtod(m, struct icmp *); =20 id =3D icp->icmp_id; - len =3D qemu_recv(so->s, icp, M_ROOM(m), 0); + len =3D slirp_recv(so->s, icp, M_ROOM(m), 0); /* * The behavior of reading SOCK_DGRAM+IPPROTO_ICMP sockets is inconsis= tent * between host OSes. On Linux, only the ICMP header and payload is diff --git a/slirp/ip_input.c b/slirp/ip_input.c index 6831526320..cfda30fccd 100644 --- a/slirp/ip_input.c +++ b/slirp/ip_input.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip_icmp.h" =20 diff --git a/slirp/ip_output.c b/slirp/ip_output.c index db403f04c1..f6ec141df5 100644 --- a/slirp/ip_output.c +++ b/slirp/ip_output.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 /* Number of packets queued before we start sending diff --git a/slirp/mbuf.c b/slirp/mbuf.c index d8d275e0e7..521c02c967 100644 --- a/slirp/mbuf.c +++ b/slirp/mbuf.c @@ -15,7 +15,6 @@ * the flags */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 #define MBUF_THRESH 30 diff --git a/slirp/misc.c b/slirp/misc.c index 17361b79a4..80a94194dd 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -5,11 +5,8 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "libslirp.h" -#include "qemu/error-report.h" -#include "qemu/main-loop.h" =20 #ifdef DEBUG int slirp_debug =3D DBG_CALL|DBG_MISC|DBG_ERROR; @@ -85,14 +82,14 @@ slirp_socketpair_with_oob(int sv[2]) int ret, s; =20 sv[1] =3D -1; - s =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + s =3D slirp_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; } =20 - sv[1] =3D qemu_socket(AF_INET, SOCK_STREAM, 0); + sv[1] =3D slirp_socket(AF_INET, SOCK_STREAM, 0); if (sv[1] < 0) { goto err; } @@ -115,16 +112,16 @@ slirp_socketpair_with_oob(int sv[2]) goto err; } =20 - closesocket(s); + slirp_closesocket(s); return 0; =20 err: g_critical("slirp_socketpair(): %s", strerror(errno)); if (s >=3D 0) { - closesocket(s); + slirp_closesocket(s); } if (sv[1] >=3D 0) { - closesocket(sv[1]); + slirp_closesocket(sv[1]); } return -1; } @@ -164,16 +161,16 @@ fork_exec(struct socket *so, const char *ex) if (err) { g_critical("fork_exec: %s", err->message); g_error_free(err); - closesocket(sp[0]); - closesocket(sp[1]); + slirp_closesocket(sp[0]); + slirp_closesocket(sp[1]); return 0; } =20 so->s =3D sp[0]; - closesocket(sp[1]); + slirp_closesocket(sp[1]); socket_set_fast_reuse(so->s); opt =3D 1; - qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + slirp_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); so->slirp->cb->set_nonblock(so->s); return 1; } diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 8594382270..327f17543c 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -6,7 +6,6 @@ * This code is licensed under the GPL version 2 or later. See the * COPYING file in the top-level directory. */ -#include "qemu/osdep.h" #include "slirp.h" =20 #include "ncsi-pkt.h" diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index a4e6421fd3..2dbc3805a5 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -3,8 +3,6 @@ * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. */ =20 -#include "qemu/osdep.h" -#include "qemu-common.h" #include "slirp.h" =20 void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, diff --git a/slirp/sbuf.c b/slirp/sbuf.c index 17f28e97a6..51a9f0cc7d 100644 --- a/slirp/sbuf.c +++ b/slirp/sbuf.c @@ -5,9 +5,7 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" -#include "qemu/main-loop.h" =20 static void sbappendsb(struct sbuf *sb, struct mbuf *m); =20 diff --git a/slirp/slirp.c b/slirp/slirp.c index 8b56f28d77..15386e5245 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -21,15 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN * THE SOFTWARE. */ -#include "qemu/osdep.h" -#include "qemu-common.h" -#include "qemu/timer.h" -#include "qemu/error-report.h" -#include "chardev/char-fe.h" -#include "migration/register.h" #include "slirp.h" -#include "hw/hw.h" -#include "qemu/cutils.h" =20 #ifdef WITH_STATE #include "state.h" diff --git a/slirp/socket.c b/slirp/socket.c index 2b1b5052c4..c3860ba067 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -5,8 +5,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" -#include "qemu-common.h" #include "slirp.h" #include "ip_icmp.h" #ifdef __sun__ @@ -187,7 +185,7 @@ soread(struct socket *so) */ sopreprbuf(so, iov, &n); =20 - nn =3D qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0); + nn =3D slirp_recv(so->s, iov[0].iov_base, iov[0].iov_len,0); if (nn <=3D 0) { if (nn < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)) return 0; @@ -203,7 +201,7 @@ soread(struct socket *so) if (getpeername(so->s, paddr, &alen) < 0) { err =3D errno; } else { - getsockopt(so->s, SOL_SOCKET, SO_ERROR, + slirp_getsockopt(so->s, SOL_SOCKET, SO_ERROR, &err, &elen); } } @@ -232,7 +230,7 @@ soread(struct socket *so) */ if (n =3D=3D 2 && nn =3D=3D iov[0].iov_len) { int ret; - ret =3D qemu_recv(so->s, iov[1].iov_base, iov[1].iov_len,0); + ret =3D slirp_recv(so->s, iov[1].iov_base, iov[1].iov_len,0); if (ret > 0) nn +=3D ret; } @@ -553,7 +551,7 @@ sorecvfrom(struct socket *so) */ len =3D M_FREEROOM(m); /* if (so->so_fport !=3D htons(53)) { */ - ioctlsocket(so->s, FIONREAD, &n); + slirp_ioctlsocket(so->s, FIONREAD, &n); =20 if (n > len) { n =3D (m->m_data - m->m_dat) + m->m_len + n + 1; @@ -718,14 +716,14 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport,= uint32_t laddr, addr.sin_addr.s_addr =3D haddr; addr.sin_port =3D hport; =20 - if (((s =3D qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) || + if (((s =3D slirp_socket(AF_INET,SOCK_STREAM,0)) < 0) || (socket_set_fast_reuse(s) < 0) || (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) || (listen(s,1) < 0)) { int tmperrno =3D errno; /* Don't clobber the real reason we failed */ =20 if (s >=3D 0) { - closesocket(s); + slirp_closesocket(s); } sofree(so); /* Restore the real errno */ @@ -736,9 +734,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, u= int32_t laddr, #endif return NULL; } - qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); opt =3D 1; - qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int)); + slirp_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int)); =20 getsockname(s,(struct sockaddr *)&addr,&addrlen); so->so_ffamily =3D AF_INET; diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index 0d34abf8d7..c9cbec205e 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip_icmp.h" =20 diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 44da8a4e47..a1547c0b23 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 static const u_char tcp_outflags[TCP_NSTATES] =3D { diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index 98bceea9f6..d8dd7d57a6 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 /* patchable/settable parameters for tcp */ @@ -337,7 +336,7 @@ tcp_close(struct tcpcb *tp) /* clobber input socket cache if we're closing the cached connection */ if (so =3D=3D slirp->tcp_last_so) slirp->tcp_last_so =3D &slirp->tcb; - closesocket(so->s); + slirp_closesocket(so->s); sbfree(&so->so_rcv); sbfree(&so->so_snd); sofree(so); @@ -407,7 +406,7 @@ int tcp_fconnect(struct socket *so, unsigned short af) DEBUG_CALL("tcp_fconnect"); DEBUG_ARG("so =3D %p", so); =20 - ret =3D so->s =3D qemu_socket(af, SOCK_STREAM, 0); + ret =3D so->s =3D slirp_socket(af, SOCK_STREAM, 0); if (ret >=3D 0) { int opt, s=3Dso->s; struct sockaddr_storage addr; @@ -415,9 +414,9 @@ int tcp_fconnect(struct socket *so, unsigned short af) so->slirp->cb->set_nonblock(s); socket_set_fast_reuse(s); opt =3D 1; - qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt)); + slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt)); opt =3D 1; - qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); + slirp_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); =20 addr =3D so->fhost.ss; DEBUG_CALL(" connect()ing"); @@ -487,7 +486,7 @@ void tcp_connect(struct socket *inso) so->slirp->cb->set_nonblock(s); socket_set_fast_reuse(s); opt =3D 1; - qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); socket_set_nodelay(s); =20 so->fhost.ss =3D addr; @@ -496,7 +495,7 @@ void tcp_connect(struct socket *inso) /* Close the accept() socket, set right state */ if (inso->so_state & SS_FACCEPTONCE) { /* If we only accept once, close the accept() socket */ - closesocket(so->s); + slirp_closesocket(so->s); =20 /* Don't select it yet, even though we have an FD */ /* if it's not FACCEPTONCE, it's already NOFDREF */ diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c index d953a16386..ebc9d16f06 100644 --- a/slirp/tcp_timer.c +++ b/slirp/tcp_timer.c @@ -30,7 +30,6 @@ * tcp_timer.c,v 1.2 1994/08/02 07:49:10 davidg Exp */ =20 -#include "qemu/osdep.h" #include "slirp.h" =20 static struct tcpcb *tcp_timers(register struct tcpcb *tp, int timer); diff --git a/slirp/tftp.c b/slirp/tftp.c index ef8d0352b4..a78d06d2a4 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -22,10 +22,11 @@ * THE SOFTWARE. */ =20 -#include "qemu/osdep.h" #include "slirp.h" -#include "qemu-common.h" -#include "qemu/cutils.h" + +#include +#include +#include =20 static inline int tftp_session_in_use(struct tftp_session *spt) { diff --git a/slirp/udp.c b/slirp/udp.c index a45ad81dda..1de3775add 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -38,7 +38,6 @@ * terms and conditions of the copyright. */ =20 -#include "qemu/osdep.h" #include "slirp.h" #include "ip_icmp.h" =20 @@ -282,7 +281,7 @@ int udp_output(struct socket *so, struct mbuf *m, int udp_attach(struct socket *so, unsigned short af) { - so->s =3D qemu_socket(af, SOCK_DGRAM, 0); + so->s =3D slirp_socket(af, SOCK_DGRAM, 0); if (so->s !=3D -1) { so->so_expire =3D curtime + SO_EXPIRE; insque(so, &so->slirp->udb); @@ -293,7 +292,7 @@ udp_attach(struct socket *so, unsigned short af) void udp_detach(struct socket *so) { - closesocket(so->s); + slirp_closesocket(so->s); sofree(so); } =20 @@ -328,7 +327,7 @@ udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, u= int32_t laddr, socklen_t addrlen =3D sizeof(struct sockaddr_in); =20 so =3D socreate(slirp); - so->s =3D qemu_socket(AF_INET,SOCK_DGRAM,0); + so->s =3D slirp_socket(AF_INET,SOCK_DGRAM,0); if (so->s < 0) { sofree(so); return NULL; diff --git a/slirp/udp6.c b/slirp/udp6.c index 473ba1586e..d14329f05f 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -3,8 +3,6 @@ * Guillaume Subiron */ =20 -#include "qemu/osdep.h" -#include "qemu-common.h" #include "slirp.h" #include "udp.h" #include "dhcpv6.h" diff --git a/slirp/util.c b/slirp/util.c new file mode 100644 index 0000000000..6fc6fea197 --- /dev/null +++ b/slirp/util.c @@ -0,0 +1,176 @@ +/* + * util.c (mostly based on QEMU os-win32.c) + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2010-2016 Red Hat, Inc. + * + * QEMU library functions for win32 which are shared between QEMU and + * the QEMU tools. + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#include "util.h" + +#include +#include +#include + +#ifdef _WIN32 +int inet_aton(const char *cp, struct in_addr *ia) +{ + uint32_t addr =3D inet_addr(cp); + if (addr =3D=3D 0xffffffff) { + return 0; + } + ia->s_addr =3D addr; + return 1; +} +#endif + +static void slirp_set_cloexec(int fd) +{ +#ifndef _WIN32 + int f; + f =3D fcntl(fd, F_GETFD); + assert(f !=3D -1); + f =3D fcntl(fd, F_SETFD, f | FD_CLOEXEC); + assert(f !=3D -1); +#endif +} + +/* + * Opens a socket with FD_CLOEXEC set + */ +int slirp_socket(int domain, int type, int protocol) +{ + int ret; + +#ifdef SOCK_CLOEXEC + ret =3D socket(domain, type | SOCK_CLOEXEC, protocol); + if (ret !=3D -1 || errno !=3D EINVAL) { + return ret; + } +#endif + ret =3D socket(domain, type, protocol); + if (ret >=3D 0) { + slirp_set_cloexec(ret); + } + + return ret; +} + +#ifdef _WIN32 +static int socket_error(void) +{ + switch (WSAGetLastError()) { + case 0: + return 0; + case WSAEINTR: + return EINTR; + case WSAEINVAL: + return EINVAL; + case WSA_INVALID_HANDLE: + return EBADF; + case WSA_NOT_ENOUGH_MEMORY: + return ENOMEM; + case WSA_INVALID_PARAMETER: + return EINVAL; + case WSAENAMETOOLONG: + return ENAMETOOLONG; + case WSAENOTEMPTY: + return ENOTEMPTY; + case WSAEWOULDBLOCK: + /* not using EWOULDBLOCK as we don't want code to have + * to check both EWOULDBLOCK and EAGAIN */ + return EAGAIN; + case WSAEINPROGRESS: + return EINPROGRESS; + case WSAEALREADY: + return EALREADY; + case WSAENOTSOCK: + return ENOTSOCK; + case WSAEDESTADDRREQ: + return EDESTADDRREQ; + case WSAEMSGSIZE: + return EMSGSIZE; + case WSAEPROTOTYPE: + return EPROTOTYPE; + case WSAENOPROTOOPT: + return ENOPROTOOPT; + case WSAEPROTONOSUPPORT: + return EPROTONOSUPPORT; + case WSAEOPNOTSUPP: + return EOPNOTSUPP; + case WSAEAFNOSUPPORT: + return EAFNOSUPPORT; + case WSAEADDRINUSE: + return EADDRINUSE; + case WSAEADDRNOTAVAIL: + return EADDRNOTAVAIL; + case WSAENETDOWN: + return ENETDOWN; + case WSAENETUNREACH: + return ENETUNREACH; + case WSAENETRESET: + return ENETRESET; + case WSAECONNABORTED: + return ECONNABORTED; + case WSAECONNRESET: + return ECONNRESET; + case WSAENOBUFS: + return ENOBUFS; + case WSAEISCONN: + return EISCONN; + case WSAENOTCONN: + return ENOTCONN; + case WSAETIMEDOUT: + return ETIMEDOUT; + case WSAECONNREFUSED: + return ECONNREFUSED; + case WSAELOOP: + return ELOOP; + case WSAEHOSTUNREACH: + return EHOSTUNREACH; + default: + return EIO; + } +} + +#undef ioctlsocket +int slirp_ioctlsocket(int fd, int req, void *val) +{ + int ret; + ret =3D ioctlsocket(fd, req, val); + if (ret < 0) { + errno =3D socket_error(); + } + return ret; +} + +#undef closesocket +int slirp_closesocket(int fd) +{ + int ret; + ret =3D closesocket(fd); + if (ret < 0) { + errno =3D socket_error(); + } + return ret; +} +#endif /* WIN32 */ diff --git a/slirp/Makefile.objs b/slirp/Makefile.objs index 98a82d2615..446a33b879 100644 --- a/slirp/Makefile.objs +++ b/slirp/Makefile.objs @@ -2,6 +2,6 @@ common-obj-y =3D cksum.o if.o ip_icmp.o ip6_icmp.o ip6_inpu= t.o ip6_output.o \ ip_input.o ip_output.o dnssearch.o dhcpv6.o common-obj-y +=3D slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_ou= tput.o common-obj-y +=3D tcp_subr.o tcp_timer.o udp.o udp6.o bootp.o tftp.o arp_t= able.o \ - ndp_table.o ncsi.o state.o + ndp_table.o ncsi.o state.o util.o =20 slirp.o-cflags :=3D -DWITH_STATE=3D1 --=20 2.19.1.708.g4ede3d42df From nobody Thu Nov 6 14:25:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542201052754689.8900027215624; Wed, 14 Nov 2018 05:10:52 -0800 (PST) Received: from localhost ([::1]:60043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuwS-0001Rb-Hs for importer@patchew.org; Wed, 14 Nov 2018 08:10:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMuWf-0005Gv-Q3 for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMuWe-0004j9-Tb for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMuWe-0004ip-OL for qemu-devel@nongnu.org; Wed, 14 Nov 2018 07:44:08 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1ADF63002E31; Wed, 14 Nov 2018 12:44:08 +0000 (UTC) Received: from localhost (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 212111019632; Wed, 14 Nov 2018 12:44:06 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 14 Nov 2018 16:36:43 +0400 Message-Id: <20181114123643.24091-42-marcandre.lureau@redhat.com> In-Reply-To: <20181114123643.24091-1-marcandre.lureau@redhat.com> References: <20181114123643.24091-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 14 Nov 2018 12:44:08 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 41/41] build-sys: add a basic meson build 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@ens-lyon.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , rjones@redhat.com, stefanha@redhat.com, renzo@cs.unibo.it Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is a minimal file to build a libslirp shared library. It has been tested to build on Linux and with mingw64 cross-compilation. Signed-off-by: Marc-Andr=C3=A9 Lureau --- slirp/meson.build | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 slirp/meson.build diff --git a/slirp/meson.build b/slirp/meson.build new file mode 100644 index 0000000000..aa6f1b39e2 --- /dev/null +++ b/slirp/meson.build @@ -0,0 +1,48 @@ +project('slirp', 'c', version : '3.1') + +add_global_arguments('-std=3Dgnu99', language : 'c') + +host_system =3D host_machine.system() + +glib_dep =3D dependency('glib-2.0') + +cc =3D meson.get_compiler('c') + +platform_deps =3D [] + +if host_system =3D=3D 'windows' + platform_deps +=3D [ + cc.find_library('ws2_32'), + cc.find_library('iphlpapi') + ] +endif + +shared_library('slirp', + 'arp_table.c', + 'bootp.c', + 'cksum.c', + 'dhcpv6.c', + 'dnssearch.c', + 'if.c', + 'ip6_icmp.c', + 'ip6_input.c', + 'ip6_output.c', + 'ip_icmp.c', + 'ip_input.c', + 'ip_output.c', + 'mbuf.c', + 'misc.c', + 'ncsi.c', + 'ndp_table.c', + 'sbuf.c', + 'slirp.c', + 'socket.c', + 'tcp_input.c', + 'tcp_output.c', + 'tcp_subr.c', + 'tcp_timer.c', + 'tftp.c', + 'udp.c', + 'udp6.c', + 'util.c', + dependencies : [glib_dep, platform_deps]) --=20 2.19.1.708.g4ede3d42df