summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-08-11 01:16:00 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-08-11 01:16:00 +0000
commit44a957634e0a68bb539caae3869f211868db8b65 (patch)
treeb17ffec51cf8aad0e5d75596c7165dc7af8c55d6 /etc
parentce486d12f053daf2d4d2aff5e05457739fdbff92 (diff)
downloadpfsense-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.inc21
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
+?>
OpenPOWER on IntegriCloud