1 |
19ac33af
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* ifstats.php
|
4 |
fd9ebcd5
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
|
|
* Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
|
7 |
|
|
* All rights reserved.
|
8 |
fd9ebcd5
|
Stephen Beaver
|
*
|
9 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
|
|
* you may not use this file except in compliance with the License.
|
11 |
|
|
* You may obtain a copy of the License at
|
12 |
fd9ebcd5
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14 |
fd9ebcd5
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
16 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
|
|
* See the License for the specific language governing permissions and
|
19 |
|
|
* limitations under the License.
|
20 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
21 |
19ac33af
|
Scott Ullrich
|
|
22 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
23 |
|
|
##|*IDENT=page-xmlrpcinterfacestats
|
24 |
5230f468
|
jim-p
|
##|*NAME=XMLRPC Interface Stats
|
25 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'XMLRPC Interface Stats' page.
|
26 |
|
|
##|*MATCH=ifstats.php*
|
27 |
|
|
##|-PRIV
|
28 |
|
|
|
29 |
2a2b79f4
|
Bill Marquette
|
require_once('guiconfig.inc');
|
30 |
872ce0dd
|
Ermal Luçi
|
require_once("interfaces.inc");
|
31 |
19ac33af
|
Scott Ullrich
|
|
32 |
|
|
$if = $_GET['if'];
|
33 |
|
|
|
34 |
85a5da13
|
Ermal Luçi
|
$realif = get_real_interface($if);
|
35 |
45b4ffc6
|
Phil Davis
|
if (!$realif) {
|
36 |
3c4fc30b
|
Chris Buechler
|
$realif = $if; // Need for IPsec case interface.
|
37 |
45b4ffc6
|
Phil Davis
|
}
|
38 |
19ac33af
|
Scott Ullrich
|
|
39 |
8e23b225
|
Ermal
|
$ifinfo = pfSense_get_interface_stats($realif);
|
40 |
|
|
|
41 |
19ac33af
|
Scott Ullrich
|
$temp = gettimeofday();
|
42 |
31cb8b31
|
Scott Ullrich
|
$timing = (double)$temp["sec"] + (double)$temp["usec"] / 1000000.0;
|
43 |
2c5fda82
|
Jose Luis Duran
|
|
44 |
6c07db48
|
Phil Davis
|
header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
|
45 |
|
|
header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
|
46 |
|
|
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP/1.1
|
47 |
45581172
|
Ermal Luçi
|
header("Pragma: no-cache"); // HTTP/1.0
|
48 |
19ac33af
|
Scott Ullrich
|
|
49 |
deea2272
|
Scott Ullrich
|
echo "$timing|" . $ifinfo['inbytes'] . "|" . $ifinfo['outbytes'] . "\n";
|
50 |
19ac33af
|
Scott Ullrich
|
|
51 |
8e23b225
|
Ermal
|
?>
|