Hello! I have a machine (FreeBSD-10/stable) with both ipv4 and ipv6 addresses configured. Also I have ip6addrctl_policy="ipv4_prefer" in rc.conf.
I am trying to resolve a hostname which has both A and AAAA records and I expect getaddrinfo() to return A record because of ipv4_prefer. I am running a sample program attached. When I use hints.ai_flags = AI_PASSIVE flag, the program prints "AF_INET6" (why?), if I change that line to hints.ai_flags = 0; it printf "AF_INET" (as expected). Can you please explain why AI_PASSIVE makes a difference? On FreeBSD, the manual page is unclear about the behavior when hostname is not NULL and AI_PASSIVE is used, but on Linux it explicitly states that "If node is not NULL, then the AI_PASSIVE flag is ignored." Thanks!
test_getaddrinfo.c
Description: Binary data
_______________________________________________ freebsd-net@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"