()
| 10721 | } |
| 10722 | // ---- CFM Watch (IEEE 802.1ag CFM / ITU-T Y.1731 service OAM) ---------------- |
| 10723 | const _CFM_VERDICT_STYLE = { |
| 10724 | 'no-traffic': ['bg-slate-800 border-slate-700 text-slate-300', 'ℹ No CFM on this port — 802.1ag / Y.1731 service OAM normally only appears on a carrier / metro Ethernet service handoff'], |
| 10725 | clean: ['bg-green-950/40 border-green-900 text-green-400', '✓ CFM seen — well-formed, no forgery, protection-switch abuse, linktrace sweep or flood (inventory only)'], |
| 10726 | observed: ['bg-sky-950/40 border-sky-900 text-sky-300', 'ℹ Operational CFM events seen (RDI, AIS, CSF, loopback / linktrace) — worth a look, not an attack'], |
| 10727 | suspicious: ['bg-orange-950/50 border-orange-800 text-orange-300', '⚠ Suspicious — a manual switch, LCK, an MD-level or MAID anomaly, a reserved encoding, or a load pattern'], |
| 10728 | attack: ['bg-red-950/60 border-red-800 text-red-300', '🛑 CFM ATTACK — forged protection switching, a forged AIS / CCM, a moved or duplicate MEP, a linktrace sweep, an LBM flood or a malformed CFM frame'], |
| 10729 | unknown: ['bg-slate-800 border-slate-700 text-slate-400', '— Could not determine'], |
| 10730 | }; |
| 10731 | async function runCfmWatch() { |
| 10732 | const out = document.getElementById('cfm-results'); |
| 10733 | if (!out) return; |
| 10734 | const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null; |
| 10735 | const ifaceSel = document.getElementById('cfm-iface'); |
| 10736 | const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : ''; |
| 10737 | const secsEl = document.getElementById('cfm-secs'); |
| 10738 | const secs = secsEl && secsEl.value ? secsEl.value : '30'; |
| 10739 | const ceilEl = document.getElementById('cfm-ceiling'); |
| 10740 | const ceil = ceilEl && ceilEl.value !== '' ? ceilEl.value : ''; |
| 10741 | _ndBusy(btn, true, 'Listening…'); |
| 10742 | out.classList.remove('hidden'); |
| 10743 | out.innerHTML = '<p class="text-sm text-gray-400">Passively capturing CFM (EtherType 0x8902, untagged / 802.1Q / QinQ)…</p>'; |
| 10744 | try { |
| 10745 | _fillIfaceSel('cfm-iface'); |
| 10746 | const qs = '?seconds=' + encodeURIComponent(secs) + (iface ? '&interface=' + encodeURIComponent(iface) : '') + |
| 10747 | (ceil !== '' ? '&md_ceiling=' + encodeURIComponent(ceil) : ''); |
| 10748 | const d = await fetchAPI('/api/net/cfm-watch' + qs); |
| 10749 | if (!d || d.success === false) { |
nothing calls this directly
no test coverage detected