TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.57k stars 246 forks source link

localhost doesn't resolve to ::1, despite having the correct entry in /etc/hosts #982

Closed treysis closed 3 years ago

treysis commented 3 years ago

I cannot connect/ping localhost to resolve to IPv6 ::1 if there is no other IPv6 configured.

I made sure that /etc/hosts reads ::1 localhost, I also made sure that ifconfig shows ::1 for the lo interface. But ping or connect will not resolve, even if I force address family via -A inet6. It only works after I set another IPv6 address.

Why can't I connect to ::1? This also causes problems with the NodeJS testing suite: https://github.com/nodejs/node/pull/37931

Unless I disable IPv6 in kernel, connecting to ::1 or localhost resolving to ::1 should work just fine. It does on Linux and Windows.

sjorge commented 3 years ago

Might be hitting https://www.illumos.org/issues/7494 or a similar issue. Python still doesn't do the right thing for saltstack to this day.

treysis commented 3 years ago

Turned out this is normal behavior due to calling getaddrinfo() with AI_ADDRCONFIG when doing lookups.