diff options
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 7ded7ae..8db8764 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -113,13 +113,23 @@ if ($_POST) { if (is_ipaddr($config['interfaces'][$_POST['interface']]['ipaddr']) && (empty($_POST['gateway']) || $_POST['gateway'] == "dynamic")) $input_errors[] = gettext("Dynamic gateway values cannot be specified for interfaces with a static ip configuration."); } - $parent_ip = get_interface_ip($_POST['interface']); - if (is_ipaddr($parent_ip)) { + if(is_ipaddrv6($_POST['gateway'])) { + $parent_ip = get_interface_ipv6($_POST['interface']); + } else { + $parent_ip = get_interface_ip($_POST['interface']); + } + if (is_ipaddrv4($parent_ip)) { $parent_sn = get_interface_subnet($_POST['interface']); if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['gateway'])) { $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); } } + if (is_ipaddrv6($parent_ip)) { + $parent_sn = get_interface_subnetv6($_POST['interface']); + if(!ip_in_subnet($_POST['gateway'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn)) { + $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']); + } + } } if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { $input_errors[] = gettext("A valid monitor IP address must be specified."); |