aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/resolv
Commit message (Collapse)AuthorAgeFilesLines
* libc/resolv: get rid of MD5Robert Clausecker2025-10-042-56/+6
| | | | | | | | | | | | | MD5 is used by libc/resolv to generate a random sequence id from a current time stamp. Replace this convoluted mechanism with a call to arc4random(). This permits us to entirely drop MD5 from libc, simplifying the MD5 rework proposed in D45670. Approved by: markj Reviewed by: kevans, markj See also: D45670 Event: EuroBSDcon 2025 Differential Revision: https://reviews.freebsd.org/D52784
* libc: Remove unused pselect() implementation.Dag-Erling Smørgrav2025-07-241-31/+0
| | | | | | | This hasn't been needed since FreeBSD 5.0. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51434
* libc: Disable debugging code in the resolver.Dag-Erling Smørgrav2025-07-246-29/+11
| | | | | Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D37319
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* lib: Remove ancient SCCS tags.Warner Losh2023-11-2711-40/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* libc: Remove empty comments in Symbol.mapBrooks Davis2023-11-151-3/+0
| | | | | | | These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
* libc: Purge unneeded cdefs.hWarner Losh2023-11-0112-12/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1612-24/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* libc: Use secure_getenv(3) where appropriateMark Johnston2023-03-272-4/+2
| | | | | | | No functional change intended. Reviewed by: mjg, imp, kib Differential Revision: https://reviews.freebsd.org/D39278
* resolver(3): Fix a typo in a source code commentGordon Bergling2022-04-091-1/+1
| | | | | | - s/psuedo/pseudo/ MFC after: 3 days
* res_init: remove unused inet_makeaddr with IN_LOOPBACKNETMike Karels2021-11-091-8/+0
| | | | | | | | Remove code that is ifdefed out on USELOOPBACK, which uses historical class. No functional change intended. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D32712
* Rather than using the legacy IP struct fields in the union for theBjoern A. Zeeb2019-06-041-1/+1
| | | | | | | | | | | | | port number, properly access them by their IPv6 names. This will make it easier to slice up and compile out address families in the future. No functional change intended. MFC after: 6 weeks Notes: svn path=/head/; revision=348671
* Allow the use of TCP instead of UDP for queries by setting options usevcBjoern A. Zeeb2018-08-161-0/+2
| | | | | | | | | | | in resolv.conf which sets RES_USEVC. Reviewed by: ume MFC after: 17 days Differential Revision: https://reviews.freebsd.org/D16607 Notes: svn path=/head/; revision=337904
* SPDX: license IDs for some ISC-related files.Pedro F. Giffuni2017-12-0812-16/+28
| | | | Notes: svn path=/head/; revision=326695
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-252-0/+4
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-207-7/+21
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-287-7/+7
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Replace dot-dot relative pathing with SRCTOP-relative paths where possibleEnji Cooper2017-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | This reduces build output, need for recalculating paths, and makes it clearer which paths are relative to what areas in the source tree. The change in performance over a locally mounted UFS filesystem was negligible in my testing, but this may more positively impact other filesystems like NFS. LIBC_SRCTOP was left alone so Juniper (and other users) can continue to manipulate lib/libc/Makefile (and other Makefile.inc's under lib/libc) as include Makefiles with custom options. Discussed with: marcel, sjg MFC after: 1 week Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9207 Notes: svn path=/head/; revision=312451
* Don't leak addrinfo if ai->ai_addrlen <= minsiz test fails.Don Lewis2016-06-081-12/+13
| | | | | | | | | | | | | | | | | If the ai->ai_addrlen <= minsiz test fails, then freeaddrinfo() does not get called to free the memory just allocated by getaddrinfo(). Fix by moving ai->ai_addrlen <= minsiz to a separate nested if block, and keep freeaddrinfo() in the outer block so that freeaddrinfo() will be called whenever getaddrinfo() succeeds. Reported by: Coverity CID: 1273652 Reviewed by: ume MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6756 Notes: svn path=/head/; revision=301592
* Since rdata is only used as an argument to the immediately followingDon Lewis2016-05-161-5/+3
| | | | | | | | | | | | call to res_nopt_rdata(), revert r299879 and fix CID 603941 by moving rdata = &buf[n]; inside the if block. Reported by: Coverity CID: 603941 Notes: svn path=/head/; revision=299880
* Likely a false positive ... but make sure that -1 can't be used as anDon Lewis2016-05-161-4/+6
| | | | | | | | | | | array index by splitting up a test. Reported by: Coverity CID: 603941 MFC after: 1 week Notes: svn path=/head/; revision=299879
* libc: spelling fixes.Pedro F. Giffuni2016-04-303-4/+4
| | | | | | | Mostly on comments. Notes: svn path=/head/; revision=298830
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-04-189-9/+0
| | | | | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined). Notes: svn path=/head/; revision=298226
* libc: make some more use of the nitems() macro.Pedro F. Giffuni2016-04-163-3/+3
| | | | | | | | | | | We have an nitems() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Given that it is available already without adding additional headers and other parts of libc already use it, extend a bit more its use. Notes: svn path=/head/; revision=298120
* libc: replace 0 with NULL for pointers.Pedro F. Giffuni2016-04-103-11/+8
| | | | | | | | | | | | While here also cleanup some surrounding code; particularly drop some malloc() casts. Found with devel/coccinelle. Reviewed by: bde (previous version - all new bugs are mine) Notes: svn path=/head/; revision=297790
* Allow users override `DEBUG` on the command line via DEBUG_FLAGS="-DDEBUG" withEnji Cooper2015-12-155-5/+15
| | | | | | | | | | | lib/libc/resolv by conditionalizing its definition MFC after: 3 days Reviewed by: ume, vangyzen Differential Revision: https://reviews.freebsd.org/D4519 Notes: svn path=/head/; revision=292250
* resolver: preserve binary compatibility; reduce header pollutionEric van Gyzen2015-12-143-20/+29
| | | | | | | | | | | | | | | | | In r289315, I added new fields to res_state. This broke binary backward compatibility. It also broke some ports (and possibly other code) by requiring the definition of time_t and struct timespec. Fix these problems by moving the new fields into __res_state_ext. Suggested by: ume Reviewed by: ume MFC after: 3 days Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D4472 Notes: svn path=/head/; revision=292216
* resolver: abuse _res a little lessEric van Gyzen2015-10-231-39/+52
| | | | | | | | | | | | | | | | | | | | In the past, _res was a global variable. Now, it's multiple function calls. Several functions in the resolver use _res multiple times and therefore call the function(s) far more than necessary. Fix those callers to store the result of _res in a local variable. Add __noinline to the definition of res_init() to avoid the code bloat that these changes would have otherwise incurred. Thanks to jilles for noticing this. Reviewed by: jilles MFC after: 1 week Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D3887 Notes: svn path=/head/; revision=289837
* resolver: automatically reload /etc/resolv.confEric van Gyzen2015-10-142-2/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | On each resolver query, use stat(2) to see if the modification time of /etc/resolv.conf has changed. If so, reload the file and reinitialize the resolver library. However, only call stat(2) if at least two seconds have passed since the last call to stat(2), since calling it on every query could kill performance. This new behavior is enabled by default. Add a "reload-period" option to disable it or change the period of the test. Document this behavior and option in resolv.conf(5). Polish the man page just enough to appease igor. https://lists.freebsd.org/pipermail/freebsd-arch/2015-October/017342.html Reviewed by: kp, wblock Discussed with: jilles, imp, alfred MFC after: 1 month Relnotes: yes Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D3867 Notes: svn path=/head/; revision=289315
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-224-21/+9
| | | | Notes: svn path=/head/; revision=288114
* Add declarations to eliminate -Wmissing-prototypes warningsCraig Rodrigues2015-09-201-0/+3
| | | | Notes: svn path=/head/; revision=288018
* Add support for '_' occurring at the beginning or end of a nameHajimu UMEMOTO2015-06-101-3/+3
| | | | | | | | | | | component. PR: 176093 Submitted by: landonf__at__bikemonkey.org MFC after: 1 week Notes: svn path=/head/; revision=284229
* Update our stub resolver to final version of libbind.Hajimu UMEMOTO2014-08-1213-120/+208
|\ | | | | | | | | | | | | Obtained from: ISC Notes: svn path=/head/; revision=269867
| * We don't use these files.Hajimu UMEMOTO2014-08-102-195/+0
| | | | | | | | Notes: svn path=/vendor/resolver/dist/; revision=269781
| * Bring final version of libbind:Pedro F. Giffuni2014-08-0513-112/+382
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From http://www.isc.org/downloads/libbind/ The libbind functions have been separated from the BIND suite as of BIND 9.6.0. Originally from older versions of BIND, they have been continually maintained and improved but not installed by default with BIND 9. This standard resolver library contains the same historical functions and headers included with many Unix operating systems. In fact, most implementations are based on the same original code. At present, NetBSD maintains libbind code, now known as "netresolv". Notes: svn path=/vendor/resolver/dist/; revision=269610
| * Import the resolver part of BIND 9.4.3.vendor/resolver/9.4.3Hajimu UMEMOTO2008-12-144-24/+139
| | | | | | | | | | Notes: svn path=/vendor/resolver/dist/; revision=186083 svn path=/vendor/resolver/9.4.3/; revision=186084; tag=vendor/resolver/9.4.3
| * Vendor import of BIND 9.4.2vendor/resolver/9.4.2Hajimu UMEMOTO2007-12-032-19/+30
| | | | | | | | | | Notes: svn path=/vendor/resolver/dist/; revision=174223 svn path=/vendor/resolver/9.4.2/; revision=174225; tag=vendor/resolver/9.4.2
* | Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}Marcel Moolenaar2014-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=262722
* | libc/resolv: Use poll() instead of kqueue().Jilles Tjoelker2014-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | The resolver in libc creates a kqueue for watching a single file descriptor. This can be done using poll() which should be lighter on the kernel and reduce possible problems with rlimits (file descriptors, kqueues). Reviewed by: jhb Notes: svn path=/head/; revision=260652
* | libc: Make resolver sockets close-on-exec (SOCK_CLOEXEC).Jilles Tjoelker2013-09-061-2/+3
| | | | | | | | | | | | | | | | Although the resolver's sockets are exposed to applications via res_state, I do not expect them to pass the sockets across execve(). Notes: svn path=/head/; revision=255336
* | libc: Make various internal file descriptors from fopen() close-on-exec.Jilles Tjoelker2013-08-232-2/+2
| | | | | | | | Notes: svn path=/head/; revision=254700
* | Remove meaningless self-assignment in res_send.c, otherwise clang willDimitry Andric2011-12-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | warn about it. I guess this was originally done to silence a bogus warning by an older version of gcc, but I could not reproduce it with any version of gcc that I have access to. MFC after: 1 week Notes: svn path=/head/; revision=228537
* | Add an option to enforce strict RFC 1034 compliance.Xin LI2009-05-291-0/+4
| | | | | | | | | | | | | | PR: kern/129477 Notes: svn path=/head/; revision=193023
* | Merge the resolver part of BIND 9.4.3 into HEAD.Hajimu UMEMOTO2008-12-144-24/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | It includes the following fix: 2426. [bug] libbind: inet_net_pton() can sometimes return the wrong value if excessively large netmasks are supplied. [RT #18512] Reported by: Maksymilian Arciemowicz <cxib__at__securityreason.com> Notes: svn path=/head/; revision=186090
* | Allow underscore in domain names while resolving. While having underscoreXin LI2008-02-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | is a violation of RFC 1034 [STD 13], it is accepted by certain name servers as well as other popular operating systems' resolver library. Bugs are mine. Obtained from: ume MFC after: 2 weeks Notes: svn path=/head/; revision=176325