diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-11 21:41:56 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-11 21:41:56 +0000 |
commit | bc5d2a265f0b15a87d50788f14fcfa9dc27dce72 (patch) | |
tree | 9fa876dcc7166b9ad7d9cbc99e172e8ee3ee11fc | |
parent | 4471b3a11f989e8c5761d0509918b91896f8c32c (diff) | |
download | pfsense-bc5d2a265f0b15a87d50788f14fcfa9dc27dce72.zip pfsense-bc5d2a265f0b15a87d50788f14fcfa9dc27dce72.tar.gz |
Simplify filter_translate_type_to_real_interface
-rw-r--r-- | etc/inc/pfsense-utils.inc | 20 |
1 files changed, 12 insertions, 8 deletions
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; } |