History log of /bionic/libc/netbsd/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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
et/getaddrinfo.c
12ea8005665085ae82c1b233ae93d12855e04b8b 16-Mar-2013 Elliott Hughes <enh@google.com> am 5f829205: am c1416647: Merge "Clean up internal libc logging."

* commit '5f8292050fc07f4bf9e70f37a807ad028e3cfc87':
Clean up internal libc logging.
8f2a5a0b40fc82126c691d5c30131d908772aab7 15-Mar-2013 Elliott Hughes <enh@google.com> Clean up internal libc logging.

We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
esolv/res_cache.c
esolv/res_send.c
esolv/res_state.c
5d36baee95096e39e49aace66d65476ebaad9bc1 22-Feb-2013 Nick Kralevich <nnk@google.com> Merge "gethostbyname: fix crash"
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
ethnamaddr.c
et/getaddrinfo.c
a6b24b7afb79294e6b709ede11395f13370d67a0 22-Feb-2013 Nick Kralevich <nnk@google.com> gethostbyname: fix crash

When an app doesn't have the internet permission, android_open_proxy
returns NULL, causing a segfault when calling fprintf. Fixed.

Change-Id: I598855350ed0db3cc88e5ae3b400145418a3a615
ethnamaddr.c
8ca1da6e715fe2bc148a0b569e326a7713518f1d 13-Feb-2013 Elliott Hughes <enh@google.com> resolved conflicts for merge of 62727429 to master

Change-Id: I8a3d167f3ef279a7c46cb8fb90c9477beff84d8e
d8213bb5738ac778fcb5d696d1294b0f8ddae7f3 13-Feb-2013 Elliott Hughes <enh@google.com> Update getnameinfo.c, remove dead code, and fix error reporting.

Also add a unit test for the salen size checking.

Bug: 1889275
Change-Id: I8ec4107df9e2e9a8571e8915525249c6e44b98ad
et/getnameinfo.c
et/getservbyname_r.c
et/getservbyport_r.c
et/getservent_r.c
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
ethnamaddr.c
et/getaddrinfo.c
et/getnameinfo.c
esolv/res_cache.c
esolv/res_data.c
esolv/res_init.c
esolv/res_send.c
esolv/res_state.c
b002a2ff77759b3852a0aa38aa95c07a066faecf 19-Jan-2013 Robert Greenwalt <rgreenwalt@google.com> Revert "dns cache per interface iteration 2"

This reverts commit f1464ff95670e6dcc0e12bf9fbbeb4c0346434c9

Change-Id: I3496b9a8cb54614fe3eea016d1391c8a89f3db38
ethnamaddr.c
et/getaddrinfo.c
et/getnameinfo.c
esolv/res_cache.c
esolv/res_data.c
esolv/res_init.c
esolv/res_send.c
esolv/res_state.c
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
ethnamaddr.c
et/getaddrinfo.c
et/getnameinfo.c
esolv/res_cache.c
esolv/res_data.c
esolv/res_init.c
esolv/res_send.c
esolv/res_state.c
78851f10d1937a5e9477c42a29c1bcf0f47b5ef4 07-Jan-2013 Robert Greenwalt <rgreenwalt@google.com> Cache negative DNS results.

Find the TTL for the negative results using the minimum of
the SOA records TTL or the MINIMUM-TTL field (RFC-2308).

bug:5926539
Change-Id: I6d39c9fb558afcb7a4a5bc014d97dab4a85c0d4f
esolv/res_cache.c
6f3222ea42f4d2335b089b3d2e5834a5c8c22eca 13-Nov-2012 Robert Greenwalt <rgreenwalt@google.com> Add search domain to dns interface data.

This doesn't currently use this info - it's still using the system
property based data-passing. That change is comming.

bug:6799630
Change-Id: I725463209855447cd04bf1457281f3084fffd692
esolv/res_cache.c
ab44f52202878cdf2bf22457aeae33ec24089556 24-Oct-2012 Elliott Hughes <enh@google.com> More upstream NetBSD upgrades.

Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
sc/ev_streams.c
sc/ev_timers.c
sc/eventlib_p.h
ce5ba8bfcd8ecfb7bfee4412f4f686cecc17e39b 20-Jun-2012 Henrik Engström <henrik.engstrom@sonymobile.com> Added missing cache failed notification

