From 6b259fffb22977f307ab3bd1170418d51001ef14 Mon Sep 17 00:00:00 2001 From: travankor Date: Mon, 22 Oct 2018 13:15:31 -0700 Subject: [PATCH] musl: backport fix for getaddrinfo regression. --- ...regression-with-AI_ADDRCONFIG-on-som.patch | 52 +++++++++++++++++++ srcpkgs/musl/template | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/musl/patches/0001-fix-getaddrinfo-regression-with-AI_ADDRCONFIG-on-som.patch diff --git a/srcpkgs/musl/patches/0001-fix-getaddrinfo-regression-with-AI_ADDRCONFIG-on-som.patch b/srcpkgs/musl/patches/0001-fix-getaddrinfo-regression-with-AI_ADDRCONFIG-on-som.patch new file mode 100644 index 00000000000..1160ee18acf --- /dev/null +++ b/srcpkgs/musl/patches/0001-fix-getaddrinfo-regression-with-AI_ADDRCONFIG-on-som.patch @@ -0,0 +1,52 @@ +From f381c118b2d4f7d914481d3cdc830ce41369b002 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Wed, 19 Sep 2018 18:03:22 -0400 +Subject: [PATCH] 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 src/network/getaddrinfo.c src/network/getaddrinfo.c +index ba26847a..e33bfa28 100644 +--- src/network/getaddrinfo.c ++++ 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]; + } +-- +2.18.0 + diff --git a/srcpkgs/musl/template b/srcpkgs/musl/template index 096aa12bcca..ca2487800c9 100644 --- a/srcpkgs/musl/template +++ b/srcpkgs/musl/template @@ -1,7 +1,7 @@ # Template file for 'musl'. pkgname=musl version=1.1.20 -revision=1 +revision=2 build_style=gnu-configure configure_args="--prefix=/usr --disable-gcc-wrapper" conflicts="glibc>=0"