Displaying 20 results from an estimated 20 matches for "new_handshake".
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...3 @@ struct nbd_old_handshake {
char zeroes[124]; /* must be sent as zero bytes */
} NBD_ATTRIBUTE_PACKED;
+#define NBD_MAGIC UINT64_C(0x4e42444d41474943) /* ASCII "NBDMAGIC" */
#define NBD_OLD_VERSION UINT64_C(0x420281861253)
/* New-style handshake. */
struct nbd_new_handshake {
- char nbdmagic[8]; /* "NBDMAGIC" */
+ uint64_t nbdmagic; /* NBD_MAGIC */
uint64_t version; /* NBD_NEW_VERSION */
uint16_t gflags; /* global flags */
} NBD_ATTRIBUTE_PACKED;
-#define NBD_NEW_VERSION UINT64_C(0x49484156454F5054)
+#define...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...* global flags */
uint16_t eflags; /* per-export flags */
char zeroes[124]; /* must be sent as zero bytes */
} __attribute__((packed));
-#define OLD_VERSION UINT64_C(0x420281861253)
+#define NBD_OLD_VERSION UINT64_C(0x420281861253)
/* New-style handshake. */
-struct new_handshake {
+struct nbd_new_handshake {
char nbdmagic[8]; /* "NBDMAGIC" */
- uint64_t version; /* NEW_VERSION */
+ uint64_t version; /* NBD_NEW_VERSION */
uint16_t gflags; /* global flags */
} __attribute__((packed));
-#define NEW_VERSION UINT64_C...
2018 Aug 06
3
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
There's no substantial difference over v1, I simply fixed a few
whitespace issues, moved one struct around and tidied up the comments.
Rich.
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...-0500, Eric Blake wrote:
> diff --git a/generator/states-magic.c b/generator/states-magic.c
> index 944728d..2ad3a96 100644
> --- a/generator/states-magic.c
> +++ b/generator/states-magic.c
...
> @@ -42,8 +42,10 @@ STATE_MACHINE {
> }
>
> version = be64toh (h->sbuf.new_handshake.version);
> - if (version == NBD_NEW_VERSION)
> + if (version == NBD_NEW_VERSION) {
> + h->sbuf.option.option = 0;
> SET_NEXT_STATE (%.NEWSTYLE.START);
> + }
> else if (version == NBD_OLD_VERSION)
> SET_NEXT_STATE (%.OLDSTYLE.START);
> else {
What d...
2020 Aug 11
3
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...--git a/generator/states-magic.c b/generator/states-magic.c
>> index 944728d..2ad3a96 100644
>> --- a/generator/states-magic.c
>> +++ b/generator/states-magic.c
> ...
>> @@ -42,8 +42,10 @@ STATE_MACHINE {
>> }
>>
>> version = be64toh (h->sbuf.new_handshake.version);
>> - if (version == NBD_NEW_VERSION)
>> + if (version == NBD_NEW_VERSION) {
>> + h->sbuf.option.option = 0;
>> SET_NEXT_STATE (%.NEWSTYLE.START);
>> + }
>> else if (version == NBD_OLD_VERSION)
>> SET_NEXT_STATE (%.OLDSTYLE...
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far.
Rich.
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...the existing list_export
code into nbd_opt_list(callback), so that I can also improve --list mode
in nbdinfo.c.
>>> +++ b/generator/states-magic.c
>> ...
>>> @@ -42,8 +42,10 @@ STATE_MACHINE {
>>> }
>>>
>>> version = be64toh (h->sbuf.new_handshake.version);
>>> - if (version == NBD_NEW_VERSION)
>>> + if (version == NBD_NEW_VERSION) {
>>> + h->sbuf.option.option = 0;
>>> SET_NEXT_STATE (%.NEWSTYLE.START);
>>> + }
>>> else if (version == NBD_OLD_VERSION)
>>> ...
2019 Sep 12
0
[nbdkit PATCH 2/2] server: Add --mask-handshake option for integration testing
...;U':
diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c
index 486d416f..9801f7c2 100644
--- a/server/protocol-handshake-newstyle.c
+++ b/server/protocol-handshake-newstyle.c
@@ -673,7 +673,7 @@ protocol_handshake_newstyle (struct connection *conn)
struct new_handshake handshake;
uint16_t gflags;
- gflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES;
+ gflags = (NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES) & mask_handshake;
debug ("newstyle negotiation: flags: global 0x%x", gflags);
@@ -694,7 +694,7 @@ protocol_handshake_newstyle (stru...
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...te machine
- * Copyright (C) 2013-2019 Red Hat Inc.
+ * Copyright (C) 2013-2020 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,8 +42,10 @@ STATE_MACHINE {
}
version = be64toh (h->sbuf.new_handshake.version);
- if (version == NBD_NEW_VERSION)
+ if (version == NBD_NEW_VERSION) {
+ h->sbuf.option.option = 0;
SET_NEXT_STATE (%.NEWSTYLE.START);
+ }
else if (version == NBD_OLD_VERSION)
SET_NEXT_STATE (%.OLDSTYLE.START);
else {
diff --git a/generator/states-newstyle-opt-go.c...
2018 Aug 06
0
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
...rt 0x%x", conn->eflags);
+ return 0;
+}
+
static int
_negotiate_handshake_newstyle_options (struct connection *conn)
{
@@ -581,6 +632,7 @@ _negotiate_handshake_newstyle_options (struct connection *conn)
uint32_t option;
uint32_t optlen;
char data[MAX_OPTION_LENGTH+1];
+ struct new_handshake_finish handshake_finish;
for (nr_options = 0; nr_options < MAX_NR_OPTIONS; ++nr_options) {
if (conn->recv (conn, &new_option, sizeof new_option) == -1) {
@@ -625,7 +677,8 @@ _negotiate_handshake_newstyle_options (struct connection *conn)
}
/* Apart from printing it...
2019 Jun 29
0
[libnbd PATCH 2/6] generator: Allow DEAD state actions to run
...b/generator/states-magic.c
@@ -27,7 +27,7 @@
MAGIC.RECV_MAGIC:
switch (recv_into_rbuf (h)) {
- case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case -1: SET_NEXT_STATE (%.DEAD); return 0;
case 0: SET_NEXT_STATE (%CHECK_MAGIC);
}
return 0;
@@ -38,7 +38,7 @@
if (strncmp (h->sbuf.new_handshake.nbdmagic, "NBDMAGIC", 8) != 0) {
SET_NEXT_STATE (%.DEAD);
set_error (0, "handshake: server did not send expected NBD magic");
- return -1;
+ return 0;
}
version = be64toh (h->sbuf.new_handshake.version);
@@ -49,7 +49,7 @@
else {
SET_NEXT_STATE (...
2019 Sep 12
3
[nbdkit PATCH 0/2] Make client fallback testing easier
This is similar to the recent --no-sr option - it's a change that is
unlikely to ever be used except by someone testing whether a client is
compliant to the protocol, but in that niche case, it can be quite
handy (it's a lot nicer to be able to purposefully cripple a server
from the command line than from a one-off compile, when testing if a
client's fallback for a spec-compliant but
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.
2018 Aug 04
3
[PATCH nbdkit] protocol: Implement NBD_OPT_GO.
This is only lightly tested (against just qemu NBD client), and the
code might be structured a little better as the
_negotiate_handshake_newstyle_options function has now grown to be
huge. Anyway works for me.
Rich.
2020 Aug 14
0
[libnbd PATCH v2 06/13] api: Add nbd_opt_abort and nbd_aio_opt_abort
...te machine
- * Copyright (C) 2013-2019 Red Hat Inc.
+ * Copyright (C) 2013-2020 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,8 +42,10 @@ STATE_MACHINE {
}
version = be64toh (h->sbuf.new_handshake.version);
- if (version == NBD_NEW_VERSION)
+ if (version == NBD_NEW_VERSION) {
+ assert (h->current_opt == 0);
SET_NEXT_STATE (%.NEWSTYLE.START);
+ }
else if (version == NBD_OLD_VERSION)
SET_NEXT_STATE (%.OLDSTYLE.START);
else {
diff --git a/generator/states-newstyle-opt-g...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples
have been updated, but it demonstrates an idea: Should we forget about
the concept of having multiple connections managed under a single
handle?
In this patch there is a single ‘struct nbd_handle *’ which manages a
single state machine and connection (and therefore no nbd_connection).
To connect to a multi-conn server you must
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...gs: export 0x%x", conn->eflags);
- return 0;
-}
-
-static int
-_negotiate_handshake_newstyle_options (struct connection *conn)
-{
- struct new_option new_option;
- size_t nr_options;
- uint64_t version;
- uint32_t option;
- uint32_t optlen;
- char data[MAX_OPTION_LENGTH+1];
- struct new_handshake_finish handshake_finish;
- const char *optname;
-
- for (nr_options = 0; nr_options < MAX_NR_OPTIONS; ++nr_options) {
- if (conn_recv_full (conn, &new_option, sizeof new_option,
- "reading option: conn->recv: %m") == -1)
- return -1;
-
- versi...
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status
implementation. While the patches (especially the second one) are
very large they are really just elementary code motion.
Rich.
2019 Jun 29
19
[libnbd PATCH 0/6] new APIs: aio_in_flight, aio_FOO_notify
I still need to wire in the use of *_notify functions into nbdkit to
prove whether it makes the code any faster or easier to maintain, but
at least the added example shows one good use case for the new API.
Eric Blake (6):
api: Add nbd_aio_in_flight
generator: Allow DEAD state actions to run
generator: Allow Int64 in callbacks
states: Prepare for aio notify callback
api: Add new
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a
single nbd connection for all cases when reading the heads of the
file is not required), but I'm happy with patches 1-11, and 12-13
show where I'm headed for getting NBD_OPT_INFO to work. Posting
now to see if some of the earlier patches are ready to commit while
I continue working on the latter half.
Eric Blake (13):