2005-03-03 00:13:02 +01:00
< ? php
2005-03-28 00:31:32 +02:00
/* $Id$ */
2004-11-07 04:06:49 +01:00
/*
interfaces_vlan . php
part of m0n0wall ( http :// m0n0 . ch / wall )
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
Copyright ( C ) 2003 - 2004 Manuel Kasper < mk @ neon1 . net >.
All rights reserved .
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
1. Redistributions of source code must retain the above copyright notice ,
this list of conditions and the following disclaimer .
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
2. Redistributions in binary form must reproduce the above copyright
notice , this list of conditions and the following disclaimer in the
documentation and / or other materials provided with the distribution .
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
THIS SOFTWARE IS PROVIDED `` AS IS '' AND ANY EXPRESS OR IMPLIED WARRANTIES ,
INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY ,
OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS
INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN
CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE )
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE .
*/
2009-09-15 01:14:40 +02:00
/*
pfSense_BUILDER_BINARIES : / sbin / ifconfig
pfSense_MODULE : interfaces
*/
2004-11-07 04:06:49 +01:00
2008-08-01 08:30:34 +02:00
##|+PRIV
##|*IDENT=page-interfaces-vlan
##|*NAME=Interfaces: VLAN page
##|*DESCR=Allow access to the 'Interfaces: VLAN' page.
##|*MATCH=interfaces_vlan.php*
##|-PRIV
2004-11-07 04:06:49 +01:00
require ( " guiconfig.inc " );
if ( ! is_array ( $config [ 'vlans' ][ 'vlan' ]))
$config [ 'vlans' ][ 'vlan' ] = array ();
$a_vlans = & $config [ 'vlans' ][ 'vlan' ] ;
function vlan_inuse ( $num ) {
2010-02-24 20:24:35 +01:00
global $config , $a_vlans ;
2004-11-07 04:06:49 +01:00
2008-06-21 19:13:18 +02:00
$iflist = get_configured_interface_list ( false , true );
foreach ( $iflist as $if ) {
2008-07-24 16:18:38 +02:00
if ( $config [ 'interfaces' ][ $if ][ 'if' ] == $a_vlans [ $num ][ 'vlanif' ])
2004-11-07 04:06:49 +01:00
return true ;
}
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
return false ;
}
if ( $_GET [ 'act' ] == " del " ) {
2013-01-24 10:57:22 +01:00
if ( ! isset ( $_GET [ 'id' ]))
2014-10-31 03:24:39 +01:00
$input_errors [] = gettext ( " Wrong parameters supplied " );
2013-01-24 10:57:22 +01:00
else if ( empty ( $a_vlans [ $_GET [ 'id' ]]))
2014-10-31 03:24:39 +01:00
$input_errors [] = gettext ( " Wrong index supplied " );
2004-11-07 04:06:49 +01:00
/* check if still in use */
2013-01-24 10:57:22 +01:00
else if ( vlan_inuse ( $_GET [ 'id' ])) {
2010-06-30 20:56:02 +02:00
$input_errors [] = gettext ( " This VLAN cannot be deleted because it is still being used as an interface. " );
2004-11-07 04:06:49 +01:00
} else {
2013-10-18 22:41:32 +02:00
if ( does_interface_exist ( $a_vlans [ $_GET [ 'id' ]][ 'vlanif' ]))
pfSense_interface_destroy ( $a_vlans [ $_GET [ 'id' ]][ 'vlanif' ]);
2004-11-07 04:06:49 +01:00
unset ( $a_vlans [ $_GET [ 'id' ]]);
2005-03-03 00:13:02 +01:00
2004-11-07 04:06:49 +01:00
write_config ();
2007-01-25 23:26:20 +01:00
2004-11-07 04:06:49 +01:00
header ( " Location: interfaces_vlan.php " );
exit ;
}
}
2005-07-02 06:03:06 +02:00
2010-06-30 20:56:02 +02:00
$pgtitle = array ( gettext ( " Interfaces " ), gettext ( " VLAN " ));
2012-08-10 19:32:16 +02:00
$shortcut_section = " interfaces " ;
2005-07-02 06:03:06 +02:00
include ( " head.inc " );
2004-11-07 04:06:49 +01:00
?>
< body link = " #0000CC " vlink = " #0000CC " alink = " #0000CC " >
< ? php include ( " fbegin.inc " ); ?>
< ? php if ( $input_errors ) print_input_errors ( $input_errors ); ?>
2013-04-15 21:51:39 +02:00
< table width = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 0 " summary = " interfaces vlan " >
2004-11-07 04:06:49 +01:00
< tr >< td >
2005-07-03 02:28:20 +02:00
< ? php
$tab_array = array ();
2010-06-30 20:56:02 +02:00
$tab_array [ 0 ] = array ( gettext ( " Interface assignments " ), false , " interfaces_assign.php " );
$tab_array [ 1 ] = array ( gettext ( " Interface Groups " ), false , " interfaces_groups.php " );
2010-07-21 19:48:31 +02:00
$tab_array [ 2 ] = array ( gettext ( " Wireless " ), false , " interfaces_wireless.php " );
2010-06-30 20:56:02 +02:00
$tab_array [ 3 ] = array ( gettext ( " VLANs " ), true , " interfaces_vlan.php " );
$tab_array [ 4 ] = array ( gettext ( " QinQs " ), false , " interfaces_qinq.php " );
$tab_array [ 5 ] = array ( gettext ( " PPPs " ), false , " interfaces_ppps.php " );
$tab_array [ 6 ] = array ( gettext ( " GRE " ), false , " interfaces_gre.php " );
$tab_array [ 7 ] = array ( gettext ( " GIF " ), false , " interfaces_gif.php " );
$tab_array [ 8 ] = array ( gettext ( " Bridges " ), false , " interfaces_bridge.php " );
$tab_array [ 9 ] = array ( gettext ( " LAGG " ), false , " interfaces_lagg.php " );
2005-07-03 02:28:20 +02:00
display_top_tabs ( $tab_array );
?>
2004-11-07 04:06:49 +01:00
</ td ></ tr >
2005-03-03 00:13:02 +01:00
< tr >
2005-07-04 02:13:27 +02:00
< td >
< div id = " mainarea " >
2013-04-15 21:51:39 +02:00
< table class = " tabcont " width = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 0 " summary = " main area " >
2004-11-07 04:06:49 +01:00
< tr >
2010-06-30 20:56:02 +02:00
< td width = " 20% " class = " listhdrr " >< ? = gettext ( " Interface " ); ?> </td>
< td width = " 20% " class = " listhdrr " >< ? = gettext ( " VLAN tag " ); ?> </td>
< td width = " 50% " class = " listhdr " >< ? = gettext ( " Description " ); ?> </td>
2004-11-07 04:06:49 +01:00
< td width = " 10% " class = " list " ></ td >
</ tr >
< ? php $i = 0 ; foreach ( $a_vlans as $vlan ) : ?>
2010-02-26 19:49:26 +01:00
< tr ondblclick = " document.location='interfaces_vlan_edit.php?id=<?= $i ;?>' " >
2004-11-07 04:06:49 +01:00
< td class = " listlr " >
< ? = htmlspecialchars ( $vlan [ 'if' ]); ?>
</ td >
< td class = " listr " >
< ? = htmlspecialchars ( $vlan [ 'tag' ]); ?>
</ td >
< td class = " listbg " >
< ? = htmlspecialchars ( $vlan [ 'descr' ]); ?>
</ td >
2013-04-15 21:51:39 +02:00
< 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 >
& 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 " alt = " delete " /></ a ></ td >
2004-11-07 04:06:49 +01:00
</ tr >
< ? php $i ++ ; endforeach ; ?>
2005-03-03 00:13:02 +01:00
< tr >
2004-11-07 04:06:49 +01:00
< td class = " list " colspan = " 3 " >& nbsp ; </ td >
2013-04-15 21:51:39 +02:00
< 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 >
2004-11-07 04:06:49 +01:00
</ tr >
< tr >
< td colspan = " 3 " class = " list " >< p class = " vexpl " >< span class = " red " >< strong >
2014-03-14 21:24:03 +01:00
< ? = gettext ( " Note: " ); ?> <br />
2004-11-07 04:06:49 +01:00
</ strong ></ span >
2010-07-10 18:42:46 +02:00
< ? 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>
2004-11-07 04:06:49 +01:00
</ td >
< td class = " list " >& nbsp ; </ td >
</ tr >
</ table >
2005-07-04 02:13:27 +02:00
</ div >
</ td >
2004-11-07 04:06:49 +01:00
</ tr >
</ table >
< ? php include ( " fend.inc " ); ?>
</ body >
</ html >