Projet

Général

Profil

Télécharger (6,55 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / interfaces_qinq.php @ fab1cd2f

1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_qinq.php
5
	Copyright (C) 2009 Ermal Luçi
6
	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
/*
30
	pfSense_BUILDER_BINARIES:	/usr/sbin/ngctl
31
	pfSense_MODULE:	interfaces
32
*/
33

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

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

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

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

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

    
82
		write_config();
83

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

    
89
$pgtitle = array(gettext("Interfaces"),gettext("QinQ"));
90
$shortcut_section = "interfaces";
91
include("head.inc");
92

    
93
?>
94

    
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php include("fbegin.inc"); ?>
97
<?php if ($input_errors) print_input_errors($input_errors); ?>
98
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces qinqs">
99
  <tr><td>
100
<?php
101
	$tab_array = array();
102
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
103
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
104
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
105
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
106
	$tab_array[4] = array(gettext("QinQs"), true, "interfaces_qinq.php");
107
	$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
108
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
109
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
110
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
111
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
112
	display_top_tabs($tab_array);
113
?>
114
  </td></tr>
115
  <tr>
116
    <td>
117
	<div id="mainarea">
118
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
119
                <tr>
120
                  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
121
                  <td width="10%" class="listhdrr"><?=gettext("Tag");?></td>
122
                  <td width="20%" class="listhdrr"><?=gettext("QinQ members");?></td>
123
                  <td width="45%" class="listhdr"><?=gettext("Description");?></td>
124
                  <td width="10%" class="list"></td>
125
				</tr>
126
			  <?php $i = 0; foreach ($a_qinqs as $qinq): ?>
127
                <tr  ondblclick="document.location='interfaces_qinq_edit.php?id=<?=$i;?>'">
128
                  <td class="listlr">
129
					<?=htmlspecialchars($qinq['if']);?>
130
                  </td>
131
		  <td class="listlr">
132
					<?=htmlspecialchars($qinq['tag']);?>
133
		  </td>
134
                  <td class="listr">
135
					<?php
136
					if (strlen($qinq['members']) > 20)
137
						echo substr(htmlspecialchars($qinq['members']), 0, 20) . "...";
138
					else
139
						echo htmlspecialchars($qinq['members']);
140
					?>
141
                  </td>
142
                  <td class="listbg">
143
                    <?=htmlspecialchars($qinq['descr']);?>&nbsp;
144
                  </td>
145
                  <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>
146
                     &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>
147
				</tr>
148
			  <?php $i++; endforeach; ?>
149
                <tr>
150
                  <td class="list" colspan="4">&nbsp;</td>
151
                  <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>
152
				</tr>
153
				<tr>
154
				<td colspan="4" class="list"><p class="vexpl"><span class="red"><strong>
155
				  <?=gettext("Note:");?><br />
156
				  </strong></span>
157
				  <?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>
158
				  </td>
159
				<td class="list">&nbsp;</td>
160
				</tr>
161
              </table>
162
	      </div>
163
	</td>
164
	</tr>
165
</table>
166
<?php include("fend.inc"); ?>
167
</body>
168
</html>
(108-108/255)