Home | History | Annotate | Download | only in net
History log of /src/lib/libc/net/getaddrinfo.c
RevisionDateAuthorComments
 1.127  21-Jan-2024  kre Unwrap a line which wasn't wrapped before it had an __UNCONST() added
to it, and now that that is gone again, doesn't need wrapping any more.

That line is now unaltered from what it was 3 revs ago (bit for bit).

NFC.
 1.126  20-Jan-2024  christos Make the first argument of ip6_str2scopeid const, instead of __UNCONST.
Thanks kre@. While here s/u_int32_t/uint32_t/
 1.125  20-Jan-2024  christos Catch up with all the lint warnings since exit on warning was disabled.
Disable 'missing header declaration' and 'nested extern' warnings for now.
 1.124  01-Aug-2023  mrg convert explicit length check before unchecked snprintf() with just a
overflow checked snprintf(). for res_debug.c and res_query.c, convert
from sprintf() to snprintf().

tested scp and rcp fail properly with too-long paths.
tested getaddrinfo fails as expected for too-long domains.
tested dig and ping for similar (res_debug.c/res_query.c).
created a temporary fs with quotas to test edquota with a long EDITOR.
did not test ypserv directly, but it's the same pattern.

avoids GCC 12 snprintf() warnings, and reduces total code size.
 1.123  19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.122  28-Oct-2021  riastradh Fix typo in comment: allows, not alows.

I don't know what an alow is, maybe some cousin of the alot.
Awaiting a nature documentary by Allie Brosh about these perhaps more
elusive beasts.

PR misc/56473, from jschauma
 1.121  27-Oct-2021  nia getaddrinfo(3): malloc + memset -> calloc
 1.120  18-Nov-2020  is Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).
 1.119  13-Dec-2018  dholland branches: 1.119.2;
Adjust English usage in message for EAI_NONAME.
 1.118  13-Dec-2018  dholland Return EAI_NODATA, not EAI_NONAME, for nonexistent hosts.

This causes e.g. "ssh nosuchname" to print "No address associated with
hostname", which is correct, rather than "hostname nor servname
provided, or not known", which is not.
 1.117  28-Dec-2017  christos branches: 1.117.2; 1.117.4;
PR/52837: Michael Kaufmann: getaddrinfo() resolves "127.0.0.1 www.example.com"
to 127.0.0.1. Apply the patch from FreeBSD and explain the rationale.
 1.116  29-Sep-2017  christos PR/52578: Benjamin M. Schwartz: sync the internal copy of res_nquery for
getaddrinfo, with the real version so that we handle EDNS fallback.
 1.115  10-Jan-2017  christos branches: 1.115.6;
KNF, simplify expressions for readability.
 1.114  06-Feb-2016  riastradh branches: 1.114.2;
Avoid shadowing global.
 1.113  14-Dec-2015  christos PR/50552: Kyle Amon: RFC3493 section 6.1 wants us to accept non-dotted-quad
INET4 addresses.
XXX: pullup-7
 1.112  13-Dec-2015  christos Implement the address selection policy; from FreeBSD
 1.111  02-Dec-2015  christos PR/44915: Havard Eidnes:
- Convert NS_NOTFOUND to EAI_NONAME instead
of EAI_NODATA which more inline with what other OS's do.
- Convert NO_DATA to NS_NOTFOUND since there is no equivalent mapping
for nsswitch (perhaps we could add one so what we could recover the exact
error and return EAI_NODATA?)
- If we end up following a CNAME chain that does not find any data return that
instead of internal error.

XXX: pullup-7
 1.110  26-Oct-2015  christos PR/50367: Stefan Schaeckeler: libc resolver library does not resolve host
