From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 224405A0262 for ; Wed, 8 Mar 2023 23:57:17 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4PX74C188Jz4xDr; Thu, 9 Mar 2023 09:57:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1678316235; bh=XLVMpc2Botp1dfpSmTFnTEqpp+vVQ+I904aUgeJiNuI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vi3gmmAOuu7KykOet9t5paoiQ+QWwNEttc9fQ6kmiqNRXyj3hFFYAtJr5xNVgim8N GeFIz+9vgY+UM2e5CGjMVgEdPHUH2gbOj98jVcJ4XE3oG+mlMTuXxWnUjJWu/eRlp+ 7rDxYEVbohHgLb2/u2hLYkGW0PMmYzDc1Y8ByKs0= Date: Thu, 9 Mar 2023 09:54:04 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] contrib: Drop QEMU out-of-tree patches Message-ID: References: <20230308225006.2589905-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FpdleLFpgwJKl382" Content-Disposition: inline In-Reply-To: <20230308225006.2589905-1-sbrivio@redhat.com> Message-ID-Hash: EHDA7BWYCFBTOKALCAM3NVX3LBCBHPRL X-Message-ID-Hash: EHDA7BWYCFBTOKALCAM3NVX3LBCBHPRL X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --FpdleLFpgwJKl382 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 08, 2023 at 11:50:06PM +0100, Stefano Brivio wrote: > Native support was introduced with commit 13c6be96618c, QEMU 7.2. >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > ...NIX-domain-sockets-to-be-used-as-net.patch | 171 ------------------ > ...e-EINVAL-on-netdev-socket-connection.patch | 37 ---- > 2 files changed, 208 deletions(-) > delete mode 100644 contrib/qemu/0001-net-Allow-also-UNIX-domain-sockets-= to-be-used-as-net.patch > delete mode 100644 contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-s= ocket-connection.patch >=20 > diff --git a/contrib/qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-u= sed-as-net.patch b/contrib/qemu/0001-net-Allow-also-UNIX-domain-sockets-to-= be-used-as-net.patch > deleted file mode 100644 > index 9e71f88..0000000 > --- a/contrib/qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-as-= net.patch > +++ /dev/null > @@ -1,171 +0,0 @@ > -From 83c3f76b8fe6b4a6bb45dcf5cfad65ec6f98a10e Mon Sep 17 00:00:00 2001 > -From: Stefano Brivio > -Date: Wed, 26 Jan 2022 16:45:15 +0100 > -Subject: [PATCH 1/2] net: Allow also UNIX domain sockets to be used as -= netdev > - socket > - > -It has lower overhead compared to TCP, doesn't need a free port > -and the adaptation is trivial. > - > -Signed-off-by: Stefano Brivio > ---- > -SPDX-FileCopyrightText: 2020-2022 Red Hat GmbH > -SPDX-License-Identifier: AGPL-3.0-or-later > - > - net/socket.c | 106 ++++++++++++++++++++++++++++++++++++++++++--------- > - 1 file changed, 87 insertions(+), 19 deletions(-) > - > -diff --git a/net/socket.c b/net/socket.c > -index 2e5f3ac923..b901e22836 100644 > ---- a/net/socket.c > -+++ b/net/socket.c > -@@ -511,26 +511,59 @@ static int net_socket_listen_init(NetClientState *= peer, > - { > - NetClientState *nc; > - NetSocketState *s; > -- struct sockaddr_in saddr; > -- int fd, ret; > -+ struct sockaddr_storage saddr; > -+ struct sockaddr_in *saddr_in =3D (struct sockaddr_in *)&saddr; > -+ struct sockaddr_un *saddr_un =3D (struct sockaddr_un *)&saddr; > -+ size_t saddr_size; > -+ int fd, ret, pf; > -+ > -+#ifndef WIN32 > -+ if (strchr(host_str, ':')) { > -+#endif > -+ if (parse_host_port(saddr_in, host_str, errp) < 0) > -+ return -1; > -=20 > -- if (parse_host_port(&saddr, host_str, errp) < 0) { > -- return -1; > -- } > -+ pf =3D PF_INET; > -+ saddr_size =3D sizeof(*saddr_in); > -+#ifndef WIN32 > -+ } else { > -+ struct stat sb; > -+ > -+ if (stat(host_str, &sb) =3D=3D -1) { > -+ error_setg_errno(errp, errno, "can't stat socket path"); > -+ return -1; > -+ } > -+ > -+ if ((sb.st_mode & S_IFMT) !=3D S_IFSOCK) { > -+ error_setg_errno(errp, errno, "path provided is not a socke= t"); > -+ return -1; > -+ } > -=20 > -- fd =3D qemu_socket(PF_INET, SOCK_STREAM, 0); > -+ saddr_un->sun_family =3D PF_UNIX; > -+ strncpy(saddr_un->sun_path, host_str, sizeof(saddr_un->sun_path= )); > -+ > -+ pf =3D PF_UNIX; > -+ saddr_size =3D sizeof(*saddr_un); > -+ } > -+#endif /* !WIN32 */ > -+ fd =3D qemu_socket(pf, SOCK_STREAM, 0); > - if (fd < 0) { > - error_setg_errno(errp, errno, "can't create stream socket"); > - return -1; > - } > - qemu_set_nonblock(fd); > -=20 > -- socket_set_fast_reuse(fd); > -+ if (pf =3D=3D PF_INET) > -+ socket_set_fast_reuse(fd); > -=20 > -- ret =3D bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)); > -+ ret =3D bind(fd, (struct sockaddr *)&saddr, saddr_size); > - if (ret < 0) { > -- error_setg_errno(errp, errno, "can't bind ip=3D%s to socket", > -- inet_ntoa(saddr.sin_addr)); > -+ if (pf =3D=3D PF_INET) > -+ error_setg_errno(errp, errno, "can't bind ip=3D%s to socket= ", > -+ inet_ntoa(saddr_in->sin_addr)); > -+ else if (pf =3D=3D PF_UNIX) > -+ error_setg_errno(errp, errno, "can't create socket with pat= h: %s", > -+ host_str); > - closesocket(fd); > - return -1; > - } > -@@ -559,14 +592,43 @@ static int net_socket_connect_init(NetClientState = *peer, > - Error **errp) > - { > - NetSocketState *s; > -- int fd, connected, ret; > -- struct sockaddr_in saddr; > -+ int fd, connected, ret, pf; > -+ struct sockaddr_storage saddr; > -+ size_t saddr_size; > -+ struct sockaddr_in *saddr_in =3D (struct sockaddr_in *)&saddr; > -+#ifndef WIN32 > -+ struct sockaddr_un *saddr_un =3D (struct sockaddr_un *)&saddr; > -+ > -+ if (strchr(host_str, ':')) { > -+#endif > -+ if (parse_host_port(saddr_in, host_str, errp) < 0) > -+ return -1; > -=20 > -- if (parse_host_port(&saddr, host_str, errp) < 0) { > -- return -1; > -+ pf =3D PF_INET; > -+ saddr_size =3D sizeof(*saddr_in); > -+#ifndef WIN32 > -+ } else { > -+ struct stat sb; > -+ > -+ if (stat(host_str, &sb) =3D=3D -1) { > -+ error_setg_errno(errp, errno, "can't stat socket path"); > -+ return -1; > -+ } > -+ > -+ if ((sb.st_mode & S_IFMT) !=3D S_IFSOCK) { > -+ error_setg_errno(errp, errno, "provided path is not a socke= t"); > -+ return -1; > -+ } > -+ > -+ saddr_un->sun_family =3D PF_UNIX; > -+ strncpy(saddr_un->sun_path, host_str, sizeof(saddr_un->sun_path= )); > -+ > -+ pf =3D PF_UNIX; > -+ saddr_size =3D sizeof(*saddr_un); > - } > -+#endif /* !WIN32 */ > -=20 > -- fd =3D qemu_socket(PF_INET, SOCK_STREAM, 0); > -+ fd =3D qemu_socket(pf, SOCK_STREAM, 0); > - if (fd < 0) { > - error_setg_errno(errp, errno, "can't create stream socket"); > - return -1; > -@@ -575,7 +637,7 @@ static int net_socket_connect_init(NetClientState *p= eer, > -=20 > - connected =3D 0; > - for(;;) { > -- ret =3D connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)); > -+ ret =3D connect(fd, (struct sockaddr *)&saddr, saddr_size); > - if (ret < 0) { > - if (errno =3D=3D EINTR || errno =3D=3D EWOULDBLOCK) { > - /* continue */ > -@@ -597,9 +659,15 @@ static int net_socket_connect_init(NetClientState *= peer, > - return -1; > - } > -=20 > -- snprintf(s->nc.info_str, sizeof(s->nc.info_str), > -- "socket: connect to %s:%d", > -- inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); > -+ if (pf =3D=3D PF_INET) { > -+ snprintf(s->nc.info_str, sizeof(s->nc.info_str), > -+ "socket: connect to %s:%d", > -+ inet_ntoa(saddr_in->sin_addr), ntohs(saddr_in->sin_por= t)); > -+ } else if (pf =3D=3D PF_UNIX) { > -+ snprintf(s->nc.info_str, sizeof(s->nc.info_str), > -+ "socket: connect to %s", saddr_un->sun_path); > -+ } > -+ > - return 0; > - } > -=20 > ---=20 > -2.28.0 > - > diff --git a/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socket-c= onnection.patch b/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socke= t-connection.patch > deleted file mode 100644 > index 0e31a1b..0000000 > --- a/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socket-connecti= on.patch > +++ /dev/null > @@ -1,37 +0,0 @@ > -From a6d475147682de1fe3b14eb325f4247e013e8440 Mon Sep 17 00:00:00 2001 > -Message-Id: > -In-Reply-To: > -References: > -From: Stefano Brivio > -Date: Wed, 21 Apr 2021 18:52:16 +0200 > -Subject: [PATCH 2/2] net: Don't ignore EINVAL on netdev socket connection > - > -Other errors are treated as failure by net_socket_connect_init(), > -but if connect() returns EINVAL, we'll fail silently. Remove the > -related exception. > - > -Signed-off-by: Stefano Brivio > ---- > -SPDX-FileCopyrightText: 2020-2021 Red Hat GmbH > -SPDX-License-Identifier: AGPL-3.0-or-later > - > - net/socket.c | 3 +-- > - 1 file changed, 1 insertion(+), 2 deletions(-) > - > -diff --git a/net/socket.c b/net/socket.c > -index aadd11dae2b3..d3293ac12e82 100644 > ---- a/net/socket.c > -+++ b/net/socket.c > -@@ -644,8 +644,7 @@ static int net_socket_connect_init(NetClientState *p= eer, > - if (errno =3D=3D EINTR || errno =3D=3D EWOULDBLOCK) { > - /* continue */ > - } else if (errno =3D=3D EINPROGRESS || > -- errno =3D=3D EALREADY || > -- errno =3D=3D EINVAL) { > -+ errno =3D=3D EALREADY) { > - break; > - } else { > - error_setg_errno(errp, errno, "can't connect socket"); > ---=20 > -2.29.2 > - --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --FpdleLFpgwJKl382 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmQJEgYACgkQzQJF27ox 2GeVdQ/+J6JqzFQ2UkkBLxfALKA/hVrIuVYhIFAN7GrxsculDySqOkRhMQ13/UgP b+5/0EP6tnik4HgSZAZphM634/Kg0i63/YBimNv4cd79tvwgTD6HAgMBQVqZacSs AMcK7GJ4y0Eye86HIGrZsPAgduRxKACn2PNhanAEcfKlGaZyJZL1FZnROMzMUwxc Stmr6MU33wR1sxrAdZDbwmlqbKzuVVuI8KN8pHHWN1gzutvanfHmDB3hZcLWv4MG N8VDTQQ+ML5bUdrCgp5te4Jun3QF0Nc4E/dpRqW1Aq5xt84Li88X1JX4lKduoUgO 3vM/JrrDq36VJqoggy1klOv8ceyEhPHvItU8rIVhVQpPbI2uRX9S1B31kNVlwhco DC0CVPlEr4etmDDjYcNfuRhhYeh6a0bTw0CEoBpqAUb7lhV8YEkm8t9k9M1rDCMN 0d4pLmERDd4h/xustT5Isa/XW/p8eoRWAUKYfImuUSRuhrRymYCg5qMLuq4GYxIR SqwHKweSRnXuWyQ7DoCZDaRZ/horhR4n9jLDBqJ170j66R2F/Ol8PVFQ6xVDUJki I0hMSbtD7aSKaqCnzEsM0ErWrQmoLQW1/2BTDcOhO3+7f/bRB0xD0BuXbKJM2vus cIPDhF137MPo9uyd5oBmvlbS6J7x1qYe6XwvOWtJJjMbQTo/yn8= =2fGJ -----END PGP SIGNATURE----- --FpdleLFpgwJKl382--