Subject: | Suggestion: IPV6 preference |
As IPV6 becomes more important, more of us are working with it.
Net::DNS has a force_v4 attribute to force IPV4 connections.
However, when a nameserver/host has both V4 and V6 interfaces, it
would be nice to be able to prefer (now) or force (later) use of
V6 addresses. This would provide the ability to gain confidence that
V6 doesn't break other software.
So I'd like to see the Resolver have 'prefer_v6' and 'force_v6'
attributes. (or 'prefer=>'v4|v6|none')
"Prefer" means that if a nameserver/srcaddr list has both AAAA record
(s) and A record(s), the resolver should try to connect to nameservers
that have AAAA records first, using only IPV6 srcaddrs (ignoring any A
records). In a second pass, it should try to connect to the A records
using only IPV4 srcaddrs (ignoring any AAAA, which it has already
tried.)
Note that both srcaddr and nameservers can be dual-stack, and V4 and V6
connectivity can be different. So the connection logic needs to handle
the cross products. In summary, that means that if there's only one
address family in common, use it. If both and there's a preference,
try the prefered family first. If no preference, random order is fine
(and may be slightly faster.)
The current code seems to try V6 src / V4 destination connections, but
recovers from the error:
;; Trying to set up a AF_INET6() family type UDP socket with srcaddr:
2001:xxxx::106 ... done
;; setting up an AF_INET() family type UDP socket
Send error: cannot reach 192.168.148.4 (IPv4) not available;; send_udp
(2001:xxxx:4:53)
;; answer from 2001:xx::4:53 : 135 bytes
Srcaddr Nameserver(s)
V4 V6/V4 Connect to V4
V6 V4/V6 Connect to V6
V4/V6 V4 Connect to V4
V4/V6 V6 Connect to V6
V4/V6 V6/V4 Try both in order of preference
Thanks!