Commit Graph

65 Commits

Author SHA1 Message Date
itojun ece2a37389 fill ai_canonname field for numeric hostname, by the given hostname.
folows new recommendation in RFC3493
2003-05-08 05:30:53 +00:00
itojun b5dda3e238 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.
2003-03-17 23:10:25 +00:00
itojun 62f36ff8e2 allocate 64K recieve buffer for DNS responses. 2002-08-27 08:50:49 +00:00
itojun 949583590f drop AAAA reply with IPv4 mapped address. sync w/kame
draft-itojun-v6ops-v4mapped-harmful-00.txt
2002-08-22 16:32:14 +00:00
itojun a4cf77c9bb pacify lint. from he@netbsd 2002-07-01 22:05:08 +00:00
itojun 754f8759a4 lint clean. from martin husemann 2002-07-01 21:05:56 +00:00
itojun 9922c987a9 make more pedantic check on strtoul. from deraadt, sync w/kame 2002-07-01 07:42:49 +00:00
itojun 28735a6a17 correct port range check. from deraadt, sync w/kame, diff sent to bind-bugs 2002-06-29 12:23:10 +00:00
itojun 0c63dd3cf2 correct %d/%u mixup. 2002-06-27 10:22:07 +00:00
itojun 9cdbc86d39 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.
2002-06-26 06:00:26 +00:00
kleink 06d36d9eee 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.
2002-05-14 13:45:13 +00:00
itojun 6cc1136ae1 use snprintf, not sprintf. sync with kame. 2001-08-20 02:33:31 +00:00
jdolecek ca797c3c15 make local constant arrays const 2001-01-25 22:50:55 +00:00
itojun 2dda99193c make sure "qname" argument to getanswer() is properly given. from lukem 2001-01-24 15:05:48 +00:00
lukem a976c8e346 sprinkle _DIAGASSERT() around 2001-01-04 03:56:17 +00:00
christos 39b08b8fe0 remove redundant declarations of h_errno and __hostalias 2000-12-10 04:19:53 +00:00
lukem 4a1b4395d7 don't bother declaring in6_addrany[] and in6_loopback #ifndef INET6 2000-09-23 04:40:19 +00:00
itojun e871d0cd31 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.
2000-08-31 17:32:39 +00:00
itojun babc498cc8 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.
2000-08-09 14:40:52 +00:00
itojun 20aa4f5b37 reject empty scopeid/numeric portname explicitly. sync with kame. 2000-07-09 04:48:17 +00:00
itojun a00fcf14af use strtoul() to check for all-digit string, not isdigit(). sync with kame. 2000-07-09 04:23:49 +00:00
itohy 7daefc5a5a 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.
2000-07-07 08:03:36 +00:00
itojun 920101cf2e 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
2000-07-05 12:41:16 +00:00
itojun c90f48caf4 remove unused struct def. more sanity check for NULL. 2000-04-27 05:30:22 +00:00
itojun 4009c33ef7 add $KAME$ 2000-04-26 16:08:10 +00:00
itojun e7cb023342 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.
2000-04-26 12:25:51 +00:00
itojun 72eddcac5b add __RCSID(). 2000-04-24 10:40:24 +00:00
itojun c6bf4b09bd supply weak alias for IPv6-related library additions. sorry to be late. 2000-04-24 09:27:30 +00:00
itojun f716418a10 in yphostent, initialize res0 when getaddrinfo fails. 2000-04-03 01:12:26 +00:00
christos f8c9a1f999 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.
2000-04-02 21:30:37 +00:00
itojun d5aee78db5 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
2000-03-16 13:51:43 +00:00
itojun b2da836f1e avoid memory leak on valid FQDN + invalid port name. 2000-02-22 05:47:15 +00:00
itojun 08f1ee0d30 query NIS hosts.byname only when necessary (= PF_UNSPEC of PF_INET queries). 2000-02-20 17:07:01 +00:00
itojun 40e69da142 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.
2000-02-20 14:44:30 +00:00
itojun 823d2a5d81 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.....
2000-02-17 17:06:17 +00:00
itojun 8829e73e38 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.
2000-02-16 04:50:23 +00:00
itojun 9d735055cd make it possible to compile it without -DINET6
From: "Castor Fu" <castor@geocast.com>
2000-02-15 18:55:55 +00:00
itojun b3092550ea sa_len was not properly set due to autoconf #ifdef.
(mistake in yesterday's upgrade)
2000-02-10 03:06:53 +00:00
itojun 34a6354b59 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).
2000-02-09 12:25:06 +00:00
itojun 59b810d3a5 backout previous commit - freeaddrinfo(NULL) issue. 2000-01-28 08:09:48 +00:00
itojun e4dc489b2c allow freeaddrinfo(NULL). nothing is talked in RFC2553 (maybe in X/Open?).
however, since NRL freeaddrinfo permits it, we need to.
2000-01-27 08:25:51 +00:00
itojun 541dde0213 fix RFC2553 conformance. AI_CANONNAME does not mean reverse query. 2000-01-26 06:51:29 +00:00
itojun 324dad9e89 fix comment.
better sync with kame tree.
2000-01-24 03:08:12 +00:00
itojun bd6de83f9b remove #if 0'ed portion (AF filtering in normal name resolution)
add comment to the fragment which confused mycroft
2000-01-23 04:03:21 +00:00
mycroft 82267feccd Doh. I'm a dork. 2000-01-23 01:37:19 +00:00
mycroft c72eee355c Partially delint. 2000-01-22 23:54:20 +00:00
itojun 2705db0080 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.
2000-01-17 15:57:29 +00:00
itojun 79641939e0 remove #if 0'ed sections. 2000-01-17 08:34:04 +00:00
itojun 1f9eba958f properly check the error result from if_nametoindex(), to disallow
bogus interface index specification like fe80::1@bogus.
(sync with kame)
1999-12-27 10:20:59 +00:00
itojun 72e7091f16 more complete solution for gethostby*() buffer overwrite issue.
(we need thread-safe gethostby*...)
1999-12-13 17:05:45 +00:00