names with underscores ("_"). According to resolv.conf(5) RES_NOCHECKNAME
is on by default; well, it is and gethostbyname(3) obeys it
(gethnamaddr.c:maybe_ok), but getaddrinfo(3) up till this commit not.
XXX: pullup-7, pullup-6
 1.109  10-Sep-2015  christos namespace protect allocaddrinfo
 1.108  10-Sep-2015  christos mke allocaddrinfo static.
 1.107  09-Sep-2015  ozaki-r Include several libc functions in rump.ping6

We need getaddrinfo, getifaddrs, if_indextoname and if_nametoindex
in addition to getnameinfo.
 1.106  22-Dec-2013  christos branches: 1.106.4; 1.106.6;
this is supposed to be re-entrant, call don't call __hostalias that uses
a static buffer.
 1.105  13-May-2013  christos CVE 1020946: Fix res leak.
 1.104  13-May-2013  christos CVE 1020938: Fix memory leak
 1.103  03-May-2013  christos PR/32373, PR/25827: Add SRV lookup in getaddrinfo(3)
Per DNS-SD (RFC 2782), but only enabled if AI_SRV is set.
 1.102  03-May-2013  christos KNF, whitespace police -- no code changes
 1.101  08-Jun-2012  martin branches: 1.101.2;
Henning Petersen in PR lib/46561: cosmetic change: avoid self assignement.
 1.100  20-Mar-2012  kardel PR pkg/46206
re-establish fqdn lookup when AI_ADDRCONFIG is used in hints
AI_ADDRCONFIG led to fqdn lookup being skipped as the systems didn't
configure any PF_UNSPEC addresses - check was too strict here.
Thnaks to Ryo ONODERA for testing.
 1.99  20-Mar-2012  kardel PR 46206: fix programmed SIGSEGV
more work is needed as tests seem to indicate that name resolution now
does no seem to work (firefox reports Server not found)
thanks to Ryo ONODERA for testing.
 1.98  17-Mar-2012  christos Add AI_ADDRCONFIG, which makes getaddrinfo() return only address with families
that are already configured in the system.
 1.97  13-Mar-2012  christos PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.96  15-Oct-2011  christos branches: 1.96.2; 1.96.4;
close on exec fixes:
- open + fcntl -> open O_CLOEXEC
- configuration database file descriptors that can stay open are now opened
fopen(db, "re")
 1.95  02-Oct-2009  wiz Revert a -> an changes: Adding an 'n' follows pronunciation, not writing.
 1.94  02-Oct-2009  cegger fix grammar: a -> an
 1.93  02-Oct-2009  tsarna Introduce allocaddrinfo(3) to make writing getaddrinfo() nss plugins easier.
Discussed on tech-net.
 1.92  23-Jan-2009  tls Cause getaddrinfo() without socktype specification to work correctly for
numeric addresses. The documentation appears to say this works, and some
other systems support it -- more importantly, why should it _not_ work? If
it does not, getaddrinfo() cannot be used as a general-purpose textual to
binary address conversion utility function; yet it is the only such function
we have in the system, since inet_pton() requires a priori knowledge of the
address family.

This change also causes getaddrinfo() with NULL hint (expressly documented
as working) to work properly for numeric addresses.
 1.91  19-Apr-2008  lukem branches: 1.91.6; 1.91.8;
Add a missing const.
 1.90  29-Jun-2007  christos branches: 1.90.10;
make this compile without INET6 (Scott Ellis)
 1.89  23-Jun-2007  christos Since we are going to be looking for ports many times, use a centralized
servent data structure and pass the stayopen hint.
 1.88  10-May-2007  christos use syslog_r, from OpenBSD
 1.87  15-Oct-2006  christos branches: 1.87.2;
fix incomplete initializers
 1.86  14-Oct-2006  christos memset the whole struct addrinfo, instead of trying to figure out if we
