summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-06-21 14:44:30 +0000
committerErmal Luçi <eri@pfsense.org>2008-06-21 14:44:30 +0000
commitcbe3ea96403e554822bd4675cb5565d20ab55fa7 (patch)
treec96401ee12ee200acbd111194e108cc6c92b4ac2 /usr/local
parent1ad25a3ffbf9ad226d8cb3463ef46c2ff82ad936 (diff)
downloadpfsense-cbe3ea96403e554822bd4675cb5565d20ab55fa7.zip
pfsense-cbe3ea96403e554822bd4675cb5565d20ab55fa7.tar.gz
Continue interface improvements
Diffstat (limited to 'usr/local')
-rwxr-xr-xusr/local/www/diag_arp.php8
-rwxr-xr-xusr/local/www/diag_backup.php2
-rwxr-xr-xusr/local/www/diag_logs_filter.php6
-rwxr-xr-xusr/local/www/diag_logs_filter_dynamic.php8
-rw-r--r--usr/local/www/diag_packet_capture.php9
-rwxr-xr-xusr/local/www/diag_ping.php9
-rwxr-xr-xusr/local/www/firewall_aliases_edit.php6
-rwxr-xr-xusr/local/www/firewall_nat_1to1_edit.php8
-rwxr-xr-xusr/local/www/firewall_nat_edit.php14
-rwxr-xr-xusr/local/www/firewall_nat_out.php18
-rwxr-xr-xusr/local/www/firewall_nat_out_edit.php5
-rwxr-xr-xusr/local/www/firewall_rules.php15
12 files changed, 38 insertions, 70 deletions
diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php
index f93cc54..5d699dd 100755
--- a/usr/local/www/diag_arp.php
+++ b/usr/local/www/diag_arp.php
@@ -193,11 +193,9 @@ foreach ($leases as $value) {
exec("/usr/sbin/arp -an",$rawdata);
$i = 0;
-$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
-
-for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
- $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
-}
+
+/* if list */
+$ifdescrs = get_configured_interface_with_descr();
foreach ($ifdescrs as $key =>$interface) {
$hwif[$config['interfaces'][$key]['if']] = $interface;
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index 165c203..5dde859 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -171,6 +171,8 @@ if ($_POST) {
if($config['system']['gateway'] <> "")
$config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
unset($config['shaper']);
+ /* optional if list */
+ $ifdescrs = get_configured_interface_list(true);
/* build an interface collection */
for ($j = 1; isset ($config['interfaces']['opt' . $j]); $j++)
$ifdescrs['opt' . $j] = "opt" . $j;
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index c1a3b6b..9654859 100755
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -67,8 +67,10 @@ function conv_clog($logfile, $tail = 50) {
$iftable = array();
$iftable[$config['interfaces']['lan']['if']] = "LAN";
$iftable[get_real_wan_interface()] = "WAN";
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
- $iftable[$config['interfaces']['opt' . $i]['if']] = $config['interfaces']['opt' . $i]['descr'];
+ /* optional if list */
+ $iflist = get_configured_interface_with_descr(true);
+ foreach ($iflist as $if => $ifdesc)
+ $iftable[$config['interfaces'][$if]['if']] = $ifdesc;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php
index 81ffd3f..b9262b2 100755
--- a/usr/local/www/diag_logs_filter_dynamic.php
+++ b/usr/local/www/diag_logs_filter_dynamic.php
@@ -62,8 +62,10 @@ function conv_clog_filter($logfile, $tail = 50) {
$iftable = array();
$iftable[$config['interfaces']['lan']['if']] = "LAN";
$iftable[get_real_wan_interface()] = "WAN";
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
- $iftable[$config['interfaces']['opt' . $i]['if']] = $config['interfaces']['opt' . $i]['descr'];
+ /* optional if list */
+ $iflist = get_configured_interface_with_descr(true);
+ foreach ($iflist as $if => $ifdesc)
+ $iftable[$config['interfaces'][$if]['if']] = $ifdesc;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
@@ -473,4 +475,4 @@ function handle_ajax() {
}
}
-?> \ No newline at end of file
+?>
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php
index c795a1a..d07d3e2 100644
--- a/usr/local/www/diag_packet_capture.php
+++ b/usr/local/www/diag_packet_capture.php
@@ -119,14 +119,9 @@ include("head.inc"); ?>
<td width="17%" valign="top" class="vncellreq">Interface</td>
<td width="83%" class="vtable">
<select name="interface" class="formfld">
- <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- if (isset($config['interfaces']['opt' . $i]['enable']) &&
- !$config['interfaces']['opt' . $i]['bridge'])
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
- }
+ <?php $interfaces = get_configured_interface_with_descr();
foreach ($interfaces as $iface => $ifacename): ?>
- <option value="<?=$iface;?>" <?php if ($selectedif == $iface) echo "selected"; ?>>
+ <option value="<?=$iface;?>" <?php if (!$config['interfaces'][$iface]['bridge'] && $selectedif == $iface) echo "selected"; ?>>
<?php echo $ifacename;?>
</option>
<?php endforeach;?>
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index 812663a..3741eca 100755
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -103,14 +103,9 @@ include("head.inc"); ?>
<td width="22%" valign="top" class="vncellreq">Interface</td>
<td width="78%" class="vtable">
<select name="interface" class="formfld">
- <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- if (isset($config['interfaces']['opt' . $i]['enable']) &&
- !$config['interfaces']['opt' . $i]['bridge'])
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
- }
+ <?php $interfaces = get_configured_interface_with_descr();
foreach ($interfaces as $iface => $ifacename): ?>
- <option value="<?=$iface;?>" <?php if ($iface == $interface) echo "selected"; ?>>
+ <option value="<?=$iface;?>" <?php if (!$config['interfaces'][$iface]['bridge'] && $iface == $interface) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php endforeach; ?>
diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php
index 402fd87..a6f5d2e 100755
--- a/usr/local/www/firewall_aliases_edit.php
+++ b/usr/local/www/firewall_aliases_edit.php
@@ -51,8 +51,10 @@ if (isset($id) && $a_aliases[$id]) {
$pconfig['address'] = $a_aliases[$id]['address'];
$pconfig['descr'] = html_entity_decode($a_aliases[$id]['descr']);
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
- if($config['interfaces']['opt' . $i]['descr'] == $pconfig['descr'])
+ /* optional if list */
+ $iflist = get_configured_interface_with_descr(true, true);
+ foreach ($iflist as $if => $ifdesc)
+ if($ifdesc == $pconfig['descr'])
$input_errors[] = "Sorry, an interface is already named {$pconfig['descr']}.";
$addresses = explode(' ', $pconfig['address']);
diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php
index d00c4eb..66f140b 100755
--- a/usr/local/www/firewall_nat_1to1_edit.php
+++ b/usr/local/www/firewall_nat_1to1_edit.php
@@ -144,11 +144,9 @@ include("head.inc");
<td width="78%" class="vtable">
<select name="interface" class="formselect">
<?php
- $interfaces = array('wan' => 'WAN');
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
- }
- foreach ($interfaces as $iface => $ifacename): ?>
+ $interfaces = get_configured_interface_with_descr();
+ foreach ($interfaces as $iface => $ifacename):
+if ($iface == "lan") continue; ?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
</option>
diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php
index c883ac9..1dfc947 100755
--- a/usr/local/www/firewall_nat_edit.php
+++ b/usr/local/www/firewall_nat_edit.php
@@ -295,16 +295,10 @@ include("fbegin.inc"); ?>
<select name="interface" class="formselect">
<?php
- $interfaces = array();
-
- if(have_ruleint_access("lan"))
- $interfaces['lan'] = "LAN";
- if(have_ruleint_access("wan"))
- $interfaces['wan'] = "WAN";
-
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
- if(have_ruleint_access("opt{$i}"))
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
+ $iflist = get_configured_interface_with_descr(false, true);
+ foreach ($iflist as $if => $ifdesc)
+ if(have_ruleint_access($if))
+ $interfaces[$if] = $ifdesc;
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 9cfffcd..99fc3f7 100755
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -79,25 +79,15 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
* user has enabled advanced outbound nat -- lets automatically create entries
* for all of the interfaces to make life easier on the pip-o-chap
*/
- $ifdescrs = array('lan');
- for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++)
- $ifdescrs[] = "opt" . $j;
- foreach($ifdescrs as $if) {
- if($if <> "lan" and $if <> "wan") {
- /* interface is an optional. is it enabled? */
- if(!isset($config['interfaces'][$if]['enabled'])) {
- continue;
- }
- }
+ $ifdescrs = get_configured_interface_with_descr();
+
+ foreach($ifdescrs as $if => $ifdesc) {
$natent = array();
$osn = gen_subnet($config['interfaces'][$if]['ipaddr'],
$config['interfaces'][$if]['subnet']);
$natent['source']['network'] = $osn . "/" . $config['interfaces'][$if]['subnet'];
$natent['sourceport'] = "";
- $int_description = $config['interfaces'][$if]['descr'];
- if($if == "lan")
- $int_description = "LAN";
- $natent['descr'] = "Auto created rule for {$int_description}";
+ $natent['descr'] = "Auto created rule for {$ifdesc}";
$natent['target'] = "";
$natent['interface'] = "wan";
$natent['destination']['any'] = true;
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php
index 66f7763..f032cfc 100755
--- a/usr/local/www/firewall_nat_out_edit.php
+++ b/usr/local/www/firewall_nat_out_edit.php
@@ -301,10 +301,7 @@ function sourcesel_change() {
<td width="78%" class="vtable">
<select name="interface" class="formselect">
<?php
- $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
- for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
- $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
- }
+ $interfaces = get_configured_interface_with_descr(false, true);
foreach ($interfaces as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index b9a5ebf..7bbeb85 100755
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -44,18 +44,11 @@ $if = $_GET['if'];
if ($_POST['if'])
$if = $_POST['if'];
-$iflist = array();
+$ifdescs = get_configured_interface_with_descr();
-if($config['interfaces']['lan'])
- if(have_ruleint_access("lan"))
- $iflist['lan'] = "LAN";
-
-if(have_ruleint_access("wan"))
- $iflist['wan'] = "WAN";
-
-for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
- if(have_ruleint_access("opt{$i}"))
- $iflist['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
+foreach ($ifdescs as $if => $ifdesc)
+ if(have_ruleint_access($if))
+ $iflist[$if] = $ifdesc;
if ($config['pptpd']['mode'] == "server")
if(have_ruleint_access("pptp"))
OpenPOWER on IntegriCloud