History log of /bionic/libc/dns/net/getaddrinfo.c
Revision Date Author Comments
5a6b9565c0e3f08f9675abad5c1c34752fb47b17 14-Mar-2018 Victor Khimenko <khim@google.com> Mark getaddrinfo functions with __BIONIC_WEAK_FOR_NATIVE_BRIDGE mark

System libc talks to out-of-process daemon thus it's better to not
duplicate that functionality in native bridge.

Bug: 67993967

Test: make

Change-Id: Iabc887a94082806d048bc98bf8d3b21c7531d60d
(cherry picked from commit 5956847acc852afff87d832792f88c0a2c6e81ce)
9864564fcaaf2f56dad0f2c3d942e3eb6ac625d6 02-Oct-2017 Ben Schwartz <bemasc@google.com> Lay the groundwork for enabling EDNS0 in queries.

This change does not enable EDNS0, so it should not
result in any behavior change. However, enabling EDNS0
should now be possible with only a small additional change
to "flip the switch".

This change has also landed in NetBSD upstream
(http://gnats.netbsd.org/52578) so this change reduces
divergence from upstream.

Most of the code in this change is for caching of queries that contain
an additional section.

Bug: 15132200
Bug: 64133961
Test: Added integration tests for fallback to the netd suite.
Merged-In: I9b0abc6e4f3ff7f9c23a5cb921d392d2d3065d99
Merged-In: I9c06bbaf1883de4bdebd822f9a052901bf3efc04
Merged-In: Ie438b77bc1aeea0b0c700a90998cec31ac9a0015
Change-Id: Ic64bed0754e1d529dc0c0ab6a5e2f1ea201ff0d5
(cherry picked from commit 6eed8e1bb6f7faac2accb85fe1ebafb4fd33dee7)
47fb0e826dd8c345d9034fda75c3238488a4690c 31-Jan-2018 Ben Schwartz <bemasc@google.com> Reduce max DNS response from 64K to 8K

No reasonable response is larger than about 4K, and this should reduce the ability of misbehaving DNS servers to waste system resources.

Test: Integration tests pass
Change-Id: I43da94f57f9b376d08a1b176e0aedb6720148833
90a83beb4dd3a70aeb512a786e9a79bbd641f4de 24-Apr-2017 Ben Schwartz <bemasc@google.com> Make use of the DNS query hook in the netcontext

This will allow netd to run queries over TLS:
https://android-review.googlesource.com/#/c/391513/
https://android-review.googlesource.com/#/c/380593/

Bug: 34953048
Test: Device tests pass. No issues during manual testing.
Change-Id: I8d613322307fc40cdba59b82599eda753697278f
418fe1eb1aeefc2268a40c5cec0ceb62672fa026 14-Nov-2016 Elliott Hughes <enh@google.com> Check for bad packets in getaddrinfo.c's getanswer.

The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

Bug: http://b/32322088
Test: browser still works
Change-Id: Ied6662be567fb1bddc7ceb138cae1da77fb57976
(cherry picked from commit 27a4459d945e34fabd7166791a5b862ccea83f23)
6eb8fb5f86b09f00d1b1781963fbbfcc3aa5d145 03-Dec-2016 Elliott Hughes <enh@google.com> Remove obsolete #include and comment.

Bug: http://b/33308258
Test: builds
Change-Id: Id6bbdae536a12134899fa57ea799f488d018db00
7ec52b12efc1c4ed9cd83ba8c95fab5bbf39aaf4 29-Nov-2016 Dan Willemsen <dwillemsen@google.com> Enable libc/libdl/libm/linker for host bionic

Disables debuggerd integration unless building for android.

Bug: 31559095
Test: Diff out/soong/build.ninja before/after, only change is moving
linker's libdebuggerd_client static lib to the beginning of the
list.
Test: lunch aosp_arm64-eng; mmma -j bionic
Change-Id: I62e725f7a9b98b7fe31637d0a835fd5846b0aff0
9ea3f1c8a5280c99b5a315a06175dbce9d9296b7 14-Nov-2016 Elliott Hughes <enh@google.com> Check for bad packets in getaddrinfo.c's getanswer.

The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

(cherrypick of 27a4459d945e34fabd7166791a5b862ccea83f23 from master.)

Bug: http://b/32322088
Test: browser still works
Change-Id: I16950bb0ff9dc806cc5405b913ca4ef96e43c19f
87c0dba7b1b1754d69cc92f2b400a311d6393eed 14-Nov-2016 Elliott Hughes <enh@google.com> Check for bad packets in getaddrinfo.c's getanswer.

The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

Bug: http://b/32322088
Test: browser still works
Change-Id: Ied6662be567fb1bddc7ceb138cae1da77fb57976
(cherry picked from commit 27a4459d945e34fabd7166791a5b862ccea83f23)
27a4459d945e34fabd7166791a5b862ccea83f23 14-Nov-2016 Elliott Hughes <enh@google.com> Check for bad packets in getaddrinfo.c's getanswer.

The near duplicate in gethnamaddr.c was already doing so (this fix
is basically copy and pasted from there, but with both copies modified
to avoid skirting undefined behavior).

Bug: http://b/32322088
Test: browser still works
Change-Id: Ied6662be567fb1bddc7ceb138cae1da77fb57976
a9209d7a0ee7ef40f9a14cab2b6756d7e6f8b919 17-Sep-2016 Elliott Hughes <enh@google.com> Fix some easy cases of __ANDROID__ versus __BIONIC__.

We need to make a clearer distinction for bionic on the host. This patch
doesn't fully address things like "should host bionic try to talk to netd?"
for now, but is a step in the right direction.

Bug: http://b/31559095
Test: bionic tests.
Change-Id: I49812f8b75d9d78c4fd8a8ddf5df1201d63771d6
7bbb181bf0d05fddb18f9b933943275ef68875c8 04-Mar-2016 Erik Kline <ek@google.com> Don't leak sockets if setsockopt() or fchown() fail.

Change-Id: Idcf8c08ff50d21c3a04b7ef80c4044f3f9762f2b
754f669076ec1edfc0d597aaf89600d4c93f9a7c 25-Jun-2015 Erik Kline <ek@google.com> Pass around struct android_net_context for better behaviour

Group network context elements in to a single struct and
add a version of android_getaddrinfofornet() that accepts it.

The introduction of UID-based routing means that the UID is an
integral part of the network context when evaluating connectivity,
sorting addresses, etc.

Also, introduce a distinction between DNS netids/marks and those
expected to be used by the application. This can be important
when the network an application is using is not the same as the
network on which DNS queries will be issued.

Additionally, de-duplicate the UDP connect logic (collapse both
_test_connect() and _find_src_addr() into just the latter).

Bug: 19470192
Bug: 20733156
Bug: 21832279
Change-Id: If16c2f4744695f507993afdac078ca105eb5d3e4
(cherry picked from commit 01e37c9665018534c798daaa59d5b0adb408e0a4)
01e37c9665018534c798daaa59d5b0adb408e0a4 25-Jun-2015 Erik Kline <ek@google.com> Pass around struct android_net_context for better behaviour

Group network context elements in to a single struct and
add a version of android_getaddrinfofornet() that accepts it.

The introduction of UID-based routing means that the UID is an
integral part of the network context when evaluating connectivity,
sorting addresses, etc.

Also, introduce a distinction between DNS netids/marks and those
expected to be used by the application. This can be important
when the network an application is using is not the same as the
network on which DNS queries will be issued.

Additionally, de-duplicate the UDP connect logic (collapse both
_test_connect() and _find_src_addr() into just the latter).

Bug: 19470192
Bug: 20733156
Bug: 21832279
Change-Id: If16c2f4744695f507993afdac078ca105eb5d3e4
c62a4b5a7aede760b06298f4b641b5a9768f5744 09-Jan-2015 Elliott Hughes <enh@google.com> Fix freeaddrinfo(NULL).

Bug: https://code.google.com/p/android/issues/detail?id=13228
Change-Id: I5e3b126d90d750a93ac0b8872198e50ba047e603
9773fa3ffd7c2d1de2431b8ea1eb8043e8959fcb 10-Dec-2014 Elliott Hughes <enh@google.com> Clean up DNS proxying.

Remove code duplication and fall back to trying directly if the proxy
isn't available. With this, tests still work if netd is dead (perhaps
because you've run "adb shell stop", or because you're running on the host).

