Project

General

Profile

Download (6.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_qinq.php
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6
	Copyright (C) 2009 Ermal Luçi
7
	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
/*
31
	pfSense_BUILDER_BINARIES:	/usr/sbin/ngctl
32
	pfSense_MODULE:	interfaces
33
*/
34

    
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
require_once("functions.inc");
44

    
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
	global $config, $a_qinqs;
52

    
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
	$id = $_GET['id'];
64

    
65
	/* check if still in use */
66
	if (qinq_inuse($id)) {
67
		$input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
68
	} elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
69
		$input_errors[] = gettext("QinQ interface does not exist");
70
	} else {
71
		$qinq =& $a_qinqs[$id];
72

    
73
		$delmembers = explode(" ", $qinq['members']);
74
		if (count($delmembers) > 0) {
75
			foreach ($delmembers as $tag)
76
				mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:");
77
		}
78
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:");
79
		mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:");
80
		mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy");
81
		unset($a_qinqs[$id]);
82

    
83
		write_config();
84

    
85
		header("Location: interfaces_qinq.php");
86
		exit;
87
	}
88
}
89

    
90
$pgtitle = array(gettext("Interfaces"),gettext("QinQ"));
91
$shortcut_section = "interfaces";
92
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
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces qinqs">
100
  <tr><td>
101
<?php
102
	$tab_array = array();
103
	$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
	display_top_tabs($tab_array);
114
?>
115
  </td></tr>
116
  <tr>
117
    <td>
118
	<div id="mainarea">
119
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
120
                <tr>
121
                  <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
                  <td width="10%" class="list"></td>
126
				</tr>
127
			  <?php $i = 0; foreach ($a_qinqs as $qinq): ?>
128
                <tr  ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
129
                  <td class="listlr">
130
					<?=htmlspecialchars($qinq['if']);?>
131
                  </td>
132
		  <td class="listlr">
133
					<?=htmlspecialchars($qinq['tag']);?>
134
		  </td>
135
                  <td class="listr">
136
					<?php
137
					if (strlen($qinq['members']) > 20)
138
						echo substr(htmlspecialchars($qinq['members']), 0, 20) . "...";
139
					else
140
						echo htmlspecialchars($qinq['members']);
141
					?>
142
                  </td>
143
                  <td class="listbg">
144
                    <?=htmlspecialchars($qinq['descr']);?>&nbsp;
145
                  </td>
146
                  <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
				</tr>
149
			  <?php $i++; endforeach; ?>
150
                <tr>
151
                  <td class="list" colspan="4">&nbsp;</td>
152
                  <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
				</tr>
154
				<tr>
155
				<td colspan="4" class="list"><p class="vexpl"><span class="red"><strong>
156
				  <?=gettext("Note:");?><br />
157
				  </strong></span>
158
				  <?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
				  </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>
(107-107/252)