mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Implements the standard 802.1D-2004/802.1w configuration surface:
Bridge: priority (0-15 x4096), hello time, max age, forward delay,
force-version (RSTP v2 / STP-compatible v0 Config BPDUs), tx hold
count (per-port per-second BPDU budget).
Per port: enable, admin edge (forwarding immediately - no listen gap),
auto edge (forwarding after 3 s of BPDU silence; DEFAULT, so
host-facing ports no longer take the full forward delay),
path cost (0=auto/20000), port priority, BPDU guard (port disabled
on BPDU receipt), root guard (never accept a better root on the
port), BPDU filter (no BPDUs in or out).
Engine additions: root max-age expiry (reclaim the tree when the root goes
silent), root path cost accounting (rx cost + root-port cost, advertised in
our BPDUs), loop detection (our own BPDU coming back blocks the port for a
listen period), topology-change counter, approximated per-port roles
(Root/Designated/Alternate) for diagnostics.
CLI: "stp prio|hello|maxage|fwd|txhold|version ..." and
"stp port <n> on|off|edge|cost|prio|guard|filter ..." (stp_parse, delegated
from cmd_parser); all forms accepted by the startup-config validator so the
whole configuration persists. /stp.json now reports config + status; the
Spanning Tree page exposes everything with immediate-apply controls and live
state/role columns (edit-in-flight guard against the 2 s refresh).
8051 memory: the module moves to code BANK2; internal-RAM pressure from
cross-bank calls resolved by xdata loop iterators/scratch, __reentrant on
the small helpers, and moving httpd's header-pointer globals to xdata.
Verified on hardware (SWTGW218AS): defaults land per standard; priority and
hello change live; admin-edge ports (the LACP bond uplinks) keep the LAN at
0% loss THROUGH "stp on"; auto-edge ports forward after 3 s; a port that
heard real BPDUs (a VM bridge behind physical port 6) correctly declined
auto-edge, sat out the full listen period and became Designated; tc counts
promotions; we win the root election at priority 16384 vs 32768.
(cherry picked from commit 09a34dc6acdc81ab9cab0727d2f4a59c68131a3e)
42 lines
1.8 KiB
HTML
42 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<script src="/main.js"></script>
|
|
<script src="/i18n.js"></script>
|
|
<link rel="stylesheet" href="style.css">
|
|
<title>FreeSwitchOS Spanning Tree</title>
|
|
</head>
|
|
<body>
|
|
<nav id="sidebar"></nav>
|
|
<div style="margin-left:16%;padding:1px 16px;height:1000px;">
|
|
<div id="ports"></div>
|
|
<h1>Spanning Tree (RSTP)</h1>
|
|
<h2>Mode: <select id="stpMode"><option value="off">Disabled</option><option value="on">Enabled</option></select>
|
|
<input style="width:15%;margin-left: 3em;" class="action" id="stp_sub" onclick="stpSub();" type="button" value="Apply"></h2>
|
|
<div id="stpStat" style="font-family:monospace;"></div>
|
|
<h2>Bridge settings</h2>
|
|
<table id="stpBridge">
|
|
<tr>
|
|
<th>Priority</th><th>Version</th><th>Hello [s]</th><th>Max age [s]</th><th>Fwd delay [s]</th><th>Tx hold</th>
|
|
</tr>
|
|
<tr>
|
|
<td><select id="bPrio"></select></td>
|
|
<td><select id="bVer"><option value="rstp">RSTP</option><option value="stp">STP compat</option></select></td>
|
|
<td><input id="bHello" type="number" min="1" max="10" style="width:4em"></td>
|
|
<td><input id="bMaxage" type="number" min="6" max="40" style="width:4em"></td>
|
|
<td><input id="bFwd" type="number" min="4" max="30" style="width:4em"></td>
|
|
<td><input id="bTxhold" type="number" min="1" max="10" style="width:4em"></td>
|
|
</tr>
|
|
</table>
|
|
<p style="font-size:small">Changes apply immediately. Edge ports skip the listen period; guard/filter act on received BPDUs.</p>
|
|
<h2>Ports</h2>
|
|
<table id="stpPortsTbl">
|
|
<tr>
|
|
<th>Port</th><th>State</th><th>Role</th><th>STP</th><th>Edge</th><th>Cost [k]</th><th>Priority</th><th>Guard</th><th>Filter</th>
|
|
</tr>
|
|
</table>
|
|
<script src="/stp.js"></script>
|
|
</div>
|
|
</body>
|
|
<script src="/navigation.js"></script>
|
|
</html>
|