From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794870143522.0100055209916; Thu, 31 May 2018 12:27:50 -0700 (PDT) Received: from localhost ([::1]:45799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTEj-0007dk-81 for importer@patchew.org; Thu, 31 May 2018 15:27:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9u-00043Q-5X for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9s-0008SS-Nu for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:50 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9s-0008Rk-Dn for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:48 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7A9BD940; Thu, 31 May 2018 21:22:47 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zUZ6Ghyyg3YB; Thu, 31 May 2018 21:22:45 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id EBB5B95A; Thu, 31 May 2018 21:22:40 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013J-9x; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:29 +0200 Message-Id: <20180531192237.3994-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 1/9] slirp: Add domainname option to slirp's DHCP server X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, Benjamin Drung , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Benjamin Drung This patch will allow the user to include the domainname option in replies from the built-in DHCP server. Signed-off-by: Benjamin Drung Signed-off-by: Samuel Thibault --- net/slirp.c | 12 +++++++++--- qapi/net.json | 4 ++++ qemu-options.hx | 7 +++++-- slirp/bootp.c | 8 ++++++++ slirp/libslirp.h | 2 +- slirp/slirp.c | 4 +++- slirp/slirp.h | 1 + 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/net/slirp.c b/net/slirp.c index 692252445a..005c2675e6 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -157,7 +157,8 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, const char *bootfile, const char *vdhcp_start, const char *vnameserver, const char *vnameserver= 6, const char *smb_export, const char *vsmbserver, - const char **dnssearch, Error **errp) + const char **dnssearch, const char *vdomainname, + Error **errp) { /* default settings according to historic slirp */ struct in_addr net =3D { .s_addr =3D htonl(0x0a000200) }; /* 10.0.2.0= */ @@ -359,6 +360,11 @@ static int net_slirp_init(NetClientState *peer, const = char *model, ip6_dns.s6_addr[15] |=3D 3; } =20 + if (vdomainname && !*vdomainname) { + error_setg(errp, "'domainname' parameter cannot be empty"); + return -1; + } + =20 nc =3D qemu_new_net_client(&net_slirp_info, peer, model, name); =20 @@ -371,7 +377,7 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, s->slirp =3D slirp_init(restricted, ipv4, net, mask, host, ipv6, ip6_prefix, vprefix6_len, ip6_host, vhostname, tftp_export, bootfile, dhcp, - dns, ip6_dns, dnssearch, s); + dns, ip6_dns, dnssearch, vdomainname, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); =20 for (config =3D slirp_configs; config; config =3D config->next) { @@ -958,7 +964,7 @@ int net_init_slirp(const Netdev *netdev, const char *na= me, user->ipv6_host, user->hostname, user->tftp, user->bootfile, user->dhcpstart, user->dns, user->ipv6_dns, user->smb, - user->smbserver, dnssearch, errp); + user->smbserver, dnssearch, user->domainname, err= p); =20 while (slirp_configs) { config =3D slirp_configs; diff --git a/qapi/net.json b/qapi/net.json index 5c1dc48890..32681a1af7 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -160,6 +160,9 @@ # @dnssearch: list of DNS suffixes to search, passed as DHCP option # to the guest # +# @domainname: guest-visible domain name of the virtual nameserver +# (since 2.12) +# # @ipv6-prefix: IPv6 network prefix (default is fec0::) (since # 2.6). The network prefix is given in the usual # hexadecimal IPv6 address notation. @@ -197,6 +200,7 @@ '*dhcpstart': 'str', '*dns': 'str', '*dnssearch': ['String'], + '*domainname': 'str', '*ipv6-prefix': 'str', '*ipv6-prefixlen': 'int', '*ipv6-host': 'str', diff --git a/qemu-options.hx b/qemu-options.hx index 2f61ea42ee..c0d3951e9f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1906,8 +1906,8 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev user,id=3Dstr[,ipv4[=3Don|off]][,net=3Daddr[/mask]][,host=3Da= ddr]\n" " [,ipv6[=3Don|off]][,ipv6-net=3Daddr[/int]][,ipv6-host=3Daddr= ]\n" " [,restrict=3Don|off][,hostname=3Dhost][,dhcpstart=3Daddr]\n" - " [,dns=3Daddr][,ipv6-dns=3Daddr][,dnssearch=3Ddomain][,tftp= =3Ddir]\n" - " [,bootfile=3Df][,hostfwd=3Drule][,guestfwd=3Drule]" + " [,dns=3Daddr][,ipv6-dns=3Daddr][,dnssearch=3Ddomain][,domain= name=3Ddomain]\n" + " [,tftp=3Ddir][,bootfile=3Df][,hostfwd=3Drule][,guestfwd=3Dru= le]" #ifndef _WIN32 "[,smb=3Ddir[,smbserver=3Dadd= r]]\n" #endif @@ -2135,6 +2135,9 @@ Example: qemu-system-i386 -nic user,dnssearch=3Dmgmt.example.org,dnssearch=3Dexampl= e.org @end example =20 +@item domainname=3D@var{domain} +Specifies the client domain name reported by the built-in DHCP server. + @item tftp=3D@var{dir} When using the user mode network stack, activate a built-in TFTP server. The files in @var{dir} will be exposed as the root of a TFTP serve= r. diff --git a/slirp/bootp.c b/slirp/bootp.c index 5dd1a415b5..9e7b53ba94 100644 --- a/slirp/bootp.c +++ b/slirp/bootp.c @@ -298,6 +298,14 @@ static void bootp_reply(Slirp *slirp, const struct boo= tp_t *bp) q +=3D val; } =20 + if (slirp->vdomainname) { + val =3D strlen(slirp->vdomainname); + *q++ =3D RFC1533_DOMAINNAME; + *q++ =3D val; + memcpy(q, slirp->vdomainname, val); + q +=3D val; + } + if (slirp->vdnssearch) { size_t spaceleft =3D sizeof(rbp->bp_vend) - (q - rbp->bp_vend); val =3D slirp->vdnssearch_len; diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 540b3e5903..740408a96e 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -16,7 +16,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct= in_addr vnetwork, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, - void *opaque); + const char *vdomainname, void *opaque); void slirp_cleanup(Slirp *slirp); =20 void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); diff --git a/slirp/slirp.c b/slirp/slirp.c index 1cb6b07004..4f29753444 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -286,7 +286,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, stru= ct in_addr vnetwork, const char *tftp_path, const char *bootfile, struct in_addr vdhcp_start, struct in_addr vnameserver, struct in6_addr vnameserver6, const char **vdnssearch, - void *opaque) + const char *vdomainname, void *opaque) { Slirp *slirp =3D g_malloc0(sizeof(Slirp)); =20 @@ -317,6 +317,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, stru= ct in_addr vnetwork, } slirp->tftp_prefix =3D g_strdup(tftp_path); slirp->bootp_filename =3D g_strdup(bootfile); + slirp->vdomainname =3D g_strdup(vdomainname); slirp->vdhcp_startaddr =3D vdhcp_start; slirp->vnameserver_addr =3D vnameserver; slirp->vnameserver_addr6 =3D vnameserver6; @@ -349,6 +350,7 @@ void slirp_cleanup(Slirp *slirp) g_free(slirp->vdnssearch); g_free(slirp->tftp_prefix); g_free(slirp->bootp_filename); + g_free(slirp->vdomainname); g_free(slirp); } =20 diff --git a/slirp/slirp.h b/slirp/slirp.h index 06febfc78b..10b410898a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -193,6 +193,7 @@ struct Slirp { char *bootp_filename; size_t vdnssearch_len; uint8_t *vdnssearch; + char *vdomainname; =20 /* tcp states */ struct socket tcb; --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794871047912.319468725868; Thu, 31 May 2018 12:27:51 -0700 (PDT) Received: from localhost ([::1]:45800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTEk-0007es-7J for importer@patchew.org; Thu, 31 May 2018 15:27:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9v-00044f-4q for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9u-0008Tc-4P for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:51 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55112) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9t-0008Sg-UT for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:50 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C1CFD9A3; Thu, 31 May 2018 21:22:48 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wjua3pvgU0fX; Thu, 31 May 2018 21:22:46 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 2A567944; Thu, 31 May 2018 21:22:39 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013L-BH; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:30 +0200 Message-Id: <20180531192237.3994-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 2/9] slirp: disable Nagle in outgoing connections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, Samuel Thibault , stefanha@redhat.com, Andreas Gustafsson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Andreas Gustafsson When setting up an outgoing user mode networking TCP connection, disable the Nagle algorithm in the host-side connection. Either the guest is already doing Nagle, in which case there is no point in doing it twice, or it has chosen to disable it, in which case we should respect that choice. This change speeds up GDB remote debugging over TCP over user mode networking (with GDB runing on the guest) by multiple orders of magnitude, and has been part of the local patches applied by pkgsrc since 2012 with no reported ill effects. Signed-off-by: Andreas Gustafsson Reviewed-by: Kamil Rytarowski Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Samuel Thibault --- slirp/tcp_subr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c index da0d53743f..8d0f94b75f 100644 --- a/slirp/tcp_subr.c +++ b/slirp/tcp_subr.c @@ -416,6 +416,8 @@ int tcp_fconnect(struct socket *so, unsigned short af) socket_set_fast_reuse(s); opt =3D 1; qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt)); + opt =3D 1; + qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)); =20 addr =3D so->fhost.ss; DEBUG_CALL(" connect()ing") --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527795077032694.9677791687192; Thu, 31 May 2018 12:31:17 -0700 (PDT) Received: from localhost ([::1]:45818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTI4-000288-8O for importer@patchew.org; Thu, 31 May 2018 15:31:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9z-00047Q-4C for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9w-0008VW-7n for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:55 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:50372) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9w-0008Uo-1s for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:52 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 12A7F944; Thu, 31 May 2018 21:22:51 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i5xDYHV7i4ln; Thu, 31 May 2018 21:22:48 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6D390977; Thu, 31 May 2018 21:22:41 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013N-CY; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:31 +0200 Message-Id: <20180531192237.3994-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 3/9] slirp: disable Nagle in ingoing connections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This follows 3929766fb3e4 ('slirp: disable Nagle in outgoing connections'): for the same reasons, ingoing connections should have the Nagle algorithm d= isabled. Signed-off-by: Samuel Thibault Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/socket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slirp/socket.c b/slirp/socket.c index 61347d1a0c..6f18e157a5 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -754,6 +754,8 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, u= int32_t laddr, return NULL; } qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int)); + opt =3D 1; + qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int)); =20 getsockname(s,(struct sockaddr *)&addr,&addrlen); so->so_ffamily =3D AF_INET; --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794698374152.54862882383543; Thu, 31 May 2018 12:24:58 -0700 (PDT) Received: from localhost ([::1]:45782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTBu-0005DI-AM for importer@patchew.org; Thu, 31 May 2018 15:24:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9s-00042B-2H for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9r-0008RM-4S for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:48 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55080) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9q-0008Qe-Tx for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:47 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id EC53699D; Thu, 31 May 2018 21:22:45 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ser_wUD-FGWN; Thu, 31 May 2018 21:22:43 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0AD7C95B; Thu, 31 May 2018 21:22:40 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013P-Dl; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:32 +0200 Message-Id: <20180531192237.3994-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 4/9] slirp/debug: Print IP addresses in human readable form X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , jan.kiszka@siemens.com, stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy Signed-off-by: Alexey Kardashevskiy Signed-off-by: Samuel Thibault --- slirp/arp_table.c | 4 ++-- slirp/socket.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slirp/arp_table.c b/slirp/arp_table.c index bac608f97f..f81963bb88 100644 --- a/slirp/arp_table.c +++ b/slirp/arp_table.c @@ -33,7 +33,7 @@ void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_= t ethaddr[ETH_ALEN]) int i; =20 DEBUG_CALL("arp_table_add"); - DEBUG_ARG("ip =3D %s", inet_ntoa(*(struct in_addr *)&ip_addr)); + DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); DEBUG_ARGS((dfd, " hw addr =3D %02x:%02x:%02x:%02x:%02x:%02x\n", ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5])); @@ -67,7 +67,7 @@ bool arp_table_search(Slirp *slirp, uint32_t ip_addr, int i; =20 DEBUG_CALL("arp_table_search"); - DEBUG_ARG("ip =3D %s", inet_ntoa(*(struct in_addr *)&ip_addr)); + DEBUG_ARG("ip =3D %s", inet_ntoa((struct in_addr){.s_addr =3D ip_addr}= )); =20 /* If broadcast address */ if (ip_addr =3D=3D 0xffffffff || ip_addr =3D=3D broadcast_addr) { diff --git a/slirp/socket.c b/slirp/socket.c index 6f18e157a5..e2a71c9b04 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -701,9 +701,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, u= int32_t laddr, memset(&addr, 0, addrlen); =20 DEBUG_CALL("tcp_listen"); - DEBUG_ARG("haddr =3D %s", inet_ntoa(*(struct in_addr *)&haddr)); + DEBUG_ARG("haddr =3D %s", inet_ntoa((struct in_addr){.s_addr =3D haddr})); DEBUG_ARG("hport =3D %d", ntohs(hport)); - DEBUG_ARG("laddr =3D %s", inet_ntoa(*(struct in_addr *)&laddr)); + DEBUG_ARG("laddr =3D %s", inet_ntoa((struct in_addr){.s_addr =3D laddr})); DEBUG_ARG("lport =3D %d", ntohs(lport)); DEBUG_ARG("flags =3D %x", flags); =20 --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794698545297.44800450696073; Thu, 31 May 2018 12:24:58 -0700 (PDT) Received: from localhost ([::1]:45780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTBp-0005AE-AT for importer@patchew.org; Thu, 31 May 2018 15:24:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9q-00041k-GH for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9n-0008Om-CC for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:46 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55030) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9n-0008Nm-5Y for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:43 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8541B95F; Thu, 31 May 2018 21:22:41 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G9KbXbQrZybH; Thu, 31 May 2018 21:22:39 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id CF631786; Thu, 31 May 2018 21:22:39 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013R-F9; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:33 +0200 Message-Id: <20180531192237.3994-6-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 5/9] net/slirp: Convert atoi to qemu_strtoi to allow error checking 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: Nia Alarie , Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nia Alarie Signed-off-by: Nia Alarie Signed-off-by: Samuel Thibault --- net/slirp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index 005c2675e6..1e14318b4d 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -492,7 +492,9 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdic= t) goto fail_syntax; } =20 - host_port =3D atoi(p); + if (qemu_strtoi(p, NULL, 10, &host_port)) { + goto fail_syntax; + } =20 err =3D slirp_remove_hostfwd(s->slirp, is_udp, host_addr, host_port); =20 --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794701268749.1549348674587; Thu, 31 May 2018 12:25:01 -0700 (PDT) Received: from localhost ([::1]:45781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTBq-0005Ax-UL for importer@patchew.org; Thu, 31 May 2018 15:24:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9r-00041z-Ou for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9q-0008R6-Ot for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:47 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:55070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9q-0008QM-IN for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:46 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8DD6C99A; Thu, 31 May 2018 21:22:45 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yFzBLrEb7aZq; Thu, 31 May 2018 21:22:42 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id CB861945; Thu, 31 May 2018 21:22:40 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013T-Gc; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:34 +0200 Message-Id: <20180531192237.3994-7-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 6/9] slirp: Send window updates to guest after window was closed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, James Clarke , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: James Clarke If the receive window presented to the guest closes, slirp should send a window update once the window reopens sufficiently, rather than forcing the guest to send a window probe, which can take several seconds. Signed-off-by: James Clarke Signed-off-by: Samuel Thibault --- slirp/slirp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/slirp/slirp.c b/slirp/slirp.c index 4f29753444..5c3bd6163f 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -678,13 +678,13 @@ void slirp_pollfds_poll(GArray *pollfds, int select_e= rror) /* continue; */ } else { ret =3D sowrite(so); + if (ret > 0) { + /* Call tcp_output in case we need to send a w= indow + * update to the guest, otherwise it will be s= tuck + * until it sends a window probe. */ + tcp_output(sototcpcb(so)); + } } - /* - * XXXXX If we wrote something (a lot), there - * could be a need for a window update. - * In the worst case, the remote will send - * a window probe to get things going again - */ } =20 /* --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794865404868.2846039487353; Thu, 31 May 2018 12:27:45 -0700 (PDT) Received: from localhost ([::1]:45798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTEe-0007aI-HS for importer@patchew.org; Thu, 31 May 2018 15:27:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9q-00041i-G0 for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9o-0008Pm-Lq for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:46 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:50288) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9o-0008Oy-F7 for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:44 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 791F4931; Thu, 31 May 2018 21:22:43 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HPFEZAYGOmWQ; Thu, 31 May 2018 21:22:41 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 167CB93E; Thu, 31 May 2018 21:22:39 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013V-IA; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:35 +0200 Message-Id: <20180531192237.3994-8-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 7/9] slirp/ncsi: fix "Get Version ID" payload length X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Joel Stanley Signed-off-by: Samuel Thibault --- slirp/ncsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index d12ba3e494..02d0e9def3 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -60,7 +60,7 @@ static const struct ncsi_rsp_handler { { NCSI_PKT_RSP_EGMF, 4, NULL }, { NCSI_PKT_RSP_DGMF, 4, NULL }, { NCSI_PKT_RSP_SNFC, 4, NULL }, - { NCSI_PKT_RSP_GVI, 36, NULL }, + { NCSI_PKT_RSP_GVI, 40, NULL }, { NCSI_PKT_RSP_GC, 32, ncsi_rsp_handler_gc }, { NCSI_PKT_RSP_GP, -1, NULL }, { NCSI_PKT_RSP_GCPS, 172, NULL }, --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527794698546525.9232252953072; Thu, 31 May 2018 12:24:58 -0700 (PDT) Received: from localhost ([::1]:45779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTBq-0005AA-He for importer@patchew.org; Thu, 31 May 2018 15:24:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9q-00041j-G0 for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9n-0008P5-RD for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:46 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:50272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9n-0008OE-KL for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:43 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 57EAA786; Thu, 31 May 2018 21:22:42 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 49alENubLVIq; Thu, 31 May 2018 21:22:40 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 02ECF931; Thu, 31 May 2018 21:22:39 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013X-JW; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:36 +0200 Message-Id: <20180531192237.3994-9-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 8/9] slirp/ncsi: add a "Get Parameters" response X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater Command 0x17 'Get Parameters' is used to get configuration parameter values currently in effect on the controller and it is mandatory in the NS-CI specification. Provide a minimum response to exercise the kernel. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Joel Stanley Signed-off-by: Samuel Thibault --- slirp/ncsi.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 02d0e9def3..7b3fff207a 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -35,6 +35,20 @@ static int ncsi_rsp_handler_gls(struct ncsi_rsp_pkt_hdr = *rnh) return 0; } =20 +/* Get Parameters */ +static int ncsi_rsp_handler_gp(struct ncsi_rsp_pkt_hdr *rnh) +{ + struct ncsi_rsp_gp_pkt *rsp =3D (struct ncsi_rsp_gp_pkt *) rnh; + + /* no MAC address filters or VLAN filters on the channel */ + rsp->mac_cnt =3D 0; + rsp->mac_enable =3D 0; + rsp->vlan_cnt =3D 0; + rsp->vlan_enable =3D 0; + + return 0; +} + static const struct ncsi_rsp_handler { unsigned char type; int payload; @@ -62,7 +76,7 @@ static const struct ncsi_rsp_handler { { NCSI_PKT_RSP_SNFC, 4, NULL }, { NCSI_PKT_RSP_GVI, 40, NULL }, { NCSI_PKT_RSP_GC, 32, ncsi_rsp_handler_gc }, - { NCSI_PKT_RSP_GP, -1, NULL }, + { NCSI_PKT_RSP_GP, 40, ncsi_rsp_handler_gp }, { NCSI_PKT_RSP_GCPS, 172, NULL }, { NCSI_PKT_RSP_GNS, 172, NULL }, { NCSI_PKT_RSP_GNPTS, 172, NULL }, --=20 2.17.0 From nobody Tue Feb 10 02:01:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527795237495774.0533758280424; Thu, 31 May 2018 12:33:57 -0700 (PDT) Received: from localhost ([::1]:45828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOTKe-0003sZ-PP for importer@patchew.org; Thu, 31 May 2018 15:33:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOT9v-00045R-T7 for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOT9u-0008U8-Ml for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:51 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:50358) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOT9u-0008Sx-FP for qemu-devel@nongnu.org; Thu, 31 May 2018 15:22:50 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 5835195B; Thu, 31 May 2018 21:22:49 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aKwXGbpJE5bb; Thu, 31 May 2018 21:22:48 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 53154965; Thu, 31 May 2018 21:22:41 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOT9i-00013Z-L2; Thu, 31 May 2018 21:22:38 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 21:22:37 +0200 Message-Id: <20180531192237.3994-10-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> References: <20180531192237.3994-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PULL 9/9] slirp/ncsi: add checksum support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jan.kiszka@siemens.com, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , stefanha@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater The checksum field of a NC-SI packet contains a value that may be included in each command and response. The verification is optional but the Linux driver does so when a non-zero value is provided. Let's extend the model to compute the checksum value and exercise a little more the Linux driver. See section "8.2.2.3 - 2's Complement Checksum Compensation" in the Network Controller Sideband Interface (NC-SI) Specification for more details. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Joel Stanley Signed-off-by: Samuel Thibault --- slirp/ncsi.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 7b3fff207a..7116034afc 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -1,7 +1,7 @@ /* * NC-SI (Network Controller Sideband Interface) "echo" model * - * Copyright (C) 2016 IBM Corp. + * Copyright (C) 2016-2018 IBM Corp. * * This code is licensed under the GPL version 2 or later. See the * COPYING file in the top-level directory. @@ -11,6 +11,23 @@ =20 #include "ncsi-pkt.h" =20 +static uint32_t ncsi_calculate_checksum(uint16_t *data, int len) +{ + uint32_t checksum =3D 0; + int i; + + /* + * 32-bit unsigned sum of the NC-SI packet header and NC-SI packet + * payload interpreted as a series of 16-bit unsigned integer values. + */ + for (i =3D 0; i < len; i++) { + checksum +=3D htons(data[i]); + } + + checksum =3D (~checksum + 1); + return checksum; +} + /* Get Capabilities */ static int ncsi_rsp_handler_gc(struct ncsi_rsp_pkt_hdr *rnh) { @@ -101,6 +118,9 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int p= kt_len) (ncsi_reply + ETH_HLEN); const struct ncsi_rsp_handler *handler =3D NULL; int i; + int ncsi_rsp_len =3D sizeof(*nh); + uint32_t checksum; + uint32_t *pchecksum; =20 memset(ncsi_reply, 0, sizeof(ncsi_reply)); =20 @@ -130,15 +150,18 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int= pkt_len) /* TODO: handle errors */ handler->handler(rnh); } + ncsi_rsp_len +=3D handler->payload; } else { rnh->common.length =3D 0; rnh->code =3D htons(NCSI_PKT_RSP_C_UNAVAILABLE); rnh->reason =3D htons(NCSI_PKT_RSP_R_UNKNOWN); } =20 - /* TODO: add a checksum at the end of the frame but the specs - * allows it to be zero */ + /* Add the optional checksum at the end of the frame. */ + checksum =3D ncsi_calculate_checksum((uint16_t *) rnh, ncsi_rsp_len); + pchecksum =3D (uint32_t *)((void *) rnh + ncsi_rsp_len); + *pchecksum =3D htonl(checksum); + ncsi_rsp_len +=3D 4; =20 - slirp_output(slirp->opaque, ncsi_reply, ETH_HLEN + sizeof(*nh) + - (handler ? handler->payload : 0) + 4); + slirp_output(slirp->opaque, ncsi_reply, ETH_HLEN + ncsi_rsp_len); } --=20 2.17.0