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:07 -0200
commit403dad2a6e382d16ead9d41f2ec6c8efe6aa8b2f (patch)
tree75777fdeea66f26559de6cb2f451ba890121b85f /src/usr/local/www/services_dhcp.php
parentec38ba8b47a79de234edde3ac912f93fcdcb8a58 (diff)
downloadpfsense-403dad2a6e382d16ead9d41f2ec6c8efe6aa8b2f.zip
pfsense-403dad2a6e382d16ead9d41f2ec6c8efe6aa8b2f.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 5f244e9..19edd62 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -63,15 +63,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;
}
@@ -80,8 +87,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;
}
@@ -732,8 +746,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