Added a missing call to _resolv_cache_query_failed for another fail
case where it was missing (it doesn't go through the error handling
under the "fail" label). This missing notification caused requests to
have to wait for timeout instead of beeing notified on some failed
requests.

Change-Id: I904d60269c59b926784e3a397d2a860329f55142
esolv/res_send.c
8f88aa7d3823ac079fc783651a64dbe986a8205e 13-Jun-2012 Robert Greenwalt <rgreenwalt@google.com> am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"

* commit 'c5cab3452d5ced55474e56497594579108670b51':
Avoid multiple dns lookups for the same query
c5cab3452d5ced55474e56497594579108670b51 13-Jun-2012 Robert Greenwalt <rgreenwalt@google.com> am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"

* commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2':
Avoid multiple dns lookups for the same query
028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2 13-Jun-2012 Robert Greenwalt <rgreenwalt@google.com> Merge "Avoid multiple dns lookups for the same query"
20afd4e70c2f346d7cd03a7a3049f8de2d176d5c 12-Jun-2012 Elliott Hughes <enh@google.com> am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."

* commit 'e0961445124b5ff39412da32578e14e0d1f6afd6':
Remove the meaningless on Linux if_dl.h header.
c3d45b822cd7d7c359aceba9447a1619b5a2150b 12-Jun-2012 Elliott Hughes <enh@google.com> Remove the meaningless on Linux if_dl.h header.

This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

(cherry-pick of 5056f1fad1187cd67729bb04ba72397d78256f03.)

Change-Id: Ic67f674d2221497c8166994812bb5fc7f0831066
et/getnameinfo.c
7c5c68f5c7b87dfb309f006673fb809c7333dcf7 12-Jun-2012 Elliott Hughes <enh@google.com> Merge "Remove the meaningless on Linux if_dl.h header."
5056f1fad1187cd67729bb04ba72397d78256f03 12-Jun-2012 Elliott Hughes <enh@google.com> Remove the meaningless on Linux if_dl.h header.

This was misleading 'configure' into thinking we actually support AF_LINK,
but we're Linux, so we don't, and we never implemented the functions we
declared here either.

Reported to AOSP by Jun-ya Kato.

Change-Id: I111f9887f3812469b411b9cf5124d9dd624f19f7
et/getnameinfo.c
524c87c61c1d39dd60aaa8ae01ec3528ce212288 09-Jun-2012 Geremy Condra <gcondra@google.com> Added event logging for some spoofed DNS queries.

Change-Id: I40909306e8cf922f1dd5a5685db89f732a709794
esolv/res_send.c
5a095ef28716b54f86d9c1727b9a2493ba775255 30-May-2012 Geremy Condra <gcondra@google.com> am 03539a36: Merge "Ensure that the port number and TXID are properly randomized." into jb-dev

* commit '03539a36b634bdfa61c06277cf25e0ca8e3105ba':
Ensure that the port number and TXID are properly randomized.
b23f193dcc0fa74b5be1978f85cc1c6811493c86 21-May-2012 Geremy Condra <gcondra@google.com> Ensure that the port number and TXID are properly randomized.

This fix reads from /dev/urandom to get the required entropy.

Bug: 6535492
Change-Id: Ibc2fec3f71a67607b608ad9b767b0b6504993c1d
esolv/res_init.c
a59cfcfd0821f51ee77f13105099f700ccbf9252 06-Sep-2011 Mattias Falk <mattias.falk@sonyericsson.com> Avoid multiple dns lookups for the same query

If two or more rapid dns requests for the same server are done
from different threads it turns into separate dns reques, if
the response of the request isn't found in the cache.

This patch avoid multiple request for the same server by
letting subsequents request wait until the first request
has finished.

Change-Id: Ic72ea0e7d3964a4164eddf866feb4357ec4dfe54
esolv/res_cache.c
esolv/res_send.c
53daf4757d36522c132006e2f74ed81bb4ed717a 07-May-2012 Elliott Hughes <enh@google.com> am 73a6566d: Merge "Remove expired dns cache entries before removing oldest"

* commit '73a6566da337db50cfc73c369d774ac1905a30c2':
Remove expired dns cache entries before removing oldest
73a6566da337db50cfc73c369d774ac1905a30c2 07-May-2012 Elliott Hughes <enh@google.com> Merge "Remove expired dns cache entries before removing oldest"
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
et/getaddrinfo.c
et/getnameinfo.c
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
et/getaddrinfo.c
et/getnameinfo.c
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
et/getaddrinfo.c
et/getnameinfo.c
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
et/getaddrinfo.c
et/getnameinfo.c
52764f5546362d0ffab99afaffe8e8c7f21f8ef2 26-Jan-2012 Robert Greenwalt <rgreenwalt@google.com> Increase the size of the system-wide dns cache

