os-bind: BIND is restarted on every interface link-up, including interfaces it does not listen on
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- backend, networking
Línea de trabajo
Start with dns/bind/src/etc/inc/plugins.inc.d/bind.inc, especially the bind_configure() hook registration and bind_configure_do() arguments; compare the interface-aware Unbound hook behavior described in the report. Use the reproduction steps to trigger link-up on an interface without a BIND listen address and check /var/log/system and the named PID. Done means such link-ups do not restart running BIND, while boot, manual reload, and listen-address link-ups still work.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Important notices
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new. (The closest one is #3958, a BIND hang after two quick link changes, closed by the stale bot; it describes a different symptom.)
- The title contains the plugin to which this issue belongs
Describe the bug
Whenever any interface gets a link-up event, BIND is stopped and started again, even if the interface is one BIND does not listen on.
We have two routers joined by a direct cable for pfsync/CARP (a private /24 that is not in BIND's listen addresses). When one router reboots, the other sees that link go down and up about five times. Each link-up runs rc.linkup, then interface_configure(), then the dns plugin hook. os-bind registers that hook as 'dns' => ['bind_configure_do'], so it rebuilds the config and runs a full BIND restart each time. On the router that stayed up, BIND was restarted five or six times within about 30 seconds (about 3 s each), and a monitoring query to it got SERVFAIL in between, so DNS was patchy for the whole network while the other router rebooted.
Since 26.7.9 core passes the interface to the dns hook (core#11083, the Unbound change). Unbound registers the hook as unbound_configure_do:2 and skips interfaces it doesn't care about. os-bind doesn't ask for the interface, so it never sees it. I don't know of a last working version.
To Reproduce
- Bring any interface down and up:
ifconfig <if> down; ifconfig <if> up, or/usr/local/etc/rc.linkup start <if>. - Watch
/var/log/systemforplugins_configure dns (...)andexecute task : bind_configure_do(...). - BIND stops and starts again (the
namedpid changes), whichever interface it was.
Expected behavior
An interface that carries none of BIND's listen addresses should not restart BIND, as with Unbound.
Relevant log files
/var/log/system on the router that stayed up when its peer rebooted: five or six plugins_configure dns (execute task : bind_configure_do(...)) lines within about 30 seconds, each followed by a BIND restart.
Additional context
We tried the same pattern for os-bind: register bind_configure_do:2, and skip the restart when none of the passed interfaces carries an address BIND listens on. BIND still restarts at boot (no interface passed) and starts if it isn't running. Diff below; it applies to current master (bind.inc unchanged since January 2024).
What we tested (HA pair, BIND listening on LAN/VLAN addresses, IPv4 and IPv6). Each case ran three times:
- Before the change, BIND restarted every time on: the pfsync interface (hook only,
rc.linkup, and a realifconfig igc3 down/up, which restarted BIND on both routers); on the second router, an uncabled WAN and a VLAN with a listen address. - After the change, no restart (BIND's pid unchanged, both routers) on: the pfsync interface (hook and
rc.linkup), WAN, a Tailscale interface and an IPv6 tracker interface. Also no restart in 12 observations of a real pfsync link down/up with the change on both routers. - After the change, BIND still restarts for an interface with a listen address (DMZ VLAN, both routers; LAN, WireGuard and a VLAN link-up, second router), when no interface is passed (second router), and it starts when it was stopped beforehand (second router).
- Not tested: a full reboot of the peer with the change in place, and a call with an explicitly empty interface list (core doesn't pass one through
plugins_configure()).
--- a/dns/bind/src/etc/inc/plugins.inc.d/bind.inc
+++ b/dns/bind/src/etc/inc/plugins.inc.d/bind.inc
@@ -36,7 +36,7 @@
function bind_configure()
{
return [
- 'dns' => ['bind_configure_do'],
+ 'dns' => ['bind_configure_do:2'],
];
}
@@ -90,8 +90,44 @@
return [$result];
}
-function bind_configure_do($verbose)
+function bind_match_interface($interface_map)
{
+ if (empty($interface_map)) {
+ /* no interface given (boot, manual reload): restart as before */
+ return true;
+ }
+
+ $model = new \OPNsense\Bind\General();
+ $listen = array_merge(
+ explode(',', (string)$model->listenv4),
+ explode(',', (string)$model->listenv6)
+ );
+
+ foreach (interfaces_addresses($interface_map) as $address) {
+ if (in_array($address['address'], $listen)) {
+ return true;
+ }
+ }
+
+ /*
+ * None of these interfaces carries an address BIND listens on
+ * (wildcard listen addresses are picked up by BIND itself),
+ * so a restart is not needed.
+ */
+ return false;
+}
+
+function bind_configure_do($verbose = false, $interface_map = null)
+{
+ if (!plugins_argument_map($interface_map)) {
+ return;
+ }
+
+ /* try to avoid restarting, but make sure to let it start if it is not running */
+ if (!bind_match_interface($interface_map) && isvalidpid('/var/run/named/pid')) {
+ return;
+ }
+
service_log('Starting BIND...', $verbose);
configd_run('template reload OPNsense/Bind');
Environment
OPNsense 26.7.9 (amd64), os-bind 1.34_4, BIND 9.20.30; two Intel igc-based routers in a CARP/pfsync pair.
AI disclosure: I used Claude (Anthropic), with several different models, to trace the hook path through the core and plugin code and to write and run the tests. I reviewed the result, ran the tests on my own routers, and I'm responsible for the report.
- Lenguaje dominante
- PHP
- Estrellas
- 1.2k
- Forks
- 926
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 25
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de opnsense/plugins
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
opnsense/plugins#5976 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directiveAbiertoincomplete
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
opnsense/plugins#5973 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)Posiblemente ocupada @bringha1 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
q-feeds-connector: "error in configd communication" every update when the Unbound DNSBL rebuild takes longer than 120sPosiblemente ocupada @mhatipog la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de opnsense/plugins
Issues similares
-
15.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
open-telemetry/opentelemetry-php-distro#176 ·
Los mantenedores suelen responder en 2 días
-
No Code Attached Yet
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
joomla/joomla-cms#48941 ·
Los mantenedores suelen responder en 1 día
-
needs-triage Platform(Default)
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug new
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
moodle-an-hochschulen/moodle-theme_boost_union#1500 ·
Los mantenedores suelen responder en 1 día