Kea / Dhcp - DHCPv4 replacement, add hostname in reservations https://github.com/opnsense/core/issues/6971

This commit is contained in:
Ad Schellevis 2023-11-11 09:48:18 +01:00
parent 29d456e877
commit 39bc101684
5 changed files with 15 additions and 2 deletions

View File

@ -75,7 +75,10 @@ class Dhcpv4Controller extends ApiMutableModelControllerBase
public function searchReservationAction() public function searchReservationAction()
{ {
return $this->searchBase("reservations.reservation", ['subnet', 'ip_address', 'hw_address', 'description'], "hw_address"); return $this->searchBase("reservations.reservation",
['subnet', 'ip_address', 'hw_address', 'hostname', 'description'],
"hw_address"
);
} }
public function setReservationAction($uuid) public function setReservationAction($uuid)

View File

@ -17,6 +17,12 @@
<type>text</type> <type>text</type>
<help>MAC/Ether address of the client in question</help> <help>MAC/Ether address of the client in question</help>
</field> </field>
<field>
<id>reservation.hostname</id>
<label>Hostname</label>
<type>text</type>
<help>Offer a hostname to the client</help>
</field>
<field> <field>
<id>reservation.description</id> <id>reservation.description</id>
<label>Description</label> <label>Description</label>

View File

@ -77,6 +77,8 @@
<hw_address type="MacAddressField"> <hw_address type="MacAddressField">
<Required>Y</Required> <Required>Y</Required>
</hw_address> </hw_address>
<hostname type="HostnameField">
</hostname>
<description type="TextField"> <description type="TextField">
</description> </description>
</reservation> </reservation>

View File

@ -109,6 +109,7 @@
<th data-column-id="subnet" data-type="string">{{ lang._('Subnet') }}</th> <th data-column-id="subnet" data-type="string">{{ lang._('Subnet') }}</th>
<th data-column-id="ip_address" data-type="string">{{ lang._('IP Address') }}</th> <th data-column-id="ip_address" data-type="string">{{ lang._('IP Address') }}</th>
<th data-column-id="hw_address" data-type="string">{{ lang._('MAC') }}</th> <th data-column-id="hw_address" data-type="string">{{ lang._('MAC') }}</th>
<th data-column-id="hostname" data-type="string">{{ lang._('Hostname') }}</th>
<th data-column-id="description" data-type="string">{{ lang._('Description') }}</th> <th data-column-id="description" data-type="string">{{ lang._('Description') }}</th>
<th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th> <th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr> </tr>

View File

@ -1,7 +1,8 @@
{%- if not helpers.empty('OPNsense.Kea.dhcp4.general.interfaces') and not helpers.empty('OPNsense.Kea.dhcp4.general.enabled') -%} {%- if not helpers.empty('OPNsense.Kea.dhcp4.general.interfaces') and not helpers.empty('OPNsense.Kea.dhcp4.general.enabled') -%}
{%- set reservation_fields = ({ {%- set reservation_fields = ({
'hw-address': 'hw_address', 'hw-address': 'hw_address',
'ip-address': 'ip_address' 'ip-address': 'ip_address',
'hostname': 'hostname'
}) -%} }) -%}
{%- set general = OPNsense.Kea.dhcp4.general -%} {%- set general = OPNsense.Kea.dhcp4.general -%}
{ {