From c2f7998c70e7a5ce814f65dd4cb4251733a4ee81 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 19 Dec 2023 09:21:31 +0100 Subject: [PATCH] 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. --- src/www/services_dhcp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/www/services_dhcp.php b/src/www/services_dhcp.php index 4af036f29..4c6feda85 100644 --- a/src/www/services_dhcp.php +++ b/src/www/services_dhcp.php @@ -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();