Project

General

Profile

Download (5.27 KB) Statistics
| Branch: | Tag: | Revision:
1 cae1695e Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3 c5d81585 Renato Botelho
 * interfaces_vlan.php
4 191cb31d 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 d42b970e Stephen Beaver
 *
9 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
10
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
 * All rights reserved.
12 d42b970e Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
14
 * you may not use this file except in compliance with the License.
15
 * You may obtain a copy of the License at
16 d42b970e Stephen Beaver
 *
17 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
18 d42b970e Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
20
 * distributed under the License is distributed on an "AS IS" BASIS,
21
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
 * See the License for the specific language governing permissions and
23
 * limitations under the License.
24 d42b970e Stephen Beaver
 */
25 5b237745 Scott Ullrich
26 6b07c15a Matthew Grooms
##|+PRIV
27
##|*IDENT=page-interfaces-vlan
28 5230f468 jim-p
##|*NAME=Interfaces: VLAN
29 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Interfaces: VLAN' page.
30
##|*MATCH=interfaces_vlan.php*
31
##|-PRIV
32
33 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
34 5b237745 Scott Ullrich
35 2af86dda Phil Davis
if (!is_array($config['vlans']['vlan'])) {
36 5b237745 Scott Ullrich
	$config['vlans']['vlan'] = array();
37 2af86dda Phil Davis
}
38 5b237745 Scott Ullrich
39 3b135582 Luiz Souza
$a_vlans = &$config['vlans']['vlan'];
40 5b237745 Scott Ullrich
41 4f7fb8a6 heper
if ($_POST['act'] == "del") {
42
	if (!isset($_POST['id'])) {
43 465f17a3 Thane Gill
		$input_errors[] = gettext("Wrong parameters supplied");
44 4f7fb8a6 heper
	} else if (empty($a_vlans[$_POST['id']])) {
45 465f17a3 Thane Gill
		$input_errors[] = gettext("Wrong index supplied");
46 5b237745 Scott Ullrich
	/* check if still in use */
47 0793de1a Luiz Souza
	} else if (vlan_inuse($a_vlans[$_POST['id']])) {
48 f76baeb3 Rafael Lucas
		$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
49 5b237745 Scott Ullrich
	} else {
50 4f7fb8a6 heper
		if (does_interface_exist($a_vlans[$_POST['id']]['vlanif'])) {
51
			pfSense_interface_destroy($a_vlans[$_POST['id']]['vlanif']);
52 2af86dda Phil Davis
		}
53 4f7fb8a6 heper
		unset($a_vlans[$_POST['id']]);
54 cae1695e Scott Ullrich
55 5b237745 Scott Ullrich
		write_config();
56 de068d0b Scott Ullrich
57 5b237745 Scott Ullrich
		header("Location: interfaces_vlan.php");
58
		exit;
59
	}
60
}
61
62 7f43ca88 Scott Ullrich
63 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("VLANs"));
64 b32dd0a6 jim-p
$shortcut_section = "interfaces";
65 465f17a3 Thane Gill
include('head.inc');
66
67
if ($input_errors) print_input_errors($input_errors);
68
69
$tab_array = array();
70 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
71 69ddae89 sbeaver
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
72
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
73
$tab_array[] = array(gettext("VLANs"), true, "interfaces_vlan.php");
74
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
75
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
76 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
77
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
78 69ddae89 sbeaver
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
79 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
80 465f17a3 Thane Gill
display_top_tabs($tab_array);
81 e78276d8 sbeaver
82
?>
83 4f7fb8a6 heper
<form action="interfaces_vlan.php" method="post">
84
	<input id="act" type="hidden" name="act" value="" />
85
	<input id="id" type="hidden" name="id" value=""/>
86
87 060ed238 Stephen Beaver
	<div class="panel panel-default">
88 70dc5cd6 Phil Davis
		<div class="panel-heading"><h2 class="panel-title"><?=gettext('VLAN Interfaces')?></h2></div>
89 060ed238 Stephen Beaver
		<div class="panel-body">
90
			<div class="table-responsive">
91 1c10ce97 PiBa-NL
				<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
92 060ed238 Stephen Beaver
					<thead>
