Blame otp-0007-Fix-erl_epmd-port_please-when-using-IPv6.patch

fc59c2
From: John Eckersberg <jeckersb@redhat.com>
fc59c2
Date: Wed, 14 Jun 2017 12:32:17 -0400
fc59c2
Subject: [PATCH] Fix erl_epmd:port_please when using IPv6
fc59c2
fc59c2
This mirrors the behavior of inet:gethostbyname when no family or
fc59c2
timeout is supplied.
fc59c2
fc59c2
diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl
fc59c2
index 7bc9e2ede3..f96bc88913 100644
fc59c2
--- a/lib/kernel/src/erl_epmd.erl
fc59c2
+++ b/lib/kernel/src/erl_epmd.erl
fc59c2
@@ -79,7 +79,13 @@ port_please(Node, EpmdAddr, Timeout) ->
fc59c2
 
fc59c2
 
fc59c2
 port_please1(Node,HostName, Timeout) ->
fc59c2
-  case inet:gethostbyname(HostName, inet, Timeout) of
fc59c2
+  Family = case inet_db:res_option(inet6) of
fc59c2
+             true ->
fc59c2
+               inet6;
fc59c2
+             false ->
fc59c2
+               inet
fc59c2
+           end,
fc59c2
+  case inet:gethostbyname(HostName, Family, Timeout) of
fc59c2
     {ok,{hostent, _Name, _ , _Af, _Size, [EpmdAddr | _]}} ->
fc59c2
       get_port(Node, EpmdAddr, Timeout);
fc59c2
     Else ->