MINOR: dns: query type change when last record is a CNAME
DNS servers don't return A or AAAA record if the query points to a CNAME
not resolving to the right type.
We know it because the last record of the response is a CNAME. We can
trigger a new query, switching to a new query type, handled by the layer
above.
diff --git a/src/server.c b/src/server.c
index b6eef5d..68fa800 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2964,6 +2964,7 @@
case DNS_RESP_TRUNCATED:
case DNS_RESP_ERROR:
case DNS_RESP_NO_EXPECTED_RECORD:
+ case DNS_RESP_CNAME_ERROR:
res_preferred_afinet = resolution->opts->family_prio == AF_INET && resolution->query_type == DNS_RTYPE_A;
res_preferred_afinet6 = resolution->opts->family_prio == AF_INET6 && resolution->query_type == DNS_RTYPE_AAAA;
@@ -3024,9 +3025,6 @@
}
break;
- case DNS_RESP_CNAME_ERROR:
- break;
-
case DNS_RESP_TIMEOUT:
if (resolution->status != RSLV_STATUS_TIMEOUT) {
resolution->status = RSLV_STATUS_TIMEOUT;