search for: nbd_flag_fixed_newstyle

Displaying 20 results from an estimated 45 matches for "nbd_flag_fixed_newstyle".

2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...col.h index 04e93d3..699aa22 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -93,9 +93,10 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) -/* Global flags. */ +/* Global flags. Exposed by the generator as LIBNBD_HANDSHAKE_FLAG_* instead #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 + */ /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) @@ -238,10 +239,12 @@ struct nbd_structured_reply_error { #define NBD_CMD_WRITE_ZEROES 6 #define NBD_CMD_BLOCK_STATUS 7 +/* Command flags. Exposed by the generator as...
2019 May 19
0
[libnbd PATCH 4/4] states: Add NBD_OPT_EXPORT_NAME handling
...uot; PRIx32, diff --git a/generator/states-newstyle.c b/generator/states-newstyle.c index f3a07f7..d108244 100644 --- a/generator/states-newstyle.c +++ b/generator/states-newstyle.c @@ -36,9 +36,11 @@ uint32_t cflags; conn->gflags = be16toh (conn->gflags); - if ((conn->gflags & NBD_FLAG_FIXED_NEWSTYLE) == 0) { + if ((conn->gflags & NBD_FLAG_FIXED_NEWSTYLE) == 0 && + h->tls == 2) { SET_NEXT_STATE (%.DEAD); - set_error (0, "handshake: server is not a fixed newstyle NBD server"); + set_error (ENOTSUP, "handshake: server is not fixed newstyle, "...
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
...e replying to */ uint32_t reply; /* NBD_REP_* */ uint32_t replylen; -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) -/* Global flags. Exposed by the generator as LIBNBD_HANDSHAKE_FLAG_* instead +/* Global flags. */ #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 - */ /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) @@ -146,19 +146,19 @@ struct nbd_fixed_new_option_reply_info_export { uint16_t info; /* NBD_INFO_EXPORT */ uint64_t exportsize; /* size of export */...
2019 Sep 24
0
Re: [PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
.../* per-export flags */ > char zeroes[124]; /* optional zeroes */ > -} __attribute__((packed));; > +} NBD_ATTRIBUTE_PACKED;; Double ;; > > -/* Global flags. Exposed by the generator as LIBNBD_HANDSHAKE_FLAG_* instead > +/* Global flags. */ > #define NBD_FLAG_FIXED_NEWSTYLE 1 > #define NBD_FLAG_NO_ZEROES 2 > - */ We won't be using these names in the rest of libnbd, except maybe we should add a compile-time assertion that NBD_FLAG_FIXED_NEWSTYLE == LIBNBD_FLAG_FIXED_NEWSTYLE (ie. that our generator produces public constants in <libnbd.h> that mat...
2019 Sep 25
0
[nbdkit PATCH 2/2] common/protocol: Declare additional constants
...on/protocol/nbd-protocol.h b/common/protocol/nbd-protocol.h index 9bf7171e..bdd1ef21 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -98,8 +98,8 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) /* Global flags. */ -#define NBD_FLAG_FIXED_NEWSTYLE 1 -#define NBD_FLAG_NO_ZEROES 2 +#define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) +#define NBD_FLAG_NO_ZEROES (1 << 1) /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) @@ -143,6 +143,9 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_ERR_TOO_BI...
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...ort flags */ + char zeroes[124]; /* optional zeroes, unless NBD_FLAG_NO_ZEROES */ } NBD_ATTRIBUTE_PACKED; /* Fixed newstyle handshake reply message. */ @@ -95,8 +98,8 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) /* Global flags. */ -#define NBD_FLAG_FIXED_NEWSTYLE 1 -#define NBD_FLAG_NO_ZEROES 2 +#define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) +#define NBD_FLAG_NO_ZEROES (1 << 1) /* Per-export flags. */ #define NBD_FLAG_HAS_FLAGS (1 << 0) @@ -140,6 +143,9 @@ struct nbd_fixed_new_option_reply { #define NBD_REP_ERR_TOO_BI...
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 25
3
[nbdkit PATCH 0/2] more protocol.h tweaks
More nbd-protocol.h improvements Eric Blake (2): common/protocol: Switch nbdmagic to uint64_t common/protocol: Declare additional constants common/protocol/nbd-protocol.h | 16 ++++++++++------ server/protocol-handshake-newstyle.c | 2 +- server/protocol-handshake-oldstyle.c | 2 +- plugins/nbd/nbd-standalone.c | 2 +- tests/test-layers.c | 2 +- 5 files
2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...RIM; - conn->can_trim = 1; - } debug ("oldstyle negotiation: flags: global 0x%x export 0x%x", gflags, eflags); @@ -552,7 +561,6 @@ _negotiate_handshake_newstyle (struct connection *conn) int64_t r; uint64_t exportsize; uint16_t eflags; - int fl; gflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES; @@ -596,42 +604,8 @@ _negotiate_handshake_newstyle (struct connection *conn) exportsize = (uint64_t) r; conn->exportsize = exportsize; - eflags = NBD_FLAG_HAS_FLAGS; - - fl = plugin_can_write (conn); - if (fl == -1) + if (compute_eflags (conn, &eflags) <...
2019 Sep 16
1
[libnbd PATCH] states: Avoid magic number for h->tls
...f --git a/generator/states-newstyle.c b/generator/states-newstyle.c index c8f817e..b4f2b80 100644 --- a/generator/states-newstyle.c +++ b/generator/states-newstyle.c @@ -129,10 +129,10 @@ handle_reply_error (struct nbd_handle *h) h->gflags = be16toh (h->gflags); if ((h->gflags & NBD_FLAG_FIXED_NEWSTYLE) == 0 && - h->tls == 2) { + h->tls == LIBNBD_TLS_REQUIRE) { SET_NEXT_STATE (%.DEAD); set_error (ENOTSUP, "handshake: server is not fixed newstyle, " - "but handle TLS setting is require (2)"); + "but handle TLS s...
2019 Sep 12
0
[nbdkit PATCH 2/2] server: Add --mask-handshake option for integration testing
...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 (struct connection *conn) /* ... which we check for accuracy. */ de...
2019 May 19
5
[libnbd PATCH 0/4] Various interop fixes
Some of these affect attempts to connect to older qemu-nbd versions, some of them were triggered by manual edits to qemu-nbd source code to provoke various other compliant (if uncommon) server behaviors. Eric Blake (4): starttls: Skip error payload if falling back to unencrypted states: Reject payload to NBD_REP_ACK meta-context: Skip error payload if server lacks meta_context states: Add
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.
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
The upstream protocol recently promoted NBD_CMD_WRITE_ZEROES from experimental to a documented extension. Exposing support for this allows plugin writers to create sparse files when driven by a client that knows how to use the extension; meanwhile, even if a plugin does not support this extension, the server benefits from less network traffic from the client. Eric Blake (5): protocol: Support
2018 Aug 06
0
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
...} + return 0; } @@ -741,11 +921,6 @@ _negotiate_handshake_newstyle (struct connection *conn) { struct new_handshake handshake; uint16_t gflags; - uint32_t cflags; - struct new_handshake_finish handshake_finish; - int64_t r; - uint64_t exportsize; - uint16_t eflags; gflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES; @@ -761,15 +936,15 @@ _negotiate_handshake_newstyle (struct connection *conn) } /* Client now sends us its 32 bit flags word ... */ - if (conn->recv (conn, &cflags, sizeof cflags) == -1) { + if (conn->recv (conn, &conn->cflags, 4) == -1) { nbd...
2019 Sep 24
0
[PATCH nbdkit 2/4] common/protocol: Remove protostrings.sed, use bash+sed instead.
...*/ -# Prologue. -1i\ -/* Generated from nbd-protocol.h by protostrings.sed. */\ -\#include "nbd-protocol.h"\ +#include "nbd-protocol.h" +EOF -# Match the precise sections of the source file. -/^extern const char \*name_of_/,/^$/ { +declare -A functions=( + [global_flag]=NBD_FLAG_FIXED_NEWSTYLE + [flag]=NBD_FLAG_HAS_FLAGS + [opt]=NBD_OPT_EXPORT_NAME + [rep]=NBD_REP_ACK + [info]=NBD_INFO_EXPORT + [reply]=NBD_REPLY_FLAG_DONE + [reply_type]=NBD_REPLY_TYPE_NONE + [cmd]=NBD_CMD_READ + [cmd_flag]=NBD_CMD_FLAG_FUA + [error]=NBD_SUCCESS +) - # Convert extern function...
2019 Sep 17
1
Re: [PATCH libnbd 2/2] api: New API for reading NBD protocol.
...rned in future. Most modern NBD servers use C<\"newstyle-fixed\">. s/in/in the/ > +++ b/generator/states-newstyle.c > @@ -155,4 +155,13 @@ handle_reply_error (struct nbd_handle *h) > } > return 0; > > + NEWSTYLE.FINISHED: > + if ((h->gflags & NBD_FLAG_FIXED_NEWSTYLE) == 0) > + h->protocol = "newstyle"; > + else > + h->protocol = "newstyle-fixed"; Should work whether this lands before or after my set_handshake_flags patch. > +++ b/lib/handle.c > @@ -315,3 +315,15 @@ nbd_unlocked_supports_uri (struct nbd_handle...
2019 Sep 17
3
[PATCH libnbd 1/2] api: Add new API to read whether TLS was negotiated.
When LIBNBD_TLS_ALLOW is used we don't have a way to find out if TLS was really negotiated. This adds a flag and a way to read it back. Unfortunately there is no test yet, because LIBNBD_TLS_ALLOW is not tested -- it really should be but requires quite a complicated set of tests because ideally we'd like to find out whether it falls back correctly for all supported servers. --- TODO
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far. Rich.
2018 Dec 06
0
[PATCH nbdkit 3/5] protocol: Generate map functions from NBD protocol flags to printable strings.
...iff --git a/src/protocol.h b/src/protocol.h index 0444641..6709ddc 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -81,10 +81,12 @@ struct fixed_new_option_reply { #define NBD_REP_MAGIC UINT64_C(0x3e889045565a9) /* Global flags. */ +extern const char *name_of_nbd_global_flag (int); #define NBD_FLAG_FIXED_NEWSTYLE 1 #define NBD_FLAG_NO_ZEROES 2 /* Per-export flags. */ +extern const char *name_of_nbd_flag (int); #define NBD_FLAG_HAS_FLAGS (1 << 0) #define NBD_FLAG_READ_ONLY (1 << 1) #define NBD_FLAG_SEND_FLUSH (1 << 2) @@ -94,6 +96,7 @@ struct fixed_new_opt...