Project

General

Profile

Download (6.6 KB) Statistics
| Branch: | Tag: | Revision:
1 b991e3b5 Ermal Lu?i
<?php
2
/* $Id$ */
3
/*
4
	interfaces_qinq.php
5 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 4b653c44 Ermal Lu?i
	Copyright (C) 2009 Ermal Luçi
7 b991e3b5 Ermal Lu?i
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30 7ac5a4cb Scott Ullrich
/*
31 62f8244b Renato Botelho
	pfSense_BUILDER_BINARIES:	/usr/sbin/ngctl
32 7ac5a4cb Scott Ullrich
	pfSense_MODULE:	interfaces
33
*/
34 b991e3b5 Ermal Lu?i
35
##|+PRIV
36
##|*IDENT=page-interfaces-qinq
37
##|*NAME=Interfaces: QinQ page
38
##|*DESCR=Allow access to the 'Interfaces: QinQ' page.
39
##|*MATCH=interfaces_qinq.php*
40
##|-PRIV
41
42
require("guiconfig.inc");
43 347ec09e Carlos Eduardo Ramos
require_once("functions.inc");
44 b991e3b5 Ermal Lu?i
45
if (!is_array($config['qinqs']['qinqentry']))
46
	$config['qinqs']['qinqentry'] = array();
47
48
$a_qinqs = &$config['qinqs']['qinqentry'];
49
50
function qinq_inuse($num) {
51 c059940b Erik Fonnesbeck
	global $config, $a_qinqs;
52 b991e3b5 Ermal Lu?i
53
	$iflist = get_configured_interface_list(false, true);
54
	foreach ($iflist as $if) {
55
		if ($config['interfaces'][$if]['if'] == $a_qinqs[$num]['qinqif'])
56
			return true;
57
	}
58
59
	return false;
60
}
61
62
if ($_GET['act'] == "del") {
63 eea7eb99 Renato Botelho
	$id = $_GET['id'];
64
65 b991e3b5 Ermal Lu?i
	/* check if still in use */
66 eea7eb99 Renato Botelho
	if (qinq_inuse($id)) {
67 a11b9585 Rafael Lucas
		$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
68 eea7eb99 Renato Botelho
	} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
69
		$input_errors[] = gettext("QinQ interface does not exist");
70 b991e3b5 Ermal Lu?i
	} else {
71
		$qinq =& $a_qinqs[$id];
72
73
		$delmembers = explode(" ", $qinq['members']);
74 62f8244b Renato Botelho
		if (count($delmembers) > 0) {
75 b991e3b5 Ermal Lu?i
			foreach ($delmembers as $tag)
76 4400ad66 Ermal Lu?i
				mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:");
77 62f8244b Renato Botelho
		}
78 4400ad66 Ermal Lu?i
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:");
79
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:");
80 9cf46050 Ermal
		mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy");
81 b991e3b5 Ermal Lu?i
		unset($a_qinqs[$id]);
82
83
		write_config();
84
85
		header("Location: interfaces_qinq.php");
86
		exit;
87
	}
88
}
89
90 a11b9585 Rafael Lucas
$pgtitle = array(gettext("Interfaces"),gettext("QinQ"));
91 b32dd0a6 jim-p
$shortcut_section = "interfaces";
92 b991e3b5 Ermal Lu?i
include("head.inc");
93
94
?>
95
96
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
97
<?php include("fbegin.inc"); ?>
98
<?php if ($input_errors) print_input_errors($input_errors); ?>
99 9f3fe5f1 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces qinqs">
100 b991e3b5 Ermal Lu?i
  <tr><td>
101
<?php
102
	$tab_array = array();
103 a11b9585 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
104
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
105
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
106
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
107
	$tab_array[4] = array(gettext("QinQs"), true, "interfaces_qinq.php");
108
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
109
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
110
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
111
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
112
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
113 b991e3b5 Ermal Lu?i
	display_top_tabs($tab_array);
114
?>
115
  </td></tr>
116
  <tr>
117
    <td>
118
	<div id="mainarea">
119 9f3fe5f1 Colin Fleming
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
120 b991e3b5 Ermal Lu?i
                <tr>
121 a11b9585 Rafael Lucas
                  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
122
                  <td width="10%" class="listhdrr"><?=gettext("Tag");?></td>
123
                  <td width="20%" class="listhdrr"><?=gettext("QinQ members");?></td>
124
                  <td width="45%" class="listhdr"><?=gettext("Description");?></td>
125 b991e3b5 Ermal Lu?i
                  <td width="10%" class="list"></td>
126
				</tr>
127
			  <?php $i = 0; foreach ($a_qinqs as $qinq): ?>
128 fd22be34 Ermal Lu?i
                <tr  ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
129 b991e3b5 Ermal Lu?i
                  <td class="listlr">
130
					<?=htmlspecialchars($qinq['if']);?>
131
                  </td>
132
		  <td class="listlr">
133
					<?=htmlspecialchars($qinq['tag']);?>
134
		  </td>
135
                  <td class="listr">
136 a5adbd09 Ermal Lu?i
					<?php
137
					if (strlen($qinq['members']) > 20)
138 4400ad66 Ermal Lu?i
						echo substr(htmlspecialchars($qinq['members']), 0, 20) . "...";
139 a5adbd09 Ermal Lu?i
					else
140
						echo htmlspecialchars($qinq['members']);
141
					?>
142 b991e3b5 Ermal Lu?i
                  </td>
143
                  <td class="listbg">
144
                    <?=htmlspecialchars($qinq['descr']);?>&nbsp;
145
                  </td>
146 9f3fe5f1 Colin Fleming
                  <td valign="middle" class="list nowrap"> <a href="interfaces_qinq_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
147
                     &nbsp;<a href="interfaces_qinq.php?act=del&amp;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" alt="remove" /></a></td>
148 b991e3b5 Ermal Lu?i
				</tr>
149
			  <?php $i++; endforeach; ?>
150
                <tr>
151
                  <td class="list" colspan="4">&nbsp;</td>
152 9f3fe5f1 Colin Fleming
                  <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" alt="add" /></a></td>
153 b991e3b5 Ermal Lu?i
				</tr>
154
				<tr>
155 abc16ee6 jim-p
				<td colspan="4" class="list"><p class="vexpl"><span class="red"><strong>
156 8cd558b6 ayvis
				  <?=gettext("Note:");?><br />
157 b991e3b5 Ermal Lu?i
				  </strong></span>
158 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>
159 b991e3b5 Ermal Lu?i
				  </td>
160
				<td class="list">&nbsp;</td>
161
				</tr>
162
              </table>
163
	      </div>
164
	</td>
165
	</tr>
166
</table>
167
<?php include("fend.inc"); ?>
168
</body>
169
</html>