Project

General

Profile

Download (6.14 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
$a_vlans = &$config['vlans']['vlan'] ;
50

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

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

    
60
	return false;
61
}
62

    
63
if ($_GET['act'] == "del") {
64
        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
	/* check if still in use */
69
	else if (vlan_inuse($_GET['id'])) {
70
		$input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
71
	} else {
72
		if (does_interface_exist($a_vlans[$_GET['id']]['vlanif']))
73
			pfSense_interface_destroy($a_vlans[$_GET['id']]['vlanif']);
74
		unset($a_vlans[$_GET['id']]);
75

    
76
		write_config();
77

    
78
		header("Location: interfaces_vlan.php");
79
		exit;
80
	}
81
}
82

    
83

    
84
$pgtitle = array(gettext("Interfaces"),gettext("VLAN"));
85
$shortcut_section = "interfaces";
86
include("head.inc");
87

    
88
?>
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
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces vlan">
94
  <tr><td>
95
<?php
96
	$tab_array = array();
97
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
98
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
99
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
100
	$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
	display_top_tabs($tab_array);
108
?>
109
  </td></tr>
110
  <tr>
111
    <td>
112
	<div id="mainarea">
113
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
114
                <tr>
115
                  <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
                  <td width="10%" class="list"></td>
119
				</tr>
120
			  <?php $i = 0; foreach ($a_vlans as $vlan): ?>
121
                <tr ondblclick="document.location='interfaces_vlan_edit.php?id=<?=$i;?>'">
122
                  <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
                  <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
				</tr>
134
			  <?php $i++; endforeach; ?>
135
                <tr>
136
                  <td class="list" colspan="3">&nbsp;</td>
137
                  <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
				</tr>
139
				<tr>
140
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
141
				  <?=gettext("Note:");?><br />
142
				  </strong></span>
143
				  <?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
				  </td>
145
				<td class="list">&nbsp;</td>
146
				</tr>
147
              </table>
148
	      </div>
149
	</td>
150
	</tr>
151
</table>
152
<?php include("fend.inc"); ?>
153
</body>
154
</html>
(111-111/256)