return r;
}
-static DnsCacheItem *dns_cache_get_by_key_follow_cname_dname_nsec(DnsCache *c, DnsResourceKey *k) {
+static DnsCacheItem *dns_cache_get_by_key_follow_cname_dname_nsec(
+ DnsCache *c,
+ DnsResourceKey *k,
+ uint64_t query_flags) {
+
DnsCacheItem *i;
const char *n;
int r;
if (i && i->type == DNS_CACHE_NXDOMAIN)
return i;
- if (dns_type_may_redirect(k->type)) {
+ if (dns_type_may_redirect(k->type) && !FLAGS_SET(query_flags, SD_RESOLVED_NO_CNAME)) {
/* Check if we have a CNAME record instead */
i = hashmap_get(c->by_key, &DNS_RESOURCE_KEY_CONST(k->class, DNS_TYPE_CNAME, n));
if (i && i->type != DNS_CACHE_NODATA)
goto miss;
}
- first = dns_cache_get_by_key_follow_cname_dname_nsec(c, key);
+ first = dns_cache_get_by_key_follow_cname_dname_nsec(c, key, query_flags);
if (!first) {
/* If one question cannot be answered we need to refresh */