Project

General

Profile

Download (25.1 KB) Statistics
| Branch: | Tag: | Revision:
1 648ec0c2 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	interfaces_bridge_edit.php
5
6 86cb9ad1 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 7ac5a4cb Scott Ullrich
/*
31
	pfSense_MODULE:	interfaces
32
*/
33 648ec0c2 Ermal Luçi
34 ea9828af Ermal Lu?i
##|+PRIV
35
##|*IDENT=page-interfaces-bridge-edit
36
##|*NAME=Interfaces: Bridge edit page
37
##|*DESCR=Allow access to the 'Interfaces: Bridge : Edit' page.
38
##|*MATCH=interfaces_bridge_edit.php*
39
##|-PRIV
40
41 648ec0c2 Ermal Luçi
require("guiconfig.inc");
42
43 3134528d Ermal Luçi
if (!is_array($config['bridges']['bridged']))
44
	$config['bridges']['bridged'] = array();
45 648ec0c2 Ermal Luçi
46 3134528d Ermal Luçi
$a_bridges = &$config['bridges']['bridged'];
47 648ec0c2 Ermal Luçi
48
$ifacelist = get_configured_interface_with_descr();
49 d776efd8 Ermal
foreach ($ifacelist as $bif => $bdescr) {
50
	if (substr(get_real_interface($bif), 0, 3) == "gre")
51
		unset($ifacelist[$bif]);
52
}
53 648ec0c2 Ermal Luçi
54
$id = $_GET['id'];
55
if (isset($_POST['id']))
56
	$id = $_POST['id'];
