summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorEvgeny Yurchenko <ey@tm-k.com>2011-07-07 18:10:40 -0400
committerEvgeny Yurchenko <ey@tm-k.com>2011-07-07 18:10:40 -0400
commit9bc59815c6eba7051a401404d4d0b0c7842a9d2f (patch)
treeba7f183057a4fd0f18a5fc3948a1348795f250f6 /usr/local
parent10f5d53cbf453ff8440e5de5cb09cce72deb2bc3 (diff)
downloadpfsense-9bc59815c6eba7051a401404d4d0b0c7842a9d2f.zip
pfsense-9bc59815c6eba7051a401404d4d0b0c7842a9d2f.tar.gz
Bug #1641 fix. DHCP server default gateway needs input validation.
Diffstat (limited to 'usr/local')
-rwxr-xr-xusr/local/www/services_dhcp.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index d02fef6..fdd70a9 100755
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -216,6 +216,13 @@ if ($_POST) {
$input_errors[] = gettext("A valid IP address must be specified for the gateway.");
if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2'])))
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
+ $parent_ip = get_interface_ip($_POST['if']);
+ if (is_ipaddr($parent_ip)) {
+ $parent_sn = get_interface_subnet($_POST['if']);
+ if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway'])) {
+ $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
+ }
+ }
if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2'])))
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary DNS servers.");
OpenPOWER on IntegriCloud