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