| 454 |
|
request->type = type; |
| 455 |
|
strcpy(request->name, host_name); |
| 456 |
|
#ifdef IPV6 |
| 457 |
< |
if (type == T_A) |
| 458 |
< |
request->state = REQ_A; |
| 459 |
< |
else |
| 457 |
> |
if (type != T_A) |
| 458 |
|
request->state = REQ_AAAA; |
| 459 |
< |
#else |
| 462 |
< |
request->state = REQ_A; |
| 459 |
> |
else |
| 460 |
|
#endif |
| 461 |
+ |
request->state = REQ_A; |
| 462 |
|
} |
| 463 |
|
|
| 464 |
|
request->type = type; |
| 769 |
|
* interest where it'll instantly be ready for read :-) -- adrian |
| 770 |
|
*/ |
| 771 |
|
comm_setselect(fd, COMM_SELECT_READ, res_readreply, NULL, 0); |
| 772 |
+ |
|
| 773 |
|
/* Better to cast the sizeof instead of rc */ |
| 774 |
|
if (rc <= (int)(sizeof(HEADER))) |
| 775 |
|
return; |
| 798 |
|
|
| 799 |
|
if ((header->rcode != NO_ERRORS) || (header->ancount == 0)) |
| 800 |
|
{ |
| 801 |
< |
if (NXDOMAIN == header->rcode) |
| 801 |
> |
if (header->rcode == SERVFAIL || header->rcode == NXDOMAIN) |
| 802 |
> |
{ |
| 803 |
> |
/* |
| 804 |
> |
* If a bad error was returned, stop here and don't |
| 805 |
> |
* send any more (no retries granted). |
| 806 |
> |
*/ |
| 807 |
> |
(*request->query->callback)(request->query->ptr, NULL); |
| 808 |
> |
rem_request(request); |
| 809 |
> |
} |
| 810 |
> |
#ifdef IPV6 |
| 811 |
> |
else |
| 812 |
|
{ |
| 813 |
|
/* |
| 814 |
|
* If we havent already tried this, and we're looking up AAAA, try A |
| 815 |
|
* now |
| 816 |
|
*/ |
| 808 |
– |
#ifdef IPV6 |
| 817 |
|
if (request->state == REQ_AAAA && request->type == T_AAAA) |
| 818 |
|
{ |
| 819 |
|
request->timeout += 4; |
| 827 |
|
request->retries--; |
| 828 |
|
resend_query(request); |
| 829 |
|
} |
| 822 |
– |
else /* It's NXDOMAIN but not IPV6 */ |
| 823 |
– |
#endif |
| 824 |
– |
{ |
| 825 |
– |
/* |
| 826 |
– |
* If a bad error was returned, stop here and don't |
| 827 |
– |
* send any more (no retries granted). |
| 828 |
– |
*/ |
| 829 |
– |
(*request->query->callback)(request->query->ptr, NULL); |
| 830 |
– |
rem_request(request); |
| 831 |
– |
} |
| 832 |
– |
} |
| 833 |
– |
else /* Some other error other than NXDOMAIN */ |
| 834 |
– |
{ |
| 835 |
– |
/* |
| 836 |
– |
* If a bad error was returned, stop here and don't |
| 837 |
– |
* send any more (no retries granted). |
| 838 |
– |
*/ |
| 839 |
– |
(*request->query->callback)(request->query->ptr, NULL); |
| 840 |
– |
rem_request(request); |
| 830 |
|
} |
| 831 |
+ |
#endif |
| 832 |
+ |
|
| 833 |
|
return; |
| 834 |
|
} |
| 835 |
+ |
|
| 836 |
|
/* |
| 837 |
|
* If this fails there was an error decoding the received packet, |
| 838 |
|
* try it again and hope it works the next time. |