32 enteries perhaps was ok for per-process caching with ipv4 only
but adding ipv6 records makes it effectively 16 entries and making
it system wide makes is pretty useless. Increasing to 640 entries.

bug:5841178
Change-Id: I879f8bf4d3c4d8c1708bb46d46a67c1f64b1861f
esolv/res_cache.c
79fcc6948d139878b9ae0423c2fe804636433ad8 19-Jan-2012 David 'Digit' Turner <digit@google.com> Merge "libc: remove private declarations from <time.h> and <resolv.h>"
5f926c26795c3a72987652870a2ae6f3fb1ac49c 18-Jan-2012 Jean-Baptiste Queru <jbq@google.com> am b00d7a33: am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"

* commit 'b00d7a331c9f2a578a4cfc4dfe0d626aa58fa702':
res_send: Avoid spurious close()s and (rare) failure
b00d7a331c9f2a578a4cfc4dfe0d626aa58fa702 18-Jan-2012 Jean-Baptiste Queru <jbq@google.com> am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"

* commit 'eae1f1fba33cb105302227b044a14e5abcbe55e7':
res_send: Avoid spurious close()s and (rare) failure
87043f9c89593125a27199d0c1b4069d088672d7 12-Dec-2011 Jim Huang <jserv@0xlab.org> res_send: Avoid spurious close()s and (rare) failure

When looping over the current list of sockets we are connected to,
use getpeername() not getsockname() to find out who the remote
end is. This change avoids spurious close() and (rare) failure.

Origin: ISC bug #18625 and fixed in libbind 6.0

Change-Id: I5e85f9ff4b98c237978e4bf4bd85ba0a90d768e6
esolv/res_send.c
208898ee776117f42815c2fcb15903b2781bf0aa 13-Jan-2012 David 'Digit' Turner <digit@google.com> libc: remove private declarations from <time.h> and <resolv.h>

This patch is used to remove private C library declarations from the
public headers (that are exported to the NDK). It should *only* be
submitted after all other patches modifying the users of said
private functions have been submitted to the tree, to avoid
breakages.

Change-Id: I0a5e3014f8e3ac9ed8df86a5cdae506337c23252
esolv/res_cache.c
e4ade69654d9026310ce7a895f14aa67947b4f31 13-Jan-2012 Robert Greenwalt <rgreenwalt@google.com> am 82c4be54: am ecd0e95a: Adding a timeout to tcp dns lookup connects.

* commit '82c4be54da0825ebe74b524932c9db733419057a':
Adding a timeout to tcp dns lookup connects.
ecd0e95a0276c1ba72c7331f5e4617815f015f22 11-Jan-2012 Robert Greenwalt <rgreenwalt@google.com> Adding a timeout to tcp dns lookup connects.

TCP isn't supported on some dns servers, which makes the old code
hang forever.

NOT adding a stopship to remove debugging stuff - it was too painful
(14s timeout on failed tcp dns lookups) so we decided not to bother people.

bug:5766949
Change-Id: I381c20c3e11b8e994438d4f7c58ef643cd36554e
esolv/res_send.c
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
et/getaddrinfo.c
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
et/getaddrinfo.c
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
et/getaddrinfo.c
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
et/getaddrinfo.c
7f84da69f86ed9daf610c8d1129392ba3f7c4405 02-Sep-2011 Robert Greenwalt <rgreenwalt@google.com> Add some logging of dns cache operations

Added info about what entries are getting flushed due to ttl or size limits.

Change-Id: I69fb70ce23b5b820f5f1a5738c0f1aa57b6a1127
esolv/res_cache.c
777901424fa1100817f80a8cff8330b4b11d5af7 27-Jul-2011 Robert Greenwalt <rgreenwalt@google.com> resolved conflicts for merge of 9363d912 to honeycomb-plus-aosp

Change-Id: I555f5c10da9770feacdbece9fd77729d6151bfba
9363d91218c7ed727c36ffaf82ff28d7755375ae 25-Jul-2011 Robert Greenwalt <rgreenwalt@google.com> Add per-interface dns caches.

import of changes 22100 and 23138 from opensource.

