Skip to content

Commit

Permalink
feat(dhcp): add dhcp-socket-type option to Kea DHCP server (#8069)
Browse files Browse the repository at this point in the history
* feat(dhcp): add dhcp-socket-type option to Kea DHCP server

This adds the ability to configure the DHCP socket type (UDP/Raw) in the
Kea DHCP server settings through the web UI.

- Added socket type field to model definition
- Added dropdown in general settings form
- Updated config generation to include socket type setting

* changed default value for dhcp_socket_type to raw

* bumped version number for KeaDhcpv4.xml
  • Loading branch information
pieewiee authored Nov 19, 2024
1 parent e70cd0c commit 37c9dea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<type>checkbox</type>
<help>Automatically add a basic set of firewall rules to allow dhcp traffic, more fine grained controls can be offered manually when disabling this option.</help>
</field>
<field>
<id>dhcpv4.general.dhcp_socket_type</id>
<label>Socket Type</label>
<type>dropdown</type>
<help>Socket type used for DHCP communication</help>
</field>
<field>
<type>header</type>
<label>High Availability</label>
Expand Down
3 changes: 2 additions & 1 deletion src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ public function generateConfig($target = '/usr/local/etc/kea/kea-dhcp4.conf')
'Dhcp4' => [
'valid-lifetime' => (int)$this->general->valid_lifetime->__toString(),
'interfaces-config' => [
'interfaces' => $this->getConfigPhysicalInterfaces()
'interfaces' => $this->getConfigPhysicalInterfaces(),
'dhcp-socket-type' => (string)$this->general->dhcp_socket_type
],
'lease-database' => [
'type' => 'memfile',
Expand Down
10 changes: 9 additions & 1 deletion src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/Kea/dhcp4</mount>
<version>1.0.1</version>
<version>1.0.2</version>
<description>Kea DHCPv4 configuration</description>
<items>
<general>
Expand All @@ -19,6 +19,14 @@
<Required>Y</Required>
<Default>1</Default>
</fwrules>
<dhcp_socket_type type="OptionField">
<Default>raw</Default>
<Required>Y</Required>
<OptionValues>
<udp>udp</udp>
<raw>raw</raw>
</OptionValues>
</dhcp_socket_type>
</general>
<ha>
<enabled type="BooleanField">
Expand Down

0 comments on commit 37c9dea

Please sign in to comment.