search for: nbdmagic

Displaying 20 results from an estimated 33 matches for "nbdmagic".

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 |...
2019 Sep 25
0
[libnbd PATCH] lib: Synchronize nbd-protocol.h with nbdkit, again
...nerator/states-magic.c | 2 +- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/nbd-protocol.h b/lib/nbd-protocol.h index fe4d451..bdd1ef2 100644 --- a/lib/nbd-protocol.h +++ b/lib/nbd-protocol.h @@ -50,7 +50,7 @@ /* Old-style handshake. */ struct nbd_old_handshake { - char nbdmagic[8]; /* "NBDMAGIC" */ + uint64_t nbdmagic; /* NBD_MAGIC */ uint64_t version; /* NBD_OLD_VERSION */ uint64_t exportsize; uint16_t gflags; /* global flags */ @@ -58,30 +58,33 @@ struct nbd_old_handshake { char zeroes[124]; /* mus...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...NENCE; conn->can_marknoremanence = 1; } - debug ("oldstyle negotiation: flags: global 0x%x export 0x%x", - gflags, eflags); + debug ("oldstyle negotiation: server flags: 0x%x", flags); memset (&handshake, 0, sizeof handshake); memcpy (handshake.nbdmagic, "NBDMAGIC", 8); handshake.version = htobe64 (OLD_VERSION); handshake.exportsize = htobe64 (exportsize); - handshake.gflags = htobe16 (gflags); - handshake.eflags = htobe16 (eflags); + handshake.flags = htobe32 (flags); if (xwrite (conn->sockout, &handshake, sizeof ha...
2019 Sep 24
0
[PATCH nbdkit 3/4] common/protocol: Update nbd-protocol.h so it matches libnbd’s copy.
...d0..724ffb6 100644 --- a/common/protocol/nbd-protocol.h +++ b/common/protocol/nbd-protocol.h @@ -40,37 +40,46 @@ * these structures. */ +#define NBD_MAX_STRING 4096 /* Maximum length 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];...
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.
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far. Rich.
2019 Apr 29
0
[nbdkit PATCH 2/2] nbd: Support TCP socket
...unix (h) == -1) + if (sockname) { + if (nbd_connect_unix (h) == -1) + goto err; + } + else if (nbd_connect_tcp (h) == -1) goto err; /* old and new handshake share same meaning of first 16 bytes */ @@ -885,7 +968,7 @@ nbd_open (int readonly) goto err; } if (strncmp(old.nbdmagic, "NBDMAGIC", sizeof old.nbdmagic)) { - nbdkit_error ("wrong magic, %s is not an NBD server", sockname); + nbdkit_error ("wrong magic, %s is not an NBD server", servname); goto err; } version = be64toh (old.version); diff --git a/TODO b/TODO index 53d33...
2019 Sep 24
0
[PATCH nbdkit 4/4] common/protocol: Install <nbd-protocol.h> as a public header.
.../* global flags */ uint16_t eflags; /* per-export flags */ char zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -59,7 +65,7 @@ struct nbd_new_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) @@ -69,14 +75,14 @@ struct nbd_new_option {...
2014 Dec 05
2
[PATCH] p2v: wait for qemu-nbd before starting conversion (RHBZ#1167774)
...,69 @@ start_qemu_nbd (int port, const char *device) return pid; } +static int +wait_qemu_nbd (int nbd_local_port, int timeout_seconds) +{ + int sockfd; + int result = 0; + struct sockaddr_in addr; + time_t start_t, now_t; + struct timeval timeout = { .tv_usec = 0 }; + char magic[8]; /* NBDMAGIC */ + size_t bytes_read = 0; + ssize_t recvd; + + time (&start_t); + + sockfd = socket (AF_INET, SOCK_STREAM, 0); + if (sockfd == -1) { + perror ("socket"); + return -1; + } + + memset(&addr, 0, sizeof (struct sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_po...
2019 Apr 29
3
[nbdkit PATCH 0/2] Let nbd plugin connect to TCP socket
Accepting only Unix sockets can be a bit limiting; let's be more flexible. Eric Blake (2): nbd: Refactor Unix socket connection nbd: Support TCP socket plugins/nbd/nbdkit-nbd-plugin.pod | 36 ++++-- plugins/nbd/nbd.c | 175 ++++++++++++++++++++++-------- TODO | 3 - 3 files changed, 161 insertions(+), 53 deletions(-) -- 2.20.1
2019 Sep 24
2
[PATCH libnbd] lib: Copy nbd-protocol.h from nbdkit 1.15.3.
.../* global flags */ uint16_t eflags; /* per-export flags */ char zeroes[124]; /* must be sent as zero bytes */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_OLD_VERSION UINT64_C(0x420281861253) @@ -64,7 +65,7 @@ struct nbd_new_handshake { char nbdmagic[8]; /* "NBDMAGIC" */ uint64_t version; /* NBD_NEW_VERSION */ uint16_t gflags; /* global flags */ -} __attribute__((packed)); +} NBD_ATTRIBUTE_PACKED; #define NBD_NEW_VERSION UINT64_C(0x49484156454F5054) @@ -74,14 +75,14 @@ struct nbd_new_option {...
2019 Mar 18
0
[PATCH nbdkit 2/2] server: Split out NBD protocol code from connections code.
...r; - conn->exportsize = exportsize; - - gflags = 0; - if (compute_eflags (conn, &eflags) < 0) - return -1; - - debug ("oldstyle negotiation: flags: global 0x%x export 0x%x", - gflags, eflags); - - memset (&handshake, 0, sizeof handshake); - memcpy (handshake.nbdmagic, "NBDMAGIC", 8); - handshake.version = htobe64 (OLD_VERSION); - handshake.exportsize = htobe64 (exportsize); - handshake.gflags = htobe16 (gflags); - handshake.eflags = htobe16 (eflags); - - if (conn->send (conn, &handshake, sizeof handshake) == -1) { - nbdkit_error ("...
2014 Dec 15
0
[PATCH] p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774)
...@@ -398,7 +398,8 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) { int sockfd; int result = -1; - struct sockaddr_in addr; + int reuseaddr = 1; + struct sockaddr_in src_addr, dst_addr; time_t start_t, now_t; struct timeval timeout = { .tv_usec = 0 }; char magic[8]; /* NBDMAGIC */ @@ -413,10 +414,40 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) return -1; } - memset (&addr, 0, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_port = htons (nbd_local_port); - inet_pton (AF_INET, "localhost", &addr.sin_addr); + memset (&...
2017 Nov 14
0
[nbdkit PATCH v2 1/2] nbd: Add new nbd forwarding plugin
...("connect: %m"); + goto err; + } + + /* old and new handshake share same meaning of first 16 bytes */ + if (read_full (h->fd, &old, offsetof (struct old_handshake, exportsize))) { + nbdkit_error ("unable to read magic: %m"); + goto err; + } + if (strncmp(old.nbdmagic, "NBDMAGIC", sizeof old.nbdmagic)) { + nbdkit_error ("wrong magic, %s is not an NBD server", sockname); + goto err; + } + version = be64toh (old.version); + if (version == OLD_VERSION) { + if (read_full (h->fd, + (char *) &old + offsetof (str...
2017 Jan 26
3
[PATCH 0/3] p2v: Allow nbdkit as an alternative NBD server.
qemu-nbd is a fine NBD server. However it's not easy to compile a reliably working version on RHEL 5. This patch series allows nbdkit to be used as an alternative (qemu-nbd is still the default). Rich.
2014 Dec 15
2
[PATCH v2 0/1] p2v: avoid connecting to ourself while probing qemu-nbd
Changes since v1: - Set probing source port to be nbd_local_port+1 instead of always using 50124 to deal with multi-disk scenario. - Set SO_REUSEADDR on client socket to avoid issues with old connections in TIME_WAIT. I've been running this for a few hours now using the updated multi-disk test and haven't seen any problems.
2014 Dec 12
2
[PATCH] p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774)
...xpect handle to ssh */ @@ -398,7 +408,7 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) { int sockfd; int result = -1; - struct sockaddr_in addr; + struct sockaddr_in src_addr, dst_addr; time_t start_t, now_t; struct timeval timeout = { .tv_usec = 0 }; char magic[8]; /* NBDMAGIC */ @@ -413,10 +423,20 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) return -1; } - memset (&addr, 0, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_port = htons (nbd_local_port); - inet_pton (AF_INET, "localhost", &addr.sin_addr); + memset (&...
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.
2017 Feb 03
5
[PATCH 0/5] Support socket activation in virt-p2v.
As the subject says, support socket activation in virt-p2v. I have added upstream support for socket activation to nbdkit already: https://github.com/libguestfs/nbdkit/commit/7ff39d028c6359f5c0925ed2cf4a2c4c751af2e4 I posted a patch for qemu-nbd, still waiting on more reviews for that one: https://www.mail-archive.com/qemu-devel@nongnu.org/msg427246.html I tested this against old and new qemu
2017 Nov 12
6
[nbdkit PATCH] nbd: Add new nbd forwarding plugin
...nbdkit_error ("connect: %m"); + goto err; + } + + /* old and new handshake share first 16 bytes */ + if (read_full (h->fd, &old, offsetof (struct old_handshake, exportsize))) { + nbdkit_error ("unable to read magic: %m"); + goto err; + } + if (strncmp(old.nbdmagic, "NBDMAGIC", sizeof old.nbdmagic)) { + nbdkit_error ("wrong magic, %s is not an NBD server", filename); + goto err; + } + version = be64toh (old.version); + if (version == OLD_VERSION) { + if (read_full (h->fd, + (char *) &old + offsetof (struct old_handsh...