From fd4e14b8853e7a30ee23532d686270cb40d84d03 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 20 Jun 2017 10:48:44 -0400 Subject: [PATCH] Match whitespace after $vhid when checking CARP status to avoid partial matches. Fixes #7638 While here, fix variable references with braces and combine the two calls to grep into a single pattern. --- src/etc/inc/pfsense-utils.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index d3d5435839..c0a083b8b8 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -725,7 +725,7 @@ function get_carp_interface_status($carpid) { $vhid = $vip['vhid']; $carp_query = ''; - $_gb = exec("/sbin/ifconfig $interface | /usr/bin/grep carp: | /usr/bin/grep \"vhid $vhid\"", $carp_query); + $_gb = exec("/sbin/ifconfig {$interface} | /usr/bin/grep \"carp:.* vhid {$vhid} \"", $carp_query); foreach ($carp_query as $int) { if (stripos($int, "MASTER")) return "MASTER";