57
58
if (isset($id) && $a_bridges[$id]) {
59
	$pconfig['enablestp'] = isset($a_bridges[$id]['enablestp']);
60
	$pconfig['descr'] = $a_bridges[$id]['descr'];
61
	$pconfig['bridgeif'] = $a_bridges[$id]['bridgeif'];
62
	$pconfig['members'] = $a_bridges[$id]['members'];
63
	$pconfig['maxaddr'] = $a_bridges[$id]['maxaddr'];
64
	$pconfig['timeout'] = $a_bridges[$id]['timeout'];
65
	if ($a_bridges[$id]['static'])
66
		$pconfig['static'] = $a_bridges[$id]['static'];
67
	if ($a_bridges[$id]['private'])
68
		$pconfig['private'] = $a_bridges[$id]['private'];
69
	if (isset($a_bridges[$id]['stp']))
70
		$pconfig['stp'] = $a_bridges[$id]['stp'];
71
	$pconfig['maxage'] = $a_bridges[$id]['maxage'];
72
	$pconfig['fwdelay'] = $a_bridges[$id]['fwdelay'];
73
	$pconfig['hellotime'] = $a_bridges[$id]['hellotime'];
74
	$pconfig['priority'] = $a_bridges[$id]['priority'];
75
	$pconfig['proto'] = $a_bridges[$id]['proto'];
76
	$pconfig['holdcount'] = $a_bridges[$id]['holdcount'];
77
	$pconfig['ifpriority'] = explode(",", $a_bridges[$id]['ifpriority']);
78
	$ifpriority = array();
79
	foreach ($pconfig['ifpriority'] as $cfg) {
80
		$embcfg = explode(":", $cfg);
81
		foreach ($embcfg as $key => $value)
82
			$ifpriority[$key] = $value;
83
	}
84
	$pconfig['ifpriority'] = $ifpriority;
85
	$pconfig['ifpathcost'] = explode(",", $a_bridges[$id]['ifpathcost']);
86
	$ifpathcost = array();
87
	foreach ($pconfig['ifpathcost'] as $cfg) {
88
		$embcfg = explode(":", $cfg);
89
		foreach ($embcfg as $key => $value)
90
			$ifpathcost[$key] = $value;
91
	}
92
	$pconfig['ifpathcost'] = $ifpathcost;
93
	$pconfig['span'] = $a_bridges[$id]['span'];
94
	if (isset($a_bridges[$id]['edge']))
95
		$pconfig['edge'] = $a_bridges[$id]['edge'];
96
	if (isset($a_bridges[$id]['autoedge']))
97
		$pconfig['autoedge'] = $a_bridges[$id]['autoedge'];
98
	if (isset($a_bridges[$id]['ptp']))
99
		$pconfig['ptp'] = $a_bridges[$id]['ptp'];
100
	if (isset($a_bridges[$id]['autoptp']))
101
		$pconfig['autoptp'] = $a_bridges[$id]['autoptp'];
102
}
103
104
if ($_POST) {
105
106
	unset($input_errors);
107
	$pconfig = $_POST;
108
109
	/* input validation */
110
	$reqdfields = explode(" ", "members");
111 eb4cf3cb Neriberto C.Prado
	$reqdfieldsn = array(gettext("Member Interfaces"));
112 648ec0c2 Ermal Luçi
113
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
114
115
	if ($_POST['maxage'] && !is_numeric($_POST['maxage']))
116 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Maxage needs to be an integer between 6 and 40.");
117 648ec0c2 Ermal Luçi
	if ($_POST['maxaddr'] && !is_numeric($_POST['maxaddr']))
118 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Maxaddr needs to be an integer.");
119 648ec0c2 Ermal Luçi
	if ($_POST['timeout'] && !is_numeric($_POST['timeout']))
120 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Timeout needs to be an integer.");
121 648ec0c2 Ermal Luçi
	if ($_POST['fwdelay'] && !is_numeric($_POST['fwdelay']))
122 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Forward Delay needs to be an integer between 4 and 30.");
123 648ec0c2 Ermal Luçi
	if ($_POST['hellotime'] && !is_numeric($_POST['hellotime']))
124 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Hello time for STP needs to be an integer between 1 and 2.");
125 648ec0c2 Ermal Luçi
	if ($_POST['priority'] && !is_numeric($_POST['priority']))
126 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Priority for STP needs to be an integer between 0 and 61440.");
127 648ec0c2 Ermal Luçi
	if ($_POST['holdcnt'] && !is_numeric($_POST['holdcnt']))
128 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("Transmit Hold Count for STP needs to be an integer between 1 and 10.");
129 648ec0c2 Ermal Luçi
	foreach ($ifacelist as $ifn => $ifdescr) {
130
		if ($_POST[$ifn] <> "" && !is_numeric($_POST[$ifn]))
131 eb4cf3cb Neriberto C.Prado
			$input_errors[] = "{$ifdescr} " . gettext("interface priority for STP needs to be an integer between 0 and 240.");
132 648ec0c2 Ermal Luçi
	}
133
	$i = 0;
134
	foreach ($ifacelist as $ifn => $ifdescr) {
135
		if ($_POST["{$ifn}{$i}"] <> "" && !is_numeric($_POST["{$ifn}{$i}"]))
136 eb4cf3cb Neriberto C.Prado
			$input_errors[] = "{$ifdescr} " . gettext("interface path cost for STP needs to be an integer between 1 and 200000000.");
137 648ec0c2 Ermal Luçi
		$i++;
138
	}
139 7a701b1e Ermal Luçi
140 9710f0fa Ermal Luçi
	if (!is_array($_POST['members']) || count($_POST['members']) < 2)
141 eb4cf3cb Neriberto C.Prado
		$input_errors[] = gettext("You must select at least 2 member interfaces for a bridge.");
142 7a701b1e Ermal Luçi
143
	if (is_array($_POST['members'])) {
144 86cb9ad1 Ermal Luçi
		foreach($_POST['members'] as $ifmembers) {
145 7a701b1e Ermal Luçi
			if (is_array($config['interfaces'][$ifmembers]['wireless']) &&
146
				$config['interfaces'][$ifmembers]['wireless']['mode'] != "hostap")
147 eb4cf3cb Neriberto C.Prado
				$input_errors[] = gettext("Bridging a wireless interface is only possible in hostap mode.");
148 86cb9ad1 Ermal Luçi
			if ($_POST['span'] != "none" && $_POST['span'] == $ifmembers)
149 eb4cf3cb Neriberto C.Prado
				$input_errors[] = gettext("Span interface cannot be part of the bridge. Remove the span interface from bridge members to continue.");
150 86cb9ad1 Ermal Luçi
		}
151 7a701b1e Ermal Luçi
	}
152
153 648ec0c2 Ermal Luçi
	if (!$input_errors) {
154
		$bridge = array();
155
		$bridge['members'] = implode(',', $_POST['members']);
156 541ba27e gnhb
		$bridge['enablestp'] = $_POST['enablestp'] ? true : false;
157 648ec0c2 Ermal Luçi
		$bridge['descr'] = $_POST['descr'];
158
		$bridge['maxaddr'] = $_POST['maxaddr'];
159
		$bridge['timeout'] = $_POST['timeout'];
160
		if ($_POST['static'])
161
			$bridge['static'] = implode(',', $_POST['static']);
162
		if ($_POST['private'])
163
			$bridge['private'] = implode(',', $_POST['private']);
164
		if (isset($_POST['stp']))
165
			$bridge['stp'] = implode(',', $_POST['stp']);
166
		$bridge['maxage'] = $_POST['maxage'];
167
		$bridge['fwdelay'] = $_POST['fwdelay'];
168
		$bridge['hellotime'] = $_POST['hellotime'];
169
		$bridge['priority'] = $_POST['priority'];
170
		$bridge['proto'] = $_POST['proto'];
171
		$bridge['holdcount'] = $_POST['holdcount'];
172
		$i = 0;
173
		$ifpriority = "";
174
		$ifpathcost = "";
175
		foreach ($ifacelist as $ifn => $ifdescr) {
176
			if ($_POST[$ifn] <> "") {
177
				if ($i > 0)
178
					$ifpriority .= ",";
179
				$ifpriority .= $ifn.":".$_POST[$ifn];
180
			}
181
			if ($_POST["{$ifn}{$i}"] <> "") {
182
				if ($i > 0)
183
					$ifpathcost .= ",";
184
				$ifpathcost .= $ifn.":".$_POST[$ifn];
185
			}
186
			$i++;
187
		}
188
		$bridge['ifpriority'] = $ifpriority;
189
		$bridge['ifpathcost'] = $ifpathcost;
190 86cb9ad1 Ermal Luçi
		if ($_POST['span'] != "none")
191
			$bridge['span'] = $_POST['span'];
192
		else 
193
			unset($bridge['span']);
194 648ec0c2 Ermal Luçi
		if (isset($_POST['edge']))
195
			$bridge['edge'] = implode(',', $_POST['edge']);
196
		if (isset($_POST['autoedge']))
197
			$bridge['autoedge'] = implode(',', $_POST['autoedge']);
198
		if (isset($_POST['ptp']))
199
			$bridge['ptp'] = implode(',', $_POST['ptp']);
200
		if (isset($_POST['autoptp']))
201
			$bridge['autoptp'] = implode(',', $_POST['autoptp']);
202
203
		$bridge['bridgeif'] = $_POST['bridgeif'];
204
                $bridge['bridgeif'] = interface_bridge_configure($bridge);
205
                if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge"))
206 eb4cf3cb Neriberto C.Prado
                        $input_errors[] = gettext("Error occured creating interface, please retry.");
207 648ec0c2 Ermal Luçi
                else {
208
                        if (isset($id) && $a_bridges[$id])
209
                                $a_bridges[$id] = $bridge;
210
                        else
211
                                $a_bridges[] = $bridge;
212
213
                        write_config();
214
215 5efc5b6f Ermal Luçi
			$confif = convert_real_interface_to_friendly_interface_name($bridge['bridgeif']);
216
                        if ($confif <> "")
217 69e5a8be Ermal Luçi
                                interface_configure($confif);
218 5efc5b6f Ermal Luçi
219
220 648ec0c2 Ermal Luçi
			header("Location: interfaces_bridge.php");
221
			exit;
222
		}
223
	}
224
}
225
226 eb4cf3cb Neriberto C.Prado
$pgtitle = array(gettext("Firewall"),gettext("Bridge"),gettext("Edit"));
227 648ec0c2 Ermal Luçi
include("head.inc");
228
229
?>
230
231
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
232
<script type="text/javascript">
233
function show_source_port_range() {
234
        document.getElementById("sprtable").style.display = 'none';
235
        document.getElementById("sprtable1").style.display = '';
236
        document.getElementById("sprtable2").style.display = '';
237
        document.getElementById("sprtable3").style.display = '';
238
        document.getElementById("sprtable4").style.display = '';
239
        document.getElementById("sprtable5").style.display = '';
240
        document.getElementById("sprtable6").style.display = '';
241
        document.getElementById("sprtable7").style.display = '';
242
        document.getElementById("sprtable8").style.display = '';
243
        document.getElementById("sprtable9").style.display = '';
244
        document.getElementById("sprtable10").style.display = '';
245
}
246
</script>
247
248
<?php include("fbegin.inc"); ?>
249
<?php if ($input_errors) print_input_errors($input_errors); ?>
250
            <form action="interfaces_bridge_edit.php" method="post" name="iform" id="iform">
