dhcp: allow saving with invalid range when IPv4 server is disabled; closes #7085

In this post-valdation after passing validation we should make sure to prevent
validtion if not enabled.  Contrary to IPv6 the range from/to is mandatory but
doesn't always match especially when changing the IP range or switching interface
assignments.
This commit is contained in:
Franco Fichtner 2023-12-19 09:21:31 +01:00
parent 927c37c135
commit c2f7998c70

View File

@ -311,7 +311,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
if (count($input_errors) == 0) {
if (count($input_errors) == 0 && isset($pconfig['enable'])) {
/* make sure the range lies within the current subnet */
$subnet_start = ip2ulong(long2ip32(ip2long($config['interfaces'][$if]['ipaddr']) & gen_subnet_mask_long($config['interfaces'][$if]['subnet'])));
$subnet_end = ip2ulong(long2ip32(ip2long($config['interfaces'][$if]['ipaddr']) | (~gen_subnet_mask_long($config['interfaces'][$if]['subnet']))));
@ -350,6 +350,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
!empty($config['interfaces'][$if]['descr']) ? htmlspecialchars($config['interfaces'][$if]['descr']) : strtoupper($if));
}
}
// save data
if (count($input_errors) == 0) {
$dhcpdconf = array();