diff options
author | ume <ume@FreeBSD.org> | 2006-03-24 13:30:10 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-03-24 13:30:10 +0000 |
commit | bf9a7919939ac869417c9254801036107b56da01 (patch) | |
tree | 0e5e56b97bcc44428e04d1e9c0ade9d7de68d5d5 /lib/libc/resolv/res_query.c | |
parent | 946071cfb766c855cda8e6bcf642a48573c38649 (diff) | |
download | FreeBSD-src-bf9a7919939ac869417c9254801036107b56da01.zip FreeBSD-src-bf9a7919939ac869417c9254801036107b56da01.tar.gz |
When res_nquerydomain() returns SERVFAIL, we should try next domain.
Diffstat (limited to 'lib/libc/resolv/res_query.c')
-rw-r--r-- | lib/libc/resolv/res_query.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c index cb21ac6d..e715b85 100644 --- a/lib/libc/resolv/res_query.c +++ b/lib/libc/resolv/res_query.c @@ -212,6 +212,7 @@ res_nsearch(res_state statp, int anslen) /* size of answer */ { const char *cp, * const *domain; + HEADER *hp = (HEADER *) answer; char tmp[NS_MAXDNAME]; u_int dots; int trailing_dot, ret, saved_herrno; @@ -252,6 +253,10 @@ res_nsearch(res_state statp, case NO_DATA: case HOST_NOT_FOUND: break; + case TRY_AGAIN: + if (hp->rcode == SERVFAIL) + break; + /* FALLTHROUGH */ default: return (-1); } @@ -320,10 +325,10 @@ res_nsearch(res_state statp, * ((HEADER *)answer)->rcode may not be set * to SERVFAIL in the case of a timeout. * - * Either way we must terminate the search - * and return TRY_AGAIN in order to avoid - * non-deterministic return codes. For - * example, loaded name servers or races + * Either way we must return TRY_AGAIN in + * order to avoid non-deterministic + * return codes. + * For example, loaded name servers or races * against network startup/validation (dhcp, * ppp, etc) can cause the search to timeout * on one search element, e.g. 'fu.bar.com', @@ -331,6 +336,10 @@ res_nsearch(res_state statp, * next search element, e.g. 'fu.'. */ got_servfail++; + if (hp->rcode == SERVFAIL) { + /* try next search element, if any */ + break; + } /* FALLTHROUGH */ default: /* anything else implies that we're done */ @@ -349,6 +358,10 @@ res_nsearch(res_state statp, case NO_DATA: case HOST_NOT_FOUND: break; + case TRY_AGAIN: + if (hp->rcode == SERVFAIL) + break; + /* FALLTHROUGH */ default: goto giveup; } |