aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-06-18 10:06:39 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-06-18 10:06:39 -0500
commit7d8f4b34a4bb6996d958da211f1dfb2686c7d82b (patch)
tree73af8d72adc7382be7d9119237ac3568772ce97f /util
parent5b456438f5bb395ed6b1eec95e18ce7a7a884a0a (diff)
parent23307908790cd8fad91220863d7712c571ddc977 (diff)
downloadqemu-7d8f4b34a4bb6996d958da211f1dfb2686c7d82b.zip
qemu-7d8f4b34a4bb6996d958da211f1dfb2686c7d82b.tar.gz
qemu-7d8f4b34a4bb6996d958da211f1dfb2686c7d82b.tar.bz2
Merge remote-tracking branch 'bonzini/nbd-next' into staging
# By Ján Tomko # Via Paolo Bonzini * bonzini/nbd-next: nbd: strip braces from literal IPv6 address in URI qemu-socket: allow hostnames starting with a digit
Diffstat (limited to 'util')
-rw-r--r--util/qemu-sockets.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index fdd8dc4..96eca2a 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -24,7 +24,6 @@
#include "monitor/monitor.h"
#include "qemu/sockets.h"
-#include "qemu-common.h" /* for qemu_isdigit */
#include "qemu/main-loop.h"
#ifndef AI_ADDRCONFIG
@@ -511,19 +510,15 @@ InetSocketAddress *inet_parse(const char *str, Error **errp)
goto fail;
}
addr->ipv6 = addr->has_ipv6 = true;
- } else if (qemu_isdigit(str[0])) {
- /* IPv4 addr */
- if (2 != sscanf(str, "%64[0-9.]:%32[^,]%n", host, port, &pos)) {
- error_setg(errp, "error parsing IPv4 address '%s'", str);
- goto fail;
- }
- addr->ipv4 = addr->has_ipv4 = true;
} else {
- /* hostname */
+ /* hostname or IPv4 addr */
if (2 != sscanf(str, "%64[^:]:%32[^,]%n", host, port, &pos)) {
error_setg(errp, "error parsing address '%s'", str);
goto fail;
}
+ if (host[strspn(host, "0123456789.")] == '\0') {
+ addr->ipv4 = addr->has_ipv4 = true;
+ }
}
addr->host = g_strdup(host);