[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 12/23] block/nbd: Reject port parameter without host
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 12/23] block/nbd: Reject port parameter without host |
Date: |
Thu, 27 Oct 2016 20:08:56 +0200 |
From: Max Reitz <address@hidden>
Currently, a port that is passed along with a UNIX socket path is
silently ignored. That is not exactly ideal, it should be an error
instead.
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/nbd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/nbd.c b/block/nbd.c
index ce7c14f..eaca33c 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -197,6 +197,7 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QemuOpts
*opts, Error **errp)
s->path = g_strdup(qemu_opt_get(opts, "path"));
s->host = g_strdup(qemu_opt_get(opts, "host"));
+ s->port = g_strdup(qemu_opt_get(opts, "port"));
if (!s->path == !s->host) {
if (s->path) {
@@ -206,6 +207,10 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QemuOpts
*opts, Error **errp)
}
return NULL;
}
+ if (s->port && !s->host) {
+ error_setg(errp, "port may not be used without host");
+ return NULL;
+ }
saddr = g_new0(SocketAddress, 1);
@@ -217,8 +222,6 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QemuOpts
*opts, Error **errp)
} else {
InetSocketAddress *inet;
- s->port = g_strdup(qemu_opt_get(opts, "port"));
-
saddr->type = SOCKET_ADDRESS_KIND_INET;
inet = saddr->u.inet.data = g_new0(InetSocketAddress, 1);
inet->host = g_strdup(s->host);
--
1.8.3.1
- [Qemu-block] [PULL 03/23] block: Remove bdrv_aio_pdiscard(), (continued)
- [Qemu-block] [PULL 03/23] block: Remove bdrv_aio_pdiscard(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 01/23] block: Use blk_co_flush() for all BB level flushes, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 04/23] block: Use blk_co_ioctl() for all BB level ioctls, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 05/23] raw-posix: Don't use bdrv_ioctl(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 06/23] block: Remove bdrv_ioctl(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 08/23] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 07/23] block: Introduce .bdrv_co_ioctl() driver callback, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 09/23] block: Remove bdrv_aio_ioctl(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 10/23] qemu-iotests: Fix typo for NFS with IMGOPTSSYNTAX, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 11/23] block/nbd: Drop trailing "." in error messages, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 12/23] block/nbd: Reject port parameter without host,
Kevin Wolf <=
- [Qemu-block] [PULL 13/23] block/nbd: Default port in nbd_refresh_filename(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 14/23] block/nbd: Use qdict_put(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 16/23] block/nbd: Accept SocketAddress, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 15/23] block/nbd: Add nbd_has_filename_options_conflict(), Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 17/23] block/nbd: Use SocketAddress options, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 18/23] qapi: Allow blockdev-add for NBD, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 20/23] iotests.py: Allow concurrent qemu instances, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 19/23] iotests.py: Add qemu_nbd function, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 21/23] socket_scm_helper: Accept fd directly, Kevin Wolf, 2016/10/27
- [Qemu-block] [PULL 23/23] iotests: Add test for NBD's blockdev-add interface, Kevin Wolf, 2016/10/27