Project

General

Profile

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

    
6
	Copyright (C) 2008 Ermal Lu?i
7
	All rights reserved.
8

    
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11

    
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14

    
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18

    
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
/*
31
	pfSense_MODULE:	interfaces
32
*/
33

    
34
##|+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
require("guiconfig.inc");
42

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

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

    
48
$ifacelist = get_configured_interface_with_descr();
49
foreach ($ifacelist as $bif => $bdescr) {
50
	if (substr(get_real_interface($bif), 0, 3) == "gre")
51
		unset($ifacelist[$bif]);
52
}
53

    
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['holdcnt'] = $a_bridges[$id]['holdcnt'];
77
	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
	}
89
	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
	}
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
	$reqdfieldsn = array(gettext("Member Interfaces"));
120

    
121
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
122

    
123
	if ($_POST['maxage'] && !is_numeric($_POST['maxage']))
124
		$input_errors[] = gettext("Maxage needs to be an integer between 6 and 40.");
125
	if ($_POST['maxaddr'] && !is_numeric($_POST['maxaddr']))
126
		$input_errors[] = gettext("Maxaddr needs to be an integer.");
127
	if ($_POST['timeout'] && !is_numeric($_POST['timeout']))
128
		$input_errors[] = gettext("Timeout needs to be an integer.");
129
	if ($_POST['fwdelay'] && !is_numeric($_POST['fwdelay']))
130
		$input_errors[] = gettext("Forward Delay needs to be an integer between 4 and 30.");
131
	if ($_POST['hellotime'] && !is_numeric($_POST['hellotime']))
132
		$input_errors[] = gettext("Hello time for STP needs to be an integer between 1 and 2.");
133
	if ($_POST['priority'] && !is_numeric($_POST['priority']))
134
		$input_errors[] = gettext("Priority for STP needs to be an integer between 0 and 61440.");
135
	if ($_POST['holdcnt'] && !is_numeric($_POST['holdcnt']))
136
		$input_errors[] = gettext("Transmit Hold Count for STP needs to be an integer between 1 and 10.");
137
	foreach ($ifacelist as $ifn => $ifdescr) {
138
		if ($_POST[$ifn] <> "" && !is_numeric($_POST[$ifn]))
139
			$input_errors[] = "{$ifdescr} " . gettext("interface priority for STP needs to be an integer between 0 and 240.");
140
	}
141
	$i = 0;
142
	foreach ($ifacelist as $ifn => $ifdescr) {
143
		if ($_POST["{$ifn}{$i}"] <> "" && !is_numeric($_POST["{$ifn}{$i}"]))
144
			$input_errors[] = "{$ifdescr} " . gettext("interface path cost for STP needs to be an integer between 1 and 200000000.");
145
		$i++;
146
	}
147

    
148
	if (!is_array($_POST['members']) || count($_POST['members']) < 2)
149
		$input_errors[] = gettext("You must select at least 2 member interfaces for a bridge.");
150

    
151
	if (is_array($_POST['members'])) {
152
		foreach($_POST['members'] as $ifmembers) {
153
			if (empty($config['interfaces'][$ifmembers]))
154
				$input_errors[] = gettext("A member interface passed does not exist in configuration");
155
			if (is_array($config['interfaces'][$ifmembers]['wireless']) &&
156
				$config['interfaces'][$ifmembers]['wireless']['mode'] != "hostap")
157
				$input_errors[] = gettext("Bridging a wireless interface is only possible in hostap mode.");
158
			if ($_POST['span'] != "none" && $_POST['span'] == $ifmembers)
159
				$input_errors[] = gettext("Span interface cannot be part of the bridge. Remove the span interface from bridge members to continue.");
160
		}
161
	}
