summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-09 14:33:40 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-09 14:33:40 -0500
commit810c191c5dfee51bff36324782033d664f22141a (patch)
tree9ef6b6407e6d87cfc3d646dc788181a3166752dd /src/usr/local
parentf2ced1772574eeb8fd1c1c9d4f310382f050053e (diff)
parentcde97f1c624d519324b702d12dce667c3b59455f (diff)
downloadpfsense-810c191c5dfee51bff36324782033d664f22141a.zip
pfsense-810c191c5dfee51bff36324782033d664f22141a.tar.gz
Merge pull request #2602 from phil-davis/patch-2
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/services_dhcp.php30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index f77e780..0c03469 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -92,15 +92,35 @@ $iflist = get_configured_interface_with_descr();
/* set the starting interface */
if (!$if || !isset($iflist[$if])) {
+ $found_starting_if = false;
+ // 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']))) ||
- (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) {
- continue;
+ if (is_array($config['dhcpd'][$ifent]) && isset($config['dhcpd'][$ifent]['enable']) && (is_ipaddrv4($oc['ipaddr']))) {
+ $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 = 'lan';
+ $found_starting_if = true;
+ }
- $if = $ifent;
- break;
+ // At the last select whatever can be found.
+ 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'])))) {
+ continue;
+ }
+
+ $if = $ifent;
+ break;
+ }
}
}
OpenPOWER on IntegriCloud