From: Paolo Bonzini <pbonzini@redhat.com>
To: "Ján Tomko" <jtomko@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI
Date: Tue, 04 Jun 2013 23:27:26 +0200 [thread overview]
Message-ID: <51AE5BBE.2070908@redhat.com> (raw)
In-Reply-To: <338c8491ea5865aca71d84175673a2b164e3bf85.1370274768.git.jtomko@redhat.com>
Il 03/06/2013 17:54, Ján Tomko ha scritto:
> Otherwise they would get passed to getaddrinfo and fail with:
> address resolution failed for [::1]:1234: Name or service not known
Hmm... Hai Huang found a similar problem:
error: internal error unable to execute QEMU command 'nbd-server-start':
address resolution failed for [::]:5900: Name or service not known
This one is a libvirt bug, but perhaps it's simpler to just have a
wrapper for getaddrinfo that strips brackets (and not strip the brackets
in inet_parse, too).
Paolo
> (Broken by commit v1.4.0-736-gf17c90b)
>
> Signed-off-by: Ján Tomko <jtomko@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));
>
next prev parent reply other threads:[~2013-06-04 21:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2013-06-03 15:54 ` [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI Ján Tomko
2013-06-04 21:27 ` Paolo Bonzini [this message]
2013-06-13 14:55 ` Ján Tomko
2013-06-03 20:15 ` [Qemu-devel] [PATCH 0/2] Fix NBD hostname parsing issues Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
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 2/2] nbd: strip braces from literal IPv6 address in URI Paolo Bonzini
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 2/2] nbd: strip braces from literal IPv6 address in URI Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51AE5BBE.2070908@redhat.com \
--to=pbonzini@redhat.com \
--cc=jtomko@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).