Project

General

Profile

Download (5.56 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_bridge.php
5

    
6
	Copyright (C) 2008 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:	/bin/rm
32
	pfSense_MODULE:	interfaces_assign
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-interfaces-bridge
37
##|*NAME=Interfaces: Bridge page
38
##|*DESCR=Allow access to the 'Interfaces: Bridge' page.
39
##|*MATCH=interfaces_bridge.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43

    
44
if (!is_array($config['bridges']['bridged']))
45
	$config['bridges']['bridged'] = array();
46

    
47
$a_bridges = &$config['bridges']['bridged'] ;
48

    
49
function bridge_inuse($num) {
50
	global $config, $a_bridges;
51

    
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54
		if ($config['interfaces'][$if]['if'] == $a_bridges[$num]['bridgeif'])
55
			return true;
56
	}
57

    
58
	return false;
59
}
60

    
61
if ($_GET['act'] == "del") {
62
	/* check if still in use */
63
	if (bridge_inuse($_GET['id'])) {
64
		$input_errors[] = "This bridge cannot be deleted because it is assigned as an interface.";
65
	} else {
66
		mwexec("/sbin/ifconfig " . $a_bridges[$_GET['id']]['bridgeif'] . " destroy");
67
		unset($a_bridges[$_GET['id']]);
68

    
69
		write_config();
70

    
71
		header("Location: interfaces_bridge.php");
72
		exit;
73
	}
74
}
75

    
76

    
77
$pgtitle = array("Interfaces","Bridge");
78
include("head.inc");
79

    
80
?>
81

    
82
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
83
<?php include("fbegin.inc"); ?>
84
<?php if ($input_errors) print_input_errors($input_errors); ?>
85
<table width="100%" border="0" cellpadding="0" cellspacing="0">
86
  <tr><td>
87
<?php
88
	$tab_array = array();
89
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
90
	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
91
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
92
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
93
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
94
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
95
	$tab_array[6] = array("GRE", false, "interfaces_gre.php");
96
	$tab_array[7] = array("GIF", false, "interfaces_gif.php");
97
	$tab_array[8] = array("Bridges", true, "interfaces_bridge.php");
98
	$tab_array[9] = array("LAGG", false, "interfaces_lagg.php");
99
	display_top_tabs($tab_array);
100
?>
101
  </td></tr>
102
  <tr>
103
    <td>
104
	<div id="mainarea">
105
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
106
                <tr>
107
                  <td width="20%" class="listhdrr">Interface</td>
108
                  <td width="20%" class="listhdrr">Members</td>
109
                  <td width="50%" class="listhdr">Description</td>
110
                  <td width="10%" class="list"></td>
111
				</tr>
112
			  <?php $i = 0; $ifdescrs = get_configured_interface_with_descr();
113
					foreach ($a_bridges as $bridge): ?>
114
                <tr  ondblclick="document.location='interfaces_bridge_edit.php?id=<?=$i;?>'">
115
                  <td class="listlr">
116
					<?=htmlspecialchars(strtoupper($bridge['bridgeif']));?>
117
                  </td>
118
                  <td class="listr">
119
					<? $members = explode(',', $bridge['members']);
120
					$j = 0;
121
					foreach ($members as $member) {
122
						if (isset($ifdescrs[$member])) {
123
							echo $ifdescrs[$member];
124
							$j++;
125
						}
126
						if ($j > 0 && $j < count($members))
127
							echo ", ";
128
					}
129
					?>
130
                  </td>
131
                  <td class="listbg">
132
                    <?=htmlspecialchars($bridge['descr']);?>&nbsp;
133
                  </td>
134
                  <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>
135
                     &nbsp;<a href="interfaces_bridge.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this bridge?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
136
				</tr>
137
			  <?php $i++; endforeach; ?>
138
                <tr>
139
                  <td class="list" colspan="3">&nbsp;</td>
140
                  <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>
141
				</tr>
142
				<tr>
143
				<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
144
				  Note:<br>
145
				  </strong></span>
146
				  Here you can configure bridging of interfaces.
147
				  </td>
148
				<td class="list">&nbsp;</td>
149
				</tr>
150
              </table>
151
	      </div>
152
	</td>
153
	</tr>
154
</table>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>
(83-83/221)