]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
remove tcmalloc default memory allocator
[pve-qemu-kvm.git] / debian / patches / 0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
1 From dea9f9c5d03983bb6a9c75f093b2f9c49e4a5397 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Thu, 21 May 2015 10:48:21 +0200
4 Subject: [PATCH] friendlier ai_flag hints for ipv6 hosts
5
6 *) Do not use AI_ADDRCONFIG on listening sockets, because this flag
7 makes it impossible to explicitly listen on '127.0.0.1' if no global
8 ipv4 address is configured additionally, making this a very
9 uncomfortable option.
10 *) Add AI_V4MAPPED hint for connecting sockets for a similar purpose.
11
12 If your system is globally only connected via ipv6 you still want to be
13 able to use '127.0.0.1' and 'localhost'.
14 Specifically, PVE - unless explicitly asking for insecure mode - uses
15 loopback addresses with QEMU for live migrations tunneled over SSH.
16 These fail to start because AI_ADDRCONFIG makes getaddrinfo refuse to
17 work with '127.0.0.1'.
18
19 As for the AI_V4MAPPED flag the situation is similar.
20
21 I also want to point out that glibc explicitly sidesteps POSIX standards
22 when passing 0 as hints by then assuming both AI_V4MAPPED and
23 AI_ADDRCONFIG (the latter being a rather weird choice IMO), while
24 according to POSIX.1-2001 it should be assumed 0. (glibc considers its
25 choice an improvement.)
26 Since either AI_CANONNAME or AI_PASSIVE are passed in our cases, glibc's
27 default flags in turn are disabled again unless explicitly added, which
28 I do with this patch.
29 ---
30 util/qemu-sockets.c | 6 +++---
31 1 file changed, 3 insertions(+), 3 deletions(-)
32
33 diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
34 index 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 --
65 2.1.4
66