From nobody Sat May 30 17:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oss.nttdata.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177963003363023.22634167022204; Sun, 24 May 2026 06:40:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wR93e-00051O-2c; Sun, 24 May 2026 09:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wR3Mt-0008Qv-4F; Sun, 24 May 2026 03:35:27 -0400 Received: from oss.nttdata.com ([49.212.34.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wR3Mq-0002Dw-Up; Sun, 24 May 2026 03:35:26 -0400 Received: by oss.nttdata.com (Postfix, from userid 1024) id E84822020286; Sun, 24 May 2026 16:34:59 +0900 (JST) From: Mitsuru Kariya To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Peter Xu , Jason Wang , qemu-stable@nongnu.org Subject: [PATCH 1/5] qemu-options: fix missing addr. prefix on -netdev stream inet/unix options Date: Sun, 24 May 2026 16:34:38 +0900 Message-ID: <20260524073442.435408-2-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=49.212.34.109; envelope-from=Mitsuru.Kariya@oss.nttdata.com; helo=oss.nttdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2026 09:39:20 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1779630035831158501 Content-Type: text/plain; charset="utf-8" -netdev stream uses modern syntax parsed by netdev_parse_modern() which goes through the QAPI keyval visitor (qobject_input_visitor_new_str() -> keyval_parse() -> qobject_input_visitor_new_keyval() -> visit_type_Netdev()= ). Options nested under addr (of type SocketAddress) must therefore be written with the "addr." prefix: a top-level "keep-alive=3Don" is rejected by the QAPI input visitor with "Parameter 'keep-alive' is unexpected", because NetdevStreamOptions has no such member. The documentation listed several InetSocketAddress members (to, numeric, keep-alive, mptcp, ipv4, ipv6) and UnixSocketAddress members (abstract, tight) without the prefix, which never actually worked. Only addr.type/addr.host/addr.port/addr.path/addr.str were spelled correctly in the synopsis. Add the missing addr. prefix to all affected option names. Fixes: bb1326abd9df ("net: update netdev stream/dgram man page") Cc: qemu-stable@nongnu.org Signed-off-by: Mitsuru Kariya --- qemu-options.hx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 96ae41f787..527fc12494 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3034,8 +3034,8 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev socket,id=3Dstr[,fd=3Dh][,udp=3Dhost:port][,localaddr=3Dhost:= port]\n" " configure a network backend to connect to another net= work\n" " using an UDP tunnel\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don= |off][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect= -ms=3Dmilliseconds]\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,abstract=3Don|off][,tight=3Don|off][,reconnect-ms=3Dmilliseconds]\= n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.= keep-alive=3Don|off][,addr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6= =3Don|off][,reconnect-ms=3Dmilliseconds]\n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,addr.abstract=3Don|off][,addr.tight=3Don|off][,reconnect-ms=3Dmill= iseconds]\n" "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Df= ile-descriptor[,reconnect-ms=3Dmilliseconds]\n" " configure a network backend to connect to another net= work\n" " using a socket connection in stream mode.\n" @@ -3640,7 +3640,7 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,to=3Dmaxport][,numeric=3Don|off][,keep-alive=3Don|off= ][,mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect-ms= =3Dmilliseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.keep= -alive=3Don|off][,addr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don= |off][,reconnect-ms=3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. =20 ``server=3Don|off`` @@ -3649,22 +3649,22 @@ SRST ``addr.host=3Dhost,addr.port=3Dport`` socket address to listen on (server=3Don) or connect to (server=3D= off) =20 - ``to=3Dmaxport`` + ``addr.to=3Dmaxport`` if present, this is range of possible addresses, with port between= ``port`` and ``maxport``. =20 - ``numeric=3Don|off`` + ``addr.numeric=3Don|off`` if ``on`` ``host`` and ``port`` are guaranteed to be numeric, othe= rwise a name resolution should be attempted (default: ``off``) =20 - ``keep-alive=3Don|off`` + ``addr.keep-alive=3Don|off`` enable keep-alive when connecting to this socket. Not supported f= or passive sockets. =20 - ``mptcp=3Don|off`` + ``addr.mptcp=3Don|off`` enable multipath TCP =20 - ``ipv4=3Don|off`` + ``addr.ipv4=3Don|off`` whether to accept IPv4 addresses, default to try both IPv4 and IPv6 =20 - ``ipv6=3Don|off`` + ``addr.ipv6=3Don|off`` whether to accept IPv6 addresses, default to try both IPv4 and IPv6 =20 ``reconnect-ms=3Dmilliseconds`` @@ -3684,7 +3684,7 @@ SRST -device virtio-net,netdev=3Dnet0,mac=3D52:54:00:12:3= 4:57 \\ -netdev stream,id=3Dnet0,server=3Doff,addr.type=3Din= et,addr.host=3Dlocalhost,addr.port=3D1234,reconnect-ms=3D5000 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,abstract=3Don|off][,tight=3Don|off][,reconnect-ms=3Dmilliseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path=3Dp= ath[,addr.abstract=3Don|off][,addr.tight=3Don|off][,reconnect-ms=3Dmillisec= onds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a stream oriented unix domain socket. =20 ``server=3Don|off`` @@ -3693,10 +3693,10 @@ SRST ``addr.path=3Dpath`` filesystem path to use =20 - ``abstract=3Don|off`` + ``addr.abstract=3Don|off`` if ``on``, this is a Linux abstract socket address. =20 - ``tight=3Don|off`` + ``addr.tight=3Don|off`` if false, pad an abstract socket address with enough null bytes to= make it fill struct sockaddr_un member sun_path. =20 ``reconnect-ms=3Dmilliseconds`` --=20 2.43.0 From nobody Sat May 30 17:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oss.nttdata.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779630066295894.790017493774; Sun, 24 May 2026 06:41:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wR93A-0004oe-86; Sun, 24 May 2026 09:39:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wR3MZ-0008NM-Ka for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:07 -0400 Received: from oss.nttdata.com ([49.212.34.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wR3MX-0002PQ-Es for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:07 -0400 Received: by oss.nttdata.com (Postfix, from userid 1024) id 180EE20202A1; Sun, 24 May 2026 16:35:03 +0900 (JST) From: Mitsuru Kariya To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Peter Xu , Jason Wang Subject: [PATCH 2/5] qemu-options: document keep-alive-count/idle/interval for -netdev stream Date: Sun, 24 May 2026 16:34:39 +0900 Message-ID: <20260524073442.435408-3-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=49.212.34.109; envelope-from=Mitsuru.Kariya@oss.nttdata.com; helo=oss.nttdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2026 09:39:19 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1779630069354154100 Content-Type: text/plain; charset="utf-8" The keep-alive-count, keep-alive-idle and keep-alive-interval members of InetSocketAddress have been available for -netdev stream (and every other QAPI SocketAddress consumer) since the qemu-sockets keep-alive options were extended in 10.1, but were never documented in qemu-options.hx. Add their descriptions, and drop the "Not supported for passive sockets" remark from addr.keep-alive=3Don|off: as of 10.1 keep-alive on listening sockets is also supported (see the SocketAddress @keep-alive QAPI doc comment, which records "(Since 4.2, not supported for listening sockets until 10.1)"). Signed-off-by: Mitsuru Kariya --- qemu-options.hx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 527fc12494..7432b77571 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3034,7 +3034,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev socket,id=3Dstr[,fd=3Dh][,udp=3Dhost:port][,localaddr=3Dhost:= port]\n" " configure a network backend to connect to another net= work\n" " using an UDP tunnel\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.= keep-alive=3Don|off][,addr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6= =3Don|off][,reconnect-ms=3Dmilliseconds]\n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.= keep-alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle= =3Didle][,addr.keep-alive-interval=3Dinterval][,addr.mptcp=3Don|off][,addr.= ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect-ms=3Dmilliseconds]\n" "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,addr.abstract=3Don|off][,addr.tight=3Don|off][,reconnect-ms=3Dmill= iseconds]\n" "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Df= ile-descriptor[,reconnect-ms=3Dmilliseconds]\n" " configure a network backend to connect to another net= work\n" @@ -3640,7 +3640,7 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.keep= -alive=3Don|off][,addr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don= |off][,reconnect-ms=3Dmilliseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.keep= -alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle=3Did= le][,addr.keep-alive-interval=3Dinterval][,addr.mptcp=3Don|off][,addr.ipv4= =3Don|off][,addr.ipv6=3Don|off][,reconnect-ms=3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. =20 ``server=3Don|off`` @@ -3656,7 +3656,19 @@ SRST if ``on`` ``host`` and ``port`` are guaranteed to be numeric, othe= rwise a name resolution should be attempted (default: ``off``) =20 ``addr.keep-alive=3Don|off`` - enable keep-alive when connecting to this socket. Not supported f= or passive sockets. + enable keep-alive when connecting to this socket. + + ``addr.keep-alive-count=3Dcount`` + number of keep-alive packets to send before dropping the connectio= n. + Set to 0 to use the system default. (default: 0) + + ``addr.keep-alive-idle=3Didle`` + time in seconds the connection needs to be idle before sending kee= p-alive packets. + Set to 0 to use the system default. (default: 0) + + ``addr.keep-alive-interval=3Dinterval`` + time in seconds between individual keep-alive packets. + Set to 0 to use the system default. (default: 0) =20 ``addr.mptcp=3Don|off`` enable multipath TCP --=20 2.43.0 From nobody Sat May 30 17:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oss.nttdata.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177963003080051.777000598315226; Sun, 24 May 2026 06:40:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wR93C-0004q7-9j; Sun, 24 May 2026 09:39:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wR3Mb-0008NZ-Ao for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:09 -0400 Received: from oss.nttdata.com ([49.212.34.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wR3MZ-0002Pp-NQ for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:09 -0400 Received: by oss.nttdata.com (Postfix, from userid 1024) id 844D020202A5; Sun, 24 May 2026 16:35:05 +0900 (JST) From: Mitsuru Kariya To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Peter Xu , Jason Wang Subject: [PATCH 3/5] qemu-options: document keep-alive*/numeric/mptcp for -incoming tcp: Date: Sun, 24 May 2026 16:34:40 +0900 Message-ID: <20260524073442.435408-4-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=49.212.34.109; envelope-from=Mitsuru.Kariya@oss.nttdata.com; helo=oss.nttdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2026 09:39:19 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1779630033987158500 Content-Type: text/plain; charset="utf-8" -incoming tcp: and migrate tcp: parse their URIs through socket_parse() -> inet_parse(), which uses the inet_opts QemuOptsList (util/qemu-sockets.c). That table has long accepted numeric, keep-alive and (when supported by the host) keep-alive-count, keep-alive-idle, keep-alive-interval and mptcp, but the -incoming synopsis only listed to/ipv4/ipv6. List the other accepted options too, so the documentation matches what the parser actually supports. Signed-off-by: Mitsuru Kariya --- qemu-options.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 7432b77571..d2b816e16f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -5365,7 +5365,7 @@ SRST ERST =20 DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ - "-incoming tcp:[host]:port[,to=3Dmaxport][,ipv4=3Don|off][,ipv6=3Don|o= ff]\n" \ + "-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-ali= ve=3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-aliv= e-interval=3Dinterval][,mptcp=3Don|off][,ipv4=3Don|off][,ipv6=3Don|off]\n" \ "-incoming rdma:host:port[,ipv4=3Don|off][,ipv6=3Don|off]\n" \ "-incoming unix:socketpath\n" \ " prepare for incoming migration, listen on\n" \ @@ -5387,7 +5387,7 @@ migration channel types. The channel type is specifi= ed in , or is 'main' for all other forms of -incoming. If multiple -incoming options are specified for a channel type, the last one takes precedence. =20 -``-incoming tcp:[host]:port[,to=3Dmaxport][,ipv4=3Don|off][,ipv6=3Don|off]= `` +``-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-alive= =3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-alive-= interval=3Dinterval][,mptcp=3Don|off][,ipv4=3Don|off][,ipv6=3Don|off]`` \=20 ``-incoming rdma:host:port[,ipv4=3Don|off][,ipv6=3Don|off]`` Prepare for incoming migration, listen on a given tcp port. --=20 2.43.0 From nobody Sat May 30 17:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oss.nttdata.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779630018100240.08721467714747; Sun, 24 May 2026 06:40:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wR93J-0004xD-HI; Sun, 24 May 2026 09:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wR3Md-0008Nm-Nb for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:11 -0400 Received: from oss.nttdata.com ([49.212.34.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wR3Mb-0002QY-F1 for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:11 -0400 Received: by oss.nttdata.com (Postfix, from userid 1024) id ABAF120202B6; Sun, 24 May 2026 16:35:07 +0900 (JST) From: Mitsuru Kariya To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Peter Xu , Jason Wang Subject: [PATCH 4/5] util/qemu-sockets: add TCP_USER_TIMEOUT support Date: Sun, 24 May 2026 16:34:41 +0900 Message-ID: <20260524073442.435408-5-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=49.212.34.109; envelope-from=Mitsuru.Kariya@oss.nttdata.com; helo=oss.nttdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2026 09:39:19 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1779630023190158500 Content-Type: text/plain; charset="utf-8" The TCP_USER_TIMEOUT socket option (Linux-only) specifies the maximum amount of time in milliseconds that transmitted data may remain unacknowledged, or buffered data may remain untransmitted, before TCP forcibly closes the connection and returns ETIMEDOUT to the application. Without it, a peer that becomes silently unreachable can take well over an hour to be noticed (the kernel default), which is particularly painful for use cases like QEMU live migration. Expose user-timeout as a new optional InetSocketAddress member, gated on a new HAVE_TCP_USER_TIMEOUT meson check, and apply it in inet_set_sockopts() alongside the existing keep-alive options. Plumb the same option through the legacy QemuOpts-based inet_parse() path so that URI-style users (-incoming tcp:, migrate tcp:, HMP nbd_server_start, ...) can set it too. Update the documentation for -netdev stream (addr.user-timeout=3DN) and -incoming tcp: (user-timeout=3DN, flat key as for the other inet_opts entries), and extend test_inet_parse_all_options_good accordingly. Signed-off-by: Mitsuru Kariya --- meson.build | 2 ++ qapi/sockets.json | 7 +++++++ qemu-options.hx | 13 +++++++++---- tests/unit/test-util-sockets.c | 13 +++++++++++++ util/qemu-sockets.c | 24 ++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index eb07491819..c5afe8754d 100644 --- a/meson.build +++ b/meson.build @@ -2726,6 +2726,8 @@ config_host_data.set('HAVE_TCP_KEEPINTVL', #endif int main(void) { return 0; }''', name: 'Win32 TCP_KEEPINTVL')) +config_host_data.set('HAVE_TCP_USER_TIMEOUT', + cc.has_header_symbol('netinet/tcp.h', 'TCP_USER_TIMEO= UT')) =20 # has_member config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID', diff --git a/qapi/sockets.json b/qapi/sockets.json index 473be2ac58..543689a2c7 100644 --- a/qapi/sockets.json +++ b/qapi/sockets.json @@ -79,6 +79,12 @@ # defined (this includes Linux, Windows, macOS, FreeBSD, but not # OpenBSD). When set to 0, system setting is used. (Since 10.1) # +# @user-timeout: time in milliseconds that transmitted data may remain +# unacknowledged before the connection is closed. Only supported +# for TCP sockets on systems where TCP_USER_TIMEOUT socket option +# is defined (Linux only). When set to 0, system setting is used. +# (Since 11.1) +# # @mptcp: enable multi-path TCP. (Since 6.1) # # Since: 1.3 @@ -94,6 +100,7 @@ '*keep-alive-count': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPCNT' }, '*keep-alive-idle': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPIDLE' }, '*keep-alive-interval': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPINTVL'= }, + '*user-timeout': { 'type': 'uint32', 'if': 'HAVE_TCP_USER_TIMEOUT' }, '*mptcp': { 'type': 'bool', 'if': 'HAVE_IPPROTO_MPTCP' } } } =20 ## diff --git a/qemu-options.hx b/qemu-options.hx index d2b816e16f..63587cccd3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3034,7 +3034,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev socket,id=3Dstr[,fd=3Dh][,udp=3Dhost:port][,localaddr=3Dhost:= port]\n" " configure a network backend to connect to another net= work\n" " using an UDP tunnel\n" - "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.= keep-alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle= =3Didle][,addr.keep-alive-interval=3Dinterval][,addr.mptcp=3Don|off][,addr.= ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect-ms=3Dmilliseconds]\n" + "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host= =3Dhost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.= keep-alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle= =3Didle][,addr.keep-alive-interval=3Dinterval][,addr.user-timeout=3Dtimeout= ][,addr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnec= t-ms=3Dmilliseconds]\n" "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dunix,addr.path= =3Dpath[,addr.abstract=3Don|off][,addr.tight=3Don|off][,reconnect-ms=3Dmill= iseconds]\n" "-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dfd,addr.str=3Df= ile-descriptor[,reconnect-ms=3Dmilliseconds]\n" " configure a network backend to connect to another net= work\n" @@ -3640,7 +3640,7 @@ SRST -device e1000,netdev=3Dn1,mac=3D52:54:00:12:34:56= \\ -netdev socket,id=3Dn1,mcast=3D239.192.168.1:1102= ,localaddr=3D1.2.3.4 =20 -``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.keep= -alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle=3Did= le][,addr.keep-alive-interval=3Dinterval][,addr.mptcp=3Don|off][,addr.ipv4= =3Don|off][,addr.ipv6=3Don|off][,reconnect-ms=3Dmilliseconds]`` +``-netdev stream,id=3Dstr[,server=3Don|off],addr.type=3Dinet,addr.host=3Dh= ost,addr.port=3Dport[,addr.to=3Dmaxport][,addr.numeric=3Don|off][,addr.keep= -alive=3Don|off][,addr.keep-alive-count=3Dcount][,addr.keep-alive-idle=3Did= le][,addr.keep-alive-interval=3Dinterval][,addr.user-timeout=3Dtimeout][,ad= dr.mptcp=3Don|off][,addr.ipv4=3Don|off][,addr.ipv6=3Don|off][,reconnect-ms= =3Dmilliseconds]`` Configure a network backend to connect to another QEMU virtual machine= or a proxy using a TCP/IP socket. =20 ``server=3Don|off`` @@ -3670,6 +3670,11 @@ SRST time in seconds between individual keep-alive packets. Set to 0 to use the system default. (default: 0) =20 + ``addr.user-timeout=3Dtimeout`` + time in milliseconds that transmitted data may remain unacknowledg= ed + before the connection is forcibly closed. + Set to 0 to use the system default. (default: 0) + ``addr.mptcp=3Don|off`` enable multipath TCP =20 @@ -5365,7 +5370,7 @@ SRST ERST =20 DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ - "-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-ali= ve=3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-aliv= e-interval=3Dinterval][,mptcp=3Don|off][,ipv4=3Don|off][,ipv6=3Don|off]\n" \ + "-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-ali= ve=3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-aliv= e-interval=3Dinterval][,user-timeout=3Dtimeout][,mptcp=3Don|off][,ipv4=3Don= |off][,ipv6=3Don|off]\n" \ "-incoming rdma:host:port[,ipv4=3Don|off][,ipv6=3Don|off]\n" \ "-incoming unix:socketpath\n" \ " prepare for incoming migration, listen on\n" \ @@ -5387,7 +5392,7 @@ migration channel types. The channel type is specifi= ed in , or is 'main' for all other forms of -incoming. If multiple -incoming options are specified for a channel type, the last one takes precedence. =20 -``-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-alive= =3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-alive-= interval=3Dinterval][,mptcp=3Don|off][,ipv4=3Don|off][,ipv6=3Don|off]`` +``-incoming tcp:[host]:port[,to=3Dmaxport][,numeric=3Don|off][,keep-alive= =3Don|off][,keep-alive-count=3Dcount][,keep-alive-idle=3Didle][,keep-alive-= interval=3Dinterval][,user-timeout=3Dtimeout][,mptcp=3Don|off][,ipv4=3Don|o= ff][,ipv6=3Don|off]`` \=20 ``-incoming rdma:host:port[,ipv4=3Don|off][,ipv6=3Don|off]`` Prepare for incoming migration, listen on a given tcp port. diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index b9f2453e29..a56efc1b83 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -382,6 +382,12 @@ static void inet_parse_test_helper(const char *str, g_assert_cmpint(addr.keep_alive_interval, =3D=3D, exp_addr->keep_alive_interval); #endif +#ifdef HAVE_TCP_USER_TIMEOUT + g_assert_cmpint(addr.has_user_timeout, =3D=3D, + exp_addr->has_user_timeout); + g_assert_cmpint(addr.user_timeout, =3D=3D, + exp_addr->user_timeout); +#endif #ifdef HAVE_IPPROTO_MPTCP g_assert_cmpint(addr.has_mptcp, =3D=3D, exp_addr->has_mptcp); g_assert_cmpint(addr.mptcp, =3D=3D, exp_addr->mptcp); @@ -495,6 +501,10 @@ static void test_inet_parse_all_options_good(void) .has_keep_alive_interval =3D true, .keep_alive_interval =3D 30, #endif +#ifdef HAVE_TCP_USER_TIMEOUT + .has_user_timeout =3D true, + .user_timeout =3D 10000, +#endif #ifdef HAVE_IPPROTO_MPTCP .has_mptcp =3D true, .mptcp =3D false, @@ -511,6 +521,9 @@ static void test_inet_parse_all_options_good(void) #ifdef HAVE_TCP_KEEPINTVL ",keep-alive-interval=3D30" #endif +#ifdef HAVE_TCP_USER_TIMEOUT + ",user-timeout=3D10000" +#endif #ifdef HAVE_IPPROTO_MPTCP ",mptcp=3Doff" #endif diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 4773755fd5..f16f9b007c 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -263,6 +263,18 @@ static int inet_set_sockopts(int sock, InetSocketAddre= ss *saddr, Error **errp) } #endif } +#ifdef HAVE_TCP_USER_TIMEOUT + if (saddr->has_user_timeout && saddr->user_timeout) { + int user_timeout =3D saddr->user_timeout; + int ret =3D setsockopt(sock, IPPROTO_TCP, TCP_USER_TIMEOUT, &user_= timeout, + sizeof(user_timeout)); + if (ret < 0) { + error_setg_errno(errp, errno, + "Unable to set TCP user timeout option on soc= ket"); + return -1; + } + } +#endif return 0; } =20 @@ -692,6 +704,12 @@ static QemuOptsList inet_opts =3D { .type =3D QEMU_OPT_NUMBER, }, #endif +#ifdef HAVE_TCP_USER_TIMEOUT + { + .name =3D "user-timeout", + .type =3D QEMU_OPT_NUMBER, + }, +#endif #ifdef HAVE_IPPROTO_MPTCP { .name =3D "mptcp", @@ -775,6 +793,12 @@ int inet_parse(InetSocketAddress *addr, const char *st= r, Error **errp) addr->keep_alive_interval =3D qemu_opt_get_number(opts, "keep-aliv= e-interval", 0); } #endif +#ifdef HAVE_TCP_USER_TIMEOUT + if (qemu_opt_find(opts, "user-timeout")) { + addr->has_user_timeout =3D true; + addr->user_timeout =3D qemu_opt_get_number(opts, "user-timeout", 0= ); + } +#endif #ifdef HAVE_IPPROTO_MPTCP if (qemu_opt_find(opts, "mptcp")) { addr->has_mptcp =3D true; --=20 2.43.0 From nobody Sat May 30 17:44:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oss.nttdata.com Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779630018125893.671040056009; Sun, 24 May 2026 06:40:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wR93c-00050V-4T; Sun, 24 May 2026 09:39:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wR3Mf-0008OH-0G for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:13 -0400 Received: from oss.nttdata.com ([49.212.34.109]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wR3Md-0002RN-7G for qemu-devel@nongnu.org; Sun, 24 May 2026 03:35:12 -0400 Received: by oss.nttdata.com (Postfix, from userid 1024) id 468C820202B8; Sun, 24 May 2026 16:35:09 +0900 (JST) From: Mitsuru Kariya To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Eric Blake , Markus Armbruster , Fabiano Rosas , Laurent Vivier , Peter Xu , Jason Wang Subject: [PATCH 5/5] tests/qtest/netdev-socket: smoke test -netdev stream inet option set Date: Sun, 24 May 2026 16:34:42 +0900 Message-ID: <20260524073442.435408-6-Mitsuru.Kariya@oss.nttdata.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> References: <20260524073442.435408-1-Mitsuru.Kariya@oss.nttdata.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.4.3 at oss.nttdata.com X-Virus-Status: Clean Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=49.212.34.109; envelope-from=Mitsuru.Kariya@oss.nttdata.com; helo=oss.nttdata.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 May 2026 09:39:20 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1779630023113158500 Content-Type: text/plain; charset="utf-8" The existing /netdev/stream/inet/ipv4 and /ipv6 tests only exercise addr.type, addr.host, addr.port and addr.ipv4/ipv6. None of the other optional InetSocketAddress members (numeric, to, keep-alive, keep-alive-count, keep-alive-idle, keep-alive-interval, user-timeout, mptcp) have any test coverage on the QAPI keyval parsing path used by netdev_parse_modern(). That gap let the qemu-options.hx synopsis drift out of sync with reality (multiple options were documented without the required "addr." prefix, which the QAPI input visitor would have rejected). Add /netdev/stream/inet/options that sets all those options on the server and client -netdev stream invocations. The options conditionally compiled by HAVE_TCP_KEEP*/HAVE_TCP_USER_TIMEOUT/HAVE_IPPROTO_MPTCP are gated the same way here, mirroring inet_set_sockopts() and the QAPI schema. This is a smoke test: it verifies QEMU accepts the options and the netdev reaches "listening"/"tcp:..." state. It does not read the options back from the kernel; that path is already covered indirectly by test_inet_parse_all_options_good which exercises inet_set_sockopts() through the QemuOpts inet_parse() path. Signed-off-by: Mitsuru Kariya --- tests/qtest/netdev-socket.c | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c index b731af0ad9..d1718813eb 100644 --- a/tests/qtest/netdev-socket.c +++ b/tests/qtest/netdev-socket.c @@ -146,6 +146,76 @@ static void test_stream_inet_ipv4(void) qtest_quit(qts0); } =20 +/* + * Smoke test that -netdev stream accepts all optional InetSocketAddress + * members (numeric, to, keep-alive*, user-timeout, mptcp). Catches + * regressions in the QAPI schema, the keyval parsing path, and the + * synopsis spelling in qemu-options.hx. + */ +static void test_stream_inet_options(void) +{ + QTestState *qts0, *qts1; + char *expect; + int port; + + port =3D inet_get_free_port(false); + qts0 =3D qtest_initf("-nodefaults -M none " + "-netdev stream,id=3Dst0,server=3Dtrue,addr.type=3D= inet," + "addr.ipv4=3Don,addr.ipv6=3Doff,addr.numeric=3Don," + "addr.host=3D127.0.0.1,addr.port=3D%d,addr.to=3D%d," + "addr.keep-alive=3Don" +#ifdef HAVE_TCP_KEEPCNT + ",addr.keep-alive-count=3D3" +#endif +#ifdef HAVE_TCP_KEEPIDLE + ",addr.keep-alive-idle=3D10" +#endif +#ifdef HAVE_TCP_KEEPINTVL + ",addr.keep-alive-interval=3D5" +#endif +#ifdef HAVE_TCP_USER_TIMEOUT + ",addr.user-timeout=3D10000" +#endif +#ifdef HAVE_IPPROTO_MPTCP + ",addr.mptcp=3Doff" +#endif + , port, port); + + EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + + qts1 =3D qtest_initf("-nodefaults -M none " + "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dinet," + "addr.ipv4=3Don,addr.ipv6=3Doff,addr.numeric=3Don," + "addr.host=3D127.0.0.1,addr.port=3D%d," + "addr.keep-alive=3Don" +#ifdef HAVE_TCP_KEEPCNT + ",addr.keep-alive-count=3D3" +#endif +#ifdef HAVE_TCP_KEEPIDLE + ",addr.keep-alive-idle=3D10" +#endif +#ifdef HAVE_TCP_KEEPINTVL + ",addr.keep-alive-interval=3D5" +#endif +#ifdef HAVE_TCP_USER_TIMEOUT + ",addr.user-timeout=3D10000" +#endif +#ifdef HAVE_IPPROTO_MPTCP + ",addr.mptcp=3Doff" +#endif + , port); + + expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,tcp:127.0.0.1= :%d\r\n", + port); + EXPECT_STATE(qts1, expect, 0); + g_free(expect); + + EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,tcp:127.0.0.1", ':'); + + qtest_quit(qts1); + qtest_quit(qts0); +} + static void wait_stream_connected(QTestState *qts, const char *id, SocketAddress **addr) { @@ -512,6 +582,7 @@ int main(int argc, char **argv) =20 if (has_ipv4) { qtest_add_func("/netdev/stream/inet/ipv4", test_stream_inet_ipv4); + qtest_add_func("/netdev/stream/inet/options", test_stream_inet_opt= ions); qtest_add_func("/netdev/dgram/inet", test_dgram_inet); #if !defined(_WIN32) && !defined(CONFIG_DARWIN) qtest_add_func("/netdev/dgram/mcast", test_dgram_mcast); --=20 2.43.0