dns/dnscrypt-proxy: restarted on every interface link-up and can deadlock with Unbound on DoH bootstrap ("waiting for at least one server to be reachable"); ignore_system_dns is in the template but not in the model
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 51/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- backend, networking
Direzione di ricerca
Read src/opnsense/service/templates/OPNsense/Dnscryptproxy/dnscrypt-proxy.toml and the dnscrypt-proxy model in General.xml; the issue says the template supports ignore_system_dns, but the model has no field for it. Then trace dnscryptproxy_configure_do() and compare its interface handling with the Unbound fix in core#11083. Done means the setting can be configured and LAN link-up no longer causes an unnecessary restart or a DNS bootstrap loop.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Important notices
- I have read the contributing guide
- I have searched the existing issues and found no duplicate
Describe the bug
With Unbound forwarding "." to dnscrypt-proxy (127.0.0.1:5353) and dnscrypt-proxy using a DoH server given by hostname, a LAN link-up event can leave DNS broken until manual intervention.
On link-up, rc.linkup runs the dns plugin hook. dnscryptproxy_configure_do() ignores the interface argument and always runs template reload + dnscryptproxy restart, and in the same second Unbound is reconfigured as well:
20:02:11 /usr/local/etc/rc.linkup: plugins_configure dns (,lan)
20:02:11 /usr/local/etc/rc.linkup: plugins_configure dns (execute task : dnscryptproxy_configure_do())
20:02:12 /usr/local/etc/rc.linkup: plugins_configure dns (execute task : unbound_configure_do(,lan))
dnscrypt-proxy then has to resolve the DoH hostname (dns.nextdns.io). Because the generated config always contains ignore_system_dns = false, it uses the system resolver first. /etc/resolv.conf points to 127.0.0.1 (Unbound), and Unbound forwards everything to dnscrypt-proxy, which is not up yet. The result is a resolution loop:
[2026-11-30 20:02:12] [NOTICE] Now listening to 127.0.0.1:5353 [UDP]
[2026-11-30 20:02:17] [ERROR] Get "https://dns.nextdns.io/<profile>?dns=...": context deadline exceeded
[2026-11-30 20:02:17] [NOTICE] dnscrypt-proxy is waiting for at least one server to be reachable
dnscrypt-proxy stays in that state. A direct DoH request from the firewall with curl succeeds in ~0.1 s, so the upstream is fine. Unbound additionally marks the forwarder as down in its infra cache:
unbound: error: SERVFAIL <redirector.googlevideo.com. A IN>: all the configured stub or forward servers failed, at zone . no server to query nameserver address
All names that are not cached return SERVFAIL (for example YouTube video hosts), while cached names keep working, which makes it look like a partial block. Recovery required a second configctl dnscryptproxy restart (after Unbound had the DoH hostname cached again) plus unbound-control flush_infra all. On this day there were several LAN link-up events, and each one carries this risk.
Two observations in the plugin
-
ignore_system_dnsis handled in the template but cannot be set:src/opnsense/service/templates/OPNsense/Dnscryptproxy/dnscrypt-proxy.toml{% if helpers.exists('OPNsense.dnscryptproxy.general.ignore_system_dns') and OPNsense.dnscryptproxy.general.ignore_system_dns == '1' %} ignore_system_dns = true {% else %} ignore_system_dns = falseGeneral.xmlhas noignore_system_dnsfield, so this branch can never become true from the GUI/model. Withignore_system_dns = true, the bootstrap resolver (fallback_resolver, e.g. 9.9.9.9:53) would be used directly and the loop could not happen. -
dnscryptproxy_configure_do($verbose)restarts the service on everydnshook call, regardless of the interface. dnscrypt-proxy here only listens on127.0.0.1:5353, so a LAN link-up does not need a restart. This is the same pattern that was fixed for Unbound in opnsense/core#11083 (c82b4c8).
To Reproduce
- Unbound: Query Forwarding "." → 127.0.0.1 port 5353 (Unbound as resolver for clients, dnscrypt-proxy as upstream).
- dnscrypt-proxy: one DoH server via hostname stamp (here NextDNS
sdns://...dns.nextdns.io/<profile>), bootstrap9.9.9.9:53. - System DNS: 127.0.0.1 first in
/etc/resolv.conf(default when Unbound is enabled). - Trigger a LAN link-up (unplug/replug a client port or reboot the client on a single-port LAN).
- dnscrypt-proxy often hangs with "waiting for at least one server to be reachable", and uncached lookups through Unbound return SERVFAIL.
Expected behavior
- A LAN link-up should not restart dnscrypt-proxy when it only listens on localhost (or at least not without need).
ignore_system_dnsshould be configurable (or default to true when Unbound forwards to dnscrypt-proxy), so the DoH hostname is resolved via the bootstrap resolver instead of through Unbound.
Workaround
An Unbound Query Forwarding entry only for the DoH hostname (dns.nextdns.io) to a plain resolver, so Unbound can always resolve it even while dnscrypt-proxy is down. (Forwarding the whole nextdns.io domain is not ideal, because then test.nextdns.io is answered by the other resolver as well.)
Environment
- OPNsense 26.7.10p1 (amd64)
- os-dnscrypt-proxy 1.17, dnscrypt-proxy2 2.1.15_11
- Unbound forwarding to dnscrypt-proxy (127.0.0.1:5353), DoH upstream NextDNS
- Intel Core Ultra 7 155H, I226 NICs
- Lingua principale
- PHP
- Stelle
- 1.2k
- Fork
- 932
- Merge medio
- 1g 11h
- PR unite (30g)
- 22
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di opnsense/plugins
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsApertasupport
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
opnsense/plugins#5983 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveForse già presa @fraenki l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
opnsense/plugins#5973 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Forse già presa @bringha1 l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di opnsense/plugins
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#7881 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
iruzen-dono/workless#117 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
magicsunday/webtrees-docker#285 ·
I maintainer di solito rispondono entro 1 giorno
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Apertaarea/tests type/bug when/soon
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookForse già presa @mayankmajeji l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
WordPress/hosting-handbook#521 ·