251
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
252
				<tr>
253 eb4cf3cb Neriberto C.Prado
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Bridge configuration"); ?></td>
254 ae5b49b1 Scott Ullrich
				</tr>
255
				<tr>
256 eb4cf3cb Neriberto C.Prado
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Member interfaces"); ?></td>
257 648ec0c2 Ermal Luçi
                  <td width="78%" class="vtable">
258
				  <select name="members[]" multiple="true" class="formselect" size="3">
259
                      <?php
260
					  	foreach ($ifacelist as $ifn => $ifinfo) {
261
							echo "<option value=\"{$ifn}\"";
262
							if (stristr($pconfig['members'], $ifn))
263
								echo "selected";
264
							echo ">{$ifinfo}</option>";
265
						}
266
		      		?>
267
                    </select>
268
			<br/>
269 eb4cf3cb Neriberto C.Prado
			<span class="vexpl"><?=gettext("Interfaces participating in the bridge."); ?></span>
270 648ec0c2 Ermal Luçi
			</td>
271
            </tr>
272
			<tr>
273 eb4cf3cb Neriberto C.Prado
                  <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
274 648ec0c2 Ermal Luçi
                  <td width="78%" class="vtable">
275 dd5bf424 Scott Ullrich
				  <input type="text" name="descr" id="descr" class="formfld unknown" size="50" value="<?=htmlspecialchars($pconfig['descr']);?>">
