Project

General

Profile

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