Displaying 20 results from an estimated 33 matches for "nbd_can_meta_context".
2019 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function
rather than libnbd-api.3 (nice), but in doing so got stumped by a
problem with a fresh git clone (automake fails for any 'include'
directive that does not already exist). I've figured out how to hack
around it, but the hack requires GNU make. We already use GNU make
constructs elsewhere (such as $(wildcard)), but
2020 Sep 28
0
[libnbd PATCH 1/3] api: Add get_nr_meta_contexts, clear_meta_contexts
...whether blocks of data are allocated, zero or sparse).
+
+This command returns how many meta contexts have been added to
+the list to request from the server via L<nbd_add_meta_context(3)>.
+The server is not obligated to honor all of the requests; to see
+what it actually supports, see L<nbd_can_meta_context(3)>.";
+ see_also = [Link "block_status"; Link "can_meta_context";
+ Link "add_meta_context"; Link "get_meta_context";
+ Link "clear_meta_contexts"];
+ };
+
+ "get_meta_context", {
+ default_ca...
2019 Jun 27
0
Re: [libnbd PATCH] generator: Add support for namespace constants
...ollowup to your patch, to add more
documentation about the constants, and to use them in our testsuite:
diff --git i/generator/generator w/generator/generator
index 9d8d257..1cfcb3d 100755
--- i/generator/generator
+++ w/generator/generator
@@ -1118,7 +1118,10 @@ was actually negotiated, call
C<nbd_can_meta_context> after
connecting.
The single parameter is the name of the metadata context,
-for example C<\"base:allocation\">.
+for example C<LIBNBD_CONTEXT_BASE_ALLOCATION>.
+B<E<lt>libnbd.hE<gt>> includes defined constants beginning with
+C<LIBNBD_CONTEXT_>...
2020 Oct 17
1
[libnbd PATCH] info: Keep request within 4G bound
...69,7 @@ main (int argc, char *argv[])
fprintf (fp, "%" PRIi64 "\n", size);
}
else if (map) { /* --map (!list_all) */
- uint64_t offset, prev_offset;
+ uint64_t offset, prev_offset, align, max_len;
/* Did we get the requested map? */
if (!nbd_can_meta_context (nbd, map)) {
@@ -276,6 +278,8 @@ main (int argc, char *argv[])
progname, map);
exit (EXIT_FAILURE);
}
+ align = nbd_get_block_size (nbd, LIBNBD_SIZE_MINIMUM) ?: 512;
+ max_len = UINT32_MAX - align + 1;
size = nbd_get_size (nbd);
if (size == -1) {
@@ -28...
2019 Sep 17
1
[libnbd PATCH] api: Add nbd_get_structured_replies_negotiated
...server to fail the negotiation
request.";
see_also = ["L<nbd_get_request_structured_replies(3)>";
"L<nbd_set_handshake_flags(3)>";
+ "L<nbd_get_structured_replies_negotiated(3)>";
"L<nbd_can_meta_context(3)>"; "L<nbd_can_df(3)>"];
};
@@ -1322,10 +1323,26 @@ request.";
shortdesc = "see if structured replies are attempted";
longdesc = "\
Return the state of the request structured replies flag on this
-handle. Note that this only reports whet...
2019 Sep 16
2
[LIBNBD SECURITY PATCH 0/1] NBD Protocol Downgrade Attack in libnbd
...Either of the following
extension tests will prove that a newstyle server is present
(unfortunately, this does not help for a newstyle server that does not
support either extension):
- If nbd_can_df(h) returns true.
- If the client requests nbd_add_meta_context(h, context) prior to
connection, then nbd_can_meta_context(h, context) returns true; the
most commonly supported context is LIBNBD_CONTEXT_BASE_ALLOCATION.
Test if libnbd is vulnerable
----------------------------
Run the following command (tested with nbdkit 1.12 or newer):
$ nbdsh -c 'h.set_tls(nbd.TLS_REQUIRE)' \
-c 'h.connect_command([...
2023 Jul 16
1
[libnbd PATCH] api: Fix block status assertion under set_strict bypass
...tatus call),
this did not 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/gene...
2019 Jun 27
3
[libnbd PATCH] generator: Add support for namespace constants
This just defines the namespace, its contexts and related constants and the only
supported one is currently base:allocation. The names of the constants are not
very future-proof, but shorter than LIBNBD_META_NS_CONTEXT_BASE_ALLOCATION or
similar.
Currently the output looks like this:
/* "base" namespace */
/* "base" namespace contexts */
/* "base:allocation"
2019 Sep 04
2
[libnbd PATCH] api: Add way to avoid structured replies
...]; ret = RErr;
+ permitted_states = [ Created ];
+ first_version = (1, 2);
+ shortdesc = "control use of structured replies";
+ longdesc = "\
+By default, libnbd tries to negotiate structured replies with the
+server, as this protocol extension must be in use before
+C<nbd_can_meta_context> or C<nbd_can_df> can return true. However,
+for integration testing, it can be useful to clear this flag
+rather than find a way to alter the server to fail the negotiation
+request.";
+ see_also = ["L<nbd_get_request_structured_replies(3)>";
+ &quo...
2019 Aug 15
3
[nbdkit PATCH] nbd: Another libnbd version bump
...dle;
- int i = nbd_read_only (h->nbd);
+ int i = nbd_is_read_only (h->nbd);
if (i == -1) {
nbdkit_error ("failure to check readonly flag: %s", nbd_get_error ());
@@ -674,7 +676,7 @@ static int
nbdplug_can_extents (void *handle)
{
struct handle *h = handle;
- int i = nbd_can_meta_context (h->nbd, "base:allocation");
+ int i = nbd_can_meta_context (h->nbd, LIBNBD_CONTEXT_BASE_ALLOCATION);
if (i == -1) {
nbdkit_error ("failure to check extents ability: %s", nbd_get_error ());
@@ -693,8 +695,8 @@ nbdplug_pread (void *handle, void *buf, uint32_t coun...
2023 Aug 03
1
[libnbd PATCH v4 20/25] generator: Actually request extended headers
...eta_context(3)>
+at other times in the negotiation sequence; and even when using
+just L<nbd_opt_info(3)>, it can be faster to collect the server's
results by relying on the callback function passed to
L<nbd_opt_list_meta_context(3)> than a series of post-process
calls to L<nbd_can_meta_context(3)>.
Note that this control has no effect if the server does not
-negotiate structured replies, or if the client did not request
-any contexts via L<nbd_add_meta_context(3)>. Setting this
-control to false may cause L<nbd_block_status(3)> to fail.";
+negotiate structured repl...
2020 Aug 19
3
[libnbd PATCH 0/2] NBD_OPT_INFO support
This replaces 13/13 of my v2 series; and now that it has pretty good
testsuite coverage and demonstrable performance improvement to
nbdinfo, I'm going ahead and pushing this now. We may still want to
add further nbd_opt_* commands for other fine-grained tuning of
negotiation, but for now, I think things have stabilized on this end,
and I can return to polishing .list_exports on the nbdkit
2020 Sep 29
0
[PATCH libnbd] DO NOT PUSH: Update api: Add get_nr_meta_contexts, clear_meta_contexts
---
generator/API.ml | 2 +-
lib/handle.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/generator/API.ml b/generator/API.ml
index 770f41e..fd6f033 100644
--- a/generator/API.ml
+++ b/generator/API.ml
@@ -1024,7 +1024,7 @@ what it actually supports, see L<nbd_can_meta_context(3)>.";
"get_meta_context", {
default_call with
- args = [ Int "i" ]; ret = RString;
+ args = [ SizeT "i" ]; ret = RString;
shortdesc = "return the i'th meta context request";
longdesc = "\
During connection libnbd c...
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
2019 Aug 14
0
[libnbd PATCH 2/2] docs: Drop docs/Makefile.inc from git
...d_set_tls_psk_file \
- nbd_add_meta_context \
- nbd_connect_uri \
- nbd_connect_unix \
- nbd_connect_tcp \
- nbd_connect_command \
- nbd_is_read_only \
- nbd_can_flush \
- nbd_can_fua \
- nbd_is_rotational \
- nbd_can_trim \
- nbd_can_zero \
- nbd_can_df \
- nbd_can_multi_conn \
- nbd_can_cache \
- nbd_can_meta_context \
- nbd_get_size \
- nbd_pread \
- nbd_pread_structured \
- nbd_pwrite \
- nbd_shutdown \
- nbd_flush \
- nbd_trim \
- nbd_cache \
- nbd_zero \
- nbd_block_status \
- nbd_poll \
- nbd_aio_connect \
- nbd_aio_connect_uri \
- nbd_aio_connect_unix \
- nbd_aio_connect_tcp \
- nbd_aio_connect_command \...
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...esting, it can be useful to clear this flag
rather than find a way to alter the server to fail the negotiation
request.";
see_also = ["L<nbd_get_request_structured_replies(3)>";
+ "L<nbd_set_handshake_flags(3)>";
"L<nbd_can_meta_context(3)>"; "L<nbd_can_df(3)>"];
};
@@ -1277,6 +1285,66 @@ able to honor that request";
see_also = ["L<nbd_set_request_structured_replies(3)>"];
};
+ "set_handshake_flags", {
+ default_call with
+ args = [ Flags ("flags"...
2019 Aug 15
1
[PATCH libnbd] docs: Change docs/Makefile.inc back to a regular include, readd to git.
...d_set_tls_psk_file \
+ nbd_add_meta_context \
+ nbd_connect_uri \
+ nbd_connect_unix \
+ nbd_connect_tcp \
+ nbd_connect_command \
+ nbd_is_read_only \
+ nbd_can_flush \
+ nbd_can_fua \
+ nbd_is_rotational \
+ nbd_can_trim \
+ nbd_can_zero \
+ nbd_can_df \
+ nbd_can_multi_conn \
+ nbd_can_cache \
+ nbd_can_meta_context \
+ nbd_get_size \
+ nbd_pread \
+ nbd_pread_structured \
+ nbd_pwrite \
+ nbd_shutdown \
+ nbd_flush \
+ nbd_trim \
+ nbd_cache \
+ nbd_zero \
+ nbd_block_status \
+ nbd_poll \
+ nbd_aio_connect \
+ nbd_aio_connect_uri \
+ nbd_aio_connect_unix \
+ nbd_aio_connect_tcp \
+ nbd_aio_connect_command \...
2019 Jun 04
0
[libnbd PATCH 2/2] api: Recover from block status callback failure
...ap.c | 65 +++++++++++++++++++++++------
3 files changed, 86 insertions(+), 41 deletions(-)
diff --git a/generator/generator b/generator/generator
index 91545ce..1261d54 100755
--- a/generator/generator
+++ b/generator/generator
@@ -1414,7 +1414,10 @@ supported by the server (see C<nbd_can_meta_context>) this call
returns information about extents by calling back to the
extent function. The callback cannot call C<nbd_*> APIs on the
same handle since it holds the handle lock and will
-cause a deadlock.
+cause a deadlock. If the callback returns C<-1>, any remaining
+contexts wi...
2023 Jul 16
2
[libnbd PATCH] api: Fix block status assertion under set_strict bypass
...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 0...
2020 Sep 26
1
[PATCH nbdinfo proposal] info: Add a --map option for displaying allocation metadata
This is a rough-and-ready implementation of nbdinfo --map option, to
display the allocation and other metadata of NBD exports. I only
tested it lightly against nbdkit. It needs at least some tests.
Command like these should work:
nbdinfo --map nbd://localhost
nbdinfo --map=qemu:dirty-bitmap nbd://localhost
Rich.