summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2009-11-28 00:43:01 +0100
committerSeth Mos <seth.mos@xs4all.nl>2009-11-28 00:43:01 +0100
commite7d3b8f4b8aa428882dd1f955027af8580690010 (patch)
tree5a749d1d3b8070f2085d999b9d13e8f3d5486bdd /usr/local/www/system_gateways_edit.php
parente489f87d99bbbc88a7eddf4a53f8db24490d685c (diff)
downloadpfsense-e7d3b8f4b8aa428882dd1f955027af8580690010.zip
pfsense-e7d3b8f4b8aa428882dd1f955027af8580690010.tar.gz
Add input validation to check if the gateway IP is in the local subnet for that interface.
Needs testing, no idea if this works for ppp or pppoe interfaces.
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-xusr/local/www/system_gateways_edit.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 6c192a8..c3aabb6 100755
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -93,6 +93,11 @@ if ($_POST) {
if ($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) {
$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 in the interface subnet";
+ }
+ }
if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) {
$input_errors[] = "A valid monitor IP address must be specified.";
}
OpenPOWER on IntegriCloud