summaryrefslogtreecommitdiff
path: root/system/musl/getaddrinfo-regression.patch
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2018-09-25 02:48:42 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2018-09-25 02:48:42 +0000
commit0e0678178f66c09afba1170ae74495c20fc01e4f (patch)
tree12faab1eb097e80f41ef9aec9e70c150dc66bae5 /system/musl/getaddrinfo-regression.patch
parentba4b0b361fdd750206f4707cf214e4cd5c17833e (diff)
parenta64a0cacd626e596036d5330f443e6b144d22816 (diff)
downloadpackages-0e0678178f66c09afba1170ae74495c20fc01e4f.tar.gz
packages-0e0678178f66c09afba1170ae74495c20fc01e4f.tar.bz2
packages-0e0678178f66c09afba1170ae74495c20fc01e4f.tar.xz
packages-0e0678178f66c09afba1170ae74495c20fc01e4f.zip
Merge branch 'musl-patches' into 'master'
system/musl: patch stdio locking, dcngettext, getaddrinfo See merge request !73
Diffstat (limited to 'system/musl/getaddrinfo-regression.patch')
-rw-r--r--system/musl/getaddrinfo-regression.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/system/musl/getaddrinfo-regression.patch b/system/musl/getaddrinfo-regression.patch
new file mode 100644
index 000000000..28d4558b8
--- /dev/null
+++ b/system/musl/getaddrinfo-regression.patch
@@ -0,0 +1,51 @@
+From f381c118b2d4f7d914481d3cdc830ce41369b002 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 19 Sep 2018 18:03:22 -0400
+Subject: fix getaddrinfo regression with AI_ADDRCONFIG on some configurations
+
+despite not being documented to do so in the standard or Linux
+documentation, attempts to udp connect to 127.0.0.1 or ::1 generate
+EADDRNOTAVAIL when the loopback device is not configured and there is
+no default route for IPv6. this caused getaddrinfo with AI_ADDRCONFIG
+to fail with EAI_SYSTEM and EADDRNOTAVAIL on some no-IPv6
+configurations, rather than the intended behavior of detecting IPv6 as
+unsuppported and producing IPv4-only results.
+
+previously, only EAFNOSUPPORT was treated as unavailability of the
+address family being probed. instead, treat all errors related to
+inability to get an address or route as conclusive that the family
+being probed is unsupported, and only fail with EAI_SYSTEM on other
+errors.
+
+further improvements may be desirable, such as reporting EAI_AGAIN
+instead of EAI_SYSTEM for errors which are expected to be transient,
+but this patch should suffice to fix the serious regression.
+---
+ src/network/getaddrinfo.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
+index ba26847a..e33bfa28 100644
+--- a/src/network/getaddrinfo.c
++++ b/src/network/getaddrinfo.c
+@@ -76,7 +76,16 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
+ close(s);
+ if (!r) continue;
+ }
+- if (errno != EAFNOSUPPORT) return EAI_SYSTEM;
++ switch (errno) {
++ case EADDRNOTAVAIL:
++ case EAFNOSUPPORT:
++ case EHOSTUNREACH:
++ case ENETDOWN:
++ case ENETUNREACH:
++ break;
++ default:
++ return EAI_SYSTEM;
++ }
+ if (family == tf[i]) return EAI_NONAME;
+ family = tf[1-i];
+ }
+--
+cgit v1.2.1
+