Project

General

Profile

Download (6.26 KB) Statistics
| Branch: | Tag: | Revision:
1 b991e3b5 Ermal Lu?i
<?php
2
/* $Id$ */
3
/*
4
	interfaces_qinq.php
5 4b653c44 Ermal Lu?i
	Copyright (C) 2009 Ermal Luçi
6 b991e3b5 Ermal Lu?i
	All rights reserved.
7
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29 7ac5a4cb Scott Ullrich
/*
30
	pfSense_BUILDER_BINARIES:	/usr/sbin/ngctl	
31
	pfSense_MODULE:	interfaces
32
*/
33 b991e3b5 Ermal Lu?i
34
##|+PRIV
35
##|*IDENT=page-interfaces-qinq
36
##|*NAME=Interfaces: QinQ page
37
##|*DESCR=Allow access to the 'Interfaces: QinQ' page.
38
##|*MATCH=interfaces_qinq.php*
39
##|-PRIV
40
41
require("guiconfig.inc");
42 347ec09e Carlos Eduardo Ramos
require_once("functions.inc");
43 b991e3b5 Ermal Lu?i
44
if (!is_array($config['qinqs']['qinqentry']))
45
	$config['qinqs']['qinqentry'] = array();
46
47
$a_qinqs = &$config['qinqs']['qinqentry'];
48
49
function qinq_inuse($num) {
50 c059940b Erik Fonnesbeck
	global $config, $a_qinqs;
51 b991e3b5 Ermal Lu?i
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54
		if ($config['interfaces'][$if]['if'] == $a_qinqs[$num]['qinqif'])
55
			return true;
56
	}
57
58
	return false;
59
}
60
61
if ($_GET['act'] == "del") {
62
	/* check if still in use */
63
	if (qinq_inuse($_GET['id'])) {
64 a11b9585 Rafael Lucas
		$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
65 b991e3b5 Ermal Lu?i
	} else {
66
		$id = $_GET['id'];
67
		$qinq =& $a_qinqs[$id];
68
69
		$delmembers = explode(" ", $qinq['members']);
70
                if (count($delmembers) > 0) {
71
			foreach ($delmembers as $tag)
72 4400ad66 Ermal Lu?i
				mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:");
73 b991e3b5 Ermal Lu?i
                }
74 4400ad66 Ermal Lu?i
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:");
75
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:");
76 b991e3b5 Ermal Lu?i
		unset($a_qinqs[$id]);
77
78
		write_config();
79
80
		header("Location: interfaces_qinq.php");
81
		exit;
82
	}
83
}
84
85 a11b9585 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("QinQ"));
86 b991e3b5 Ermal Lu?i
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">
94
  <tr><td>
95
<?php
96
	$tab_array = array();
97 a11b9585 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
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
100
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
101
	$tab_array[4] = array(gettext("QinQs"), true, "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 b991e3b5 Ermal Lu?i
	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">
114
                <tr>
115 a11b9585 Rafael Lucas
                  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
116
                  <td width="10%" class="listhdrr"><?=gettext("Tag");?></td>
117
                  <td width="20%" class="listhdrr"><?=gettext("QinQ members");?></td>
118
                  <td width="45%" class="listhdr"><?=gettext("Description");?></td>
119 b991e3b5 Ermal Lu?i
                  <td width="10%" class="list"></td>
120
				</tr>
121
			  <?php $i = 0; foreach ($a_qinqs as $qinq): ?>
122 fd22be34 Ermal Lu?i
                <tr  ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
123 b991e3b5 Ermal Lu?i
                  <td class="listlr">
124
					<?=htmlspecialchars($qinq['if']);?>
125
                  </td>
126
		  <td class="listlr">
127
					<?=htmlspecialchars($qinq['tag']);?>
128
		  </td>
129
                  <td class="listr">
130 a5adbd09 Ermal Lu?i
					<?php
131
					if (strlen($qinq['members']) > 20)
132 4400ad66 Ermal Lu?i
						echo substr(htmlspecialchars($qinq['members']), 0, 20) . "...";
133 a5adbd09 Ermal Lu?i
					else
134
						echo htmlspecialchars($qinq['members']);
135
					?>
136 b991e3b5 Ermal Lu?i
                  </td>
137
                  <td class="listbg">
138
                    <?=htmlspecialchars($qinq['descr']);?>&nbsp;
139
                  </td>
140
                  <td valign="middle" nowrap class="list"> <a href="interfaces_qinq_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
141 5daab314 Vinicius Coque
                     &nbsp;<a href="interfaces_qinq.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this QinQ?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
142 b991e3b5 Ermal Lu?i
				</tr>
143
			  <?php $i++; endforeach; ?>
144
                <tr>
145
                  <td class="list" colspan="4">&nbsp;</td>
146
                  <td class="list"> <a href="interfaces_qinq_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
147
				</tr>
148
				<tr>
149
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
150 ad157b4c Vinicius Coque
				  <?=gettext("Note:");?><br>
151 b991e3b5 Ermal Lu?i
				  </strong></span>
152 1b42d9b6 Vinicius Coque
				  <?php printf(gettext("Not all drivers/NICs support 802.1Q QinQ tagging properly. On cards that do not explicitly support it, QinQ tagging will still work, but the reduced MTU may cause problems. See the %s handbook for information on supported cards."), $g['product_name']);?></p>
153 b991e3b5 Ermal Lu?i
				  </td>
154
				<td class="list">&nbsp;</td>
155
				</tr>
156
              </table>
157
	      </div>
158
	</td>
159
	</tr>
160
</table>
161
<?php include("fend.inc"); ?>
162
</body>
163
</html>