Change-Id: I3ce86394323d269272aeb2bebeed4374f171a8cf
esolv/res_cache.c
esolv/res_state.c
e4197d41bb3458ea3a38de7bd75aa9cab27ee3af 21-Jul-2011 Robert Greenwalt <rgreenwalt@google.com> am fed31359: am f6fcdb2e: am 28de3e59: Merge "Don\'t reset caches when dns props change."

* commit 'fed3135972f9725a44a7d9b3df728e311ac1a130':
Don't reset caches when dns props change.
bad1686e1fadea28b56c83268b95c089671c9a89 04-Apr-2011 Mattias Falk <mattias.falk@sonyericsson.com> Don't reset caches when dns props change.

This happens too frequently. We should flush a per-interface cache
when it's dns server addrs changes.

Change-Id: I8a691c96ce9a775160ef55ddb8f755d649041583
esolv/res_state.c
8f88cbedc1692def20298300a7df94ad1c536259 27-Jun-2011 Robert Greenwalt <rgreenwalt@google.com> am e0a4b678: am cc32fbc3: Merge "Add support for a dns cache per interface"

* commit 'e0a4b67811981ab4c04c437b23c36ae42c444bce':
Add support for a dns cache per interface
23d3e6b21b4b6debff87da8c6558495e564cc38e 04-Apr-2011 Mattias Falk <mattias.falk@sonyericsson.com> Add support for a dns cache per interface

Initial commit for dns cache per interface.
Added a type that holds a reference to a
cache and name of associated interface,
address of interface, name server(s)
associated with an interface etc.

New functions to set default interface,
address of name servers etc.

Change-Id: Ie991bc5592fd998409853d8bf77d7fe69035dac5
esolv/res_cache.c
8a5123740750298433cce102f93cf5871985aa09 19-May-2011 JP Abgrall <jpa@google.com> libc: enable IPTOS_MINCOST, fixup gethostbyaddr() proto.

Make netinet/ip.h have IPTOS_MINCOST which matches what
kernel/common/linux/ip.h has to say.
Fixup gethostbyaddr() 1st arg to match what man has to say.

Change-Id: Iff9647d4a46ea88b1fc32163eb69bb9b27cdf370
ethnamaddr.c
dd16182b4b3f107d5c26015622c1cb8c06619ad7 20-May-2011 Anders Fredlund <anders.fredlund@sonyericsson.com> Remove expired dns cache entries before removing oldest

A suggestion how to make a smarter delete function when the cache
is full. First look through the entire cache and remove all entries
which have expired. If none use the old solution and just remove
the last entry in the MRU list.

Change-Id: I5f997ab35290a55dc6e1ddf37d725759edf83d36
esolv/res_cache.c
f8d02d24edd23dfb5028881105828cbf15e59310 19-May-2011 JP Abgrall <jpa@google.com> libc: enable IPTOS_MINCOST, fixup gethostbyaddr() proto.

Make netinet/ip.h have IPTOS_MINCOST which matches what
kernel/common/linux/ip.h has to say.
Fixup gethostbyaddr() 1st arg to match what man has to say.

Change-Id: Iff9647d4a46ea88b1fc32163eb69bb9b27cdf370
ethnamaddr.c
b6cd6816d2145682aecb64a676bd3df32185a0e2 17-Mar-2011 David 'Digit' Turner <digit@google.com> libc: Fix leak in the DNS thread-specific state.

NOTE: This is a back-port from the internal HC branch.

This patch fixes a leak that occurs when creating a new
thread-specific DNS resolver state object.

Essentially, each thread that calls gethostbyname() or getaddrinfo()
at least once will leak a small memory block. Another leak happens
anytime these functions are called after a change of the network
settings.

The leak is insignificant and hard to notice on typical programs.
However, netd tends to create one new thread for each DNS request
it processes, and quickly grows in size after a > 20 hours.

The same problem is seen in other system processes that tend to
create one thread per request too.

The leak occured becasue res_ninit() was called twice when creating
a new thread-specific DNS resolver state in _res_get_thread().

This function could not properly reset an existing thread and was
leaking a memory block.

The patch does two things:

- First, it fixes res_ninit() to prevent any leakage when resetting
the state of a given res_state instance.

- Second, it modifies the _res_get_thread() implementation to
make it more explicit, and avoid calling res_ninit() twice
in a row on first-time creation.

Fix for Bug 4089945, and Bug 4090857

