From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujyla-0004sW-QE for qemu-devel@nongnu.org; Tue, 04 Jun 2013 17:27:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjylZ-0001YU-Hc for qemu-devel@nongnu.org; Tue, 04 Jun 2013 17:27:42 -0400 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:41011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjylZ-0001YP-DF for qemu-devel@nongnu.org; Tue, 04 Jun 2013 17:27:41 -0400 Received: by mail-qa0-f48.google.com with SMTP id f14so719007qak.7 for ; Tue, 04 Jun 2013 14:27:41 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51AE5BBE.2070908@redhat.com> Date: Tue, 04 Jun 2013 23:27:26 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <338c8491ea5865aca71d84175673a2b164e3bf85.1370274768.git.jtomko@redhat.com> In-Reply-To: <338c8491ea5865aca71d84175673a2b164e3bf85.1370274768.git.jtomko@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 2/2] nbd: strip braces from literal IPv6 address in URI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?SsOhbiBUb21rbw==?= Cc: qemu-devel@nongnu.org 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 > --- > 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)); >