diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile index e8d39960e..839e83462 100644 --- a/net/isc-dhcp/Makefile +++ b/net/isc-dhcp/Makefile @@ -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 diff --git a/net/isc-dhcp/pkg-descr b/net/isc-dhcp/pkg-descr index 1c04f4132..8e9525483 100644 --- a/net/isc-dhcp/pkg-descr +++ b/net/isc-dhcp/pkg-descr @@ -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 diff --git a/net/isc-dhcp/src/etc/inc/plugins.inc.d/dhcpd.inc b/net/isc-dhcp/src/etc/inc/plugins.inc.d/dhcpd.inc index 87552f2f7..96900d285 100644 --- a/net/isc-dhcp/src/etc/inc/plugins.inc.d/dhcpd.inc +++ b/net/isc-dhcp/src/etc/inc/plugins.inc.d/dhcpd.inc @@ -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 = [ diff --git a/net/isc-dhcp/src/www/services_dhcp.php b/net/isc-dhcp/src/www/services_dhcp.php index d53b86867..6b00cc16e 100644 --- a/net/isc-dhcp/src/www/services_dhcp.php +++ b/net/isc-dhcp/src/www/services_dhcp.php @@ -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\""); diff --git a/net/isc-dhcp/src/www/services_dhcpv6.php b/net/isc-dhcp/src/www/services_dhcpv6.php index 6fc711279..dfe2e587e 100644 --- a/net/isc-dhcp/src/www/services_dhcpv6.php +++ b/net/isc-dhcp/src/www/services_dhcpv6.php @@ -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\"");