162

    
163
	if (!$input_errors) {
164
		$bridge = array();
165
		$bridge['members'] = implode(',', $_POST['members']);
166
		$bridge['enablestp'] = $_POST['enablestp'] ? true : false;
167
		$bridge['descr'] = $_POST['descr'];
168
		$bridge['maxaddr'] = $_POST['maxaddr'];
169
		$bridge['timeout'] = $_POST['timeout'];
170
		if ($_POST['static'])
171
			$bridge['static'] = implode(',', $_POST['static']);
172
		if ($_POST['private'])
173
			$bridge['private'] = implode(',', $_POST['private']);
174
		if (isset($_POST['stp']))
175
			$bridge['stp'] = implode(',', $_POST['stp']);
176
		$bridge['maxage'] = $_POST['maxage'];
177
		$bridge['fwdelay'] = $_POST['fwdelay'];
178
		$bridge['hellotime'] = $_POST['hellotime'];
179
		$bridge['priority'] = $_POST['priority'];
180
		$bridge['proto'] = $_POST['proto'];
181
		$bridge['holdcnt'] = $_POST['holdcnt'];
182
		$i = 0;
183
		$ifpriority = "";
184
		$ifpathcost = "";
185
		foreach ($ifacelist as $ifn => $ifdescr) {
186
			if ($_POST[$ifn] <> "") {
187
				if ($i > 0)
188
					$ifpriority .= ",";
189
				$ifpriority .= $ifn.":".$_POST[$ifn];
190
			}
191
			if ($_POST["{$ifn}0"] <> "") {
192
				if ($i > 0)
193
					$ifpathcost .= ",";
194
				$ifpathcost .= $ifn.":".$_POST["{$ifn}0"];
195
			}
196
			$i++;
197
		}
198
		$bridge['ifpriority'] = $ifpriority;
199
		$bridge['ifpathcost'] = $ifpathcost;
200

    
201
		if ($_POST['span'] != "none")
202
			$bridge['span'] = $_POST['span'];
203
		else
204
			unset($bridge['span']);
205
		if (isset($_POST['edge']))
206
			$bridge['edge'] = implode(',', $_POST['edge']);
207
		if (isset($_POST['autoedge']))
208
			$bridge['autoedge'] = implode(',', $_POST['autoedge']);
209
		if (isset($_POST['ptp']))
210
			$bridge['ptp'] = implode(',', $_POST['ptp']);
211
		if (isset($_POST['autoptp']))
212
			$bridge['autoptp'] = implode(',', $_POST['autoptp']);
213

    
214
		$bridge['bridgeif'] = $_POST['bridgeif'];
215
		interface_bridge_configure($bridge);
216
		if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge"))
217
			$input_errors[] = gettext("Error occurred creating interface, please retry.");
218
		else {
219
			if (isset($id) && $a_bridges[$id])
220
				$a_bridges[$id] = $bridge;
221
			else
222
				$a_bridges[] = $bridge;
223

    
224
			write_config();
225

    
226
			$confif = convert_real_interface_to_friendly_interface_name($bridge['bridgeif']);
227
			if ($confif <> "")
228
				interface_configure($confif);
229

    
230
			header("Location: interfaces_bridge.php");
231
			exit;
232
		}
233
	}
234
}
235

    
236
$pgtitle = array(gettext("Interfaces"),gettext("Bridge"),gettext("Edit"));
237
$shortcut_section = "interfaces";
238
include("head.inc");
239

    
240
?>
241

    
242
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
243
<script type="text/javascript">
244
//<![CDATA[
245
function show_source_port_range() {
246
        document.getElementById("sprtable").style.display = 'none';
247
        document.getElementById("sprtable1").style.display = '';
248
        document.getElementById("sprtable2").style.display = '';
249
        document.getElementById("sprtable3").style.display = '';
250
        document.getElementById("sprtable4").style.display = '';
251
        document.getElementById("sprtable5").style.display = '';
252
        document.getElementById("sprtable6").style.display = '';
253
        document.getElementById("sprtable7").style.display = '';
254
        document.getElementById("sprtable8").style.display = '';
255
        document.getElementById("sprtable9").style.display = '';
256
        document.getElementById("sprtable10").style.display = '';
257
}
258
//]]>
259
</script>
260

    
261
<?php include("fbegin.inc"); ?>
262
<?php if ($input_errors) print_input_errors($input_errors); ?>
263
            <form action="interfaces_bridge_edit.php" method="post" name="iform" id="iform">
264
              <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces bridge edit">
265
				<tr>
266
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Bridge configuration"); ?></td>
267
				</tr>
268
				<tr>
269
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Member interfaces"); ?></td>
270
                  <td width="78%" class="vtable">
