Project

General

Profile

Download (5.21 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 b8f91b7c Luiz Souza
 * Copyright (c) 2004-2018 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 a9912980 Steve Beaver
if (!is_array($config['qinqs'])) {
33
	$config['qinqs'] = array();
34
}
35
36 2af86dda Phil Davis
if (!is_array($config['qinqs']['qinqentry'])) {
37 b991e3b5 Ermal Lu?i
	$config['qinqs']['qinqentry'] = array();
38 2af86dda Phil Davis
}
39 b991e3b5 Ermal Lu?i
40
$a_qinqs = &$config['qinqs']['qinqentry'];
41
42 87b458b5 Steve Beaver
if ($_POST['act'] == "del") {
43
	$id = $_POST['id'];
44 eea7eb99 Renato Botelho
45 b991e3b5 Ermal Lu?i
	/* check if still in use */
46 0793de1a Luiz Souza
	if (isset($a_qinqs) && vlan_inuse($a_qinqs[$id])) {
47 a11b9585 Rafael Lucas
		$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
48 eea7eb99 Renato Botelho
	} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
49
		$input_errors[] = gettext("QinQ interface does not exist");
50 b991e3b5 Ermal Lu?i
	} else {
51
		$qinq =& $a_qinqs[$id];
52
53
		$delmembers = explode(" ", $qinq['members']);
54 0793de1a Luiz Souza
		foreach ($delmembers as $tag) {
55
			if (qinq_inuse($qinq, $tag)) {
56
				$input_errors[] = gettext("This QinQ cannot be deleted because one of it tags is still being used as an interface.");
57
				break;
58 2af86dda Phil Davis
			}
59 62f8244b Renato Botelho
		}
60 0793de1a Luiz Souza
	}
61
62
	if (empty($input_errors)) {
63
		$qinq =& $a_qinqs[$id];
64
65
		$ngif = str_replace(".", "_", $qinq['vlanif']);
66
		$delmembers = explode(" ", $qinq['members']);
67
		foreach ($delmembers as $tag) {
68
			mwexec("/usr/sbin/ngctl shutdown {$ngif}h{$tag}:  > /dev/null 2>&1");
69
		}
70
		mwexec("/usr/sbin/ngctl shutdown {$ngif}qinq: > /dev/null 2>&1");
71
		mwexec("/usr/sbin/ngctl shutdown {$ngif}: > /dev/null 2>&1");
72 414aa359 Renato Botelho
		pfSense_interface_destroy($qinq['vlanif']);
73 b991e3b5 Ermal Lu?i
		unset($a_qinqs[$id]);
74
75
		write_config();
76
77
		header("Location: interfaces_qinq.php");
78
		exit;
79
	}
80
}
81
82 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("QinQs"));
83 b32dd0a6 jim-p
$shortcut_section = "interfaces";
84 b991e3b5 Ermal Lu?i
include("head.inc");
85
86 aa82505e Phil Davis
if ($input_errors) {
87 ff846cb9 Sjon Hortensius
	print_input_errors($input_errors);
88 aa82505e Phil Davis
}
89 ff846cb9 Sjon Hortensius
90 b104d092 sbeaver
$tab_array = array();
91 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
92 ff846cb9 Sjon Hortensius
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
93
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
94
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
95
$tab_array[] = array(gettext("QinQs"), true, "interfaces_qinq.php");
96
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
97 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
98
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
99 ff846cb9 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
100 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
101 b104d092 sbeaver
display_top_tabs($tab_array);
102
103 b991e3b5 Ermal Lu?i
?>
104 060ed238 Stephen Beaver
<div class="panel panel-default">
105 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('QinQ Interfaces')?></h2></div>
106 060ed238 Stephen Beaver
	<div class="panel-body">
107
		<div class="table-responsive">
108 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
109 060ed238 Stephen Beaver
				<thead>
110
					<tr>
111 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
112 edb85ffd Renato Botelho
						<th><?=gettext("Tag");?></th>
113 70dc5cd6 Phil Davis
						<th><?=gettext("QinQ members"); ?></th>
114
						<th><?=gettext("Description"); ?></th>
115
						<th><?=gettext("Actions"); ?></th>
116 060ed238 Stephen Beaver
					</tr>
117
				</thead>
118
				<tbody>
119 ff846cb9 Sjon Hortensius
<?php foreach ($a_qinqs as $i => $qinq):?>
120 060ed238 Stephen Beaver
					<tr>
121
						<td>
122
							<?=htmlspecialchars($qinq['if'])?>
123
						</td>
124
						<td>
125
							<?=htmlspecialchars($qinq['tag'])?>
126
						</td>
127
						<td>
128 ff846cb9 Sjon Hortensius
<?php if (strlen($qinq['members']) > 20):?>
129 060ed238 Stephen Beaver
							<?=substr(htmlspecialchars($qinq['members']), 0, 20)?>&hellip;
130 ff846cb9 Sjon Hortensius
<?php else:?>
131 060ed238 Stephen Beaver
							<?=htmlspecialchars($qinq['members'])?>
132 ff846cb9 Sjon Hortensius
<?php endif; ?>
133 060ed238 Stephen Beaver
						</td>
134
						<td>
135
							<?=htmlspecialchars($qinq['descr'])?>&nbsp;
136
						</td>
137
						<td>
138 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit Q-in-Q interface')?>"	href="interfaces_qinq_edit.php?id=<?=$i?>"></a>
139 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>
140 060ed238 Stephen Beaver
						</td>
141
					</tr>
142 b104d092 sbeaver
<?php
143 c72237ee Sjon Hortensius
endforeach;
144 b104d092 sbeaver
?>
145 060ed238 Stephen Beaver
				</tbody>
146
			</table>
147
		</div>
148
	</div>
149 b104d092 sbeaver
</div>
150 ff846cb9 Sjon Hortensius
151 c10cb196 Stephen Beaver
<nav class="action-buttons">
152 4401107f Steve Beaver
	<a href="interfaces_qinq_edit.php" class="btn btn-success btn-sm">
153 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
154 ff846cb9 Sjon Hortensius
		<?=gettext("Add")?>
155
	</a>
156
</nav>
157 2ec8f0ba Stephen Beaver
158 35681930 Stephen Beaver
<div class="infoblock">
159 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, ' .
160
		'QinQ tagging will still work, but the reduced MTU may cause problems.%1$s' .
161
		'See the %2$s handbook for information on supported cards.'), '<br />', $g['product_name']), 'info', false); ?>
162 2ec8f0ba Stephen Beaver
</div>
163
164 b104d092 sbeaver
<?php
165 de4a1c84 Colin Fleming
include("foot.inc");