search for: nbd_opt_set_meta_context

Displaying 20 results from an estimated 55 matches for "nbd_opt_set_meta_context".

2019 Sep 28
2
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
On Fri, Sep 27, 2019 at 11:48:47PM -0500, Eric Blake wrote: > Fixes the fact that clients could not request the maximum string > length except with NBD_OPT_EXPORT_LEN. Updates the testsuite to > match. > > Signed-off-by: Eric Blake <eblake@redhat.com> > --- > server/protocol-handshake-newstyle.c | 12 +++++++----- > tests/test-long-name.sh | 10
2020 Sep 28
0
[libnbd PATCH 3/3] api: Add nbd_opt_list_meta_context
...if (h->opt_current == NBD_OPT_LIST_META_CONTEXT) { + assert (h->opt_mode); + assert (h->structured_replies); + assert (CALLBACK_IS_NOT_NULL (h->opt_cb.fn.context)); + opt = h->opt_current; + } + else { + assert (CALLBACK_IS_NULL (h->opt_cb.fn.context)); + opt = NBD_OPT_SET_META_CONTEXT; + if (!h->structured_replies || + nbd_internal_string_list_length (h->request_meta_contexts) == 0) { + SET_NEXT_STATE (%^OPT_GO.START); + return 0; + } } assert (h->meta_contexts == NULL); @@ -44,7 +54,7 @@ STATE_MACHINE { len += 4 /* length of query */...
2020 Sep 28
8
[libnbd PATCH 0/3] opt_list_meta_context
I'm posting this now, as I'm at the end of a workday and I got things working for manual experimentation. Still to do: - write interop tests for qemu-nbd and nbdkit (including my proposed patch addition of qemu-nbd -A to show qemu:allocation-depth) - figure out if we can make 'nbdinfo --map' use the new API to automatically select all contexts advertised by the server Eric Blake
2020 Jul 21
4
[PATCH nbdkit] server: Pass the export name through filter .open calls.
...xportname) parameter if they need the export name. Filter .reopen also takes the exportname. The only filter that uses it (retry) must save the exportname from .open in order to pass it to .reopen. This filter already does the same for the readonly flag so this seems reasonable. The handling of NBD_OPT_SET_META_CONTEXT interacted with the export name (see commit 20b8509a9ccdab118ce7b7043be63bbad74f1e79). I have attempted to keep previous behaviour in this change, but note that there is no regression test for this. I added a debug message so we can tell when this unusual case actually happens which should help w...
2020 Aug 02
2
[nbdkit] Failure in test-retry-size.sh
...t.sh preconnect: status 2 nbdkit: sh[1]: debug: newstyle negotiation: flags: global 0x3 nbdkit: sh[1]: debug: newstyle negotiation: client flags: 0x3 nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_STRUCTURED_REPLY: client requested structured replies nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: client requested export '' nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: set count: 1 nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: set base:allocation nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: replying with base:a...
2019 Jun 14
10
[libnbd PATCH 0/7] state machine refactoring
I'm still playing with ideas on how to split rstate from wstate (so that we can send a request without waiting for POLLIN to complete a pending reply), but this is some preliminary refactoring I found useful. I also fixed a couple of bugs while in the area (already pushed). There's a question of whether we want nbd_handle to be nearly 5k, or if we should instead keep it small and add one
2020 Aug 03
0
Re: [nbdkit] Failure in test-retry-size.sh
...tus 2 > nbdkit: sh[1]: debug: newstyle negotiation: flags: global 0x3 > nbdkit: sh[1]: debug: newstyle negotiation: client flags: 0x3 > nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_STRUCTURED_REPLY: client requested structured replies > nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: client requested export '' > nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: set count: 1 > nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: set base:allocation > nbdkit: sh[1]: debug: newstyle negotiation: NBD_OPT_SET_META_CONTEXT: reply...
2019 Mar 20
0
[PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
...); + return -1; + } + + return 0; +} + /* Sub-function during negotiate_handshake_newstyle, to uniformly handle * a client hanging up on a message boundary. */ @@ -452,6 +480,8 @@ negotiate_handshake_newstyle_options (struct connection *conn) case NBD_OPT_LIST_META_CONTEXT: case NBD_OPT_SET_META_CONTEXT: { + int r; + bool can_extents; uint32_t opt_index; uint32_t exportnamelen; uint32_t nr_queries; @@ -469,6 +499,16 @@ negotiate_handshake_newstyle_options (struct connection *conn) continue; } + /* Work out if the server s...
2019 Sep 30
0
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
...ke-newstyle.c >> @@ -48,7 +48,7 @@ >> #define MAX_NR_OPTIONS 32 >> >> /* Maximum length of any option data (bytes). */ >> -#define MAX_OPTION_LENGTH 4096 >> +#define MAX_OPTION_LENGTH (NBD_MAX_STRING * 4) > > I may have missed it - why was * 4 chosen? NBD_OPT_SET_META_CONTEXT allows two strings plus a few glue bytes, so more than 8k of data from a compliant client. 16k is the next power of 2. We can bump it larger if we want, especially since 16k pales in comparison to our 32M limit on NBD_CMD_WRITE, but for now, there is nothing in the NBD protocol larger than NB...
2019 Mar 08
1
[PATCH nbdkit] server: Implement minimal implementation of set/list metadata contexts.
...ndex 0aadd46..b03555e 100644 --- a/server/protocol.h +++ b/server/protocol.h @@ -105,6 +105,8 @@ extern const char *name_of_nbd_opt (int); #define NBD_OPT_INFO 6 #define NBD_OPT_GO 7 #define NBD_OPT_STRUCTURED_REPLY 8 +#define NBD_OPT_LIST_META_CONTEXT 9 +#define NBD_OPT_SET_META_CONTEXT 10 extern const char *name_of_nbd_rep (int); #define NBD_REP_ACK 1 diff --git a/server/connections.c b/server/connections.c index aeb27f8..7e32f00 100644 --- a/server/connections.c +++ b/server/connections.c @@ -926,6 +926,90 @@ _negotiate_handshake_newstyle_options (struct connectio...
2019 Sep 28
0
[nbdkit PATCH v2 6/7] server: Fix OPT_GO on different export than SET_META_CONTEXT
...n), (int) exportnamelen, buf); @@ -451,7 +455,9 @@ negotiate_handshake_newstyle_options (struct connection *conn) } /* As with NBD_OPT_EXPORT_NAME we print the export name and - * save it in the connection. + * save it in the connection. If an earlier + * NBD_OPT_SET_META_CONTEXT used an export name, it must match + * or else we drop the support for that context. */ if (check_export_name (conn, option, &data[4], exportnamelen, optlen - 6, true) == -1) @@ -574,12 +580,16 @@ negotiate_handshake_newstyle_options (s...
2019 Sep 19
0
[nbdkit PATCH 4/4] server: Fix OPT_GO on different export than SET_META_CONTEXT
...return -1; @@ -420,14 +421,21 @@ negotiate_handshake_newstyle_options (struct connection *conn) } /* As with NBD_OPT_EXPORT_NAME we print the export name and - * save it in the connection. + * save it in the connection. For NBD_OPT_GO, if an earlier + * NBD_OPT_SET_META_CONTEXT used an export name, it must match + * or else we drop the support for that context. */ + if (option == NBD_OPT_GO && conn->meta_context_base_allocation && + (exportnamelen != conn->exportnamelen || + memcmp (conn->exportname,...
2023 Mar 03
1
[PATCH v2 5/6] spec: Introduce NBD_FLAG_BLOCK_STATUS_PAYLOAD
...dvertise this bit unless the client successfully negotiates > > + extended headers via `NBD_OPT_EXTENDED_HEADERS`, and SHOULD NOT > > + advertise this bit in response to `NBD_OPT_EXPORT_NAME` or > > + `NBD_OPT_GO` if the client does not negotiate metacontexts with > > + `NBD_OPT_SET_META_CONTEXT`; clients SHOULD NOT set the > > + `NBD_CMD_FLAG_PAYLOAD_LEN` flag for `NBD_CMD_BLOCK_STATUS` unless > > + this transmission flag is set. > > Given that we are introducing this at the same time as the extended > headers (and given that we're running out of available flag...
2020 Sep 28
0
[libnbd PATCH 2/3] generator: Rename OPT_SET_META_CONTEXT states
...ONTEXT", newstyle_opt_meta_context_state_machine); Group ("OPT_GO", newstyle_opt_go_state_machine); Group ("OPT_EXPORT_NAME", newstyle_opt_export_name_state_machine); @@ -453,8 +453,8 @@ and newstyle_opt_structured_reply_state_machine = [ }; ] -(* Fixed newstyle NBD_OPT_SET_META_CONTEXT option. *) -and newstyle_opt_set_meta_context_state_machine = [ +(* Fixed newstyle NBD_OPT_SET/LIST_META_CONTEXT option. *) +and newstyle_opt_meta_context_state_machine = [ State { default_state with name = "START"; diff --git a/generator/states-newstyle-opt-set-meta-context....
2019 Sep 19
7
[nbdkit PATCH 0/4] Spec compliance patches
The first one is the nastiest - it is an assertion failure caused by a spec-compliant client and introduced by our security fix that was released in 1.14.1. Eric Blake (4): server: Fix regression for NBD_OPT_INFO before NBD_OPT_GO server: Fix back-to-back SET_META_CONTEXT server: Forbid NUL in export and context names server: Fix OPT_GO on different export than SET_META_CONTEXT
2019 Mar 23
2
Re: nbdkit & qemu 2.12: qemu-img: Protocol error: simple reply when structured reply chunk was expected
...around in nbdkit. > > > > And what workaround would that be? Looking at the qemu patch, the > problem is that qemu asked for "base:allocation" and nbdkit replied with > 0 contexts. The workaround would either be to reply with > NBD_REP_ERR_UNSUP (the behavior before NBD_OPT_SET_META_CONTEXT was > added), or to implement "base:allocation" (even if we implement the > poor-man's version that always reports that the entire image is data, > for all requests, without any feedback from the plugins). The former > feels odd, but the latter seems oddly appealing as pr...
2023 Jul 16
1
[libnbd PATCH] api: Fix block status assertion under set_strict bypass
...t warrant a CVE. However, since it is a case where a server's reply can prompt a libnbd denial of service crash, I will be sending a security announcement and upcoming patch be to the libnbd-security man page once backports are in place. Fixes: 55b09667 ("api: Fix nbd_can_meta_context if NBD_OPT_SET_META_CONTEXT fails", v1.15.3) Signed-off-by: Eric Blake <eblake at redhat.com> --- generator/states-reply-chunk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generator/states-reply-chunk.c b/generator/states-reply-chunk.c index 02c65414..26b8a6b0 100644 --- a/generator/states-reply-chunk.c +...
2022 Nov 14
2
[PATCH v2 3/6] spec: Add NBD_OPT_EXTENDED_HEADERS
...l connections to the given device. In particular, if this flag is @@ -1212,10 +1309,10 @@ of the newstyle negotiation. When this command succeeds, the server MUST NOT preserve any negotiation state (such as a request for - `NBD_OPT_STRUCTURED_REPLY`, or metadata contexts from - `NBD_OPT_SET_META_CONTEXT`) issued before this command. A client - SHOULD defer all stateful option requests until after it - determines whether encryption is available. + `NBD_OPT_STRUCTURED_REPLY` or `NBD_OPT_EXTENDED_HEADERS`, or + metadata contexts from `NBD_OPT_SET_META_CONTEXT`) issued before + this co...
2019 Apr 25
6
[nbdkit PATCH v2 0/5] structured replies/.extents for nbd plugin
Updated based on other changes that have happened in the meantime: - rely more on cleanup.h (throughout) - split structured read for easier review (patch 2 and 3 were combined in v1) - rely on nbdkit not leaking a server's partial answer (patch 3) - add tests (patch 5) - other bug fixes I found while testing it - drop EOVERFLOW patch for now; it will be separate once upstream NBD protocol
2020 Oct 02
4
[libnbd PATCH v2 0/2] opt_list_meta_context
In v2: ack'ed preliminary patches have been pushed, and I've added a lot of testsuite coverage as well as putting the new API to use in nbdinfo. Eric Blake (2): api: Add nbd_opt_list_meta_context info: List available meta-contexts lib/internal.h | 1 + generator/API.ml | 84 ++++++++-