summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/asr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix two issues related to thread private data in asr.otto2021-01-061-3/+21
| | | | | | | | - setting up asr in single thread mode and then starting threads using asr would lead to multiple threads sharing the same resolver. - destruction of a thread that has been using asr would leak data. Problem originally reported by Alexey Sokolov and Uli Schlachter. ok kettenis@
* Add support for timeconting in userland.pirofti2020-07-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* In the libc resolver function asr_run(), clear the result buffer everytime,deraadt2020-06-071-1/+3
| | | | | | because there are callers who were inspecting unrelated fields. discussion with eric, otto, solution from semarie this is errata 6.6/031_asr and 6.7/009_asr
* Allow the caller of asr functions to create and use a specific context.otto2019-10-241-5/+38
| | | | | Diff from eric@ and florian@, commiting on their behalf since they are absent and we want to ride the minor shlib bump.
* More "explicitely" -> "explicitly" in various comments.krw2018-10-221-2/+2
| | | | ok guenther@ tb@ deraadt@
* To allow us to get rid of /etc/networks, make getnetby*(3)schwarze2018-04-281-7/+1
| | | | | | wrappers around gethostby*_async(3). If you had anything of importance in /etc/networks, specify it in /etc/hosts instead. Feedback and OK eric@, OK deraadt@
* Fix commentsjca2018-03-131-6/+5
| | | | ok eric@ a while ago
* make sure that all error paths are correctly handled in asr_run_sync()eric2018-02-061-18/+33
| | | | | | | and that the result is always properly set when the functions returns. fix issues spotted by claudio@. ok claudio@
* Put a common flags field in the query struct, rather than in somejca2017-02-271-2/+2
| | | | | | | | | elements of the union. This field is for internal asr flags. The flags in "struct rrset" and "struct ni" are different kinds of flags. ok eric@
* Put a common subq pointer in the query struct, rather than one in eacheric2017-02-231-13/+5
| | | | | | element of the union. ok gilles@ millert@ krw@
* Add EDNS0 support.jca2017-02-181-1/+3
| | | | | | | EDNS allows for various DNS extensions, among which UDP DNS packets size bigger than 512 bytes. The default is still to not advertize anything. ok eric@
* Remove duplicated line.reyk2016-06-181-2/+1
| | | | OK eric@
* typo fixes; Anthony Coultersthen2016-05-271-2/+2
|
* Calculate elapsed time in poll() and subtract that from the remaining timejmatthew2016-05-261-4/+19
| | | | | | | | | | when restarting poll() after receiving a signal. The ruby runtime send signals to threads periodically, so without accounting for elapsed time, the timeout would never expire if we didn't get a response from a nameserver. ok deraadt@ eric@
* Avoid a possible double-free if the "search" keyword is used multiple times.eric2016-02-241-2/+4
| | | | ok jca@ gilles@
* Remove support for HOSTALIASES from the resolver. This "open and parsederaadt2015-12-161-48/+1
| | | | | | | | any file indicated by an environment variable" feature inside the resolver is incompatible with what pledge "dns" is trying to be. It is a misguided "feature" added way back in history which almost noone uses, but everyone has to assume the risk from. ok eric florian kettenis
* Remove support for "lookup yp" in /etc/resolv.conf. This historicalderaadt2015-11-231-4/+4
| | | | | | | | wart is incompatible with pledge, because suddenly a "dns" operation needs "getpw" access to ypbind/ypserv, etc. file + dns access is enough for everyone, sorry if you were using that old SunOS 4.x style mechanism, but it is now gone. ok semarie millert florian
* We are always using _PATH_RESCONF, so no need to remember the path oneric2015-10-281-14/+4
| | | | | | the resolver. ok millert@ deraadt@
* Remove support for [addr]:port syntax from the "nameserver" line.deraadt2015-10-281-22/+1
| | | | | | | This extension never made it to other systems. (pledge is also happy with this. The idea of DNS @ any port collides with pledge encouraring differentiation between DNS and non-DNS sockets) ok phessler jung sthen kettenis
* getaddrinfo_async() shouldn't unconditionally intialize the resolverderaadt2015-10-071-1/+7
| | | | | | via _asr_use_resolver(). If the hint specifies for AI_NUMERICHOST, create a transient lookup context which won't try to open /etc/reslov.conf ok eric guenther
* Initially eric developers asr as a side-load style library for async DNS.deraadt2015-10-031-63/+13
| | | | | | | When it was integrated as the main resolver, a bunch of strange initialization code remained. Start whittling away at this, piece by piece, to make it more clear. ok eric
* missing asr* -> _asr* symbol rename for building with debug codeeric2015-10-031-5/+5
| | | | ok jca@
* remove bogus includes of err.heric2015-09-201-2/+1
|
* use _PATH_RESCONF directlyeric2015-09-201-3/+2
|
* Wrap <asr.h> so internal calls go direct and all the symbols are weakguenther2015-09-141-1/+3
|
* Hide all unnecessary asr / resolver related API with _ prefixes.deraadt2015-09-091-26/+26
| | | | direction & ok guenther
* use _PATH_RESCONFderaadt2015-09-021-2/+2
|
* make sure to check for resolv.conf update the first time the resolvereric2015-06-041-1/+9
| | | | | | is used after pid has changed. ok deraadt@
* fix a possible off-by-one when reading /etc/hosts if it doesn't enderic2015-05-291-2/+9
| | | | | | with a newline. ok jca@
* simply use _PATH_HOSTS where appropriateeric2015-05-261-4/+1
|
* Move to the <limits.h> universe.deraadt2015-01-161-1/+2
| | | | review by millert, binary checking process with doug, concept with guenther
* When fopen()ing internal to libc (the API doesn't support the useguenther2014-09-151-3/+3
| | | | | | | of the resulting FILE *), then pass fopen() the 'e' mode letter to mark it close-on-exec. ok miod@
* Make the asr API public. Install asr.h to /usr/include.h and manpages.eric2014-03-261-3/+4
| | | | | | Include tweaks suggested by mpi@ ok deraadt@
* Cleanup and simplify the API to be exposed. Use better names foreric2014-03-251-18/+20
| | | | | | structures, functions and defines. discussed with and ok deraadt@ guenther@
* Make some symbols static and prefix all visible symbols with asr_eric2013-07-121-22/+22
| | | | | | to prevent collisions with third-party programs. suggested by sthen@, ok theo@
* Move search domain iteration code in res_search_async.c where it belongs.eric2013-06-011-108/+1
|
* Make hostaliases work for gethostbyname() and getaddrinfo() wheneric2013-06-011-20/+1
| | | | | | looking into /etc/hosts. Remove the alias check from the search domain iteration. Instead, take a shortcut to res_query_async_ctx() in res_search_async_ctx().
* Update asr_hostaliases() to make all necessary checks in the function.eric2013-06-011-13/+12
| | | | | Explicitely check for issetguid() before calling getenv(). Also make asr_hostalias() callable from other parts of asr too.
* iterating over the ns list only matters for res_send_async.c, so moveeric2013-06-011-32/+1
| | | | things around.
* Add minimal support for _res setup and update.eric2013-05-271-4/+4
| | | | | | | | Change res_init() to initialize the _res structure on first call, and udpate the global async context if changes were made by the user. All resolver functions now call res_init() internally. fixes issue spotted by otto@
* Do not take external buffers for storing DNS responses in the internaleric2013-04-301-2/+2
| | | | | async API. That is actually useless and it makes the code more complicated. The required buffers are always allocated when needed.
* check return value of strdup(), fix mem leak in error path and takeotto2013-04-171-10/+17
| | | | into account that asr_use_resolver() can return NULL; ok tedu@ eric@
* give a timespec a name that is easier to verifyderaadt2013-04-171-5/+5
|
* Proper access of _THREAD_PRIVATE storage. Avoids a mem leak and reinitotto2013-04-111-3/+3
| | | | | of resolver context for each resolver call for single threaded programs. With and ok tedu@ ok eric@
* If more than one lookup line is found in resolv.conf, the latest oneeric2013-04-011-18/+9
| | | | | | takes precedence. Simplify code while there. suggested by deraadt@
* properly check for domain name truncation at various places and faileric2013-04-011-12/+18
| | | | | | if that happens. prodded by deraadt@
* space cleanup; ok ericderaadt2013-04-011-6/+6
|
* Principle of least astonishment: implement nameserver retry/backoff aseric2013-03-311-3/+9
| | | | in the former resolver.
* Do not assume local nameserver if resolv.conf doesn't exist, just useeric2013-03-301-2/+2
| | | | | | /etc/hosts. discussed with deraadt@
* don't ever skip reload the very first time; detective work by rpe@; ok eric@otto2013-03-301-2/+2
|