Project

General

Profile

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