Change-Id: Icde1d4d1dfb9383efdbf38d0658ba915be77942e
esolv/res_init.c
esolv/res_state.c
be7f5da0bdbfdd03c4fdceb827c15fc0b5c21792 30-Apr-2011 Brian Carlstrom <bdc@google.com> Tracking change to dns proxy protocol

The gethostbyaddr code in system/netd now expects a string address
from inet_ntop, not raw bytes, in order to properly pass addresses
containing null and probably spaces and newlines characeters as well.

Bug: 4344448
Change-Id: I8ec0eab94d5b1d38e9269ba3afb2825e946f8df3
et/getnameinfo.c
c5a3f7700b70c3857e0b098b1e976a2db1573174 27-Apr-2011 Brian Carlstrom <bdc@google.com> Tracking change to dns proxy protocol

The gethostbyaddr code in system/netd now expects a string address
from inet_ntop, not raw bytes, in order to properly pass addresses
containing null and probably spaces and newlines characeters as well.

Bug: 4344448
git cherry-pick -e c13fa640eea3285a586fc4bad0abf2fc1b902185
et/getnameinfo.c
c13fa640eea3285a586fc4bad0abf2fc1b902185 27-Apr-2011 Brian Carlstrom <bdc@google.com> Tracking change to dns proxy protocol

The gethostbyaddr code in system/netd now expects a string address
from inet_ntop, not raw bytes, in order to properly pass addresses
containing null and probably spaces and newlines characeters as well.

Bug: 4344448
Change-Id: I935abbbe522d96b64a5f975c7937e3aed3f7b335
et/getnameinfo.c
a34694d39498975c3afae959a7a52f1ea7092888 12-Apr-2011 Brad Fitzpatrick <bradfitz@android.com> am 09db590d: am 9b6e8af6: am 3ef36b21: Merge "Use system property to set dns cache size"

* commit '09db590d56ff2b568ea1a0ce265810697f0e0e92':
Use system property to set dns cache size
09db590d56ff2b568ea1a0ce265810697f0e0e92 12-Apr-2011 Brad Fitzpatrick <bradfitz@android.com> am 9b6e8af6: am 3ef36b21: Merge "Use system property to set dns cache size"

* commit '9b6e8af6994fd41f468161dec797354bb7778673':
Use system property to set dns cache size
3ef36b2115d0802e668e325b59af6ef14d999e71 11-Apr-2011 Brad Fitzpatrick <bradfitz@android.com> Merge "Use system property to set dns cache size"
02be15039a79735286ca8f10074aaa9b2d61a56b 25-Mar-2011 David 'Digit' Turner <digit@google.com> am aa8f50b4: am 6d46b099: am 2f169162: Merge "libc: Fix leak in the DNS thread-specific state." into honeycomb-mr1

* commit 'aa8f50b404ab0b2c78833387551800fa8448afcd':
libc: Fix leak in the DNS thread-specific state.
6d46b09954847b8905507c22e84c39b33425c5bd 25-Mar-2011 David 'Digit' Turner <digit@google.com> am 2f169162: Merge "libc: Fix leak in the DNS thread-specific state." into honeycomb-mr1

* commit '2f169162462e44d7aa6443e682b15fc756c2e4ad':
libc: Fix leak in the DNS thread-specific state.
2cc2b2be692f1d559a09d2066e56e450249cc9c0 22-Mar-2011 Carl Shapiro <cshapiro@google.com> Add some missing includes.

Change-Id: Ieec623c06bc32ec78334f628af25b00c2bccd2e7
ethnamaddr.c
et/getaddrinfo.c
et/nsdispatch.c
esolv/res_debug.c
4661fda2e5339c39ceb3aefd184eb8be3d0ca835 17-Mar-2011 David 'Digit' Turner <digit@google.com> libc: Fix leak in the DNS thread-specific state.

This patch fixes a leak that occurs when creating a new
thread-specific DNS resolver state object.

Essentially, each thread that calls gethostbyname() or getaddrinfo()
at least once will leak a small memory block. Another leak happens
anytime these functions are called after a change of the network
settings.

The leak is insignificant and hard to notice on typical programs.
However, netd tends to create one new thread for each DNS request
it processes, and quickly grows in size after a > 20 hours.

The same problem is seen in other system processes that tend to
create one thread per request too.

The leak occured becasue res_ninit() was called twice when creating
a new thread-specific DNS resolver state in _res_get_thread().

