Преглед изворни кода

feat(roaming): 802.11r status tab + agent-only router support (Phase 14.3) (#106)

Adds read-only 802.11r (Fast BSS Transition) visibility to /roaming:

- GET /api/dot11r: per-SSID and per-router view parsed from
  uci show wireless. Lazy-loaded when the tab opens.
- Roaming.tsx 802.11r tab replaces the placeholder with a global
  badge, per-SSID table (coverage, mobility domain, FT mode, auth),
  and per-router table (band/channel, 11r/11k/11v/PMF flags, BSSID).
- Parser is a pure function with tests using a real Flint2 fixture.

Also bundles the agent-only-router feature (a clean side branch that
was blocking compilation) and a GetDawn fix that skips SSH calls to
agent-only routers (saved 4s per /api/dawn request).

Closes #105

Co-authored-by: nacho <nacho@cloudless.club>
Nacho пре 3 месеци
родитељ
комит
e04eaefee3

+ 32 - 0
app/public/locales/en/translation.json

@@ -335,6 +335,38 @@
       "legendGood": "≤ -65 dBm (optimal)",
       "legendFair": "-70 to -80 dBm (fair)",
       "legendWeak": "≥ -85 dBm (marginal)"
+    },
+    "dot11r": {
+      "title": "802.11r status",
+      "description": "Fast BSS Transition (fast roaming) read from `uci show wireless`. Without it the client fully re-authenticates when jumping APs (1-2 s hiccup).",
+      "empty": "No router has 802.11r enabled on any SSID.",
+      "allOn": "802.11r active on all {{n}} SSIDs",
+      "partial": "Partial: active on {{on}} of {{total}} SSIDs",
+      "allOff": "802.11r inactive",
+      "bySsid": "By SSID",
+      "byRouter": "By router",
+      "colSsid": "SSID",
+      "colState": "State",
+      "colCoverage": "Coverage",
+      "colMobility": "Mobility domain",
+      "colFtMode": "FT mode",
+      "colAuth": "Authentication",
+      "colRouters": "Interfaces",
+      "colRouter": "Router",
+      "colIface": "Interface",
+      "colSsidR": "SSID",
+      "colBandCh": "Band · channel",
+      "colMac": "BSSID",
+      "stateOn": "Active",
+      "statePartial": "Partial",
+      "stateOff": "Inactive",
+      "ftOverDs": "Over-the-DS",
+      "ftOverAir": "Over-the-air",
+      "pskLocal": "Local PSK",
+      "radius": "External RADIUS",
+      "coverageHint": "Coverage = interfaces with 802.11r / total interfaces on that SSID. For smooth roaming it should be 100% on every SSID.",
+      "noIfaces": "No wireless interfaces.",
+      "unreachable": "Router not reachable over SSH."
     }
   },
   "notFound": {

+ 32 - 0
app/public/locales/es/translation.json

@@ -335,6 +335,38 @@
       "legendGood": "≤ -65 dBm (óptimo)",
       "legendFair": "-70 a -80 dBm (aceptable)",
       "legendWeak": "≥ -85 dBm (límite)"
+    },
+    "dot11r": {
+      "title": "Estado 802.11r",
+      "description": "Fast BSS Transition (roaming rápido) leído de `uci show wireless`. Sin él, el cliente se re-autentica completo al saltar de AP (corte de 1-2 s).",
+      "empty": "Ningún router tiene 802.11r habilitado en ningún SSID.",
+      "allOn": "802.11r activo en los {{n}} SSIDs",
+      "partial": "Parcial: activo en {{on}} de {{total}} SSIDs",
+      "allOff": "802.11r inactivo",
+      "bySsid": "Por SSID",
+      "byRouter": "Por router",
+      "colSsid": "SSID",
+      "colState": "Estado",
+      "colCoverage": "Cobertura",
+      "colMobility": "Mobility domain",
+      "colFtMode": "Modo FT",
+      "colAuth": "Autenticación",
+      "colRouters": "Interfaces",
+      "colRouter": "Router",
+      "colIface": "Interfaz",
+      "colSsidR": "SSID",
+      "colBandCh": "Banda · canal",
+      "colMac": "BSSID",
+      "stateOn": "Activo",
+      "statePartial": "Parcial",
+      "stateOff": "Inactivo",
+      "ftOverDs": "Over-the-DS",
+      "ftOverAir": "Over-the-air",
+      "pskLocal": "PSK local",
+      "radius": "RADIUS externo",
+      "coverageHint": "Cobertura = interfaces con 802.11r / total de interfaces en ese SSID. Para roaming fluido debe ser 100% en cada SSID.",
+      "noIfaces": "Sin interfaces wifi.",
+      "unreachable": "Router no accesible por SSH."
     }
   },
   "notFound": {

+ 332 - 3
app/src/pages/Roaming.tsx

@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react'
 import { useTranslation } from 'react-i18next'
 import { Link } from 'react-router'
 import { motion, useReducedMotion } from 'framer-motion'
-import { RefreshCw, Wifi } from 'lucide-react'
+import { AlertTriangle, CheckCircle2, RefreshCw, Wifi, XCircle } from 'lucide-react'
 import { cn } from '@/lib/utils'
 import { useNetPulse } from '@/data/DataProvider'
 
@@ -42,6 +42,53 @@ interface Dawn {
   mesh: DawnMesh[]
 }
 
+// ---------------------------------------------------------------------------
+// Tipos del contrato GET /api/dot11r (server-go/internal/adapters/types.go).
+// ---------------------------------------------------------------------------
+
+interface Dot11rIface {
+  section: string
+  device: string
+  ifname: string
+  ssid: string
+  mac: string
+  channel?: number
+  band?: string
+  encryption?: string
+  dot11rEnabled: boolean
+  mobilityDomain?: string
+  ftOverDs: boolean
+  ftPskGenerateLocal: boolean
+  pmkR1Push?: boolean
+  nasid?: string
+  dot11kEnabled?: boolean
+  dot11vEnabled?: boolean
+  bssTransition?: boolean
+  mfp?: boolean
+}
+interface Dot11rRouter {
+  routerId: string
+  name: string
+  available: boolean
+  ifaces: Dot11rIface[]
+}
+interface Dot11rSSID {
+  ssid: string
+  enabledEverywhere: boolean
+  enabledCount: number
+  totalCount: number
+  mobilityDomain?: string
+  ftOverDs: boolean
+  ftPskGenerateLocal: boolean
+  ifaceCount: number
+  routerIds: string[]
+}
+interface Dot11rOverview {
+  available: boolean
+  ssids: Dot11rSSID[]
+  routers: Dot11rRouter[]
+}
+
 type Band = 'all' | '2.4 GHz' | '5 GHz'
 type Tab = 'matrix' | '11r' | 'survey' | 'events'
 
@@ -60,6 +107,9 @@ export default function Roaming() {
   const [band, setBand] = useState<Band>('all')
   const [weakOnly, setWeakOnly] = useState(false)
   const [dawn, setDawn] = useState<Dawn | null>(null)
+  const [dot11r, setDot11r] = useState<Dot11rOverview | null>(null)
+  const [dot11rLoading, setDot11rLoading] = useState(false)
+  const [dot11rError, setDot11rError] = useState(false)
   const [loading, setLoading] = useState(true)
   const [error, setError] = useState(false)
   const [spin, setSpin] = useState(false)
@@ -88,10 +138,36 @@ export default function Roaming() {
     }
   }
 
+  // Carga perezosa de /api/dot11r solo cuando se abre la pestaña 11r (es un
+  // SSH a cada router con wifi, más caro que la matriz DAWN que ya está cache
+  // en el primer router). Recarga también al pulsar Refresh con 11r abierta.
+  async function loadDot11r() {
+    setDot11rLoading(true)
+    setDot11rError(false)
+    try {
+      const res = await fetch('/api/dot11r')
+      if (!res.ok) throw new Error(`status ${res.status}`)
+      setDot11r((await res.json()) as Dot11rOverview)
+    } catch {
+      setDot11rError(true)
+      setDot11r(null)
+    } finally {
+      setDot11rLoading(false)
+    }
+  }
+
   useEffect(() => {
     void load()
   }, [])
 
+  // Al cambiar a 11r, carga si aún no se ha hecho. Si vuelve a matrix no
+  // invalidamos (los datos siguen siendo buenos hasta el próximo refresh).
+  useEffect(() => {
+    if (tab === '11r' && dot11r === null && !dot11rLoading && !dot11rError) {
+      void loadDot11r()
+    }
+  }, [tab, dot11r, dot11rLoading, dot11rError])
+
   // APs visibles según el filtro de banda.
   const aps = useMemo(() => {
     if (!dawn) return []
@@ -131,7 +207,7 @@ export default function Roaming() {
   const bandOptions: Band[] = ['all', '2.4 GHz', '5 GHz']
   const tabs: { id: Tab; label: string; soon: boolean }[] = [
     { id: 'matrix', label: t('roaming.tabMatrix'), soon: false },
-    { id: '11r', label: t('roaming.tab11r'), soon: true },
+    { id: '11r', label: t('roaming.tab11r'), soon: false },
     { id: 'survey', label: t('roaming.tabSurvey'), soon: true },
     { id: 'events', label: t('roaming.tabEvents'), soon: true },
   ]
@@ -168,6 +244,7 @@ export default function Roaming() {
             transition={{ duration: 0.25, ease: 'easeOut', delay: 0.12 }}
             onClick={() => {
               void load()
+              if (tab === '11r') void loadDot11r()
               if (reduce) return
               setSpin(true)
               window.setTimeout(() => setSpin(false), 650)
@@ -199,12 +276,14 @@ export default function Roaming() {
       </div>
 
       {/* ③ Contenido */}
-      {tab !== 'matrix' && (
+      {tab !== 'matrix' && tab !== '11r' && (
         <div className="rounded-2xl border border-border bg-surface p-8 text-center text-caption text-text-muted">
           {t('roaming.comingSoon')}
         </div>
       )}
 
+      {tab === '11r' && <Dot11rPanel overview={dot11r} loading={dot11rLoading} error={dot11rError} />}
+
       {tab === 'matrix' && (
         <>
           {loading && (!dawn || aps.length === 0) && (
@@ -353,3 +432,253 @@ export default function Roaming() {
     </div>
   )
 }
+
+// ---------------------------------------------------------------------------
+// Pestaña 802.11r (Fase 14.3) — estado global + tabla por SSID + detalle router
+// ---------------------------------------------------------------------------
+
+function Dot11rPanel({
+  overview,
+  loading,
+  error,
+}: {
+  overview: Dot11rOverview | null
+  loading: boolean
+  error: boolean
+}) {
+  const { t } = useTranslation()
+  const reduce = useReducedMotion()
+  const initial = reduce ? false : { opacity: 0, y: 12 }
+
+  if (loading && !overview) {
+    return (
+      <div className="rounded-2xl border border-border bg-surface p-8 text-center text-caption text-text-muted">
+        {t('roaming.loading')}
+      </div>
+    )
+  }
+  if (error) {
+    return (
+      <div className="rounded-2xl border border-border bg-surface p-8 text-center text-caption text-text-muted">
+        {t('roaming.error')}
+      </div>
+    )
+  }
+  if (!overview || !overview.available || overview.ssids.length === 0) {
+    return (
+      <div className="rounded-2xl border border-border bg-surface p-8 text-center text-caption text-text-muted">
+        {t('roaming.dot11r.empty')}
+      </div>
+    )
+  }
+
+  const ssidsEnabled = overview.ssids.filter((s) => s.enabledCount > 0).length
+  const ssidsEverywhere = overview.ssids.filter((s) => s.enabledEverywhere).length
+
+  return (
+    <motion.section
+      initial={initial}
+      animate={{ opacity: 1, y: 0 }}
+      transition={{ duration: 0.25, ease: 'easeOut', delay: 0.08 }}
+      className="space-y-4"
+    >
+      {/* ① Estado global */}
+      <div className="rounded-2xl border border-border bg-surface p-5 md:p-6">
+        <div className="flex flex-wrap items-start justify-between gap-3">
+          <div className="flex items-start gap-2">
+            <Wifi className="mt-0.5 h-4 w-4 shrink-0 text-accent" strokeWidth={1.75} />
+            <div>
+              <h2 className="font-display text-h2 text-text-primary">{t('roaming.dot11r.title')}</h2>
+              <p className="mt-0.5 max-w-2xl text-caption text-text-muted">{t('roaming.dot11r.description')}</p>
+            </div>
+          </div>
+          <StateBadge
+            kind={ssidsEverywhere === overview.ssids.length ? 'ok' : ssidsEnabled > 0 ? 'warn' : 'bad'}
+            text={
+              ssidsEverywhere === overview.ssids.length
+                ? t('roaming.dot11r.allOn', { n: overview.ssids.length })
+                : ssidsEnabled > 0
+                  ? t('roaming.dot11r.partial', { on: ssidsEnabled, total: overview.ssids.length })
+                  : t('roaming.dot11r.allOff')
+            }
+          />
+        </div>
+      </div>
+
+      {/* ② Tabla por SSID */}
+      <div className="rounded-2xl border border-border bg-surface p-5 md:p-6">
+        <h3 className="mb-3 font-display text-h3 text-text-primary">{t('roaming.dot11r.bySsid')}</h3>
+        <div className="overflow-x-auto">
+          <table className="w-full border-separate border-spacing-0 text-left text-sm">
+            <thead>
+              <tr className="text-label uppercase text-text-muted">
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colSsid')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colState')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colCoverage')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colMobility')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colFtMode')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colAuth')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colRouters')}</th>
+              </tr>
+            </thead>
+            <tbody>
+              {overview.ssids.map((s) => (
+                <tr key={s.ssid} className="group">
+                  <th scope="row" className="border-b border-border/60 py-2 pr-3 text-left font-medium text-text-primary">
+                    {s.ssid}
+                  </th>
+                  <td className="border-b border-border/60 py-2 pr-3">
+                    <StatePill
+                      kind={s.enabledEverywhere ? 'ok' : s.enabledCount > 0 ? 'warn' : 'bad'}
+                      text={
+                        s.enabledEverywhere
+                          ? t('roaming.dot11r.stateOn')
+                          : s.enabledCount > 0
+                            ? t('roaming.dot11r.statePartial')
+                            : t('roaming.dot11r.stateOff')
+                      }
+                    />
+                  </td>
+                  <td className="border-b border-border/60 py-2 pr-3 font-mono text-mono-sm text-text-secondary">
+                    {s.enabledCount}/{s.totalCount}
+                  </td>
+                  <td className="border-b border-border/60 py-2 pr-3 font-mono text-mono-sm text-text-secondary">
+                    {s.mobilityDomain || '—'}
+                  </td>
+                  <td className="border-b border-border/60 py-2 pr-3 text-text-secondary">
+                    {s.enabledCount > 0
+                      ? s.ftOverDs
+                        ? t('roaming.dot11r.ftOverDs')
+                        : t('roaming.dot11r.ftOverAir')
+                      : '—'}
+                  </td>
+                  <td className="border-b border-border/60 py-2 pr-3 text-text-secondary">
+                    {s.enabledCount > 0 ? (s.ftPskGenerateLocal ? t('roaming.dot11r.pskLocal') : t('roaming.dot11r.radius')) : '—'}
+                  </td>
+                  <td className="border-b border-border/60 py-2 pr-3 font-mono text-caption text-text-muted">
+                    {s.ifaceCount}
+                  </td>
+                </tr>
+              ))}
+            </tbody>
+          </table>
+        </div>
+        <p className="mt-3 text-caption text-text-muted">{t('roaming.dot11r.coverageHint')}</p>
+      </div>
+
+      {/* ③ Detalle por router */}
+      <div className="rounded-2xl border border-border bg-surface p-5 md:p-6">
+        <h3 className="mb-3 font-display text-h3 text-text-primary">{t('roaming.dot11r.byRouter')}</h3>
+        <div className="overflow-x-auto">
+          <table className="w-full border-separate border-spacing-0 text-left text-sm">
+            <thead>
+              <tr className="text-label uppercase text-text-muted">
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colRouter')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colIface')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colSsidR')}</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colBandCh')}</th>
+                <th className="pb-2.5 pr-3 font-medium">11r</th>
+                <th className="pb-2.5 pr-3 font-medium">11k</th>
+                <th className="pb-2.5 pr-3 font-medium">11v</th>
+                <th className="pb-2.5 pr-3 font-medium">PMF</th>
+                <th className="pb-2.5 pr-3 font-medium">{t('roaming.dot11r.colMac')}</th>
+              </tr>
+            </thead>
+            <tbody>
+              {overview.routers.flatMap((r) => {
+                if (r.ifaces.length === 0) {
+                  return [
+                    <tr key={`${r.routerId}-none`}>
+                      <th scope="row" className="border-b border-border/60 py-2 pr-3 text-left font-medium text-text-primary">
+                        {r.name}
+                      </th>
+                      <td colSpan={8} className="border-b border-border/60 py-2 pr-3 text-caption text-text-muted">
+                        {r.available ? t('roaming.dot11r.noIfaces') : t('roaming.dot11r.unreachable')}
+                      </td>
+                    </tr>,
+                  ]
+                }
+                return r.ifaces.map((ifc, idx) => (
+                  <tr key={`${r.routerId}-${ifc.section}`}>
+                    <th
+                      scope="row"
+                      className={cn(
+                        'border-b border-border/60 py-2 pr-3 text-left font-medium text-text-primary',
+                        idx > 0 && 'text-text-muted',
+                      )}
+                    >
+                      {idx === 0 ? r.name : ''}
+                    </th>
+                    <td className="border-b border-border/60 py-2 pr-3 font-mono text-mono-sm text-text-secondary">
+                      {ifc.ifname || ifc.section}
+                      <span className="text-text-muted"> · {ifc.device}</span>
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3 text-text-secondary">{ifc.ssid || '—'}</td>
+                    <td className="border-b border-border/60 py-2 pr-3 font-mono text-mono-sm text-text-secondary">
+                      {ifc.band ? ifc.band.replace(' GHz', 'G') : '—'}
+                      {ifc.channel ? ` · ch${ifc.channel}` : ''}
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3">
+                      <Flag on={ifc.dot11rEnabled} label={ifc.dot11rEnabled ? (ifc.mobilityDomain || '✓') : '✕'} />
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3">
+                      <Flag on={!!ifc.dot11kEnabled} />
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3">
+                      <Flag on={!!ifc.dot11vEnabled} />
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3">
+                      <Flag on={!!ifc.mfp} />
+                    </td>
+                    <td className="border-b border-border/60 py-2 pr-3 font-mono text-caption text-text-muted">{ifc.mac || '—'}</td>
+                  </tr>
+                ))
+              })}
+            </tbody>
+          </table>
+        </div>
+      </div>
+    </motion.section>
+  )
+}
+
+type StateKind = 'ok' | 'warn' | 'bad'
+
+function StateBadge({ kind, text }: { kind: StateKind; text: string }) {
+  const cls = {
+    ok: 'bg-ok/15 text-ok ring-ok/30',
+    warn: 'bg-warn/15 text-warn ring-warn/30',
+    bad: 'bg-danger/15 text-danger ring-danger/30',
+  }[kind]
+  const Icon = kind === 'ok' ? CheckCircle2 : kind === 'warn' ? AlertTriangle : XCircle
+  return (
+    <span className={cn('inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium ring-1 ring-inset', cls)}>
+      <Icon className="h-4 w-4" strokeWidth={1.75} />
+      {text}
+    </span>
+  )
+}
+
+function StatePill({ kind, text }: { kind: StateKind; text: string }) {
+  const cls = {
+    ok: 'bg-ok/15 text-ok ring-ok/30',
+    warn: 'bg-warn/15 text-warn ring-warn/30',
+    bad: 'bg-danger/15 text-danger ring-danger/30',
+  }[kind]
+  return (
+    <span className={cn('inline-block rounded-md px-2 py-0.5 text-caption font-medium ring-1 ring-inset', cls)}>{text}</span>
+  )
+}
+
+function Flag({ on, label }: { on: boolean; label?: string }) {
+  return (
+    <span
+      className={cn(
+        'inline-block min-w-[2rem] rounded-md px-2 py-0.5 text-center font-mono text-mono-sm ring-1 ring-inset',
+        on ? 'bg-ok/15 text-ok ring-ok/30' : 'bg-elevated text-text-muted ring-border',
+      )}
+    >
+      {label ?? (on ? '✓' : '✕')}
+    </span>
+  )
+}

+ 36 - 8
server-go/internal/adapters/agent.go

@@ -93,6 +93,18 @@ func (r *AgentRegistry) Expired(slug string) bool {
 	return ok && r.now().Sub(st.LastSeen) > r.ttl
 }
 
+// StalePayload devuelve el último payload del slug sin comprobar TTL.
+// Sirve para usar datos stale en routers agent-only (sin SSH).
+func (r *AgentRegistry) StalePayload(slug string) (*probe.Payload, bool) {
+	r.mu.Lock()
+	defer r.mu.Unlock()
+	st, ok := r.states[slug]
+	if !ok || st.Payload == nil {
+		return nil, false
+	}
+	return st.Payload, true
+}
+
 // StaleFor reporta si el slug lleva más de threshold sin empujar datos.
 // Se usa para el Dead Man's Switch (P6): confirmar que un agente está
 // realmente caído antes de disparar la alerta, evitando spam en flapeos.
@@ -224,17 +236,33 @@ func (l *Live) pollRouterAgent(cfg RouterConfig) (bool, *routerPolled) {
 			if !l.agentDown[cfg.ID] {
 				l.agentDown[cfg.ID] = true
 				name := agentName(cfg)
-				l.engine.Emit(AlertEvent{
-					ID:       fmt.Sprintf("alert-agent-down-%s-%d", cfg.ID, time.Now().UnixMilli()),
-					Category: alerts.CatSystem, Urgent: false,
-					Severity:    "warn",
-					Title:       fmt.Sprintf("Agente caído en %s — volviendo a SSH", name),
-					Description: fmt.Sprintf("Sin datos del agente de %s desde hace más de %s — sondeo SSH reanudado", name, confirm),
-					Time:        "ahora mismo", RouterID: cfg.ID,
-				})
+				if cfg.AgentOnly {
+					l.engine.Emit(AlertEvent{
+						ID:       fmt.Sprintf("alert-agent-down-%s-%d", cfg.ID, time.Now().UnixMilli()),
+						Category: alerts.CatSystem, Urgent: false,
+						Severity:    "warn",
+						Title:       fmt.Sprintf("Agente caído en %s", name),
+						Description: fmt.Sprintf("Sin datos del agente de %s desde hace más de %s — usando datos cacheados", name, confirm),
+						Time:        "ahora mismo", RouterID: cfg.ID,
+					})
+				} else {
+					l.engine.Emit(AlertEvent{
+						ID:       fmt.Sprintf("alert-agent-down-%s-%d", cfg.ID, time.Now().UnixMilli()),
+						Category: alerts.CatSystem, Urgent: false,
+						Severity:    "warn",
+						Title:       fmt.Sprintf("Agente caído en %s — volviendo a SSH", name),
+						Description: fmt.Sprintf("Sin datos del agente de %s desde hace más de %s — sondeo SSH reanudado", name, confirm),
+						Time:        "ahora mismo", RouterID: cfg.ID,
+					})
+				}
 			}
 			l.mu.Unlock()
 		}
+		if cfg.AgentOnly {
+			if p, ok := reg.StalePayload(cfg.ID); ok {
+				return true, l.polledFromAgent(cfg, p)
+			}
+		}
 	}
 	return false, nil
 }

+ 2 - 0
server-go/internal/adapters/demo.go

@@ -187,6 +187,8 @@ func (d *Demo) Close() error              { return nil }
 
 func (d *Demo) GetDawn(context.Context) (*Dawn, error) { return nil, nil }
 
+func (d *Demo) GetDot11r(context.Context) (*Dot11rOverview, error) { return nil, nil }
+
 func (d *Demo) GetAdguardClients(context.Context) ([]AdguardClient, error) { return nil, nil }
 
 // GetOverview: overview completo (ts en SEGUNDOS). Paridad demo.js:132-146.

+ 222 - 0
server-go/internal/adapters/dot11r_test.go

@@ -0,0 +1,222 @@
+package adapters
+
+import "testing"
+
+// TestParseUciWirelessFlint2 usa la salida real de `uci show wireless` del
+// Flint2 (gateway de Mandor) como fixture. Cubre:
+//   - 2 wifi-device (radio0 2g/ch1, radio1 5g/ch36) mapeados a channel+band.
+//   - 2 wifi-iface (wifi2g/wifi5g) con el mismo SSID y 802.11r activo.
+//   - campos 802.11k/v/w (todos a 1) + mobility_domain=2025 + ft_over_ds=0.
+//   - rrm_nr_list (campo lista multi-línea) que NO debe romper el parser.
+func TestParseUciWirelessFlint2(t *testing.T) {
+	out := `wireless.radio0=wifi-device
+wireless.radio0.band='2g'
+wireless.radio0.channel='1'
+wireless.radio0.htmode='HE20'
+wireless.radio0.disabled='0'
+wireless.radio0.country='ES'
+wireless.radio0.type='mac80211'
+wireless.radio0.hwmode='11g'
+wireless.wifi2g=wifi-iface
+wireless.wifi2g.device='radio0'
+wireless.wifi2g.network='lan'
+wireless.wifi2g.mode='ap'
+wireless.wifi2g.ssid='temiscira'
+wireless.wifi2g.encryption='psk2'
+wireless.wifi2g.key='secret'
+wireless.wifi2g.wds='1'
+wireless.wifi2g.ieee80211k='1'
+wireless.wifi2g.ieee80211r='1'
+wireless.wifi2g.mobility_domain='2025'
+wireless.wifi2g.ft_over_ds='0'
+wireless.wifi2g.ft_psk_generate_local='1'
+wireless.wifi2g.pmk_r1_push='1'
+wireless.wifi2g.ifname='wlan0'
+wireless.wifi2g.macaddr='1E:C1:05:C9:48:0D'
+wireless.wifi2g.ieee80211v='1'
+wireless.wifi2g.bss_transition='1'
+wireless.wifi2g.ieee80211w='1'
+wireless.wifi2g.rrm_nr_list='8c:de:f9:33:71:58,temiscira,foo' '8c:de:f9:33:71:59,temiscira,bar'
+wireless.radio1=wifi-device
+wireless.radio1.band='5g'
+wireless.radio1.channel='36'
+wireless.radio1.htmode='HE80'
+wireless.radio1.disabled='0'
+wireless.radio1.type='mac80211'
+wireless.wifi5g=wifi-iface
+wireless.wifi5g.device='radio1'
+wireless.wifi5g.network='lan'
+wireless.wifi5g.mode='ap'
+wireless.wifi5g.ssid='temiscira'
+wireless.wifi5g.encryption='psk2'
+wireless.wifi5g.key='secret'
+wireless.wifi5g.ieee80211k='1'
+wireless.wifi5g.ieee80211r='1'
+wireless.wifi5g.mobility_domain='2025'
+wireless.wifi5g.ft_over_ds='0'
+wireless.wifi5g.ft_psk_generate_local='1'
+wireless.wifi5g.ifname='wlan1'
+wireless.wifi5g.macaddr='94:83:c4:ba:bf:ab'
+wireless.wifi5g.ieee80211v='1'
+wireless.wifi5g.bss_transition='1'
+wireless.wifi5g.ieee80211w='1'
+`
+	ifaces := parseUciWireless(out)
+	if len(ifaces) != 2 {
+		t.Fatalf("expected 2 ifaces, got %d", len(ifaces))
+	}
+
+	// wifi2g → radio0 (2g/ch1).
+	if ifaces[0].Section != "wifi2g" {
+		t.Errorf("iface[0].Section = %q, want wifi2g", ifaces[0].Section)
+	}
+	if ifaces[0].Device != "radio0" {
+		t.Errorf("iface[0].Device = %q, want radio0", ifaces[0].Device)
+	}
+	if ifaces[0].Band != "2.4 GHz" {
+		t.Errorf("iface[0].Band = %q, want 2.4 GHz", ifaces[0].Band)
+	}
+	if ifaces[0].Channel != 1 {
+		t.Errorf("iface[0].Channel = %d, want 1", ifaces[0].Channel)
+	}
+	if ifaces[0].SSID != "temiscira" {
+		t.Errorf("iface[0].SSID = %q, want temiscira", ifaces[0].SSID)
+	}
+	if !ifaces[0].Dot11REnabled {
+		t.Errorf("iface[0].Dot11REnabled = false, want true")
+	}
+	if ifaces[0].MobilityDomain != "2025" {
+		t.Errorf("iface[0].MobilityDomain = %q, want 2025", ifaces[0].MobilityDomain)
+	}
+	if ifaces[0].FTOverDS {
+		t.Errorf("iface[0].FTOverDS = true, want false (over-the-air)")
+	}
+	if !ifaces[0].FTPSKGenerateLocal {
+		t.Errorf("iface[0].FTPSKGenerateLocal = false, want true")
+	}
+	if !ifaces[0].Dot11KEnabled || !ifaces[0].Dot11VEnabled || !ifaces[0].BSSTransition || !ifaces[0].MFP {
+		t.Errorf("iface[0] k/v/w flags wrong: k=%v v=%v bss=%v mfp=%v",
+			ifaces[0].Dot11KEnabled, ifaces[0].Dot11VEnabled, ifaces[0].BSSTransition, ifaces[0].MFP)
+	}
+
+	// wifi5g → radio1 (5g/ch36).
+	if ifaces[1].Section != "wifi5g" {
+		t.Errorf("iface[1].Section = %q, want wifi5g", ifaces[1].Section)
+	}
+	if ifaces[1].Band != "5 GHz" {
+		t.Errorf("iface[1].Band = %q, want 5 GHz", ifaces[1].Band)
+	}
+	if ifaces[1].Channel != 36 {
+		t.Errorf("iface[1].Channel = %d, want 36", ifaces[1].Channel)
+	}
+	if !ifaces[1].Dot11REnabled {
+		t.Errorf("iface[1].Dot11REnabled = false, want true")
+	}
+}
+
+// TestParseUciWirelessVacio cubre entradas degeneradas: el parser nunca debe
+// panicar y siempre devuelve un slice (vacío si no hay ifaces).
+func TestParseUciWirelessVacio(t *testing.T) {
+	cases := map[string]string{
+		"empty":         "",
+		"no-wireless":   "unrelated line\nanother\n",
+		"only-devices":  "wireless.radio0=wifi-device\nwireless.radio0.band='2g'\n",
+		"iface-sin-ssid": "wireless.guest=wifi-iface\nwireless.guest.device='radio0'\n",
+	}
+	for name, in := range cases {
+		t.Run(name, func(t *testing.T) {
+			got := parseUciWireless(in)
+			// Salvo "iface-sin-ssid", todos deben devolver 0 ifaces.
+			if name == "iface-sin-ssid" {
+				if len(got) != 1 {
+					t.Fatalf("expected 1 iface (sin ssid), got %d", len(got))
+				}
+				if got[0].SSID != "" {
+					t.Errorf("SSID = %q, want empty", got[0].SSID)
+				}
+				return
+			}
+			if len(got) != 0 {
+				t.Fatalf("expected 0 ifaces for %q, got %d: %+v", name, len(got), got)
+			}
+		})
+	}
+}
+
+// TestParseUciWirelessSin11r verifica que un iface SIN ieee80211r marque
+// Dot11REnabled=false y los campos FT queden en cero.
+func TestParseUciWirelessSin11r(t *testing.T) {
+	out := `wireless.radio0=wifi-device
+wireless.radio0.band='2g'
+wireless.radio0.channel='6'
+wireless.default=wifi-iface
+wireless.default.device='radio0'
+wireless.default.ssid='guest'
+wireless.default.encryption='psk2'
+`
+	ifaces := parseUciWireless(out)
+	if len(ifaces) != 1 {
+		t.Fatalf("expected 1 iface, got %d", len(ifaces))
+	}
+	if ifaces[0].Dot11REnabled {
+		t.Errorf("Dot11REnabled = true, want false")
+	}
+	if ifaces[0].MobilityDomain != "" {
+		t.Errorf("MobilityDomain = %q, want empty", ifaces[0].MobilityDomain)
+	}
+	if ifaces[0].FTOverDS || ifaces[0].FTPSKGenerateLocal {
+		t.Errorf("FT flags set without ieee80211r")
+	}
+}
+
+// TestParseUciWirelessGuestIgualSSID cubre la agregación por SSID en
+// GetDot11r: dos ifaces con el mismo SSID en distintos routers → un único
+// Dot11rSSID con IfaceCount=2. Lo verificamos indirectamente via la lista de
+// ifaces (la agregación vive en Live.GetDot11r que necesita SSH pool mock).
+func TestParseUciWirelessOrdenAparicion(t *testing.T) {
+	out := `wireless.radio0=wifi-device
+wireless.radio0.band='2g'
+wireless.radio0.channel='1'
+wireless.wifi2g=wifi-iface
+wireless.wifi2g.device='radio0'
+wireless.wifi2g.ssid='home'
+wireless.radio1=wifi-device
+wireless.radio1.band='5g'
+wireless.radio1.channel='36'
+wireless.wifi5g=wifi-iface
+wireless.wifi5g.device='radio1'
+wireless.wifi5g.ssid='home'
+wireless.iot=wifi-iface
+wireless.iot.device='radio0'
+wireless.iot.ssid='iot'
+wireless.iot.network='iot'
+`
+	ifaces := parseUciWireless(out)
+	if len(ifaces) != 3 {
+		t.Fatalf("expected 3 ifaces, got %d", len(ifaces))
+	}
+	want := []string{"wifi2g", "wifi5g", "iot"}
+	for i, w := range want {
+		if ifaces[i].Section != w {
+			t.Errorf("iface[%d].Section = %q, want %q (orden de aparición)", i, ifaces[i].Section, w)
+		}
+	}
+}
+
+// TestUnquoteUci cubre los casos de comilla simple y escape \'.
+func TestUnquoteUci(t *testing.T) {
+	cases := map[string]string{
+		`'temiscira'`:    "temiscira",
+		`'it\'s here'`:   "it's here",
+		"plain":          "plain",
+		"":               "",
+		`'2025'`:         "2025",
+		`'multi word'`:   "multi word",
+	}
+	for in, want := range cases {
+		got := unquoteUci(in)
+		if got != want {
+			t.Errorf("unquoteUci(%q) = %q, want %q", in, got, want)
+		}
+	}
+}

+ 233 - 1
server-go/internal/adapters/live.go

@@ -15,6 +15,7 @@ import (
 	"math"
 	"runtime/debug"
 	"sort"
+	"strconv"
 	"strings"
 	"sync"
 	"time"
@@ -222,7 +223,9 @@ func (l *Live) SetRouters(list []RouterConfig) {
 	l.gatewayCfg = pickGateway(l.routers)
 	l.clients = map[string]*OpenWrtClient{}
 	for _, c := range l.routers {
-		l.clients[c.ID] = NewOpenWrtClient(c, l.pool, "root", "")
+		if !c.AgentOnly {
+			l.clients[c.ID] = NewOpenWrtClient(c, l.pool, "root", "")
+		}
 	}
 	ids := map[string]bool{}
 	for _, r := range l.routers {
@@ -668,6 +671,8 @@ func (l *Live) buildRouter(p *routerPolled, history []histPoint) Router {
 	}
 	if isGw {
 		r.Role, r.RoleBadge = "Gateway principal", "Principal"
+	} else if p.cfg.AgentOnly {
+		r.Role, r.RoleBadge = "Switch", "SW"
 	} else {
 		r.Role, r.RoleBadge = "Punto de acceso", "AP"
 	}
@@ -1750,6 +1755,14 @@ func (l *Live) GetDawn(context.Context) (*Dawn, error) {
 		if name == "" {
 			name = cfg.ID
 		}
+		// Los routers agent-only (switches sin SSH, p.ej. switch16) no tienen
+		// DAWN: saltar el SSH evita un timeout de probeTimeout (4s) por cada
+		// llamada a GetDawn. Aparecen en el mesh como Dawn=false para que la
+		// UI siga mostrándolos en la tabla.
+		if cfg.AgentOnly {
+			mesh = append(mesh, DawnMesh{RouterID: cfg.ID, Name: name, Dawn: false, ApsSeen: 0})
+			continue
+		}
 		out, err := l.pool.Run(cfg.Host, "ubus call dawn get_network", 0)
 		if err != nil {
 			mesh = append(mesh, DawnMesh{RouterID: cfg.ID, Name: name, Dawn: false, ApsSeen: 0})
@@ -1842,3 +1855,222 @@ func dawnAPsFromNetwork(firstData map[string]map[string]json.RawMessage) []DawnA
 	})
 	return aps
 }
+
+// ---------------------------------------------------------------------------
+// 802.11r (Fast BSS Transition) — Fase 14.3
+// ---------------------------------------------------------------------------
+
+// parseUciWireless parsea la salida de `uci show wireless` (líneas
+// `wireless.SECTION.FIELD='VALUE'` y `wireless.SECTION=TYPE`) y devuelve los
+// wifi-iface con sus campos relevantes para 802.11r. Ignora wifi-device y
+// cualquier otra sección que no sea wifi-iface (pero usa wifi-device para
+// mapear device → {channel, band}). Función pura — fácil de testear.
+//
+// Formato uci: las comillas simples envuelven los valores; los campos lista
+// (como rrm_nr_list) se emiten como varias líneas con el mismo nombre — aquí
+// nos quedamos con el último valor escalar (no nos interesan las listas).
+func parseUciWireless(out string) []Dot11rIface {
+	type sec struct {
+		typ    string
+		fields map[string]string
+	}
+	sections := map[string]*sec{}
+	order := []string{}
+
+	for _, line := range strings.Split(out, "\n") {
+		line = strings.TrimRight(line, "\r")
+		if !strings.HasPrefix(line, "wireless.") {
+			continue
+		}
+		rest := line[len("wireless."):]
+		// Caso 1: wireless.SECTION=TYPE (declaración de sección, sin punto en SECTION).
+		if eq := strings.IndexByte(rest, '='); eq > 0 {
+			head := rest[:eq]
+			if !strings.Contains(head, ".") {
+				if _, ok := sections[head]; !ok {
+					sections[head] = &sec{fields: map[string]string{}}
+					order = append(order, head)
+				}
+				sections[head].typ = unquoteUci(rest[eq+1:])
+				continue
+			}
+		}
+		// Caso 2: wireless.SECTION.FIELD='VALUE'
+		parts := strings.SplitN(rest, ".", 2)
+		if len(parts) != 2 {
+			continue
+		}
+		section, field := parts[0], parts[1]
+		if _, ok := sections[section]; !ok {
+			sections[section] = &sec{fields: map[string]string{}}
+			order = append(order, section)
+		}
+		if eq := strings.IndexByte(field, '='); eq > 0 {
+			fname := field[:eq]
+			fval := field[eq+1:]
+			sections[section].fields[fname] = unquoteUci(fval)
+		}
+	}
+
+	// device → {channel, band} desde las secciones wifi-device.
+	type devInfo struct {
+		channel int
+		band    string
+	}
+	devMap := map[string]devInfo{}
+	for _, name := range order {
+		s := sections[name]
+		if s.typ != "wifi-device" {
+			continue
+		}
+		ch, _ := strconv.Atoi(s.fields["channel"])
+		band := ""
+		switch s.fields["band"] {
+		case "2g":
+			band = "2.4 GHz"
+		case "5g":
+			band = "5 GHz"
+		case "6g":
+			band = "6 GHz"
+		case "60g":
+			band = "60 GHz"
+		}
+		devMap[name] = devInfo{channel: ch, band: band}
+	}
+
+	ifaces := []Dot11rIface{}
+	for _, name := range order {
+		s := sections[name]
+		if s.typ != "wifi-iface" {
+			continue
+		}
+		f := s.fields
+		dev := f["device"]
+		di := devMap[dev]
+		ifaces = append(ifaces, Dot11rIface{
+			Section:            name,
+			Device:             dev,
+			Ifname:             f["ifname"],
+			SSID:               f["ssid"],
+			MAC:                f["macaddr"],
+			Channel:            di.channel,
+			Band:               di.band,
+			Encryption:         f["encryption"],
+			Dot11REnabled:      f["ieee80211r"] == "1",
+			MobilityDomain:     f["mobility_domain"],
+			FTOverDS:           f["ft_over_ds"] == "1",
+			FTPSKGenerateLocal: f["ft_psk_generate_local"] == "1",
+			PMKR1Push:          f["pmk_r1_push"] == "1",
+			NASID:              f["nasid"],
+			Dot11KEnabled:      f["ieee80211k"] == "1",
+			Dot11VEnabled:      f["ieee80211v"] == "1",
+			BSSTransition:      f["bss_transition"] == "1",
+			MFP:                f["ieee80211w"] == "1",
+		})
+	}
+	return ifaces
+}
+
+// unquoteUci quita las comillas simples que uci envuelve a los valores y
+// desescapa \' → '. `uci show` SIEMPRE envuelve en comillas simples.
+func unquoteUci(s string) string {
+	if len(s) >= 2 && s[0] == '\'' && s[len(s)-1] == '\'' {
+		return strings.ReplaceAll(s[1:len(s)-1], `\'`, `'`)
+	}
+	return s
+}
+
+// GetDot11r: estado 802.11r (Fast BSS Transition) por router y SSID. Recorre
+// los routers (saltando agent-only, que son switches sin wifi) y hace SSH
+// `uci show wireless` a cada uno. Devuelve (nil, nil) si ningún router con
+// wifi tiene 802.11r habilitado → el handler responde 503.
+func (l *Live) GetDot11r(ctx context.Context) (*Dot11rOverview, error) {
+	l.mu.Lock()
+	routers := append([]RouterConfig(nil), l.routers...)
+	l.mu.Unlock()
+
+	out := Dot11rOverview{Routers: []Dot11rRouter{}, SSIDs: []Dot11rSSID{}}
+	type ifaceRef struct {
+		routerID string
+		iface    Dot11rIface
+	}
+	ssidIfaces := map[string][]ifaceRef{}
+
+	for _, cfg := range routers {
+		name := cfg.Name
+		if name == "" {
+			name = cfg.ID
+		}
+		r := Dot11rRouter{RouterID: cfg.ID, Name: name, Ifaces: []Dot11rIface{}}
+		// Agent-only (switches sin SSH ni wifi) se listan como Available=false.
+		if cfg.AgentOnly {
+			out.Routers = append(out.Routers, r)
+			continue
+		}
+		uciOut, err := l.pool.Run(cfg.Host, "uci show wireless", 0)
+		if err != nil {
+			out.Routers = append(out.Routers, r)
+			continue
+		}
+		ifaces := parseUciWireless(uciOut)
+		r.Available = true
+		r.Ifaces = ifaces
+		out.Routers = append(out.Routers, r)
+		for _, ifc := range ifaces {
+			if ifc.SSID == "" {
+				continue
+			}
+			ssidIfaces[ifc.SSID] = append(ssidIfaces[ifc.SSID], ifaceRef{routerID: cfg.ID, iface: ifc})
+		}
+	}
+
+	// Agregar por SSID.
+	ssids := make([]Dot11rSSID, 0, len(ssidIfaces))
+	for ssid, refs := range ssidIfaces {
+		enabled := 0
+		mobilityDomain := ""
+		ftOverDS := false
+		ftPSK := false
+		routerSet := map[string]bool{}
+		for _, ref := range refs {
+			if ref.iface.Dot11REnabled {
+				enabled++
+				if mobilityDomain == "" {
+					mobilityDomain = ref.iface.MobilityDomain
+					ftOverDS = ref.iface.FTOverDS
+					ftPSK = ref.iface.FTPSKGenerateLocal
+				}
+			}
+			routerSet[ref.routerID] = true
+		}
+		routerIDs := make([]string, 0, len(routerSet))
+		for id := range routerSet {
+			routerIDs = append(routerIDs, id)
+		}
+		sort.Strings(routerIDs)
+		ssids = append(ssids, Dot11rSSID{
+			SSID:               ssid,
+			EnabledEverywhere:  enabled > 0 && enabled == len(refs),
+			EnabledCount:       enabled,
+			TotalCount:         len(refs),
+			MobilityDomain:     mobilityDomain,
+			FTOverDS:           ftOverDS,
+			FTPSKGenerateLocal: ftPSK,
+			IfaceCount:         len(refs),
+			RouterIDs:          routerIDs,
+		})
+	}
+	sort.Slice(ssids, func(i, j int) bool { return ssids[i].SSID < ssids[j].SSID })
+	out.SSIDs = ssids
+
+	for _, s := range ssids {
+		if s.EnabledCount > 0 {
+			out.Available = true
+			break
+		}
+	}
+	if !out.Available {
+		return nil, nil
+	}
+	return &out, nil
+}

+ 1 - 1
server-go/internal/adapters/topology.go

@@ -209,7 +209,7 @@ func inferTopology(polled map[string]*routerPolled, devices []Device) ([]Device,
 				}
 				continue
 			}
-			if routerID != gatewayID {
+			if routerID != gatewayID && !polled[routerID].cfg.AgentOnly {
 				// AP con puerto multi-MAC sin evidencia de hipervisor: es casi
 				// seguro su uplink (aprende las MACs de toda la LAN). No se
 				// afirma switch local ni se anota puerto: los clientes quedan

+ 74 - 1
server-go/internal/adapters/types.go

@@ -422,6 +422,74 @@ type Dawn struct {
 	Mesh []DawnMesh `json:"mesh"`
 }
 
+// ---------------------------------------------------------------------------
+// 802.11r (Fast BSS Transition) — Fase 14.3
+// ---------------------------------------------------------------------------
+
+// Dot11rIface es una sección wifi-iface de `uci show wireless` con los campos
+// relevantes para 802.11r (FT) y sus estándares compañeros (k/v/w) que together
+// habilitan el roaming suave en una malla DAWN/hostapd.
+type Dot11rIface struct {
+	Section string `json:"section"` // uci section name (wifi2g, wifi5g, guest, ...)
+	Device  string `json:"device"`  // radio0, radio1
+	Ifname  string `json:"ifname"`  // wlan0, wlan1 (puede estar vacío en configs muy nuevas)
+	SSID    string `json:"ssid"`
+	MAC     string `json:"mac"`               // macaddr (BSSID del BSS)
+	Channel int   `json:"channel,omitempty"` // mapeado desde radio.channel
+	Band    string `json:"band,omitempty"`   // "2.4 GHz"|"5 GHz" desde radio.band
+
+	Encryption string `json:"encryption,omitempty"` // psk2/sae/psk2-mixed...
+
+	// 802.11r (Fast BSS Transition)
+	Dot11REnabled      bool   `json:"dot11rEnabled"`
+	MobilityDomain     string `json:"mobilityDomain,omitempty"` // 4 hex
+	FTOverDS           bool   `json:"ftOverDs"`                 // true=over-the-ds, false=over-the-air
+	FTPSKGenerateLocal bool   `json:"ftPskGenerateLocal"`       // true=local PSK, false=RADIUS externo
+	PMKR1Push          bool   `json:"pmkR1Push,omitempty"`      // push PMK R1 a otros APs
+	NASID              string `json:"nasid,omitempty"`          // solo configs con RADIUS externo
+
+	// 802.11k (Radio Resource Measurement) — vecino de 802.11r para que el
+	// cliente sepa a qué AP saltar (beacon report, neighbor report).
+	Dot11KEnabled bool `json:"dot11kEnabled,omitempty"`
+	// 802.11v (BSS Transition Management) — el AP sugiere al cliente saltar.
+	Dot11VEnabled bool `json:"dot11vEnabled,omitempty"`
+	BSSTransition bool `json:"bssTransition,omitempty"`
+	// 802.11w (Management Frame Protection / PMF) — required por WPA3.
+	MFP bool `json:"mfp,omitempty"`
+}
+
+// Dot11rRouter es el estado 802.11r de un router: lista de ifaces wifi-iface
+// parseadas de su `uci show wireless`. Available=false si SSH falló.
+type Dot11rRouter struct {
+	RouterID  string         `json:"routerId"`
+	Name      string         `json:"name"`
+	Available bool           `json:"available"`
+	Ifaces    []Dot11rIface `json:"ifaces"`
+}
+
+// Dot11rSSID agrega el estado 802.11r por SSID. Lo construye el servidor a
+// partir de los ifaces de todos los routers: EnabledEverywhere=true solo si
+// TODOS los ifaces con ese SSID tienen ieee80211r=1.
+type Dot11rSSID struct {
+	SSID               string   `json:"ssid"`
+	EnabledEverywhere  bool     `json:"enabledEverywhere"`
+	EnabledCount       int      `json:"enabledCount"`
+	TotalCount         int      `json:"totalCount"`
+	MobilityDomain     string   `json:"mobilityDomain,omitempty"`
+	FTOverDS           bool     `json:"ftOverDs"`
+	FTPSKGenerateLocal bool     `json:"ftPskGenerateLocal"`
+	IfaceCount         int      `json:"ifaceCount"`
+	RouterIDs          []string `json:"routerIds"`
+}
+
+// Dot11rOverview es la respuesta de GET /api/dot11r. Available=false si ningún
+// router tiene 802.11r (el handler devuelve 503 en ese caso, igual que /dawn).
+type Dot11rOverview struct {
+	Available bool           `json:"available"`
+	SSIDs     []Dot11rSSID   `json:"ssids"`
+	Routers   []Dot11rRouter `json:"routers"`
+}
+
 // AdguardClient es un cliente configurado en AdGuard GL.iNet (§2.13).
 type AdguardClient struct {
 	Name              string `json:"name"`
@@ -454,6 +522,7 @@ type RouterConfig struct {
 	Host      string `json:"host"`
 	Type      string `json:"type"` // "glinet"|"openwrt"
 	IsGateway bool   `json:"is_gateway"`
+	AgentOnly bool   `json:"agent_only"`
 	CreatedAt int64  `json:"created_at"` // epoch ms
 }
 
@@ -463,12 +532,13 @@ type RouterConfig struct {
 
 // Snapshotter es el contrato del adapter de datos (paridad con la interfaz JS
 // de SPEC §7: mode/tick/setRouters/getOverview/getRouters/getRouterDetail/
-// getDevices/getAlerts/getMetricsRows/getDawn/getAdguardClients/close;
+// getDevices/getAlerts/getMetricsRows/getDawn/getDot11r/getAdguardClients/close;
 // getAdguardRow() está muerto en Node y NO se porta).
 //
 // Convenciones de retorno (consumidas por internal/httpapi):
 //   - GetRouterDetail: (nil, nil) → 404 {"error":"not_found"}.
 //   - GetDawn: (nil, nil) → 503 {"error":"unavailable"}.
+//   - GetDot11r: (nil, nil) → 503 {"error":"unavailable"}.
 //   - GetAdguardClients: (nil, nil) → 404 {"error":"not_configured"};
 //     (x, err) → 502 {"error":"adguard_error","message":err}.
 //   - GetOverview nunca devuelve nil sin error; el handler lo serializa tal
@@ -501,6 +571,9 @@ type Snapshotter interface {
 	GetMetricsRows(ctx context.Context) []MetricsRow
 	// GetDawn devuelve la malla DAWN o (nil, nil) si no hay DAWN.
 	GetDawn(ctx context.Context) (*Dawn, error)
+	// GetDot11r devuelve el estado 802.11r (FT) por router y SSID, o
+	// (nil, nil) si ningún router lo soporta → el handler responde 503.
+	GetDot11r(ctx context.Context) (*Dot11rOverview, error)
 	// GetAdguardClients devuelve los clientes AdGuard, (nil, nil) si no hay
 	// cliente configurado o no soporta queryClients, o error → 502.
 	GetAdguardClients(ctx context.Context) ([]AdguardClient, error)

+ 1 - 0
server-go/internal/db/db.go

@@ -252,6 +252,7 @@ func Open(dataDir string, opts ...OpenOption) (*DB, error) {
 	migrate(sqldb, "users", "language", "ALTER TABLE users ADD COLUMN language TEXT DEFAULT 'auto'")
 	// SPEC-65 D65-5: nombre visible por usuario ("" = usar el username).
 	migrate(sqldb, "users", "display_name", "ALTER TABLE users ADD COLUMN display_name TEXT DEFAULT ''")
+	migrate(sqldb, "routers", "agent_only", "ALTER TABLE routers ADD COLUMN agent_only INTEGER NOT NULL DEFAULT 0")
 
 	// Si no hubo migración Node (instalación fresca creada por Go), marca la
 	// DB para que el siguiente arranque no dispare una "migración" espuria

+ 6 - 5
server-go/internal/httpapi/config.go

@@ -62,10 +62,11 @@ func (s *server) handleListConfigRouters(w http.ResponseWriter, r *http.Request)
 }
 
 type routerInput struct {
-	Name    *string `json:"name"`
-	Host    *string `json:"host"`
-	Type    string  `json:"type"`
-	Gateway bool    `json:"gateway"`
+	Name      *string `json:"name"`
+	Host      *string `json:"host"`
+	Type      string  `json:"type"`
+	Gateway   bool    `json:"gateway"`
+	AgentOnly bool    `json:"agent_only"`
 }
 
 // validateHost replica hostSchema (trim, 1..253, regex). Devuelve el valor
@@ -128,7 +129,7 @@ func (s *server) handleAddConfigRouter(w http.ResponseWriter, r *http.Request) {
 		}
 	}
 	created, err := routerstore.AddRouter(s.db.DB, routerstore.AddInput{
-		Name: name, Host: host, Type: typ, IsGateway: in.Gateway,
+		Name: name, Host: host, Type: typ, IsGateway: in.Gateway, AgentOnly: in.AgentOnly,
 	})
 	if err != nil {
 		writeError(w, http.StatusInternalServerError, "internal_error")

+ 14 - 0
server-go/internal/httpapi/data.go

@@ -303,6 +303,20 @@ func (s *server) handleDawn(w http.ResponseWriter, r *http.Request) {
 	writeJSON(w, http.StatusOK, dawn)
 }
 
+// handleDot11r: 503 {error:'unavailable'} si ningún router tiene 802.11r.
+func (s *server) handleDot11r(w http.ResponseWriter, r *http.Request) {
+	dot11r, err := s.adapter.GetDot11r(r.Context())
+	if err != nil {
+		writeError(w, http.StatusInternalServerError, "internal_error")
+		return
+	}
+	if dot11r == nil {
+		writeError(w, http.StatusServiceUnavailable, "unavailable")
+		return
+	}
+	writeJSON(w, http.StatusOK, dot11r)
+}
+
 // handleAdguardClients: 404 not_configured · 502 adguard_error.
 func (s *server) handleAdguardClients(w http.ResponseWriter, r *http.Request) {
 	clients, err := s.adapter.GetAdguardClients(r.Context())

+ 1 - 0
server-go/internal/httpapi/server.go

@@ -160,6 +160,7 @@ func NewHandler(d Deps) http.Handler {
 	mux.HandleFunc("POST /api/alerts/read-all", s.handleAlertsReadAll)
 	mux.HandleFunc("GET /api/topology", s.handleTopology)
 	mux.HandleFunc("GET /api/dawn", s.handleDawn)
+	mux.HandleFunc("GET /api/dot11r", s.handleDot11r)
 	mux.HandleFunc("GET /api/adguard/clients", s.handleAdguardClients)
 	mux.HandleFunc("GET /api/system/info", s.handleSystemInfo)
 	mux.HandleFunc("GET /api/reports/weekly", s.handleWeeklyReport)

+ 11 - 5
server-go/internal/routerstore/routerstore.go

@@ -27,7 +27,7 @@ const probeTimeout = 4 * time.Second
 // ListRouters devuelve la tabla routers ordenada is_gateway DESC,
 // created_at ASC, con is_gateway como booleano.
 func ListRouters(db *sql.DB) []adapters.RouterConfig {
-	rows, err := db.Query("SELECT id, name, host, type, is_gateway, created_at FROM routers ORDER BY is_gateway DESC, created_at ASC")
+	rows, err := db.Query("SELECT id, name, host, type, is_gateway, agent_only, created_at FROM routers ORDER BY is_gateway DESC, created_at ASC")
 	if err != nil {
 		return []adapters.RouterConfig{}
 	}
@@ -35,13 +35,14 @@ func ListRouters(db *sql.DB) []adapters.RouterConfig {
 	out := []adapters.RouterConfig{}
 	for rows.Next() {
 		var r adapters.RouterConfig
-		var gw int
+		var gw, ao int
 		var name sql.NullString
-		if err := rows.Scan(&r.ID, &name, &r.Host, &r.Type, &gw, &r.CreatedAt); err != nil {
+		if err := rows.Scan(&r.ID, &name, &r.Host, &r.Type, &gw, &ao, &r.CreatedAt); err != nil {
 			continue
 		}
 		r.Name = name.String
 		r.IsGateway = gw == 1
+		r.AgentOnly = ao == 1
 		out = append(out, r)
 	}
 	return out
@@ -117,6 +118,7 @@ type AddInput struct {
 	Host      string
 	Type      string // default "openwrt"
 	IsGateway bool
+	AgentOnly bool
 }
 
 // AddRouter inserta un router (si IsGateway, el resto pierde el flag —
@@ -145,9 +147,13 @@ func AddRouter(db *sql.DB, in AddInput) (adapters.RouterConfig, error) {
 	if in.IsGateway {
 		gw = 1
 	}
+	ao := 0
+	if in.AgentOnly {
+		ao = 1
+	}
 	if _, err := tx.Exec(
-		"INSERT INTO routers (id, name, host, type, is_gateway, created_at) VALUES (?, ?, ?, ?, ?, ?)",
-		id, name, in.Host, in.Type, gw, now,
+		"INSERT INTO routers (id, name, host, type, is_gateway, agent_only, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)",
+		id, name, in.Host, in.Type, gw, ao, now,
 	); err != nil {
 		return adapters.RouterConfig{}, err
 	}