43fe83
From e043b7231c5b4be3915b8674121b618008bad825 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <e043b7231c5b4be3915b8674121b618008bad825.1382534060.git.jdenemar@redhat.com>
43fe83
From: "Daniel P. Berrange" <berrange@redhat.com>
43fe83
Date: Wed, 16 Oct 2013 23:12:55 +0800
43fe83
Subject: [PATCH] Fix max stream packet size for old clients
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=950416
43fe83
43fe83
The libvirtd server pushes data out to clients. It does not
43fe83
know what protocol version the client might have, so must be
43fe83
conservative and use the old payload limits. ie send no more
43fe83
than 256kb of data per packet.
43fe83
43fe83
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
43fe83
(cherry picked from commit 27e81517a876dcb738dd8a9bb2e0e68d71c3b7e3)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 daemon/stream.c          | 2 +-
43fe83
 src/rpc/virnetprotocol.x | 7 +++++++
43fe83
 2 files changed, 8 insertions(+), 1 deletion(-)
43fe83
43fe83
diff --git a/daemon/stream.c b/daemon/stream.c
43fe83
index 87dfaf5..9e36e8a 100644
43fe83
--- a/daemon/stream.c
43fe83
+++ b/daemon/stream.c
43fe83
@@ -708,7 +708,7 @@ daemonStreamHandleRead(virNetServerClientPtr client,
43fe83
                        daemonClientStream *stream)
43fe83
 {
43fe83
     char *buffer;
43fe83
-    size_t bufferLen = VIR_NET_MESSAGE_PAYLOAD_MAX;
43fe83
+    size_t bufferLen = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
43fe83
     int ret;
43fe83
 
43fe83
     VIR_DEBUG("client=%p, stream=%p tx=%d closed=%d",
43fe83
diff --git a/src/rpc/virnetprotocol.x b/src/rpc/virnetprotocol.x
43fe83
index 131e40b..1eae7cb 100644
43fe83
--- a/src/rpc/virnetprotocol.x
43fe83
+++ b/src/rpc/virnetprotocol.x
43fe83
@@ -50,6 +50,13 @@
43fe83
  */
43fe83
 const VIR_NET_MESSAGE_INITIAL = 65536;
43fe83
 
43fe83
+/*
43fe83
+ * Until we enlarged the message buffers, this was the max
43fe83
+ * payload size. We need to remember this for compat with
43fe83
+ * old clients.
43fe83
+ */
43fe83
+const VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX = 262144;
43fe83
+
43fe83
 /* Maximum total message size (serialised). */
43fe83
 const VIR_NET_MESSAGE_MAX = 16777216;
43fe83
 
43fe83
-- 
43fe83
1.8.4
43fe83