276 648ec0c2 Ermal Luçi
				 	</td>
277
				</tr>
278
            <tr id="sprtable" name="sprtable">
279
                <td></td>
280
                <td>
281 b0e30881 Carlos Eduardo Ramos
                <p><input type="button" onClick="show_source_port_range()" value="<?=gettext("Show advanced options"); ?>"></p>
282 648ec0c2 Ermal Luçi
                </td>
283
			</tr>
284
                <tr style="display:none" id="sprtable1" name="sprtable1">
285 8caea9a2 Carlos Eduardo Ramos
                  <td valign="top" class="vncell" align="middle"><?=gettext("RSTP/STP"); ?>  </td>
286 648ec0c2 Ermal Luçi
                  <td class="vtable">
287 541ba27e gnhb
					<input type="checkbox" name="enablestp" id="enablestp" <?php if ($pconfig['enablestp']) echo "checked";?>>
288 eb4cf3cb Neriberto C.Prado
					<span class="vexpl"><strong><?=gettext("Enable spanning tree options for this bridge."); ?> </strong></span>
289 648ec0c2 Ermal Luçi
					<br/><br/>
290
				  	<table id="stpoptions" name="stpoptions" border="0" cellpadding="6" cellspacing="0">
291 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Protocol"); ?></td>
292 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
293
				  	<select name="proto" id="proto">
294
						<?php 
295
							foreach (array("rstp", "stp") as $proto) {
296
								echo "<option value=\"{$proto}\"";
297
								if ($pconfig['proto'] == $proto)
298
									echo "selected";
299
								echo ">".strtoupper($proto)."</option>";
300
							}
301
						?>
302
					</select>
303
                    <br/>
304 eb4cf3cb Neriberto C.Prado
                    <span class="vexpl"><?=gettext("Protocol used for spanning tree."); ?> </span></td>
305 648ec0c2 Ermal Luçi
					</td></tr>
306 eb4cf3cb Neriberto C.Prado
					<tr> <td valign="top" class="vncell" width="20%"><?=gettext("STP interfaces"); ?></td>
307 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
308
				  	<select name="stp[]" class="formselect" multiple="true" size="3">
309
						<?php 
310
							foreach ($ifacelist as $ifn => $ifdescr) {
311
								echo "<option value=\"{$ifn}\"";
312
								if (stristr($pconfig['stp'], $ifn))
313
									echo "selected";
314
								echo ">{$ifdescr}</option>";
315
							}
316
						?>
317
					</select>
318
					<br/>
319 eb4cf3cb Neriberto C.Prado
					<span class="vexpl" >
