Tech, Now that my AI_ADDRCONFIG diff is in, it's time to reveal my evil master plan: make getaddrinfo() return IPv6 results first by default.
The diff below would be the end goal. I guess people will have valid objections to it. I'd like to know what they are. Would it be necessary/desirable to check all calls to getaddrinfo() in base and add AI_ADDRCONFIG to hints.ai_flags where needed? (i.e. pretty much everywhere except special cases which right now I can't think of any) Thanks, Simon Index: lib/libc/asr/asr.c =================================================================== RCS file: /cvs/src/lib/libc/asr/asr.c,v retrieving revision 1.33 diff -u -p -r1.33 asr.c --- lib/libc/asr/asr.c 26 Mar 2014 18:13:15 -0000 1.33 +++ lib/libc/asr/asr.c 28 Apr 2014 21:43:52 -0000 @@ -518,8 +518,8 @@ asr_ctx_create(void) ac->ac_options = RES_RECURSE | RES_DEFNAMES | RES_DNSRCH; ac->ac_refcount = 1; ac->ac_ndots = 1; - ac->ac_family[0] = AF_INET; - ac->ac_family[1] = AF_INET6; + ac->ac_family[0] = AF_INET6; + ac->ac_family[1] = AF_INET; ac->ac_family[2] = -1; ac->ac_hostfile = DEFAULT_HOSTFILE; Index: share/man/man5/resolv.conf.5 =================================================================== RCS file: /cvs/src/share/man/man5/resolv.conf.5,v retrieving revision 1.44 diff -u -p -r1.44 resolv.conf.5 --- share/man/man5/resolv.conf.5 14 Jul 2013 19:44:39 -0000 1.44 +++ share/man/man5/resolv.conf.5 28 Apr 2014 21:43:52 -0000 @@ -217,8 +217,8 @@ For example: .It Cm family Specify which type of Internet protocol family to prefer, if a host is reachable using different address families. -By default IPv4 addresses are queried first, -and then IPv6 addresses. +By default IPv6 addresses are queried first, +and then IPv4 addresses. The syntax is: .Bd -ragged -offset indent .Cm family Ar family Op Ar family