about summary refs log tree commit diff
path: root/sysdeps/posix/getaddrinfo.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix qsort_r namespace (bug 17571).Joseph Myers2014-11-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | qsort_r is defined in the same file as qsort, but is not an ISO C function, so should be a weak alias for __qsort_r. The uses in getaddrinfo should also call __qsort_r, since getaddrinfo is a POSIX function and qsort_r isn't. This patch implements this. Because nscd uses the getaddrinfo sources outside libc, as do the tst-rfc3484 tests, a #define of __qsort_r to qsort_r is added there alongside the similar defines for other libc-internal symbols used in getaddrinfo. Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #17571] * stdlib/msort.c (qsort_r): Rename to __qsort_r and define as weak alias of __qsort_r. (qsort): Call __qsort_r instead of qsort_r. * include/stdlib.h (qsort_r): Do not call libc_hidden_proto. (__qsort_r): Declare. Call libc_hidden_proto. * sysdeps/posix/getaddrinfo.c (getaddrinfo): Call __qsort_r instead of qsort_r. * nscd/gai.c (__qsort_r): Define to qsort_r. * posix/tst-rfc3484.c (__qsort_r): Likewise. * posix/tst-rfc3484-2.c (__qsort_r): Likewise. * posix/tst-rfc3484-3.c (__qsort_r): Likewise.
* Return EAI_AGAIN for AF_UNSPEC when herrno is TRY_AGAIN (BZ #16849)Siddhesh Poyarekar2014-05-151-2/+1
| | | | | | | | | | getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6 queries. For AF_UNSPEC however, an older change (a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to that the returned error was EAI_NONAME. This patch fixes the check so that a non-authoritative not-found is returned as EAI_AGAIN to the user instead of EAI_NONAME.
* Fix parsing of getai result from nscd for IPv6-only requestAndreas Schwab2014-05-071-4/+8
|
* Fix use of half-initialized result in getaddrinfo when using nscd (bug 16743)Andreas Schwab2014-03-241-0/+8
| | | | | | | | | | | | | | | | | | This fixes a bug in the way the results from __nscd_getai are collected: for every returned result a new entry is first added to the gaih_addrtuple list, but if that result doesn't match the request this entry remains uninitialized. So for this non-matching result an extra result with uninitialized content is returned. To reproduce (with nscd running): $ getent ahostsv4 localhost 127.0.0.1 STREAM localhost 127.0.0.1 DGRAM 127.0.0.1 RAW (null) STREAM (null) DGRAM (null) RAW
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-2/+2
|
* Remove redundant GAIH_OKIFUNSPEC and GAIH_EAI.Pavel Simerda2013-12-021-17/+14
| | | | | | | | | | | Only gaih_inet() and gaih_inet_serv() use a special bit flag denoted by the GAIH_OKIFUNSPEC macro. Only the return value of gaih_inet_serv() is actively checked for the bit flag which is redundant because it just copies the nonzero property of the value otherwise returned. The return value of gaih_inet() is only checked for being zero and then the bit flag is filtered out. As the bit flag is set only for otherwise nonzero return values, it doesn't affect the zero comparison. GAIH_EAI just an alias to ~GAIH_OKIFUNSPEC.
* getaddrinfo: remove dead codePavel Simerda2013-12-021-12/+0
|
* Fix stack overflow due to large AF_INET6 requestsSiddhesh Poyarekar2013-10-251-2/+18
| | | | | | | | Resolves #16072 (CVE-2013-4458). This patch fixes another stack overflow in getaddrinfo when it is called with AF_INET6. The AF_UNSPEC case was fixed as CVE-2013-1914, but the AF_INET6 case went undetected back then.
* Fix incorrect getaddrinfo assertion triggerAllan McRae2013-10-251-3/+10
| | | | | | | | | | | | | | | | | | | [BZ #9954] With the following /etc/hosts: 127.0.0.1 www.my-domain.es 127.0.1.1 www.my-domain.es 192.168.0.1 www.my-domain.es Using getaddrinfo() on www.my-domain.es, trigger the following assertion: ../sysdeps/posix/getaddrinfo.c:1473: rfc3484_sort: Assertion `src->results[i].native == -1 || src->results[i].native == a1_native' failed. This is due to two different bugs: - In rfc3484_sort() rule 7, src->results[i].native is assigned even if src->results[i].index is -1, meaning that no interface is associated. - In getaddrinfo() the source IP address used with the lo interface needs a special case, as it can be any IP within 127.X.Y.Z.
* Don't use gethostbyaddr to determine canonical nameAndreas Schwab2013-10-171-78/+11
|
* Properly cache the result from looking up the nss database configAndreas Schwab2013-09-301-8/+6
|
* Use __glibc_unlikely instead of __builtin_expect (..., 0)Siddhesh Poyarekar2013-08-281-1/+1
|
* Set EAI_SYSTEM only when h_errno is NETDB_INTERNALSiddhesh Poyarekar2013-05-211-2/+10
| | | | | | | | | | | | Fixes BZ #15339. NSS_STATUS_UNAVAIL may mean that a necessary input resource is not available. This could occur in a number of cases including when the network is down, system runs out of file descriptors, etc. The correct differentiator in such a case is the h_errno, which gives the nature of failure. In case of failures other than a simple 'not found', we set h_errno as NETDB_INTERNAL and let errno be the identifier for the exact error.
* Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold2013-05-161-0/+1
|
* Minor cleanup in getaddrinfoSiddhesh Poyarekar2013-04-221-3/+4
| | | | | Replace repeated computations of alloca size with a local variable that stores the computed value.
* Fix stack overflow in getaddrinfo with many resultsAndreas Schwab2013-04-031-2/+21
|
* Return EAI_SYSTEM if we're out of file descriptorsSiddhesh Poyarekar2012-11-191-0/+6
| | | | Resolves BZ #14719.
* Suppress incorrect link warnings for NSS symbolsChris Metcalf2012-10-301-1/+1
| | | | | | | | | When glibc is built with --enable-static-nss, the warning that using NSS symbols requires the nss shared objects to be present is no longer true, as those symbols are built into libc. Suppress the warning for those symbols by providing a new macro (nss_interface_function) for the NSS functions that is defined as static_link_warning in the normal case, and empty for static NSS.
* [BZ #11438]Jeff Law2012-09-281-4/+0
| | | | | | | | | * sysdeps/posix/getaddrinfo.c (default_scopes): Map RFC 1918 * addresses to global scope. * posix/tst-rfc3484.c: Verify 10/8, 172.16/12 and 196.128/16 addresses are in the same scope as 192.0.2/24. * posix/gai.conf: Document new scope table defaults.
* * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use gethostbyname4_rJeff Law2012-08-221-2/+7
| | | | if the family is PF_UNSPEC.
* Fix typo in last change.Roland McGrath2012-08-171-1/+1
|
* Fix getaddrinfo for [!_STATBUF_ST_NSEC] case.Roland McGrath2012-08-171-2/+35
|
* Avoid duplicate DNS requests if answer is longer than a implementationJeroen van Bemmel2012-07-121-3/+7
| | | | | | | | | | | | | | | | limit [BZ #14307] * sysdeps/posix/getaddrinfo.c (gaih_inet): Increase the size of the temporary buffer used to invoke __gethostbyname2_r, __gethostbyaddr_r and gethostbyname4_r to make room for struct host_data / struct gaih_addrtuple. * resolv/nss_dns/dns-host.c (global scope): Move definition of implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS to header file nss/nsswitch.h. * nss/nsswitch.h (global scope): Add definition of implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS (moved from resolv/nss_dns/dns-host.c).
* Hurd: libc_once_getThomas Schwinge2012-05-101-1/+1
|
* Clean up internal fopen usesUlrich Drepper2011-11-151-1/+1
| | | | No need to ever not use c and e.
* Cache network interface informationUlrich Drepper2011-10-311-5/+5
| | | | | | | | | | | | Whenever getaddrinfo needed network interface information it used the netlink interface to read the information every single time. The problem is that this information can change at any time. The patch implements monitoring of the network interfaces through nscd. If no change is detected the previously read information can be reused (which is the norm). This timestamp information is also made available to other processes using the shared memory segment between nscd and those processes.
* Fix encoding name for IDN in getaddrinfoAndreas Schwab2011-08-041-1/+4
|
* Make sure RES_USE_INET6 is always restoredAndreas Schwab2011-06-301-0/+4
|
* Avoid __check_pf calls in getaddrinfo unless really neededUlrich Drepper2011-06-221-5/+12
|
* Fix Ipv4&IPv6 lookup in getaddrinfoAndreas Schwab2011-06-221-1/+1
| | | | Problem introduced in the last patch.
* Fix IPv6-only lookups through getaddrinfoUlrich Drepper2011-06-211-3/+31
| | | | | A recent patch introduced a problem where IPv6 lookups happily returned IPv4 addresses.
* Minor optimization of getaddrinfo after recent patchUlrich Drepper2011-06-211-14/+4
|
* Fix memory leak in getaddrinfoUlrich Drepper2011-06-131-1/+1
|
* Restore _res correctlyUlrich Drepper2011-05-291-2/+2
| | | | | | getaddrinfo works around the resolver functionality to avoid automatic IPv6 lookups. The restoring didn't allow for the resolver to set additional bits in _res.
* Don't unconditionally use alloca in gaih_inetUlrich Drepper2011-05-201-91/+342
|
* getaddrinfo(AF_INET6) does not return scope_id info provided by NSS modulesMaciej Babinski2011-05-021-45/+28
|
* Fix decoding of canonical name in getaddrinfo.Ulrich Drepper2011-01-191-0/+1
|
* Add self-contained test for NSS.Ulrich Drepper2010-08-111-1/+2
| | | | | While at it fix interaction between __nss_configure_lookup and nscd. Otherwise the test fails if nscd is runnung.
* Fix one case of last checkin.Ulrich Drepper2010-03-261-0/+1
| | | | If the v4 lookup failed but v6 succeeded we treat this as a success.
* Don't abort immediately on successful lookup in getaddrinfo.Ulrich Drepper2010-03-261-10/+10
| | | | | | | When not using gethostbyname4 methods we immediately aborted the loop over the nss modules on the first successful lookup. While this is almost always what is wanted the nsswitch.conf file allows to select something different.
* Fix spurious UNAVAIL status is getaddrinfoAndreas Schwab2010-03-261-0/+1
|
* Fix a few error cases in *name4_r lookup handling.Ulrich Drepper2009-12-101-7/+2
|
* Handle missing NSS modules and those without callbacks.Ulrich Drepper2009-07-251-0/+2
| | | | | getaddrinfo didn't update the status variable in that round of the loop if no callback was used.
* * sysdeps/posix/getaddrinfo.c (gaih_inet): When theUlrich Drepper2008-12-291-0/+2
| | | | gethostbyname4_r function call succeeded, just leave the loop.
* * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): RecognizeUlrich Drepper2008-12-031-0/+2
| | | | | | | | | 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.
* * sysdeps/posix/getaddrinfo.c (getaddrinfo): Only restrict searchUlrich Drepper2008-11-271-7/+1
| | | | to IPv4 or IPv6 if an interface has been found.
* * sysdeps/posix/getaddrinfo.c (getaddrinfo): If the system hasUlrich Drepper2008-11-271-0/+6
| | | | neither IPv4 nor IPv6 addresses defined, don't do anything.
* * sysdeps/posix/getaddrinfo.c (gaih_inet): Raise size of initialUlrich Drepper2008-07-301-1/+1
| | | | buffer passed to NSS functions.
* * sysdeps/posix/getaddrinfo.c: Move _res_hconf_init call to aUlrich Drepper2008-06-131-21/+9
| | | | better place so it is not called when nscd is used.
* * sysdeps/posix/getaddrinfo.c (gaih_inet): If nscd reports noUlrich Drepper2008-05-171-1/+4
| | | | entry is available, believe it.