have a pad member or not.
 1.85  19-Jul-2006  christos Call endservent_r. From Hajimu UMEMOTO
 1.84  18-Jul-2006  christos use getservbyname_r.
 1.83  18-Jul-2006  christos Remove comments that do not reflect reality anymore.
 1.82  25-Mar-2006  rpaulo Make macros more readable. No functional change.
 1.81  21-Mar-2006  christos Coverity CID 2363: cur is known not to be NULL.
 1.80  21-Mar-2006  christos Coverity CID 2364: cur is known not to be NULL.
 1.79  21-Mar-2006  christos Coverity CID 2430: cur is known not to be NULL.
 1.78  21-Mar-2006  mjl Correct obvious typo
 1.77  17-Feb-2006  ginsbach Add EAI_OVERFLOW as specified in RFC3493, POSIX and XPG6.
 1.76  13-Feb-2006  ginsbach Fix spelling mistake in comment. From OpenBSD.
 1.75  02-Dec-2005  yamt constify and remove an unnecessary __UNCONST.
 1.74  29-Nov-2005  christos WARNS=4
 1.73  15-Sep-2005  tsarna Rest of fix for PR#31184: getaddrinfo() now honors resolv.conf sortlist
directive for dns answers.

Also, unifdef the RESLVSORT (non-)option sillyness.

Reviewed by christos.
 1.72  27-May-2004  christos make yp stuff re-entrant.
 1.71  23-May-2004  christos centralize res_*init() calls in __res_get_state()
 1.70  21-May-2004  christos Finish bind9 resolver merge.
 1.69  14-Apr-2004  itojun remove prototype decl for removed function
 1.68  14-Apr-2004  itojun remove unused code
 1.67  14-Apr-2004  itojun implement AI_NUMERICSERV (as defined in RFC3493)
 1.66  17-May-2003  itojun bound copies
 1.65  08-May-2003  itojun fill ai_canonname field for numeric hostname, by the given hostname.
folows new recommendation in RFC3493
 1.64  17-Mar-2003  itojun From: "Jason L. Wright" <jason@thought.net>

The man page for getaddrinfo() and RFC2553 says it should return EAI_NONAME
for the case where hostname != NULL, hostname is not a numeric string and
ai_flags has the AI_NUMERICHOST bit set. Instead, it returns EAI_NODATA
for this case. The diff below makes it return EAI_NONAME for this case.

This is why ntpq and ntpdc from ntp-4.1.74 can't resolve hostnames,
but work fine with numeric strings like ::1 or 127.0.0.1.
 1.63  27-Aug-2002  itojun allocate 64K recieve buffer for DNS responses.
 1.62  22-Aug-2002  itojun drop AAAA reply with IPv4 mapped address. sync w/kame
draft-itojun-v6ops-v4mapped-harmful-00.txt
 1.61  01-Jul-2002  itojun pacify lint. from he@netbsd
 1.60  01-Jul-2002  itojun lint clean. from martin husemann
 1.59  01-Jul-2002  itojun make more pedantic check on strtoul. from deraadt, sync w/kame
 1.58  29-Jun-2002  itojun correct port range check. from deraadt, sync w/kame, diff sent to bind-bugs
 1.57  27-Jun-2002  itojun correct %d/%u mixup.
 1.56  26-Jun-2002  itojun correct bad practice in the code - it uses two changing variables
to manage buffer (buf and buflen). we eliminate buflen and use
fixed point (ep) as the ending pointer.

this fix is NOT critical.
 1.55  14-May-2002  kleink branches: 1.55.2;
struct addrinfo.ai_addrlen used to be a size_t, per RFC 2553.

In XNS5.2, and subsequently in POSIX-2001 and draft-ietf-ipngwg-rfc2553bis-02
it was changed to a socklen_t.

To accomodate for this while preserving binary compatibility with the
old interface, prepend or append 32 bits of padding, depending on
the (LP64 data model) architecture's endianness.

This should be deleted the next time the libc major number is
incremented.
 1.54  20-Aug-2001  itojun use snprintf, not sprintf. sync with kame.
 1.53  25-Jan-2001  jdolecek branches: 1.53.2;
