1 |
de4a1c84
|
Colin Fleming
|
<?php
|
2 |
919d91f9
|
Phil Davis
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* interfaces_qinq.php
|
4 |
b9043cdc
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
b9043cdc
|
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 |
b9043cdc
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14 |
b9043cdc
|
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 |
b9043cdc
|
Stephen Beaver
|
*/
|
21 |
b991e3b5
|
Ermal Lu?i
|
|
22 |
|
|
##|+PRIV
|
23 |
|
|
##|*IDENT=page-interfaces-qinq
|
24 |
5230f468
|
jim-p
|
##|*NAME=Interfaces: QinQ
|
25 |
b991e3b5
|
Ermal Lu?i
|
##|*DESCR=Allow access to the 'Interfaces: QinQ' page.
|
26 |
|
|
##|*MATCH=interfaces_qinq.php*
|
27 |
|
|
##|-PRIV
|
28 |
|
|
|
29 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
30 |
347ec09e
|
Carlos Eduardo Ramos
|
require_once("functions.inc");
|
31 |
b991e3b5
|
Ermal Lu?i
|
|
32 |
2af86dda
|
Phil Davis
|
if (!is_array($config['qinqs']['qinqentry'])) {
|
33 |
b991e3b5
|
Ermal Lu?i
|
$config['qinqs']['qinqentry'] = array();
|
34 |
2af86dda
|
Phil Davis
|
}
|
35 |
b991e3b5
|
Ermal Lu?i
|
|
36 |
|
|
$a_qinqs = &$config['qinqs']['qinqentry'];
|
37 |
|
|
|
38 |
|
|
function qinq_inuse($num) {
|
39 |
c059940b
|
Erik Fonnesbeck
|
global $config, $a_qinqs;
|
40 |
b991e3b5
|
Ermal Lu?i
|
|
41 |
|
|
$iflist = get_configured_interface_list(false, true);
|
42 |
|
|
foreach ($iflist as $if) {
|
43 |
2af86dda
|
Phil Davis
|
if ($config['interfaces'][$if]['if'] == $a_qinqs[$num]['qinqif']) {
|
44 |
b991e3b5
|
Ermal Lu?i
|
return true;
|
45 |
2af86dda
|
Phil Davis
|
}
|
46 |
b991e3b5
|
Ermal Lu?i
|
}
|
47 |
|
|
|
48 |
|
|
return false;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
if ($_GET['act'] == "del") {
|
52 |
eea7eb99
|
Renato Botelho
|
$id = $_GET['id'];
|
53 |
|
|
|
54 |
b991e3b5
|
Ermal Lu?i
|
/* check if still in use */
|
55 |
eea7eb99
|
Renato Botelho
|
if (qinq_inuse($id)) {
|
56 |
a11b9585
|
Rafael Lucas
|
$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
|
57 |
eea7eb99
|
Renato Botelho
|
} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
|
58 |
|
|
$input_errors[] = gettext("QinQ interface does not exist");
|
59 |
b991e3b5
|
Ermal Lu?i
|
} else {
|
60 |
|
|
$qinq =& $a_qinqs[$id];
|
61 |
|
|
|
62 |
|
|
$delmembers = explode(" ", $qinq['members']);
|
63 |
62f8244b
|
Renato Botelho
|
if (count($delmembers) > 0) {
|
64 |
2af86dda
|
Phil Davis
|
foreach ($delmembers as $tag) {
|
65 |
4400ad66
|
Ermal Lu?i
|
mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:");
|
66 |
2af86dda
|
Phil Davis
|
}
|
67 |
62f8244b
|
Renato Botelho
|
}
|
68 |
4400ad66
|
Ermal Lu?i
|
mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:");
|
69 |
|
|
mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:");
|
70 |
414aa359
|
Renato Botelho
|
pfSense_interface_destroy($qinq['vlanif']);
|
71 |
b991e3b5
|
Ermal Lu?i
|
unset($a_qinqs[$id]);
|
72 |
|
|
|
73 |
|
|
write_config();
|
74 |
|
|
|
75 |
|
|
header("Location: interfaces_qinq.php");
|
76 |
|
|
exit;
|
77 |
|
|
}
|
78 |
|
|
}
|
79 |
|
|
|
80 |
26b4bef8
|
k-paulius
|
$pgtitle = array(gettext("Interfaces"), gettext("QinQs"));
|
81 |
b32dd0a6
|
jim-p
|
$shortcut_section = "interfaces";
|
82 |
b991e3b5
|
Ermal Lu?i
|
include("head.inc");
|
83 |
|
|
|
84 |
aa82505e
|
Phil Davis
|
if ($input_errors) {
|
85 |
ff846cb9
|
Sjon Hortensius
|
print_input_errors($input_errors);
|
86 |
aa82505e
|
Phil Davis
|
}
|
87 |
ff846cb9
|
Sjon Hortensius
|
|
88 |
b104d092
|
sbeaver
|
$tab_array = array();
|
89 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
90 |
ff846cb9
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
91 |
|
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
92 |
|
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
93 |
|
|
$tab_array[] = array(gettext("QinQs"), true, "interfaces_qinq.php");
|
94 |
|
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
95 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
96 |
|
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
97 |
ff846cb9
|
Sjon Hortensius
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
98 |
26b4bef8
|
k-paulius
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
99 |
b104d092
|
sbeaver
|
display_top_tabs($tab_array);
|
100 |
|
|
|
101 |
b991e3b5
|
Ermal Lu?i
|
?>
|
102 |
060ed238
|
Stephen Beaver
|
<div class="panel panel-default">
|
103 |
70dc5cd6
|
Phil Davis
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('QinQ Interfaces')?></h2></div>
|
104 |
060ed238
|
Stephen Beaver
|
<div class="panel-body">
|
105 |
|
|
<div class="table-responsive">
|
106 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
107 |
060ed238
|
Stephen Beaver
|
<thead>
|
108 |
|
|
<tr>
|
109 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Interface"); ?></th>
|
110 |
edb85ffd
|
Renato Botelho
|
<th><?=gettext("Tag");?></th>
|
111 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("QinQ members"); ?></th>
|
112 |
|
|
<th><?=gettext("Description"); ?></th>
|
113 |
|
|
<th><?=gettext("Actions"); ?></th>
|
114 |
060ed238
|
Stephen Beaver
|
</tr>
|
115 |
|
|
</thead>
|
116 |
|
|
<tbody>
|
117 |
ff846cb9
|
Sjon Hortensius
|
<?php foreach ($a_qinqs as $i => $qinq):?>
|
118 |
060ed238
|
Stephen Beaver
|
<tr>
|
119 |
|
|
<td>
|
120 |
|
|
<?=htmlspecialchars($qinq['if'])?>
|
121 |
|
|
</td>
|
122 |
|
|
<td>
|
123 |
|
|
<?=htmlspecialchars($qinq['tag'])?>
|
124 |
|
|
</td>
|
125 |
|
|
<td>
|
126 |
ff846cb9
|
Sjon Hortensius
|
<?php if (strlen($qinq['members']) > 20):?>
|
127 |
060ed238
|
Stephen Beaver
|
<?=substr(htmlspecialchars($qinq['members']), 0, 20)?>…
|
128 |
ff846cb9
|
Sjon Hortensius
|
<?php else:?>
|
129 |
060ed238
|
Stephen Beaver
|
<?=htmlspecialchars($qinq['members'])?>
|
130 |
ff846cb9
|
Sjon Hortensius
|
<?php endif; ?>
|
131 |
060ed238
|
Stephen Beaver
|
</td>
|
132 |
|
|
<td>
|
133 |
|
|
<?=htmlspecialchars($qinq['descr'])?>
|
134 |
|
|
</td>
|
135 |
|
|
<td>
|
136 |
|
|
<a class="fa fa-pencil" title="<?=gettext('Edit Q-in-Q interface')?>" href="interfaces_qinq_edit.php?id=<?=$i?>"></a>
|
137 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete Q-in-Q interface')?>" href="interfaces_qinq.php?act=del&id=<?=$i?>"></a>
|
138 |
|
|
</td>
|
139 |
|
|
</tr>
|
140 |
b104d092
|
sbeaver
|
<?php
|
141 |
c72237ee
|
Sjon Hortensius
|
endforeach;
|
142 |
b104d092
|
sbeaver
|
?>
|
143 |
060ed238
|
Stephen Beaver
|
</tbody>
|
144 |
|
|
</table>
|
145 |
|
|
</div>
|
146 |
|
|
</div>
|
147 |
b104d092
|
sbeaver
|
</div>
|
148 |
ff846cb9
|
Sjon Hortensius
|
|
149 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
150 |
2ec8f0ba
|
Stephen Beaver
|
<a href="interfaces_qinq_edit.php" class="btn btn-success btn-sm">
|
151 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
152 |
ff846cb9
|
Sjon Hortensius
|
<?=gettext("Add")?>
|
153 |
|
|
</a>
|
154 |
|
|
</nav>
|
155 |
2ec8f0ba
|
Stephen Beaver
|
|
156 |
35681930
|
Stephen Beaver
|
<div class="infoblock">
|
157 |
f6aebbcc
|
NewEraCracker
|
<?php print_info_box(sprintf(gettext('Not all drivers/NICs support 802.1Q QinQ tagging properly. <br />On cards that do not explicitly support it, ' .
|
158 |
2ec8f0ba
|
Stephen Beaver
|
'QinQ tagging will still work, but the reduced MTU may cause problems.<br />' .
|
159 |
f6aebbcc
|
NewEraCracker
|
'See the %s handbook for information on supported cards.'), $g['product_name']), 'info', false); ?>
|
160 |
2ec8f0ba
|
Stephen Beaver
|
</div>
|
161 |
|
|
|
162 |
b104d092
|
sbeaver
|
<?php
|
163 |
de4a1c84
|
Colin Fleming
|
include("foot.inc");
|