[qemu/private-bonzini-demo] add fix-ipv6-brackets.patch

bonzini bonzini at fedoraproject.org
Tue Jun 4 21:41:16 UTC 2013


commit 04f3006c4f751c9931bf4494fc4b1dc6933f7da4
Author: Paolo Bonzini <pbonzini at redhat.com>
Date:   Tue Jun 4 23:38:42 2013 +0200

    add fix-ipv6-brackets.patch

 fix-ipv6-brackets.patch |   81 +++++++++++++++++++++++++++++++++++++++++++++++
 qemu.spec               |   12 ++++++-
 2 files changed, 91 insertions(+), 2 deletions(-)
---
diff --git a/fix-ipv6-brackets.patch b/fix-ipv6-brackets.patch
new file mode 100644
index 0000000..84a1676
--- /dev/null
+++ b/fix-ipv6-brackets.patch
@@ -0,0 +1,81 @@
+needed for rh summit demo, jan tomko should get a better patch in 1.5.1.
+
+diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
+index fdd8dc4..e3051f3 100644
+--- a/util/qemu-sockets.c
++++ b/util/qemu-sockets.c
+@@ -61,6 +61,25 @@ QemuOptsList socket_optslist = {
+     },
+ };
+ 
++static int qemu_getaddrinfo(const char *node, const char *service,
++                            const struct addrinfo *hints,
++                            struct addrinfo **res)
++{
++    int ret;
++
++    if (node[0] == '[') {
++        int len = strlen(node);
++        if (node[len - 1] == ']') {
++            char *ipv6_node = g_strndup(node + 1, len - 2);
++            ret = getaddrinfo(ipv6_node, service, hints, res);
++            g_free(ipv6_node);
++            return ret;
++        }
++    }
++
++    return getaddrinfo(node, service, hints, res);
++}
++
+ static int inet_getport(struct addrinfo *e)
+ {
+     struct sockaddr_in *i4;
+@@ -136,7 +155,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
+     /* lookup */
+     if (port_offset)
+         snprintf(port, sizeof(port), "%d", atoi(port) + port_offset);
+-    rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
++    rc = qemu_getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
+     if (rc != 0) {
+         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
+                    gai_strerror(rc));
+@@ -328,7 +347,7 @@ static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp)
+     }
+ 
+     /* lookup */
+-    rc = getaddrinfo(addr, port, &ai, &res);
++    rc = qemu_getaddrinfo(addr, port, &ai, &res);
+     if (rc != 0) {
+         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
+                    gai_strerror(rc));
+@@ -424,7 +443,7 @@ int inet_dgram_opts(QemuOpts *opts, Error **errp)
+     if (qemu_opt_get_bool(opts, "ipv6", 0))
+         ai.ai_family = PF_INET6;
+ 
+-    if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) {
++    if (0 != (rc = qemu_getaddrinfo(addr, port, &ai, &peer))) {
+         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
+                    gai_strerror(rc));
+ 	return -1;
+@@ -444,7 +463,7 @@ int inet_dgram_opts(QemuOpts *opts, Error **errp)
+     if (!port || strlen(port) == 0)
+         port = "0";
+ 
+-    if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) {
++    if (0 != (rc = qemu_getaddrinfo(addr, port, &ai, &local))) {
+         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
+                    gai_strerror(rc));
+         goto err;
+@@ -506,10 +525,11 @@ InetSocketAddress *inet_parse(const char *str, Error **errp)
+         }
+     } else if (str[0] == '[') {
+         /* IPv6 addr */
+-        if (2 != sscanf(str, "[%64[^]]]:%32[^,]%n", host, port, &pos)) {
++        if (2 != sscanf(str, "%63[^]]]:%32[^,]%n", host, port, &pos)) {
+             error_setg(errp, "error parsing IPv6 address '%s'", str);
+             goto fail;
+         }
++        strcat(host, "]");
+         addr->ipv6 = addr->has_ipv6 = true;
+     } else if (qemu_isdigit(str[0])) {
+         /* IPv4 addr */
diff --git a/qemu.spec b/qemu.spec
index 580f540..187509e 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -131,7 +131,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 1.4.2
-Release: 2%{?dist}
+Release: 3%{?dist}
 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
@@ -244,6 +244,8 @@ Patch0203: 0203-i8254-Fix-migration-from-qemu-kvm-1.1.patch
 Patch0204: 0204-pc_piix-Add-compat-handling-for-qemu-kvm-VGA-mem-siz.patch
 Patch0205: 0205-qxl-Add-rom_size-compat-property-fix-migration-from-.patch
 
+Patch0999: fix-ipv6-brackets.patch
+
 BuildRequires: SDL-devel
 BuildRequires: zlib-devel
 BuildRequires: which
@@ -776,6 +778,9 @@ CAC emulation development files.
 %patch0204 -p1
 %patch0205 -p1
 
+%patch0999 -p1
+
+
 %build
 %if %{with kvmonly}
     buildarch="%{kvm_target}-softmmu"
@@ -1421,7 +1426,10 @@ getent passwd qemu >/dev/null || \
 %endif
 
 %changelog
-* Mon May 27 2013 Dan Horák <dan[at]danny.cz> - 2:1.4.2-2
+* Tue Jun  4 2013 Paolo Bonzini <pbonzini at redhat.com> 2:1.5.0-5
+- add fix-ipv6-brackets.patch
+
+* Mon May 27 2013 Dan Horák <dan[at]danny.cz> - 2:1.5.0-3
 - Install the qemu-kvm.1 man page only on arches with kvm
 
 * Sat May 25 2013 Cole Robinson <crobinso at redhat.com> - 2:1.4.2-1


More information about the scm-commits mailing list