320 308a8589 Neriberto C.Prado
	     <?=gettext("Enable Spanning Tree Protocol on interface.  The if_bridge(4) " .
321
	     "driver has support for the IEEE 802.1D Spanning Tree Protocol " .
322
	     "(STP).  STP is used to detect and remove loops in a " .
323 ad803a5f Neriberto C.Prado
	     "network topology."); ?>
324 648ec0c2 Ermal Luçi
					</span>
325
					</td></tr>
326 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Valid time"); ?></td>
327 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
328 dd5bf424 Scott Ullrich
					<input name="maxage" type="text" class="formfld unkown" id="maxage" size="8" value="<?=htmlspecialchars($pconfig['maxage']);?>"> <?=gettext("seconds"); ?>
329 648ec0c2 Ermal Luçi
					<br/>
330
					<span class="vexpl">
331 308a8589 Neriberto C.Prado
	     <?=gettext("Set the time that a Spanning Tree Protocol configuration is " .
332
	     "valid.  The default is 20 seconds.  The minimum is 6 seconds and " .
333 ad803a5f Neriberto C.Prado
	     "the maximum is 40 seconds."); ?>
334 648ec0c2 Ermal Luçi
					</span>
335
					</td></tr>
336 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Forward time"); ?> </td>
337 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
338 dd5bf424 Scott Ullrich
					<input name="fwdelay" type="text" class="formfld unkown" id="fwdelay" size="8" value="<?=htmlspecialchars($pconfig['fwdelay']);?>"> <?=gettext("seconds"); ?>
339 648ec0c2 Ermal Luçi
					<br/>
340
					<span class="vexpl">
341 308a8589 Neriberto C.Prado
	     <?=gettext("Set the time that must pass before an interface begins forwarding " .
342 ad803a5f Neriberto C.Prado
	     "packets when Spanning Tree is enabled.  The default is 15 seconds.  The minimum is 4 seconds and the maximum is 30 seconds."); ?>		
343 648ec0c2 Ermal Luçi
					</span>
344
					</td></tr>
345 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Hello time"); ?></td>
346 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
347 dd5bf424 Scott Ullrich
					<input name="hellotime" type="text" class="formfld unkown" size="8" id="hellotime" value="<?=htmlspecialchars($pconfig['hellotime']);?>"> <?=gettext("seconds"); ?>
348 648ec0c2 Ermal Luçi
					<br/>
349
					<span class="vexpl">
350 308a8589 Neriberto C.Prado
	     <?=gettext("Set the time between broadcasting of Spanning Tree Protocol configuration messages.  The hello time may only be changed when " .
351 ad803a5f Neriberto C.Prado
	     "operating in legacy STP mode.  The default is 2 seconds.  The minimum is 1 second and the maximum is 2 seconds."); ?>		
352 648ec0c2 Ermal Luçi
					</span>
353
					</td></tr>
354 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
355 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
356 dd5bf424 Scott Ullrich
					<input name="priority" type="text" class="formfld unkown" id="priority" value="<?=htmlspecialchars($pconfig['priority']);?>">
357 648ec0c2 Ermal Luçi
					<br/>
358
					<span class="vexpl">
359 308a8589 Neriberto C.Prado
	     <?=gettext("Set the bridge priority for Spanning Tree.  The default is 32768. " .
360 ad803a5f Neriberto C.Prado
	     "The minimum is 0 and the maximum is 61440."); ?>		
361 648ec0c2 Ermal Luçi
					</span>
362
					</td></tr>
363 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Hold count"); ?></td>
364 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
365 dd5bf424 Scott Ullrich
					<input name="holdcnt" type="text" class="formfld unkown" id="holdcnt" value="<?=htmlspecialchars($pconfig['holdcnt']);?>">
366 648ec0c2 Ermal Luçi
					<br/>
367
					<span class="vexpl">
368 308a8589 Neriberto C.Prado
	     <?=gettext("Set the transmit hold count for Spanning Tree.  This is the num- " .
369
	     "ber of packets transmitted before being rate limited.  The " .
370 ad803a5f Neriberto C.Prado
	     "default is 6.  The minimum is 1 and the maximum is 10."); ?>		
371 648ec0c2 Ermal Luçi
					</span>
372
					</td></tr>
373 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
374 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
375
					<table>
376
					<?php foreach ($ifacelist as $ifn => $ifdescr) 
