()
| 6893 | out.innerHTML = '<p class="text-sm text-gray-400">Provoking DHCP offers and watching for a DISCOVER flood… (a few seconds)</p>'; |
| 6894 | try { |
| 6895 | _dhcpFillIfaces(); |
| 6896 | const d = await fetchAPI('/api/net/dhcp-guardian' + (iface ? '?interface=' + encodeURIComponent(iface) : '')); |
| 6897 | if (!d || d.success === false) { |
| 6898 | out.innerHTML = '<p class="text-sm text-red-400">Error: ' + escapeHtml((d && d.error) || 'failed') + '</p>'; |
| 6899 | return; |
| 6900 | } |
| 6901 | const [cls, label] = _DHCP_VERDICT_STYLE[d.verdict] || _DHCP_VERDICT_STYLE.unknown; |
| 6902 | let html = `<div class="mb-2 px-3 py-2 rounded border ${cls} text-sm">${label}</div>`; |
| 6903 | html += `<p class="text-xs text-gray-500 mb-2">Interface: ${escapeHtml(d.interface || '—')} · active gateway: <span class="font-mono">${escapeHtml(d.gateway || '—')}</span>${d.learned ? ' · <span class="text-gray-400">baseline learned now</span>' : ''}</p>`; |
| 6904 | |
| 6905 | // DHCP servers table |
| 6906 | const servers = d.servers || []; |
| 6907 | if (servers.length) { |
| 6908 | html += '<p class="text-xs uppercase text-gray-400 mt-2 mb-1">DHCP servers that answered (' + servers.length + ')</p>' + |
| 6909 | '<table class="min-w-full text-xs text-gray-300 whitespace-nowrap"><thead>' + |
| 6910 | '<tr class="text-left text-gray-500"><th class="px-2 py-1">Server</th><th class="px-2 py-1">Offered gateway</th><th class="px-2 py-1">Offered DNS</th><th class="px-2 py-1">Lease</th><th class="px-2 py-1">Status</th></tr>' + |
| 6911 | '</thead><tbody>' + |
| 6912 | servers.map(s => { |
nothing calls this directly
no test coverage detected