diff options
-rw-r--r-- | etc/inc/interfaces.inc | 9 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index acaa897..ae084dc 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -159,6 +159,8 @@ function interfaces_lan_configure() { mwexec("/sbin/ifconfig bridge{$bridges_total} up"); $bridges_total++; + /* update cache */ + find_number_of_created_bridges(); } /* media */ @@ -319,7 +321,8 @@ function interfaces_optional_configure_if($opti) { mwexec("/sbin/ifconfig bridge{$bridges_total} up"); $bridges_total++; - + /* update cache */ + find_number_of_created_bridges(); } else { /* if user has selected DHCP type then act accordingly */ if($optcfg['ipaddr'] == "dhcp") { @@ -876,6 +879,8 @@ function interfaces_wan_configure() { mwexec("/sbin/ifconfig bridge{$bridges_total} up"); $bridges_total++; + /* update cache */ + find_number_of_created_bridges(); } if (!$g['booting']) { @@ -1564,4 +1569,4 @@ function get_wireless_modes($interface) return($wireless_modes); } -?>
\ No newline at end of file +?> diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 01b61d6..98981f8 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -705,7 +705,11 @@ function setup_filter_bridge() { * find_number_of_created_bridges(): returns the number of currently created bridges */ function find_number_of_created_bridges() { - return `/sbin/ifconfig | grep "bridge[0-999]" | wc -l`; + global $bridge_interface_count_cache; + if(!isset($bridge_interface_count_cache)) + $bridge_interface_count_cache = exec_command('/sbin/ifconfig | /usr/bin/grep "bridge[0-999]" | /usr/bin/wc -l'); + + return $bridge_interface_count_cache; } /* |