thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

Blame SOURCES/kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch

29b115
From cb6dc39a5e5d2d981b4b1e983042b3fbb529d5d1 Mon Sep 17 00:00:00 2001
29b115
From: Leonardo Bras <leobras@redhat.com>
29b115
Date: Thu, 4 Aug 2022 04:10:43 -0300
29b115
Subject: [PATCH 06/11] QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Leonardo Brás <leobras@redhat.com>
29b115
RH-MergeRequest: 111: zero-copy-send fixes & improvements
29b115
RH-Commit: [6/6] 2eb1aba8ebf267a6f67cfba2e489dc88619c7fd4 (LeoBras/centos-qemu-kvm)
29b115
RH-Bugzilla: 2107466
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Thomas Huth <thuth@redhat.com>
29b115
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
29b115
For using MSG_ZEROCOPY, there are two steps:
29b115
1 - io_writev() the packet, which enqueues the packet for sending, and
29b115
2 - io_flush(), which gets confirmation that all packets got correctly sent
29b115
29b115
Currently, if MSG_ZEROCOPY is used to send packets over IPV6, no error will
29b115
be reported in (1), but it will fail in the first time (2) happens.
29b115
29b115
This happens because (2) currently checks for cmsg_level & cmsg_type
29b115
associated with IPV4 only, before reporting any error.
29b115
29b115
Add checks for cmsg_level & cmsg_type associated with IPV6, and thus enable
29b115
support for MSG_ZEROCOPY + IPV6
29b115
29b115
Fixes: 2bc58ffc29 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX")
29b115
Signed-off-by: Leonardo Bras <leobras@redhat.com>
29b115
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
29b115
(cherry picked from commit 5258a7e2c0677d16e9e1d06845f60171adf0b290)
29b115
Signed-off-by: Leonardo Bras <leobras@redhat.com>
29b115
---
29b115
 io/channel-socket.c | 4 ++--
29b115
 1 file changed, 2 insertions(+), 2 deletions(-)
29b115
29b115
diff --git a/io/channel-socket.c b/io/channel-socket.c
29b115
index eb7baa2184..efd5f60808 100644
29b115
--- a/io/channel-socket.c
29b115
+++ b/io/channel-socket.c
29b115
@@ -747,8 +747,8 @@ static int qio_channel_socket_flush(QIOChannel *ioc,
29b115
         }
29b115
 
29b115
         cm = CMSG_FIRSTHDR(&msg;;
29b115
-        if (cm->cmsg_level != SOL_IP &&
29b115
-            cm->cmsg_type != IP_RECVERR) {
29b115
+        if (cm->cmsg_level != SOL_IP   && cm->cmsg_type != IP_RECVERR &&
29b115
+            cm->cmsg_level != SOL_IPV6 && cm->cmsg_type != IPV6_RECVERR) {
29b115
             error_setg_errno(errp, EPROTOTYPE,
29b115
                              "Wrong cmsg in errqueue");
29b115
             return -1;
29b115
-- 
29b115
2.31.1
29b115