| 320 |
|
struct reslist *request; |
| 321 |
|
|
| 322 |
|
request = (struct reslist *)MyMalloc(sizeof(struct reslist)); |
| 323 |
– |
memset(request, 0, sizeof(struct reslist)); |
| 323 |
|
|
| 324 |
|
request->sentat = CurrentTime; |
| 325 |
|
request->retries = 3; |
| 326 |
|
request->resend = 1; |
| 327 |
|
request->timeout = 4; /* start at 4 and exponential inc. */ |
| 329 |
– |
memset(&request->addr, 0, sizeof(request->addr)); |
| 328 |
|
request->query = query; |
| 329 |
|
request->state = REQ_IDLE; |
| 330 |
|
|
| 762 |
|
static void |
| 763 |
|
res_readreply(fde_t *fd, void *data) |
| 764 |
|
{ |
| 765 |
< |
char buf[sizeof(HEADER) + MAXPACKET]; |
| 765 |
> |
char buf[sizeof(HEADER) + MAXPACKET] |
| 766 |
> |
/* Sparc and alpha need 16bit-alignment for accessing header->id |
| 767 |
> |
* (which is uint16_t). Because of the header = (HEADER*) buf; |
| 768 |
> |
* lateron, this is neeeded. --FaUl |
| 769 |
> |
*/ |
| 770 |
> |
#if defined(__sparc__) || defined(__alpha__) |
| 771 |
> |
__attribute__((aligned (16))) |
| 772 |
> |
#endif |
| 773 |
> |
; |
| 774 |
|
HEADER *header; |
| 775 |
|
struct reslist *request = NULL; |
| 776 |
|
struct DNSReply *reply = NULL; |
| 813 |
|
|
| 814 |
|
if ((header->rcode != NO_ERRORS) || (header->ancount == 0)) |
| 815 |
|
{ |
| 816 |
< |
if (SERVFAIL == header->rcode) |
| 811 |
< |
resend_query(request); |
| 812 |
< |
else |
| 816 |
> |
if (NXDOMAIN == header->rcode) |
| 817 |
|
{ |
| 818 |
|
/* |
| 819 |
|
* If we havent already tried this, and we're looking up AAAA, try A |
| 820 |
|
* now |
| 821 |
|
*/ |
| 818 |
– |
|
| 822 |
|
#ifdef IPV6 |
| 823 |
|
if (request->state == REQ_AAAA && request->type == T_AAAA) |
| 824 |
|
{ |
| 830 |
|
{ |
| 831 |
|
request->state = REQ_INT; |
| 832 |
|
request->timeout += 4; |
| 833 |
< |
request->retries--; |
| 833 |
> |
request->retries--; |
| 834 |
|
resend_query(request); |
| 835 |
|
} |
| 836 |
< |
else |
| 836 |
> |
else /* It's NXDOMAIN but not IPV6 */ |
| 837 |
|
#endif |
| 838 |
|
{ |
| 839 |
|
/* |
| 840 |
< |
* If a bad error was returned, we stop here and dont send |
| 840 |
> |
* If a bad error was returned, stop here and don't |
| 841 |
|
* send any more (no retries granted). |
| 842 |
|
*/ |
| 843 |
|
(*request->query->callback)(request->query->ptr, NULL); |
| 844 |
< |
rem_request(request); |
| 845 |
< |
} |
| 844 |
> |
rem_request(request); |
| 845 |
> |
} |
| 846 |
> |
} |
| 847 |
> |
else /* Some other error other than NXDOMAIN */ |
| 848 |
> |
{ |
| 849 |
> |
/* |
| 850 |
> |
* If a bad error was returned, stop here and don't |
| 851 |
> |
* send any more (no retries granted). |
| 852 |
> |
*/ |
| 853 |
> |
(*request->query->callback)(request->query->ptr, NULL); |
| 854 |
> |
rem_request(request); |
| 855 |
|
} |
| 844 |
– |
|
| 856 |
|
return; |
| 857 |
|
} |
| 858 |
|
/* |