diff options
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/load_balancer_pool_edit.php | 14 | ||||
-rwxr-xr-x | usr/local/www/load_balancer_virtual_server_edit.php | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index d42e0b6..81a548c 100755 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -94,15 +94,21 @@ if ($_POST) { if (is_array($_POST['servers'])) { foreach($pconfig['servers'] as $svrent) { - if (!is_ipaddr($svrent)) { - $input_errors[] = sprintf(gettext("%s is not a valid IP address (in \"enabled\" list)."), $svrent); + if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) { + $input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"enabled\" list)."), $svrent); + } + else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) { + $input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"enabled\" list)."), $svrent); } } } if (is_array($_POST['serversdisabled'])) { foreach($pconfig['serversdisabled'] as $svrent) { - if (!is_ipaddr($svrent)) { - $input_errors[] = sprintf(gettext("%s is not a valid IP address (in \"disabled\" list)."), $svrent); + if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) { + $input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"disabled\" list)."), $svrent); + } + else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) { + $input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"disabled\" list)."), $svrent); } } } diff --git a/usr/local/www/load_balancer_virtual_server_edit.php b/usr/local/www/load_balancer_virtual_server_edit.php index 7a2d792..ff59fd9 100755 --- a/usr/local/www/load_balancer_virtual_server_edit.php +++ b/usr/local/www/load_balancer_virtual_server_edit.php @@ -91,8 +91,10 @@ if ($_POST) { if (!is_port($_POST['port'])) $input_errors[] = gettext("The port must be an integer between 1 and 65535."); - if(!is_ipaddr($_POST['ipaddr'])) - $input_errors[] = sprintf(gettext("%s is not a valid IP address."), $_POST['ipaddr']); + if (!is_ipaddr($_POST['ipaddr']) && !is_subnetv4($_POST['ipaddr'])) + $input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet."), $_POST['ipaddr']); + else if (is_subnetv4($_POST['ipaddr']) && subnet_size($_POST['ipaddr']) > 64) + $input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses."), $_POST['ipaddr']); if (!$input_errors) { $vsent = array(); |