diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-03-26 01:19:12 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-03-26 01:19:32 +0000 |
commit | bb34737fbae53d57bd0bbcfc846bb09330e8e985 (patch) | |
tree | fd002986974e85ba6628d12073453bb76ea39d54 /etc/inc/util.inc | |
parent | 89ee8c555983aaa54318ce6d888224119b79f977 (diff) | |
download | pfsense-bb34737fbae53d57bd0bbcfc846bb09330e8e985.zip pfsense-bb34737fbae53d57bd0bbcfc846bb09330e8e985.tar.gz |
Add function which returns the list of interfaces by realif index.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index c7f0293..7c31ca5 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -301,6 +301,39 @@ function get_configured_interface_list($only_opt = false, $withdisabled = false) return $iflist; } +/* return the configured interfaces list. */ +function get_configured_interface_list_by_realif($only_opt = false, $withdisabled = false) { + global $config; + + $iflist = array(); + + if (!$only_opt) { + if (isset($config['interfaces']['wan'])) { + $tmpif = get_real_interface("wan"); + if (!empty($tmpif)) + $iflist[$tmpif] = "wan"; + } + if (isset($config['interfaces']['lan'])) { + $tmpif = get_real_interface("lan"); + if (!empty($tmpif)) + $iflist[$tmpif] = "lan"; + } + } + + /* if list */ + foreach($config['interfaces'] as $if => $ifdetail) { + if ($if == "wan" || $if == "lan") + continue; + if (isset($ifdetail['enable']) || $withdisabled == true) { + $tmpif = get_real_interface($if); + if (!empty($tmpif)) + $iflist[$tmpif] = $if; + } + } + + return $iflist; +} + /* return the configured interfaces list with their description. */ function get_configured_interface_with_descr($only_opt = false, $withdisabled = false) { global $config; |