public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] contrib: Drop QEMU out-of-tree patches
Date: Thu, 9 Mar 2023 09:54:04 +1100	[thread overview]
Message-ID: <ZAkSDOAwqWpn+Kwv@yekko> (raw)
In-Reply-To: <20230308225006.2589905-1-sbrivio@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 9360 bytes --]

On Wed, Mar 08, 2023 at 11:50:06PM +0100, Stefano Brivio wrote:
> Native support was introduced with commit 13c6be96618c, QEMU 7.2.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  ...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-socket-connection.patch
> 
> diff --git a/contrib/qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-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 <sbrivio@redhat.com>
> -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 <sbrivio@redhat.com>
> ----
> -SPDX-FileCopyrightText: 2020-2022 Red Hat GmbH <sbrivio@redhat.com>
> -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 = (struct sockaddr_in *)&saddr;
> -+    struct sockaddr_un *saddr_un = (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;
> - 
> --    if (parse_host_port(&saddr, host_str, errp) < 0) {
> --        return -1;
> --    }
> -+        pf = PF_INET;
> -+        saddr_size = sizeof(*saddr_in);
> -+#ifndef WIN32
> -+    } else {
> -+        struct stat sb;
> -+
> -+        if (stat(host_str, &sb) == -1) {
> -+            error_setg_errno(errp, errno, "can't stat socket path");
> -+            return -1;
> -+        }
> -+
> -+        if ((sb.st_mode & S_IFMT) != S_IFSOCK) {
> -+            error_setg_errno(errp, errno, "path provided is not a socket");
> -+            return -1;
> -+        }
> - 
> --    fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
> -+        saddr_un->sun_family = PF_UNIX;
> -+        strncpy(saddr_un->sun_path, host_str, sizeof(saddr_un->sun_path));
> -+
> -+        pf = PF_UNIX;
> -+        saddr_size = sizeof(*saddr_un);
> -+    }
> -+#endif /* !WIN32 */
> -+    fd = 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);
> - 
> --    socket_set_fast_reuse(fd);
> -+    if (pf == PF_INET)
> -+        socket_set_fast_reuse(fd);
> - 
> --    ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
> -+    ret = bind(fd, (struct sockaddr *)&saddr, saddr_size);
> -     if (ret < 0) {
> --        error_setg_errno(errp, errno, "can't bind ip=%s to socket",
> --                         inet_ntoa(saddr.sin_addr));
> -+        if (pf == PF_INET)
> -+            error_setg_errno(errp, errno, "can't bind ip=%s to socket",
> -+                             inet_ntoa(saddr_in->sin_addr));
> -+        else if (pf == PF_UNIX)
> -+            error_setg_errno(errp, errno, "can't create socket with path: %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 = (struct sockaddr_in *)&saddr;
> -+#ifndef WIN32
> -+    struct sockaddr_un *saddr_un = (struct sockaddr_un *)&saddr;
> -+
> -+    if (strchr(host_str, ':')) {
> -+#endif
> -+        if (parse_host_port(saddr_in, host_str, errp) < 0)
> -+            return -1;
> - 
> --    if (parse_host_port(&saddr, host_str, errp) < 0) {
> --        return -1;
> -+        pf = PF_INET;
> -+        saddr_size = sizeof(*saddr_in);
> -+#ifndef WIN32
> -+    } else {
> -+        struct stat sb;
> -+
> -+        if (stat(host_str, &sb) == -1) {
> -+            error_setg_errno(errp, errno, "can't stat socket path");
> -+            return -1;
> -+        }
> -+
> -+        if ((sb.st_mode & S_IFMT) != S_IFSOCK) {
> -+            error_setg_errno(errp, errno, "provided path is not a socket");
> -+            return -1;
> -+        }
> -+
> -+        saddr_un->sun_family = PF_UNIX;
> -+        strncpy(saddr_un->sun_path, host_str, sizeof(saddr_un->sun_path));
> -+
> -+        pf = PF_UNIX;
> -+        saddr_size = sizeof(*saddr_un);
> -     }
> -+#endif /* !WIN32 */
> - 
> --    fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
> -+    fd = 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 *peer,
> - 
> -     connected = 0;
> -     for(;;) {
> --        ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr));
> -+        ret = connect(fd, (struct sockaddr *)&saddr, saddr_size);
> -         if (ret < 0) {
> -             if (errno == EINTR || errno == EWOULDBLOCK) {
> -                 /* continue */
> -@@ -597,9 +659,15 @@ static int net_socket_connect_init(NetClientState *peer,
> -         return -1;
> -     }
> - 
> --    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 == 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_port));
> -+    } else if (pf == PF_UNIX) {
> -+        snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> -+                 "socket: connect to %s", saddr_un->sun_path);
> -+    }
> -+
> -     return 0;
> - }
> - 
> --- 
> -2.28.0
> -
> diff --git a/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socket-connection.patch b/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socket-connection.patch
> deleted file mode 100644
> index 0e31a1b..0000000
> --- a/contrib/qemu/0002-net-Don-t-ignore-EINVAL-on-netdev-socket-connection.patch
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -From a6d475147682de1fe3b14eb325f4247e013e8440 Mon Sep 17 00:00:00 2001
> -Message-Id: <a6d475147682de1fe3b14eb325f4247e013e8440.1619091389.git.sbrivio@redhat.com>
> -In-Reply-To: <ba51349d353f11e05c6341a7e065f2ade3874c68.1619091389.git.sbrivio@redhat.com>
> -References: <ba51349d353f11e05c6341a7e065f2ade3874c68.1619091389.git.sbrivio@redhat.com>
> -From: Stefano Brivio <sbrivio@redhat.com>
> -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 <sbrivio@redhat.com>
> ----
> -SPDX-FileCopyrightText: 2020-2021 Red Hat GmbH <sbrivio@redhat.com>
> -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 *peer,
> -             if (errno == EINTR || errno == EWOULDBLOCK) {
> -                 /* continue */
> -             } else if (errno == EINPROGRESS ||
> --                       errno == EALREADY ||
> --                       errno == EINVAL) {
> -+                       errno == EALREADY) {
> -                 break;
> -             } else {
> -                 error_setg_errno(errp, errno, "can't connect socket");
> --- 
> -2.29.2
> -

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2023-03-08 22:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 22:50 [PATCH] contrib: Drop QEMU out-of-tree patches Stefano Brivio
2023-03-08 22:54 ` David Gibson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAkSDOAwqWpn+Kwv@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).