search for: nbd_rep_err_invalid

Displaying 20 results from an estimated 38 matches for "nbd_rep_err_invalid".

2018 Nov 29
2
[nbdkit PATCH] connections: Implement NBD_OPT_INFO
...} if (optlen < 6) { /* 32 bit export length + 16 bit nr info */ - debug ("newstyle negotiation: NBD_OPT_GO option length < 6"); + debug ("newstyle negotiation: %s option length < 6", optname); if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) == -1) @@ -800,7 +803,7 @@ _negotiate_handshake_newstyle_options (struct connection *conn) memcpy (&exportnamelen, &data[0], 4); exportnamelen = be32toh (exportnamelen); if (exportnamelen > optlen-6 /* NB optlen >= 6, see above */) { -...
2019 Jun 28
0
[libnbd PATCH] opt-go: Better decoding of known errors
...if (handle_reply_error (h) == 0) { + /* Decode expected known errors into a nicer string */ + switch (reply) { + case NBD_REP_ERR_POLICY: + case NBD_REP_ERR_PLATFORM: + set_error (0, "handshake: server policy prevents NBD_OPT_GO"); + break; + case NBD_REP_ERR_INVALID: + case NBD_REP_ERR_TOO_BIG: + set_error (EINVAL, "handshake: server rejected NBD_OPT_GO as invalid"); + break; + case NBD_REP_ERR_TLS_REQD: + set_error (ENOTSUP, "handshake: server requires TLS encryption first"); + break; + case NBD_R...
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.
2019 Mar 08
1
[PATCH nbdkit] server: Implement minimal implementation of set/list metadata contexts.
...uerylen; + const char *what; + + optname = name_of_nbd_opt (option); + if (conn_recv_full (conn, data, optlen, "read: %s: %m", optname) == -1) + return -1; + + if (!conn->structured_replies) { + if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) + == -1) + return -1; + continue; + } + + /* Minimum length of the option payload is the 32 bit export + * name plus a zero length export name plus 32 bit number of + * queries followed by no queries. + */ + what = &quot...
2018 Aug 06
0
[PATCH nbdkit v2] protocol: Implement NBD_OPT_GO.
...== -1) { + nbdkit_error ("read: %m"); + return -1; + } + + if (optlen < 6) { /* 32 bit export length + 16 bit nr info */ + debug ("newstyle negotiation: NBD_OPT_GO option length < 6"); + + if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) + == -1) + return -1; + continue; + } + + { + uint32_t exportnamelen; + uint16_t nrinfos; + uint16_t info; + size_t i; + CLEANUP_FREE char *requested_exportname = NULL; + + /* Validate the name length and number of INFO...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...option_reply (conn, option, NBD_REP_ACK) == -1) - return -1; - debug ("client sent %s to abort the connection", - name_of_nbd_opt (option)); - return -1; - - case NBD_OPT_LIST: - if (optlen != 0) { - if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) - == -1) - return -1; - if (conn_recv_full (conn, data, optlen, - "read: %s: %m", name_of_nbd_opt (option)) == -1) - return -1; - continue; - } - - /* Send back the exportname. */ - debug ("newstyle...
2018 Dec 21
1
[nbdkit PATCH] connections: Don't use uninit memory on early client EOF
...- } /* Apart from printing it, ignore the export name. */ data[optlen] = '\0'; debug ("newstyle negotiation: %s: " @@ -715,10 +738,9 @@ _negotiate_handshake_newstyle_options (struct connection *conn) if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) == -1) return -1; - if (conn->recv (conn, data, optlen) == -1) { - nbdkit_error ("read: %s: %m", name_of_nbd_opt (option)); + if (conn_recv_full (conn, data, optlen, + "read: %s: %m", name_of_nbd_opt (...
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.
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...;recv: %m") == -1) return -1; @@ -302,7 +303,7 @@ negotiate_handshake_newstyle_options (struct connection *conn) */ if (!(conn->cflags & NBD_FLAG_FIXED_NEWSTYLE) && option != NBD_OPT_EXPORT_NAME) { - if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID)) + if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID)) return -1; continue; } @@ -312,31 +313,30 @@ negotiate_handshake_newstyle_options (struct connection *conn) */ if (tls == 2 && !conn->using_tls && !(option == NBD_OPT_A...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html v2 replaces struct connection *conn = GET_CONN; with GET_CONN; which sets conn implicitly and asserts that it is non-NULL. If we actually want to test if conn is non-NULL or behave differently, then you must use threadlocal_get_conn() instead, and some existing uses do that. 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 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.
2023 Mar 03
1
[PATCH v2 3/6] spec: Add NBD_OPT_EXTENDED_HEADERS
...BD_REP_META_CONTEXT` replies, one per context, > > followed by an `NBD_REP_ACK` or an error. > > > > - This option SHOULD NOT be requested unless structured replies have > > - been negotiated first. If a client attempts to do so, a server > > - MAY send `NBD_REP_ERR_INVALID`. > > + This option SHOULD NOT be requested unless structured replies or > > + extended headers have been negotiated first. If a client attempts > > + to do so, a server MAY send `NBD_REP_ERR_INVALID` or > > + `NBD_REP_ERR_EXT_HEADER_REQD`. > > Is it the i...
2022 Nov 14
2
[PATCH v2 3/6] spec: Add NBD_OPT_EXTENDED_HEADERS
...the newstyle negotiation. Return a list of `NBD_REP_META_CONTEXT` replies, one per context, followed by an `NBD_REP_ACK` or an error. - This option SHOULD NOT be requested unless structured replies have - been negotiated first. If a client attempts to do so, a server - MAY send `NBD_REP_ERR_INVALID`. + This option SHOULD NOT be requested unless structured replies or + extended headers have been negotiated first. If a client attempts + to do so, a server MAY send `NBD_REP_ERR_INVALID` or + `NBD_REP_ERR_EXT_HEADER_REQD`. Data: - 32 bits, length of export name. @@ -1454,...
2019 Sep 16
2
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...> +# This should not happen. > +sys.exit (1) The test looks good. (Yeah, figuring out how to make it more graceful in the future might be nice, but that's not this patch's problem. I'm thinking that if a plugin's .open() fails, nbdkit could reply with NBD_REP_ERR_UNKNOWN or NBD_REP_ERR_INVALID, and then wait for the client to disconnect, rather than the current hard hangup initiated by the server) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
2019 Mar 20
0
[PATCH nbdkit 3/8] server: Implement Block Status requests to read allocation status.
.../server/protocol.h @@ -112,6 +112,7 @@ extern const char *name_of_nbd_rep (int); #define NBD_REP_ACK 1 #define NBD_REP_SERVER 2 #define NBD_REP_INFO 3 +#define NBD_REP_META_CONTEXT 4 #define NBD_REP_ERR_UNSUP 0x80000001 #define NBD_REP_ERR_POLICY 0x80000002 #define NBD_REP_ERR_INVALID 0x80000003 @@ -128,6 +129,18 @@ struct fixed_new_option_reply_info_export { uint16_t eflags; /* per-export flags */ } __attribute__((packed)); +/* NBD_REP_META_CONTEXT reply (follows fixed_new_option_reply). */ +struct fixed_new_option_reply_meta_context { + uint32_t context_id...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...0 | (val)) #define NBD_REP_IS_ERR(val) (!!((val) & 0x80000000)) -#define NBD_REP_ACK 1 -#define NBD_REP_SERVER 2 -#define NBD_REP_INFO 3 -#define NBD_REP_META_CONTEXT 4 -#define NBD_REP_ERR_UNSUP NBD_REP_ERR (1) -#define NBD_REP_ERR_POLICY NBD_REP_ERR (2) -#define NBD_REP_ERR_INVALID NBD_REP_ERR (3) -#define NBD_REP_ERR_PLATFORM NBD_REP_ERR (4) -#define NBD_REP_ERR_TLS_REQD NBD_REP_ERR (5) +#define NBD_REP_ACK 1 +#define NBD_REP_SERVER 2 +#define NBD_REP_INFO 3 +#define NBD_REP_META_CONTEXT 4 +#define NBD_REP_ERR_UNSUP...
2016 May 20
1
[PATCH] protocol: Ignore rest of option when replying with error
...file changed, 8 insertions(+) diff --git a/src/connections.c b/src/connections.c index 0c93f35..840e315 100644 --- a/src/connections.c +++ b/src/connections.c @@ -334,6 +334,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn) if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) == -1) return -1; + if (xread (conn->sockin, data, optlen) == -1) { + nbdkit_error ("read: %m"); + return -1; + } continue; } @@ -351,6 +355,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn)...
2019 Mar 19
0
[PATCH nbdkit 3/9] server: Implement Block Status requests to read allocation status.
.../server/protocol.h @@ -112,6 +112,7 @@ extern const char *name_of_nbd_rep (int); #define NBD_REP_ACK 1 #define NBD_REP_SERVER 2 #define NBD_REP_INFO 3 +#define NBD_REP_META_CONTEXT 4 #define NBD_REP_ERR_UNSUP 0x80000001 #define NBD_REP_ERR_POLICY 0x80000002 #define NBD_REP_ERR_INVALID 0x80000003 @@ -128,6 +129,18 @@ struct fixed_new_option_reply_info_export { uint16_t eflags; /* per-export flags */ } __attribute__((packed)); +/* NBD_REP_META_CONTEXT reply (follows fixed_new_option_reply). */ +struct fixed_new_option_reply_meta_context { + uint32_t context_id...
2020 Sep 29
1
[nbdkit PATCH] server: Adjust limit on max NBD_OPT_* from client
...(option)); - if (send_newstyle_option_reply_exportnames (option) == -1) - return -1; + if (list_seen) { + debug ("newstyle negotiation: %s: export list already advertised", + name_of_nbd_opt (option)); + if (send_newstyle_option_reply (option, NBD_REP_ERR_INVALID) + == -1) + return -1; + continue; + } + else { + /* Send back the exportname list. */ + debug ("newstyle negotiation: %s: advertising exports", + name_of_nbd_opt (option)); + if (send_newstyle_option_reply_exportname...