summaryrefslogtreecommitdiff
path: root/lib/libc/net/getaddrinfo.c
Commit message (Collapse)AuthorAgeFilesLines
* Copy releng/7.3 to release/7.3.0 to mark 7.3-RELEASE.release/7.3.0_cvsKen Smith2010-03-211-1/+1
| | | | | | Approved by: re (implicit) This commit was manufactured to restore the state of the 7.3-RELEASE image.
* MFH r190382,190416,190525:Hajimu UMEMOTO2009-04-121-90/+197
| | | | | | | | | | | | | | | | | | - getaddrinfo(3) should accept numeric when ai_socktype is not specified in hint or hints is NULL. - Add support for SCTP to getaddrinfo(3). Now, getaddrinfo(3) returns two SOCK_STREAMs, IPPROTO_TCP and IPPROTO_SCTP. It confuses some programs. If getaddrinfo(3) returns IPPROTO_SCTP when SOCK_STREAM is specified by hints.ai_socktype, at least Apache doesn't work. So, I made getaddrinfo(3) to return IPPROTO_SCTP with SOCK_STREAM only when IPPROTO_SCTP is specified explicitly by hints.ai_protocol. - Query DNS only once per an address family. Approved by: re (kib) Notes: svn path=/stable/7/; revision=190972
* MFH 188316: Shutup warning for DNAME RR.Hajimu UMEMOTO2009-02-161-1/+2
| | | | | | | | PR: bin/127591 Submitted by: "Eugene M. Kim" <20080111.freebsd.org__at__ab.ote.we.lv> Notes: svn path=/stable/7/; revision=188690
* ensure the head entry of addrinfo chain has non-NULL ai_canonname to beJINMEI Tatuya2007-09-051-2/+19
| | | | | | | | | | | | compliant with RFC3493. PR: standards/114910 Approved by: ume (mentor) Approved by: re MFC after: 1 week Notes: svn path=/head/; revision=172052
* do not overload the port number on to the return value ofHajimu UMEMOTO2006-07-231-8/+9
| | | | | | | | | | str2number(). this could result in an unexpected code path. Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=160593
* remove obsolete comments.Hajimu UMEMOTO2006-07-221-8/+0
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=160577
* simplification in explore_numeric: unified the post-process withHajimu UMEMOTO2006-07-211-32/+22
| | | | | | | | | | GET_AI and GET_PORT. Commented on an impossible case. Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=160553
* RFC3493 requires use of inet_aton for AF_INET.Hajimu UMEMOTO2006-07-211-3/+7
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=160552
* clean-up: rewrote explore_null and explore_numeric without using sentinel.Hajimu UMEMOTO2006-07-211-35/+20
| | | | | | | | | | | we do not need it since we make (at most) a single addrinfo entry in these cases. Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=160551
* - Extend the nsswitch to support Services, Protocols and RpcHajimu UMEMOTO2006-04-281-0/+197
| | | | | | | | | | | databases. - Make nsswitch support caching. Submitted by: Michael Bushkov <bushman__at__rsu.ru> Sponsored by: Google Summer of Code 2005 Notes: svn path=/head/; revision=158115
* fix indent.Hajimu UMEMOTO2006-04-011-9/+9
| | | | Notes: svn path=/head/; revision=157371
* If the query choked with EDNS0, retry without EDNS0.Hajimu UMEMOTO2006-03-281-8/+24
| | | | | | | Obtained from: res_nquery() of BIND9. Notes: svn path=/head/; revision=157203
* - Use ANSI C prototype.Hajimu UMEMOTO2006-03-251-104/+38
| | | | | | | - Remove trailing space. Notes: svn path=/head/; revision=157119
* When res_nquerydomain() returns SERVFAIL, we should try next domain.Hajimu UMEMOTO2006-03-241-1/+9
| | | | Notes: svn path=/head/; revision=157093
* When res_send() fails, we should reserve an error code.Hajimu UMEMOTO2006-03-241-2/+2
| | | | Notes: svn path=/head/; revision=157081
* Update the resolver in libc to BIND9's one.Hajimu UMEMOTO2006-03-211-75/+83
| | | | | | | | | | | | | | | | | | | | | | | | | Since, res_sendsigned(3) and the friends use MD5 functions, it is hard to include them without having MD5 functions in libc. So, res_sendsigned(3) is not merged into libc. Since, res_update(3) in BIND9 is not binary compatible with our res_update(3), res_update(3) is leaved as is, except some necessary modifications. The res_update(3) and the friends are not essential part of the resolver. They are not defined in resolv.h but defined in res_update.h separately in BIND9. Further, they are not called from our tree. So, I hide them from our resolv.h, but leave them only for binary backward compatibility (perhaps, no one calls them). Since, struct __res_state_ext is not exposed in BIND9, I hide it from our resolv.h. And, global variable _res_ext is removed. It breaks binary backward compatibility. But, since it is not used from outside of our libc, I think it is safe. Reviewed by: arch@ (no objection) Notes: svn path=/head/; revision=156960
* When we are doing initialization against q, use its own size, notXin LI2006-03-211-1/+1
| | | | | | | | | | the size of q2. This should be a no-op because q and q2 are of the same type. Submitted by: Alexey Dobriyan <adobriyan gmail com> Notes: svn path=/head/; revision=156946
* Handle the errors returned by res_querydomain() in same manner.Hajimu UMEMOTO2006-03-011-0/+20
| | | | | | | | | Reported by: yar Tested by: yar, Rostislav Krasny <rosti.bsd__at__gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=156155
* - Just query 'as is', if there is a trailing dot in the name.Hajimu UMEMOTO2006-02-241-9/+20
| | | | | | | | | | | | | - Don't query 'as is' twice. PR: bin/62139 Reported by: Rostislav Krasny <rosti.bsd__at__gmail.com> Tested by: Rostislav Krasny <rosti.bsd__at__gmail.com> Obtained from: BIND9 (with some modification) MFC after: 1 week Notes: svn path=/head/; revision=155983
* Remove padding for ABI compatibility of ai_addrlen memberHajimu UMEMOTO2005-07-221-3/+0
| | | | | | | | from struct addrinfo. This change break ABI compatibility on 64 bit arch. Notes: svn path=/head/; revision=148308
* - The ai_addrlen of a struct addrinfo used to be a size_t, perHajimu UMEMOTO2005-05-151-1/+4
| | | | | | | | | | | | | | | | | | | RFC 2553. In XNS5.2, and subsequently in POSIX-2001 and RFC 3493, it was changed to a socklen_t. And, the n_net of a struct netent used to be an unsigned long integer. In XNS5, and subsequently in POSIX-2001, it was changed to an uint32_t. To accomodate for this while preserving ABI compatibility with the old interface, we need to prepend or append 32 bits of padding, depending on the (LP64) architecture's endianness. - Correct 1st argument of getnetbyaddr() to uint32_t on 32 bit arch. Stay as is on 64 bit arch for ABI backward compatibility for now. Reviewed by: das, peter MFC after: 2 weeks Notes: svn path=/head/; revision=146244
* Submitted by: Jinmei Tatuya, Hajimu UmemotoGeorge V. Neville-Neil2005-05-141-2/+2
| | | | | | | | | | | | | Reviewed by: rwatson at freebsd dot org Approved by: rwatson at freebsd dot org MFC after: 1 week Fix the matchlen() function so that it handles the IPv4 (AF_INET) case correctly. Until now it has been treating IPv4 addresses as if they were IPv6 which could lead to corruption errors. Notes: svn path=/head/; revision=146222
* free ypbuf only when yp_match() succeed.Hajimu UMEMOTO2005-05-131-1/+1
| | | | Notes: svn path=/head/; revision=146190
* the 3rd argument of getsockname() should be socklen_t*.Hajimu UMEMOTO2005-05-021-1/+2
| | | | | | | Submitted by: stefanf Notes: svn path=/head/; revision=145786
* Now, our getservbyname(3) is thread-safe. So, we don't needHajimu UMEMOTO2005-04-151-14/+1
| | | | | | | to protect it with mutex lock. Notes: svn path=/head/; revision=145118
* hostalias() is not thread-safe. So, introduce _res_hostalias()Hajimu UMEMOTO2005-04-151-2/+3
| | | | | | | | | and use it. Obtained from: BIND9 Notes: svn path=/head/; revision=145113
* remove needless res_init() call.Hajimu UMEMOTO2005-04-141-9/+0
| | | | | | | Inspired by: NetBSD Notes: svn path=/head/; revision=145066
* - we are no longer shareing any resources to be locked betweenHajimu UMEMOTO2005-04-061-10/+6
| | | | | | | | | getaddrinfo(3) and getipnodeby*(3). - use definitions in reentrant.h. - remove obsolete comment. Notes: svn path=/head/; revision=144715
* separate gai_strerror(3) from getaddrinfo.c.Hajimu UMEMOTO2005-04-061-27/+0
| | | | | | | Requested by: phantom Notes: svn path=/head/; revision=144708
* make yp stuff re-entrant.Hajimu UMEMOTO2005-04-051-26/+15
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=144679
* make _files_getaddrinfo() re-entrant.Hajimu UMEMOTO2005-04-041-22/+19
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=144634
* . Convert return type of gai_strerror() to 'const char *' as POSIX requires.Alexey Zelkin2005-02-141-29/+21
| | | | | | | | . Convert ai_errlist[] to simple 'char *' array, and appropriately optimize gai_strerror() Notes: svn path=/head/; revision=141908
* use strdup().Hajimu UMEMOTO2005-01-281-2/+1
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=140947
* implement AI_NUMERICSERV (as defined in RFC3493).Hajimu UMEMOTO2005-01-271-10/+13
| | | | | | | | Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=140908
* fill ai_canonname field for numeric hostname, by the given hostname.Hajimu UMEMOTO2005-01-271-7/+25
| | | | | | | | | | follow new recommendation in RFC3493. Obtained from: KAME MFC after: 1 week Notes: svn path=/head/; revision=140906
* query A RR before AAAA RR.Hajimu UMEMOTO2005-01-271-10/+10
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=140896
* Don't ignore the last line of config file (/etc/hosts, /etc/services, etc)Maxim Sobolev2005-01-031-3/+3
| | | | | | | | | | | which doesn't end in \n, since it may be very confusing. Also this should increase consistency, since most other config files work just fine regardless of the presence of traling \n in the last line. MFC After: 2 weeks Notes: svn path=/head/; revision=139612
* Rename variable name from `name' to `hostname'.Hajimu UMEMOTO2004-06-161-7/+7
| | | | | | | | | | | | | This is a corresponding change to bin/67994. I'll soon commit bin/67994 into 4-STABLE. Actually, 5-CURRENT's getaddrinfo() doesn't have the problem mentiond in bin/67994. However, it is good to be in sync variable name with 4-STABLE and KAME. PR: bin/67994 Submitted by: JINMEI Tatuya <jinmei@ocean.jinmei.org> Notes: svn path=/head/; revision=130600
* Treat IPv4 private address as global scope rather than site scope.Hajimu UMEMOTO2004-05-311-1/+1
| | | | | | | | Though it breaks RFC 3484, without this change, dest addr selection doesn't work well under NAT environment. Notes: svn path=/head/; revision=129905
* use source address as a hint to determine destination address.Hajimu UMEMOTO2004-05-311-0/+111
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=129901
* Make the resolver(3) and many associated interfaces much more reentrant.Brian Feldman2004-02-251-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now with what should be totally reentrant, and h_errno values will now be preserved correctly, but this does not affect interfaces such as gethostbyname(3) which are still mostly non-reentrant. In all of these relevant functions, the thread-safety has been pushed down as far as it seems possible right now. This means that operations that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected still under global locks that getaddrinfo(3) defines, but where possible the locking is greatly reduced. The most noticeable improvement is that multiple DNS lookups can now be run at the same time, and this shows major improvement in performance of DNS-lookup threaded programs, and solves the "Mozilla tab serialization" problem. No single-threaded applications need to be recompiled. Multi-threaded applications that reference "_res" to change resolver(3) options will need to be recompiled, and ones which reference "h_errno" will also if they desire the correct h_errno values. If the applications already understood that _res and h_errno were not thread-safe and had their own locking, they will see no performance improvement but will not actually break in any way. Please note that when NSS modules are used, or when nsdispatch(3) defaults to adding any lookups of its own to the individual libc _nsdispatch() calls, those MUST be reentrant as well. Notes: svn path=/head/; revision=126243
* add destination address selection described in RFC3484.Hajimu UMEMOTO2003-10-301-7/+412
| | | | | | | | | | | | in KAME implementation, even when no policy is installed into kernel, getaddrinfo(3) sorts addresses. Since it causes POLA violation, I modified to don't sort addresses when no policy is installed into kernel, Obtained from: KAME Notes: svn path=/head/; revision=121747
* oops, revert previous change to getaddrinfo.c. This is not relatedHajimu UMEMOTO2003-10-241-275/+155
| | | | | | | | to RFC3493. The previous change was related to RFC3484 (Default Address Selection for IPv6), and it will come later. Notes: svn path=/head/; revision=121474
* Switch Advanced Sockets API for IPv6 from RFC2292 to RFC3542Hajimu UMEMOTO2003-10-241-155/+275
| | | | | | | | | | | | | (aka RFC2292bis). Though I believe this commit doesn't break backward compatibility againt existing binaries, it breaks backward compatibility of API. Now, the applications which use Advanced Sockets API such as telnet, ping6, mld6query and traceroute6 use RFC3542 API. Obtained from: KAME Notes: svn path=/head/; revision=121472
* reorder functions to be in sync with KAME.Hajimu UMEMOTO2003-10-231-128/+132
| | | | Notes: svn path=/head/; revision=121426
* EAI_ADDRFAMILY and EAI_NODATA was deprecated in RFC3493Hajimu UMEMOTO2003-10-231-10/+4
| | | | | | | | | | | (aka RFC2553bis). Now, getaddrinfo(3) returns EAI_NONAME instead of EAI_NODATA. Our getaddrinfo(3) nor getnameinfo(3) didn't use EAI_ADDRFAMILY. Obtained from: KAME Notes: svn path=/head/; revision=121425
* oops, gai_strerror must return default value when error codeHajimu UMEMOTO2003-10-221-0/+1
| | | | | | | isn't found in ai_errlist. Notes: svn path=/head/; revision=121348
* make ai_errlist struct. this is preparation for RFC3493Hajimu UMEMOTO2003-10-221-19/+32
| | | | | | | | | (EAI_NODATA is depricated). Obtained from: KAME Notes: svn path=/head/; revision=121347
* Replace use of a spinlock with a mutex.Daniel Eischen2003-05-041-6/+4
| | | | Notes: svn path=/head/; revision=114681
* Back out the `hiding' of strlcpy and strlcat. Several peopleJacques Vidrine2003-05-011-2/+2
| | | | | | | vocally objected to this safety belt. Notes: svn path=/head/; revision=114443