summaryrefslogtreecommitdiffstats
path: root/etc/inc/util.inc
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2010-09-15 23:15:14 -0600
committerErik Fonnesbeck <efonnes@gmail.com>2010-09-15 23:15:14 -0600
commit8735afe8e58e6a8f20f13503ad36e8ab83f1fca4 (patch)
treed1c49356a4411dde08978b031fa1939d621afb08 /etc/inc/util.inc
parent14f49fd0bcd259909de41131b077298934d4f769 (diff)
downloadpfsense-8735afe8e58e6a8f20f13503ad36e8ab83f1fca4.zip
pfsense-8735afe8e58e6a8f20f13503ad36e8ab83f1fca4.tar.gz
Return list with WAN and LAN interfaces in the configured order rather than giving special treatment, as is already done with the OPTx interfaces.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r--etc/inc/util.inc61
1 files changed, 14 insertions, 47 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index f07e2aa..272512e 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -567,16 +567,9 @@ function get_configured_interface_list($only_opt = false, $withdisabled = false)
$iflist = array();
- if (!$only_opt) {
- if (isset($config['interfaces']['wan']))
- $iflist['wan'] = "wan";
- if (isset($config['interfaces']['lan']))
- $iflist['lan'] = "lan";
- }
-
/* if list */
- foreach($config['interfaces'] as $if => $ifdetail) {
- if ($if == "wan" || $if == "lan")
+ foreach($config['interfaces'] as $if => $ifdetail) {
+ if ($only_opt && ($if == "wan" || $if == "lan"))
continue;
if (isset($ifdetail['enable']) || $withdisabled == true)
$iflist[$if] = $if;
@@ -587,35 +580,22 @@ function get_configured_interface_list($only_opt = false, $withdisabled = false)
/* return the configured interfaces list. */
function get_configured_interface_list_by_realif($only_opt = false, $withdisabled = false) {
- global $config;
-
- $iflist = array();
+ global $config;
- 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";
- }
- }
+ $iflist = array();
- /* if list */
- foreach($config['interfaces'] as $if => $ifdetail) {
- if ($if == "wan" || $if == "lan")
- continue;
- if (isset($ifdetail['enable']) || $withdisabled == true) {
+ /* if list */
+ foreach($config['interfaces'] as $if => $ifdetail) {
+ if ($only_opt && ($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 $iflist;
}
/* return the configured interfaces list with their description. */
@@ -624,25 +604,12 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled =
$iflist = array();
- if (!$only_opt) {
- if (isset($config['interfaces']['wan'])) {
- if (empty($config['interfaces']['wan']['descr']))
- $iflist['wan'] = "WAN";
- else
- $iflist['wan'] = strtoupper($config['interfaces']['wan']['descr']);
- }
- if (isset($config['interfaces']['lan'])) {
- if (empty($config['interfaces']['lan']['descr']))
- $iflist['lan'] = "LAN";
- else
- $iflist['lan'] = strtoupper($config['interfaces']['lan']['descr']);
- }
- }
-
/* if list */
foreach($config['interfaces'] as $if => $ifdetail) {
+ if ($only_opt && ($if == "wan" || $if == "lan"))
+ continue;
if (isset($ifdetail['enable']) || $withdisabled == true) {
- if($ifdetail['descr'] == "")
+ if(empty($ifdetail['descr']))
$iflist[$if] = strtoupper($if);
else
$iflist[$if] = strtoupper($ifdetail['descr']);
OpenPOWER on IntegriCloud