Project

General

Profile

Download (4.74 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_vlan.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	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

    
21
	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
/*
33
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
34
	pfSense_MODULE: interfaces
35
*/
36

    
37
##|+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
require("guiconfig.inc");
45

    
46
if (!is_array($config['vlans']['vlan'])) {
47
	$config['vlans']['vlan'] = array();
48
}
49

    
50
$a_vlans = &$config['vlans']['vlan'] ;
51

    
52
function vlan_inuse($num) {
53
	global $config, $a_vlans;
54

    
55
	$iflist = get_configured_interface_list(false, true);
56
	foreach ($iflist as $if) {
57
		if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif']) {
58
			return true;
59
		}
60
	}
61

    
62
	return false;
63
}
64

    
65
if ($_GET['act'] == "del") {
66
	if (!isset($_GET['id'])) {
67
		$input_errors[] = gettext("Wrong parameters supplied");
68
	} else if (empty($a_vlans[$_GET['id']])) {
69
		$input_errors[] = gettext("Wrong index supplied");
70
	/* check if still in use */
71
	} else if (vlan_inuse($_GET['id'])) {
72
		$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
73
	} else {
74
		if (does_interface_exist($a_vlans[$_GET['id']]['vlanif'])) {
75
			pfSense_interface_destroy($a_vlans[$_GET['id']]['vlanif']);
76
		}
77
		unset($a_vlans[$_GET['id']]);
78

    
79
		write_config();
80

    
81
		header("Location: interfaces_vlan.php");
82
		exit;
83
	}
84
}
85

    
86

    
87
$pgtitle = array(gettext("Interfaces"), gettext("VLAN"));
88
$shortcut_section = "interfaces";
89
include('head.inc');
90

    
91
if ($input_errors) print_input_errors($input_errors);
92

    
93
$tab_array = array();
94
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
95
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
96
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
97
$tab_array[] = array(gettext("VLANs"), true, "interfaces_vlan.php");
98
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
99
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
100
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
101
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
102
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
103
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
104
display_top_tabs($tab_array);
105

    
106
print_info_box(sprintf(gettext('NOTE: Not all drivers/NICs support 802.1Q '.
107
		'VLAN tagging properly. <br />On cards that do not explicitly support it, VLAN '.
108
		'tagging will still work, but the reduced MTU may cause problems.<br />See the '.
109
		'%s handbook for information on supported cards.'),$g['product_name']));
110
?>
111
<div class="table-responsive">
112
	<table class="table">
113
		<tr>
114
			<th><?=gettext('Interface');?></th>
115
			<th><?=gettext('VLAN tag');?></th>
116
			<th><?=gettext('Description');?></th>
117
		</tr>
118
<?php
119
	$i = 0;
120
	foreach ($a_vlans as $vlan) {
121
?>
122
		<tr>
123
			<td><?=htmlspecialchars($vlan['if']);?></td>
124
			<td><?=htmlspecialchars($vlan['tag']);?></td>
125
			<td><?=htmlspecialchars($vlan['descr']);?></td>
126
			<td>
127
				<a class="btn btn-primary btn-xs" role="button" href="interfaces_vlan_edit.php?id=<?=$i?>"><?=gettext('Edit')?></a>
128
				<a class="btn btn-danger btn-xs" role="button" href="interfaces_vlan.php?act=del&amp;id=<?=$i?>"><?=gettext('Delete')?></a></td>
129
			</td>
130
		</tr>
131
		<?php
132
			$i++;
133
	}
134
?>
135
	</table>
136
	<nav class="action-buttons">
137
		<a class="btn btn-success" role="button" href="interfaces_vlan_edit.php"><?=gettext('Add VLAN'); ?></a>
138
	</nav>
139
</div>
140
<?php
141
include("foot.inc");
(99-99/235)