Bug: 18547878
Change-Id: Ia4a9aa18b1fc79e09735107246989fa7fc6c8455
3638a83657d9833816e579778394a40ae4178868 25-Nov-2014 Robert Alm <robert2.alm@sonymobile.com> Add error-check when mapping socket to fd

The call to fdopen can fail in several ways.
The fprintf on the next line will then dereference a
NULL-pointer FILE*.
Added a NULL-check, closed the socket, returned system error
and added a comment about it.

Change-Id: I7a6b26aa3c79452b1fdd76af12dfa75da88cbad7
55293c1dad2f88e6d1d11822bb9edda95563b02b 13-Nov-2014 Elliott Hughes <enh@google.com> Don't receive structs containing pointers over sockets.

Fixes x86-64 netd.

Change-Id: Iee5ef802ebbf2e000b2593643de4eec46f296c04
c674edbf27450bbb2396b1434421b1db5325d8f4 27-Aug-2014 Elliott Hughes <enh@google.com> libc should use O_CLOEXEC when opening files for its own use.

Change-Id: I159f1d57e0ca090d837f57854fcef5879b8b8248
1781ed7774671d5a750839650b9582ff0abbcf42 30-Jun-2014 Nick Kralevich <nnk@google.com> add CLOEXEC to various DNS related code