271
				  <select name="members[]" multiple="multiple" class="formselect" size="3">
272
                      <?php
273
						foreach ($ifacelist as $ifn => $ifinfo) {
274
							echo "<option value=\"{$ifn}\"";
275
							if (stristr($pconfig['members'], $ifn))
276
								echo " selected=\"selected\"";
277
							echo ">{$ifinfo}</option>";
278
						}
279
				?>
280
                    </select>
281
			<br/>
282
			<span class="vexpl"><?=gettext("Interfaces participating in the bridge."); ?></span>
283
			</td>
284
            </tr>
285
			<tr>
286
                  <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
287
                  <td width="78%" class="vtable">
288
				  <input type="text" name="descr" id="descr" class="formfld unknown" size="50" value="<?=htmlspecialchars($pconfig['descr']);?>" />
289
					</td>
290
				</tr>
291
            <tr id="sprtable">
292
                <td></td>
293
                <td>
294
                <p><input type="button" onclick="show_source_port_range()" value="<?=gettext("Show advanced options"); ?>" /></p>
295
                </td>
296
			</tr>
297
                <tr style="display:none" id="sprtable1">
298
                  <td valign="top" class="vncell" align="center"><?=gettext("RSTP/STP"); ?>  </td>
299
                  <td class="vtable">
300
					<input type="checkbox" name="enablestp" id="enablestp" <?php if ($pconfig['enablestp']) echo "checked=\"checked\"";?> />
301
					<span class="vexpl"><strong><?=gettext("Enable spanning tree options for this bridge."); ?> </strong></span>
302
					<br/><br/>
303
					<table id="stpoptions" border="0" cellpadding="6" cellspacing="0" summary="protocol">
304
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Protocol"); ?></td>
305
					<td class="vtable" width="80%">
306
					<select name="proto" id="proto">
307
						<?php
308
							foreach (array("rstp", "stp") as $proto) {
309
								echo "<option value=\"{$proto}\"";
310
								if ($pconfig['proto'] == $proto)
311
									echo " selected=\"selected\"";
312
								echo ">".strtoupper($proto)."</option>";
313
							}
314
						?>
315
					</select>
316
                    <br/>
317
                    <span class="vexpl"><?=gettext("Protocol used for spanning tree."); ?> </span></td>
318
					</tr>
319
					<tr> <td valign="top" class="vncell" width="20%"><?=gettext("STP interfaces"); ?></td>
320
					<td class="vtable" width="80%">
321
					<select name="stp[]" class="formselect" multiple="multiple" size="3">
322
						<?php
323
							foreach ($ifacelist as $ifn => $ifdescr) {
324
								echo "<option value=\"{$ifn}\"";
325
								if (stristr($pconfig['stp'], $ifn))
326
									echo " selected=\"selected\"";
327
								echo ">{$ifdescr}</option>";
328
							}
329
						?>
330
					</select>
331
					<br/>
332
					<span class="vexpl" >
333
	     <?=gettext("Enable Spanning Tree Protocol on interface.  The if_bridge(4) " .
334
	     "driver has support for the IEEE 802.1D Spanning Tree Protocol " .
335
	     "(STP).  STP is used to detect and remove loops in a " .
336
	     "network topology."); ?>
337
					</span>
338
					</td></tr>
339
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Valid time"); ?></td>
340
					<td class="vtable" width="80%">
341
					<input name="maxage" type="text" class="formfld unkown" id="maxage" size="8" value="<?=htmlspecialchars($pconfig['maxage']);?>" /> <?=gettext("seconds"); ?>
342
					<br/>
343
					<span class="vexpl">
344
	     <?=gettext("Set the time that a Spanning Tree Protocol configuration is " .
345
	     "valid.  The default is 20 seconds.  The minimum is 6 seconds and " .
346
	     "the maximum is 40 seconds."); ?>
347
					</span>
348
					</td></tr>
349
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Forward time"); ?> </td>
350
					<td class="vtable" width="80%">
351
					<input name="fwdelay" type="text" class="formfld unkown" id="fwdelay" size="8" value="<?=htmlspecialchars($pconfig['fwdelay']);?>" /> <?=gettext("seconds"); ?>
352
					<br/>
353
					<span class="vexpl">
