]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: match CNAME replies to right question
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Mar 2021 21:15:18 +0000 (22:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 15 Mar 2021 22:54:53 +0000 (23:54 +0100)
Previously by mistake we'd always match every single reply we get in a
CNAME chain to the original question from the stub client. That's
broken, we need to test it against the CNAME query we are currently
looking at.

The effect of this incorrect matching was that we'd assign the RRs to
the wrong section since we'd assume they'd be auxiliary answers instead
of primary answers.

Fixes: #18972
src/resolve/resolved-dns-stub.c

index f8d4767e536a0368106ba73e6ba41aaa270ddb6c..b6d14b9305ec490e6f0298b6363521bc19ff24ec 100644 (file)
@@ -761,7 +761,7 @@ static void dns_stub_query_complete(DnsQuery *q) {
          * and keep adding all RRs in the CNAME chain. */
         r = dns_stub_assign_sections(
                         q,
-                        q->request_packet->question,
+                        dns_query_question_for_protocol(q, DNS_PROTOCOL_DNS),
                         dns_stub_reply_with_edns0_do(q));
         if (r < 0) {
                 log_debug_errno(r, "Failed to assign sections: %m");