1
|
--- pfsense-utils.inc.submitted20032010 2010-03-22 18:44:16.000000000 +0700
|
2
|
+++ pfsense-utils.inc.new 2010-03-24 20:10:53.000000000 +0700
|
3
|
@@ -1181,7 +1181,7 @@
|
4
|
|
5
|
//returns interface information
|
6
|
function get_interface_info($ifdescr) {
|
7
|
- global $config, $linkinfo, $netstatrninfo;
|
8
|
+ global $config, $linkinfo, $netstatrninfo, $g;
|
9
|
|
10
|
$ifinfo = array();
|
11
|
/* if list */
|
12
|
@@ -1299,15 +1299,30 @@
|
13
|
break;
|
14
|
/* PPP interface? -> get uptime for this session and cumulative uptime from the persistant log file in conf */
|
15
|
case "ppp":
|
16
|
- if ($config['interfaces'][$if]['serialport']){
|
17
|
+ $ppp_int = $config['interfaces'][$if]['if'];
|
18
|
$dev = $config['interfaces'][$if]['serialport'];
|
19
|
+ if ($dev == "")
|
20
|
+ break;
|
21
|
if (file_exists("/dev/{$dev}")){
|
22
|
$ifinfo['ppplink'] = $dev;
|
23
|
|
24
|
- if (file_exists("/var/run/{$dev}.sock") && file_exists("/var/run/{$dev}.if")){
|
25
|
- $ifinfo['ppp_uptime'] = trim(`/usr/sbin/pppctl /var/run/$dev.sock bg echo UPTIME`);
|
26
|
- if (stristr($ifinfo['ppp_uptime'],">"))
|
27
|
- $ifinfo['ppp_uptime'] = substr($ifinfo['ppp_uptime'], 2 + strpos($ifinfo['ppp_uptime'], ">"));
|
28
|
+ if (file_exists("{$g['varrun_path']}/{$ppp_int}.pid") && file_exists("{$g['varetc_path']}/{$ppp_int}.query")){
|
29
|
+ $sec = trim(`/usr/bin/nc localhost 5005 < {$g['varetc_path']}/{$ppp_int}.query | grep 'Session time' | cut -f7 -d ' '`);
|
30
|
+ if ($sec != 0){
|
31
|
+ $min = floor($sec/60);
|
32
|
+ $sec %= 60;
|
33
|
+ if ($sec < 10)
|
34
|
+ $sec = "0{$sec}";
|
35
|
+ }
|
36
|
+ if ($min !=0){
|
37
|
+ $hrs = floor($min/60);
|
38
|
+ $min %= 60;
|
39
|
+ if ($min < 10)
|
40
|
+ $min = "0{$min}";
|
41
|
+ }
|
42
|
+ if ($hrs < 10)
|
43
|
+ $hrs = "0{$hrs}";
|
44
|
+ $ifinfo['ppp_uptime'] = "{$hrs}:{$min}:{$sec}";
|
45
|
}
|
46
|
$ifinfo['missing_device'] = 0;
|
47
|
}
|
48
|
@@ -1317,7 +1332,6 @@
|
49
|
}
|
50
|
// Calculate cumulative uptime for PPP link. Useful for connections that have per minute/hour contracts so you don't go over!
|
51
|
$ifinfo['ppp_uptime_accumulated'] = get_ppp_uptime($dev);
|
52
|
- }
|
53
|
|
54
|
break;
|
55
|
default:
|