From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
Tweaked nbd_client.py to properly handle handshake and transport flags in new handshake protocol
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- diff --git a/scripts/nbd_client.py b/scripts/nbd_client.py --- a/scripts/nbd_client.py +++ b/scripts/nbd_client.py @@ -66,15 +66,17 @@ def _old_style_handshake(self, magic): def _new_style_handshake(self, magic): assert(magic == 0x49484156454F5054) # Should have received IHAVEOPT buf = self._s.recv(2) - (self._flags) = struct.unpack(">H", buf) + (handshake_flags,) = struct.unpack(">H", buf) + client_flags = struct.pack('>L', 0) self._s.send(client_flags) options = struct.pack('>QLL', 0x49484156454F5054, 1, 0) self._s.send(options) buf = self._s.recv(8 + 2) - (self._size, self._flags) = struct.unpack(">QH", buf) + (self._size, transport_flags) = struct.unpack(">QH", buf) + self._flags = (handshake_flags << 16) + transport_flags # ignore trailing zeroes self._s.recv(124) -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000033ca0305890bc05a%40google.com. For more options, visit https://groups.google.com/d/optout.