Duplicate/retried DNS queries fail with REFUSED (Fixed in upstream)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dnsmasq (Ubuntu) |
Fix Released
|
Undecided
|
Lena Voytek | ||
Jammy |
Fix Released
|
Undecided
|
Lena Voytek | ||
Kinetic |
Fix Released
|
Undecided
|
Lena Voytek |
Bug Description
[Impact]
When a DNS query fails to complete and the system retries it, subsequent copies of the query will be refused by dnsmasq. The client will automatically receive the REFUSED return value without a retry attempt.
Adding this fix will stop dnsmasq from unnecessarily breaking connections, especially for situations where an internet connection is flaky.
This bug is fixed by patching in an upstream commit - https:/
[Test Plan]
The fix can be tested using 2 lxd containers, 1 for running the fix, and 1 for acting as a dns server.
Start by setting up the dns server container:
# lxc launch images:ubuntu/jammy dns-resolver
# lxc exec dns-resolver bash
# apt update && apt dist-upgrade -y
# systemctl disable systemd-resolved
# systemctl stop systemd-resolved
# unlink /etc/resolv.conf
# echo nameserver 8.8.8.8 | tee /etc/resolv.conf
# apt install net-tools dnsmasq -y
# systemctl enable dnsmasq
Get the container's ip on lxd's network, in this case ifconfig is used, showing 10.62.42.157:
# ifconfig
eth0: flags=4163<
inet 10.62.42.157 netmask 255.255.255.0 broadcast 10.62.42.255
...
Now set up the test container:
# lxc launch images:ubuntu/jammy test-dnsmasq
# lxc exec test-dnsmasq bash
# apt update && apt dist-upgrade -y
# systemctl disable systemd-resolved
# systemctl stop systemd-resolved
# unlink /etc/resolv.conf
Use other container's ip here, along with an ip that does not resolve
# echo "nameserver 10.62.42.157
nameserver 192.0.2.1" | tee /etc/resolv.conf
# apt install dnsmasq -y
# systemctl enable dnsmasq
On the dns server side, set the nameserver to 127.0.0.1 to cause denials on the test server:
# echo nameserver 127.0.0.1 | tee /etc/resolv.conf; systemctl restart dnsmasq
Now ping a known domain on the test container, and while it runs set the dns server side nameserver back to 8.8.8.8:
# ping ubuntu.com
> swap containers
# echo nameserver 8.8.8.8 | tee /etc/resolv.conf; systemctl restart dnsmasq
Ping will continue to not pick up the domain and fails with:
ping: ubuntu.com: Temporary failure in name resolution
With the fix, ping should now pick up the new successful responses:
PING ubuntu.com (185.125.190.29) 56(84) bytes of data.
64 bytes from website-
64 bytes from website-
64 bytes from website-
64 bytes from website-
64 bytes from website-
64 bytes from website-
^C
--- ubuntu.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5005ms
Note: ping is used here instead of another dns tester such as dig because it continues its dns resolution attempts with retry packets even after receiving a REFUSED error. Other programs fail immediately on REFUSED and are unable to send duplicate packets to reproduce the issue.
[Where problems could occur]
This change was added upstream in version 2.87, which means it has not been tested in many situations alongside 2.86. Allowing the retries could lead to a flood of requests to remote DNS servers if the replies are unable to make it back through dnsmasq to the user.
[Other Info]
This bug was fixed in Kinetic in version 2.86-1.1ubuntu2.
[Original Description]
Duplicate or retried DNS queries will return REFUSED for one of the queries causing intermittent failures in clients.
This probably breaks lots of things, but for me is causing 22.04's internet connection sharing to be unstable. It's particularly bad for my Xbox which seems to like sending duplicate queries.
Here's an example capture:
22:37:25.308212 IP 10.42.0.16.54248 > 10.42.0.1.53: 22442+ A? title.auth.
22:37:25.332711 IP 10.42.0.16.54248 > 10.42.0.1.53: 22442+ A? title.auth.
22:37:25.332740 IP 10.42.0.1.53 > 10.42.0.16.54248: 22442 Refused 0/0/0 (41)
22:37:25.353003 IP 10.42.0.1.53 > 10.42.0.16.54248: 22442 2/0/0 CNAME title.auth.
This has been fixed in upstream as of Sept 2021 in the unreleased 2.87 version. It's apparently a regression in version 2.86 (also released in Sept 2021). Ubuntu 22.04 and later all use the broken 2.86 version.
Upstream fix:
https:/
Upstream bug thread:
https:/
Related branches
- git-ubuntu bot: Approve
- Sergio Durigan Junior (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 66 lines (+28/-4)2 files modifieddebian/changelog (+12/-0)
src/forward.c (+16/-4)
- git-ubuntu bot: Approve
- Utkarsh Gupta (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 66 lines (+28/-4)2 files modifieddebian/changelog (+12/-0)
src/forward.c (+16/-4)
Changed in dnsmasq (Ubuntu Kinetic): | |
assignee: | nobody → Lena Voytek (lvoytek) |
Changed in dnsmasq (Ubuntu Jammy): | |
assignee: | nobody → Lena Voytek (lvoytek) |
tags: | added: server-todo |
description: | updated |
Changed in dnsmasq (Ubuntu Jammy): | |
status: | Confirmed → In Progress |
description: | updated |
description: | updated |
description: | updated |
tags: |
added: verification-done removed: verification-needed |
Hello,
Sorry we missed this bug for so long. I can confirm the issue is present in 22.04 and 22.10 and can be fixed with the commit you provided. I created a patch file that can be added to 22.04, attached here. I will mark this bug as confirmed too.
Thanks!