93
						<tr>
94
							<th><?=gettext('Interface');?></th>
95
							<th><?=gettext('VLAN tag');?></th>
96
							<th><?=gettext('Priority');?></th>
97
							<th><?=gettext('Description');?></th>
98 70dc5cd6 Phil Davis
							<th><?=gettext('Actions');?></th>
99 060ed238 Stephen Beaver
						</tr>
100
					</thead>
101
					<tbody>
102 e78276d8 sbeaver
<?php
103
	$i = 0;
104
	foreach ($a_vlans as $vlan) {
105 c8b8ff69 Scott Ullrich
?>
106 060ed238 Stephen Beaver
						<tr>
107 9fcc7581 Luiz Otavio O Souza
							<td>
108
<?php
109
	printf("%s", htmlspecialchars($vlan['if']));
110
	$iface = convert_real_interface_to_friendly_interface_name($vlan['if']);
111
	if (isset($iface) && strlen($iface) > 0)
112
		printf(" (%s)", htmlspecialchars($iface));
113
?>
114
							</td>
115 060ed238 Stephen Beaver
							<td><?=htmlspecialchars($vlan['tag']);?></td>
116
							<td><?=htmlspecialchars($vlan['pcp']);?></td>
117
							<td><?=htmlspecialchars($vlan['descr']);?></td>
118
							<td>
119 4401107f Steve Beaver
								<a class="fa fa-pencil"	title="<?=gettext('Edit VLAN')?>"	role="button" href="interfaces_vlan_edit.php?id=<?=$i?>" ></a>
120 4a03ae0a Steve Beaver
								<a class="fa fa-trash no-confirm"	title="<?=gettext('Delete VLAN')?>"	role="button" id="del-<?=$i?>"></a>
121 060ed238 Stephen Beaver
							</td>
122
						</tr>
123 968865fa heper
<?php
124 4f7fb8a6 heper
			$i++;
125 e78276d8 sbeaver
	}
126
?>
127 060ed238 Stephen Beaver
					</tbody>
128
				</table>
129
			</div>
130
		</div>
131 4f7fb8a6 heper
	</div>
132 060ed238 Stephen Beaver
133
	<nav class="action-buttons">
134 4401107f Steve Beaver
		<a class="btn btn-success btn-sm" role="button" href="interfaces_vlan_edit.php">
135 060ed238 Stephen Beaver
			<i class="fa fa-plus icon-embed-btn"></i>
136
			<?=gettext('Add'); ?>
137
		</a>
138
	</nav>
139
140 4f7fb8a6 heper
</form>
141
142 35681930 Stephen Beaver
<div class="infoblock">
143 f6aebbcc NewEraCracker
	<?php print_info_box(sprintf(gettext('Not all drivers/NICs support 802.1Q '.
144 7ae1b34f Phil Davis
		'VLAN tagging properly. %1$sOn cards that do not explicitly support it, VLAN '.
145
		'tagging will still work, but the reduced MTU may cause problems.%1$sSee the '.
146
		'%2$s handbook for information on supported cards.'), '<br />', $g['product_name']), 'info', false); ?>
147 2ec8f0ba Stephen Beaver
</div>
148 38fe6f07 Steve Beaver
149
<?php
150
	$delmsg = gettext("Are you sure you want to delete this VLAN?");
151
?>
152
153 8fd9052f Colin Fleming
<script type="text/javascript">
154 4f7fb8a6 heper
//<![CDATA[
155 aa82505e Phil Davis
events.push(function() {
156 4f7fb8a6 heper
	// Select 'delete button' clicks, extract the id, set the hidden input values and submit
157
	$('[id^=del-]').click(function(event) {
158 38fe6f07 Steve Beaver
		if (confirm("<?=$delmsg?>")) {
159
			$('#act').val('del');
160
			$('#id').val(this.id.replace("del-", ""));
161
			$(this).parents('form').submit();
162
		}
163 4f7fb8a6 heper
	});
164 38fe6f07 Steve Beaver
165 4f7fb8a6 heper
});
166
//]]>
167
</script>
168 e78276d8 sbeaver
<?php
169 a41fd4a7 Sjon Hortensius
include("foot.inc");