> FYI, with getaddrinfo() - with Nenad's patch - against a dual-stacked host > and without IPv6 connectivity leads to additional syscalls in this case: > > connect(4, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, > "2a03:2880:f010:900:face:b00c:0:1", &sin6_addr), sin6_flowinfo=0, > sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) > connect(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) > = 0 > connect(4, {sa_family=AF_INET, sin_port=htons(0), > sin_addr=inet_addr("31.13.81.144")}, 16) = 0 > > > Also we need to be aware that browsers do a lot of tricks to fix IPv6 > blackholes (RFC6555), while we don't. > > > By using this approach we switch from default IPv4 to default IPv6. > > > I agree that this makes sense and needs to be done, I'm just raising > awareness of the problems we may see when starting to do so.
This is really the responsibility of the server admin. If you use getaddrinfo(), this behavior can be configured in /etc/gai.conf. This is the preferred way to go. It's consistent and documented.