354
	     <?=gettext("Set the time that must pass before an interface begins forwarding " .
355
	     "packets when Spanning Tree is enabled.  The default is 15 seconds.  The minimum is 4 seconds and the maximum is 30 seconds."); ?>
356
					</span>
357
					</td></tr>
358
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Hello time"); ?></td>
359
					<td class="vtable" width="80%">
360
					<input name="hellotime" type="text" class="formfld unkown" size="8" id="hellotime" value="<?=htmlspecialchars($pconfig['hellotime']);?>" /> <?=gettext("seconds"); ?>
361
					<br/>
362
					<span class="vexpl">
363
	     <?=gettext("Set the time between broadcasting of Spanning Tree Protocol configuration messages.  The hello time may only be changed when " .
364
	     "operating in legacy STP mode.  The default is 2 seconds.  The minimum is 1 second and the maximum is 2 seconds."); ?>
365
					</span>
366
					</td></tr>
367
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
368
					<td class="vtable" width="80%">
369
					<input name="priority" type="text" class="formfld unkown" id="priority" value="<?=htmlspecialchars($pconfig['priority']);?>" />
370
					<br/>
371
					<span class="vexpl">
372
	     <?=gettext("Set the bridge priority for Spanning Tree.  The default is 32768. " .
373
	     "The minimum is 0 and the maximum is 61440."); ?>
374
					</span>
375
					</td></tr>
376
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Hold count"); ?></td>
377
					<td class="vtable" width="80%">
378
					<input name="holdcnt" type="text" class="formfld unkown" id="holdcnt" value="<?=htmlspecialchars($pconfig['holdcnt']);?>" />
379
					<br/>
380
					<span class="vexpl">
381
	     <?=gettext("Set the transmit hold count for Spanning Tree.  This is the number" .
382
	     " of packets transmitted before being rate limited.  The " .
383
	     "default is 6.  The minimum is 1 and the maximum is 10."); ?>
384
					</span>
385
					</td></tr>
386
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
387
					<td class="vtable" width="80%">
388
					<table summary="priority">
389
					<?php foreach ($ifacelist as $ifn => $ifdescr)
390
							echo "<tr><td>{$ifdescr}</td><td><input size=\"5\" name=\"{$ifn}\" type=\"text\" class=\"formfld unkown\" id=\"{$ifn}\" value=\"{$ifpriority[$ifn]}\" /></td></tr>";
391
					?>
392
					<tr><td></td></tr>
393
					</table>
394
					<br/>
395
					<span class="vexpl" >
396
	     <?=gettext("Set the Spanning Tree priority of interface to value.  The " .
397
	     "default is 128.  The minimum is 0 and the maximum is 240.  Increments of 16."); ?>
398
					</span>
399
					</td></tr>
400
					<tr><td valign="top" class="vncell" width="20%"><?=gettext("Path cost"); ?></td>
401
					<td class="vtable" width="80%">
402
					<table summary="path cost">
403
					<?php $i = 0; foreach ($ifacelist as $ifn => $ifdescr)
404
							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>";
405
					?>
406
					<tr><td></td></tr>
407
					</table>
408
					<br/>
409
					<span class="vexpl" >
410
	     <?=gettext("Set the Spanning Tree path cost of interface to value.  The " .
411
	     "default is calculated from the link speed.  To change a previously selected path cost back to automatic, set the cost to 0. ".
412
	     "The minimum is 1 and the maximum is 200000000."); ?>
413
					</span>
414
					</td></tr>
415

    
416
			    </table>
417
				</td></tr>
418
                <tr style="display:none" id="sprtable2">
419
                  <td valign="top" class="vncell"><?=gettext("Cache size"); ?></td>
420
					<td class="vtable">
421
						<input name="maxaddr" size="10" type="text" class="formfld unkown" id="maxaddr" value="<?=htmlspecialchars($pconfig['maxaddr']);?>" /> <?=gettext("entries"); ?>
422
					<br/><span class="vexpl">
423
<?=gettext("Set the size of the bridge address cache to size.	The default is " .
424
	     ".100 entries."); ?>
425
					</span>
426
					</td>
427
				</tr>
428
                <tr style="display:none" id="sprtable3">
429
                  <td valign="top" class="vncell"><?=gettext("Cache entry expire time"); ?></td>
