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
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 51/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- php
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 1.2k
- Fork
- 932
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opnsense/plugins
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsĐang mởsupport
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
opnsense/plugins#5983 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveCó thể đã có người làm @fraenki đã nhận 6 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opnsense/plugins#5973 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Có thể đã có người làm @bringha1 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opnsense/plugins
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/blocks-engine#7881 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
iruzen-dono/workless#117 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
magicsunday/webtrees-docker#285 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Flaky browser test: AreaHeadersTest 'shows Counting on the way while deferred tab counts load'Đang mởarea/tests type/bug when/soon
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbookCó thể đã có người làm @mayankmajeji đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
WordPress/hosting-handbook#521 ·