Occasionally file descriptors seem to be leaking across execs
from DNS related calls. Set close-on-execute for the various
sockets / file to prevent file descriptor leakage.

Change-Id: I4724b47bc7236f40c29518a6075598a9bba48b0a
31ad03761d35ce5bff48cc1cb3764816727ac1f0 29-May-2014 Paul Jensen <pauljensen@google.com> Make host resolver call __connect() rather than connect() so mark isn't cleared.

Calling connect() will erase the mark set by the host resolver code because the
explicitlySelected bit of the Fwmark isn't set. It's by design that the
explicitlySelected bit isn't set as this facilitates falling through to other
routing rules if the selected network doesn't provide a route to the DNS server
as may be the case with VPNs.

Change-Id: I60ba7c754194ead97df3ac6a6c5b3db1f446dac8
5240b562e7e9de2f31ba70f71c394c5529aadf0f 15-May-2014 Paul Jensen <pauljensen@google.com> Query libnetd_client for the appropriate netId for host resolution.

If libnetd_client can't be found, operate as before and use the default netId
potentially overriden by a more specific netId passed in to
android_get*fornet().

(cherry picked from commit 559c7842cc6862568d9b5799fc0bcf74d58b596b)

Change-Id: I42ef3293172651870fb46d2de22464c4f03e8e0b
57a26275754730c0b1c8ec313b99cbefc10564c9 19-May-2014 Sreeram Ramachandran <sreeram@google.com> Fix build breakage.

Change-Id: I1835198c64c28021b81f0c790f108685a3f456c7
559c7842cc6862568d9b5799fc0bcf74d58b596b 15-May-2014 Paul Jensen <pauljensen@google.com> Query libnetd_client for the appropriate netId for host resolution.

If libnetd_client can't be found, operate as before and use the default netId
potentially overriden by a more specific netId passed in to
android_get*fornet().

Change-Id: I42ef3293172651870fb46d2de22464c4f03e8e0b
ea9bf6788144b83cc51c454b2bfe6b980d6e947c 14-Feb-2014 Szymon Jakubczak <szym@google.com> bionic: Replace iface with opaque netid in resolver.

Replace iface cache key with netid.

Replace _mark with netid.

Mark sockets used to test IPv4/IPv6 support as well as sockets
used to determine source address for rfc6724 sort.

Remove pid/uid mappings (functionality moved to system/netd).

Do not create resolv_cache when it does not exist, but rather only
when DNS configuration is supplied.

Clean up unused functions.

Change-Id: I9ccfda2902cc0943e87c9bc346ad9a2578accdab
569fb9887d00104509df79fa77d92e3cf9afe7db 04-Mar-2014 Calin Juravle <calin@google.com> Moved nameser.h and namser_compat.h to public include dir

This is part of the upstream sync (Net/Open/Free BSDs expose the
nameser.h in their public headers).

Change-Id: Ib063d4e50586748cc70201a8296cd90d2e48bbcf
bd33537fde8e1c68fcadfd6adf77b295ada9b45f 28-Feb-2014 Calin Juravle <calin@google.com> Renamed the misleading libc/netbsd directory to libc/dns.

Bug: 13219633
Change-Id: Ide43add0b90b3081cc709a22d1ff1f59d65f1104