1 |
commit: c731a1c2ac72c2e89882d808cab1e924aef01324 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 3 21:23:21 2017 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 3 21:23:42 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c731a1c2 |
7 |
|
8 |
media-libs/liblo: Fixed build with USE="ipv6" (bug #627832). |
9 |
|
10 |
Package-Manager: Portage-2.3.8, Repoman-2.3.3 |
11 |
|
12 |
.../liblo/files/liblo-0.29-ipv6_build_fix.patch | 133 +++++++++++++++++++++ |
13 |
media-libs/liblo/liblo-0.29.ebuild | 4 + |
14 |
2 files changed, 137 insertions(+) |
15 |
|
16 |
diff --git a/media-libs/liblo/files/liblo-0.29-ipv6_build_fix.patch b/media-libs/liblo/files/liblo-0.29-ipv6_build_fix.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..484fddbd603 |
19 |
--- /dev/null |
20 |
+++ b/media-libs/liblo/files/liblo-0.29-ipv6_build_fix.patch |
21 |
@@ -0,0 +1,133 @@ |
22 |
+From 968dff4d576ca102525c81beddb36a623890424b Mon Sep 17 00:00:00 2001 |
23 |
+From: Stephen Sinclair <radarsat1@×××××.com> |
24 |
+Date: Tue, 29 Aug 2017 14:32:24 -0300 |
25 |
+Subject: [PATCH] Resolve hostname using getnameinfo for ipv6 support. |
26 |
+ |
27 |
+Iterates on interfaces, possibly searching for a pre-selected |
28 |
+interface, and resolves the hostname associated with non-localhost |
29 |
+addresses. |
30 |
+ |
31 |
+Fixes #56, fix compilation with --enable-ipv6. |
32 |
+--- |
33 |
+ src/server.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- |
34 |
+ src/testlo.c | 7 ++++++ |
35 |
+ 2 files changed, 72 insertions(+), 9 deletions(-) |
36 |
+ |
37 |
+diff --git a/src/server.c b/src/server.c |
38 |
+index cf20495..4aff673 100644 |
39 |
+--- a/src/server.c |
40 |
++++ b/src/server.c |
41 |
+@@ -55,6 +55,10 @@ |
42 |
+ #endif |
43 |
+ #include <sys/un.h> |
44 |
+ #include <arpa/inet.h> |
45 |
++#include <netinet/in.h> |
46 |
++#ifdef HAVE_GETIFADDRS |
47 |
++#include <ifaddrs.h> |
48 |
++#endif |
49 |
+ #endif |
50 |
+ |
51 |
+ #if defined(WIN32) || defined(_MSC_VER) |
52 |
+@@ -298,20 +302,72 @@ void lo_server_resolve_hostname(lo_server s) |
53 |
+ /* Set hostname to empty string */ |
54 |
+ hostname[0] = '\0'; |
55 |
+ |
56 |
+-#ifdef ENABLE_IPV6 |
57 |
++#if defined(ENABLE_IPV6) && defined(HAVE_GETIFADDRS) |
58 |
+ /* Try it the IPV6 friendly way first */ |
59 |
+- for (it = ai; it; it = it->ai_next) { |
60 |
+- if (getnameinfo(it->ai_addr, it->ai_addrlen, hostname, |
61 |
+- sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0) { |
62 |
++ do { |
63 |
++ struct ifaddrs *ifa, *ifa_list; |
64 |
++ if (getifaddrs(&ifa_list)) |
65 |
+ break; |
66 |
++ ifa = ifa_list; |
67 |
++ |
68 |
++ while (ifa) { |
69 |
++ if (!ifa->ifa_addr) { |
70 |
++ ifa = ifa->ifa_next; |
71 |
++ continue; |
72 |
++ } |
73 |
++ |
74 |
++ if (s->addr_if.iface) { |
75 |
++ if (s->addr_if.size == sizeof(struct in_addr) |
76 |
++ && (ifa->ifa_addr->sa_family == AF_INET)) |
77 |
++ { |
78 |
++ struct sockaddr_in *sin = (struct sockaddr_in*)ifa->ifa_addr; |
79 |
++ if (memcmp(&sin->sin_addr, &s->addr_if.a.addr, sizeof(struct in_addr))!=0 |
80 |
++ || (s->addr_if.iface && ifa->ifa_name |
81 |
++ && strcmp(s->addr_if.iface, ifa->ifa_name)!=0)) |
82 |
++ { |
83 |
++ ifa = ifa->ifa_next; |
84 |
++ continue; |
85 |
++ } |
86 |
++ } |
87 |
++ else if (s->addr_if.size == sizeof(struct in6_addr) |
88 |
++ && (ifa->ifa_addr->sa_family == AF_INET6)) |
89 |
++ { |
90 |
++ struct sockaddr_in6 *sin = (struct sockaddr_in6*)ifa->ifa_addr; |
91 |
++ if (memcmp(&sin->sin6_addr, &s->addr_if.a.addr6, |
92 |
++ sizeof(struct in6_addr))!=0 |
93 |
++ || (s->addr_if.iface && ifa->ifa_name |
94 |
++ && strcmp(s->addr_if.iface, ifa->ifa_name)!=0)) |
95 |
++ { |
96 |
++ ifa = ifa->ifa_next; |
97 |
++ continue; |
98 |
++ } |
99 |
++ } |
100 |
++ } |
101 |
++ |
102 |
++ if ((ifa->ifa_addr->sa_family == AF_INET |
103 |
++ && (!s->addr_if.iface || s->addr_if.size == sizeof(struct in_addr)) |
104 |
++ && (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), hostname, |
105 |
++ sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0)) |
106 |
++ || (ifa->ifa_addr->sa_family == AF_INET6 |
107 |
++ && (!s->addr_if.iface || s->addr_if.size == sizeof(struct in6_addr)) |
108 |
++ && (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), hostname, |
109 |
++ sizeof(hostname), NULL, 0, NI_NAMEREQD) == 0))) |
110 |
++ { |
111 |
++ /* check to make sure getnameinfo() didn't just set the hostname to "::". |
112 |
++ Needed on Darwin. */ |
113 |
++ if (hostname[0] == ':') |
114 |
++ hostname[0] = '\0'; |
115 |
++ else if (strcmp(hostname, "localhost")==0) |
116 |
++ hostname[0] = '\0'; |
117 |
++ else |
118 |
++ break; |
119 |
++ } |
120 |
++ ifa = ifa->ifa_next; |
121 |
+ } |
122 |
+- } |
123 |
+ |
124 |
+- /* check to make sure getnameinfo() didn't just set the hostname to "::". |
125 |
+- Needed on Darwin. */ |
126 |
+- if (hostname[0] == ':') { |
127 |
+- hostname[0] = '\0'; |
128 |
++ freeifaddrs(ifa_list); |
129 |
+ } |
130 |
++ while (0); |
131 |
+ #endif |
132 |
+ |
133 |
+ /* Fallback to the oldschool (i.e. more reliable) way */ |
134 |
+diff --git a/src/testlo.c b/src/testlo.c |
135 |
+index c128d10..c69570c 100644 |
136 |
+--- a/src/testlo.c |
137 |
++++ b/src/testlo.c |
138 |
+@@ -704,6 +704,13 @@ void test_multicast(lo_server_thread st) |
139 |
+ |
140 |
+ DOING("test_multicast"); |
141 |
+ |
142 |
++#ifdef ENABLE_IPV6 |
143 |
++ // Print a warning but we let it fail, prefer to actually fix IPv6 |
144 |
++ // support rather than just skip the test! |
145 |
++ printf("WARNING: Compiled with --enable-ipv6, multicast not supported;" |
146 |
++ "failure expected.\n"); |
147 |
++#endif |
148 |
++ |
149 |
+ /* test multicast server and sender */ |
150 |
+ /* message is sent from st otherwise reply doesn't work */ |
151 |
+ ms = lo_server_new_multicast("224.0.1.1", "15432", error); |
152 |
+-- |
153 |
+2.14.1 |
154 |
+ |
155 |
|
156 |
diff --git a/media-libs/liblo/liblo-0.29.ebuild b/media-libs/liblo/liblo-0.29.ebuild |
157 |
index b9fc3ba9519..0397195ad00 100644 |
158 |
--- a/media-libs/liblo/liblo-0.29.ebuild |
159 |
+++ b/media-libs/liblo/liblo-0.29.ebuild |
160 |
@@ -17,6 +17,10 @@ RESTRICT="test" |
161 |
|
162 |
DEPEND="doc? ( app-doc/doxygen )" |
163 |
|
164 |
+PATCHES=( |
165 |
+ "${FILESDIR}/${P}-ipv6_build_fix.patch" #627832 |
166 |
+) |
167 |
+ |
168 |
src_prepare() { |
169 |
default |