History log of /bionic/libc/netbsd/net/getaddrinfo.c
Revision Date Author Comments
e919b116d35aa7deb24ddece69c491e24c3b0d6f 29-Mar-2013 Lorenzo Colitti <lorenzo@google.com> Update getaddrinfo to RFC6724

Currently, our getaddrinfo implementation does not conform to
any IETF standard. It follows draft-ietf-6man-rfc3484-revise-01,
but that draft has expired. Update the policy table to RFC6724.

Bug: 8276725
Change-Id: I03c63abfcad9b2f3a3bab2718bd2fc6440531843
bfe0640e41204ccc090c364e02675de10d87c923 22-Feb-2013 Nick Kralevich <nnk@google.com> Don't pass pid to dnsproxyd

dnsproxyd can already determine our pid by looking at our
socket connection. It's dangerous (and unneeded) to pass it
ourselves.

Change-Id: I2596d02e361b302259ddb084be2fb75be59889c5
c63e59039d28c352e3053bb81319e960c392dbd4 23-Aug-2011 Mattias Falk <mattias.falk@sonyericsson.com> dns cache per interface iteration 2

name server addresses are read from the dns
cache associated wih the interface on which
the request shall be done.

processes which has requested to issue dns request
using specific interface are now proxied to netd.

added methods to attach/detach a process to a specific
dns cache/interface.

added getaddrinfoforinface method which takes an
interface as an argument.

bug:4815099
bug:5465296
Change-Id: I7a8fe1980cdf99d4d296ddc5c6411f0c72162263
b002a2ff77759b3852a0aa38aa95c07a066faecf 19-Jan-2013 Robert Greenwalt <rgreenwalt@google.com> Revert "dns cache per interface iteration 2"

This reverts commit f1464ff95670e6dcc0e12bf9fbbeb4c0346434c9

Change-Id: I3496b9a8cb54614fe3eea016d1391c8a89f3db38
f1464ff95670e6dcc0e12bf9fbbeb4c0346434c9 23-Aug-2011 Mattias Falk <mattias.falk@sonyericsson.com> dns cache per interface iteration 2

name server addresses are read from the dns
cache associated wih the interface on which
the request shall be done.

processes which has requested to issue dns request
using specific interface are now proxied to netd.

added methods to attach/detach a process to a specific
dns cache/interface.

added getaddrinfoforinface method which takes an
interface as an argument.

Change-Id: I851ec8ab8ce3112626ad2a729078b91d013f32fd
bug:4815099
bug:5465296
c59ba4595be25a1213955233fcf9bcd1afe6438e 09-Mar-2012 Robert Greenwalt <rgreenwalt@google.com> Use new binary code format

3-digits + null. Old was 3-digits + space + null.

Change-Id: If5fdf9ced073f432ace3a76858025ad651c74e3d
06e1831f194389b6f56ac016ebb52ed5cd430bb2 28-Feb-2012 Selim Gurun <sgurun@google.com> Prevent potential stall on dns proxy operations.

Update wire protocol to return and process error code first.
This will make sure dns proxy operations do not stall when
an internal error happens.
Also fix a compiler warning.
Also fix a potential buffer overflow.
And use correct types (uint32_t) rather than int when reading from network.

Change-Id: I9f99c16d6fd5e9137491a4d1b293a7c78e31b9c3
93b8f941f2de1bd110265dd7585710ac30548928 24-Feb-2012 Kenny Root <kroot@google.com> Revert "Use the new NativeDaemonConnector style."

The other changes relating to this were already reverted.

This reverts commit 1625c7a837d73b6729f97edb32c497d289c0220c
1fb6662d1aa51eec54cfc133c40cacc0b15aad30 24-Feb-2012 Kenny Root <kroot@google.com> Revert "Use the new NativeDaemonConnector style."

The other changes relating to this were already reverted.

This reverts commit 1625c7a837d73b6729f97edb32c497d289c0220c
1625c7a837d73b6729f97edb32c497d289c0220c 07-Feb-2012 Robert Greenwalt <rgreenwalt@google.com> Use the new NativeDaemonConnector style.

Prepend a 0 to match the new sequence-number style, though this module
doesn't really need/use it.

