diff options
author | Phil Davis <phil.davis@inf.org> | 2015-08-28 20:55:09 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-08-28 20:55:09 +0545 |
commit | 89735da238ed1b173942bdc24e4bc2f4c8543555 (patch) | |
tree | 0ea8c76b7a1860d1c4f1a07ee7e3cd7e0638b673 | |
parent | 206154295194d88942f419dd4c8d2c824963cf1c (diff) | |
download | pfsense-89735da238ed1b173942bdc24e4bc2f4c8543555.zip pfsense-89735da238ed1b173942bdc24e4bc2f4c8543555.tar.gz |
Ignore DHCP pools that are out of range RELENG_2_2
Backport of https://github.com/pfsense/pfsense/pull/1824
-rw-r--r-- | etc/inc/services.inc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index ffc131c..2ea6110 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -675,8 +675,16 @@ EOPP; $dhcpdconf .= "subnet {$subnet} netmask {$subnetmask} {\n"; -// Setup pool options + // Setup pool options foreach($all_pools as $poolconf) { + if (!(ip_in_subnet($poolconf['range']['from'], "{$subnet}/{$ifcfgsn}") && ip_in_subnet($poolconf['range']['to'], "{$subnet}/{$ifcfgsn}"))) { + // If the user has changed the subnet from the interfaces page and applied, + // but has not updated the DHCP range, then the range to/from of the pool can be outside the subnet. + // In that case, ignore the pool and post an error. + $error_msg = sprintf(gettext("Invalid DHCP pool %s - %s for %s subnet %s/%s detected. Please correct the settings in Services, DHCP Server"), $poolconf['range']['from'], $poolconf['range']['to'], convert_real_interface_to_friendly_descr($dhcpif), $subnet, $ifcfgsn); + file_notice("DHCP", $error_msg); + continue; + } $dhcpdconf .= " pool {\n"; /* is failover dns setup? */ if (is_array($poolconf['dnsserver']) && $poolconf['dnsserver'][0] <> "") { |