mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-03-04 00:01:12 -05:00
Support edns-tcp-keepalive EDNS0 Option - RFC7828 #3146
Labels
No labels
P1: Critical
P2: High
P3: Medium
P4: Low
UI
bug
cannot reproduce
compatibility
dependencies
docker
documentation
duplicate
enhancement
enhancement
external libs
feature request
good first issue
help wanted
infrastructure
invalid
localization
needs investigation
performance
potential-duplicate
question
recurrent
research
snap
waiting for data
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AdGuardHome#3146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rskallies on GitHub (Oct 28, 2021).
Originally assigned to: @ainar-g on GitHub.
Problem Description
Using latest stubby / getdns as DOT client is not possible without running stubby with the option idle_timeout: 0 because
on the AdGuard server side the edns-tcp-keepalive EDNS0 Option seems not to be parsed. Instead the server logs
[info] error handling TCP packet: dns: buffer size too small
Proposed Solution
The project already use the https://github.com/miekg/dns/ Go library already which supports this feature.
It would be nice either to support this also or at least emit a proper error message if such option is requested by a client and the server cannot handle this feature.
It took me a while to get this figured out and to get a Stubby client working.
@Harvester57 commented on GitHub (Dec 2, 2021):
It took me a long time to find this post and the solution to my problem: using DoT on an Asus router with Merlin firmware, I would always hit the same problem you described, where pointing to NextDNS works flawlessly.
Upon implementing your solution, I was able to restore the connection with my AdGuard server. So first, thank you for your post, and second, I concur with your proposition to add the support for edns-tcp-keepalive !
@gspannu commented on GitHub (Dec 10, 2021):
@rskallies @Harvester57
I am running AdGuard Home on a VPS and Asus RTAX88U running Merlin firmware 386.3.2
I am unable to get AdGuard Home working on Asus Router when using Beta/Edge version (while NextDNS works without any issue).
1) Could you please elaborate how you fixed this issue? What changes did you make on the Asus Router? Which files/ scripts to edit/ add?
Do you have the same issue?
@Harvester57 commented on GitHub (Dec 11, 2021):
Hi @gspannu,
I created the post-conf script for Stubby (/jffs/scripts/stubby.postconf) with the following content:
You don't need the
edns_client_subnet_private: 1line if you don't intend to use ECS. Theidle_timeout: 0is the only parameter you need to change.Do not forget to add the execute bit to your script:
chmod +x /jffs/scripts/stubby.postconfand then you can restart the Stubby service.P.S. : I assume you already have a USB key and external JFFS scripts support enabled, and that you can connect to your router through SSH
@gspannu commented on GitHub (Dec 13, 2021):
Thanks for your response.
Another quick query if could help me.
AdGuard complains about chain of trust when adding the certificate, but if I copy my self-signed/ self-generated RootCA to /etc/ssl/certs path, then the self signed certificate is accepted by AdGuardHome.
To test that my self signed cert is actually working on DoT/ DoH...
Q: How do I copy this RootCA to Asus Router?
If I try and scp the file to /etc/certs... it fails with read-only error.
@Harvester57 commented on GitHub (Dec 13, 2021):
You can copy you cert in your /jffs partition (for example /jffs/mycert/mycert.pem) and use a binding mount with the /etc/ssl directory :
mount -o bind /jffs/mycert/mycert.pem /etc/ssl/certs/mycert.pemYou should now see your cert in
/etc/ssl/certs.You can automatically do this during the router boot phase, by editing the file
/jffs/scripts/services-start, and by adding the previous line in it.@gspannu commented on GitHub (Dec 13, 2021):
You are a star.... Thanks.
@ameshkov commented on GitHub (Dec 14, 2021):
Not really: https://github.com/miekg/dns/pull/1317
@ainar-g if the PR does not get merged until we release AGH, I suggest adding a replace to go.mod.
@rskallies commented on GitHub (Dec 14, 2021):
@ameshkov Thank you for digging even deeper and for creating a PR to upstream. Spotting / fixing this exceeded my skills. 😄
👍
@ainar-g commented on GitHub (Dec 15, 2021):
@rskallies, the latest
edgebuild includes Andrey's version of the fix. Can you check if that fixes your issue?@rskallies commented on GitHub (Dec 15, 2021):
Yes it does. 👍
Stubby connects successful when setting the (default) value idle_timeout to 10000 again.
Still wonder why dnsproxy does not connect via QUIC - would prefer to use Adguard dnsproxy instead of Stubby on this MIPS based router. I'll create another issue with more information later.
@ainar-g commented on GitHub (Dec 15, 2021):
Thanks for testing! I'll close this issue then. I've left a TODO in the code to switch back to the original library once the PR is merged there.
@ameshkov commented on GitHub (Dec 15, 2021):
This one is strange. Do you specify the port number when running dnsproxy?
@rskallies commented on GitHub (Dec 15, 2021):
Yes
-u quic://fully.qualified.domain:784, since using dnsproxy a long time on x86_64 and arm64 devices which defaulted to port 784 then. I already tested using various different ports in case of a middleware is blocking something but still no success. Using the same config / arguments for dnsproxy from an x86 or arm64 device which is behind the affected MIPS / OpenWRT based router works like a charm. Only if running dnsproxy directly on the router is causing this. I also disabled any firewall rules for testing purposes on the router but no success so far.Log on the Adguard Server is showing
"got error when accepting a new QUIC stream: timeout: no recent network activity"
Log on the client (dnsproxy v0.39.13) is showing
"[debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).udpHandlePacket(): error handling DNS (udp) request: talking to dnsUpstream failed, cause: failed to open QUIC session to quic://fully.qualified.domain:784, cause: timeout: handshake did not complete in time"
Seems I need to enable debug on the server and see what is logged then.
@ameshkov commented on GitHub (Dec 15, 2021):
Hm, it looks as if something is wrong with UDP to port 784 in general. As if it's dropping packets somehow.
@rskallies commented on GitHub (Dec 15, 2021):
I disabled any firewalling on both sides, changed UDP port with no success. And interestingly it also does not work with DoT. Using same dnsproxy version from a client behind the router does work for both DoQ / Quic and DoT for the same AdGuard server. Really strange.
I'll try to debug this using tcpdump on both sides.
@gspannu commented on GitHub (Dec 15, 2021):
Confirmed. The issue is now fixed in v0.107.0-b.16. 👍
Just tested and removed the post.conf script for Stubby in Asus Merlin Router, all works as expected.