diff options
author | Ermal Luçi <eri@pfsense.org> | 2008-08-31 13:47:21 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2008-08-31 13:47:21 +0000 |
commit | 63182e6083d1a920248120a3b9fbd7eeafc39460 (patch) | |
tree | ee6cdd3ea6b44b2334854791c732975a47cd1c88 /etc/inc/pfsense-utils.inc | |
parent | 6a418ab72b5b9a5ff95ef7410afa1afb75a653b3 (diff) | |
download | pfsense-63182e6083d1a920248120a3b9fbd7eeafc39460.zip pfsense-63182e6083d1a920248120a3b9fbd7eeafc39460.tar.gz |
Bring bridge related support functions up to date with the other bridge code.
NOTE: that the function link_int_to_bridge_interface needs a friendly interface as a parameter now i.e. "wan/lan/optX".
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 0f4c9f5..0f5308a 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1233,16 +1233,11 @@ function find_number_of_created_carp_interfaces($flush = false) { * bridge[0-99] ******/ function link_int_to_bridge_interface($int) { - global $config, $g; - $real_int = convert_friendly_interface_to_real_interface_name($int); - $num_bridges = find_number_of_created_bridges(); - for($x=0; $x<$num_bridges; $x++) { - $matches = ""; - $bridge_info = `/sbin/ifconfig bridge{$x}`; - if(stristr($bridge_info, "member: {$real_int}")) { - return "bridge{$x}"; - } - } + global $config; + + foreach ($config['bridges']['bridged'] as $bridge) + if(stristr($bridge['members'], "{$int}")) + return "{$bridge['bridgeif']}"; } function link_carp_interface_to_parent($interface) { @@ -1522,17 +1517,6 @@ function find_carp_interface($ip) { } /* - * find_number_of_created_bridges(): returns the number of currently created bridges - */ -function find_number_of_created_bridges($flush = false) { - global $bridge_interface_count_cache; - if(!isset($bridge_interface_count_cache) or $flush) - $bridge_interface_count_cache = exec_command('/sbin/ifconfig | /usr/bin/grep "bridge[0-999]" | /usr/bin/wc -l'); - - return $bridge_interface_count_cache; -} - -/* * add_rule_to_anchor($anchor, $rule): adds the specified rule to an anchor */ function add_rule_to_anchor($anchor, $rule, $label) { @@ -3664,7 +3648,7 @@ function get_interface_info($ifdescr) { } $bridge = ""; - $bridge = link_int_to_bridge_interface($ifinfo['if']); + $bridge = link_int_to_bridge_interface($ifdescr); if($bridge) { $bridge_text = `/sbin/ifconfig {$bridge}`; if(stristr($bridge_text, "blocking") <> false) { |