nbd: Honor server global flags on little-endian
commite03b34d62a6ff6e89573cd9595f3619155622d29
authorEric Blake <eblake@redhat.com>
Mon, 22 Apr 2019 18:51:25 +0000 (22 13:51 -0500)
committerEric Blake <eblake@redhat.com>
Tue, 23 Apr 2019 15:43:57 +0000 (23 10:43 -0500)
tree59352bb33d117b06fe2b59eaa9cb1c2cbc91a630
parent9eb2a4dfc8fe83056d3cd231c400bb01c0a94d45
nbd: Honor server global flags on little-endian

In the nbd plugin, I forgot to swap the server's global flags into
host endian order before checking which flags the server had set. As a
result, on little-endian machines, we were always replying with cflags
of 0 instead of the intended mirroring of the supported server flags,
although fortunately it made no real difference up to now (we were
never sending any option other than NBD_OPT_EXPORT_NAME, so not
mirroring NBD_FLAG_FIXED_NEWSTYLE had no effect; not mirroring
NBD_FLAG_NO_ZEROES merely means a longer handshake; and the NBD
protocol does not yet define flag 0x100 or 0x200 to confuse
us). However, once we add code for NBD_OPT_GO, it becomes essential to
get it right.

Fixes: 0e8e8eb1
Signed-off-by: Eric Blake <eblake@redhat.com>
plugins/nbd/nbd.c