]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
qemu : add drive-mirror sleep patches
[pve-qemu-kvm.git] / debian / patches / 0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
CommitLineData
580562d4
WB
1From dea9f9c5d03983bb6a9c75f093b2f9c49e4a5397 Mon Sep 17 00:00:00 2001
2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3Date: Thu, 21 May 2015 10:48:21 +0200
4Subject: [PATCH] friendlier ai_flag hints for ipv6 hosts
5
6*) Do not use AI_ADDRCONFIG on listening sockets, because this flag
7makes it impossible to explicitly listen on '127.0.0.1' if no global
8ipv4 address is configured additionally, making this a very
9uncomfortable option.
10*) Add AI_V4MAPPED hint for connecting sockets for a similar purpose.
11
12If your system is globally only connected via ipv6 you still want to be
13able to use '127.0.0.1' and 'localhost'.
14Specifically, PVE - unless explicitly asking for insecure mode - uses
15loopback addresses with QEMU for live migrations tunneled over SSH.
16These fail to start because AI_ADDRCONFIG makes getaddrinfo refuse to
17work with '127.0.0.1'.
18
19As for the AI_V4MAPPED flag the situation is similar.
20
21I also want to point out that glibc explicitly sidesteps POSIX standards
22when passing 0 as hints by then assuming both AI_V4MAPPED and
23AI_ADDRCONFIG (the latter being a rather weird choice IMO), while
24according to POSIX.1-2001 it should be assumed 0. (glibc considers its
25choice an improvement.)
26Since either AI_CANONNAME or AI_PASSIVE are passed in our cases, glibc's
27default flags in turn are disabled again unless explicitly added, which
28I do with this patch.
29---
30 util/qemu-sockets.c | 6 +++---
31 1 file changed, 3 insertions(+), 3 deletions(-)
32
33diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
34index 6b97dc1..f99b013 100644
35--- a/util/qemu-sockets.c
36+++ b/util/qemu-sockets.c
37@@ -114,7 +114,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
38 int slisten, rc, to, port_min, port_max, p;
39
40 memset(&ai,0, sizeof(ai));
41- ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
42+ ai.ai_flags = AI_PASSIVE;
43 ai.ai_family = PF_UNSPEC;
44 ai.ai_socktype = SOCK_STREAM;
45
46@@ -308,7 +308,7 @@ static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp)
47
48 memset(&ai, 0, sizeof(ai));
49
50- ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
51+ ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG;
52 ai.ai_family = PF_UNSPEC;
53 ai.ai_socktype = SOCK_STREAM;
54
55@@ -404,7 +404,7 @@ int inet_dgram_opts(QemuOpts *opts, Error **errp)
56
57 /* lookup peer addr */
58 memset(&ai,0, sizeof(ai));
59- ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
60+ ai.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG;
61 ai.ai_family = PF_UNSPEC;
62 ai.ai_socktype = SOCK_DGRAM;
63
64--
652.1.4
66