Project

General

Profile

Download (4.7 KB) Statistics
| Branch: | Tag: | Revision:
1 cae1695e Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	interfaces_vlan.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6 cae1695e Scott Ullrich
7 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9 5b237745 Scott Ullrich
	All rights reserved.
10 cae1695e Scott Ullrich
11 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13 cae1695e Scott Ullrich
14 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16 cae1695e Scott Ullrich
17 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20 cae1695e Scott Ullrich
21 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32 7ac5a4cb Scott Ullrich
/*
33
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
34
	pfSense_MODULE:	interfaces
35
*/
36 5b237745 Scott Ullrich
37 6b07c15a Matthew Grooms
##|+PRIV
38
##|*IDENT=page-interfaces-vlan
39
##|*NAME=Interfaces: VLAN page
40
##|*DESCR=Allow access to the 'Interfaces: VLAN' page.
41
##|*MATCH=interfaces_vlan.php*
42
##|-PRIV
43
44 5b237745 Scott Ullrich
require("guiconfig.inc");
45
46
if (!is_array($config['vlans']['vlan']))
47
	$config['vlans']['vlan'] = array();
48
49
$a_vlans = &$config['vlans']['vlan'] ;
50
51
function vlan_inuse($num) {
52 c059940b Erik Fonnesbeck
	global $config, $a_vlans;
53 5b237745 Scott Ullrich
54 fbb45bb0 Ermal Luçi
	$iflist = get_configured_interface_list(false, true);
55
	foreach ($iflist as $if) {
56 3feef69d Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif'])
57 5b237745 Scott Ullrich
			return true;
58
	}
59 cae1695e Scott Ullrich
60 5b237745 Scott Ullrich
	return false;
61
}
62
63
if ($_GET['act'] == "del") {
64 465f17a3 Thane Gill
	if (!isset($_GET['id']))
65
		$input_errors[] = gettext("Wrong parameters supplied");
66
	else if (empty($a_vlans[$_GET['id']]))
67
		$input_errors[] = gettext("Wrong index supplied");
68 5b237745 Scott Ullrich
	/* check if still in use */
69 0e22dda5 Ermal
	else if (vlan_inuse($_GET['id'])) {
70 f76baeb3 Rafael Lucas
		$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
71 5b237745 Scott Ullrich
	} else {
72 36b7f215 Renato Botelho
		if (does_interface_exist($a_vlans[$_GET['id']]['vlanif']))
73
			pfSense_interface_destroy($a_vlans[$_GET['id']]['vlanif']);
74 5b237745 Scott Ullrich
		unset($a_vlans[$_GET['id']]);
75 cae1695e Scott Ullrich
76 5b237745 Scott Ullrich
		write_config();
77 de068d0b Scott Ullrich
78 5b237745 Scott Ullrich
		header("Location: interfaces_vlan.php");
79
		exit;
80
	}
81
}
82
83 f76baeb3 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("VLAN"));
84 b32dd0a6 jim-p
$shortcut_section = "interfaces";
85 465f17a3 Thane Gill
include('head.inc');
86
87
if ($input_errors) print_input_errors($input_errors);
88
89
$tab_array = array();
90
$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
91
$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
92
$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
93
$tab_array[3] = array(gettext("VLANs"), true, "interfaces_vlan.php");
94
$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
95
$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
96
$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
97
$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
98
$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
99
$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
100
display_top_tabs($tab_array);
101 c8b8ff69 Scott Ullrich
?>
102 465f17a3 Thane Gill
<table class="table">
103
	<caption><?php printf(gettext('NOTE: Not all drivers/NICs support 802.1Q '.
104
	'VLAN tagging properly. On cards that do not explicitly support it, VLAN '.
105
	'tagging will still work, but the reduced MTU may cause problems. See the '.
106
	'%s handbook for information on supported cards.'),$g['product_name'])?></caption>
107
	<tr>
108
		<th class="col-sm-3"><?=gettext('Interface');?></th>
109
		<th class="col-sm-3"><?=gettext('VLAN tag');?></th>
110
		<th><?=gettext('Description');?></th>
111
		<th class="col-sm-2"><a class="btn btn-primary btn-sm" role="button" href="interfaces_vlan_edit.php"><?=gettext('Add VLAN'); ?></a></th>
112
	</tr>
113
	<?php $i = 0; foreach ($a_vlans as $vlan): ?>
114
	<tr>
115
		<td><?=htmlspecialchars($vlan['if']);?></td>
116
		<td><?=htmlspecialchars($vlan['tag']);?></td>
117
		<td><?=htmlspecialchars($vlan['descr']);?></td>
118
		<td>
119
			<a class="btn btn-primary btn-sm" role="button" href="interfaces_vlan_edit.php?id=<?=$i?>"><?=gettext('Edit')?></a>
120 45d6ada5 Sjon Hortensius
			<a class="btn btn-danger btn-sm" role="button" href="interfaces_vlan.php?act=del&amp;id=<?=$i?>"><?=gettext('Delete')?></a></td>
121 465f17a3 Thane Gill
		</td>
122 5b237745 Scott Ullrich
	</tr>
123 465f17a3 Thane Gill
	<?php
124
		$i++;
125
	endforeach;
126
	?>
127 5b237745 Scott Ullrich
</table>
128 465f17a3 Thane Gill
<?php include("foot.inc")?>