summaryrefslogtreecommitdiff
path: root/libc/netbsd/resolv
AgeCommit message (Collapse)Author
2011-05-20Remove expired dns cache entries before removing oldestAnders Fredlund
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
2011-05-18libc: Fix leak in the DNS thread-specific state.David 'Digit' Turner
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
2011-04-12am 09db590d: am 9b6e8af6: am 3ef36b21: Merge "Use system property to set dns ↵Brad Fitzpatrick
cache size" * commit '09db590d56ff2b568ea1a0ce265810697f0e0e92': Use system property to set dns cache size
2011-04-12am 9b6e8af6: am 3ef36b21: Merge "Use system property to set dns cache size"Brad Fitzpatrick
* commit '9b6e8af6994fd41f468161dec797354bb7778673': Use system property to set dns cache size
2011-03-25am aa8f50b4: am 6d46b099: am 2f169162: Merge "libc: Fix leak in the DNS ↵David 'Digit' Turner
thread-specific state." into honeycomb-mr1 * commit 'aa8f50b404ab0b2c78833387551800fa8448afcd': libc: Fix leak in the DNS thread-specific state.
2011-03-21Add some missing includes.Carl Shapiro
Change-Id: Ieec623c06bc32ec78334f628af25b00c2bccd2e7
2011-03-18libc: Fix leak in the DNS thread-specific state.David 'Digit' Turner
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
2011-02-14Use system property to set dns cache sizeMattias Falk
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
2011-02-02Add time-to-live (TTL) support to resolver cacheMattias Falk
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
2010-10-15resolv: make internal symbols static/hiddenJim Huang
Change-Id: I988b83613e6252c0cc961555e81c10f856a38b37
2010-03-08Fix spurious DNS lookups in the C library.David 'Digit' Turner
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
2009-07-28am 3773d35e: Make the DNS resolver accept domain names with an underscore.David 'Digit' Turner
Merge commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494' * commit '3773d35eb98e22b5edab4d82fb72bdf86ff80494': Make the DNS resolver accept domain names with an underscore.
2009-07-27Make the DNS resolver accept domain names with an underscore.David 'Digit' Turner
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.
2009-06-16Make IPv6 definitions comply with RFC 3493:Lorenzo Colitti
- Add some definitions to netinet/in6.h - Include netinet/in6.h from netinet/in.h
2009-04-13Add the domain search list for VPN connection.Chung-yih Wang
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.
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-02-19auto import from //branches/cupcake/...@132276The Android Open Source Project
2008-10-21Initial ContributionThe Android Open Source Project