377
							echo "<tr><td>{$ifdescr}</td><td><input size=\"5\" name=\"{$ifn}\" type=\"text\" class=\"formfld unkown\" id=\"{$ifn}\" value=\"{$ifpriority[$ifn]}\"></td></tr>";
378
					?>
379
					</table>
380
					<br/>
381
					<span class="vexpl" > 
382 308a8589 Neriberto C.Prado
	     <?=gettext("Set the Spanning Tree priority of interface to value.  The " .
383 ad803a5f Neriberto C.Prado
	     "default is 128.  The minimum is 0 and the maximum is 240."); ?>		
384 648ec0c2 Ermal Luçi
					</span>
385
					</td></tr>
386 eb4cf3cb Neriberto C.Prado
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Path cost"); ?></td>
387 648ec0c2 Ermal Luçi
					<td class="vtable" width="80%">
388
					<table>
389
					<?php $i = 0; foreach ($ifacelist as $ifn => $ifdescr)
390
							echo "<tr><td>{$ifdescr}</td><td><input size=\"8\" name=\"{$ifn}{$i}\" type=\"text\" class=\"formfld unkown\" id=\"{$ifn}{$i}\" value=\"{$ifpathcost[$ifn]}\"></td></tr>";
391
					?>
392
					</table>
393
					<br/>
394
					<span class="vexpl" > 
395 308a8589 Neriberto C.Prado
	     <?=gettext("Set the Spanning Tree path cost of interface to value.  The " .
396
	     "default is calculated from the link speed.  To change a previously selected path cost back to automatic, set the cost to 0. ".
397
	     "The minimum is 1 and the maximum is 200000000."); ?>		
398 648ec0c2 Ermal Luçi
					</span>
399
					</td></tr>
400
401
			    </table>
402
				</tr>
403
                <tr style="display:none" id="sprtable2" name="sprtable2">
404 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Cache size"); ?></td>
405 648ec0c2 Ermal Luçi
					<td class="vtable">
406 dd5bf424 Scott Ullrich
						<input name="maxaddr" size="10" type="text" class="formfld unkown" id="maxaddr" value="<?=htmlspecialchars($pconfig['maxaddr']);?>"> <?=gettext("entries"); ?>
407 648ec0c2 Ermal Luçi
					<br/><span class="vexpl">		
408 308a8589 Neriberto C.Prado
<?=gettext("Set the size of the bridge address cache to size.	The default is " .
409 ad803a5f Neriberto C.Prado
	     ".100 entries."); ?>
410 648ec0c2 Ermal Luçi
					</span>					
411
					</td>
412
				</tr>
413
                <tr style="display:none" id="sprtable3" name="sprtable3">
414 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Cache entry expire time"); ?></td>
415 648ec0c2 Ermal Luçi
				  <td>
416 dd5bf424 Scott Ullrich
					<input name="timeout" type="text" class="formfld unkown" id="timeout" size="10" value="<?=htmlspecialchars($pconfig['timeout']);?>"> <?=gettext("seconds"); ?>
417 648ec0c2 Ermal Luçi
					<br/><span class="vexpl">		
418 308a8589 Neriberto C.Prado
	     <?=gettext("Set the timeout of address cache entries to this number of seconds.  If " .
419
	     "seconds is zero, then address cache entries will not be expired. " .
420 ad803a5f Neriberto C.Prado
	     "The default is 240 seconds."); ?>
421 648ec0c2 Ermal Luçi
					</span>					
422
					</td>
423
				</tr>
424
                <tr style="display:none" id="sprtable4" name="sprtable4">
425 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Span port"); ?></td>
426 648ec0c2 Ermal Luçi
					<td class="vtable">
427
				  	<select name="span" class="formselect" id="span">
428 eb4cf3cb Neriberto C.Prado
						<option value="none" selected><?=gettext("None"); ?></option>
429 648ec0c2 Ermal Luçi
						<?php 
430
							foreach ($ifacelist as $ifn => $ifdescr) {
431
								echo "<option value=\"{$ifn}\"";
432
								if ($ifn == $pconfig['span'])
433
									echo "selected";
434
								echo ">{$ifdescr}</option>";
435
							}
436
						?>
437
					</select>
438
					<br/><span class="vexpl">		
