1 |
648ec0c2
|
Ermal Luçi
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
interfaces_bridge.php
|
5 |
|
|
|
6 |
e395ef5d
|
Ermal Luçi
|
Copyright (C) 2008 Ermal Lu?i
|
7 |
648ec0c2
|
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 |
|
|
|
31 |
|
|
require("guiconfig.inc");
|
32 |
|
|
|
33 |
3134528d
|
Ermal Luçi
|
if (!is_array($config['bridges']['bridged']))
|
34 |
|
|
$config['bridges']['bridged'] = array();
|
35 |
648ec0c2
|
Ermal Luçi
|
|
36 |
3134528d
|
Ermal Luçi
|
$a_bridges = &$config['bridges']['bridged'] ;
|
37 |
648ec0c2
|
Ermal Luçi
|
|
38 |
|
|
function bridge_inuse($num) {
|
39 |
|
|
global $config;
|
40 |
|
|
|
41 |
|
|
$iflist = get_configured_interface_list(false, true);
|
42 |
|
|
foreach ($iflist as $if) {
|
43 |
2eedb548
|
Ermal Luçi
|
if ($config['interfaces'][$if]['if'] == $a_bridges[$num]['bridgeif'])
|
44 |
648ec0c2
|
Ermal Luçi
|
return true;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
return false;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
if ($_GET['act'] == "del") {
|
51 |
|
|
/* check if still in use */
|
52 |
|
|
if (bridge_inuse($_GET['id'])) {
|
53 |
|
|
$input_errors[] = "This bridge TUNNEL cannot be deleted because it is still being used as an interface.";
|
54 |
|
|
} else {
|
55 |
|
|
mwexec("/sbin/ifconfig " . $a_bridges[$_GET['id']]['bridgeif'] . " destroy");
|
56 |
|
|
unset($a_bridges[$_GET['id']]);
|
57 |
|
|
|
58 |
|
|
write_config();
|
59 |
|
|
|
60 |
|
|
header("Location: interfaces_bridge.php");
|
61 |
|
|
exit;
|
62 |
|
|
}
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
$pgtitle = array("Interfaces","Bridge");
|
67 |
|
|
include("head.inc");
|
68 |
|
|
|
69 |
|
|
?>
|
70 |
|
|
|
71 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
72 |
|
|
<?php include("fbegin.inc"); ?>
|
73 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
74 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
75 |
|
|
<tr><td>
|
76 |
|
|
<?php
|
77 |
|
|
$tab_array = array();
|
78 |
|
|
$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
|
79 |
0ec2fdf0
|
Ermal Lu?i
|
$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
|
80 |
|
|
$tab_array[2] = array("VLANs", false, "interfaces_vlan.php");
|
81 |
5f1e1d26
|
Ermal Lu?i
|
$tab_array[3] = array("QinQs", false, "interfaces_qinq.php");
|
82 |
|
|
$tab_array[4] = array("PPP", false, "interfaces_ppp.php");
|
83 |
|
|
$tab_array[5] = array("GRE", false, "interfaces_gre.php");
|
84 |
|
|
$tab_array[6] = array("GIF", false, "interfaces_gif.php");
|
85 |
|
|
$tab_array[7] = array("Bridges", true, "interfaces_bridge.php");
|
86 |
|
|
$tab_array[8] = array("LAGG", false, "interfaces_lagg.php");
|
87 |
648ec0c2
|
Ermal Luçi
|
display_top_tabs($tab_array);
|
88 |
|
|
?>
|
89 |
|
|
</td></tr>
|
90 |
|
|
<tr>
|
91 |
|
|
<td>
|
92 |
|
|
<div id="mainarea">
|
93 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
94 |
|
|
<tr>
|
95 |
|
|
<td width="20%" class="listhdrr">Interface</td>
|
96 |
|
|
<td width="20%" class="listhdrr">Members</td>
|
97 |
|
|
<td width="50%" class="listhdr">Description</td>
|
98 |
|
|
<td width="10%" class="list"></td>
|
99 |
|
|
</tr>
|
100 |
4bd1d5eb
|
Ermal Luçi
|
<?php $i = 0; $ifdescrs = get_configured_interface_with_descr();
|
101 |
|
|
foreach ($a_bridges as $bridge): ?>
|
102 |
648ec0c2
|
Ermal Luçi
|
<tr>
|
103 |
|
|
<td class="listlr">
|
104 |
|
|
<?=htmlspecialchars(strtoupper($bridge['bridgeif']));?>
|
105 |
|
|
</td>
|
106 |
|
|
<td class="listr">
|
107 |
4bd1d5eb
|
Ermal Luçi
|
<? $members = explode(',', $bridge['members']);
|
108 |
|
|
$j = 0;
|
109 |
|
|
foreach ($members as $member) {
|
110 |
|
|
if (isset($ifdescrs[$member])) {
|
111 |
|
|
echo $ifdescrs[$member];
|
112 |
|
|
$j++;
|
113 |
|
|
}
|
114 |
|
|
if ($j > 1)
|
115 |
|
|
echo ", ";
|
116 |
|
|
}
|
117 |
|
|
?>
|
118 |
648ec0c2
|
Ermal Luçi
|
</td>
|
119 |
|
|
<td class="listbg">
|
120 |
|
|
<?=htmlspecialchars($bridge['descr']);?>
|
121 |
|
|
</td>
|
122 |
|
|
<td valign="middle" nowrap class="list"> <a href="interfaces_bridge_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
|
123 |
|
|
<a href="interfaces_bridge.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this bridge tunnel?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
124 |
|
|
</tr>
|
125 |
|
|
<?php $i++; endforeach; ?>
|
126 |
|
|
<tr>
|
127 |
|
|
<td class="list" colspan="3"> </td>
|
128 |
|
|
<td class="list"> <a href="interfaces_bridge_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
129 |
|
|
</tr>
|
130 |
|
|
<tr>
|
131 |
|
|
<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
|
132 |
|
|
Note:<br>
|
133 |
|
|
</strong></span>
|
134 |
|
|
Something meaningful here.
|
135 |
|
|
</td>
|
136 |
|
|
<td class="list"> </td>
|
137 |
|
|
</tr>
|
138 |
|
|
</table>
|
139 |
|
|
</div>
|
140 |
|
|
</td>
|
141 |
|
|
</tr>
|
142 |
|
|
</table>
|
143 |
|
|
<?php include("fend.inc"); ?>
|
144 |
|
|
</body>
|
145 |
|
|
</html>
|