diff options
author | smos <seth.mos@dds.nl> | 2012-06-18 18:37:20 +0200 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2012-06-18 18:37:20 +0200 |
commit | 2972b3e786bb1c4b7196e42bd6d21e8363b0f8fe (patch) | |
tree | 77021d51e62475acc81fd4948c70360cc78628df /usr/local/www/system_gateways_edit.php | |
parent | 6be0280159d71f7de716c082c7c5dc96be6bc864 (diff) | |
download | pfsense-2972b3e786bb1c4b7196e42bd6d21e8363b0f8fe.zip pfsense-2972b3e786bb1c4b7196e42bd6d21e8363b0f8fe.tar.gz |
Now that we actually have a IP protocol tag in the config.xml we can make this check a lot simpler and do less guessing.
Redmine ticket #2503
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 84a0b32..033b3e6 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -150,13 +150,22 @@ if ($_POST) { if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { $input_errors[] = gettext("A valid monitor IP address must be specified."); } + /* only allow correct IPv4 and IPv6 gateway addresses */ + if (($_POST['gateway'] <> "") && is_ipaddr($_POST['gateway']) && $_POST['gateway'] != "dynamic") { + if(is_ipaddrv6($_POST['gateway']) && ($_POST['ipprotocol'] == "inet")) { + $input_errors[] = gettext("The IPv6 gateway address '{$_POST['gateway']}' can not be used as a IPv4 gateway'."); + } + if(is_ipaddrv4($_POST['gateway']) && ($_POST['ipprotocol'] == "inet6")) { + $input_errors[] = gettext("The IPv4 gateway address '{$_POST['gateway']}' can not be used as a IPv6 gateway'."); + } + } + /* only allow correct IPv4 and IPv6 monitor addresses */ if (($_POST['monitor'] <> "") && is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { - /* check if we can figure out the address family */ - if(is_ipaddrv6($_POST['monitor']) && (interface_has_gatewayv6($_POST['interface'])) && $_POST['gateway'] != "dynamic") { - $input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used with a IPv4 gateway'."); + if(is_ipaddrv6($_POST['monitor']) && ($_POST['ipprotocol'] == "inet")) { + $input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used on a IPv4 gateway'."); } - if(is_ipaddrv4($_POST['monitor']) && (interface_has_gateway($_POST['interface'])) && $_POST['gateway'] != "dynamic") { - $input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used with a IPv4 gateway'."); + if(is_ipaddrv4($_POST['monitor']) && ($_POST['ipprotocol'] == "inet6")) { + $input_errors[] = gettext("The IPv4 monitor address '{$_POST['monitor']}' can not be used on a IPv6 gateway'."); } } |