Project

General

Profile

Download (6.14 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 29aef6c4 Jim Thompson
        Copyright (C) 2013-2014 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 0e22dda5 Ermal
        if (!isset($_GET['id']))
65 c656bc75 Phil Davis
                $input_errors[] = gettext("Wrong parameters supplied");
66 0e22dda5 Ermal
        else if (empty($a_vlans[$_GET['id']]))
67 c656bc75 Phil Davis
                $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 7f43ca88 Scott Ullrich
84 f76baeb3 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("VLAN"));
85 b32dd0a6 jim-p
$shortcut_section = "interfaces";
86 7f43ca88 Scott Ullrich
include("head.inc");
87
88 5b237745 Scott Ullrich
?>
89
90
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
91
<?php include("fbegin.inc"); ?>
92
<?php if ($input_errors) print_input_errors($input_errors); ?>
93 f8cc0b6d Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces vlan">
94 5b237745 Scott Ullrich
  <tr><td>
95 c8b8ff69 Scott Ullrich
<?php
96
	$tab_array = array();
97 f76baeb3 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
98
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
99 46e25b71 Carlos Eduardo Ramos
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
100 f76baeb3 Rafael Lucas
	$tab_array[3] = array(gettext("VLANs"), true, "interfaces_vlan.php");
101
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
102
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
103
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
104
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
105
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
106
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
107 c8b8ff69 Scott Ullrich
	display_top_tabs($tab_array);
108
?>
109 5b237745 Scott Ullrich
  </td></tr>
110 cae1695e Scott Ullrich
  <tr>
111 d732f186 Bill Marquette
    <td>
112
	<div id="mainarea">
113 f8cc0b6d Colin Fleming
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
114 5b237745 Scott Ullrich
                <tr>
115 f76baeb3 Rafael Lucas
                  <td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
116
                  <td width="20%" class="listhdrr"><?=gettext("VLAN tag");?></td>
117
                  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
118 5b237745 Scott Ullrich
                  <td width="10%" class="list"></td>
119
				</tr>
120
			  <?php $i = 0; foreach ($a_vlans as $vlan): ?>
121 fd22be34 Ermal Lu?i
                <tr ondblclick="document.location='interfaces_vlan_edit.php?id=<?=$i;?>'">
122 5b237745 Scott Ullrich
                  <td class="listlr">
123
					<?=htmlspecialchars($vlan['if']);?>
124
                  </td>
125
                  <td class="listr">
126
					<?=htmlspecialchars($vlan['tag']);?>
127
                  </td>
128
                  <td class="listbg">
129
                    <?=htmlspecialchars($vlan['descr']);?>&nbsp;
130
                  </td>
131 f8cc0b6d Colin Fleming
                  <td valign="middle" class="list nowrap"> <a href="interfaces_vlan_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
132
                     &nbsp;<a href="interfaces_vlan.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this VLAN?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
133 5b237745 Scott Ullrich
				</tr>
134
			  <?php $i++; endforeach; ?>
135 cae1695e Scott Ullrich
                <tr>
136 5b237745 Scott Ullrich
                  <td class="list" colspan="3">&nbsp;</td>
137 f8cc0b6d Colin Fleming
                  <td class="list"> <a href="interfaces_vlan_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
138 5b237745 Scott Ullrich
				</tr>
139
				<tr>
140
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
141 8cd558b6 ayvis
				  <?=gettext("Note:");?><br />
142 5b237745 Scott Ullrich
				  </strong></span>
143 3119dcde Vinicius Coque
				  <?php printf(gettext("Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the %s handbook for information on supported cards."),$g['product_name']);?> </p>
144 5b237745 Scott Ullrich
				  </td>
145
				<td class="list">&nbsp;</td>
146
				</tr>
147
              </table>
148 d732f186 Bill Marquette
	      </div>
149
	</td>
150 5b237745 Scott Ullrich
	</tr>
151
</table>
152
<?php include("fend.inc"); ?>
153
</body>
154
</html>