aboutsummaryrefslogtreecommitdiff
path: root/resolv/res_init.c
AgeCommit message (Collapse)Author
2017-06-19resolv: Use getline for configuration file reading in res_vinit_1Florian Weimer
2017-06-19resolv: Report allocation errors in __res_vinitFlorian Weimer
2017-06-19resolv: Reformat res_vinit and related functions to GNU styleFlorian Weimer
Also remove some obsolete comments.
2017-06-19resolv: Introduce is_sort_mask and call it from res_vinitFlorian Weimer
2017-06-19resolv: Remove DEBUG preprocessor conditionals from res_setoptionsFlorian Weimer
2017-06-19resolv: Move _res deallocation functions to their own fileFlorian Weimer
2017-06-19resolv: Move res_randomid to its own fileFlorian Weimer
2017-06-19resolv: Make __res_vinit hiddenFlorian Weimer
And remove unnecessary separate declarations.
2017-04-19resolv: Replace __builtin_expect with __glibc_unlikely/__glibc_likelyFlorian Weimer
2016-12-31resolv: Deprecate the "inet6" option and RES_USE_INET6 [BZ #19582]Florian Weimer
2016-10-07resolv: Remove RES_USEBSTRING and its implementation [BZ #20629]Florian Weimer
In ns_name_ntop, the NS_CMPRSFLGS check is no longer needed because labellen (called earlier) already rejects everything which is not a plain label (compression references and extended label types).
2016-10-07resolv: Remove RES_NOIP6DOTINT and its implementationFlorian Weimer
2016-10-07resolv: Deprecate unimplemented flagsFlorian Weimer
RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG result in compile-time warnings. Some of these flags are still used in applications.
2016-09-21resolv: Remove unsupported hook functions from the API [BZ #20016]Florian Weimer
2016-09-15inet: Add __inet6_scopeid_pton function [BZ #20611]Florian Weimer
__inet6_scopeid_pton implements strict validation of numeric scope IDs. Use it in getaddrinfo and __res_vinit.
2016-09-13resolv: Remove _LIBC_REENTRANTFlorian Weimer
2016-04-28resolv: Reindent preprocessor conditionals following cleanupsFlorian Weimer
2016-04-28resolv: Assorted preprocessor cleanupsFlorian Weimer
2016-04-28resolv: Remove RFC1535 conditionalsFlorian Weimer
2016-04-28resolv: Remove RESOLVSORT preprocess conditionalsFlorian Weimer
2016-04-28resolv: Remove _LIBC conditionalsFlorian Weimer
2016-04-28resolv: Remove SCCS and RCS keywordsFlorian Weimer
2016-03-15Fix resource leak in resolver (bug 19257)Andreas Schwab
The number of currently defined nameservers is stored in ->nscount, whereas ->_u._ext.nscount is set by __libc_res_nsend only after local initializations.
2016-02-19res_ninit: Update commentFlorian Weimer
Since commit e66e7419a6f58200eec6941b14e2dcff9875cc6c (Actually make it possible to user the default name server.), the default is INADDR_LOOPBACK, not INADDR_ANY.
2015-12-29resolv: Reset defdname before use in __res_vinit [BZ #19369]Rob Wu
Resetting defdname (default domain name) before use in __res_vinit ensures that the default domain name is correctly set to a default value when it is not set by the LOCALDOMAIN environment variable or the "domain" or "search" parameters in resolv.conf Tested using the steps from: https://sourceware.org/bugzilla/show_bug.cgi?id=19369
2015-10-21Convert a few more function definitions to prototype style.Joseph Myers
This patch converts a few more function definitions in glibc from old-style K&R to prototype style. This is sufficient to build and test on x86_64 and x86 with -Wold-style-definition (I'll test on some more architectures before proposing the actual addition of -Wold-style-definition). Tested for x86_64 and x86 with -Wold-style-definition in use (testsuite - this patch affects files containing assertions). * io/fts.c (fts_open): Convert to prototype-style function definition. * malloc/mcheck.c (mcheck): Likewise. (mcheck_pedantic): Likewise. * posix/regexec.c (re_search_2_stub): Likewise. Use internal_function. (re_search_internal): Likewise. * resolv/res_init.c [RESOLVSORT] (net_mask): Convert to prototype-style function definition. * sunrpc/clnt_udp.c (clntudp_call): Likewise. * sunrpc/pmap_rmt.c (clnt_broadcast): Likewise. * sunrpc/rpcsvc/rusers.x (xdr_utmp): Likewise. (xdr_utmpptr): Likewise. (xdr_utmparr): Likewise. (xdr_utmpidle): Likewise. (xdr_utmpidleptr): Likewise. (xdr_utmpidlearr): Likewise.
2015-05-21Simplify handling of nameserver configuration in resolverAndreas Schwab
Remove use of ext.nsmap member of struct __res_state and always use an identity mapping betwen the nsaddr_list array and the ext.nsaddrs array. The fact that a nameserver has an IPv6 address is signalled by setting nsaddr_list[].sin_family to zero.
2015-01-06resolv: fix rotate optionAurelien Jarno
The rotate option doesn't work correctly, and only send the query to the same server (the second in the list). The rotation code in itself is not broken, but the nsaddrs structure is reinitialized each time at the beginning of __libc_res_nsend unless RES_STAYOPEN is enabled. This is due to a call to __res_iclose from the end of __libc_res_nsend when answers from the name server have been received. This function closes all the sockets, but doesn't free the addresses (it can do that, but in that case the second argument is false). This patch change the code of __res_iclose to clear statp->_u._ext.nsinit only when the addresses are actually freed. * resolv/res_init.c (__res_iclose): Only clear nsinit if the addresses have been freed.
2015-01-06resolv: improve comments about nserv and nservallAurelien Jarno
The current comments concerning nserv and nservall are not really clear and lead to confusion when reviewing an already complex code. Improve them, there real meaning have been confirmed by a code analysis. * resolv/res_init.c (__res_vinit): Improve comments about nserv and nservall.
2014-12-17Fix resolver inet_* namespace (bug 17722).Joseph Myers
Parts of the resolver brought in by pthreads (at least) use inet_* functions that aren't in the 1995/6 edition of POSIX that introduced pthreads (or in one case, use __inet_aton which is then defined in the same file as non-weak inet_addr). This patch fixes this by making the affected functions into weak alias for __inet_* and using those names in the problematic resolver code. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #17722] * inet/inet_mkadr.c (inet_makeaddr): Rename to __inet_makeaddr and define as weak alias of __inet_makeaddr. * resolv/inet_addr.c (inet_addr): Rename to __inet_addr and define as weak alias of __inet_addr. * resolv/inet_pton.c (inet_pton): Rename to __inet_pton and define as weak alias of __inet_pton. Use libc_hidden_weak. * include/arpa/inet.h (__inet_pton): Declare. Use libc_hidden_proto. (inet_makeaddr): Don't use libc_hidden_proto. (__inet_makeaddr): Declare. Use libc_hidden_proto. * resolv/res_init.c (__res_vinit): Use __inet_pton instead of inet_pton. Use __inet_makeaddr instead of inet_makeaddr. * conform/Makefile (test-xfail-POSIX/pthread.h/linknamespace): Remove variable. (test-xfail-POSIX/sched.h/linknamespace): Likewise. (test-xfail-POSIX/time.h/linknamespace): Likewise.
2014-12-16Fix resolver if_* namespace (bug 17717).Joseph Myers
Resolver code, brought in by pthreads (at least), uses if_* interfaces that weren't in POSIX before 2001, resulting in linknamespace failures. This patch changes those interfaces to be weak aliases of __if_* and makes the resolver use __if_* directly. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by this patch). [BZ #17717] * inet/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. * sysdeps/mach/hurd/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. * sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Rename to __if_nametoindex and define as weak alias of __if_nametoindex. Use libc_hidden_weak. (if_freenameindex): Rename to __if_freenameindex and define as weak alias of __if_freenameindex. Use libc_hidden_weak. (if_nameindex_netlink): Use __if_freenameindex instead of if_freenameindex. (if_nameindex): Rename to __if_nameindex and define as weak alias of __if_nameindex. Use libc_hidden_weak. (if_indextoname): Rename to __if_indextoname and define as weak alias of __if_indextoname. Use libc_hidden_weak. * include/net/if.h [!_ISOMAC] (__if_nametoindex): Declare and use libc_hidden_proto. [!_ISOMAC] (__if_freenameindex): Likewise. * resolv/res_init.c (__res_vinit): Use __if_nametoindex instead of if_nametoindex. * conform/Makefile (test-xfail-XPG4/grp.h/linknamespace): Remove variable. (test-xfail-XPG4/pwd.h/linknamespace): Likewise. (test-xfail-UNIX98/aio.h/linknamespace): Likewise. (test-xfail-UNIX98/grp.h/linknamespace): Likewise. (test-xfail-UNIX98/pthread.h/linknamespace): Likewise. (test-xfail-UNIX98/pwd.h/linknamespace): Likewise. (test-xfail-UNIX98/sched.h/linknamespace): Likewise. (test-xfail-UNIX98/time.h/linknamespace): Likewise.
2014-12-02Fix fgets_unlocked namespace issues (bug 17664).Joseph Myers
Various POSIX functions bring in res_init.o, res_hconf.o or mntent_r.o, which use fgets_unlocked, which is not a POSIX function. This patch arranges for them to use __fgets_unlocked instead. (The IS_IN (libc) conditional in rec_hconf.c is needed because that file is also used in nscd.) Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch except for an assertion line number). Note that most of the linknamespace tests that failed because of fgets_unlocked from the resolver also fail because of other symbols brought in by the resolver, so the number of XFAILs this removes is limited. Also note that fgets_unlocked failures for unistd.h for XPG3/XPG4 showed up that actually unistd.h is declaring too much for XPG3/XPG4 (bug 17665) - there is no actual need to make getusershell.c use __fgets_unlocked (at least as regards formal standards are concerned; maybe it should still change for namespace-cleanness of _DEFAULT_SOURCE) because the functions there aren't actually in any of the supported standards; the correct fix for those failures will be to stop the *usershell* functions appearing in unistd.h for XPG3/XPG4. [BZ #17664] * misc/mntent_r.c (__getmntent_r): Use __fgets_unlocked instead of fgets_unlocked. * resolv/res_hconf.c [IS_IN (libc)] (fgets_unlocked): Define to __fgets_unlocked. * resolv/res_init.c (__res_vinit): Use __fgets_unlocked instead of fgets_unlocked. * conform/Makefile (test-xfail-XPG4/sys/statvfs.h/linknamespace): Remove variable. (test-xfail-POSIX/sys/mman.h/linknamespace): Likewise. (test-xfail-UNIX98/sys/mman.h/linknamespace): Likewise. (test-xfail-UNIX98/sys/statvfs.h/linknamespace): Likewise. (test-xfail-XOPEN2K/sys/mman.h/linknamespace): Likewise. (test-xfail-XOPEN2K/sys/statvfs.h/linknamespace): Likewise. (test-xfail-POSIX2008/sys/mman.h/linknamespace): Likewise. (test-xfail-POSIX2008/sys/statvfs.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/sys/mman.h/linknamespace): Likewise. (test-xfail-XOPEN2K8/sys/statvfs.h/linknamespace): Likewise.
2014-02-10Use glibc_likely instead __builtin_expect.Ondřej Bílka
2013-06-07Avoid use of "register" as optimization hint.Joseph Myers
2013-05-16Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold
2011-12-17Open /etc/resolv.conf with FD_CLOEXECRoss Lagerwall
2011-08-04Properly tokenize nameserver line for servers with IPv6 addressAndreas Schwab
2011-05-29Make resolv.conf parsing more compactUlrich Drepper
2011-05-29Recognize use-vc option in resolv.confUlrich Drepper
2011-05-07Backport BIND code to query name as TLD.Ulrich Drepper
2010-09-14Actually make it possible to user the default name server.Ulrich Drepper
2010-08-25Missing server address again leads to localhost being usedUlrich Drepper
2009-06-26Implement second fallback mode for DNS requests.Ulrich Drepper
There is some more shardware/software out there which has problems if two DNS requests are sent using the same tuple (source addr, source port, dest addr, dest port) This can range from firewalls to load balancers. Some of the vendors already fixed it in response to this problem. Still, we need a way to make glibc work with broken environments. The single-request-reopen flag can be used or we fall back automatically to this mode.
2009-04-07* resolv/resolv.h (RES_SNGLKUP): Define.cvs/fedora-glibc-20090407T0545Ulrich Drepper
* resolv/res_init.c (res_setoptions): Recognize single-request option. * resolv/res_send.c (send_dg): If we sent two requests at once and only get one reply before timeout switch to mode where we send the second request only after the first answer has been received.
2008-12-29* resolv/res_init.c (__res_vinit): Count all servers in statp->nscount.Ulrich Drepper
2008-12-08* resolv/res_init.c (__res_vinit): Always assign to statp->nscountUlrich Drepper
after reading name server list.
2008-12-03* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): RecognizeUlrich Drepper
ESRCH return value. (_nss_dns_gethostbyname4_r): Likewise. * resolv/res_init.c (__res_vinit): Initialize nscount to zero. * sysdeps/posix/getaddrinfo.c (gaih_inet): In case we use gethostbyname4_r, we don't have a separate IPv6 status, so copy the no_data variable.
2008-12-03* resolv/res_init.c (__res_vinit): Fill in IPv4 name serverUlrich Drepper
information at the correct index.
2008-04-07Handle scope IDs in resolv.conf.Ulrich Drepper
2007-06-18[BZ #4647]Ulrich Drepper
Tomas Janousek <tjanouse@redhat.com> Ulrich Drepper <drepper@redhat.com> [BZ #4647] * resolv/res_send.c (send_dg): Remove socket_pf. Use ipv6_unavail member in __res_state, only convaddr4to6 if nssocks[ns] is a PF_INET6 socket. * resolv/resolv.h (__res_state): Add ipv6_unavail member. Make unused member a bitmap. * resolv/res_init.c (__res_vinit): Reset ipv6_unavail if IPv6 servers are configured. 2007-06-18 Jakub Jelinek <jakub@redhat.com>