summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorRenato Botelho <renato.botelho@bluepex.com>2010-11-03 12:53:40 -0200
committerRenato Botelho <renato.botelho@bluepex.com>2010-11-03 12:53:40 -0200
commit4816e5caa29b542c57659de8eff53ba51e355b24 (patch)
tree7482c94367d6a7929f9e249dd71d4da5b8906953 /etc/inc/util.inc
parentf5fe66cd96ed7903244b83564d4a74f16ca6369f (diff)
parentb039f099e66c9dbd0c33470bc4613e0cfdc9a1a0 (diff)
downloadpfsense-4816e5caa29b542c57659de8eff53ba51e355b24.zip
pfsense-4816e5caa29b542c57659de8eff53ba51e355b24.tar.gz
Merge remote branch 'mainline/master' into inc
Conflicts: etc/inc/auth.inc etc/inc/config.lib.inc etc/inc/priv.defs.inc etc/inc/system.inc etc/inc/upgrade_config.inc etc/inc/vpn.inc
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc37
1 files changed, 21 insertions, 16 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 3517c32..861bcd9 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -42,11 +42,10 @@ function killbypid($pidfile) {
}
function isvalidpid($pid) {
- $running = `ps -p $pid | wc -l`;
- if(intval($running) > 1)
- return true;
- else
- return false;
+ $output = "";
+ exec("/bin/pgrep -F {$pid}", $output, $retval);
+
+ return (intval($retval) == 0);
}
function is_process_running($process) {
@@ -679,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 = "";
@@ -705,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":
@@ -1187,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