439 308a8589 Neriberto C.Prado
	     <?=gettext("Add the interface named by interface as a span port on the " .
440
	     "bridge.  Span ports transmit a copy of every frame received by " .
441
	     "the bridge.  This is most useful for snooping a bridged network " .
442
	     "passively on another host connected to one of the span ports of " .
443 ad803a5f Neriberto C.Prado
	     "the bridge."); ?>		
444 5e3b419e Ermal Luçi
					</span>
445
		<p class="vexpl"><span class="red"><strong>
446 8c287f1b Vinicius Coque
					 <?=gettext("Note:"); ?><br>
447 5e3b419e Ermal Luçi
                                  </strong></span>
448 eb4cf3cb Neriberto C.Prado
                 <?=gettext("The span interface cannot be part of the bridge member interfaces."); ?>
449 5e3b419e Ermal Luçi
                                        </span>
450 648ec0c2 Ermal Luçi
					</td>
451
				</tr>
452
                <tr style="display:none" id="sprtable5" name="sprtable5">
453 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Edge ports"); ?></td>
454 648ec0c2 Ermal Luçi
                  <td class="vtable">
455
				  	<select name="edge[]" class="formselect" multiple="true" size="3">
456
						<?php 
457
							foreach ($ifacelist as $ifn => $ifdescr) {
458
								echo "<option value=\"{$ifn}\"";
459
								if (stristr($pconfig['edge'], $ifn))
460
									echo "selected";
461
								echo ">{$ifdescr}</option>";
462
							}
463
						?>
464
					</select>
465
                    <br>
466
                    <span class="vexpl">
467 308a8589 Neriberto C.Prado
	     <?=gettext("Set interface as an edge port.  An edge port connects directly to " .
468
	     "end stations and cannot create bridging loops in the network; this " .
469 ad803a5f Neriberto C.Prado
	     "allows it to transition straight to forwarding."); ?>			
470 648ec0c2 Ermal Luçi
					</span></td>
471
			    </tr>
472
                <tr style="display:none" id="sprtable6" name="sprtable6">
473 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Auto Edge ports"); ?></td>
474 648ec0c2 Ermal Luçi
                  <td class="vtable">
475
				  	<select name="autoedge[]" class="formselect" multiple="true" size="3">
476
						<?php 
477
							foreach ($ifacelist as $ifn => $ifdescr) {
478
								echo "<option value=\"{$ifn}\"";
479
								if (stristr($pconfig['autoedge'], $ifn))
480
									echo "selected";
481
								echo ">{$ifdescr}</option>";
482
							}
483
						?>
484
					</select>
485
                    <br>
486
                    <span class="vexpl">
487 308a8589 Neriberto C.Prado
	     <?=gettext("Allow interface to automatically detect edge status.  This is the " .
488 ad803a5f Neriberto C.Prado
	     "default for all interfaces added to a bridge."); ?>
489 648ec0c2 Ermal Luçi
		 <p class="vexpl"><span class="red"><strong>
490 8c287f1b Vinicius Coque
				  <?=gettext("Note:"); ?><br>
491 648ec0c2 Ermal Luçi
				  </strong></span>
492 eb4cf3cb Neriberto C.Prado
		 <?=gettext("This will disable the autoedge status of interfaces."); ?>
493 648ec0c2 Ermal Luçi
					</span></td>
494
			    </tr>
495
                <tr style="display:none" id="sprtable7" name="sprtable7">
496 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("PTP ports"); ?></td>
497 648ec0c2 Ermal Luçi
                  <td class="vtable">
498
				  	<select name="ptp[]" class="formselect" multiple="true" size="3">
499
						<?php 
500
							foreach ($ifacelist as $ifn => $ifdescr) {
501
								echo "<option value=\"{$ifn}\"";
502
								if (stristr($pconfig['ptp'], $ifn))
503
									echo "selected";
504
								echo ">{$ifdescr}</option>";
505
							}
506
						?>
507
					</select>
508
                    <br>
509
                    <span class="vexpl">
510 308a8589 Neriberto C.Prado
	     <?=gettext("Set the interface as a point-to-point link.  This is required for " .
511
	     "straight transitions to forwarding and should be enabled on a " .
512 ad803a5f Neriberto C.Prado
	     "direct link to another RSTP-capable switch."); ?>
513 648ec0c2 Ermal Luçi
					</span></td>
514
			    </tr>
515
                <tr style="display:none" id="sprtable8" name="sprtable8">
