Add the patches

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-09-15 16:27:29 +02:00
parent 83883a482f
commit 5689195cb9
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From fbb8f503df077c726b0c99d467bc984566273b92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 15 Sep 2020 14:20:17 +0200
Subject: [PATCH 1/2] mpl: limit scope on macos .local workaround
This was added in 62f4178981617384fc116da4c839baf469bef512.
Assuming that "localhost" is equivalent to any name ending in .local
is unwarranted. RFC6762 reserves the ".local" suffix for MulticastDNS use,
but it is also used in other context for "local network" addresses and such.
So let's at least limit the scope to not hurt other systems.
---
src/mpl/src/sock/mpl_sockaddr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mpl/src/sock/mpl_sockaddr.c b/src/mpl/src/sock/mpl_sockaddr.c
index 51e9f9973f..9334cc4fb2 100644
--- a/src/mpl/src/sock/mpl_sockaddr.c
+++ b/src/mpl/src/sock/mpl_sockaddr.c
@@ -75,6 +75,7 @@ int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr)
struct addrinfo *ai_list;
int ret;
+#ifdef __APPLE__
/* Macos adds .local to hostname when network is unavailable or limited.
* This will result in long timeout in getaddrinfo below.
* Bypass it by resetting the hostname to "localhost"
@@ -83,6 +84,7 @@ int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr)
if (n > 6 && strcmp(s_hostname + n - 6, ".local") == 0) {
s_hostname = "localhost";
}
+#endif
/* NOTE: there is report that getaddrinfo implementations will call kernel
* even when s_hostname is entirely numerical string and it may cause

View File

@ -0,0 +1,57 @@
From ecb72e6699f4f8525115e0b42f81121a1cf8eefa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 15 Sep 2020 14:59:58 +0200
Subject: [PATCH 2/2] mpl: do not require non-loopback networking
getaddrinfo(3) says:
If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4
addresses are returned in the list pointed to by res only if the
local system has at least one IPv4 address configured, and IPv6
addresses are returned only if the local system has at least one
IPv6 address configured. The loopback address is not considered for
this case as valid as a configured address.
This means that MPL_get_sockaddr() will fail to resolve the local host
(either as "localhost" or by the actual hostname) on a system that has
no non-loopback networking. This break exection of mpirun e.g. in a
container for tests and such.
From https://bugzilla.redhat.com/show_bug.cgi?id=1839007:
<mock-chroot> sh-5.0# hostname
68da8e7c62a2404bb4bf75c9ce643e06
<mock-chroot> sh-5.0# module load mpi/mpich-x86_64
<mock-chroot> sh-5.0# mpirun ./a.out
Fatal error in PMPI_Init: Other MPI error, error stack:
MPIR_Init_thread(586)..............:
MPID_Init(224).....................: channel initialization failed
MPIDI_CH3_Init(105)................:
MPID_nem_init(324).................:
MPID_nem_tcp_init(175).............:
MPID_nem_tcp_get_business_card(404):
MPID_nem_tcp_init(375).............: gethostbyname failed, 68da8e7c62a2404bb4bf75c9ce643e06 (errno 0)
<mock-chroot> sh-5.0# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
---
src/mpl/src/sock/mpl_sockaddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mpl/src/sock/mpl_sockaddr.c b/src/mpl/src/sock/mpl_sockaddr.c
index 9334cc4fb2..c0e991c68d 100644
--- a/src/mpl/src/sock/mpl_sockaddr.c
+++ b/src/mpl/src/sock/mpl_sockaddr.c
@@ -98,7 +98,7 @@ int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr)
ai_hint.ai_family = af_type;
ai_hint.ai_socktype = SOCK_STREAM;
ai_hint.ai_protocol = IPPROTO_TCP;
- ai_hint.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED;
+ ai_hint.ai_flags = AI_V4MAPPED;
ret = getaddrinfo(s_hostname, NULL, &ai_hint, &ai_list);
if (ret) {
return ret;