mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 00:07:57 -06:00
nbd: correctly manage default port
block/nbd.c: use default port number when none is specified qemu-nbd.c: use IANA-assigned port number: 10809 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
5fe16888d3
commit
c2e2872bf4
2 changed files with 3 additions and 5 deletions
|
@ -95,8 +95,6 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
|
||||||
if (r == p) {
|
if (r == p) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if (name == NULL) {
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sock = tcp_socket_outgoing(hostname, port);
|
sock = tcp_socket_outgoing(hostname, port);
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void usage(const char *name)
|
||||||
"Usage: %s [OPTIONS] FILE\n"
|
"Usage: %s [OPTIONS] FILE\n"
|
||||||
"QEMU Disk Network Block Device Server\n"
|
"QEMU Disk Network Block Device Server\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -p, --port=PORT port to listen on (default `1024')\n"
|
" -p, --port=PORT port to listen on (default `%d')\n"
|
||||||
" -o, --offset=OFFSET offset into the image\n"
|
" -o, --offset=OFFSET offset into the image\n"
|
||||||
" -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n"
|
" -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n"
|
||||||
" -k, --socket=PATH path to the unix socket\n"
|
" -k, --socket=PATH path to the unix socket\n"
|
||||||
|
@ -62,7 +62,7 @@ static void usage(const char *name)
|
||||||
" -V, --version output version information and exit\n"
|
" -V, --version output version information and exit\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Report bugs to <anthony@codemonkey.ws>\n"
|
"Report bugs to <anthony@codemonkey.ws>\n"
|
||||||
, name, "DEVICE");
|
, name, NBD_DEFAULT_PORT, "DEVICE");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void version(const char *name)
|
static void version(const char *name)
|
||||||
|
@ -188,7 +188,7 @@ int main(int argc, char **argv)
|
||||||
bool readonly = false;
|
bool readonly = false;
|
||||||
bool disconnect = false;
|
bool disconnect = false;
|
||||||
const char *bindto = "0.0.0.0";
|
const char *bindto = "0.0.0.0";
|
||||||
int port = 1024;
|
int port = NBD_DEFAULT_PORT;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
socklen_t addr_len = sizeof(addr);
|
socklen_t addr_len = sizeof(addr);
|
||||||
off_t fd_size;
|
off_t fd_size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue