summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-11-02 21:16:21 +0000
committerErmal <eri@pfsense.org>2010-11-02 21:16:42 +0000
commit729931965e68a3c8ab1de307446410f6810c4433 (patch)
tree41330a56bc61cf772e76366b6095a3ce55496ff0 /etc/inc/util.inc
parent6bc1e79a7dd5d7498adec42045382e7c5804e530 (diff)
downloadpfsense-729931965e68a3c8ab1de307446410f6810c4433.zip
pfsense-729931965e68a3c8ab1de307446410f6810c4433.tar.gz
Protect from strange situations on bootup by testing for is_array(). Do not add anymore the 127.0.0.2 route its not needed anymore. Also during bootup bring up all interfaces so the assignment process can deal with them(Possibly should be done in another code flow!).
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc28
1 files changed, 17 insertions, 11 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index e4efbfb..0551d40 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -678,6 +678,9 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
if(stristr($status, "active")) $upints[] = $int;
}
break;
+ default:
+ $upints = explode(" ", trim(shell_exec("/sbin/ifconfig -l")));
+ break;
}
/* build interface list with netstat */
$linkinfo = "";
@@ -704,8 +707,9 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
$toput['ipaddr'] = $aip[1];
}
}
- foreach($config['interfaces'] as $name => $int) {
- if($int['if'] == $ifname) $friendly = $name;
+ if (is_array($config['interfaces'])) {
+ foreach($config['interfaces'] as $name => $int)
+ if($int['if'] == $ifname) $friendly = $name;
}
switch($keyby) {
case "physical":
@@ -1186,15 +1190,17 @@ function is_interface_mismatch() {
/* XXX: Should we process only enabled interfaces?! */
$do_assign = false;
$i = 0;
- foreach ($config['interfaces'] as $ifname => $ifcfg) {
- if (preg_match("/^enc|^cua|^tun|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
- $i++;
- }
- else if (does_interface_exist($ifcfg['if']) == false) {
- $do_assign = true;
- } else
- $i++;
- }
+ if (is_array($config['interfaces'])) {
+ foreach ($config['interfaces'] as $ifname => $ifcfg) {
+ if (preg_match("/^enc|^cua|^tun|^l2tp|^pptp|^ppp|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_wlan/i", $ifcfg['if'])) {
+ $i++;
+ }
+ else if (does_interface_exist($ifcfg['if']) == false) {
+ $do_assign = true;
+ } else
+ $i++;
+ }
+ }
if ($g['minimum_nic_count'] > $i) {
$do_assign = true;
OpenPOWER on IntegriCloud