516 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Auto PTP ports"); ?></td>
517 648ec0c2 Ermal Luçi
                  <td class="vtable">
518
				  	<select name="autoptp[]" class="formselect" multiple="true" size="3">
519
						<?php 
520
							foreach ($ifacelist as $ifn => $ifdescr) {
521
								echo "<option value=\"{$ifn}\"";
522
								if (stristr($pconfig['autoptp'], $ifn))
523
									echo "selected";
524
								echo ">{$ifdescr}</option>";
525
							}
526
						?>
527
					</select>
528
                    <br>
529
                    <span class="vexpl">
530 308a8589 Neriberto C.Prado
	     <?=gettext("Automatically detect the point-to-point status on interface by " .
531
	     "checking the full duplex link status.  This is the default for " .
532 ad803a5f Neriberto C.Prado
	     "interfaces added to the bridge."); ?>
533 648ec0c2 Ermal Luçi
		 		 <p class="vexpl"><span class="red"><strong>
534 8c287f1b Vinicius Coque
				  <?=gettext("Note:"); ?><br>
535 648ec0c2 Ermal Luçi
				  </strong></span>
536 eb4cf3cb Neriberto C.Prado
		 <?=gettext("The interfaces selected here will be removed from default autoedge status."); ?>
537 648ec0c2 Ermal Luçi
					</span></td>
538
			    </tr>
539
                <tr style="display:none" id="sprtable9" name="sprtable9">
540 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Sticky ports"); ?></td>
541 648ec0c2 Ermal Luçi
                  <td class="vtable">
542
				  	<select name="static[]" class="formselect" multiple="true" size="3">
543
						<?php 
544
							foreach ($ifacelist as $ifn => $ifdescr) {
545
								echo "<option value=\"{$ifn}\"";
546
								if (stristr($pconfig['static'], $ifn))
547
									echo "selected";
548
								echo ">{$ifdescr}</option>";
549
							}
550
						?>
551
					</select>
552
                    <br>
553
                    <span class="vexpl">
554 308a8589 Neriberto C.Prado
	     <?=gettext("Mark an interface as a \"sticky\" interface.  Dynamically learned " .
555
	     "address entries are treated as static once entered into the " .
556
	     "cache.  Sticky entries are never aged out of the cache or " .
557 ad803a5f Neriberto C.Prado
	     "replaced, even if the address is seen on a different interface."); ?>		
558 648ec0c2 Ermal Luçi
					</span></td>
559
			    </tr>
560
                <tr style="display:none" id="sprtable10" name="sprtable10">
561 eb4cf3cb Neriberto C.Prado
                  <td valign="top" class="vncell"><?=gettext("Private ports"); ?></td>
562 648ec0c2 Ermal Luçi
                  <td class="vtable">
563
				  	<select name="private[]" class="formselect" multiple="true" size="3">
564
						<?php 
565
							foreach ($ifacelist as $ifn => $ifdescr) {
566
								echo "<option value=\"{$ifn}\"";
567
								if (stristr($pconfig['private'], $ifn))
568
									echo "selected";
569
								echo ">{$ifdescr}</option>";
570
							}
571
						?>
572
					</select>
573
                    <br>
574
                    <span class="vexpl">
575 308a8589 Neriberto C.Prado
	     <?=gettext("Mark an interface as a \"private\" interface.  A private interface does not forward any traffic to any other port that is also " .
576 ad803a5f Neriberto C.Prado
	     "a private interface."); ?>
577 648ec0c2 Ermal Luçi
					</span></td>
578
			    </tr>
579
                <tr>
580
                  <td width="22%" valign="top">&nbsp;</td>
581
                  <td width="78%">
582 dd5bf424 Scott Ullrich
		    <input type="hidden" name="bridgeif" value="<?=htmlspecialchars($pconfig['bridgeif']); ?>">
583 eb4cf3cb Neriberto C.Prado
                    <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> <input type="button" value="<?=gettext("Cancel"); ?>" onclick="history.back()">
584 648ec0c2 Ermal Luçi
                    <?php if (isset($id) && $a_bridges[$id]): ?>
585 225a2f0b Scott Ullrich
                    <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
586 648ec0c2 Ermal Luçi
                    <?php endif; ?>
587
                  </td>
588
                </tr>
589
              </table>
590
</form>
591
<?php include("fend.inc"); ?>
592
</body>
593
</html>