diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-02-25 20:55:39 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-02-25 20:55:39 +0000 |
commit | e3939e202cfd50d7c8e8ea217b464e08a917652e (patch) | |
tree | cbe80eb4dd5d4bdc958c7bdd3b375ba36991f64e /etc/inc | |
parent | b964717db84031e4e2a4e61ec2685c7130b4b6cc (diff) | |
download | pfsense-e3939e202cfd50d7c8e8ea217b464e08a917652e.zip pfsense-e3939e202cfd50d7c8e8ea217b464e08a917652e.tar.gz |
* Full path to cut and grep
* global $config in many missed locations
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 7f7c039..c4e6e1f 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -123,7 +123,7 @@ function is_carp_defined() { * find_number_of_created_carp_interfaces() returns the number of currently created carp interfaces */ function find_number_of_created_carp_interfaces() { - $command = "/sbin/ifconfig | grep \"carp*:\" | wc -l"; + $command = "/sbin/ifconfig | /usr/bin/grep \"carp*:\" | /usr/bin/wc -l"; $fd = popen($command . " 2>&1 ", "r"); if(!$fd) { log_error("Warning, could not execute command {$command}"); @@ -133,7 +133,7 @@ function find_number_of_created_carp_interfaces() { $tmp .= fread($fd,49); } fclose($fd); - $tmp=$tmp-1; + $tmp = intval($tmp) -1; return $tmp; } @@ -141,6 +141,8 @@ function find_number_of_created_carp_interfaces() { * link_ip_to_carp_interface($ip): finds where a carp interface links to. */ function link_ip_to_carp_interface($ip) { + global $config; + if($ip == "") return; $i = 0; $ifdescrs = array('wan', 'lan'); @@ -210,7 +212,7 @@ function convert_ip_to_network_format($ip, $subnet) { */ function find_interface_ip($interface) { if(does_interface_exist($interface) == false) return; - $ip = exec_command("/sbin/ifconfig {$interface} | grep -w \"inet\" | cut -d\" \" -f 2"); + $ip = exec_command("/sbin/ifconfig {$interface} | /usr/bin/grep -w \"inet\" | /usr/bin/cut -d\" \" -f 2"); $ip = str_replace("\n","",$ip); return $ip; } @@ -229,6 +231,7 @@ function filter_get_opt_interface_descr($opt) { * find_ip_interface($ip): return the interface where an ip is defined */ function find_ip_interface($ip) { + global $config; $i = 0; $ifdescrs = array('wan', 'lan'); for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { @@ -249,7 +252,7 @@ function find_ip_interface($ip) { function get_carp_interface_status($carpinterface) { $result = does_interface_exist($carpinterface); if($result <> true) return; - $status = exec_command("/sbin/ifconfig {$carpinterface} | grep \"carp:\" | cut -d\" \" -f2"); + $status = exec_command("/sbin/ifconfig {$carpinterface} | /usr/bin/grep \"carp:\" | /usr/bin/cut -d\" \" -f2"); return $status; } @@ -259,7 +262,7 @@ function get_carp_interface_status($carpinterface) { function get_pfsync_interface_status($pfsyncinterface) { $result = does_interface_exist($pfsyncinterface); if($result <> true) return; - $status = exec_command("/sbin/ifconfig {$pfsyncinterface} | grep \"pfsync:\" | cut -d\" \" -f5"); + $status = exec_command("/sbin/ifconfig {$pfsyncinterface} | /usr/bin/grep \"pfsync:\" | /usr/bin/cut -d\" \" -f5"); return $status; } |