net/isc-dhcp: small change for #5164

This commit is contained in:
Franco Fichtner 2026-01-23 12:40:38 +01:00
parent 14a1301888
commit 7de2634b88
5 changed files with 8 additions and 4 deletions

View file

@ -1,5 +1,6 @@
PLUGIN_NAME= isc-dhcp
PLUGIN_VERSION= 1.0
PLUGIN_REVISION= 1
PLUGIN_COMMENT= ISC DHCPv4/v6 server
PLUGIN_DEPENDS= isc-dhcp44-server
PLUGIN_MAINTAINER= franco@opnsense.org

View file

@ -14,3 +14,4 @@ Plugin Changelog
* First release resembling the core state of 25.7.11
* Minor changes due to "radvd" extraction out of DHCPv6 configuration
* Minor changes regarding "track6" mode handling
* Added DHCPv6 static mappings export

View file

@ -1197,7 +1197,7 @@ EOD;
service_log("done.\n", $verbose);
}
function dhcpd_staticmap($proto = null, $valid_addresses = true, $ifconfig_details = null, $allow_disabled = false)
function dhcpd_staticmap($proto = null, $valid_addresses = true, $ifconfig_details = null, $allow_disabled = false, $for_export = false)
{
$staticmap = [];
foreach (empty($proto) ? [4, 6] : [$proto] as $inet) {
@ -1243,7 +1243,9 @@ function dhcpd_staticmap($proto = null, $valid_addresses = true, $ifconfig_detai
}
if ($domain !== null) {
$domain = preg_replace('/\s*;\s*/', ',', trim($domain));
/* first entry only unless requested */
$domain = !$for_export ? preg_split('/[ ;]+/', $domain)[0] :
preg_replace('/\s*;\s*/', ',', trim($domain));
}
$entry = [

View file

@ -449,7 +449,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
header(url_safe('Location: /services_dhcp.php?if=%s', array($if)));
} elseif ($act == "export") {
$static = dhcpd_staticmap(4, true, null, true);
$static = dhcpd_staticmap(4, true, null, true, true);
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=\"isc_export_{$if}.csv\"");

View file

@ -435,7 +435,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
exit;
} elseif ($act == "export") {
$static = dhcpd_staticmap(6, true, null, true);
$static = dhcpd_staticmap(6, true, null, true, true);
header("Content-Type: text/csv");
header("Content-Disposition: attachment; filename=\"isc_dhcpdv6_export_{$if}.csv\"");