mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
dnsmasq: look up port conflict via service framework
This commit is contained in:
parent
68f781f430
commit
4cd1b72d4d
@ -82,12 +82,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (isset($pconfig['local_ttl']) && $pconfig['local_ttl'] !== '' && !is_numericint($pconfig['local_ttl'])) {
|
||||
$input_errors[] = gettext("You must specify a valid TTL for local DNS");
|
||||
}
|
||||
$unbound_mdl = new \OPNsense\Unbound\Unbound();
|
||||
$unbound_enabled = (string)$unbound_mdl->general->enabled;
|
||||
$unbound_port = (string)$unbound_mdl->general->port;
|
||||
|
||||
$dnsmasq_port = empty($pconfig['port']) ? "53" : $pconfig['port'];
|
||||
if (!empty($pconfig['enable']) && !empty($unbound_enabled) && $dnsmasq_port == $unbound_port) {
|
||||
$input_errors[] = gettext('Unbound is still active on the same port. Disable it before enabling Dnsmasq.');
|
||||
$port_conflict = service_by_name('*', ['ports' => [$dnsmasq_port]]);
|
||||
if (!empty($pconfig['enable']) && !empty($port_conflict)) {
|
||||
$input_errors[] = sprintf(gettext('%s is currently using this port.'), $port_conflict['description']);
|
||||
}
|
||||
|
||||
if (count($input_errors) == 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user