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
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 51/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- php
- 領域
- backend, networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- PHP
- スター
- 1.2k
- フォーク
- 932
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 22
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opnsense/plugins のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) failsオープンsupport
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
opnsense/plugins#5983 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directive対応中かも @fraenki が 6 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opnsense/plugins#5973 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)対応中かも @bringha1 が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
opnsense/plugins の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/blocks-engine#7881 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
magicsunday/webtrees-docker#285 ·
メンテナーはふだん 1 日以内に返信
-
area/tests type/bug when/soon
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbook対応中かも @mayankmajeji が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
WordPress/hosting-handbook#521 ·