Project

General

Profile

Download (5.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
	All rights reserved.
9 cae1695e Scott Ullrich
10 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 cae1695e Scott Ullrich
13 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 cae1695e Scott Ullrich
16 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19 cae1695e Scott Ullrich
20 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31 7ac5a4cb Scott Ullrich
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE:	interfaces
34
*/
35 5b237745 Scott Ullrich
36 6b07c15a Matthew Grooms
##|+PRIV
37
##|*IDENT=page-interfaces-vlan
38
##|*NAME=Interfaces: VLAN page
39
##|*DESCR=Allow access to the 'Interfaces: VLAN' page.
40
##|*MATCH=interfaces_vlan.php*
41
##|-PRIV
42
43 5b237745 Scott Ullrich
require("guiconfig.inc");
44
45
if (!is_array($config['vlans']['vlan']))
46
	$config['vlans']['vlan'] = array();
47
48
$a_vlans = &$config['vlans']['vlan'] ;
49
50
function vlan_inuse($num) {
51 c059940b Erik Fonnesbeck
	global $config, $a_vlans;
52 5b237745 Scott Ullrich
53 fbb45bb0 Ermal Luçi
	$iflist = get_configured_interface_list(false, true);
54
	foreach ($iflist as $if) {
55 3feef69d Ermal Luçi
		if ($config['interfaces'][$if]['if'] == $a_vlans[$num]['vlanif'])
56 5b237745 Scott Ullrich
			return true;
57
	}
58 cae1695e Scott Ullrich
59 5b237745 Scott Ullrich
	return false;
60
}
61
62
if ($_GET['act'] == "del") {
63
	/* check if still in use */
64
	if (vlan_inuse($_GET['id'])) {
65 f76baeb3 Rafael Lucas
		$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
66 5b237745 Scott Ullrich
	} else {
67 a3f9082f Ermal Luçi
		mwexec("/sbin/ifconfig " . $a_vlans[$_GET['id']]['vlanif'] . " destroy");
68 5b237745 Scott Ullrich
		unset($a_vlans[$_GET['id']]);
69 cae1695e Scott Ullrich
70 5b237745 Scott Ullrich
		write_config();
71 de068d0b Scott Ullrich
72 5b237745 Scott Ullrich
		header("Location: interfaces_vlan.php");
73
		exit;
74
	}
75
}
76
77 7f43ca88 Scott Ullrich
78 f76baeb3 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("VLAN"));
79 7f43ca88 Scott Ullrich
include("head.inc");
80
81 5b237745 Scott Ullrich
?>
82
83
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
84
<?php include("fbegin.inc"); ?>
85
<?php if ($input_errors) print_input_errors($input_errors); ?>
86
<table width="100%" border="0" cellpadding="0" cellspacing="0">
87
  <tr><td>
88 c8b8ff69 Scott Ullrich
<?php
89
	$tab_array = array();
90 f76baeb3 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
91
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
92 46e25b71 Carlos Eduardo Ramos
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
93 f76baeb3 Rafael Lucas
	$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 c8b8ff69 Scott Ullrich
	display_top_tabs($tab_array);
101
?>
102 5b237745 Scott Ullrich
  </td></tr>
103 cae1695e Scott Ullrich
  <tr>
104 d732f186 Bill Marquette
    <td>
105
	<div id="mainarea">
106
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
107 5b237745 Scott Ullrich
                <tr>
108 f76baeb3 Rafael Lucas
                  <td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
109
                  <td width="20%" class="listhdrr"><?=gettext("VLAN tag");?></td>
110
                  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
111 5b237745 Scott Ullrich
                  <td width="10%" class="list"></td>
112
				</tr>
113
			  <?php $i = 0; foreach ($a_vlans as $vlan): ?>
114 fd22be34 Ermal Lu?i
                <tr ondblclick="document.location='interfaces_vlan_edit.php?id=<?=$i;?>'">
115 5b237745 Scott Ullrich
                  <td class="listlr">
116
					<?=htmlspecialchars($vlan['if']);?>
117
                  </td>
118
                  <td class="listr">
119
					<?=htmlspecialchars($vlan['tag']);?>
120
                  </td>
121
                  <td class="listbg">
122
                    <?=htmlspecialchars($vlan['descr']);?>&nbsp;
123
                  </td>
124 677c0869 Erik Kristensen
                  <td valign="middle" nowrap class="list"> <a href="interfaces_vlan_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
125 3119dcde Vinicius Coque
                     &nbsp;<a href="interfaces_vlan.php?act=del&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"></a></td>
126 5b237745 Scott Ullrich
				</tr>
127
			  <?php $i++; endforeach; ?>
128 cae1695e Scott Ullrich
                <tr>
129 5b237745 Scott Ullrich
                  <td class="list" colspan="3">&nbsp;</td>
130 f76baeb3 Rafael Lucas
                  <td class="list"> <a href="interfaces_vlan_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="<F12>17" border="0"></a></td>
131 5b237745 Scott Ullrich
				</tr>
132
				<tr>
133
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
134 c1d85ee1 Vinicius Coque
				  <?=gettext("Note:");?><br>
135 5b237745 Scott Ullrich
				  </strong></span>
136 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>
137 5b237745 Scott Ullrich
				  </td>
138
				<td class="list">&nbsp;</td>
139
				</tr>
140
              </table>
141 d732f186 Bill Marquette
	      </div>
142
	</td>
143 5b237745 Scott Ullrich
	</tr>
144
</table>
145
<?php include("fend.inc"); ?>
146
</body>
147
</html>