Project

General

Profile

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