This function could not properly reset an existing thread and was
leaking a memory block.

The patch does two things:

- First, it fixes res_ninit() to prevent any leakage when resetting
the state of a given res_state instance.

- Second, it modifies the _res_get_thread() implementation to
make it more explicit, and avoid calling res_ninit() twice
in a row on first-time creation.

Fix for Bug 4089945, and Bug 4090857

Change-Id: Ie4831a8dbe82be8f07fce5ddd1d36bf95994f836
esolv/res_init.c
esolv/res_state.c
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
et/getaddrinfo.c
149f7dfe0416f19a729d83bf5cfde44b5e28e0ec 15-Feb-2011 Mattias Falk <mattias.falk@sonyericsson.com> Proxy getnameinfo through netd

Proxy the parts of getnameinfo that utilize
the dns cache through netd.

Change-Id: I1d57c451ea6b179c34828cf57a4182b262674003
et/getnameinfo.c
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
et/getaddrinfo.c
3a4910c6161d57e40ba01cc9693f1a4514892b03 14-Feb-2011 Mattias Falk <mattias.falk@sonyericsson.com> Use system property to set dns cache size

Use system property ro.net.dns_cache_size to set
the size of the cache. If the system property
is not set the default cache size is defined by
CONFIG_MAX_ENTRIES.

The number of entries in the hash table will be equal
to the number of max entries allowed in the cache.

Change-Id: I77d69d7c178937fa483d0b40512483ad29232d28
esolv/res_cache.c
3e0c5102e6d57e5b7296f95e1b318fda6114b48e 31-Jan-2011 Mattias Falk <mattias.falk@sonyericsson.com> Add time-to-live (TTL) support to resolver cache

Use the the TTL of the answer as the time a query
shall remain in the resolver cache.

Added some debugging support as well, i.e.
parse answer and print a la dig.

Change-Id: I724d3392245032592f1912f3ca7a81a8987ebbac
esolv/res_cache.c
f03e2d3f3104a85d64f66a18ab13d5ba5fb4131c 22-Jan-2011 David Turner <digit@google.com> am 5d45fa40: am 2081fda6: Merge "Only look up A records if the system has IPv4." into gingerbread

* commit '5d45fa4049d9ba03c0d922ece18d1d2dda119dc7':
Only look up A records if the system has IPv4.
5d45fa4049d9ba03c0d922ece18d1d2dda119dc7 19-Jan-2011 David Turner <digit@google.com> am 2081fda6: Merge "Only look up A records if the system has IPv4." into gingerbread

* commit '2081fda69a68505c914324797400b1b798516904':
Only look up A records if the system has IPv4.
2081fda69a68505c914324797400b1b798516904 19-Jan-2011 David Turner <digit@google.com> Merge "Only look up A records if the system has IPv4." into gingerbread
76b6f084ab555ea5610156153371659320f7b56d 17-Jan-2011 Steinar H. Gunderson <sesse@google.com> am 2be18508: am 2e23e292: Backport (simple cherry-pick) d33019030c1f0cddca557f9659e3c471bde0e6a9 to gingerbread.

* commit '2be18508f349b74b60b09e1b1118d879afb5928c':
Backport (simple cherry-pick) d33019030c1f0cddca557f9659e3c471bde0e6a9 to gingerbread.
2be18508f349b74b60b09e1b1118d879afb5928c 17-Jan-2011 Steinar H. Gunderson <sesse@google.com> am 2e23e292: Backport (simple cherry-pick) d33019030c1f0cddca557f9659e3c471bde0e6a9 to gingerbread.

* commit '2e23e29245aa42d0f9419187c94e72dba3888eef':
Backport (simple cherry-pick) d33019030c1f0cddca557f9659e3c471bde0e6a9 to gingerbread.
42e449e972c94d4af5a5ddffe2ffa73cc5666712 17-Jan-2011 Steinar H. Gunderson <sesse@google.com> am a798b9f0: Backport (simple cherry-pick) d1624add2b73ce8ff7826ce27b1d6d6e35bb83a6 to gingerbread.

* commit 'a798b9f0e171643b0bc7bbf79f14cb018689f715':
Backport (simple cherry-pick) d1624add2b73ce8ff7826ce27b1d6d6e35bb83a6 to gingerbread.
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
et/getaddrinfo.c
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).
et/getaddrinfo.c
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.
et/getaddrinfo.c
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
et/getaddrinfo.c
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
et/getaddrinfo.c
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
et/getaddrinfo.c
aeb41ec103103c37bf4a1700de714d9ff1befe8e 21-Oct-2010 Jean-Baptiste Queru <jbq@google.com> am b2061a30: Merge "resolv: make internal symbols static/hidden"