bug:5864209
Change-Id: Iacbcddaced6fe8bb01d186596a916e4fb4805fef
ca6fe7bebe3cc6ed7e2db5a3ede2de0fcddf411d 22-Nov-2011 Robert Greenwalt <rgreenwalt@google.com> Request both v4 and v6 dns when on secondary net

We can't easily tell the protocol family of the secondary network,
so try both and trust that the carrier has configured dns servers
according to the protocols supported on its network.

bug:5468224
Change-Id: If4f017573d313a6ad8354574076de6d63d43b444
f432de2de7288c0589d1e50c2aa949a76c571794 29-Sep-2011 Lorenzo Colitti <lorenzo@google.com> Send both A and AAAA queries if all probes fail.

AI_ADDRCONFIG is currently implemented by trying to connect
to well-known addresses in order to see if IPv4 and/or IPv6
connectivity is available.

In some cases (e.g., walled gardens with no global
connectivity) both probes can fail. If this happens,
query for both IPv4 and IPv6 addresses instead of doing
nothing and failing the query.

Bug: 5284168
Change-Id: I4e3a69ea86fb6d839a6bd31236b98da81e5cbf45
b82532d11a301370c14f77f2e56dee11f8bfa971 29-Sep-2011 Lorenzo Colitti <lorenzo@google.com> Revert "Use framework hints to determine dns query type."

Change Ife82a8d8 broke IPv6 on wifi. Change I4e3a69ea is
an alternate approach that does not require any framework
changes.

Bug: 5284168
Change-Id: Ib52614be3875a2ae2eaedd1be265f90e506eda41
8af58f0fd4ff3fb11cb8a3c61e4654e3633906a4 14-Sep-2011 Robert Greenwalt <rgreenwalt@google.com> Use framework hints to determine dns query type.

Instead of checking for IPv4 or IPv6 connectivity, try using pid-specific
hints the framework has left for us.

bug:5284168
Change-Id: Id64d48db3900865a7d58ada8309870c63d6eab12
2cc2b2be692f1d559a09d2066e56e450249cc9c0 22-Mar-2011 Carl Shapiro <cshapiro@google.com> Add some missing includes.

Change-Id: Ieec623c06bc32ec78334f628af25b00c2bccd2e7
44892440582ee8df1dcace7167e587fdfe1ada6d 15-Feb-2011 Mattias Falk <mattias.falk@sonyericsson.com> DO NOT MERGE Cherry-pick of 0ee092fb2 from master

Convert cname lenght before use

The length of the cname is sent in big-endian
order. Thus, it has to be converted before used
in android_getaddrinfo_proxy

Change-Id: I78552d427ef6500d9121fc83423f0744ea0c3087
0ee092fb23318bc479de8e6514fbf2e05e0ce646 15-Feb-2011 Mattias Falk <mattias.falk@sonyericsson.com> Convert cname lenght before use

The length of the cname is sent in big-endian
order. Thus, it has to be converted before used
in android_getaddrinfo_proxy

Change-Id: I1a0cc12780c47f7493fcf06f690515829f88c01e
066ecc8f4a6ef4195194626875fe32442bf91d56 15-Feb-2011 Mattias Falk <mattias.falk@sonyericsson.com> Convert cname lenght before use

The length of the cname is sent in big-endian
order. Thus, it has to be converted before used
in android_getaddrinfo_proxy

Change-Id: I1a0cc12780c47f7493fcf06f690515829f88c01e
ba96e30fa08212e48ec1ff9c1d545b2d05e787b0 14-Jan-2011 Lorenzo Colitti <lorenzo@google.com> Only look up A records if the system has IPv4.

getaddrinfo only asks DNS for IPv6 addresses if the system
has IPv6 connectivity, but always asks for IPv4 addresses.
Don't ask for IPv4 addresses if there is no IPv4
connectivity.

Change-Id: Iefe9fcb006fabe60b4b11dd4653a7c4a406506f4
2e23e29245aa42d0f9419187c94e72dba3888eef 20-Dec-2010 Steinar H. Gunderson <sesse@google.com> Backport (simple cherry-pick) d33019030c1f0cddca557f9659e3c471bde0e6a9
to gingerbread.

