summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_message_parse.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-05-17 19:38:29 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-05-17 19:38:29 +0000
commit413b26a719d402a30e61c8f93cf7cbf2f19375e3 (patch)
tree663c7611f40817ff1d0eeb031d906ac3f5fb20d6 /src/libs6dns/s6dns_message_parse.c
parent91e808f1db0b76f3625f516ec73a95b4e32decb2 (diff)
downloads6-dns-413b26a719d402a30e61c8f93cf7cbf2f19375e3.tar.xz
Fix resolveq_aaaaa
If s6dns_resolveq_aaaaa gets nodata on the AAAA query for a qualified domain, it will now wait for the answer to the A query on the same qualified domain before returning. Even if it gets nodata, it still means that the domain exists, so it will not wait for results from other qualification attempts.
Diffstat (limited to 'src/libs6dns/s6dns_message_parse.c')
-rw-r--r--src/libs6dns/s6dns_message_parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs6dns/s6dns_message_parse.c b/src/libs6dns/s6dns_message_parse.c
index 06b7677..4aaee9a 100644
--- a/src/libs6dns/s6dns_message_parse.c
+++ b/src/libs6dns/s6dns_message_parse.c
@@ -10,6 +10,7 @@ int s6dns_message_parse (s6dns_message_header_t *h, char const *packet, unsigned
s6dns_message_counts_t counts ;
unsigned int pos ;
unsigned int section ;
+ int gotans ;
if (!s6dns_message_parse_init(h, &counts, packet, packetlen, &pos)) return 0 ;
switch (h->rcode)
{
@@ -21,6 +22,7 @@ int s6dns_message_parse (s6dns_message_header_t *h, char const *packet, unsigned
case 5 : return (errno = ECONNREFUSED, 0) ;
default: return (errno = EIO, 0) ;
}
+ gotans = !!counts.an ;
section = s6dns_message_parse_skipqd(&counts, packet, packetlen, &pos) ;
while (section)
{
@@ -33,5 +35,5 @@ int s6dns_message_parse (s6dns_message_header_t *h, char const *packet, unsigned
}
section = s6dns_message_parse_next(&counts, &rr, packet, packetlen, &pos) ;
}
- return 1 ;
+ return 1 + gotans ;
}