Project

General

Profile

Download (5.1 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_qinq.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * 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
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * 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
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-interfaces-qinq
24
##|*NAME=Interfaces: QinQ
25
##|*DESCR=Allow access to the 'Interfaces: QinQ' page.
26
##|*MATCH=interfaces_qinq.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30
require_once("functions.inc");
31

    
32
init_config_arr(array('qinqs', 'qinqentry'));
33
$a_qinqs = &$config['qinqs']['qinqentry'];
34

    
35
if ($_POST['act'] == "del") {
36
	$id = $_POST['id'];
37

    
38
	/* check if still in use */
39
	if (isset($a_qinqs) && vlan_inuse($a_qinqs[$id])) {
40
		$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
41
	} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
42
		$input_errors[] = gettext("QinQ interface does not exist");
43
	} else {
44
		$qinq =& $a_qinqs[$id];
45

    
46
		$delmembers = explode(" ", $qinq['members']);
47
		foreach ($delmembers as $tag) {
48
			if (qinq_inuse($qinq, $tag)) {
49
				$input_errors[] = gettext("This QinQ cannot be deleted because one of it tags is still being used as an interface.");
50
				break;
51
			}
52
		}
53
	}
54

    
55
	if (empty($input_errors)) {
56
		$qinq =& $a_qinqs[$id];
57

    
58
		$ngif = str_replace(".", "_", $qinq['vlanif']);
59
		$delmembers = explode(" ", $qinq['members']);
60
		foreach ($delmembers as $tag) {
61
			mwexec("/usr/sbin/ngctl shutdown {$ngif}h{$tag}:  > /dev/null 2>&1");
62
		}
63
		mwexec("/usr/sbin/ngctl shutdown {$ngif}qinq: > /dev/null 2>&1");
64
		mwexec("/usr/sbin/ngctl shutdown {$ngif}: > /dev/null 2>&1");
65
		pfSense_interface_destroy($qinq['vlanif']);
66
		unset($a_qinqs[$id]);
67

    
68
		write_config();
69

    
70
		header("Location: interfaces_qinq.php");
71
		exit;
72
	}
73
}
74

    
75
$pgtitle = array(gettext("Interfaces"), gettext("QinQs"));
76
$shortcut_section = "interfaces";
77
include("head.inc");
78

    
79
if ($input_errors) {
80
	print_input_errors($input_errors);
81
}
82

    
83
$tab_array = array();
84
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
85
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
86
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
87
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
88
$tab_array[] = array(gettext("QinQs"), true, "interfaces_qinq.php");
89
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
90
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
91
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
92
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
93
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
94
display_top_tabs($tab_array);
95

    
96
?>
97
<div class="panel panel-default">
98
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('QinQ Interfaces')?></h2></div>
99
	<div class="panel-body">
100
		<div class="table-responsive">
101
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
102
				<thead>
103
					<tr>
104
						<th><?=gettext("Interface"); ?></th>
105
						<th><?=gettext("Tag");?></th>
106
						<th><?=gettext("QinQ members"); ?></th>
107
						<th><?=gettext("Description"); ?></th>
108
						<th><?=gettext("Actions"); ?></th>
109
					</tr>
110
				</thead>
111
				<tbody>
112
<?php foreach ($a_qinqs as $i => $qinq):?>
113
					<tr>
114
						<td>
115
							<?=htmlspecialchars($qinq['if'])?>
116
						</td>
117
						<td>
118
							<?=htmlspecialchars($qinq['tag'])?>
119
						</td>
120
						<td>
121
<?php if (strlen($qinq['members']) > 20):?>
122
							<?=substr(htmlspecialchars($qinq['members']), 0, 20)?>&hellip;
123
<?php else:?>
124
							<?=htmlspecialchars($qinq['members'])?>
125
<?php endif; ?>
126
						</td>
127
						<td>
128
							<?=htmlspecialchars($qinq['descr'])?>&nbsp;
129
						</td>
130
						<td>
131
							<a class="fa fa-pencil"	title="<?=gettext('Edit Q-in-Q interface')?>"	href="interfaces_qinq_edit.php?id=<?=$i?>"></a>
132
							<a class="fa fa-trash"	title="<?=gettext('Delete Q-in-Q interface')?>"	href="interfaces_qinq.php?act=del&amp;id=<?=$i?>" usepost></a>
133
						</td>
134
					</tr>
135
<?php
136
endforeach;
137
?>
138
				</tbody>
139
			</table>
140
		</div>
141
	</div>
142
</div>
143

    
144
<nav class="action-buttons">
145
	<a href="interfaces_qinq_edit.php" class="btn btn-success btn-sm">
146
		<i class="fa fa-plus icon-embed-btn"></i>
147
		<?=gettext("Add")?>
148
	</a>
149
</nav>
150

    
151
<div class="infoblock">
152
	<?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, ' .
153
		'QinQ tagging will still work, but the reduced MTU may cause problems.%1$s' .
154
		'See the %2$s handbook for information on supported cards.'), '<br />', $g['product_name']), 'info', false); ?>
155
</div>
156

    
157
<?php
158
include("foot.inc");
(85-85/234)