mpich/SOURCES/0001-mpl-limit-scope-on-mac...

35 lines
1.5 KiB
Diff

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