Bug 1461494 - inet:gethostbyname returns IPv4 results when IPv6 is configured [OSP-9] [NEEDINFO]
inet:gethostbyname returns IPv4 results when IPv6 is configured [OSP-9]
Product: Red Hat OpenStack
Classification: Red Hat
Component: erlang (Show other bugs)
9.0 (Mitaka)
Unspecified Unspecified
high Severity high
: zstream
: 9.0 (Mitaka)
Assigned To: Peter Lemenkov
: Triaged, ZStream
Depends On:
  Show dependency treegraph
Reported: 2017-06-14 11:11 EDT by John Eckersberg
Modified: 2017-10-05 10:02 EDT (History)
11 users (show)

See Also:
Fixed In Version: erlang-
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1461190
Last Closed: 2017-10-05 10:02:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
lruzicka: needinfo? (plemenko)

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Github erlang/otp/pull/1065 None None None 2017-06-14 11:11 EDT

  None (edit)
Description John Eckersberg 2017-06-14 11:11:12 EDT
+++ This bug was initially created as a clone of Bug #1461190 +++

Description of problem:
If IPv6 is configured via proto_dist and/or inetrc, inet:gethostbyname will still prefer IPv4 addresses.  This breaks epmd lookups if epmd is forced to listen only on IPv6.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
[root@rhel7 ~]# env | grep ERL                                                                                                                                                                                       
[root@rhel7 ~]# cat /root/inetrc
{inet6, true}.
[root@rhel7 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:13:f6:0e brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic eth0
       valid_lft 2881sec preferred_lft 2881sec
    inet6 fd00::1/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe13:f60e/64 scope link 
       valid_lft forever preferred_lft forever
[root@rhel7 ~]# cat /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
fd00::1     rhel7

Actual results:
[root@rhel7 ~]# erl -sname foo -proto_dist inet6_tcp
Erlang/OTP 18 [erts-] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3.1.2  (abort with ^G)
(foo@rhel7)1> inet:gethostbyname("rhel7").
inet_gethost[7615] (DEBUG):Saved domainname .
inet_gethost[7615] (DEBUG):Saved domainname .
inet_gethost[7616] (DEBUG):Worker got request, op = 1, proto = 1, data = rhel7.
inet_gethost[7616] (DEBUG):Starting gethostbyname(rhel7)
inet_gethost[7616] (DEBUG):gethostbyname OK

Expected results:
[root@rhel7 ~]# erl -sname foo -proto_dist inet6_tcp
Erlang/OTP 18 [erts-] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3.1.2  (abort with ^G)
(foo@rhel7)1> inet:gethostbyname("rhel7").
inet_gethost[7694] (DEBUG):Saved domainname .
inet_gethost[7694] (DEBUG):Created worker[7695] with fd 3
inet_gethost[7694] (DEBUG):Saved domainname .
inet_gethost[7695] (DEBUG):Worker got request, op = 1, proto = 2, data = rhel7.
inet_gethost[7695] (DEBUG):Starting getaddrinfo(rhel7, ...)
inet_gethost[7695] (DEBUG):getaddrinfo returned 0

Additional info:
Upstream fix on OTP 19 - https://github.com/erlang/otp/commit/5d7dcfc2e0de7e93b29d01f07a2f970720d62f9d
Backport for OTP - https://github.com/jeckersb/otp/commit/5ceafb8276b2d920abb3724450e87d8724d21f8e
Comment 1 Peter Lemenkov 2017-07-14 11:20:26 EDT
Different build (against RHEL 7.3) - erlang-
Comment 4 Marian Krcmarik 2017-09-21 10:25:00 EDT
Verified on erlang-
Comment 6 errata-xmlrpc 2017-10-05 10:02:51 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.