Blame SOURCES/0002-mpl-do-not-require-non-loopback-networking.patch

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