* [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches)
@ 2013-06-18 10:52 Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI Paolo Bonzini
0 siblings, 2 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-06-18 10:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Ján Tomko, mdroth, qemu-stable
The following changes since commit afd59989db90683fa127fec501d2633bcfbd6379:
intc/xilinx_intc: Dont lower IRQ when HIE cleared (2013-06-18 09:45:00 +0200)
are available in the git repository at:
git://github.com/bonzini/qemu.git nbd-next
for you to fetch changes up to 23307908790cd8fad91220863d7712c571ddc977:
nbd: strip braces from literal IPv6 address in URI (2013-06-18 11:43:00 +0200)
----------------------------------------------------------------
Ján Tomko (2):
qemu-socket: allow hostnames starting with a digit
nbd: strip braces from literal IPv6 address in URI
block/nbd.c | 11 ++++++++++-
util/qemu-sockets.c | 13 ++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit
2013-06-18 10:52 [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches) Paolo Bonzini
@ 2013-06-18 10:52 ` Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI Paolo Bonzini
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-06-18 10:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Ján Tomko, mdroth, qemu-stable
From: Ján Tomko <jtomko@redhat.com>
According to RFC 1123 [1], hostnames can start with a digit too.
[1] http://tools.ietf.org/html/rfc1123#page-13
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
[Use strspn, not strcspn. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
util/qemu-sockets.c | 13 ++++---------
1 file 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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI
2013-06-18 10:52 [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches) Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Paolo Bonzini
@ 2013-06-18 10:52 ` Paolo Bonzini
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-06-18 10:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Ján Tomko, mdroth, qemu-stable
From: Ján Tomko <jtomko@redhat.com>
Otherwise they would get passed to getaddrinfo and fail with:
address resolution failed for [::1]:1234: Name or service not known
(Broken by commit v1.4.0-736-gf17c90b)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/nbd.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block/nbd.c b/block/nbd.c
index 30e3b78..9c480b8 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -118,13 +118,22 @@ static int nbd_parse_uri(const char *filename, QDict *options)
}
qdict_put(options, "path", qstring_from_str(qp->p[0].value));
} else {
+ QString *host;
/* nbd[+tcp]://host[:port]/export */
if (!uri->server) {
ret = -EINVAL;
goto out;
}
- qdict_put(options, "host", qstring_from_str(uri->server));
+ /* strip braces from literal IPv6 address */
+ if (uri->server[0] == '[') {
+ host = qstring_from_substr(uri->server, 1,
+ strlen(uri->server) - 2);
+ } else {
+ host = qstring_from_str(uri->server);
+ }
+
+ qdict_put(options, "host", host);
if (uri->port) {
char* port_str = g_strdup_printf("%d", uri->port);
qdict_put(options, "port", qstring_from_str(port_str));
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit
2013-06-18 14:14 [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches) Paolo Bonzini
@ 2013-06-18 14:14 ` Paolo Bonzini
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2013-06-18 14:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Ján Tomko, qemu-stable
From: Ján Tomko <jtomko@redhat.com>
According to RFC 1123 [1], hostnames can start with a digit too.
[1] http://tools.ietf.org/html/rfc1123#page-13
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
[Use strspn, not strcspn. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
util/qemu-sockets.c | 13 ++++---------
1 file 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);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit
2013-06-18 9:42 ` Paolo Bonzini
@ 2013-06-18 11:29 ` Ján Tomko
0 siblings, 0 replies; 7+ messages in thread
From: Ján Tomko @ 2013-06-18 11:29 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On 06/18/2013 11:42 AM, Paolo Bonzini wrote:
> Il 03/06/2013 17:54, Ján Tomko ha scritto:
>> According to RFC 1123 [1], hostnames can start with a digit too.
>>
>> [1] http://tools.ietf.org/html/rfc1123#page-13
>>
>> Signed-off-by: Ján Tomko <jtomko@redhat.com>
>> ---
>> } 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 (strcspn(host, "0123456789.") == 0) {
>
> I think what you want here is:
>
> if (host[strspn(host, "0123456789.")] == '\0') {
>
Yes, thank you for catching that.
Jan
> Otherwise, you're still basically testing
>
> qemu_isdigit(str[0]) || str[0] == '.'
>
> Paolo
>
>> + addr->ipv4 = addr->has_ipv4 = true;
>> + }
>> }
>>
>> addr->host = g_strdup(host);
>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit
2013-06-03 15:54 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Ján Tomko
@ 2013-06-18 9:42 ` Paolo Bonzini
2013-06-18 11:29 ` Ján Tomko
0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2013-06-18 9:42 UTC (permalink / raw)
To: Ján Tomko; +Cc: qemu-devel
Il 03/06/2013 17:54, Ján Tomko ha scritto:
> According to RFC 1123 [1], hostnames can start with a digit too.
>
> [1] http://tools.ietf.org/html/rfc1123#page-13
>
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
> util/qemu-sockets.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index fdd8dc4..727dafa 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 (strcspn(host, "0123456789.") == 0) {
I think what you want here is:
if (host[strspn(host, "0123456789.")] == '\0') {
Otherwise, you're still basically testing
qemu_isdigit(str[0]) || str[0] == '.'
Paolo
> + addr->ipv4 = addr->has_ipv4 = true;
> + }
> }
>
> addr->host = g_strdup(host);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit
2013-06-03 15:54 [Qemu-devel] [PATCH 0/2] Fix NBD hostname parsing issues Ján Tomko
@ 2013-06-03 15:54 ` Ján Tomko
2013-06-18 9:42 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Ján Tomko @ 2013-06-03 15:54 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
According to RFC 1123 [1], hostnames can start with a digit too.
[1] http://tools.ietf.org/html/rfc1123#page-13
Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
util/qemu-sockets.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index fdd8dc4..727dafa 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 (strcspn(host, "0123456789.") == 0) {
+ addr->ipv4 = addr->has_ipv4 = true;
+ }
}
addr->host = g_strdup(host);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-18 14:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18 10:52 [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches) Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Paolo Bonzini
2013-06-18 10:52 ` [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2013-06-18 14:14 [Qemu-devel] [PULL 0/2] NBD changes for 2013-06-18 (including 1.5.1 patches) Paolo Bonzini
2013-06-18 14:14 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Paolo Bonzini
2013-06-03 15:54 [Qemu-devel] [PATCH 0/2] Fix NBD hostname parsing issues Ján Tomko
2013-06-03 15:54 ` [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit Ján Tomko
2013-06-18 9:42 ` Paolo Bonzini
2013-06-18 11:29 ` Ján Tomko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.