Skip to content

Commit 7ccb1f6

Browse files
poetteringbluca
authored andcommitted
resolved: honour SD_RESOLVED_NO_CNAME flag when processing cache
Fixes: #33300 Replaces: #35102 (cherry picked from commit 959d7f1) (cherry picked from commit 8f1b7ec9edd4ce7d5ced86d29e659fda95dd95f3) (cherry picked from commit b5d7d32d6575f28bc447576e1da52f8f41805c79) (cherry picked from commit cf3d93b) (cherry picked from commit dd2e419)
1 parent 42de761 commit 7ccb1f6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/resolve/resolved-dns-cache.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,11 @@ int dns_cache_put(
870870
return r;
871871
}
872872

873-
static DnsCacheItem *dns_cache_get_by_key_follow_cname_dname_nsec(DnsCache *c, DnsResourceKey *k) {
873+
static DnsCacheItem *dns_cache_get_by_key_follow_cname_dname_nsec(
874+
DnsCache *c,
875+
DnsResourceKey *k,
876+
uint64_t query_flags) {
877+
874878
DnsCacheItem *i;
875879
const char *n;
876880
int r;
@@ -893,7 +897,7 @@ static DnsCacheItem *dns_cache_get_by_key_follow_cname_dname_nsec(DnsCache *c, D
893897
if (i && i->type == DNS_CACHE_NXDOMAIN)
894898
return i;
895899

896-
if (dns_type_may_redirect(k->type)) {
900+
if (dns_type_may_redirect(k->type) && !FLAGS_SET(query_flags, SD_RESOLVED_NO_CNAME)) {
897901
/* Check if we have a CNAME record instead */
898902
i = hashmap_get(c->by_key, &DNS_RESOURCE_KEY_CONST(k->class, DNS_TYPE_CNAME, n));
899903
if (i && i->type != DNS_CACHE_NODATA)
@@ -1013,7 +1017,7 @@ int dns_cache_lookup(
10131017
goto miss;
10141018
}
10151019

1016-
first = dns_cache_get_by_key_follow_cname_dname_nsec(c, key);
1020+
first = dns_cache_get_by_key_follow_cname_dname_nsec(c, key, query_flags);
10171021
if (!first) {
10181022
/* If one question cannot be answered we need to refresh */
10191023

0 commit comments

Comments
 (0)