make local constant arrays const
 1.52  24-Jan-2001  itojun make sure "qname" argument to getanswer() is properly given. from lukem
 1.51  04-Jan-2001  lukem sprinkle _DIAGASSERT() around
 1.50  10-Dec-2000  christos remove redundant declarations of h_errno and __hostalias
 1.49  23-Sep-2000  lukem don't bother declaring in6_addrany[] and in6_loopback #ifndef INET6
 1.48  31-Aug-2000  itojun on /etc/hosts lookup, set "official host name" (the leftmost hostname)
into ai_canonname. this is to synchronize with practice in gethostby*.
comment from ume@mahoroba.org. sync with kame.
 1.47  09-Aug-2000  itojun implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers. need careful configuration
when enable it. (default config is not affected).
see manpage for details.

XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.
 1.46  09-Jul-2000  itojun reject empty scopeid/numeric portname explicitly. sync with kame.
 1.45  09-Jul-2000  itojun use strtoul() to check for all-digit string, not isdigit(). sync with kame.
 1.44  07-Jul-2000  itohy Passing "char" values to ctype(3) functions is problematic.
If an argument of a ctype function is outside "unsigned char"
and if it is not EOF, the behavior is undefined.

The isascii(3) is the sole exception of above and it was used to
be used to check a value was valid for other ctype functions in
ancient systems. On modern systems, the ctype functions take
all values of "unsigned char", and this check is obsolete and
even wrong for non-ASCII systems. However, we leave the isascii()
untouched for now, so as not to change the current behavior.
 1.43  05-Jul-2000  itojun return EAI_NODATA, instead of EAI_NONAME, on name resolution errors.
EAI_NONAME does not make sense in these situations. from kame.
From: enami@netbsd.org
 1.42  27-Apr-2000  itojun branches: 1.42.4;
remove unused struct def. more sanity check for NULL.
 1.41  26-Apr-2000  itojun add $KAME$
 1.40  26-Apr-2000  itojun disable AI_ADDRCONFIG (post RFC2553 specification),
it has bug in PF_UNSPEC caes. From: ume
fix boundary check which was broken by delint in the past.
 1.39  24-Apr-2000  itojun add __RCSID().
 1.38  24-Apr-2000  itojun supply weak alias for IPv6-related library additions. sorry to be late.
 1.37  03-Apr-2000  itojun in yphostent, initialize res0 when getaddrinfo fails.
 1.36  02-Apr-2000  christos Delint:
- add notreached comment
- remove unused variables
- cast to void * first to avoid casting warnings
- fix bug in _yphostent where cur and sentinel were not
being initialized.
 1.35  16-Mar-2000  itojun visit all requests even if we get errors from name server.
this will solve name query failures for IPv4-only node, when
the DNS server returns SERVFAIL or NXDOMAIN (should success with an == 0).
PR: 9621
 1.34  22-Feb-2000  itojun avoid memory leak on valid FQDN + invalid port name.
 1.33  20-Feb-2000  itojun query NIS hosts.byname only when necessary (= PF_UNSPEC of PF_INET queries).
 1.32  20-Feb-2000  itojun to honor the search order defined by nsswitch.conf,
getaddrinfo(3) now calls lower-layer resolver functions directly.

XXX code duplicate with gethnamaddr.c/res_search.c - future code
maintenance issue? Since BIND[89] does not address this issue either at
this moment, switching to BIND[89] does not help.
 1.31  17-Feb-2000  itojun to synchronize with progress of discussion for post
draft-ietf-ipngwg-scopedaddr-format-00.txt (will be 01),
use "address%interface" notation for extended scoped IPv6 address.

NOTE: the change affects link-local addresses only. I hope it to be
the final change on it.....
 1.30  16-Feb-2000  itojun preparation to flip extended scoped address syntax.

the specification is still under debate; there is high possibility that
"fe80::1%de0" will be the finalist but i'm not sure yet.
 1.29  15-Feb-2000  itojun make it possible to compile it without -DINET6