Implement RFC3484 policy table changes from draft-ietf-6man-rfc3484-revise-01.

The changes in a nutshell:

- Handle v4-mapped as different from v4-compat (this was probably
an existing bug in our code).
- Add policy entries for ULA, above most everything else.
- Put v4-compat, old-style IPv6 site-local and 6bone addresses
way down in the preference table.

The rest is just shuffling numbers around (no actual changes to
priority).
a798b9f0e171643b0bc7bbf79f14cb018689f715 20-Dec-2010 Steinar H. Gunderson <sesse@google.com> Backport (simple cherry-pick) d1624add2b73ce8ff7826ce27b1d6d6e35bb83a6
to gingerbread.

Don't treat private IPv4 addresses as being in a non-global scope. The effect of this change is essentially to prefer NATed IPv4 over 6to4.
d33019030c1f0cddca557f9659e3c471bde0e6a9 20-Dec-2010 Steinar H. Gunderson <sesse@google.com> Implement RFC3484 policy table changes from draft-ietf-6man-rfc3484-revise-01.

The changes in a nutshell:

- Handle v4-mapped as different from v4-compat (this was probably
an existing bug in our code).
- Add policy entries for ULA, above most everything else.
- Put v4-compat, old-style IPv6 site-local and 6bone addresses
way down in the preference table.

The rest is just shuffling numbers around (no actual changes to
priority).

Change-Id: Ieb111e0edd705992bc9d066befaaee95a8c1a5df
555e02dee7e46831eaeb7ff2c90f49b6943bb157 28-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> Don't proxy getaddrinfo when net.dns1.[MYPID] is set.

Part of on-going DNS proxy/cache work.

Bug: 1146676
Change-Id: I5e6028169c81c2223efc34c3b57e348c44f26d26
52583cc67981c96a88a82f803f71fbb6804a5834 27-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> DNS proxy: the start. proxies getaddrinfo calls.

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
d1624add2b73ce8ff7826ce27b1d6d6e35bb83a6 20-Dec-2010 Steinar H. Gunderson <sesse@google.com> Don't treat private IPv4 addresses as being in a non-global scope. The effect of this change is essentially to prefer NATed IPv4 over 6to4.

Change-Id: I53a8613ca9eb61cac0bf18f0b5f98a2d35ab9c50
7858564582ca134bd0101ffc725c0d0b1d29d645 28-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> Don't proxy getaddrinfo when net.dns1.[MYPID] is set.

Part of on-going DNS proxy/cache work.

Bug: 1146676
Change-Id: I5e6028169c81c2223efc34c3b57e348c44f26d26
a1dbf0b453801620565e5911f354f82706b0200d 27-Oct-2010 Brad Fitzpatrick <bradfitz@android.com> DNS proxy: the start. proxies getaddrinfo calls.

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
50ace4fec5e8cb5afcbc656a4556fa528adfd760 17-Jun-2010 David 'Digit' Turner <digit@google.com> Remove compiler warnings when building Bionic.

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
7e0bfb511e85834d7c6cb9631206b62f82701d60 25-Mar-2010 Kenny Root <kroot@google.com> Fix comparison of IPv6 prefixes

Typo assigned prefixlen1 twice instead of to the two different variables
for comparison and difference computation.

Change-Id: I6631b8269ca6aae264c8d7d414127b756838df96
9ab75d4cc803e91b7f1b656ffbe2ad32c52a86f9 11-Feb-2010 Steinar H. Gunderson <sesse@google.com> Implement support for RFC 3484 (address selection/sorting) in bionic. (The
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.
194d3fa048cf909ca592dd56fa538dc9cd3f5ddb 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
3d8f4ada56cc4965c8d2cbaa16d1bc0f75492c07 04-Aug-2009 Lorenzo Colitti <lorenzo@google.com> Don't request IPv6 addresses if AI_ADDRCONFIG is specified and the system has no IPv6 connectivity.
5e563700380eade647f347669ea61dbb0ede9814 05-May-2009 David 'Digit' Turner <digit@google.com> change getaddrinfo() implementation to match GLibc.

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.
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution