Services: Kea DHCP [new]: Kea DHCPv4 - fix missing default domain in 29e87aa3e4

(ref; https://github.com/opnsense/core/pull/7361)
This commit is contained in:
Ad Schellevis 2024-04-16 12:30:21 +02:00
parent c4b64a417d
commit b551927c89
1 changed files with 11 additions and 2 deletions

View File

@ -140,17 +140,26 @@ class KeaDhcpv4 extends BaseModel
'pools' => [],
'reservations' => []
];
/* standard option-data elements */
foreach ($subnet->option_data->iterateItems() as $key => $value) {
if (!empty((string)$value)) {
$target_fieldname = str_replace('_', '-', $key);
if ((string)$value != '') {
$record['option-data'][] = [
'name' => str_replace('_', '-', $key),
'name' => $target_fieldname,
'data' => (string)$value
];
} elseif ($key == 'domain_name') {
$record['option-data'][] = [
'name' => $target_fieldname,
'data' => (string)Config::getInstance()->object()->system->domain
];
}
}
/* add pools */
foreach (array_filter(explode("\n", $subnet->pools)) as $pool) {
$record['pools'][] = ['pool' => $pool];
}
/* static reservations */
foreach ($this->reservations->reservation->iterateItems() as $key => $reservation) {
if ($reservation->subnet != $subnet_uuid) {
continue;