dnsmasq: When dhcp-fqdn is set, there must be a domain without an address set as default (#8405)

* dnsmasq: When dhcp-fqdn is set, there must be a domain without an address set as default
This commit is contained in:
Monviech 2025-03-07 08:19:57 +01:00 committed by GitHub
parent b7ed45db20
commit b11baac9d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 31 additions and 0 deletions

View File

@ -29,12 +29,24 @@
namespace OPNsense\Dnsmasq\Api;
use OPNsense\Base\ApiMutableModelControllerBase;
use OPNsense\Core\Config;
class SettingsController extends ApiMutableModelControllerBase
{
protected static $internalModelName = 'dnsmasq';
protected static $internalModelClass = '\OPNsense\Dnsmasq\Dnsmasq';
/**
* @inheritdoc
*/
public function getAction()
{
$data = parent::getAction();
$data[self::$internalModelName]['dhcp']['this_domain'] = (string)Config::getInstance()->object()->system->domain;
return $data;
}
/* hosts */
public function searchHostAction()
{

View File

@ -125,6 +125,12 @@
<type>checkbox</type>
<help>In the default mode, we insert the unqualified names of DHCP clients into the DNS, in which case they have to be unique. Using this option the unqualified name is no longer put in the DNS, only the qualified name.</help>
</field>
<field>
<id>dnsmasq.dhcp.domain</id>
<label>DHCP default domain</label>
<type>text</type>
<help>To ensure that all names have a domain part, there must be a default domain specified when dhcp-fqdn is set. Leave empty to use the system domain.</help>
</field>
<field>
<id>dnsmasq.dhcp.lease_max</id>
<label>DHCP max leases</label>

View File

@ -38,6 +38,10 @@
<Multiple>Y</Multiple>
</no_interface>
<fqdn type="BooleanField"/>
<domain type="HostnameField">
<IsDNSName>Y</IsDNSName>
<IpAllowed>N</IpAllowed>
</domain>
<lease_max type="IntegerField">
<MinimumValue>0</MinimumValue>
</lease_max>

View File

@ -28,6 +28,14 @@
$( document ).ready(function() {
let data_get_map = {'frm_settings':"/api/dnsmasq/settings/get"};
mapDataToFormUI(data_get_map).done(function(data){
try {
$("#dnsmasq\\.dhcp\\.domain").attr(
"placeholder",
data.frm_settings.dnsmasq.dhcp.this_domain
);
} catch (e) {
null;
}
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
updateServiceControlUI('dnsmasq');

View File

@ -31,6 +31,7 @@ dhcp-lease-max={{dnsmasq.dhcp.lease_max}}
{% if dnsmasq.dhcp.fqdn == '1' %}
dhcp-fqdn
domain={{dnsmasq.dhcp.domain|default(system.domain)}}
{% endif %}
{% if dnsmasq.dhcp.authoritative == '1' %}