Displaying 20 results from an estimated 37 matches for "nbd_max_str".
2019 Jun 14
0
[libnbd PATCH 7/7] states: Capture NBD_REP_ERR message
...+ uint32_t len;
+ uint32_t reply;
+
+ len = be32toh (h->sbuf.or.option_reply.replylen);
+ reply = be32toh (h->sbuf.or.option_reply.reply);
+ if (!NBD_REP_IS_ERR (reply)) {
+ set_error (0, "handshake: unexpected option reply type %d", reply);
+ return -1;
+ }
+
+ assert (NBD_MAX_STRING < sizeof h->sbuf.or.payload);
+ if (len > NBD_MAX_STRING) {
+ set_error (0, "handshake: option error string too long");
+ return -1;
+ }
+
+ if (len > 0)
+ debug (h, "handshake: server error message: %.*s", (int) len,
+ h->sbuf.or.payload....
2019 Sep 28
2
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
.....3b5d144e 100644
> --- a/server/protocol-handshake-newstyle.c
> +++ b/server/protocol-handshake-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?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows insta...
2019 Sep 28
11
[nbdkit PATCH v2 0/7] Spec compliance patches
Since the v1 series (0/4, at [1]), I've applied patches 1 and 2,
rewritten patch 3 [Forbid NUL in export and context names] into patch
4 here, patch 4 there turned into patch 6 here, and everything else
here is new.
[1]https://www.redhat.com/archives/libguestfs/2019-September/msg00180.html
I don't know if there is a handy reusable function for checking
whether a string contains valid
2019 Sep 28
0
[nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
...ocol-handshake-newstyle.c
index 34958360..3b5d144e 100644
--- a/server/protocol-handshake-newstyle.c
+++ b/server/protocol-handshake-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)
/* Receive newstyle options. */
static int
@@ -255,7 +255,7 @@ negotiate_handshake_newstyle_options (struct connection *conn)
uint64_t version;
uint32_t option;
uint32_t optlen;
- char data[MAX_OPTION_LENGTH+1];
+ CLEANUP_FREE char *data = NULL;
struct nbd_export_name_optio...
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 Jul 29
3
[libnbd PATCH 0/2] Expose export description
An incremental improvement on top of listing exports. I still think
it's worth experimenting with revisiting how our API for list mode
should actually work [1] (so that we can reuse a single connection for
both grabbing the list and finally using NBD_OPT_GO), but this change
was easier to whip together while still thinking about that.
[1]
2019 Oct 18
0
[PATCH nbdkit] Add support for AF_VSOCK.
...N:
+#ifdef AF_VSOCK
+ vsock = true;
+ break;
+#else
+ fprintf (stderr, "%s: AF_VSOCK is not supported on this platform\n",
+ program_name);
+ exit (EXIT_FAILURE);
+#endif
+
case 'e':
exportname = optarg;
if (strnlen (exportname, NBD_MAX_STRING + 1) > NBD_MAX_STRING) {
@@ -826,15 +842,22 @@ start_serving (void)
size_t nr_socks;
size_t i;
- /* If the user has mixed up -p/-U/-s options, then give an error.
+ /* If the user has mixed up -p/--run/-s/-U/--vsock options, then
+ * give an error.
*
* XXX Actually the ser...
2019 Oct 18
1
[PATCH nbdkit v2] Add support for AF_VSOCK.
v1 was discussed here:
https://www.redhat.com/archives/libguestfs/2019-October/thread.html#00100
v2:
- Bind to VMADDR_CID_ANY (instead of HOST) and update the
documentation accordingly.
- Don't bother with SOCK_CLOEXEC fallback path that can
never be used.
Rich.
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...lts of nbd_opt_list. */
- size_t nr_exports;
- struct export *exports;
+ struct command_cb opt_cb;
/* Full info mode. */
bool full_info;
@@ -186,7 +192,7 @@ struct nbd_handle {
union {
struct {
struct nbd_fixed_new_option_reply_server server;
- char str[NBD_MAX_STRING * 2]; /* name and description */
+ char str[NBD_MAX_STRING * 2 + 1]; /* name, description, NUL */
} __attribute__((packed)) server;
struct nbd_fixed_new_option_reply_info_export export;
struct nbd_fixed_new_option_reply_info_block_size block_size;
@@ -324,14 +...
2019 Jun 14
1
Re: [libnbd PATCH 7/7] states: Capture NBD_REP_ERR message
...t; + len = be32toh (h->sbuf.or.option_reply.replylen);
> + reply = be32toh (h->sbuf.or.option_reply.reply);
> + if (!NBD_REP_IS_ERR (reply)) {
> + set_error (0, "handshake: unexpected option reply type %d", reply);
> + return -1;
> + }
> +
> + assert (NBD_MAX_STRING < sizeof h->sbuf.or.payload);
Missing an addition of #include <assert.h>.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
2019 Sep 30
0
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
...server/protocol-handshake-newstyle.c
>> +++ b/server/protocol-handshake-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 l...
2019 Sep 28
0
[nbdkit PATCH v2 6/7] server: Fix OPT_GO on different export than SET_META_CONTEXT
...e-newstyle.c | 16 +++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/server/internal.h b/server/internal.h
index e6a22f1a..97e417f9 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -200,6 +200,7 @@ struct connection {
size_t nr_handles;
char exportname[NBD_MAX_STRING + 1];
+ uint32_t exportnamelen;
uint32_t cflags;
uint16_t eflags;
bool using_tls;
diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c
index 3b5d144e..2480d7a3 100644
--- a/server/protocol-handshake-newstyle.c
+++ b/server/protocol-handshake-newstyle...
2019 Oct 18
2
[PATCH nbdkit] Add support for AF_VSOCK.
This is a series of patches to libnbd and nbdkit adding AF_VSOCK
support.
On the host side it allows you to start an nbdkit instance which
listens on a virtio-vsock socket:
$ ./nbdkit -fv --vsock memory 1G
...
nbdkit: debug: bound to vsock 2:10809
On the guest side you can then use libnbd to connect to the server:
$ ./run nbdsh -c 'h.connect_vsock(2, 10809)' -c
2019 Sep 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
...eXXtoh or htobeXX when reading or writing
+ * order, so you must use beXXtoh or htobeXX when reading or writing
* these structures.
*/
+#if defined(__GNUC__) || defined(__clang__)
+#define NBD_ATTRIBUTE_PACKED __attribute__((__packed__))
+#else
+#define NBD_ATTRIBUTE_PACKED
+#endif
+
#define NBD_MAX_STRING 4096 /* Maximum length of a string field */
/* Old-style handshake. */
@@ -50,7 +56,7 @@ struct nbd_old_handshake {
uint16_t gflags; /* global flags */
uint16_t eflags; /* per-export flags */
char zeroes[124]; /* must be sent as zero bytes */
-} __attr...
2020 Jul 24
4
[libnbd PATCH 0/3] Expose server block size constraints
Necessary when writing a client that wants to avoid unnecessary EINVAL
errors from sending unaligned requests.
At some point, we may want to add synchronous convenience API wrappers
that do request splitting or read-modify-write to obey server
constraints while still appearing to the library client as accepting
any possible request. But such a wrapper should only be synchronous
and not copied to
2020 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...lts of nbd_opt_list. */
- size_t nr_exports;
- struct export *exports;
+ struct command_cb opt_cb;
/* Full info mode. */
bool full_info;
@@ -186,7 +192,7 @@ struct nbd_handle {
union {
struct {
struct nbd_fixed_new_option_reply_server server;
- char str[NBD_MAX_STRING * 2]; /* name and description */
+ char str[NBD_MAX_STRING * 2 + 1]; /* name, description, NUL */
} __attribute__((packed)) server;
struct nbd_fixed_new_option_reply_info_export export;
struct nbd_fixed_new_option_reply_info_block_size block_size;
@@ -324,14 +...
2019 Sep 24
11
[PATCH nbdkit 0/4] common/protocol: Unify public <nbd-protocol.h>
We should have only one NBD protocol file. Let's make nbdkit's
version the canonical one, and use it in libnbd.
Rich.
2019 Sep 28
3
Re: [nbdkit PATCH v2 5/7] server: Allow longer NBD_OPT
.....3b5d144e 100644
> --- a/server/protocol-handshake-newstyle.c
> +++ b/server/protocol-handshake-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)
>
> /* Receive newstyle options. */
> static int
> @@ -255,7 +255,7 @@ negotiate_handshake_newstyle_options (struct connection *conn)
> uint64_t version;
> uint32_t option;
> uint32_t optlen;
> - char data[MAX_OPTION_LENGTH+1];
> + CLEANUP_FREE char...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...eXXtoh or htobeXX when reading or writing
+ * order, so you must use beXXtoh or htobeXX when reading or writing
* these structures.
*/
+#if defined(__GNUC__) || defined(__clang__)
+#define NBD_ATTRIBUTE_PACKED __attribute__((__packed__))
+#else
+#define NBD_ATTRIBUTE_PACKED
+#endif
+
#define NBD_MAX_STRING 4096 /* Maximum length of a string field */
/* Old-style handshake. */
@@ -55,7 +56,7 @@ struct nbd_old_handshake {
uint16_t gflags; /* global flags */
uint16_t eflags; /* per-export flags */
char zeroes[124]; /* must be sent as zero bytes */
-} __attr...
2020 Jul 21
3
[PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
.../* -e */
bool foreground; /* -f */
const char *ipaddr; /* -i */
enum log_to log_to = LOG_TO_DEFAULT; /* --log */
@@ -345,13 +344,7 @@ main (int argc, char *argv[])
break;
case 'e':
- exportname = optarg;
- if (strnlen (exportname, NBD_MAX_STRING + 1) > NBD_MAX_STRING) {
- nbdkit_error ("export name too long");
- exit (EXIT_FAILURE);
- }
- /* TODO: Check that name is valid UTF-8? */
- newstyle = true;
+ /* Does nothing, ignored for compatibility with older nbdkit. */
break;
cas...