add fix-ipv6-brackets.patch

This commit is contained in:
Paolo Bonzini 2013-06-04 23:38:42 +02:00
parent 441340007b
commit 5ccf22180d
2 changed files with 88 additions and 0 deletions

81
fix-ipv6-brackets.patch Normal file
View File

@ -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 */

View File

@ -189,6 +189,8 @@ Patch0004: 0004-pc_piix-Add-compat-handling-for-qemu-kvm-VGA-mem-siz.patch
# Fix migration w/ qxl from qemu-kvm 1.2 (solution pending upstream)
Patch0005: 0005-qxl-Add-rom_size-compat-property-fix-migration-from-.patch
Patch0999: fix-ipv6-brackets.patch
BuildRequires: SDL-devel
BuildRequires: zlib-devel
BuildRequires: which
@ -685,6 +687,8 @@ CAC emulation development files.
# Fix migration w/ qxl from qemu-kvm 1.2 (solution pending upstream)
%patch0005 -p1
%patch0999 -p1
%build
%if %{with kvmonly}
@ -1364,6 +1368,9 @@ getent passwd qemu >/dev/null || \
%endif
%changelog
* Tue Jun 4 2013 Paolo Bonzini <pbonzini@redhat.com> 2:1.5.0-5
- add fix-ipv6-brackets.patch
* Sat Jun 1 2013 Peter Robinson <pbrobinson@fedoraproject.org> 2:1.5.0-4
- build qemu-kvm on ARMv7