430
				  <td>
431
					<input name="timeout" type="text" class="formfld unkown" id="timeout" size="10" value="<?=htmlspecialchars($pconfig['timeout']);?>" /> <?=gettext("seconds"); ?>
432
					<br/><span class="vexpl">
433
	     <?=gettext("Set the timeout of address cache entries to this number of seconds.  If " .
434
	     "seconds is zero, then address cache entries will not be expired. " .
435
	     "The default is 240 seconds."); ?>
436
					</span>
437
					</td>
438
				</tr>
439
                <tr style="display:none" id="sprtable4">
440
                  <td valign="top" class="vncell"><?=gettext("Span port"); ?></td>
441
					<td class="vtable">
442
				  	<select name="span" class="formselect" id="span">
443
						<option value="none" selected="selected"><?=gettext("None"); ?></option>
444
						<?php
445
							foreach ($ifacelist as $ifn => $ifdescr) {
446
								echo "<option value=\"{$ifn}\"";
447
								if ($ifn == $pconfig['span'])
448
									echo " selected=\"selected\"";
449
								echo ">{$ifdescr}</option>";
450
							}
451
						?>
452
					</select>
453
					<br/><span class="vexpl">
454
	     <?=gettext("Add the interface named by interface as a span port on the " .
455
	     "bridge.  Span ports transmit a copy of every frame received by " .
456
	     "the bridge.  This is most useful for snooping a bridged network " .
457
	     "passively on another host connected to one of the span ports of " .
458
	     "the bridge."); ?>
459
					</span>
460
		<p class="vexpl"><span class="red"><strong>
461
					 <?=gettext("Note:"); ?><br/>
462
                                  </strong></span>
463
                 <?=gettext("The span interface cannot be part of the bridge member interfaces."); ?>
464
                                        </p>
465
					</td>
466
				</tr>
467
                <tr style="display:none" id="sprtable5">
468
                  <td valign="top" class="vncell"><?=gettext("Edge ports"); ?></td>
469
                  <td class="vtable">
470
					<select name="edge[]" class="formselect" multiple="multiple" size="3">
471
						<?php
472
							foreach ($ifacelist as $ifn => $ifdescr) {
473
								echo "<option value=\"{$ifn}\"";
474
								if (stristr($pconfig['edge'], $ifn))
475
									echo " selected=\"selected\"";
476
								echo ">{$ifdescr}</option>";
477
							}
478
						?>
479
					</select>
480
                    <br/>
481
                    <span class="vexpl">
482
	     <?=gettext("Set interface as an edge port.  An edge port connects directly to " .
483
	     "end stations and cannot create bridging loops in the network; this " .
484
	     "allows it to transition straight to forwarding."); ?>
485
					</span></td>
486
			    </tr>
487
                <tr style="display:none" id="sprtable6">
488
                  <td valign="top" class="vncell"><?=gettext("Auto Edge ports"); ?></td>
489
                  <td class="vtable">
490
					<select name="autoedge[]" class="formselect" multiple="multiple" size="3">
491
						<?php
492
							foreach ($ifacelist as $ifn => $ifdescr) {
493
								echo "<option value=\"{$ifn}\"";
494
								if (stristr($pconfig['autoedge'], $ifn))
495
									echo " selected=\"selected\"";
496
								echo ">{$ifdescr}</option>";
497
							}
498
						?>
499
					</select>
500
                    <br/>
501
                    <span class="vexpl">
502
	     <?=gettext("Allow interface to automatically detect edge status.  This is the " .
503
	     "default for all interfaces added to a bridge."); ?></span>
504
		 <p class="vexpl"><span class="red"><strong>
505
				  <?=gettext("Note:"); ?><br/>
506
				  </strong></span>
507
		 <?=gettext("This will disable the autoedge status of interfaces."); ?>
508
					</p></td>
509
			    </tr>
510
                <tr style="display:none" id="sprtable7">
511
                  <td valign="top" class="vncell"><?=gettext("PTP ports"); ?></td>
512
                  <td class="vtable">
513
					<select name="ptp[]" class="formselect" multiple="multiple" size="3">
514
						<?php
