diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-08-11 01:16:00 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-08-11 01:16:00 +0000 |
commit | 44a957634e0a68bb539caae3869f211868db8b65 (patch) | |
tree | b17ffec51cf8aad0e5d75596c7165dc7af8c55d6 /etc | |
parent | ce486d12f053daf2d4d2aff5e05457739fdbff92 (diff) | |
download | pfsense-44a957634e0a68bb539caae3869f211868db8b65.zip pfsense-44a957634e0a68bb539caae3869f211868db8b65.tar.gz |
MFC 13700
build an interface cache this saves 30 wallclock seconds on my 4801 when running rc.filter_configure on my vmware dev box it saved 24 seconds
Diffstat (limited to 'etc')
-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 +?> |