summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr (follow)
Commit message (Collapse)AuthorAgeFilesLines
* swap rname and mname in debug output, and handle the USE_CD flageric2021-04-021-3/+4
| | | | from Boudewijn Dijkstra
* When checking for available address family for AI_ADDRCONFIG considerflorian2021-01-261-1/+16
| | | | | | | | the routing domain we are currently in. Otherwise we might end up with address families that are not available in the current rdomain but in others since getifaddrs(3) gives us all interface addresses in the system. Clue-bat & OK claudio, input & OK eric, OK kn
* 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@
* Always call endservent_r() after getservbyport_r().eric2020-12-212-13/+17
| | | | | | Fix a memory leak when no entry is matched. ok florian
* 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-242-9/+61
| | | | | Diff from eric@ and florian@, commiting on their behalf since they are absent and we want to ride the minor shlib bump.
* correctly handle read(2) return value.eric2019-09-281-3/+10
| | | | | | fix issue reported by Mikolaj Kucharski. ok martijn@ deraadt@
* snprintf/vsnprintf return < 0 on error, rather than -1.deraadt2019-07-033-6/+6
|
* If we don't receive a reply packet the res_send subquery will already havemartijn2019-06-271-7/+5
| | | | | | | | | | | set subq_h_errno and ar_count. Remove the ar_datalen == -1 check, so we set ar_h_errno and don't have to (wrongly) guess that ar_h_errno = HOST_NOT_FOUND. This makes sure that if no nameserver responds the h_errno value is set to TRY_AGAIN instead of HOST_NOT_FOUND. OK eric@, deraadt@
* Allow setting of retransmission intervasl via _res.retrans. Ugly API butotto2019-06-171-1/+4
| | | | it's all we got. ok jca@
* Unbreak tree. Last minute changes are evil.otto2019-01-142-4/+4
|
* There are cases where a program doing dns requests wants to set theotto2019-01-142-2/+6
| | | | | Checking Disabled flag. Introduce a RES flag to do so. ok krw@ deraadt@ eric@
* For correctness, do not read struct servent if getservbyname_r() failed.eric2018-11-031-7/+5
| | | | Also simplify code.
* More "explicitely" -> "explicitly" in various comments.krw2018-10-222-4/+4
| | | | ok guenther@ tb@ deraadt@
* To allow us to get rid of /etc/networks, make getnetby*(3)schwarze2018-04-285-442/+79
| | | | | | 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@
* Minor cleanup, no functional change:schwarze2018-04-281-8/+3
| | | | | | | Remove unused headers and a comment implying that we might consider reviving these dead horses in the future, which we do not intend to do. OK deraadt@ guenther@
* 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@
* Kill unused functionjca2017-09-231-9/+1
| | | | Spotted by krw@
* use recallocarray to resize buffer - ensures that detritus from previousderaadt2017-03-151-2/+2
| | | | | lookups isn't left lying around the address space. ok eric
* don't need to handle the malloc case special, since realloc worksderaadt2017-03-141-9/+1
| | | | | with NULL ok eric
* Add support for RES_USE_DNSSECjca2017-02-274-13/+22
| | | | | | | | | | | | RES_USE_DNSSEC is implemented by setting the DNSSEC DO bit in outgoing queries. The resolver is then supposed to set the AD bit in the reply if it managed to validate the answer through DNSSEC. Useful when the application doesn't implement validation internally. This scheme assumes that the validating resolver is trusted and that the communication channel between the validating resolver and and the client is secure. ok eric@ gilles@
* Recognize and allow bits AD and CD in DNS replies.jca2017-02-272-6/+9
| | | | | | Needed for RES_USE_DNSSEC support. ok eric@ gilles@
* Put a common flags field in the query struct, rather than in somejca2017-02-275-21/+19
| | | | | | | | | 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-238-53/+40
| | | | | | element of the union. ok gilles@ millert@ krw@
* missing breakseric2017-02-212-2/+4
| | | | ok jca@ krw@ gilles@
* Report the errno set by getifaddrs(3) if the setup for AI_ADDRCONFIG fails,eric2017-02-211-4/+5
| | | | | | | rather than a non-informative EAI_FAIL. Compare to -1 for error detection while here. ok jca@ gilles@
* Use T_OPT instead of literal "41".jca2017-02-191-2/+2
| | | | Requested earlier by eric@
* Use more specific error codes for invalid packets.eric2017-02-181-4/+15
| | | | | | | | In particular, truncated packets without the TC flag set (non-compliant server sending too large packets) now fail with EOVERFLOW instead of EINVAL, so the TCP fallback mechanism can work. feedback and ok krw@ jca@ benno@
* Add EDNS0 support.jca2017-02-186-12/+39
| | | | | | | 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@
* use common errnos instead of random strings as error indicators ineric2017-02-173-15/+16
| | | | | | pack/unpack contexts. ok krw@ deraadt@
* Increase UDP packet buffer to 4096 bytes from 512. There are some reallykrw2017-02-171-2/+4
| | | | | | | | | | broken DNS servers out there that send packets >512 bytes w/o even the courtesy of trying to use EDNS0. A partial workaround as more complete packet parsing solutions are worked on. ok jca@ eric@
* Remove prototype for static function _asr_resolver. Eliminates gcckrw2016-12-181-2/+1
| | | | | | | whining about undefined static in all the .c files that include asr_private.h. _asr_resolver() is defined and used in asr.c only. ok kettenis@
* Declare all _asr_* debug functions as hidden.jca2016-08-201-8/+8
| | | | Reported by & similar diff by guenther@ some time ago, 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@
* Prefer _MUTEX_*LOCK over _THREAD_PRIVATE_MUTEX_*LOCK() when thread-specificguenther2016-04-051-4/+4
| | | | | | data isn't necessary. ok mpi@, ok&tweak natano@
* for some time now mandoc has not required MLINKS to functionjmc2016-03-301-16/+1
| | | | | | | | | | | | correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
* Initialize _res_ext.nsaddr_list alongside _res.nsaddr_list.chrisz2016-03-231-9/+16
| | | | | | | Fallback to initialization with 0 when _res.nsaddr_list is to small to hold an IPv6 address. OK bluhm@
* 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-165-66/+7
| | | | | | | | 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-234-239/+7
| | | | | | | | 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
* Set the name server counter in __res_state correctly if a nameserverbluhm2015-11-051-2/+2
| | | | | from asr_ctx was skiped. Missed in previous commit. OK deraadt@
* When filling the __res_state compatibiliy struct, a long list ofbluhm2015-11-051-4/+8
| | | | | | | | nameservers could overflow the dns search pointers. Restrict the number, size and address family of nameservers in res_init(3). This fixes a crash in sendmail. Only programs that use the bind resolver internals directly are affected. OK deraadt@ millert@
* We are always using _PATH_RESCONF, so no need to remember the path oneric2015-10-283-21/+6
| | | | | | 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
* Switch to using SOCK_DNS flag, rather than the dnssocket() andderaadt2015-10-231-3/+4
| | | | | | dnssonnect() calls. Be a bit careful crossing over this, need a kernel no older than Monday. ok guenther tedu semarie
* libc DNS functions will now use the new dnssocket() / dnsconnect()deraadt2015-10-181-3/+3
| | | | | | | | | | | system calls. These signal to the pledge kernel code that a DNS transaction is happening. These special sockets only work well with port 53 (there are some cute plans...). Programs calling pledge "inet" will not work! You need pledge "dns", and of course, you need a fairly fresh kernel. ok guenther kettenis tedu