Commit Graph

47 Commits

Author SHA1 Message Date
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
itojun 58481c1c06 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.
1999-12-13 16:22:56 +00:00
itojun 1501f61891 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)
1999-12-13 14:18:31 +00:00
lukem d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
lukem b48252f365 * 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
1999-09-16 11:44:54 +00:00
kleink 5f3726439e Need "namespace.h". 1999-08-22 12:54:02 +00:00
itojun 94c4bdf1cc pacify too-picky compiler.
From: onoe@sm.sony.co.jp
1999-08-13 09:45:51 +00:00
itojun f958dccbd1 - 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.
1999-07-14 22:10:03 +00:00
itojun 2842a2f6bb 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
1999-07-06 02:00:41 +00:00
lukem abd1f8ab5b 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 [...]"
1999-07-04 02:02:29 +00:00
itojun 4620b00436 add NetBSD RCSID on top. 1999-07-04 00:43:43 +00:00
itojun d505f1145c fix USE_GETIPNODEBY case. 1999-07-04 00:34:20 +00:00
itojun f69724e659 fix behavior when there's dangling CNAME on specific AF.
TODO: have getipnodeby{name,addr} and let them do the trick.
1999-07-04 00:33:14 +00:00
itojun a45fa8f3c7 improve lint friendliness on USE_GETIPNODEBY case.
(no change in behavior)
1999-07-03 14:29:29 +00:00
lukem b8e9b3ff69 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).
1999-07-03 07:00:42 +00:00
itojun 37e8159125 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)
1999-07-01 18:23:53 +00:00