Bug 827378 - localhost6 sometimes resolves to 127.0.0.1
localhost6 sometimes resolves to 127.0.0.1
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jeff Law
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-01 06:01 EDT by Maciej Żenczykowski
Modified: 2016-11-24 10:51 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-29 01:17:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Maciej Żenczykowski 2012-06-01 06:01:51 EDT
host and ssh appear broken (localhost6 -> 127.0.0.1), but telnet appears to work (localhost6 -> ::1) 


[maze@varda ~]$ cat /etc/nsswitch.conf | egrep hosts
hosts:      files dns myhostname

[maze@varda ~]$ cat /etc/hosts | egrep localhost
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[maze@varda ~]$ telnet localhost6 1
Trying ::1...
telnet: connect to address ::1: Connection refused

[maze@varda ~]$ ssh -v -p 1 localhost6
OpenSSH_5.9p1, OpenSSL 1.0.0j-fips 10 May 2012
debug1: Reading configuration data /home/maze/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 50: Applying options for *
debug1: Connecting to localhost6 [127.0.0.1] port 1.
debug1: connect to address 127.0.0.1 port 1: Connection refused
ssh: connect to host localhost6 port 1: Connection refused

[maze@varda ~]$ host localhost6
localhost6.localdomain is an alias for localhost.
localhost has address 127.0.0.1

[maze@varda ~]$ ping localhost6
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.092 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.048 ms
^C
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.048/0.070/0.092/0.022 ms

[maze@varda ~]$ ping6 localhost6
PING localhost6(localhost) 56 data bytes
64 bytes from localhost: icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from localhost: icmp_seq=2 ttl=64 time=0.052 ms
^C
--- localhost6 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.031/0.041/0.052/0.012 ms
Comment 1 Jeff Law 2012-06-29 01:17:50 EDT
telnet, ssh and ping all have different ways of looking up addresses.

ssh, for example calls getaddrinfo with the hints AI_ADDRCONFIG flag set.  When that flag is set then it will only return IPV4 addresses if IPV4 is configured and IPV6 addresses when IPV6 is configured.  With localhost6 just an alias for localhost, I would expect ssh to try to connect to the IPV4 address when no IPV6 interfaces are configured.  Note that link-local addresses are ignored for that check.

ping calls gethostbyname, which is deprecated.  It really should be using getaddrinfo to get better control over the types of addresses that are returned.  However, from my reading, the translation to an IPV4 address within gethostbyname is by design as well.
Comment 2 Maciej Żenczykowski 2012-06-29 16:35:03 EDT
I'm not sure I agree with your reasoning.
In the above setup there is no valid reason for localhost6 to become ::1

That said, after further debugging, this appears to actually be a VMWare Fusion DNS server bug.

192.168.208.130 is the Fedora VM
192.168.208.1 is the Mac Host local ip.
192.168.208.2 appears to be some magic VMware ip, reachable only from within the VM.

13:31:44.655450 IP 192.168.208.130.47411 > 192.168.208.2.domain: 63482+ A? localhost6.localdomain. (40)
13:31:44.657303 IP 192.168.208.2.domain > 192.168.208.130.47411: 63482*- 2/0/0 CNAME localhost., A 127.0.0.1 (79)
Comment 3 Maciej Żenczykowski 2012-06-29 16:36:31 EDT
(I meant 'for localhost6 to become 127.0.0.1', of course)

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