From bc5d2a265f0b15a87d50788f14fcfa9dc27dce72 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 11 Mar 2005 21:41:56 +0000 Subject: Simplify filter_translate_type_to_real_interface --- etc/inc/pfsense-utils.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'etc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 1d6d876..868a0c2 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -273,6 +273,15 @@ function find_ip_interface($ip) { } /* + * filter_translate_type_to_real_interface($interface): returns the real interface name + * for a friendly interface. ie: wan + */ +function filter_translate_type_to_real_interface($interface) { + global $config; + return $config['interfaces'][$interface]['if']; +} + +/* * get_carp_interface_status($carpinterface): returns the status of a carp ip */ function get_carp_interface_status($carpinterface) { @@ -506,13 +515,7 @@ function execute_command_return_output($command) { */ function convert_friendly_interface_to_real_interface_name($interface) { global $config; - if($interface == "lan") return $config['interfaces']['lan']['if']; - if($interface == "wan") return $config['interfaces']['wan']['if']; - foreach($config['interfaces'] as $int) { - if($int['descr'] == $interface) - return $int['if']; - } - return; + return $config['interfaces'][$interface]['if']; } /* @@ -527,7 +530,8 @@ function convert_real_interface_to_friendly_interface_name($interface) { } foreach ($ifdescrs as $ifdescr => $ifname) { $int = filter_translate_type_to_real_interface($ifname); - if($int == $interface) return $ifname; + echo $ifname . " - " . $interface ."\n"; + if($ifname == $interface) return $ifname; } return $interface; } -- cgit v1.1