1
|
<?php
|
2
|
/*
|
3
|
* interfaces_qinq.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8
|
* Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved.
|
10
|
*
|
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
* you may not use this file except in compliance with the License.
|
13
|
* You may obtain a copy of the License at
|
14
|
*
|
15
|
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
*
|
17
|
* Unless required by applicable law or agreed to in writing, software
|
18
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
* See the License for the specific language governing permissions and
|
21
|
* limitations under the License.
|
22
|
*/
|
23
|
|
24
|
##|+PRIV
|
25
|
##|*IDENT=page-interfaces-qinq
|
26
|
##|*NAME=Interfaces: QinQ
|
27
|
##|*DESCR=Allow access to the 'Interfaces: QinQ' page.
|
28
|
##|*MATCH=interfaces_qinq.php*
|
29
|
##|-PRIV
|
30
|
|
31
|
require_once("guiconfig.inc");
|
32
|
require_once("functions.inc");
|
33
|
|
34
|
init_config_arr(array('qinqs', 'qinqentry'));
|
35
|
$a_qinqs = &$config['qinqs']['qinqentry'];
|
36
|
|
37
|
if ($_POST['act'] == "del") {
|
38
|
$id = $_POST['id'];
|
39
|
|
40
|
/* check if still in use */
|
41
|
if (isset($a_qinqs) && vlan_inuse($a_qinqs[$id])) {
|
42
|
$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
|
43
|
} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
|
44
|
$input_errors[] = gettext("QinQ interface does not exist");
|
45
|
} else {
|
46
|
$qinq =& $a_qinqs[$id];
|
47
|
|
48
|
$delmembers = explode(" ", $qinq['members']);
|
49
|
foreach ($delmembers as $tag) {
|
50
|
if (qinq_inuse($qinq, $tag)) {
|
51
|
$input_errors[] = gettext("This QinQ cannot be deleted because one of it tags is still being used as an interface.");
|
52
|
break;
|
53
|
}
|
54
|
}
|
55
|
}
|
56
|
|
57
|
if (empty($input_errors)) {
|
58
|
$qinq =& $a_qinqs[$id];
|
59
|
|
60
|
$delmembers = explode(" ", $qinq['members']);
|
61
|
foreach ($delmembers as $tag) {
|
62
|
exec("/sbin/ifconfig {$qinq['vlanif']}.{$tag} destroy");
|
63
|
}
|
64
|
pfSense_interface_destroy($qinq['vlanif']);
|
65
|
unset($a_qinqs[$id]);
|
66
|
|
67
|
write_config("QinQ interface deleted");
|
68
|
|
69
|
header("Location: interfaces_qinq.php");
|
70
|
exit;
|
71
|
}
|
72
|
}
|
73
|
|
74
|
$pgtitle = array(gettext("Interfaces"), gettext("QinQs"));
|
75
|
$shortcut_section = "interfaces";
|
76
|
include("head.inc");
|
77
|
|
78
|
if ($input_errors) {
|
79
|
print_input_errors($input_errors);
|
80
|
}
|
81
|
|
82
|
$tab_array = array();
|
83
|
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
|
84
|
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
85
|
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
86
|
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
87
|
$tab_array[] = array(gettext("QinQs"), true, "interfaces_qinq.php");
|
88
|
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
89
|
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
|
90
|
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
|
91
|
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
92
|
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
|
93
|
display_top_tabs($tab_array);
|
94
|
|
95
|
?>
|
96
|
<div class="panel panel-default">
|
97
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('QinQ Interfaces')?></h2></div>
|
98
|
<div class="panel-body">
|
99
|
<div class="table-responsive">
|
100
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
101
|
<thead>
|
102
|
<tr>
|
103
|
<th><?=gettext("Interface"); ?></th>
|
104
|
<th><?=gettext("Tag");?></th>
|
105
|
<th><?=gettext("QinQ members"); ?></th>
|
106
|
<th><?=gettext("Description"); ?></th>
|
107
|
<th><?=gettext("Actions"); ?></th>
|
108
|
</tr>
|
109
|
</thead>
|
110
|
<tbody>
|
111
|
<?php foreach ($a_qinqs as $i => $qinq):?>
|
112
|
<tr>
|
113
|
<td>
|
114
|
<?=htmlspecialchars($qinq['if'])?>
|
115
|
</td>
|
116
|
<td>
|
117
|
<?=htmlspecialchars($qinq['tag'])?>
|
118
|
</td>
|
119
|
<td>
|
120
|
<?php if (strlen($qinq['members']) > 20):?>
|
121
|
<?=substr(htmlspecialchars($qinq['members']), 0, 20)?>…
|
122
|
<?php else:?>
|
123
|
<?=htmlspecialchars($qinq['members'])?>
|
124
|
<?php endif; ?>
|
125
|
</td>
|
126
|
<td>
|
127
|
<?=htmlspecialchars($qinq['descr'])?>
|
128
|
</td>
|
129
|
<td>
|
130
|
<a class="fa-solid fa-pencil" title="<?=gettext('Edit Q-in-Q interface')?>" href="interfaces_qinq_edit.php?id=<?=$i?>"></a>
|
131
|
<a class="fa-solid fa-trash-can" title="<?=gettext('Delete Q-in-Q interface')?>" href="interfaces_qinq.php?act=del&id=<?=$i?>" usepost></a>
|
132
|
</td>
|
133
|
</tr>
|
134
|
<?php
|
135
|
endforeach;
|
136
|
?>
|
137
|
</tbody>
|
138
|
</table>
|
139
|
</div>
|
140
|
</div>
|
141
|
</div>
|
142
|
|
143
|
<nav class="action-buttons">
|
144
|
<a href="interfaces_qinq_edit.php" class="btn btn-success btn-sm">
|
145
|
<i class="fa-solid fa-plus icon-embed-btn"></i>
|
146
|
<?=gettext("Add")?>
|
147
|
</a>
|
148
|
</nav>
|
149
|
|
150
|
<div class="infoblock">
|
151
|
<?php print_info_box(sprintf(gettext('Not all drivers/NICs support 802.1Q QinQ tagging properly. %1$sOn cards that do not explicitly support it, ' .
|
152
|
'QinQ tagging will still work, but the reduced MTU may cause problems.%1$s' .
|
153
|
'See the %2$s handbook for information on supported cards.'), '<br />', g_get('product_label')), 'info', false); ?>
|
154
|
</div>
|
155
|
|
156
|
<?php
|
157
|
include("foot.inc");
|