Will also need to do gethostinfo, but that's probably about it.
It was cleaner to do it at this level, rather than speaking in terms
of DNS packets.
Change-Id: I047cc459979ffb0170a3eb0d432a7e827fb71c26
Also add missing declarations to misc. functions.
Fix clearerr() implementation (previous was broken).
Handle feature test macros like _POSIX_C_SOURCE properly.
Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
Typo assigned prefixlen1 twice instead of to the two different variables
for comparison and difference computation.
Change-Id: I6631b8269ca6aae264c8d7d414127b756838df96
Java changes required not to mess up the ordering from bionic will arrive in a
later commit.) In particular, this will give us more correct behavior when on a
6to4 network, in that IPv4 will usually be preferred over 6to4.
Most of RFC 3484 is implemented -- what's not is rule 3 (avoid deprecated
addresses), 4 (prefer home addresses) and 7 (prefer native transport) as they
require low-level access to the kernel routing table via netlink. (glibc also
started out this way, and these rules are primarily useful in pretty obscure
circumstances, so we should be fine for the time being.)
Also, rule 9 (use longest matching prefix) has been modified so it does not try
to sort IPv4 addresses; given current IPv4 addressing practice these rules are
pretty much meaningless. Finally, I've added support for Teredo as a separate
label, with slightly lower preference than 6to4. (Vista puts the preference
below IPv4 by default. glibc puts the preference together with non-tunneled
IPv6.)
Note that this patch removes support for the "sortlist" directive in
resolv.conf; I've never seen it in actual use, it's irrelevant for Android
(since we don't use resolv.conf anyway), and it's not clear how it would be
implemented alongside RFC 3484.
the issue is that the BSD implementation doesn't accept a call like:
getaddrinfo(SERVER_NAME, "9999", NULL, &res);
because if will reject a numerical string in the second parameter if no hints are explicitely
provided. This technically doesn't violate POSIX but might make porting Linux software a bit
difficult. For more details see:
http://groups.google.com/group/android-ndk/browse_thread/thread/818ab9c53f24c87
also comment debugging printf() calls which shouldn't be there.