515
							foreach ($ifacelist as $ifn => $ifdescr) {
516
								echo "<option value=\"{$ifn}\"";
517
								if (stristr($pconfig['ptp'], $ifn))
518
									echo " selected=\"selected\"";
519
								echo ">{$ifdescr}</option>";
520
							}
521
						?>
522
					</select>
523
                    <br/>
524
                    <span class="vexpl">
525
	     <?=gettext("Set the interface as a point-to-point link.  This is required for " .
526
	     "straight transitions to forwarding and should be enabled on a " .
527
	     "direct link to another RSTP-capable switch."); ?>
528
					</span></td>
529
			    </tr>
530
                <tr style="display:none" id="sprtable8">
531
                  <td valign="top" class="vncell"><?=gettext("Auto PTP ports"); ?></td>
532
                  <td class="vtable">
533
					<select name="autoptp[]" class="formselect" multiple="multiple" size="3">
534
						<?php
535
							foreach ($ifacelist as $ifn => $ifdescr) {
536
								echo "<option value=\"{$ifn}\"";
537
								if (stristr($pconfig['autoptp'], $ifn))
538
									echo " selected=\"selected\"";
539
								echo ">{$ifdescr}</option>";
540
							}
541
						?>
542
					</select>
543
                    <br/>
544
                    <span class="vexpl">
545
	     <?=gettext("Automatically detect the point-to-point status on interface by " .
546
	     "checking the full duplex link status.  This is the default for " .
547
	     "interfaces added to the bridge."); ?></span>
548
				 <p class="vexpl"><span class="red"><strong>
549
				  <?=gettext("Note:"); ?><br/>
550
				  </strong></span>
551
		 <?=gettext("The interfaces selected here will be removed from default autoedge status."); ?>
552
					</p></td>
553
			    </tr>
554
                <tr style="display:none" id="sprtable9">
555
                  <td valign="top" class="vncell"><?=gettext("Sticky ports"); ?></td>
556
                  <td class="vtable">
557
					<select name="static[]" class="formselect" multiple="multiple" size="3">
558
						<?php
559
							foreach ($ifacelist as $ifn => $ifdescr) {
560
								echo "<option value=\"{$ifn}\"";
561
								if (stristr($pconfig['static'], $ifn))
562
									echo " selected=\"selected\"";
563
								echo ">{$ifdescr}</option>";
564
							}
565
						?>
566
					</select>
567
                    <br/>
568
                    <span class="vexpl">
569
	     <?=gettext("Mark an interface as a \"sticky\" interface.  Dynamically learned " .
570
	     "address entries are treated as static once entered into the " .
571
	     "cache.  Sticky entries are never aged out of the cache or " .
572
	     "replaced, even if the address is seen on a different interface."); ?>
573
					</span></td>
574
			    </tr>
575
                <tr style="display:none" id="sprtable10">
576
                  <td valign="top" class="vncell"><?=gettext("Private ports"); ?></td>
577
                  <td class="vtable">
578
					<select name="private[]" class="formselect" multiple="multiple" size="3">
579
						<?php
580
							foreach ($ifacelist as $ifn => $ifdescr) {
581
								echo "<option value=\"{$ifn}\"";
582
								if (stristr($pconfig['private'], $ifn))
583
									echo " selected=\"selected\"";
584
								echo ">{$ifdescr}</option>";
585
							}
586
						?>
587
					</select>
588
                    <br/>
589
                    <span class="vexpl">
590
	     <?=gettext("Mark an interface as a \"private\" interface.  A private interface does not forward any traffic to any other port that is also " .
591
	     "a private interface."); ?>
592
					</span></td>
593
			    </tr>
594
                <tr>
595
                  <td width="22%" valign="top">&nbsp;</td>
596
                  <td width="78%">
597
		    <input type="hidden" name="bridgeif" value="<?=htmlspecialchars($pconfig['bridgeif']); ?>" />
598
                    <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" value="<?=gettext("Cancel"); ?>" onclick="history.back()" />
599
                    <?php if (isset($id) && $a_bridges[$id]): ?>
600
                    <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
601
                    <?php endif; ?>
602
                  </td>
603
                </tr>
604
              </table>
605
</form>
606
<?php include("fend.inc"); ?>
607
</body>
608
</html>
(96-96/246)