diff options
author | Ermal Luçi <eri@pfsense.org> | 2008-09-12 22:54:43 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2008-09-12 22:54:43 +0000 |
commit | 872ce0dd45e0c7733daee13287ac29dbad1dc744 (patch) | |
tree | ba1267d6b1bc59c03b755cde73f2b16aa77bd04c | |
parent | fb707f4a3b00a05c441a19eb53ae1d33e6a342d3 (diff) | |
download | pfsense-872ce0dd45e0c7733daee13287ac29dbad1dc744.zip pfsense-872ce0dd45e0c7733daee13287ac29dbad1dc744.tar.gz |
Fix the Status->Traffic Graph graphic.
-rw-r--r-- | usr/local/www/ifstats.php | 25 | ||||
-rwxr-xr-x | usr/local/www/status_graph.php | 19 |
2 files changed, 13 insertions, 31 deletions
diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php index c8457d1..9ea65ad 100644 --- a/usr/local/www/ifstats.php +++ b/usr/local/www/ifstats.php @@ -37,44 +37,31 @@ ##|-PRIV - require("functions.inc"); - require("config.inc"); + require_once("interfaces.inc"); $ifinfo = array(); $if = $_GET['if']; - $ifinfo['hwif'] = $config['interfaces'][$if]['if']; - if(!$ifinfo['hwif']) - $ifinfo['hwif'] = $if; - - $ifinfo['if'] = $ifinfo['hwif']; + $realif = get_real_wan_interface($if); + if(!$realif) + $realif = $if; // Need for IPSec case interface. /* run netstat to determine link info */ $linkinfo = ""; unset($linkinfo); - exec("/usr/bin/netstat -I " . $ifinfo['hwif'] . " -nWb -f link", $linkinfo); + exec("/usr/bin/netstat -I {$realif} -nWb -f link", $linkinfo); $linkinfo = preg_split("/\s+/", $linkinfo[1]); - if (preg_match("/\*$/", $linkinfo[0])) { - $ifinfo['status'] = "down"; - } else { - $ifinfo['status'] = "up"; - } - - if(preg_match("/^enc|^tun/i", $ifinfo['if'])) { + if (preg_match("/^enc|^tun|^pppoe|^pptp/i", $realif)) { $ifinfo['inpkts'] = $linkinfo[3]; $ifinfo['inbytes'] = $linkinfo[5]; $ifinfo['outpkts'] = $linkinfo[6]; $ifinfo['outbytes'] = $linkinfo[8]; } else { - $ifinfo['macaddr'] = $linkinfo[3]; $ifinfo['inpkts'] = $linkinfo[4]; - $ifinfo['inerrs'] = $linkinfo[5]; $ifinfo['inbytes'] = $linkinfo[6]; $ifinfo['outpkts'] = $linkinfo[7]; - $ifinfo['outerrs'] = $linkinfo[8]; $ifinfo['outbytes'] = $linkinfo[9]; - $ifinfo['collisions'] = $linkinfo[10]; } $temp = gettimeofday(); $timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0; diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php index df1a83f..2b58bad 100755 --- a/usr/local/www/status_graph.php +++ b/usr/local/www/status_graph.php @@ -52,16 +52,11 @@ if ($_POST['height']) else $height = "275"; -/* link the ipsec interface magically */ -$config['interfaces']['ipsec']['if'] = "enc0"; -if ($_GET['if']) { +if ($_GET['if']) $curif = $_GET['if']; - $ifnum = $config['interfaces'][$curif]['if']; -} else { +else $curif = "wan"; - $ifnum = get_real_wan_interface(); -} $pgtitle = array("Status","Traffic Graph"); include("head.inc"); @@ -73,9 +68,9 @@ include("head.inc"); <?php $ifdescrs = get_configured_interface_with_descr(); -if((isset($config['ipsec']['enable'])) || (isset($config['ipsec']['mobileclients']['enable']))) { - $ifdescrs['ipsec'] = "IPsec"; -} +/* link the ipsec interface magically */ +if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable'])) + $ifdescrs['enc0'] = "IPsec"; ?> <form name="form1" action="status_graph.php" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999"> @@ -95,8 +90,8 @@ foreach ($ifdescrs as $ifn => $ifd) { </form> <p> <div align="center"> - <object data="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml" width="550" height="275"> - <param name="src" value="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" /> + <object data="graph.php?ifnum=<?=$curif;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml" width="550" height="275"> + <param name="src" value="graph.php?ifnum=<?=$curif;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" /> Your browser does not support the type SVG! You need to either use Firefox or download the Adobe SVG plugin. </object> </div> |