OSDN Git Service

support mix of IPv4 and v6 nameservers in resolv.conf
authorRich Felker <dalias@aerifal.cx>
Sat, 30 Nov 2013 18:33:29 +0000 (13:33 -0500)
committerRich Felker <dalias@aerifal.cx>
Sat, 30 Nov 2013 18:33:29 +0000 (13:33 -0500)
commit7603c5f127316e5ee4c5b161d87742d2ac824567
tree517f51c517959d8987fd08e0bc8a1226d5d0fdca
parent8c8cf4bbd269d0535cad48f4088083b5a466803f
support mix of IPv4 and v6 nameservers in resolv.conf

a v6 socket will only be used if there is at least one v6 nameserver
address. if the kernel lacks v6 support, the code will fall back to
using a v4 socket and requests to v6 servers will silently fail. when
using a v6 socket, v4 addresses are converted to v4-mapped form and
setsockopt is used to ensure that the v6 socket can accept both v4 and
v6 traffic (this is on-by-default on Linux but the default is
configurable in /proc and so it needs to be set explicitly on the
socket level). this scheme avoids increasing resource usage during
lookups and allows the existing network io loop to be used without
modification.

previously, nameservers whose address family did not match the address
family of the first-listed nameserver were simply ignored. prior to
recent __ipparse fixes, they were not ignored but erroneously parsed.
src/network/__dns.c