Services / DHCPv4 - static entries: add "none" option to gateway setting. Although I really don't like how "none" is a valid option, it will be more consistent with the overal experience. closes https://github.com/opnsense/core/issues/4843

This commit is contained in:
Ad Schellevis 2021-03-18 20:20:37 +01:00
parent e16d889691
commit b2f6cf581f
2 changed files with 6 additions and 4 deletions

View File

@ -1107,7 +1107,7 @@ EOD;
$dhcpdconf .= " option root-path \"{$sm['rootpath']}\";\n";
}
if (!empty($sm['gateway']) && ($sm['gateway'] != $dhcpifconf['gateway'])) {
if (!empty($sm['gateway']) && $sm['gateway'] != "none" && ($sm['gateway'] != $dhcpifconf['gateway'])) {
$dhcpdconf .= " option routers {$sm['gateway']};\n";
}

View File

@ -164,7 +164,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
if (!empty($pconfig['gateway']) && !is_ipaddrv4($pconfig['gateway'])) {
if (!empty($pconfig['gateway']) && $pconfig['gateway'] != "none" && !is_ipaddrv4($pconfig['gateway'])) {
$input_errors[] = gettext("A valid IP address must be specified for the gateway.");
}
@ -173,7 +173,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
}
if (is_subnetv4($parent_net) && !empty($pconfig['gateway'])) {
if (is_subnetv4($parent_net) && $pconfig['gateway'] != "none" && !empty($pconfig['gateway'])) {
if (!ip_in_subnet($pconfig['gateway'], $parent_net) && !ip_in_interface_alias_subnet($if, $pconfig['gateway'])) {
$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
}
@ -420,7 +420,9 @@ include("head.inc");
<td>
<input name="gateway" type="text" value="<?=$pconfig['gateway'];?>" />
<div class="hidden" data-for="help_for_gateway">
<?=gettext("The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network.");?>
<?=gettext('The default is to use the IP on this interface of the firewall as the gateway. '.
'Specify an alternate gateway here if this is not the correct gateway for your network. ' .
'Type "none" for no gateway assignment.');?>
</div>
</td>
</tr>