summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-10-23 21:51:53 +0000
committerErmal Luçi <eri@pfsense.org>2008-10-23 21:51:53 +0000
commit85a5da131ccbbb6fe335da3ca7d67cc0c3f60aa0 (patch)
tree5599823fbfad08f8e11831c28d9e6caedd41bd1a /usr/local/www
parentcb00b7342f39a96ddbffd3a53965c780359e2d3b (diff)
downloadpfsense-85a5da131ccbbb6fe335da3ca7d67cc0c3f60aa0.zip
pfsense-85a5da131ccbbb6fe335da3ca7d67cc0c3f60aa0.tar.gz
* Rename get_current_wan_address to get_interface_ip
* Rename get_real_wan_interface to get_real_interface * Simplify get_interface_ip by using find_interface_ip which should help in speed to since its using caching. Pointed by billm@ * Cleanup some code when passing or remove some unused one.
Diffstat (limited to 'usr/local/www')
-rwxr-xr-xusr/local/www/diag_logs_filter.php7
-rwxr-xr-xusr/local/www/diag_logs_filter_dynamic.php7
-rw-r--r--usr/local/www/diag_packet_capture.php15
-rwxr-xr-xusr/local/www/diag_ping.php27
-rw-r--r--usr/local/www/ifstats.php2
-rw-r--r--usr/local/www/interfaces_lagg_edit.php2
-rwxr-xr-xusr/local/www/pkg_edit.php2
-rw-r--r--usr/local/www/widgets/include/log.inc6
-rwxr-xr-xusr/local/www/wizard.php2
9 files changed, 11 insertions, 59 deletions
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index 11e7478..850a338 100755
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -73,12 +73,9 @@ function conv_clog($logfile, $tail = 50) {
$logarr = "";
/* make interface/port table */
$iftable = array();
- $iftable[$config['interfaces']['lan']['if']] = "LAN";
- $iftable[get_real_wan_interface()] = "WAN";
- /* optional if list */
- $iflist = get_configured_interface_with_descr(true);
+ $iflist = get_configured_interface_with_descr();
foreach ($iflist as $if => $ifdesc)
- $iftable[$config['interfaces'][$if]['if']] = $ifdesc;
+ $iftable[get_real_interface($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 62de8fa..e91b4e1 100755
--- a/usr/local/www/diag_logs_filter_dynamic.php
+++ b/usr/local/www/diag_logs_filter_dynamic.php
@@ -68,12 +68,9 @@ function conv_clog_filter($logfile, $tail = 50) {
/* make interface/port table */
$iftable = array();
- $iftable[$config['interfaces']['lan']['if']] = "LAN";
- $iftable[get_real_wan_interface()] = "WAN";
- /* optional if list */
- $iflist = get_configured_interface_with_descr(true);
+ $iflist = get_configured_interface_with_descr();
foreach ($iflist as $if => $ifdesc)
- $iftable[$config['interfaces'][$if]['if']] = $ifdesc;
+ $iftable[get_real_interface($if)] = $ifdesc;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php
index 4ff4ed9..fa972ff 100644
--- a/usr/local/www/diag_packet_capture.php
+++ b/usr/local/www/diag_packet_capture.php
@@ -40,21 +40,6 @@ $fn = "packetcapture.cap";
$snaplen = 1500;//default packet length
$count = 100;//default number of packets to capture
-function get_interface_addr($if) {
- global $config;
-
- $ifdescr = convert_friendly_interface_to_friendly_descr($if);
-
- /* find out interface name */
- if ($ifdescr == "wan")
- $if = get_real_wan_interface();
- else
- $if = $config['interfaces'][$ifdescr];
-
- return $if;
-
-}
-
if ($_POST) {
$do_tcpdump = true;
$host = $_POST['host'];
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index e80aa76..e4cc4f4 100755
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -68,31 +68,6 @@ if (!isset($do_ping)) {
$count = DEFAULT_COUNT;
}
-function get_interface_addr($ifdescr) {
-
- global $config, $g;
-
- /* find out interface name */
- if ($ifdescr == "wan")
- $if = get_real_wan_interface();
- else
- $if = $config['interfaces'][$ifdescr]['if'];
-
- /* try to determine IP address and netmask with ifconfig */
- $ifconfiginfo = "";
- $matches = "";
- unset($ifconfiginfo);
- exec("/sbin/ifconfig " . $if, $ifconfiginfo);
-
- foreach ($ifconfiginfo as $ici) {
- if (preg_match("/inet (\S+)/", $ici, $matches)) {
- return $matches[1];
- }
- }
-
- return false;
-}
-
include("head.inc"); ?>
<body link="#000000" vlink="#000000" alink="#000000">
<? include("fbegin.inc"); ?>
@@ -145,7 +120,7 @@ include("head.inc"); ?>
echo("<strong>Ping output:</strong><br>");
echo('<pre>');
ob_end_flush();
- $ifaddr = get_interface_addr($interface);
+ $ifaddr = get_interface_ip($interface);
if ($ifaddr)
system("/sbin/ping -S$ifaddr -c$count " . escapeshellarg($host));
else
diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php
index e35f35c..1e177cf 100644
--- a/usr/local/www/ifstats.php
+++ b/usr/local/www/ifstats.php
@@ -43,7 +43,7 @@
$if = $_GET['if'];
- $realif = get_real_wan_interface($if);
+ $realif = get_real_interface($if);
if(!$realif)
$realif = $if; // Need for IPSec case interface.
diff --git a/usr/local/www/interfaces_lagg_edit.php b/usr/local/www/interfaces_lagg_edit.php
index 2268053..032e239 100644
--- a/usr/local/www/interfaces_lagg_edit.php
+++ b/usr/local/www/interfaces_lagg_edit.php
@@ -40,7 +40,7 @@ $portlist = get_interface_list();
$checklist = get_configured_interface_list(false, true);
$realifchecklist = array();
foreach ($checklist as $tmpif)
- $realifchecklist[get_real_wan_interface($tmpif)] = $tmpif;
+ $realifchecklist[get_real_interface($tmpif)] = $tmpif;
$id = $_GET['id'];
if (isset($_POST['id']))
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php
index caf2044..67a4382 100755
--- a/usr/local/www/pkg_edit.php
+++ b/usr/local/www/pkg_edit.php
@@ -643,7 +643,7 @@ function fixup_string($string) {
$newstring = str_replace("\$myurl", $myurl, $string);
$string = $newstring;
// fixup #2: $wanip
- $curwanip = get_current_wan_address();
+ $curwanip = get_interface_ip();
$newstring = str_replace("\$wanip", $curwanip, $string);
$string = $newstring;
// fixup #3: $lanip
diff --git a/usr/local/www/widgets/include/log.inc b/usr/local/www/widgets/include/log.inc
index 74d7c17..e1e8c3f 100644
--- a/usr/local/www/widgets/include/log.inc
+++ b/usr/local/www/widgets/include/log.inc
@@ -19,11 +19,9 @@ function conv_clog_filter($logfile, $tail = 8) {
$logarr = "";
/* make interface/port table */
$iftable = array();
- $iftable[$config['interfaces']['lan']['if']] = "LAN";
- $iftable[get_real_wan_interface()] = "WAN";
- $iflist = get_configured_interface_with_descr(true);
+ $iflist = get_configured_interface_with_descr();
foreach ($iflist as $ifl => $ifdesc)
- $iftable[$config['interfaces'][$if]['if']] = $ifdesc;
+ $iftable[get_real_interface($ifl)] = $ifdesc;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php
index c9dae67..9fd214f 100755
--- a/usr/local/www/wizard.php
+++ b/usr/local/www/wizard.php
@@ -614,7 +614,7 @@ function fixup_string($string) {
$myurl = $proto . "://" . $config['interfaces']['lan']['ipaddr'] . $urlport . "/";
$newstring = str_replace("\$myurl", $myurl, $newstring);
// fixup #2: $wanip
- $curwanip = get_current_wan_address();
+ $curwanip = get_interface_ip();
$newstring = str_replace("\$wanip", $curwanip, $newstring);
// fixup #3: $lanip
$lanip = $config['interfaces']['lan']['ipaddr'];
OpenPOWER on IntegriCloud