Services: Dnsmasq DNS & DHCP - extend model with a dns_port property which reflects the current listening port (for dns)

This commit is contained in:
Ad Schellevis 2025-02-20 08:54:51 +01:00
parent 17b5859872
commit 5ea401df84
2 changed files with 11 additions and 0 deletions

View File

@ -37,11 +37,21 @@ use OPNsense\Base\Messages\Message;
*/
class Dnsmasq extends BaseModel
{
/**
* {@inheritdoc}
*/
protected function init()
{
$this->dns_port = !empty((string)$this->port) ? (string)$this->port : '53'; /* port defaults */
}
/**
* {@inheritdoc}
*/
public function performValidation($validateFullModel = false)
{
$this->dns_port = !empty((string)$this->port) ? (string)$this->port : '53'; /* port defaults */
$messages = parent::performValidation($validateFullModel);
foreach ($this->hosts->iterateItems() as $host) {
if (!$validateFullModel && !$host->isFieldChanged()) {

View File

@ -23,6 +23,7 @@
<MinimumValue>0</MinimumValue>
<MaximumValue>65535</MaximumValue>
</port>
<dns_port type="IntegerField" volatile="true"/>
<dns_forward_max type="IntegerField">
<MinimumValue>0</MinimumValue>
</dns_forward_max>