()
| 9834 | out.classList.remove('hidden'); |
| 9835 | out.innerHTML = '<p class="text-sm text-gray-400">Passively capturing OSPF on the segment…</p>'; |
| 9836 | try { |
| 9837 | _ospfFillIfaces(); |
| 9838 | const qs = '?seconds=' + encodeURIComponent(secs) + (iface ? '&interface=' + encodeURIComponent(iface) : ''); |
| 9839 | const d = await fetchAPI('/api/net/ospf-watch' + qs); |
| 9840 | if (!d || d.success === false) { |
| 9841 | const msg = (d && d.error) || 'failed'; |
| 9842 | let extra = ''; |
| 9843 | if (d && d.missing_tool) extra = ' <button onclick="installNetTool(\'tcpdump\', this, runOspfWatch)" class="ml-2 underline text-cyan-400">Install tcpdump</button>'; |
| 9844 | out.innerHTML = '<p class="text-sm text-red-400">Error: ' + escapeHtml(msg) + extra + '</p>'; |
| 9845 | return; |
| 9846 | } |
| 9847 | const [cls, label] = _OSPF_VERDICT_STYLE[d.verdict] || _OSPF_VERDICT_STYLE.unknown; |
| 9848 | let html = `<div class="mb-2 px-3 py-2 rounded border ${cls} text-sm">${label}</div>`; |
| 9849 | html += `<p class="text-xs text-gray-500 mb-2">Interface: ${escapeHtml(d.interface || '—')} · ${d.seconds}s · ${d.packets} OSPF pkts (${d.hellos} hello, ${d.ls_updates} LSU @ ${d.lsu_per_s}/s)${d.learned ? ' · <span class="text-gray-400">baseline learned now</span>' : ''}</p>`; |
| 9850 | if (d.note) html += `<p class="text-xs text-gray-500 mb-2">${escapeHtml(d.note)}</p>`; |
| 9851 | const auth = (d.auth_types || []).map(a => _OSPF_AUTH_NAME[a] || a); |
| 9852 | if (auth.length) { |
| 9853 | const bad = (d.auth_types || []).some(a => a < 2); |
| 9854 | html += `<p class="text-xs mb-1 ${bad ? 'text-amber-300' : 'text-gray-400'}">Authentication: ${escapeHtml(auth.join(', '))}${bad ? ' — no cryptographic auth' : ''}</p>`; |
| 9855 | } |
| 9856 | // Advisories (CVE / OSV) |
| 9857 | (d.advisories || []).forEach(a => { |
| 9858 | const sev = a.severity === 'high' ? 'text-red-300 border-red-800 bg-red-950/40' : 'text-amber-300 border-amber-800 bg-amber-950/30'; |
| 9859 | const refs = (a.refs || []).map(r => r.startsWith('http') |
| 9860 | ? `<a href="${escapeHtml(r)}" target="_blank" rel="noopener" class="underline text-cyan-400">OSV</a>` |
| 9861 | : `<span class="font-mono">${escapeHtml(r)}</span>`).join(', '); |
| 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 || []; |
no test coverage detected