1 |
8cccee1c
|
Scott Ullrich
|
<?php
|
2 |
2bdf4a03
|
Scott Ullrich
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
status_interfaces.php
|
5 |
|
|
*/
|
6 |
66c52114
|
Stephen Beaver
|
/* ====================================================================
|
7 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
8 |
|
|
* Copyright (c) 2004, 2005 Scott Ullrich
|
9 |
|
|
*
|
10 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
11 |
|
|
* are permitted provided that the following conditions are met:
|
12 |
|
|
*
|
13 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
* this list of conditions and the following disclaimer.
|
15 |
|
|
*
|
16 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
* notice, this list of conditions and the following disclaimer in
|
18 |
|
|
* the documentation and/or other materials provided with the
|
19 |
|
|
* distribution.
|
20 |
|
|
*
|
21 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
22 |
|
|
* must display the following acknowledgment:
|
23 |
|
|
* "This product includes software developed by the pfSense Project
|
24 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
25 |
|
|
*
|
26 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
27 |
|
|
* endorse or promote products derived from this software without
|
28 |
|
|
* prior written permission. For written permission, please contact
|
29 |
|
|
* coreteam@pfsense.org.
|
30 |
|
|
*
|
31 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
32 |
|
|
* nor may "pfSense" appear in their names without prior written
|
33 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
34 |
|
|
*
|
35 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
36 |
|
|
* acknowledgment:
|
37 |
|
|
*
|
38 |
|
|
* "This product includes software developed by the pfSense Project
|
39 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
40 |
|
|
*
|
41 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
42 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
43 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
44 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
45 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
46 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
47 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
48 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
49 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
50 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
51 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
52 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
53 |
|
|
*
|
54 |
|
|
* ====================================================================
|
55 |
|
|
*
|
56 |
|
|
*/
|
57 |
bd06568f
|
sbeaver
|
/*
|
58 |
66c52114
|
Stephen Beaver
|
pfSense_MODULE: interfaces
|
59 |
1d333258
|
Scott Ullrich
|
*/
|
60 |
5b237745
|
Scott Ullrich
|
|
61 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
62 |
|
|
##|*IDENT=page-status-interfaces
|
63 |
|
|
##|*NAME=Status: Interfaces page
|
64 |
|
|
##|*DESCR=Allow access to the 'Status: Interfaces' page.
|
65 |
|
|
##|*MATCH=status_interfaces.php*
|
66 |
|
|
##|-PRIV
|
67 |
|
|
|
68 |
51caa77a
|
Scott Ullrich
|
require_once("guiconfig.inc");
|
69 |
e8f35171
|
Ermal
|
require_once("shaper.inc");
|
70 |
c9a98f18
|
Phil Davis
|
require_once("filter.inc");
|
71 |
5b237745
|
Scott Ullrich
|
|
72 |
a03fb095
|
Renato Botelho
|
if ($_POST['if'] && $_POST['submit']) {
|
73 |
7c9710fc
|
Renato Botelho
|
$interface = $_POST['if'];
|
74 |
42b0c921
|
Phil Davis
|
if ($_POST['status'] == "up") {
|
75 |
80bf3f4a
|
Ermal Luçi
|
interface_bring_down($interface);
|
76 |
42b0c921
|
Phil Davis
|
} else {
|
77 |
bd06568f
|
sbeaver
|
interface_configure($interface);
|
78 |
42b0c921
|
Phil Davis
|
}
|
79 |
56e1d16e
|
Ermal Lu?i
|
header("Location: status_interfaces.php");
|
80 |
|
|
exit;
|
81 |
c26e2cf0
|
Scott Ullrich
|
}
|
82 |
|
|
|
83 |
bd06568f
|
sbeaver
|
$formtemplate = '<form name="%s" action="status_interfaces.php" method="post">' .
|
84 |
|
|
'<input type="hidden" name="if" value="%s" />' .
|
85 |
|
|
'<input type="hidden" name="status" value="%s" />' .
|
86 |
|
|
'%s' .
|
87 |
|
|
'<input type="submit" name="submit" class="btn btn-warning btn-xs" value="%s" />' .
|
88 |
|
|
'</form>';
|
89 |
|
|
|
90 |
|
|
// Display a term/definition pair
|
91 |
|
|
function showDef($show, $term, $def) {
|
92 |
|
|
if($show) {
|
93 |
|
|
print('<dt>' . $term . '</dt>');
|
94 |
fb6c7bb8
|
sbeaver
|
print('<dd>' . htmlspecialchars($def) . '</dd>');
|
95 |
bd06568f
|
sbeaver
|
}
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
// Display a term/definition pair with a button
|
99 |
|
|
function showDefBtn($show, $term, $def, $ifval, $btnlbl) {
|
100 |
|
|
global $formtemplate;
|
101 |
|
|
|
102 |
|
|
if($show) {
|
103 |
|
|
print('<dt>' . $term . '</dt>');
|
104 |
|
|
print('<dd>');
|
105 |
fb6c7bb8
|
sbeaver
|
printf($formtemplate, $term, $ifvalue, $show, htmlspecialchars($def) . ' ', $btnlbl);
|
106 |
bd06568f
|
sbeaver
|
print('</dd>');
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
ee644822
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("Status"),gettext("Interfaces"));
|
111 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
112 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
113 |
|
|
|
114 |
66c52114
|
Stephen Beaver
|
$ifdescrs = get_configured_interface_with_descr(false, true);
|
115 |
8cccee1c
|
Scott Ullrich
|
|
116 |
66c52114
|
Stephen Beaver
|
foreach ($ifdescrs as $ifdescr => $ifname):
|
117 |
|
|
$ifinfo = get_interface_info($ifdescr);
|
118 |
|
|
$mac_man = load_mac_manufacturer_table();
|
119 |
0d7b21de
|
sullrich
|
?>
|
120 |
bd06568f
|
sbeaver
|
|
121 |
|
|
<div class="panel panel-default">
|
122 |
f17594c7
|
Sjon Hortensius
|
<div class="panel-heading"><h2 class="panel-title"><?=htmlspecialchars($ifname)?><?=gettext(" interface "); ?>(<?=htmlspecialchars($ifdescr)?>, <?=htmlspecialchars($ifinfo['hwif'])?>)</h2></div>
|
123 |
fb6c7bb8
|
sbeaver
|
<div class="panel-body">
|
124 |
|
|
<dl class="dl-horizontal">
|
125 |
0d7b21de
|
sullrich
|
<?php
|
126 |
fb6c7bb8
|
sbeaver
|
showDef(true, gettext("Status"), $ifinfo['status']);
|
127 |
|
|
showDefBtn($ifinfo['dhcplink'], 'DHCP', $ifinfo['dhcplink'], $ifdescr, $ifinfo['dhcplink'] == "up" ? gettext("Release") : gettext("Renew"));
|
128 |
|
|
showDefBtn($ifinfo['dhcp6link'], 'DHCP6', $ifinfo['dhcp6link'], $ifdescr, $ifinfo['dhcp6link'] == "up" ? gettext("Release") : gettext("Renew"));
|
129 |
|
|
showDefBtn($ifinfo['pppoelink'], 'PPPoE', $ifinfo['pppoelink'], $ifdescr, $ifinfo['pppoelink'] == "up" ? gettext("Disconnect") : gettext("Connect"));
|
130 |
|
|
showDefBtn($ifinfo['pptplink'], 'PPTP', $ifinfo['pptplink'], $ifdescr, $ifinfo['pptplink'] == "up" ? gettext("Disconnect") : gettext("Connect"));
|
131 |
|
|
showDefBtn($ifinfo['l2tplink'], 'L2TP', $ifinfo['l2tplink'], $ifdescr, $ifinfo['l2tplink'] == "up" ? gettext("Disconnect") : gettext("Connect"));
|
132 |
|
|
showDefBtn($ifinfo['ppplink'], 'L2TP', $ifinfo['ppplink'], $ifdescr, ($ifinfo['ppplink'] == "up" && !$ifinfo['nodevice']) ? gettext("Disconnect") : gettext("Connect"));
|
133 |
|
|
showDef($ifinfo['ppp_uptime'] || $ifinfo['ppp_uptime_accumulated'], gettext("Uptime ") . $ifinfo['ppp_uptime_accumulated'] ? '(historical)':'', $ifinfo['ppp_uptime'] . $ifinfo['ppp_uptime_accumulated']);
|
134 |
|
|
showDef($ifinfo['cell_rssi'], gettext("Cell Signal (RSSI)"), $ifinfo['cell_rssi']);
|
135 |
|
|
showDef($ifinfo['cell_mode'], gettext("Cell Mode"), $ifinfo['cell_mode']);
|
136 |
|
|
showDef($ifinfo['cell_simstate'], gettext("Cell SIM State"), $ifinfo['cell_simstate']);
|
137 |
|
|
showDef($ifinfo['cell_service'], gettext("Cell Service"), $ifinfo['cell_service']);
|
138 |
|
|
showDef($ifinfo['cell_bwupstream'], gettext("Cell Upstream"), $ifinfo['cell_bwupstream']);
|
139 |
|
|
showDef($ifinfo['cell_bwdownstream'], gettext("Cell Downstream"), $ifinfo['cell_bwdownstream']);
|
140 |
|
|
showDef($ifinfo['cell_upstream'], gettext("Cell Current Up"), $ifinfo['cell_upstream']);
|
141 |
|
|
showDef($ifinfo['cell_downstream'], gettext("Cell Current Down"), $ifinfo['cell_downstream']);
|
142 |
|
|
|
143 |
|
|
if ($ifinfo['macaddr']) {
|
144 |
|
|
$mac=$ifinfo['macaddr'];
|
145 |
|
|
$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
|
146 |
|
|
showDef(isset($mac_man[$mac_hi]), gettext('MAC Address'), ' - ' . $mac_man[$mac_hi]);
|
147 |
bd06568f
|
sbeaver
|
}
|
148 |
|
|
|
149 |
fb6c7bb8
|
sbeaver
|
if ($ifinfo['status'] != "down") {
|
150 |
|
|
if ($ifinfo['dhcplink'] != "down" && $ifinfo['pppoelink'] != "down" && $ifinfo['pptplink'] != "down") {
|
151 |
|
|
showDef($ifinfo['ipaddr'], gettext('IPv4 Address'), $ifinfo['ipaddr']);
|
152 |
|
|
showDef($ifinfo['subnet'], gettext('Subnet mask IPv4'), $ifinfo['subnet']);
|
153 |
|
|
showDef($ifinfo['gateway'], gettext('Gateway IPv4'), $ifinfo['gateway']);
|
154 |
|
|
showDef($ifinfo['linklocal'], gettext('IPv6 Link Local'), $ifinfo['linklocal']);
|
155 |
|
|
showDef($ifinfo['ipaddrv6'], gettext('IPv6 Address'), $ifinfo['ipaddrv6']);
|
156 |
|
|
showDef($ifinfo['subnetv6'], gettext('Subnet mask IPv6'), $ifinfo['subnetv6']);
|
157 |
|
|
showDef($ifinfo['gatewayv6'], gettext("Gateway IPv6"), $config['interfaces'][$ifdescr]['gatewayv6'] . $ifinfo['gatewayv6']);
|
158 |
|
|
|
159 |
|
|
if ($ifdescr == "wan" && file_exists("{$g['varetc_path']}/resolv.conf")) {
|
160 |
|
|
$dns_servers = get_dns_servers();
|
161 |
|
|
$dnscnt = 0;
|
162 |
|
|
foreach($dns_servers as $dns) {
|
163 |
|
|
showDef(true, $dnscnt == 0 ? gettext('ISP DNS servers'):'', $dns);
|
164 |
|
|
$dnscnt++;
|
165 |
bd06568f
|
sbeaver
|
}
|
166 |
|
|
}
|
167 |
fb6c7bb8
|
sbeaver
|
}
|
168 |
bd06568f
|
sbeaver
|
|
169 |
fb6c7bb8
|
sbeaver
|
showDef($ifinfo['mtu'], gettext("MTU"), $ifinfo['mtu']);
|
170 |
|
|
showDef($ifinfo['media'], gettext("Media"), $ifinfo['media']);
|
171 |
|
|
showDef($ifinfo['laggproto'], gettext("LAGG Protocol"), $ifinfo['laggproto']);
|
172 |
|
|
showDef($ifinfo['laggport'],gettext("LAGG Ports"),$laggport);
|
173 |
|
|
showDef($ifinfo['channel'],gettext("Channel"),$ifinfo['channel']);
|
174 |
|
|
showDef($ifinfo['ssid'],gettext("SSID"),$ifinfo['ssid']);
|
175 |
|
|
showDef($ifinfo['bssid'],gettext("BSSID"),$ifinfo['bssid']);
|
176 |
|
|
showDef($ifinfo['rate'],gettext("Rate"),$ifinfo['rate']);
|
177 |
|
|
showDef($ifinfo['rssi'],gettext("RSSI"),$ifinfo['rssi']);
|
178 |
|
|
showDef(true,gettext("In/out packets"),$ifinfo['inpkts'] . '/' . $ifinfo['outpkts']);
|
179 |
|
|
showDef(true,gettext("In/out packets (pass)"),$ifinfo['inpktspass'] . "/" . $ifinfo['outpktspass']);
|
180 |
|
|
showDef(true,gettext("In/out packets (block)"),$ifinfo['inpktsblock'] . "/" . $ifinfo['outpktsblock']);
|
181 |
|
|
showDef(isset($ifinfo['inerrs']),gettext("In/out errors"),$ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);
|
182 |
|
|
showDef(isset($ifinfo['collisions']),gettext("Collisions"),$ifinfo['collisions']);
|
183 |
|
|
} // e-o-if ($ifinfo['status'] != "down")
|
184 |
|
|
|
185 |
|
|
showDef($ifinfo['bridge'], gettext('Bridge (') . $ifinfo['bridgeint'] . ')', $ifinfo['bridge']);
|
186 |
|
|
|
187 |
|
|
if(file_exists("/usr/bin/vmstat")) {
|
188 |
|
|
$real_interface = "";
|
189 |
|
|
$interrupt_total = "";
|
190 |
|
|
$interrupt_sec = "";
|
191 |
|
|
$real_interface = $ifinfo['hwif'];
|
192 |
|
|
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $3 }'`;
|
193 |
|
|
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
|
194 |
|
|
|
195 |
|
|
if(strstr($interrupt_total, "hci")) {
|
196 |
|
|
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
|
197 |
|
|
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $5 }'`;
|
198 |
bd06568f
|
sbeaver
|
}
|
199 |
fb6c7bb8
|
sbeaver
|
|
200 |
|
|
unset($interrupt_total);
|
201 |
|
|
|
202 |
|
|
showDef($interrupt_total, gettext('Total interrupts'), $interrupt_total);
|
203 |
|
|
showDef($interrupt_total, '', $interrupt_sec . " " . $interrupt_total);
|
204 |
|
|
}
|
205 |
bd06568f
|
sbeaver
|
?>
|
206 |
fb6c7bb8
|
sbeaver
|
</dl>
|
207 |
bd06568f
|
sbeaver
|
</div>
|
208 |
|
|
</div>
|
209 |
0d7b21de
|
sullrich
|
|
210 |
db794357
|
Colin Fleming
|
<?php
|
211 |
|
|
endforeach;
|
212 |
|
|
?>
|
213 |
|
|
|
214 |
fb6c7bb8
|
sbeaver
|
<div class="alert alert-warning" role="alert">
|
215 |
|
|
<?=gettext("Using dial-on-demand will bring the connection up again if any packet ".
|
216 |
|
|
"triggers it. To substantiate this point: disconnecting manually ".
|
217 |
|
|
"will <strong>not</strong> prevent dial-on-demand from making connections ".
|
218 |
|
|
"to the outside! Don't use dial-on-demand if you want to make sure that the line ".
|
219 |
|
|
"is kept disconnected.");?>
|
220 |
|
|
</div>
|
221 |
71d9cd3d
|
Scott Ullrich
|
|
222 |
db794357
|
Colin Fleming
|
<?php include("foot.inc"); ?>
|