Project

General

Profile

Download (25.1 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['holdcount'] = $a_bridges[$id]['holdcount'];
77
	$pconfig['ifpriority'] = explode(",", $a_bridges[$id]['ifpriority']);
78
	$ifpriority = array();
79
	foreach ($pconfig['ifpriority'] as $cfg) {
80
		$embcfg = explode(":", $cfg);
81
		foreach ($embcfg as $key => $value)
82
			$ifpriority[$key] = $value;
83
	}
84
	$pconfig['ifpriority'] = $ifpriority;
85
	$pconfig['ifpathcost'] = explode(",", $a_bridges[$id]['ifpathcost']);
86
	$ifpathcost = array();
87
	foreach ($pconfig['ifpathcost'] as $cfg) {
88
		$embcfg = explode(":", $cfg);
89
		foreach ($embcfg as $key => $value)
90
			$ifpathcost[$key] = $value;
91
	}
92
	$pconfig['ifpathcost'] = $ifpathcost;
93
	$pconfig['span'] = $a_bridges[$id]['span'];
94
	if (isset($a_bridges[$id]['edge']))
95
		$pconfig['edge'] = $a_bridges[$id]['edge'];
96
	if (isset($a_bridges[$id]['autoedge']))
97
		$pconfig['autoedge'] = $a_bridges[$id]['autoedge'];
98
	if (isset($a_bridges[$id]['ptp']))
99
		$pconfig['ptp'] = $a_bridges[$id]['ptp'];
100
	if (isset($a_bridges[$id]['autoptp']))
101
		$pconfig['autoptp'] = $a_bridges[$id]['autoptp'];
102
}
103

    
104
if ($_POST) {
105

    
106
	unset($input_errors);
107
	$pconfig = $_POST;
108

    
109
	/* input validation */
110
	$reqdfields = explode(" ", "members");
111
	$reqdfieldsn = array(gettext("Member Interfaces"));
112

    
113
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
114

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

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

    
143
	if (is_array($_POST['members'])) {
144
		foreach($_POST['members'] as $ifmembers) {
145
			if (is_array($config['interfaces'][$ifmembers]['wireless']) &&
146
				$config['interfaces'][$ifmembers]['wireless']['mode'] != "hostap")
147
				$input_errors[] = gettext("Bridging a wireless interface is only possible in hostap mode.");
148
			if ($_POST['span'] != "none" && $_POST['span'] == $ifmembers)
149
				$input_errors[] = gettext("Span interface cannot be part of the bridge. Remove the span interface from bridge members to continue.");
150
		}
151
	}
152

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

    
203
		$bridge['bridgeif'] = $_POST['bridgeif'];
204
                $bridge['bridgeif'] = interface_bridge_configure($bridge);
205
                if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge"))
206
                        $input_errors[] = gettext("Error occured creating interface, please retry.");
207
                else {
208
                        if (isset($id) && $a_bridges[$id])
209
                                $a_bridges[$id] = $bridge;
210
                        else
211
                                $a_bridges[] = $bridge;
212

    
213
                        write_config();
214

    
215
			$confif = convert_real_interface_to_friendly_interface_name($bridge['bridgeif']);
216
                        if ($confif <> "")
217
                                interface_configure($confif);
218

    
219

    
220
			header("Location: interfaces_bridge.php");
221
			exit;
222
		}
223
	}
224
}
225

    
226
$pgtitle = array(gettext("Firewall"),gettext("Bridge"),gettext("Edit"));
227
include("head.inc");
228

    
229
?>
230

    
231
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
232
<script type="text/javascript">
233
function show_source_port_range() {
234
        document.getElementById("sprtable").style.display = 'none';
235
        document.getElementById("sprtable1").style.display = '';
236
        document.getElementById("sprtable2").style.display = '';
237
        document.getElementById("sprtable3").style.display = '';
238
        document.getElementById("sprtable4").style.display = '';
239
        document.getElementById("sprtable5").style.display = '';
240
        document.getElementById("sprtable6").style.display = '';
241
        document.getElementById("sprtable7").style.display = '';
242
        document.getElementById("sprtable8").style.display = '';
243
        document.getElementById("sprtable9").style.display = '';
244
        document.getElementById("sprtable10").style.display = '';
245
}
246
</script>
247

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

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