1 |
19ac33af
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
ifstats.php
|
5 |
c7281770
|
Chris Buechler
|
part of pfSense (https://www.pfsense.org)
|
6 |
19ac33af
|
Scott Ullrich
|
|
7 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
8 |
19ac33af
|
Scott Ullrich
|
Copyright (C) 2005-2006 Scott Ullrich (sullrich@gmail.com)
|
9 |
|
|
All rights reserved.
|
10 |
|
|
|
11 |
|
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
|
|
|
14 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
|
|
|
17 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
|
|
|
21 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
7ac5a4cb
|
Scott Ullrich
|
/*
|
33 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/netstat
|
34 |
|
|
pfSense_MODULE: interfaces
|
35 |
|
|
*/
|
36 |
19ac33af
|
Scott Ullrich
|
|
37 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
38 |
|
|
##|*IDENT=page-xmlrpcinterfacestats
|
39 |
|
|
##|*NAME=XMLRPC Interface Stats page
|
40 |
|
|
##|*DESCR=Allow access to the 'XMLRPC Interface Stats' page.
|
41 |
|
|
##|*MATCH=ifstats.php*
|
42 |
|
|
##|-PRIV
|
43 |
|
|
|
44 |
2a2b79f4
|
Bill Marquette
|
require_once('guiconfig.inc');
|
45 |
872ce0dd
|
Ermal Luçi
|
require_once("interfaces.inc");
|
46 |
19ac33af
|
Scott Ullrich
|
|
47 |
|
|
$if = $_GET['if'];
|
48 |
|
|
|
49 |
85a5da13
|
Ermal Luçi
|
$realif = get_real_interface($if);
|
50 |
872ce0dd
|
Ermal Luçi
|
if(!$realif)
|
51 |
3c4fc30b
|
Chris Buechler
|
$realif = $if; // Need for IPsec case interface.
|
52 |
19ac33af
|
Scott Ullrich
|
|
53 |
8e23b225
|
Ermal
|
$ifinfo = pfSense_get_interface_stats($realif);
|
54 |
|
|
|
55 |
19ac33af
|
Scott Ullrich
|
$temp = gettimeofday();
|
56 |
31cb8b31
|
Scott Ullrich
|
$timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;
|
57 |
45581172
|
Ermal Luçi
|
|
58 |
|
|
header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" );
|
59 |
|
|
header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" );
|
60 |
|
|
header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
|
61 |
|
|
header("Cache-Control: post-check=0, pre-check=0", FALSE );
|
62 |
|
|
header("Pragma: no-cache"); // HTTP/1.0
|
63 |
19ac33af
|
Scott Ullrich
|
|
64 |
deea2272
|
Scott Ullrich
|
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
|
65 |
19ac33af
|
Scott Ullrich
|
|
66 |
8e23b225
|
Ermal
|
?>
|