Merge commit 'b2061a30da29ee531c16862a5be3566e3b860839' into gingerbread-plus-aosp

* commit 'b2061a30da29ee531c16862a5be3566e3b860839':
resolv: make internal symbols static/hidden
7cc5666d94615d9249163dc7ac0f58c2614497ce 14-Oct-2010 Jim Huang <jserv@0xlab.org> resolv: make internal symbols static/hidden

Change-Id: I988b83613e6252c0cc961555e81c10f856a38b37
esolv/res_cache.c
esolv/res_data.c
esolv/res_debug.c
esolv/res_init.c
esolv/res_send.c
esolv/res_state.c
a9b706bd2b0814fcb45c4e8396c2bdddecb1f5de 11-Oct-2010 Jean-Baptiste Queru <jbq@google.com> am 66ad3429: Merge "gethnamaddr: make helper functions static"

Merge commit '66ad34293b84d979cae5ffda4b3b90b746127ebb' into gingerbread-plus-aosp

* commit '66ad34293b84d979cae5ffda4b3b90b746127ebb':
gethnamaddr: make helper functions static
e5c35e075fad5b5c143971c4401a360f6eaf5470 27-Sep-2010 Jim Huang <jserv@0xlab.org> gethnamaddr: make helper functions static

In order not to conflict with the symbols defined in file
libc/netbsd/getaddrinfo.c, this patch makes the internal/helper
functions static.

Change-Id: I0f85599e0b4ce0a637d005ff1680e1805dec4380
ethnamaddr.c
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
sc/ev_timers.c
ameser/ns_ttl.c
et/base64.c
et/getaddrinfo.c
et/getnameinfo.c
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
et/getaddrinfo.c
d378c68d74cb4fdac450650fe816c9d649c8edaf 09-Mar-2010 David 'Digit' Turner <digit@google.com> Fix spurious DNS lookups in the C library.

The problem was that the 'defdname' field of res_state structure
was not properly initialized in __res_vinit(). This field is used
to store the default domain name, which is normally build from
calling gethostname() (see line 549 of res_init.c).

Unfortunately, in the typical Android case, gethostname() returns
an error (the hostname is configured) and a random stack string is
used later to build the DNS search list (see lines 556+ in res_init.c)

For the sake of illustration, let's say the search list is set to
a random value like 'xWLK'.

The end result is that when trying to result an unknown domain name
(e.g. 'www.ptn'), the query fails then the resolver tries to make a
new query with the DNS search list path(s) appended (e.g. 'www.ptn.xWLK').

The patch simply initializes 'defdname' to an empty string to avoid
this when the net.dns.search system property is not set.

Also contains whitespace/formatting fixes
esolv/res_cache.c
esolv/res_init.c
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.
et/getaddrinfo.c
cdeb4c8afa2fb7b92cce3b32a9d2f3c05ad759ba 15-Sep-2009 Jean-Baptiste Queru <jbq@google.com> merge from open-source master
a90528ad3420c571987f2124955646dae88007b6 28-Jul-2009 Chih-Wei Huang <cwhuang@linux.org.tw> Include <endian.h> instead of <sys/endian.h>,
since the later doesn't define byte order.
et/getservent.c
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.
et/getaddrinfo.c
9cfb12e6bce65b49fd858b86149858ff3851072d 29-Jul-2009 David 'Digit' Turner <digit@google.com> am 3773d35e: Make the DNS resolver accept domain names with an underscore.

Merge commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494'

* commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494':
Make the DNS resolver accept domain names with an underscore.
3773d35eb98e22b5edab4d82fb72bdf86ff80494 27-Jul-2009 David 'Digit' Turner <digit@google.com> Make the DNS resolver accept domain names with an underscore.

