1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

When res_nquerydomain() returns SERVFAIL, we should try next domain.

This commit is contained in:
Hajimu UMEMOTO 2006-03-24 13:30:10 +00:00
parent 1ab7d4c93d
commit aebc6ec293
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157093
2 changed files with 26 additions and 5 deletions

View File

@ -2455,6 +2455,10 @@ res_searchN(name, target, res)
case NO_DATA:
case HOST_NOT_FOUND:
break;
case TRY_AGAIN:
if (hp->rcode == SERVFAIL)
break;
/* FALLTHROUGH */
default:
return (-1);
}
@ -2514,9 +2518,9 @@ res_searchN(name, target, res)
/* keep trying */
break;
case TRY_AGAIN:
got_servfail++;
if (hp->rcode == SERVFAIL) {
/* try next search element, if any */
got_servfail++;
break;
}
/* FALLTHROUGH */
@ -2537,6 +2541,10 @@ res_searchN(name, target, res)
case NO_DATA:
case HOST_NOT_FOUND:
break;
case TRY_AGAIN:
if (hp->rcode == SERVFAIL)
break;
/* FALLTHROUGH */
default:
goto giveup;
}

View File

@ -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;
}