[Kimchi-devel] [PATCH 1/5] PowerKVM: Workaround of numpy byte order bug on PowerPC
Paulo Vital
pvital at linux.vnet.ibm.com
Fri Aug 15 15:29:30 UTC 2014
A numpy byte order bug cause the novnc handshake failure. To workaround
this problem, we swap bytes after unmasking. After it's fixed on the
numpy side, we can drop this patch.
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
src/kimchi/websocket.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/websocket.py b/src/kimchi/websocket.py
index a98fc6d..870c453 100644
--- a/src/kimchi/websocket.py
+++ b/src/kimchi/websocket.py
@@ -16,7 +16,7 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
-import os, sys, time, errno, signal, socket, traceback, select
+import os, sys, time, errno, signal, socket, traceback, select, platform
import array, struct
from base64 import b64encode, b64decode
@@ -251,7 +251,10 @@ Sec-WebSocket-Accept: %s\r
data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
offset=pstart, count=int(plen / 4))
#b = numpy.bitwise_xor(data, mask).data
- b = numpy.bitwise_xor(data, mask).tostring()
+ if platform.machine().startswith('ppc'):
+ b = numpy.bitwise_xor(data, mask).byteswap().tostring()
+ else:
+ b = numpy.bitwise_xor(data, mask).tostring()
if plen % 4:
#print("Partial unmask")
--
1.9.3
More information about the Kimchi-devel
mailing list