summaryrefslogtreecommitdiffstats
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
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!).
-rw-r--r--etc/inc/interfaces.inc5
-rw-r--r--etc/inc/util.inc28
-rwxr-xr-xetc/rc3
3 files changed, 22 insertions, 14 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 89915bd..67bf69a 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -75,9 +75,9 @@ function does_interface_exist($interface) {
global $config;
if(!$interface)
- return false;
+ return false;
- $ints = get_interface_arr();
+ $ints = get_interface_arr(true);
if (in_array($interface, $ints))
return true;
else
@@ -89,7 +89,6 @@ function interfaces_loopback_configure() {
echo "Configuring loopback interface...";
pfSense_interface_setaddress("lo0", "127.0.0.1");
interfaces_bring_up("lo0");
- exec("/sbin/route add 127.0.0.2 127.0.0.1");
if($g['booting'])
echo "done.\n";
return 0;
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;
diff --git a/etc/rc b/etc/rc
index ab1b460..c4c1df3 100755
--- a/etc/rc
+++ b/etc/rc
@@ -349,6 +349,9 @@ echo -n "Launching the init system..."
/bin/rm -f /cf/conf/backup/backup.cache
/bin/rm -f /root/lighttpd*
/usr/bin/touch $varrunpath/booting
+for iface in `/sbin/ifconfig -l`; do
+ /sbin/ifconfig $iface up
+done
/etc/rc.bootup
# If a shell was selected from recovery
OpenPOWER on IntegriCloud