(devices)
| 9862 | html += `<div class="mt-2 px-3 py-2 rounded border text-xs ${sev}"><strong>${escapeHtml(a.title)}</strong><br>${escapeHtml(a.detail)}${refs ? '<br><span class="text-gray-400">Refs:</span> ' + refs : ''}</div>`; |
| 9863 | }); |
| 9864 | // Routers table |
| 9865 | const routers = d.routers || [], tr = d.trusted_routers || []; |
| 9866 | if (routers.length) { |
| 9867 | html += '<p class="text-xs uppercase text-gray-400 mt-2 mb-1">OSPF routers seen (' + routers.length + ')</p>' + |
| 9868 | '<table class="min-w-full text-xs text-gray-300 whitespace-nowrap"><thead>' + |
| 9869 | '<tr class="text-left text-gray-500"><th class="px-2 py-1">Router-ID</th><th class="px-2 py-1">Source(s)</th><th class="px-2 py-1">Status</th></tr>' + |
| 9870 | '</thead><tbody>' + |
| 9871 | routers.map(r => { |
| 9872 | const badge = r.new ? '<span class="text-amber-300">? new</span>' : (tr.indexOf(r.router_id) >= 0 ? '<span class="text-green-400">✓ known</span>' : '<span class="text-gray-500">—</span>'); |
| 9873 | return `<tr class="border-t border-slate-800"> |
| 9874 | <td class="px-2 py-1 font-mono ${r.new ? 'text-amber-300' : ''}">${escapeHtml(r.router_id)}</td> |
| 9875 | <td class="px-2 py-1 font-mono text-gray-400">${escapeHtml((r.sources || []).join(', ') || '—')}</td> |
| 9876 | <td class="px-2 py-1">${badge}</td> |
| 9877 | </tr>`; |
| 9878 | }).join('') + |
| 9879 | '</tbody></table>'; |
| 9880 | } |
| 9881 | const lc = d.lsa_counts || {}; |
| 9882 | const lcKeys = Object.keys(lc); |
| 9883 | if (lcKeys.length) { |
| 9884 | html += '<p class="text-xs text-gray-500 mt-2">LSAs: ' + lcKeys.map(k => `${escapeHtml(k)}×${lc[k]}`).join(', ') + '</p>'; |
| 9885 | } |
| 9886 | if (d.reasons && d.reasons.length) { |
| 9887 | html += '<ul class="text-xs text-gray-400 mt-2 list-disc pl-5">' + |
| 9888 | d.reasons.map(r => '<li>' + escapeHtml(r) + '</li>').join('') + '</ul>'; |
| 9889 | } |
| 9890 | out.innerHTML = html; |
| 9891 | } catch (e) { |
| 9892 | out.innerHTML = '<p class="text-sm text-red-400">Failed: ' + escapeHtml(e.message) + '</p>'; |
| 9893 | } finally { |
| 9894 | _ndBusy(btn, false); |
| 9895 | } |
| 9896 | } |
| 9897 | async function ospfTrustBaseline() { |
| 9898 | try { |
| 9899 | await postAPI('/api/net/ospf-baseline', { action: 'reset' }); |
| 9900 | addConsoleMessage('OSPF baseline reset — re-learning current routers & originators', 'info'); |
| 9901 | await runOspfWatch(); |
| 9902 | } catch (e) { |
| 9903 | addConsoleMessage('Failed to reset OSPF baseline: ' + e.message, 'error'); |
| 9904 | } |
| 9905 | } |
| 9906 | |
| 9907 | // ---- STP/BPDU Watch (passive spanning-tree security scanner) ---------------- |
| 9908 | const _STP_VERDICT_STYLE = { |
| 9909 | clean: ['bg-green-950/40 border-green-900 text-green-400', '✓ Spanning-tree root(s) and bridges match the baseline'], |
| 9910 | 'topology-change': ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ Topology-change churn — MAC tables being flushed (instability / TCN flood)'], |
| 9911 | 'bpdu-flood': ['bg-red-950/60 border-red-800 text-red-300', '🛑 BPDU flood — spanning-tree reconvergence storm (DoS)'], |
| 9912 | 'rogue-bridge': ['bg-red-950/60 border-red-800 text-red-300', '🛑 New STP bridge on the segment — unexpected switch / spoofed bridge'], |
| 9913 | 'root-hijack': ['bg-red-950/60 border-red-800 text-red-300', '🛑 ROOT HIJACK — a superior BPDU is taking over the root bridge (L2 MITM)'], |
| 9914 | anomaly: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ BPDU anomaly — field-sanity / MST / per-MSTI violation (see findings)'], |
no test coverage detected