CNAME-only should not be returned instantly in parellel requests
Prerequisites
-
[x] I have checked the Wiki and Discussions and found no answer
-
[x] I have searched other issues and found no duplicates
-
[x] I want to report a bug and not ask a question or ask for help
-
[x] I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)
Platform (OS and CPU architecture)
Linux, AMD64 (aka x86_64)
Installation
GitHub releases or script from README
Setup
On one machine
AdGuard Home version
v0.107.71
Action
dig www.mydomain.com
2 upstream servers are queried in parellel.
Expected result
one upstream would sometimes return an answer only with CNAME but without A record, this should be treated as a negative answer, ADH should wait for all answers.
;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58017 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags: do; udp: 1232 ;; QUESTION SECTION: ;www.xyz.com. IN A
;; ANSWER SECTION: www.xyz.com. 600 IN CNAME www.xyz.com.w.abc.com. www.xyz.com.w.abc.com. 600 IN A 111.222.333.444
;; Query time: 4 msec
Actual result
ADH returned and cached the fastest answer, did not check whether the slightly slower answer included a valid A record.
;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62479 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags: do; udp: 1232 ;; QUESTION SECTION: ;www.xyz.com. IN A
;; ANSWER SECTION: www.xyz.com. 600 IN CNAME www.xyz.com.w.abc.com.
;; Query time: 4 msec
Additional information and/or screenshots
No response
Are you not essentially masking a broken upstream if you do this? Why would one upstream return a CNAME and one not?
Are you not essentially masking a broken upstream if you do this? Why would one upstream return a CNAME and one not?
I believe it is an ISP DNS fail, out of my control.
Even if all uptreams returned answers with CNAME only but without any A recod, the result could be returned but not cached.
I'm having the same exact issue on my end, however, the upstream server is "controlled" by me.
I did however, identify a potential bug on AGH which I would like to report.
I'm using Unifi's UDM-SE for my network.
AGH is only used for filtering and the DNS records are in Unifi. DNSSEC is disabled in AGH.
When a client is making a DNS query, the flow is like this:
Client --> AGH --> Unifi
I have a CNAME record pointing to another external record. Lets call it:
CNAME: www.example-cname.com Target: www.example.com
www.example.com is hosted outside of my network.
dig shows exactly the same behavior as the OP:
truenas_admin@TrueNAS:~$ dig www.example-cname.com
; <<>> DiG 9.18.33-1~deb12u2-Debian <<>> www.example-cname.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27825
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.example-cname.com. IN A
;; ANSWER SECTION:
www.example-cname.com. 10 IN CNAME www.example.com.
;; Query time: 3 msec
;; SERVER: 192.168.5.203#53(192.168.5.203) (UDP)
;; WHEN: Mon Mar 23 15:21:52 WET 2026
;; MSG SIZE rcvd: 115
But if my client bypasses AGH and queries Unifi directly for the record, it will show the proper result with the IP Addresses:
truenas_admin@TrueNAS:~$ dig www.example-cname.com "@192.168.5.1"
; <<>> DiG 9.18.33-1~deb12u2-Debian <<>> www.example-cname.com @192.168.5.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57488
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.example-cname.com. IN A
;; ANSWER SECTION:
www.example-cname.com. 0 IN CNAME www.example.com.
www.example.com. 21 IN A 123.123.123.123
;; Query time: 0 msec
;; SERVER: 192.168.5.1#53(192.168.5.1) (UDP)
;; WHEN: Mon Mar 23 15:21:55 WET 2026
;; MSG SIZE rcvd: 134
However, if Unifi is hosting both the CNAME and A records, AGH is also able to resolve it.
So, it seems that AGH starts having issues if the CNAME's target is not hosted in Unifi. If it is, AGH works fine.
I have passed quite some time troubleshooting this with the help of Claude and was able to identify 2 potential bugs, one on AGH and one on Unifi.
After running tcpdump on the AGH while querying from clients and from dig inside AGH, I tracked this down to the DNSSEC DO bit.
AGH's dnsproxy sets the DO flag on outbound queries to the upstream, even though enable_dnssec is set to false in my config. My upstream (Unifi) changes its behavior when it sees the DO flag: it returns only the local authoritative CNAME record and does not chase the CNAME recursively.
Here's the tcpdump from AGH showing the outbound query to Unifi with the DO flag:
10.100.1.55.49366 > 192.168.5.1.53: 62872+ [1au] A? www.example-cname.com. ar: . OPT UDPsize=1232 DO (71)
192.168.5.1.53 > 10.100.1.55.49366: 62872* q: A? www.example-cname.com. 1/0/1 CNAME www.example.com. (118)
Note the DO in the outbound query with only 1 answer in the response.
I confirmed this by running dig directly from AGH:
With DO flag — only CNAME returned (broken):
/opt/adguardhome/work$ dig +dnssec www.example-cname.com "@192.168.5.1"
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; ANSWER SECTION:
www.example-cname.com. 0 IN CNAME www.example.com.
Without DO flag — full answer returned (correct):
/opt/adguardhome/work$ dig +nodnssec www.example-cname.com "@192.168.5.1"
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; ANSWER SECTION:
www.example-cname.com. 0 IN CNAME www.example.com.
www.example.com. 55 IN A 123.123.123.123
The behavior is 100% reproducible.
While this is partly a quirk in how Unifi handles the DO flag, the AGH side of the problem is that dnsproxy should not be setting DO on upstream queries when enable_dnssec is false. This causes breakage with upstream resolvers that alter their response based on the DNSSEC OK bit.
I was not able to figure out a workaround on this issue unfortunately...
Only "workaround", if we can even call it that, would be to not use CNAME records at all in my usecase and instead use A records.
@pyhd You could also try running dig with the +nodnssec flag as a test to see if this will return the IPs or not. If it works, your upstream DNS servers from your ISP seem to have the same behavior then.
I'll create a separate issue regarding the DNSSEC OK bit being set since it should be a bug on the AGH side as the DNSSEC is disabled on my end.
I reproduced the selection behavior deterministically on current AdGuard Home master, which uses dnsproxy v0.83.1.
Parallel mode currently does exactly what its documented contract says: it returns the first non-nil response whose upstream exchange did not return an error. It does not rank otherwise valid DNS messages by answer completeness. With a channel-controlled fast CNAME-only upstream and a slower CNAME+A upstream, parallel mode consistently selected the CNAME-only response in 50 race-enabled runs.
One detail in the report does not reproduce: dnsproxy explicitly does not cache CNAME-only responses to A or AAAA queries. Its existing TestCacheCNAME regression passed 20 times under the race detector with both dnsproxy v0.78.2, used by the reported AdGuard Home v0.107.71, and current v0.83.1.
A CNAME-only response is also not necessarily a negative response. For a recursive upstream it may be incomplete, but a forwarding proxy cannot safely merge or rank divergent upstream responses without defining additional trust, DNSSEC, split-DNS, timeout, and latency semantics.
The Unifi behavior later described here has a separate likely cause tracked in #8307. The broader request to prefer a later useful response over an earlier successful response is related to AdguardTeam/dnsproxy#354.
For A/AAAA queries, fastest_addr is the closest existing mode: it waits for all upstream responses and, in the reproduced one-address case, selected the response containing the A record. It has additional fastest-IP semantics, so it is not an exact replacement for parallel mode.
Given the documented historical behavior and compatibility impact, I recommend treating this as a feature request rather than changing parallel mode in place. If maintainers want a new response-quality selection policy, it should be designed in dnsproxy together with #354 and covered for CNAME/DNAME chains, authoritative NODATA, NXDOMAIN after CNAME, SERVFAIL, timeouts, DNSSEC flags, split-horizon disagreement, and QTYPE=CNAME.
Hello, please update to version v0.107.79 and test it again - please post the results here.
Closed due not reply.
The issue has been closed, its implementation is not planned.