aboutsummaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorAlex Bligh <alex@alex.org.uk>2016-04-06 10:59:22 -0600
committerPaolo Bonzini <pbonzini@redhat.com>2016-04-08 00:07:44 +0200
commit6ff5816478940c76d3412593e503f644af531d49 (patch)
treed40d901577f09fabb349cd5e410d6289da43b7e0 /po
parent332a254b66b7c801ef9a387c23e92dde81bba51a (diff)
downloadqemu-6ff5816478940c76d3412593e503f644af531d49.zip
qemu-6ff5816478940c76d3412593e503f644af531d49.tar.gz
qemu-6ff5816478940c76d3412593e503f644af531d49.tar.bz2
nbd: Fix NBD unsupported options
nbd-client.c currently fails to handle unsupported options properly. If during option haggling the server finds an option that is unsupported, it returns an NBD_REP_ERR_UNSUP reply. According to nbd's proto.md, the format for such a reply should be: S: 64 bits, 0x3e889045565a9 (magic number for replies) S: 32 bits, the option as sent by the client to which this is a reply S: 32 bits, reply type (e.g., NBD_REP_ACK for successful completion, or NBD_REP_ERR_UNSUP to mark use of an option not known by this server S: 32 bits, length of the reply. This may be zero for some replies, in which case the next field is not sent S: any data as required by the reply (e.g., an export name in the case of NBD_REP_SERVER, or optional UTF-8 message for NBD_REP_ERR_*) However, in nbd-client.c, the reply type was being read, and if it contained an error, it was bailing out and issuing the next option request without first reading the length. This meant that the next option / handshake read had an extra 4 or more bytes of data in it. In practice, this makes Qemu incompatible with servers that do not support NBD_OPT_LIST. To verify this isn't an error in the specification or my reading of it, replies are sent by the reference implementation here: https://github.com/yoe/nbd/blob/66dfb35/nbd-server.c#L1232 and as is evident it always sends a 'datasize' (aka length) 32 bit word. Unsupported elements are replied to here: https://github.com/yoe/nbd/blob/66dfb35/nbd-server.c#L1371 Signed-off-by: Alex Bligh <alex@alex.org.uk> Message-Id: <1459882500-24316-1-git-send-email-alex@alex.org.uk> [rework to ALWAYS consume an optional UTF-8 message from the server] Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1459961962-18771-1-git-send-email-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'po')
0 files changed, 0 insertions, 0 deletions