summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dhcp.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-12-20 15:50:17 -0200
committerRenato Botelho <renato@netgate.com>2016-12-20 15:51:02 -0200
commite66503688e06a8ce19875863ee87356bb4ce3cf8 (patch)
tree7e84e86d9e59b96380b6967c7a4afa2c264adf95 /src/usr/local/www/services_dhcp.php
parentf75f0ef76349ebee3ab2afb3d1e75ab5c637118f (diff)
downloadpfsense-e66503688e06a8ce19875863ee87356bb4ce3cf8.zip
pfsense-e66503688e06a8ce19875863ee87356bb4ce3cf8.tar.gz
Disable DHCP server on interfaces with subnet >= 31. Fixes #6930
Diffstat (limited to 'src/usr/local/www/services_dhcp.php')
-rw-r--r--src/usr/local/www/services_dhcp.php30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index e8a9da5..36a0f34 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -95,15 +95,22 @@ if (!$if || !isset($iflist[$if])) {
// First look for an interface with DHCP already enabled.
foreach ($iflist as $ifent => $ifname) {
$oc = $config['interfaces'][$ifent];
- if (is_array($config['dhcpd'][$ifent]) && isset($config['dhcpd'][$ifent]['enable']) && (is_ipaddrv4($oc['ipaddr']))) {
+ if (is_array($config['dhcpd'][$ifent]) &&
+ isset($config['dhcpd'][$ifent]['enable']) &&
+ is_ipaddrv4($oc['ipaddr']) && $oc['subnet'] < 31) {
$if = $ifent;
$found_starting_if = true;
break;
}
}
- // If there is no DHCP-enabled interface and LAN is a candidate, then choose LAN.
- if (!$found_starting_if && isset($iflist['lan']) && is_ipaddrv4($config['interfaces']['lan']['ipaddr'])) {
+ /*
+ * If there is no DHCP-enabled interface and LAN is a candidate,
+ * then choose LAN.
+ */
+ if (!$found_starting_if && isset($iflist['lan']) &&
+ is_ipaddrv4($config['interfaces']['lan']['ipaddr']) &&
+ $config['interfaces']['lan']['subnet'] < 31) {
$if = 'lan';
$found_starting_if = true;
}
@@ -112,8 +119,15 @@ if (!$if || !isset($iflist[$if])) {
if (!$found_starting_if) {
foreach ($iflist as $ifent => $ifname) {
$oc = $config['interfaces'][$ifent];
- if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
- (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) {
+
+ /* Not static IPv4 or subnet >= 31 */
+ if (!is_ipaddrv4($oc['ipaddr']) ||
+ empty($oc['subnet']) || $oc['subnet'] < 31) {
+ continue;
+ }
+
+ if (!is_array($config['dhcpd'][$ifent]) ||
+ !isset($config['dhcpd'][$ifent]['enable'])) {
continue;
}
@@ -760,8 +774,10 @@ $i = 0;
foreach ($iflist as $ifent => $ifname) {
$oc = $config['interfaces'][$ifent];
- if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
- (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) {
+
+ /* Not static IPv4 or subnet >= 31 */
+ if (!is_ipaddrv4($oc['ipaddr']) ||
+ empty($oc['subnet']) || $oc['subnet'] >= 31) {
continue;
}
OpenPOWER on IntegriCloud