diff options
author | Eric Blake <eblake@redhat.com> | 2018-01-10 17:08:24 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2018-01-17 20:14:12 -0600 |
commit | 894e02804c862c6940b43a0a488164655d3fb3f0 (patch) | |
tree | 9994f5b536c702f336f6c5e34f051ba750c75dcc /.exrc | |
parent | 41f5dfafbb158d2bed0b6abcb7d16b77c56ea5a1 (diff) |
nbd/server: Add helper functions for parsing option payload
Rather than making every callsite perform length sanity checks
and error reporting, add the helper functions nbd_opt_read()
and nbd_opt_drop() that use the length stored in the client
struct; also add an assertion that optlen is 0 before any
option (ie. any previous option was fully handled), complementing
the assertion added in an earlier patch that optlen is 0 after
all negotiation completes.
Note that the call in nbd_negotiate_handle_export_name() does
not use the new helper (in part because the server cannot
reply to NBD_OPT_EXPORT_NAME - it either succeeds or the
connection drops).
Based on patches by Vladimir Sementsov-Ogievskiy.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20180110230825.18321-6-eblake@redhat.com>
Diffstat (limited to '.exrc')
0 files changed, 0 insertions, 0 deletions