From: "Castor Fu" <castor@geocast.com>
 1.28  10-Feb-2000  itojun sa_len was not properly set due to autoconf #ifdef.
(mistake in yesterday's upgrade)
 1.27  09-Feb-2000  itojun revise extended scoped address format support. delimiter and the order
is changed, based on discussion in ipngwg scoped address cabal.
past code: fe80::1@de0
now: de0%fe80::1
this will be in sync with next extended address format proposal
(which should be final - I don't want to make this kind of change again).
 1.26  28-Jan-2000  itojun backout previous commit - freeaddrinfo(NULL) issue.
 1.25  27-Jan-2000  itojun allow freeaddrinfo(NULL). nothing is talked in RFC2553 (maybe in X/Open?).
however, since NRL freeaddrinfo permits it, we need to.
 1.24  26-Jan-2000  itojun fix RFC2553 conformance. AI_CANONNAME does not mean reverse query.
 1.23  24-Jan-2000  itojun fix comment.
better sync with kame tree.
 1.22  23-Jan-2000  itojun remove #if 0'ed portion (AF filtering in normal name resolution)
add comment to the fragment which confused mycroft
 1.21  23-Jan-2000  mycroft Doh. I'm a dork.
 1.20  22-Jan-2000  mycroft Partially delint.
 1.19  17-Jan-2000  itojun do not filter address families that are not supported by kernel.
the behavior was introduced in 1.8 -> 1.9, by itojun, and it was
not a correct behavior.

even if we may be able to connect to the the returned addresses,
filtering them out is not a correct thing to do. for example, even if
you have partial unreachablility in IPv4, gethostbyname(3) will return
IPv4 addresses in the unreachable network nonetheless.
 1.18  17-Jan-2000  itojun remove #if 0'ed sections.
 1.17  27-Dec-1999  itojun properly check the error result from if_nametoindex(), to disallow
bogus interface index specification like fe80::1@bogus.
(sync with kame)
 1.16  13-Dec-1999  itojun more complete solution for gethostby*() buffer overwrite issue.
(we need thread-safe gethostby*...)
 1.15  13-Dec-1999  itojun fix getaddrinfo(3) and getnameinfo(3).

getaddrinfo(3): result from gethostby* will be broken if we call it again.
deep-copy them. we have sa_len so configure them.
getnameinfo(3): we have sa_len so configure them.
 1.14  13-Dec-1999  itojun bring in latest KAME get{addr,name}info(3).
getnameinfo(3) globs ai_socktype and ai_protocol correctly.
KAME scopeid extension is implemented.
(draft-ietf-ipngwg-scopedaddr-format-00.txt)

bump up shlib minor
(may not be necessary, but rather big difference in behavior - especially
ai_flags)
 1.13  20-Sep-1999  lukem branches: 1.13.4;
back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
 1.12  16-Sep-1999  lukem * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif
 1.11  22-Aug-1999  kleink Need "namespace.h".
 1.10  13-Aug-1999  itojun pacify too-picky compiler.

From: onoe@sm.sony.co.jp
 1.9  14-Jul-1999  itojun - do not make query for AFs that are not supported by kernel.
i.e. do not make query for IPv6 addresses, when running on non-IPv6 kernel,
or, do not query for IPv4 address on IPv6-only kernel :-)

This kind of behavior is not very well documented in RFC2553. This
may violate the spec.

- on EAI_AGAIN, only retry 3 times (3 is a magic number). Previous code
made retries forever. This solves situation where name server is wrongly
configured and nameserver:53 returns icmp port unreach.

The only proper fix for all getaddrinfo() related twists would be to
implement getipnodebyname() and get rid of wacky get_addr().
We need to contribute bind8 development for this.
 1.8  06-Jul-1999  itojun fix name resolution problem when you have "hosts: files dns" on
/etc/nsswitch.conf.

This was because of two reasons:
- /etc/hosts lookup code damaged some of internal
state used by gethostbyname2().
- getaddrinfo() was not persistent enough against errors.

Sorry for the delay, and hope this fix all the following PRs
(I checked in my environment immitating those PRs and it worked for me)
PR: 7901, 7912, 7921
 1.7  04-Jul-1999  lukem capitalize the first word of most error strings except those words that are
argument names to the function. e.g, if `const char *servname' is an argument
name, keep using "servname invalid [...]" instead of "Servname invalid [...]"
 1.6  04-Jul-1999  itojun add NetBSD RCSID on top.
 1.5  04-Jul-1999  itojun fix USE_GETIPNODEBY case.
 1.4  04-Jul-1999  itojun fix behavior when there's dangling CNAME on specific AF.
TODO: have getipnodeby{name,addr} and let them do the trick.
 1.3  03-Jul-1999  itojun improve lint friendliness on USE_GETIPNODEBY case.
(no change in behavior)
 1.2  03-Jul-1999  lukem remove trailing `.' on error messages, since messages from strerror() and
h_strerror() don't return messages with a trailing `.' (and the `.' looks
ugly when using warnx() with the error message).
 1.1  01-Jul-1999  itojun add IPv6 support functions.

get{addr,name} info are implemented to have as little impact to existing
resolver code as possible, so they are NOT the optimal implementation.
They are at this moment not very thread safe (as they call
gethostby{name,addr}).

(shlib minor version)++, as new interfaces are added.

TODO: getipnodeby{name,addr} - which needs total reimplementation of
gethostby{name,addr}.
upgrade rcmd.c for multiple af support (needed for IPv6-ready rsh/rlogin)
 1.13.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.4.5  04-Sep-2002  itojun lib/libc/net/getaddrinfo.c 1.56
lib/libc/net/res_mkquery.c 1.22
correct bad practice in the code - it uses two changing variables
to manage buffer (buf and buflen). we eliminate buflen and use
fixed point (ep) as the ending pointer.

lib/libc/net/getaddrinfo.c 1.50
remove redundant declarations of h_errno and __hostalias

lib/libc/net/getaddrinfo.c 1.52
make sure "qname" argument to getanswer() is properly given. from lukem

lib/libc/net/getaddrinfo.c 1.54
lib/libc/net/gethnamaddr.c 1.43,1.49-1.50
lib/libc/net/getnetnamadr.c 1.23
use snprintf, string manipulation cleanups

lib/libc/net/getaddrinfo.c 1.57-1.59
correct port range check and signed/unsigned mixup

lib/libc/net/getaddrinfo.c 1.60-1.61
lint clean

lib/libc/net/getaddrinfo.c 1.62
lib/libc/net/gethnamaddr.c 1.51
drop AAAA reply with IPv4 mapped address. sync w/kame
draft-itojun-v6ops-v4mapped-harmful-00.txt

lib/libc/net/getaddrinfo.c 1.63
lib/libc/net/gethnamaddr.c 1.52
lib/libc/net/getnetnamadr.c 1.24
allocate 64K recieve buffer for DNS responses.

lib/libc/net/gethnamaddr.c 1.38
Varargsify dprintf to allow for format string checking

lib/libc/net/gethnamaddr.c 1.39
lib/libc/net/getnetnamadr.c 1.20
remove redundant declarations.

lib/libc/net/gethnamaddr.c 1.41
do not reverse-lookup scoped IPv6 address. it does not make sense as
there's no way to give scope identifier. sync w/kame

lib/libc/net/gethnamaddr.c 1.42
style

lib/libc/net/gethnamaddr.c 1.45
do not pass uninitialized variable to nsdispatch().

lib/libc/net/gethnamaddr.c 1.48
query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.
 1.42.4.4  01-Jul-2002  he Pull up revision 1.58 (requested by itojun):
Correct port range check.
 1.42.4.3  31-Aug-2000  itojun pullup 1.47 -> 1.48 (approved by releng-1-5)

> on /etc/hosts lookup, set "official host name" (the leftmost hostname)
> into ai_canonname. this is to synchronize with practice in gethostby*.
> comment from ume@mahoroba.org. sync with kame.
 1.42.4.2  13-Jul-2000  itojun pullup 1.42 -> 1.43: (approved by releng-1-5)
return EAI_NODATA, instead of EAI_NONAME, on name resolution errors.
EAI_NONAME does not make sense in these situations. from kame.
From: enami@netbsd.org
 1.42.4.1  13-Jul-2000  thorpej Pull up rev. 1.45 (itojun):
use strtoul() to check for all-digit string, not isdigit(). sync with kame.
 1.53.2.4  27-Aug-2002  nathanw Catch up to -current.
 1.53.2.3  01-Aug-2002  nathanw Catch up to -current.
 1.53.2.2  21-Jun-2002  nathanw Catch up to -current.
 1.53.2.1  08-Oct-2001  nathanw Catch up to -current.
 1.55.2.6  27-Aug-2002  lukem Pull up revision 1.63 (requested by itojun in ticket #735):
allocate 64K recieve buffer for DNS responses.
 1.55.2.5  24-Aug-2002  lukem Pull up revision 1.62 (requested by itojun in ticket #718):
drop AAAA reply with IPv4 mapped address. sync w/kame
draft-itojun-v6ops-v4mapped-harmful-00.txt
 1.55.2.4  17-Aug-2002  lukem Pull up revision 1.56 (requested by itojun in ticket #693):
correct bad practice in the code - it uses two changing variables
to manage buffer (buf and buflen). we eliminate buflen and use
fixed point (ep) as the ending pointer.
this fix is NOT critical.
 1.55.2.3  02-Jul-2002  lukem Pull up revision 1.60 (requested by itojun in ticket #417):
lint clean. from martin husemann
 1.55.2.2  02-Jul-2002  lukem Pull up revision 1.59 (requested by itojun in ticket #417):
make more pedantic check on strtoul. from deraadt, sync w/kame
 1.55.2.1  29-Jun-2002  lukem Pull up revision 1.58 (requested by itojun in ticket #401):
correct port range check. from deraadt, sync w/kame, diff sent to bind-bugs
 1.87.2.1  31-Jan-2009  bouyer Pull up following revision(s) (requested by tls in ticket #1267):
lib/libc/net/getaddrinfo.c: revision 1.92
Cause getaddrinfo() without socktype specification to work correctly for
numeric addresses. The documentation appears to say this works, and some
other systems support it -- more importantly, why should it _not_ work? If
it does not, getaddrinfo() cannot be used as a general-purpose textual to
binary address conversion utility function; yet it is the only such function
we have in the system, since inet_pton() requires a priori knowledge of the
address family.
This change also causes getaddrinfo() with NULL hint (expressly documented
as working) to work properly for numeric addresses.
 1.90.10.1  18-May-2008  yamt sync with head.
 1.91.8.2  19-Apr-2008  lukem Add a missing const.
 1.91.8.1  19-Apr-2008  lukem file getaddrinfo.c was added on branch christos-time_t on 2008-04-19 07:56:35 +0000
 1.91.6.2  23-Dec-2013  riz Apply patch (requested by bad in ticket #1887):

src/lib/libc/net/getaddrinfo.c r1.106:
this is supposed to be re-entrant, call don't call __hostalias that uses
a static buffer.

src/lib/libc/net/gethnamaddr.c r1.85:
- don't clobber hp in the RES_USE_INET6 case
- increment naddrs in the yp case
- don't use __hostalias(), it is not thread-safe.

This should finish addressing PR lib/46454
 1.91.6.1  26-Jan-2009  snj Pull up following revision(s) (requested by tls in ticket #306):
lib/libc/net/getaddrinfo.c: revision 1.92
Cause getaddrinfo() without socktype specification to work correctly for
numeric addresses. The documentation appears to say this works, and some
other systems support it -- more importantly, why should it _not_ work? If
it does not, getaddrinfo() cannot be used as a general-purpose textual to
binary address conversion utility function; yet it is the only such function
we have in the system, since inet_pton() requires a priori knowledge of the
address family.
This change also causes getaddrinfo() with NULL hint (expressly documented
as working) to work properly for numeric addresses.
 1.96.4.3  17-Nov-2015  bouyer Pull up following revision(s) (requested by christos in ticket #1340):
lib/libc/net/getnetnamadr.c: revision 1.43 via patch
lib/libc/net/getnetnamadr.c: revision 1.44 via patch
put the state back after it is used.
PR/50367: Stefan Schaeckeler: Apply fix to obey RES_CHECKNAME to getnetbyaddr
and getnetbyname.
 1.96.4.2  23-Dec-2013  riz Apply additional patches (requested by bad in ticket #975):

src/lib/libc/net/getaddrinfo.c r1.106:
this is supposed to be re-entrant, call don't call __hostalias that uses
a static buffer.

src/lib/libc/net/gethnamaddr.c r1.85:
- don't clobber hp in the RES_USE_INET6 case
- increment naddrs in the yp case
- don't use __hostalias(), it is not thread-safe.

Fixes additional issues in PR lib/46454
 1.96.4.1  03-Jun-2012  jdc Pull up revisions:
src/lib/libc/net/getaddrinfo.c revision 1.98 - 1.100
src/include/netdb.h revision 1.65
(requested by khorben in ticket #278).

Add AI_ADDRCONFIG, which makes getaddrinfo() return only address with
families
that are already configured in the system.

PR 46206: fix programmed SIGSEGV
more work is needed as tests seem to indicate that name resolution now
does no seem to work (firefox reports Server not found)
thanks to Ryo ONODERA for testing.

PR pkg/46206
re-establish fqdn lookup when AI_ADDRCONFIG is used in hints
AI_ADDRCONFIG led to fqdn lookup being skipped as the systems didn't
configure any PF_UNSPEC addresses - check was too strict here.
Thnaks to Ryo ONODERA for testing.
 1.96.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.96.2.2  30-Oct-2012  yamt sync with head
 1.96.2.1  17-Apr-2012  yamt sync with head
 1.101.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.101.2.1  23-Jun-2013  tls resync from head
 1.106.6.1  15-Jan-2016  sborrill Pull up to netbsd-7 (missing part of ticket #1012):
lib/libc/net/getaddrinfo.c 1.110
 1.106.4.1  15-Jan-2016  sborrill Pull up to netbsd-7 (missing part of ticket #1012):
lib/libc/net/getaddrinfo.c 1.110
 1.114.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.115.6.2  29-Nov-2020  martin Pull up following revision(s) (requested by is in ticket #1625):

lib/libc/net/getaddrinfo.c: revision 1.120
lib/libc/net/gethnamaddr.c: revision 1.93
include/arpa/nameser_compat.h: revision 1.8

Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).
 1.115.6.1  25-Oct-2017  snj Pull up following revision(s) (requested by jdolecek in ticket #317):
lib/libc/net/getaddrinfo.c: revision 1.116
lib/libc/resolv/res_mkquery.c: revision 1.16
PR/52578: Benjamin M. Schwartz Set the AD bit when DNSSEC is enabled
(RFC 6840 Section 5.7).
--
PR/52578: Benjamin M. Schwartz: sync the internal copy of res_nquery for
getaddrinfo, with the real version so that we handle EDNS fallback.
 1.117.4.1  10-Jun-2019  christos Sync with HEAD
 1.117.2.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.119.2.1  29-Nov-2020  martin Pull up following revision(s) (requested by is in ticket #1135):

lib/libc/net/getaddrinfo.c: revision 1.120
lib/libc/net/gethnamaddr.c: revision 1.93
include/arpa/nameser_compat.h: revision 1.8

Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).

RSS XML Feed