diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 7ffbf24927..a2cb02e09e 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -339,11 +339,8 @@ function convert_ip_to_network_format($ip, $subnet) { * get_carp_interface_status($carpinterface): returns the status of a carp ip */ function get_carp_interface_status($carpinterface) { - /* basically cache the contents of ifconfig statement - to speed up this routine */ - global $carp_query; - if($carp_query == "") - $carp_query = split("\n", `/sbin/ifconfig $carpinterface | grep carp`); + $carp_query = ""; + exec("/sbin/ifconfig $carpinterface | /usr/bin/grep -v grep | /usr/bin/grep carp:", $carp_query); foreach($carp_query as $int) { if(stristr($int, "MASTER")) return "MASTER"; diff --git a/usr/local/www/widgets/include/carp_status.inc b/usr/local/www/widgets/include/carp_status.inc index d2851d27d1..79d3c03ded 100644 --- a/usr/local/www/widgets/include/carp_status.inc +++ b/usr/local/www/widgets/include/carp_status.inc @@ -4,4 +4,4 @@ $carp_status_title = "Carp Status"; $carp_status_title_link = "carp_status.php"; -?> \ No newline at end of file +?> diff --git a/usr/local/www/widgets/widgets/carp_status.widget.php b/usr/local/www/widgets/widgets/carp_status.widget.php index 7c989468fa..6399579987 100644 --- a/usr/local/www/widgets/widgets/carp_status.widget.php +++ b/usr/local/www/widgets/widgets/carp_status.widget.php @@ -37,13 +37,14 @@ require_once("/usr/local/www/widgets/include/carp_status.inc"); if(is_array($config['virtualip']['vip'])) { $carpint=0; foreach($config['virtualip']['vip'] as $carp) { - if ($carp['mode'] != "carp") continue; + if ($carp['mode'] != "carp") + continue; $ipaddress = $carp['subnet']; $password = $carp['password']; - $netmask = $carp['subnet_bits']; + $netmask = $carp['subnet_bits']; $vhid = $carp['vhid']; $advskew = $carp['advskew']; - $carp_int = find_carp_interface($ipaddress); + $carp_int = "vip{$vhid}"; $status = get_carp_interface_status($carp_int); ?> @@ -54,7 +55,7 @@ require_once("/usr/local/www/widgets/include/carp_status.inc"); "; } else if($status == "BACKUP") { echo ""; @@ -73,4 +74,4 @@ require_once("/usr/local/www/widgets/include/carp_status.inc"); - \ No newline at end of file +