Displaying 20 results from an estimated 96 matches for "gflags".
Did you mean:
flags
2019 Sep 16
1
[libnbd PATCH] api: Add set_handshake_flags for integration
...insertions(+), 10 deletions(-)
diff --git a/lib/internal.h b/lib/internal.h
index ccaca32..998ca3d 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -157,6 +157,7 @@ struct nbd_handle {
} __attribute__((packed)) error;
} payload;
} __attribute__((packed)) sr;
+ uint16_t gflags;
uint32_t cflags;
uint32_t len;
uint16_t nrinfos;
diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.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(0x3e889045565...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...lags in old-style connection
diff -r d7d5078d08c7 -r dbd1ea0a401c src/connections.c
--- a/src/connections.c Sun Sep 25 05:04:02 2016 +0200
+++ b/src/connections.c Mon Sep 26 17:28:54 2016 +0200
@@ -155,7 +155,7 @@
struct old_handshake handshake;
int64_t r;
uint64_t exportsize;
- uint16_t gflags, eflags;
+ uint32_t flags;
int fl;
r = plugin_get_size (conn);
@@ -169,14 +169,13 @@
exportsize = (uint64_t) r;
conn->exportsize = exportsize;
- gflags = 0;
- eflags = NBD_FLAG_HAS_FLAGS;
+ flags = NBD_FLAG_HAS_FLAGS;
fl = plugin_can_write (conn);
if (fl == -1)
r...
2019 Sep 16
1
[libnbd PATCH] states: Avoid magic number for h->tls
...s 'require' (2)");
return 0;
}
diff --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 han...
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
...= -1)
+ return -1;
+ if (fl) {
+ eflags |= NBD_FLAG_SEND_TRIM;
+ conn->can_trim = 1;
+ }
+
+ *flags = eflags;
+ return 0;
+}
+
+static int
_negotiate_handshake_oldstyle (struct connection *conn)
{
struct old_handshake handshake;
int64_t r;
uint64_t exportsize;
uint16_t gflags, eflags;
- int fl;
/* In --tls=require / FORCEDTLS mode, old style handshakes are
* rejected because they cannot support TLS.
@@ -265,43 +309,8 @@ _negotiate_handshake_oldstyle (struct connection *conn)
conn->exportsize = exportsize;
gflags = 0;
- eflags = NBD_FLAG_HAS_FLAGS;
-...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...of a string field */
+
/* Old-style handshake. */
-struct old_handshake {
+struct nbd_old_handshake {
char nbdmagic[8]; /* "NBDMAGIC" */
- uint64_t version; /* OLD_VERSION */
+ uint64_t version; /* NBD_OLD_VERSION */
uint64_t exportsize;
uint16_t gflags; /* 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 handshak...
2019 May 23
0
[PATCH libnbd 1/3] states: Factor out common code for setting export size and eflags.
...return -1;
}
}
diff --git a/generator/states-oldstyle.c b/generator/states-oldstyle.c
index 95b7df9..29cb341 100644
--- a/generator/states-oldstyle.c
+++ b/generator/states-oldstyle.c
@@ -47,14 +47,10 @@
eflags = be16toh (conn->sbuf.old_handshake.eflags);
conn->gflags = gflags;
- conn->h->exportsize = exportsize;
- conn->h->eflags = eflags;
- debug (conn->h, "exportsize: %" PRIu64 " eflags: 0x%" PRIx16
- " gflags: 0x%" PRIx16,
- exportsize, eflags, gflags);
- if (eflags == 0) {
+ debug (conn->h...
2019 Sep 16
2
[LIBNBD SECURITY PATCH 0/1] NBD Protocol Downgrade Attack in libnbd
We discovered a possible Downgrade Attack in libnbd.
Lifecycle
---------
Reported: 2019-09-14 Fixed: 2019-09-16 Published: 2019-09-16
There is no CVE number assigned for this issue yet, but the bug is
being categorized and processed by Red Hat's security team which may
result in a CVE being published later.
Description
-----------
Libnbd includes the method nbd_set_tls(h,
2019 May 19
0
[libnbd PATCH 4/4] states: Add NBD_OPT_EXPORT_NAME handling
...T_STATE (%SEND_EXPORT);
+ }
+ return 0;
+
+ NEWSTYLE.OPT_EXPORT_NAME.SEND_EXPORT:
+ switch (send_from_wbuf (conn)) {
+ case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case 0:
+ conn->rbuf = &conn->sbuf;
+ conn->rlen = sizeof conn->sbuf.export_name_reply;
+ if ((conn->gflags & NBD_FLAG_NO_ZEROES) != 0)
+ conn->rlen -= sizeof conn->sbuf.export_name_reply.zeroes;
+ SET_NEXT_STATE (%RECV_REPLY);
+ }
+ return 0;
+
+ NEWSTYLE.OPT_EXPORT_NAME.RECV_REPLY:
+ switch (recv_into_rbuf (conn)) {
+ case -1: SET_NEXT_STATE (%.DEAD); return -1;
+ case 0: SET_NE...
2020 Aug 11
3
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...sbuf.option;
>> + SET_NEXT_STATE (%SEND_OPT_ABORT);
>> + return 0;
>> + case 0:
>> + break;
>> + default:
>> + abort ();
>> + }
>> + }
>> h->rbuf = &h->sbuf;
>> h->rlen = sizeof h->sbuf.gflags;
>> SET_NEXT_STATE (%RECV_GFLAGS);
>
> And this hunk which I guess is related to above but I couldn't quite
> work out why it's needed either.
>
>> @@ -136,6 +155,11 @@ STATE_MACHINE {
>> return 0;
>> }
>>
>> + if ((h->gfla...
2019 Sep 12
0
[nbdkit PATCH 2/2] server: Add --mask-handshake option for integration testing
...-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 (struct connection *conn)
/* ......
2020 Aug 11
0
Re: [libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...uf;
> + h->wlen = sizeof h->sbuf.option;
> + SET_NEXT_STATE (%SEND_OPT_ABORT);
> + return 0;
> + case 0:
> + break;
> + default:
> + abort ();
> + }
> + }
> h->rbuf = &h->sbuf;
> h->rlen = sizeof h->sbuf.gflags;
> SET_NEXT_STATE (%RECV_GFLAGS);
And this hunk which I guess is related to above but I couldn't quite
work out why it's needed either.
> @@ -136,6 +155,11 @@ STATE_MACHINE {
> return 0;
> }
>
> + if ((h->gflags & LIBNBD_HANDSHAKE_FLAG_FIXED_NEWSTYLE)...
2019 Apr 23
0
[nbdkit PATCH 6/7] nbd: Implement NBD_OPT_GO client request
...ake, exportsize),
sizeof old - offsetof (struct old_handshake, exportsize))) {
@@ -508,6 +661,7 @@ nbd_open (int readonly)
struct new_handshake_finish finish;
size_t expect;
+ nbdkit_debug ("trying newstyle connection");
if (read_full (h->fd, &gflags, sizeof gflags)) {
nbdkit_error ("unable to read global flags: %m");
goto err;
@@ -519,25 +673,36 @@ nbd_open (int readonly)
goto err;
}
- /* For now, we don't do any option haggling, but go straight into
- transmission phase */
- opt.version = h...
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far.
Rich.
2019 May 23
5
[PATCH libnbd 0/3] Prevent some misuse of multi-conn.
Per recent discussion here:
https://www.redhat.com/archives/libguestfs/2019-May/thread.html#00175
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.
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...optlen = htobe32 (0);
+ h->wbuf = &h->sbuf;
+ h->wlen = sizeof h->sbuf.option;
+ SET_NEXT_STATE (%SEND_OPT_ABORT);
+ return 0;
+ case 0:
+ break;
+ default:
+ abort ();
+ }
+ }
h->rbuf = &h->sbuf;
h->rlen = sizeof h->sbuf.gflags;
SET_NEXT_STATE (%RECV_GFLAGS);
@@ -136,6 +155,11 @@ STATE_MACHINE {
return 0;
}
+ if ((h->gflags & LIBNBD_HANDSHAKE_FLAG_FIXED_NEWSTYLE) == 0)
+ h->protocol = "newstyle";
+ else
+ h->protocol = "newstyle-fixed";
+
cflags = h->gflags;
h-...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...urn -1;
- if (fl) {
- eflags |= NBD_FLAG_CAN_MULTI_CONN;
- conn->can_multi_conn = true;
- }
-
- *flags = eflags;
- return 0;
-}
-
-static int
-_negotiate_handshake_oldstyle (struct connection *conn)
-{
- struct old_handshake handshake;
- int64_t r;
- uint64_t exportsize;
- uint16_t gflags, eflags;
-
- /* In --tls=require / FORCEDTLS mode, old style handshakes are
- * rejected because they cannot support TLS.
- */
- if (tls == 2) {
- nbdkit_error ("non-TLS client tried to connect in --tls=require mode");
- return -1;
- }
-
- r = backend->get_size (backend,...
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 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