diff options
-rw-r--r-- | etc/inc/pfsense-utils.inc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 6433114..36f73b5 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -523,10 +523,25 @@ function is_jumbo_capable($int) { } /* - * does_interface_exist($interface): return true or false if a interface is detected. + * Return the interface array + */ +function get_interface_arr() { + global $interface_arr_cache; + + /* If the cache doesn't exist, build it */ + if (!isset($interface_arr_cache)) + $interface_arr_cache = exec_command("/sbin/ifconfig -l"); + + return $interface_arr_cache; +} + +/* + * does_interface_exist($interface): return true or false if a interface is + * detected. */ function does_interface_exist($interface) { - $ints = exec_command("/sbin/ifconfig -l"); + $ints = get_interface_arr(); + if(stristr($ints, $interface) !== false) return true; else @@ -2252,4 +2267,4 @@ function is_dhcp_server_enabled() { return $dhcpdenable; } -?>
\ No newline at end of file +?> |