More precisely, this accepts domain labels with an underscore in
the middle (i.e. not at the start or the end of the label). This
is needed to perform complex CNAME chain resolution in certain
VPN networks.
esolv/res_comp.c
c52c174e412fa6c829cf6353ce8dbebdf710511f 12-Jun-2009 Lorenzo Colitti <lorenzo@google.com> Make IPv6 definitions comply with RFC 3493:
- Add some definitions to netinet/in6.h
- Include netinet/in6.h from netinet/in.h
esolv/res_send.c
2735b33519595da5d51b79757ccce730021a9228 26-May-2009 David 'Digit' Turner <digit@google.com> Fix getservent() so that it returns s_port in network byte order.
Also add a new document detailing known issues in the C library.
et/getservent.c
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.
et/getaddrinfo.c
aeae1f5b6c6cf22c2854e07f11555591c5430607 09-Apr-2009 Chung-yih Wang <cywang@google.com> Add the domain search list for VPN connection.
The current solution is to read the net.dns.search property,
and expand the list during the resolve initialization. In the
future, we could implement search list per process.

Update: refine the code accordingly.

Update: remove unnecessary code.

Update: remove the unused variable.
esolv/res_init.c
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ethnamaddr.c
net/nsap_addr.c
sc/ev_streams.c
sc/ev_timers.c
sc/eventlib_p.h
ameser/ns_name.c
ameser/ns_netint.c
ameser/ns_parse.c
ameser/ns_print.c
ameser/ns_samedomain.c
ameser/ns_ttl.c
et/base64.c
et/getaddrinfo.c
et/getnameinfo.c
et/getservbyname.c
et/getservbyname_r.c
et/getservbyport.c
et/getservbyport_r.c
et/getservent.c
et/getservent_r.c
et/nsdispatch.c
et/reentrant.h
et/servent.h
et/services.h
esolv/__dn_comp.c
esolv/__res_close.c
esolv/__res_send.c
esolv/herror.c
esolv/res_cache.c
esolv/res_comp.c
esolv/res_compat.c
esolv/res_data.c
esolv/res_debug.c
esolv/res_debug.h
esolv/res_init.c
esolv/res_mkquery.c
esolv/res_private.h
esolv/res_query.c
esolv/res_random.c
esolv/res_send.c
esolv/res_state.c
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ethnamaddr.c
net/nsap_addr.c
sc/ev_streams.c
sc/ev_timers.c
sc/eventlib_p.h
ameser/ns_name.c
ameser/ns_netint.c
ameser/ns_parse.c
ameser/ns_print.c
ameser/ns_samedomain.c
ameser/ns_ttl.c
et/base64.c
et/getaddrinfo.c
et/getnameinfo.c
et/getservbyname.c
et/getservbyname_r.c
et/getservbyport.c
et/getservbyport_r.c
et/getservent.c
et/getservent_r.c
et/nsdispatch.c
et/reentrant.h
et/servent.h
et/services.h
esolv/__dn_comp.c
esolv/__res_close.c
esolv/__res_send.c
esolv/herror.c
esolv/res_cache.c
esolv/res_comp.c
esolv/res_compat.c
esolv/res_data.c
esolv/res_debug.c
esolv/res_debug.h
esolv/res_init.c
esolv/res_mkquery.c
esolv/res_private.h
esolv/res_query.c
esolv/res_random.c
esolv/res_send.c
esolv/res_state.c
6f04a0f4c72acff80dad04828cb69ef67fa609d1 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
ethnamaddr.c
esolv/res_cache.c
esolv/res_send.c
esolv/res_state.c
4e468ed2eb86a2406e14f1eca82072ee501d05fd 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
et/getnameinfo.c
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
ethnamaddr.c
net/nsap_addr.c
sc/ev_streams.c
sc/ev_timers.c
sc/eventlib_p.h
ameser/ns_name.c
ameser/ns_netint.c
ameser/ns_parse.c
ameser/ns_print.c
ameser/ns_samedomain.c
ameser/ns_ttl.c
et/base64.c
et/getaddrinfo.c
et/getnameinfo.c
et/getservbyname.c
et/getservbyname_r.c
et/getservbyport.c
et/getservbyport_r.c
et/getservent.c
et/getservent_r.c
et/nsdispatch.c
et/reentrant.h
et/servent.h
et/services.h
esolv/__dn_comp.c
esolv/__res_close.c
esolv/__res_send.c
esolv/herror.c
esolv/res_cache.c
esolv/res_comp.c
esolv/res_compat.c
esolv/res_data.c
esolv/res_debug.c
esolv/res_debug.h
esolv/res_init.c
esolv/res_mkquery.c
esolv/res_private.h
esolv/res_query.c
esolv/res_random.c
esolv/res_send.c
esolv/res_state.c