summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/interfaces_bridge_edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/interfaces_bridge_edit.php')
-rw-r--r--src/usr/local/www/interfaces_bridge_edit.php723
1 files changed, 288 insertions, 435 deletions
diff --git a/src/usr/local/www/interfaces_bridge_edit.php b/src/usr/local/www/interfaces_bridge_edit.php
index 1787ca1..4377555 100644
--- a/src/usr/local/www/interfaces_bridge_edit.php
+++ b/src/usr/local/www/interfaces_bridge_edit.php
@@ -29,7 +29,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
/*
- pfSense_MODULE: interfaces
+ pfSense_MODULE: interfaces
*/
##|+PRIV
@@ -41,19 +41,13 @@
require("guiconfig.inc");
-if (isset($_POST['referer'])) {
- $referer = $_POST['referer'];
-} else {
- $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/interfaces_bridge.php');
-}
-
-if (!is_array($config['bridges']['bridged'])) {
+if (!is_array($config['bridges']['bridged']))
$config['bridges']['bridged'] = array();
-}
$a_bridges = &$config['bridges']['bridged'];
$ifacelist = get_configured_interface_with_descr();
+
foreach ($ifacelist as $bif => $bdescr) {
if (substr(get_real_interface($bif), 0, 3) == "gre") {
unset($ifacelist[$bif]);
@@ -89,6 +83,7 @@ if (isset($id) && $a_bridges[$id]) {
$pconfig['priority'] = $a_bridges[$id]['priority'];
$pconfig['proto'] = $a_bridges[$id]['proto'];
$pconfig['holdcnt'] = $a_bridges[$id]['holdcnt'];
+
if (!empty($a_bridges[$id]['ifpriority'])) {
$pconfig['ifpriority'] = explode(",", $a_bridges[$id]['ifpriority']);
$ifpriority = array();
@@ -101,6 +96,7 @@ if (isset($id) && $a_bridges[$id]) {
}
$pconfig['ifpriority'] = $ifpriority;
}
+
if (!empty($a_bridges[$id]['ifpathcost'])) {
$pconfig['ifpathcost'] = explode(",", $a_bridges[$id]['ifpathcost']);
$ifpathcost = array();
@@ -113,6 +109,7 @@ if (isset($id) && $a_bridges[$id]) {
}
$pconfig['ifpathcost'] = $ifpathcost;
}
+
$pconfig['span'] = $a_bridges[$id]['span'];
if (isset($a_bridges[$id]['edge'])) {
$pconfig['edge'] = $a_bridges[$id]['edge'];
@@ -129,7 +126,6 @@ if (isset($id) && $a_bridges[$id]) {
}
if ($_POST) {
-
unset($input_errors);
$pconfig = $_POST;
@@ -165,7 +161,9 @@ if ($_POST) {
$input_errors[] = "{$ifdescr} " . gettext("interface priority for STP needs to be an integer between 0 and 240.");
}
}
+
$i = 0;
+
foreach ($ifacelist as $ifn => $ifdescr) {
if ($_POST["{$ifn}{$i}"] <> "" && !is_numeric($_POST["{$ifn}{$i}"])) {
$input_errors[] = "{$ifdescr} " . gettext("interface path cost for STP needs to be an integer between 1 and 200000000.");
@@ -217,6 +215,7 @@ if ($_POST) {
$i = 0;
$ifpriority = "";
$ifpathcost = "";
+
foreach ($ifacelist as $ifn => $ifdescr) {
if ($_POST[$ifn] <> "") {
if ($i > 0) {
@@ -232,6 +231,7 @@ if ($_POST) {
}
$i++;
}
+
$bridge['ifpriority'] = $ifpriority;
$bridge['ifpathcost'] = $ifpathcost;
@@ -253,6 +253,7 @@ if ($_POST) {
$bridge['autoptp'] = implode(',', $_POST['autoptp']);
}
+
$bridge['bridgeif'] = $_POST['bridgeif'];
interface_bridge_configure($bridge);
if ($bridge['bridgeif'] == "" || !stristr($bridge['bridgeif'], "bridge")) {
@@ -277,432 +278,284 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Interfaces"), gettext("Bridge"), gettext("Edit"));
+function build_spanport_list() {
+ global $ifacelist;
+
+ $splist = array('none' => 'None');
+
+ foreach ($ifacelist as $ifn => $ifdescr)
+ $splist[$ifn] = $ifdescr;
+
+ return($splist);
+}
+
+function build_member_list() {
+ global $pconfig, $ifacelist;
+
+ $memberlist = array('list' => array(),
+ 'selected' => array());
+
+ $members_array = explode(',', $pconfig['members']);
+ foreach ($ifacelist as $ifn => $ifinfo) {
+ $memberlist['list'][$ifn] = $ifinfo;
+
+ if (in_array($ifn, $members_array))
+ array_push($memberlist['selected'], $ifn);
+ }
+ unset($members_array);
+ return($memberlist);
+}
+
+function build_port_list($selecton) {
+ global $pconfig, $ifacelist;
+
+ $portlist = array('list' => array(),
+ 'selected' => array());
+
+ foreach ($ifacelist as $ifn => $ifdescr) {
+ $portlist['list'][$ifn] = $ifdescr;
+
+ if (stristr($selecton, $ifn))
+ array_push($portlist['selected'], $ifn);
+ }
+
+ return($portlist);
+}
+
+$pgtitle = array(gettext("Interfaces"),gettext("Bridge"),gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
-?>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<script type="text/javascript">
-//<![CDATA[
-function show_source_port_range() {
- document.getElementById("sprtable").style.display = 'none';
- document.getElementById("sprtable1").style.display = '';
- document.getElementById("sprtable2").style.display = '';
- document.getElementById("sprtable3").style.display = '';
- document.getElementById("sprtable4").style.display = '';
- document.getElementById("sprtable5").style.display = '';
- document.getElementById("sprtable6").style.display = '';
- document.getElementById("sprtable7").style.display = '';
- document.getElementById("sprtable8").style.display = '';
- document.getElementById("sprtable9").style.display = '';
- document.getElementById("sprtable10").style.display = '';
+if ($input_errors)
+ print_input_errors($input_errors);
+
+require_once('classes/Form.class.php');
+
+$form = new Form();
+
+$section = new Form_Section('Bridge Configuration');
+
+$memberslist = build_member_list();
+
+$section->addInput(new Form_Select(
+ 'members',
+ 'Member Interfaces',
+ $memberslist['selected'],
+ $memberslist['list'],
+ true // Allow multiples
+))->setHelp('Interfaces participating in the bridge');
+
+$section->addInput(new Form_Input(
+ 'Descr',
+ 'Description',
+ 'text',
+ $pconfig['descr']
+));
+
+$section->addInput(new Form_Checkbox(
+ 'showadvanced',
+ 'Advanced',
+ 'Show advanced options',
+ $pconfig['showadvanced']
+))->toggles('.toggle-advanced');
+
+$form->add($section);
+
+$section = new Form_Section('Advanced Configuration');
+
+// Set initial toggle state manually for now
+if($pconfig['showadvanced'])
+ $section->addClass('toggle-advanced in');
+else
+ $section->addClass('toggle-advanced collapse');
+
+$section->addInput(new Form_Input(
+ 'maxaddr',
+ 'Cache Size',
+ 'text',
+ $pconfig['maxaddr']
+))->setHelp('Set the size of the bridge address cache. The default is 100 entries');
+
+$section->addInput(new Form_Input(
+ 'timeout',
+ 'Cache expire time',
+ 'text',
+ $pconfig['timeout']
+))->setHelp('Set the timeout of address cache entries to this number of seconds. If seconds is zero, then address cache entries will not be expired. The default is 240 seconds');
+
+$section->addInput(new Form_Select(
+ 'span',
+ 'Span Port',
+ $pconfig['span'],
+ build_spanport_list()
+))->setHelp('Add the interface named by interface as a span port on the bridge. Span ports transmit a copy of every frame received by the bridge.' .
+ 'This is most useful for snooping a bridged network passively on another host connected to one of the span ports of the bridge. <br />' .
+ '%sThe span interface cannot be part of the bridge member interfaces.%s', ['<strong>', '</strong>']);
+
+$edgelist = build_port_list($pconfig['edge']);
+
+$section->addInput(new Form_Select(
+ 'edge[]',
+ 'Edge Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Set interface as an edge port. An edge port connects directly to end stations and cannot create bridging loops in the network; this allows it to transition straight to forwarding.');
+
+$edgelist = build_port_list($pconfig['autoedge']);
+
+$section->addInput(new Form_Select(
+ 'autoedge[]',
+ 'Auto Edge Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Allow interface to automatically detect edge status. This is the default for all interfaces added to a bridge.' .
+ '%sThis will disable the autoedge status of interfaces. %s', ['<strong>', '</strong>']);
+
+$edgelist = build_port_list($pconfig['ptp']);
+
+$section->addInput(new Form_Select(
+ 'ptp',
+ 'PTP Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Set the interface as a point-to-point link. This is required for straight transitions to forwarding and should be enabled on a direct link to another RSTP-capable switch.');
+
+$edgelist = build_port_list($pconfig['autoptp']);
+
+$section->addInput(new Form_Select(
+ 'autoptp[]',
+ 'Auto PTP Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Automatically detect the point-to-point status on interface by checking the full duplex link status. This is the default for interfaces added to the bridge.' .
+ '%sThe interfaces selected here will be removed from default autoedge status. %s', ['<strong>', '</strong>']);
+
+$edgelist = build_port_list($pconfig['static']);
+
+$section->addInput(new Form_Select(
+ 'static[]',
+ 'Sticky Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Mark an interface as a "sticky" interface. Dynamically learned address entries are treated as static once entered into the cache. ' .
+ 'Sticky entries are never aged out of the cache or replaced, even if the address is seen on a different interface.');
+
+$edgelist = build_port_list($pconfig['private']);
+
+$section->addInput(new Form_Select(
+ 'private[]',
+ 'Private Ports',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Mark an interface as a "private" interface. A private interface does not forward any traffic to any other port that is also a private interface. ');
+
+// STP section
+// ToDo: - Should disable spanning tree section when not checked
+$section->addInput(new Form_Checkbox(
+ 'enablestp',
+ 'Enable RSTP/STP',
+ null,
+ $pconfig['enablestp']
+));
+
+// Show the spanning tree section
+$form->add($section);
+$section = new Form_Section('RSTP/STP');
+if($pconfig['showadvanced'])
+ $section->addClass('toggle-advanced in');
+else
+ $section->addClass('toggle-advanced collapse');
+
+$section->addInput(new Form_Select(
+ 'proto',
+ 'Protocol',
+ $pconfig['proto'],
+ array('rstp' => 'RSTP',
+ 'stp' => 'STP')
+))->setHelp('Protocol used for spanning tree.');
+
+$edgelist = build_port_list($pconfig['stp']);
+
+$section->addInput(new Form_Select(
+ 'stp[]',
+ 'STP Interfaces',
+ $edgelist['selected'],
+ $edgelist['list'],
+ true
+))->setHelp('Enable Spanning Tree Protocol on interface. The if_bridge(4) driver has support for the IEEE 802.1D Spanning Tree Protocol (STP).' .
+ 'STP is used to detect and remove loops in a network topology.');
+
+$section->addInput(new Form_Input(
+ 'maxage',
+ 'Valid time',
+ 'number',
+ $pconfig['maxage'],
+ ['placeholder' => 20, 'min' => 6, 'max' => 40]
+))->setHelp('Set the time that a Spanning Tree Protocol configuration is valid. The default is 20 seconds. The minimum is 6 seconds and the maximum is 40 seconds.');
+
+$section->addInput(new Form_Input(
+ 'fwdelay',
+ 'Forward time',
+ 'number',
+ $pconfig['fwdelay'],
+ ['placeholder' => 15, 'min' => 4, 'max' => 30]
+))->setHelp('Set the time that must pass before an interface begins forwarding packets when Spanning Tree is enabled. The default is 15 seconds. The minimum is 4 seconds and the maximum is 30 seconds. ');
+
+$section->addInput(new Form_Input(
+ 'hellotime',
+ 'Hello time',
+ 'number',
+ $pconfig['hellotime'],
+ ['placeholder' => 2, 'min' => 1, 'max' => 2, 'step' => '0.1']
+))->setHelp('Set the time in seconds between broadcasting of Spanning Tree Protocol configuration messages. The hello time may only be changed when operating in legacy STP mode.' .
+ 'The default is 2 seconds. The minimum is 1 second and the maximum is 2 seconds.');
+
+$section->addInput(new Form_Input(
+ 'priority',
+ 'Priority',
+ 'text',
+ $pconfig['priority'],
+ ['placeholder' => 32768, 'min' => 0, 'max' => 61440]
+))->setHelp('Set the bridge priority for Spanning Tree. The default is 32768. The minimum is 0 and the maximum is 61440. ');
+
+$section->addInput(new Form_Input(
+ 'holdcnt',
+ 'Hold Count',
+ 'number',
+ $pconfig['holdcnt'],
+ ['placeholder' => 6, 'min' => 1, 'max' => 10]
+))->setHelp('Set the transmit hold count for Spanning Tree. This is the number of packets transmitted before being rate limited. The default is 6. The minimum is 1 and the maximum is 10.');
+
+foreach ($ifacelist as $ifn => $ifdescr) {
+ $section->addInput(new Form_Input(
+ $ifn,
+ $ifdescr . ' Priority',
+ 'number',
+ $pconfig[$ifn],
+ ['placeholder' => 128, 'min' => 0, 'max' => 240, 'step' => 16]
+ ))->setHelp('Set the Spanning Tree priority of interface to value. The default is 128. The minimum is 0 and the maximum is 240. Increments of 16.');
}
-//]]>
-</script>
-
-<?php include("fbegin.inc"); ?>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<?php $size=count($ifacelist); ?>
-<form action="interfaces_bridge_edit.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="interfaces bridge edit">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("Bridge configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Member interfaces"); ?></td>
- <td width="78%" class="vtable">
- <select name="members[]" multiple="multiple" class="formselect" size="<?php echo $size; ?>">
- <?php
- $members_array = explode(',', $pconfig['members']);
- foreach ($ifacelist as $ifn => $ifinfo) {
- echo "<option value=\"{$ifn}\"";
- if (in_array($ifn, $members_array)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifinfo}</option>";
- }
- unset($members_array);
- ?>
- </select>
- <br />
- <span class="vexpl"><?=gettext("Interfaces participating in the bridge."); ?></span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
- <td width="78%" class="vtable">
- <input type="text" name="descr" id="descr" class="formfld unknown" size="50" value="<?=htmlspecialchars($pconfig['descr']);?>" />
- </td>
- </tr>
- <tr id="sprtable">
- <td></td>
- <td>
- <p><input type="button" onclick="show_source_port_range()" value="<?=gettext("Show advanced options"); ?>" /></p>
- </td>
- </tr>
- <tr style="display:none" id="sprtable1">
- <td valign="top" class="vncell" align="center"><?=gettext("RSTP/STP"); ?> </td>
- <td class="vtable">
- <input type="checkbox" name="enablestp" id="enablestp" <?php if ($pconfig['enablestp']) echo "checked=\"checked\"";?> />
- <span class="vexpl"><strong><?=gettext("Enable spanning tree options for this bridge."); ?> </strong></span>
- <br /><br />
- <table id="stpoptions" border="0" cellpadding="6" cellspacing="0" summary="protocol">
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Protocol"); ?></td>
- <td class="vtable" width="80%">
- <select name="proto" id="proto">
- <?php
- foreach (array("rstp", "stp") as $proto) {
- echo "<option value=\"{$proto}\"";
- if ($pconfig['proto'] == $proto) {
- echo " selected=\"selected\"";
- }
- echo ">".strtoupper($proto)."</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl"><?=gettext("Protocol used for spanning tree."); ?> </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("STP interfaces"); ?></td>
- <td class="vtable" width="80%">
- <select name="stp[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['stp'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl" >
- <?=gettext("Enable Spanning Tree Protocol on interface. The if_bridge(4) " .
- "driver has support for the IEEE 802.1D Spanning Tree Protocol " .
- "(STP). STP is used to detect and remove loops in a " .
- "network topology."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Valid time"); ?></td>
- <td class="vtable" width="80%">
- <input name="maxage" type="text" class="formfld unknown" id="maxage" size="8" value="<?=htmlspecialchars($pconfig['maxage']);?>" /> <?=gettext("seconds"); ?>
- <br />
- <span class="vexpl">
- <?=gettext("Set the time that a Spanning Tree Protocol configuration is " .
- "valid. The default is 20 seconds. The minimum is 6 seconds and " .
- "the maximum is 40 seconds."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Forward time"); ?> </td>
- <td class="vtable" width="80%">
- <input name="fwdelay" type="text" class="formfld unknown" id="fwdelay" size="8" value="<?=htmlspecialchars($pconfig['fwdelay']);?>" /> <?=gettext("seconds"); ?>
- <br />
- <span class="vexpl">
- <?=gettext("Set the time that must pass before an interface begins forwarding " .
- "packets when Spanning Tree is enabled. The default is 15 seconds. The minimum is 4 seconds and the maximum is 30 seconds."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Hello time"); ?></td>
- <td class="vtable" width="80%">
- <input name="hellotime" type="text" class="formfld unknown" size="8" id="hellotime" value="<?=htmlspecialchars($pconfig['hellotime']);?>" /> <?=gettext("seconds"); ?>
- <br />
- <span class="vexpl">
- <?=gettext("Set the time between broadcasting of Spanning Tree Protocol configuration messages. The hello time may only be changed when " .
- "operating in legacy STP mode. The default is 2 seconds. The minimum is 1 second and the maximum is 2 seconds."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
- <td class="vtable" width="80%">
- <input name="priority" type="text" class="formfld unknown" id="priority" value="<?=htmlspecialchars($pconfig['priority']);?>" />
- <br />
- <span class="vexpl">
- <?=gettext("Set the bridge priority for Spanning Tree. The default is 32768. " .
- "The minimum is 0 and the maximum is 61440."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Hold count"); ?></td>
- <td class="vtable" width="80%">
- <input name="holdcnt" type="text" class="formfld unknown" id="holdcnt" value="<?=htmlspecialchars($pconfig['holdcnt']);?>" />
- <br />
- <span class="vexpl">
- <?=gettext("Set the transmit hold count for Spanning Tree. This is the number" .
- " of packets transmitted before being rate limited. The " .
- "default is 6. The minimum is 1 and the maximum is 10."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Priority"); ?></td>
- <td class="vtable" width="80%">
- <table summary="priority">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<tr><td>{$ifdescr}</td><td><input size=\"5\" name=\"{$ifn}\" type=\"text\" class=\"formfld unknown\" id=\"{$ifn}\" value=\"{$ifpriority[$ifn]}\" /></td></tr>";
- }
- ?>
- <tr>
- <td></td>
- </tr>
- </table>
- <br />
- <span class="vexpl" >
- <?=gettext("Set the Spanning Tree priority of interface to value. The " .
- "default is 128. The minimum is 0 and the maximum is 240. Increments of 16."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="vncell" width="20%"><?=gettext("Path cost"); ?></td>
- <td class="vtable" width="80%">
- <table summary="path cost">
- <?php
- $i = 0;
- foreach ($ifacelist as $ifn => $ifdescr) {
- 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>";
- }
- ?>
- <tr>
- <td></td>
- </tr>
- </table>
- <br />
- <span class="vexpl" >
- <?=gettext("Set the Spanning Tree path cost of interface to value. The " .
- "default is calculated from the link speed. To change a previously selected path cost back to automatic, set the cost to 0. ".
- "The minimum is 1 and the maximum is 200000000."); ?>
- </span>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr style="display:none" id="sprtable2">
- <td valign="top" class="vncell"><?=gettext("Cache size"); ?></td>
- <td class="vtable">
- <input name="maxaddr" size="10" type="text" class="formfld unknown" id="maxaddr" value="<?=htmlspecialchars($pconfig['maxaddr']);?>" /> <?=gettext("entries"); ?>
- <br />
- <span class="vexpl">
- <?=gettext("Set the size of the bridge address cache to size. The default is " .
- ".100 entries."); ?>
- </span>
- </td>
- </tr>
- <tr style="display:none" id="sprtable3">
- <td valign="top" class="vncell"><?=gettext("Cache entry expire time"); ?></td>
- <td>
- <input name="timeout" type="text" class="formfld unknown" id="timeout" size="10" value="<?=htmlspecialchars($pconfig['timeout']);?>" /> <?=gettext("seconds"); ?>
- <br />
- <span class="vexpl">
- <?=gettext("Set the timeout of address cache entries to this number of seconds. If " .
- "seconds is zero, then address cache entries will not be expired. " .
- "The default is 240 seconds."); ?>
- </span>
- </td>
- </tr>
- <tr style="display:none" id="sprtable4">
- <td valign="top" class="vncell"><?=gettext("Span port"); ?></td>
- <td class="vtable">
- <select name="span" class="formselect" id="span">
- <option value="none" selected="selected"><?=gettext("None"); ?></option>
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if ($ifn == $pconfig['span']) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Add the interface named by interface as a span port on the " .
- "bridge. Span ports transmit a copy of every frame received by " .
- "the bridge. This is most useful for snooping a bridged network " .
- "passively on another host connected to one of the span ports of " .
- "the bridge."); ?>
- </span>
- <p class="vexpl">
- <span class="red"><strong>
- <?=gettext("Note:"); ?><br />
- </strong></span>
- <?=gettext("The span interface cannot be part of the bridge member interfaces."); ?>
- </p>
- </td>
- </tr>
- <tr style="display:none" id="sprtable5">
- <td valign="top" class="vncell"><?=gettext("Edge ports"); ?></td>
- <td class="vtable">
- <select name="edge[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['edge'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Set interface as an edge port. An edge port connects directly to " .
- "end stations and cannot create bridging loops in the network; this " .
- "allows it to transition straight to forwarding."); ?>
- </span>
- </td>
- </tr>
- <tr style="display:none" id="sprtable6">
- <td valign="top" class="vncell"><?=gettext("Auto Edge ports"); ?></td>
- <td class="vtable">
- <select name="autoedge[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['autoedge'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Allow interface to automatically detect edge status. This is the " .
- "default for all interfaces added to a bridge."); ?>
- </span>
- <p class="vexpl">
- <span class="red"><strong>
- <?=gettext("Note:"); ?><br />
- </strong></span>
- <?=gettext("This will disable the autoedge status of interfaces."); ?>
- </p>
- </td>
- </tr>
- <tr style="display:none" id="sprtable7">
- <td valign="top" class="vncell"><?=gettext("PTP ports"); ?></td>
- <td class="vtable">
- <select name="ptp[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['ptp'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Set the interface as a point-to-point link. This is required for " .
- "straight transitions to forwarding and should be enabled on a " .
- "direct link to another RSTP-capable switch."); ?>
- </span>
- </td>
- </tr>
- <tr style="display:none" id="sprtable8">
- <td valign="top" class="vncell"><?=gettext("Auto PTP ports"); ?></td>
- <td class="vtable">
- <select name="autoptp[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['autoptp'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Automatically detect the point-to-point status on interface by " .
- "checking the full duplex link status. This is the default for " .
- "interfaces added to the bridge."); ?>
- </span>
- <p class="vexpl">
- <span class="red"><strong>
- <?=gettext("Note:"); ?><br />
- </strong></span>
- <?=gettext("The interfaces selected here will be removed from default autoedge status."); ?>
- </p>
- </td>
- </tr>
- <tr style="display:none" id="sprtable9">
- <td valign="top" class="vncell"><?=gettext("Sticky ports"); ?></td>
- <td class="vtable">
- <select name="static[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['static'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Mark an interface as a \"sticky\" interface. Dynamically learned " .
- "address entries are treated as static once entered into the " .
- "cache. Sticky entries are never aged out of the cache or " .
- "replaced, even if the address is seen on a different interface."); ?>
- </span>
- </td>
- </tr>
- <tr style="display:none" id="sprtable10">
- <td valign="top" class="vncell"><?=gettext("Private ports"); ?></td>
- <td class="vtable">
- <select name="private[]" class="formselect" multiple="multiple" size="3">
- <?php
- foreach ($ifacelist as $ifn => $ifdescr) {
- echo "<option value=\"{$ifn}\"";
- if (stristr($pconfig['private'], $ifn)) {
- echo " selected=\"selected\"";
- }
- echo ">{$ifdescr}</option>";
- }
- ?>
- </select>
- <br />
- <span class="vexpl">
- <?=gettext("Mark an interface as a \"private\" interface. A private interface does not forward any traffic to any other port that is also " .
- "a private interface."); ?>
- </span>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input type="hidden" name="bridgeif" value="<?=htmlspecialchars($pconfig['bridgeif']); ?>" />
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
- <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
- <input name="referer" type="hidden" value="<?=$referer;?>" />
- <?php if (isset($id) && $a_bridges[$id]): ?>
- <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
-</form>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+$i = 0;
+foreach ($ifacelist as $ifn => $ifdescr) {
+ $section->addInput(new Form_Input(
+ $ifn . $i,
+ $ifdescr . ' Path cost',
+ 'number',
+ $ifpathcost[$ifn],
+ [ 'placeholder' => 0, 'min' => 1, 'max' => 200000000]
+ ))->setHelp('Set the Spanning Tree path cost of interface to value. The default is calculated from the link speed. '.
+ 'To change a previously selected path cost back to automatic, set the cost to 0. The minimum is 1 and the maximum is 200000000.');
+ $i++;
+}
+
+$form->add($section);
+print($form);
+
+include("foot.inc"); \ No newline at end of file
OpenPOWER on IntegriCloud