s_client如何将ip6-localhost变成127.0.0.1?

s_client如何将ip6-localhost变成127.0.0.1?

当我使用openssl s_client并要求它连接时ip6-localhost,它实际上连接到127.0.0.1而不是::1.

这是我在 Ubuntu 和 Debian 上看到的:

$ strace -e connect openssl s_client -connect ip6-localhost:443
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("127.0.0.1")}, 16) = 0

我没有看到任何/etc/hosts可以解释这种行为的内容:

127.0.0.1       localhost
127.0.1.1       dell

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

如何得出IP地址是s_client的结论?ip6-localhost127.0.0.1

相关内容