summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2009-12-12 23:46:25 -0500
committerChris Buechler <cmb@pfsense.org>2009-12-12 23:46:25 -0500
commitb29b1a339cf13010c64a58daa2ec5ee31b0391bd (patch)
treea50219e4061bcf89144d50314e5de7026383581e /usr/local/www/system_gateways_edit.php
parent7b995bec3f7c389228688206aae0b30d63b09340 (diff)
downloadpfsense-b29b1a339cf13010c64a58daa2ec5ee31b0391bd.zip
pfsense-b29b1a339cf13010c64a58daa2ec5ee31b0391bd.tar.gz
fix input validation of gateways. Ticket #173
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-xusr/local/www/system_gateways_edit.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 415823f..c588ca5 100755
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -94,8 +94,10 @@ if ($_POST) {
$input_errors[] = "A valid gateway IP address must be specified.";
}
if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) {
- if(! ip_in_subnet($_POST['gateway'], get_interface_subnet($interface))) {
- $input_errors[] = "The Address {$_POST['gateway']} does not lie within the chosen interface's subnet";
+ $parent_ip = get_interface_ip($_POST['interface']);
+ $parent_sn = get_interface_subnet($_POST['interface']);
+ if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) {
+ $input_errors[] = "The Address {$_POST['gateway']} does not lie within the chosen interface's subnet.";
}
}
if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) {
OpenPOWER on IntegriCloud