From ffe1badd2ced2bdf459cc6fabbae8a21cce7bbc0 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 23 Aug 2024 08:50:44 +0200 Subject: [PATCH] dns/rfc2136: convert to newwanip_map event --- dns/rfc2136/Makefile | 2 +- dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dns/rfc2136/Makefile b/dns/rfc2136/Makefile index f4ac272b2..176f5376f 100644 --- a/dns/rfc2136/Makefile +++ b/dns/rfc2136/Makefile @@ -1,6 +1,6 @@ PLUGIN_NAME= rfc2136 PLUGIN_VERSION= 1.8 -PLUGIN_REVISION= 2 +PLUGIN_REVISION= 3 PLUGIN_COMMENT= RFC-2136 Support PLUGIN_MAINTAINER= franco@opnsense.org PLUGIN_DEPENDS= bind-tools diff --git a/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc b/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc index 25c3fc914..73cf42bc0 100644 --- a/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc +++ b/dns/rfc2136/src/etc/inc/plugins.inc.d/rfc2136.inc @@ -34,7 +34,7 @@ function rfc2136_configure() return [ 'bootup' => ['rfc2136_configure_do'], 'local' => ['rfc2136_configure_do'], - 'newwanip' => ['rfc2136_configure_do:2'], + 'newwanip_map' => ['rfc2136_configure_map:2'], ]; } @@ -87,7 +87,7 @@ function rfc2136_cache_file($dnsupdate, $ipver = 4) return "/var/cache/rfc2136_{$dnsupdate['interface']}_{$dnsupdate['host']}_{$dnsupdate['server']}{$ipver}.cache"; } -function rfc2136_configure_do($verbose = false, $int = '', $updatehost = '', $forced = false) +function rfc2136_configure_do($verbose = false, $int = null, $updatehost = '', $forced = false) { global $config; @@ -95,12 +95,15 @@ function rfc2136_configure_do($verbose = false, $int = '', $updatehost = '', $fo return; } + /* $int is passed as an optional CSV so transform into empty array when not set */ + $int = !empty($int) ? explode(',', $int) : []; + service_log('Configuring RFC 2136 clients...', $verbose); foreach ($config['dnsupdates']['dnsupdate'] as $i => $dnsupdate) { if (!isset($dnsupdate['enable'])) { continue; - } elseif (!empty($int) && $int != $dnsupdate['interface']) { + } elseif (count($int) && !in_array($dnsupdate['interface'], $int)) { continue; } elseif (!empty($updatehost) && ($updatehost != $dnsupdate['host'])) { continue;