فهرست منبع

fix: roaming connect events, port overflow, topology matching, fleet edit card (#1043)

* fix(roaming): parse hostapd IEEE 802.11 (dis)associated lines (#1038)

wpad-mbedtls (OpenWrt 25.12.x) logs 'STA <mac> IEEE 802.11: associated
(aid N)' and 'disassociated [due to inactivity]' instead of
AP-STA-CONNECTED/DISCONNECTED, so the logread grep never matched and
Connect events never reached the roaming feed. Add the format to the
grep and the parser, with tests from the reported log samples.

* fix(router-detail): port selector dropdown when many ports (#1035)

The Traffic history card overflowed with 5+ ports, same pattern as #929.
Keep the button row up to 4 ports; above that switch to a Select
dropdown, and with 8+ ports add an All/Active/Inactive segmented filter
that narrows the dropdown options and re-anchors the selection if the
active port falls outside the filter.

* fix(router-detail): stop leaking hardcoded Spanish port aggregation label (#1036)

The server formatted "N dispositivos" / "agregación" inline for ports
with more than 3 MACs behind them, so non-Spanish UIs saw Spanish text.
Send deviceCount in the port contract and translate in the client via
portPeerLabel/portPeerDetail.

* feat(snmp): read switch bridge MAC for topology matching (#1036)

SNMP-polled switches had no MAC at all: the poller only walked the FDB
and interface tables, so fleet detail showed nothing and topology could
not match the unit by MAC. Read dot1dBaseBridgeAddress per poll, cache
the last value per router, and feed it into routerPolled.brMac so the
existing MAC-based paths (fleet detail, topology, uplink exclusion)
consume it transparently. The OID is optional: a switch that does not
answer keeps its last known MAC.

* fix(topology): deterministic port peer selection (#1036)

portMacs is built by iterating the FDB map, so the MAC order behind a
port changed on every tick. With 2-3 MACs the "first with a DHCP
hostname" heuristic picked a different device each cycle and the port
label in Device detail flipped between neighbors (e.g. ap1/ap2). Sort
the slice once per port so the selection is stable across polls.

* fix(settings): fleet edit card - accidental submit, field labels and hints

- SegmentedControl buttons had no type="button", so picking a device
  type inside the edit form submitted it and closed the dialog.
- Edit dialog host/name inputs now have visible labels; the name label
  carries an InfoTip explaining it overrides discovered names.
- Firmware target field moved under the type selector and only shown
  for openwrt/glinet units.
- InfoTips on the agent-only and SNMP polling toggles explaining that
  no SSH is attempted.
- Add form can now configure SNMP (community/port/interval) when the
  unit type is managed-switch or external.

Refs #1026

* fix(server): skip SSH feature probes on SNMP-polled units

GetUsteer, GetDot11r and GetSurvey skipped agent-only routers but still
opened SSH connections to SNMP-polled units, which have no SSH at all,
generating connection backoff noise. Extend the guards with
cfg.SnmpEnabled; the units are listed as unavailable, same as
agent-only. Adds tests using a nil SSH pool as tripwire.

Refs #1026
Nacho 2 ماه پیش
والد
کامیت
0d1ae2eb59

+ 10 - 1
app/public/locales/en/translation.json

@@ -852,7 +852,13 @@
       "seriesTitle": "Traffic history",
       "seriesRx": "Receive",
       "seriesTx": "Transmit",
-      "seriesNoData": "No historical data"
+      "seriesNoData": "No historical data",
+      "seriesPort": "Port",
+      "filterAll": "All",
+      "filterActive": "Active",
+      "filterInactive": "Inactive",
+      "aggregation": "{{count}} devices",
+      "aggregationHint": "aggregation · hypervisor or switch?"
     },
     "radios": {
       "channel": "Channel",
@@ -1414,6 +1420,7 @@
       "empty": "No routers configured yet. The gateway is auto-detected when the server boots; if it's missing, add it here.",
       "host": "IP or hostname",
       "name": "Name (optional)",
+      "nameOverrideHint": "Optional. Overrides the names discovered from DHCP, SNMP and other sources everywhere in the app.",
       "role": "Role",
       "actions": "Actions",
       "regenerateToken": "Regenerate token",
@@ -1448,6 +1455,7 @@
       "copied": "Copied",
       "copyFailed": "Copy failed; select the key manually",
       "agentOnly": "Agent only (no SSH)",
+      "agentOnlyHint": "Data arrives only from the NetPulse/NetGrip agent push. The server never uses SSH on this unit.",
       "agentOnlyBadge": "Agent only",
       "edit": "Edit",
       "editTitle": "Edit {{id}}",
@@ -1465,6 +1473,7 @@
       "firmwareTargetPlaceholder": "e.g. 25.12.5",
       "firmwareTargetHint": "Optional. If the installed firmware doesn't match this version, NetPulse alerts.",
       "snmpEnabled": "SNMP polling",
+      "snmpEnabledHint": "SNMP polling replaces SSH: no SSH connection is attempted on this unit.",
       "snmpCommunity": "Community (SNMPv2c)",
       "snmpPort": "Port",
       "snmpPollInterval": "Interval (s)",

+ 10 - 1
app/public/locales/es/translation.json

@@ -852,7 +852,13 @@
       "seriesTitle": "Historial de tráfico",
       "seriesRx": "Recepción",
       "seriesTx": "Envío",
-      "seriesNoData": "Sin datos históricos"
+      "seriesNoData": "Sin datos históricos",
+      "seriesPort": "Puerto",
+      "filterAll": "Todos",
+      "filterActive": "Activos",
+      "filterInactive": "Inactivos",
+      "aggregation": "{{count}} dispositivos",
+      "aggregationHint": "agregación · ¿hipervisor o switch?"
     },
     "radios": {
       "channel": "Canal",
@@ -1414,6 +1420,7 @@
       "empty": "Sin routers configurados todavía. La puerta de enlace se autodetecta al arrancar el servidor; si no aparece, añádela aquí.",
       "host": "IP o hostname",
       "name": "Nombre (opcional)",
+      "nameOverrideHint": "Opcional. Sustituye en toda la app a los nombres descubiertos por DHCP, SNMP y otras fuentes.",
       "role": "Rol",
       "actions": "Acciones",
       "regenerateToken": "Regenerar token",
@@ -1448,6 +1455,7 @@
       "copied": "Copiada",
       "copyFailed": "No se pudo copiar; selecciona la clave a mano",
       "agentOnly": "Solo agente (sin SSH)",
+      "agentOnlyHint": "Los datos llegan solo del push del agente NetPulse/NetGrip. El servidor nunca usa SSH en esta unidad.",
       "agentOnlyBadge": "Solo agente",
       "edit": "Editar",
       "editTitle": "Editar {{id}}",
@@ -1465,6 +1473,7 @@
       "firmwareTargetPlaceholder": "p. ej. 25.12.5",
       "firmwareTargetHint": "Opcional. Si el firmware instalado no coincide con esta versión, NetPulse lo avisa.",
       "snmpEnabled": "Sondeo SNMP",
+      "snmpEnabledHint": "El sondeo SNMP sustituye a SSH: no se intenta ninguna conexión SSH con esta unidad.",
       "snmpCommunity": "Comunidad (SNMPv2c)",
       "snmpPort": "Puerto",
       "snmpPollInterval": "Intervalo (s)",

+ 1 - 0
app/src/components/SegmentedControl.tsx

@@ -32,6 +32,7 @@ export function SegmentedControl<T extends string>({
         return (
           <button
             key={opt.value}
+            type="button"
             role="tab"
             aria-selected={active}
             onClick={() => onChange(opt.value)}

+ 35 - 26
app/src/components/routers/PortPanel.tsx

@@ -4,7 +4,7 @@ import { Link } from 'react-router'
 import type { Router } from '@/data/mock'
 import type { WanInfo } from '@/data/types'
 import { SectionHeader } from '@/components/SectionHeader'
-import { getRouterExtras } from '@/components/routers/routerExtras'
+import { getRouterExtras, portPeerDetail, portPeerLabel } from '@/components/routers/routerExtras'
 import type { EthPort, RouterExtras, SfpInfo } from '@/components/routers/routerExtras'
 import { EMPTY_EXTRAS, useNetPulse } from '@/data/DataProvider'
 import { Activity } from 'lucide-react'
@@ -34,7 +34,7 @@ function Jack({ port, index, wan }: { port: EthPort; index: number; wan?: WanInf
   const isWan = port.id === 'wan'
 
   const aria = port.up
-    ? t('routerDetail.ports.ariaUsed', { label: port.label, connectedTo: port.connectedTo ?? t('routerDetail.ports.unknownDevice'), speed: port.speed ? `, ${port.speed}` : '' })
+    ? t('routerDetail.ports.ariaUsed', { label: port.label, connectedTo: portPeerLabel(port) || t('routerDetail.ports.unknownDevice'), speed: port.speed ? `, ${port.speed}` : '' })
     : t('routerDetail.ports.ariaFree', { label: port.label })
 
   const hasWanInfo = isWan && wan && (wan.proto || wan.publicIp || wan.gateway || (wan.dns?.length ?? 0) > 0)
@@ -112,21 +112,24 @@ function Jack({ port, index, wan }: { port: EthPort; index: number; wan?: WanInf
             {port.up ? (
               <>
                 <div className="mt-0.5 w-full truncate text-caption font-medium text-text-primary">
-                  {port.connectedTo && port.connectedTo === port.label ? (
-                    <span className="font-mono text-[10px] text-text-muted">{port.deviceMac ?? ''}</span>
-                  ) : port.connectedTo && port.deviceMac ? (
-                    <Link
-                      to={`/devices?q=${encodeURIComponent(port.deviceMac)}`}
-                      className="transition-colors hover:text-accent hover:underline"
-                      onClick={(e) => e.stopPropagation()}
-                    >
-                      {port.connectedTo}
-                    </Link>
-                  ) : port.connectedTo ? (
-                    port.connectedTo
-                  ) : (
-                    t('routerDetail.ports.inUse')
-                  )}
+                  {(() => {
+                    const peer = portPeerLabel(port)
+                    return peer && peer === port.label ? (
+                      <span className="font-mono text-[10px] text-text-muted">{port.deviceMac ?? ''}</span>
+                    ) : peer && port.deviceMac ? (
+                      <Link
+                        to={`/devices?q=${encodeURIComponent(port.deviceMac)}`}
+                        className="transition-colors hover:text-accent hover:underline"
+                        onClick={(e) => e.stopPropagation()}
+                      >
+                        {peer}
+                      </Link>
+                    ) : peer ? (
+                      peer
+                    ) : (
+                      t('routerDetail.ports.inUse')
+                    )
+                  })()}
                 </div>
                 {port.speed && <div className="font-mono text-[10px] text-text-muted">{port.speed}</div>}
                 {(port.rxBps !== undefined || port.txBps !== undefined) && (
@@ -163,16 +166,22 @@ function Jack({ port, index, wan }: { port: EthPort; index: number; wan?: WanInf
             {isWan && hasWanInfo ? (
               /* Boca WAN: conexión a Internet */
               <div className="mt-1 text-caption leading-snug text-text-secondary">
-                {port.connectedTo && <div>{port.connectedTo}</div>}
+                {(() => {
+                  const peer = portPeerLabel(port)
+                  return peer ? <div>{peer}</div> : null
+                })()}
                 {wan!.proto && <div className="mt-0.5 font-mono text-caption text-accent">{wan!.proto.toUpperCase()}</div>}
               </div>
             ) : (
               /* Boca LAN: dispositivo conectado */
-              port.connectedTo && (
-                <div className="mt-1 text-caption font-medium text-text-primary">
-                  {port.connectedTo}
-                </div>
-              )
+              (() => {
+                const peer = portPeerLabel(port)
+                return peer ? (
+                  <div className="mt-1 text-caption font-medium text-text-primary">
+                    {peer}
+                  </div>
+                ) : null
+              })()
             )}
 
             {isWan && hasWanInfo && wan ? (
@@ -186,10 +195,10 @@ function Jack({ port, index, wan }: { port: EthPort; index: number; wan?: WanInf
                 )}
               </div>
             ) : (
-              port.deviceMac && (
+              (port.deviceMac || port.deviceCount) && (
                 <div className="mt-2 grid grid-cols-2 gap-1.5">
-                  <MiniStat label="MAC" value={port.deviceMac} />
-                  {port.detail && <MiniStat label={t('routerDetail.ports.deviceDetail')} value={port.detail} />}
+                  {port.deviceMac && <MiniStat label="MAC" value={port.deviceMac} />}
+                  {(port.detail || port.deviceCount) && <MiniStat label={t('routerDetail.ports.deviceDetail')} value={portPeerDetail(port)} />}
                   {(port.rxBps !== undefined || port.txBps !== undefined) && (
                     <div className="col-span-2">
                       <MiniStat

+ 105 - 28
app/src/components/routers/PortSeriesChart.tsx

@@ -3,6 +3,8 @@ import { useTranslation } from 'react-i18next'
 import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis } from 'recharts'
 import { SectionHeader } from '@/components/SectionHeader'
 import type { EthPort } from '@/components/routers/routerExtras'
+import { portPeerLabel } from '@/components/routers/routerExtras'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
 import { cn } from '@/lib/utils'
 
 interface PortPoint {
@@ -28,6 +30,18 @@ export type TrafficUnit = 'bps' | 'fps'
 
 const RANGES: Range[] = ['24h', '7d', '30d']
 
+// #1035: con más de 4 bocas la fila de botones desborda la tarjeta; con 8 o
+// más además ofrecemos el filtro All/Active/Inactive para acotar el dropdown.
+const PORT_BUTTON_MAX = 4
+const PORT_FILTER_MIN = 8
+type PortFilter = 'all' | 'active' | 'inactive'
+const PORT_FILTERS: PortFilter[] = ['all', 'active', 'inactive']
+const PORT_FILTER_LABEL: Record<PortFilter, string> = {
+  all: 'routerDetail.ports.filterAll',
+  active: 'routerDetail.ports.filterActive',
+  inactive: 'routerDetail.ports.filterInactive',
+}
+
 function rangeToSeconds(range: Range): number {
   switch (range) {
     case '24h': return 24 * 3600
@@ -127,6 +141,7 @@ export function PortSeriesChart({
   const { t } = useTranslation()
   const [range, setRange] = useState<Range>('24h')
   const [portId, setPortId] = useState<string | null>(null)
+  const [portFilter, setPortFilter] = useState<PortFilter>('all')
   const [data, setData] = useState<PortPoint[]>([])
   const [loading, setLoading] = useState(false)
 
@@ -143,6 +158,23 @@ export function PortSeriesChart({
     })
   }, [ports])
 
+  // Opciones visibles según el filtro All/Active/Inactive (#1035).
+  const visiblePorts = useMemo(() => {
+    if (portFilter === 'active') return ports.filter((p) => p.up)
+    if (portFilter === 'inactive') return ports.filter((p) => !p.up)
+    return ports
+  }, [ports, portFilter])
+
+  // Si el filtro excluye el puerto activo, recoloca la selección dentro del
+  // subconjunto visible (si el subconjunto queda vacío, sobre toda la flota).
+  useEffect(() => {
+    if (ports.length === 0) return
+    setPortId((prev) => {
+      if (prev && visiblePorts.some((p) => p.id === prev)) return prev
+      return (visiblePorts[0] ?? ports[0])!.id
+    })
+  }, [visiblePorts, ports])
+
   const fetchData = useCallback(async () => {
     if (!portId) return
     setLoading(true)
@@ -190,26 +222,66 @@ export function PortSeriesChart({
       <div className="flex flex-wrap items-start justify-between gap-3">
         <SectionHeader title={t('routerDetail.ports.seriesTitle')} />
         <div className="flex flex-wrap items-center gap-2">
-          {/* Selector de puerto */}
-          <div className="flex max-w-full items-center gap-1 overflow-x-auto rounded-lg border border-border bg-elevated p-0.5">
-            {ports.map((p) => (
-              <button
-                key={p.id}
-                type="button"
-                onClick={() => setPortId(p.id)}
-                title={p.connectedTo ? `${p.label} · ${p.connectedTo}` : p.label}
-                className={cn(
-                  'shrink-0 rounded-md px-2 py-0.5 font-mono text-[10px] font-medium transition-colors',
-                  portId === p.id
-                    ? 'bg-accent/15 text-accent'
-                    : 'text-text-muted hover:bg-canvas hover:text-text-secondary',
-                  !p.up && portId !== p.id && 'opacity-50',
-                )}
-              >
-                {p.label.replace(/\s+/g, '')}
-              </button>
-            ))}
-          </div>
+          {/* Selector de puerto: fila de botones hasta 4 bocas (#1035) */}
+          {ports.length <= PORT_BUTTON_MAX ? (
+            <div className="flex max-w-full items-center gap-1 overflow-x-auto rounded-lg border border-border bg-elevated p-0.5">
+              {ports.map((p) => (
+                <button
+                  key={p.id}
+                  type="button"
+                  onClick={() => setPortId(p.id)}
+                  title={(() => { const peer = portPeerLabel(p); return peer ? `${p.label} · ${peer}` : p.label })()}
+                  className={cn(
+                    'shrink-0 rounded-md px-2 py-0.5 font-mono text-[10px] font-medium transition-colors',
+                    portId === p.id
+                      ? 'bg-accent/15 text-accent'
+                      : 'text-text-muted hover:bg-canvas hover:text-text-secondary',
+                    !p.up && portId !== p.id && 'opacity-50',
+                  )}
+                >
+                  {p.label.replace(/\s+/g, '')}
+                </button>
+              ))}
+            </div>
+          ) : (
+            <div className="flex items-center gap-2">
+              {ports.length >= PORT_FILTER_MIN && (
+                <div className="flex gap-0.5 rounded-lg border border-border bg-elevated p-0.5">
+                  {PORT_FILTERS.map((f) => (
+                    <button
+                      key={f}
+                      type="button"
+                      onClick={() => setPortFilter(f)}
+                      className={cn(
+                        'rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors',
+                        portFilter === f
+                          ? 'bg-accent/15 text-accent'
+                          : 'text-text-muted hover:bg-canvas hover:text-text-secondary',
+                      )}
+                    >
+                      {t(PORT_FILTER_LABEL[f])}
+                    </button>
+                  ))}
+                </div>
+              )}
+              <Select value={portId ?? ''} onValueChange={setPortId}>
+                <SelectTrigger
+                  aria-label={t('routerDetail.ports.seriesPort')}
+                  className="h-7 w-auto max-w-56 gap-1.5 rounded-lg border-border bg-elevated px-2 font-mono text-[10px] font-medium text-text-secondary"
+                >
+                  <SelectValue />
+                </SelectTrigger>
+                <SelectContent>
+                  {visiblePorts.map((p) => (
+                    <SelectItem key={p.id} value={p.id}>
+                      {p.label}
+                      {(() => { const peer = portPeerLabel(p); return peer && peer !== p.label ? ` · ${peer}` : '' })()}
+                    </SelectItem>
+                  ))}
+                </SelectContent>
+              </Select>
+            </div>
+          )}
           {/* Selector de rango */}
           <div className="flex gap-0.5 rounded-lg border border-border bg-elevated p-0.5">
             {RANGES.map((r) => (
@@ -231,14 +303,19 @@ export function PortSeriesChart({
         </div>
       </div>
 
-      <p className="mt-1 truncate text-caption text-text-muted" title={activePort?.connectedTo ?? activePort?.label}>
-        {activePort
-          ? activePort.connectedTo && activePort.connectedTo !== activePort.label
-            ? `${activePort.label} · ${activePort.connectedTo}`
-            : activePort.label
-          : ''}
-        {activePort?.speed ? ` · ${activePort.speed}` : ''}
-      </p>
+      {(() => {
+        const activePeer = activePort ? portPeerLabel(activePort) : ''
+        return (
+          <p className="mt-1 truncate text-caption text-text-muted" title={activePeer || activePort?.label}>
+            {activePort
+              ? activePeer && activePeer !== activePort.label
+                ? `${activePort.label} · ${activePeer}`
+                : activePort.label
+              : ''}
+            {activePort?.speed ? ` · ${activePort.speed}` : ''}
+          </p>
+        )
+      })()}
 
       <div className="mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-caption text-text-secondary">
         <span className="inline-flex items-center gap-1.5">

+ 22 - 0
app/src/components/routers/routerExtras.ts

@@ -79,10 +79,32 @@ export interface EthPort {
   sfp?: SfpInfo // diagnóstico SFP si la boca tiene módulo óptico (#313)
   connectedTo?: string // "NAS Synology" | "Salón · AX3000T"
   deviceMac?: string // MAC del dispositivo conectado (para enlazar a /devices)
+  /** > 0 = agregación: N MACs detrás de la boca, sin par único nombrable (#1036). */
+  deviceCount?: number
   detail?: string // "192.168.8.10 · full duplex"
   health?: PortHealth // health score del puerto (#299)
 }
 
+/**
+ * Etiqueta del par conectado a una boca. En agregación (deviceCount > 0)
+ * el contador lo traduce la app con su i18n; el server ya no pre-formatea
+ * texto en este caso (#1036).
+ */
+export function portPeerLabel(port: EthPort): string {
+  if (port.deviceCount && port.deviceCount > 0) {
+    return i18n.t('routerDetail.ports.aggregation', { count: port.deviceCount })
+  }
+  return port.connectedTo ?? ''
+}
+
+/** Detalle del par: en agregación, la pista "¿hipervisor o switch?" traducida. */
+export function portPeerDetail(port: EthPort): string {
+  if (port.deviceCount && port.deviceCount > 0) {
+    return i18n.t('routerDetail.ports.aggregationHint')
+  }
+  return port.detail ?? ''
+}
+
 export interface BackhaulInfo {
   kind: 'wireless' | 'cable'
   /** Etiqueta principal: "−58 dBm · 866 Mbps PHY" / "Cable · 1 Gbps · full duplex" */

+ 118 - 32
app/src/pages/Settings.tsx

@@ -397,6 +397,10 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
   const [gateway, setGateway] = useState(false)
   const [agentOnly, setAgentOnly] = useState(false)
   const [addSshPort, setAddSshPort] = useState(22)
+  const [addSnmpEnabled, setAddSnmpEnabled] = useState(false)
+  const [addSnmpCommunity, setAddSnmpCommunity] = useState('')
+  const [addSnmpPort, setAddSnmpPort] = useState(161)
+  const [addSnmpPollInterval, setAddSnmpPollInterval] = useState(60)
   const [submitting, setSubmitting] = useState(false)
   const [confirmDeleteFor, setConfirmDeleteFor] = useState<string | null>(null)
   const [confirmRotateFor, setConfirmRotateFor] = useState<string | null>(null)
@@ -567,6 +571,10 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
           gateway,
           agent_only: agentOnly,
           ssh_port: addSshPort,
+          snmp_enabled: addSnmpEnabled,
+          snmp_community: addSnmpCommunity.trim() || undefined,
+          snmp_port: addSnmpPort,
+          snmp_poll_interval: addSnmpPollInterval,
         }),
       })
       if (res.status === 409) {
@@ -580,6 +588,10 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
       setGateway(false)
       setAgentOnly(false)
       setAddSshPort(22)
+      setAddSnmpEnabled(false)
+      setAddSnmpCommunity('')
+      setAddSnmpPort(161)
+      setAddSnmpPollInterval(60)
       setShowAddForm(false)
       await load()
       refresh()
@@ -983,6 +995,63 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
             {submitting ? t('settings.routers.adding') : t('settings.routers.add')}
           </button>
         </div>
+        {(type === 'managed-switch' || type === 'external') && (
+          <div className="mt-2.5 space-y-2.5 rounded-lg border border-border bg-canvas/50 p-3">
+            <label className="flex cursor-pointer items-center gap-2 text-sm text-text-secondary">
+              <Switch checked={addSnmpEnabled} onCheckedChange={setAddSnmpEnabled} />
+              {t('settings.routers.snmpEnabled')}
+              <InfoTip text={t('settings.routers.snmpEnabledHint')} />
+            </label>
+            {addSnmpEnabled && (
+              <div className="grid grid-cols-2 gap-2.5">
+                <div>
+                  <label htmlFor="add-snmp-community" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.snmpCommunity')}
+                  </label>
+                  <input
+                    id="add-snmp-community"
+                    type="text"
+                    value={addSnmpCommunity}
+                    onChange={(e) => setAddSnmpCommunity(e.target.value)}
+                    placeholder="public"
+                    aria-label={t('settings.routers.snmpCommunity')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                </div>
+                <div>
+                  <label htmlFor="add-snmp-port" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.snmpPort')}
+                  </label>
+                  <input
+                    id="add-snmp-port"
+                    type="text"
+                    min={1}
+                    max={65535}
+                    value={addSnmpPort}
+                    onChange={(e) => setAddSnmpPort(Number(e.target.value))}
+                    aria-label={t('settings.routers.snmpPort')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                </div>
+                <div>
+                  <label htmlFor="add-snmp-poll-interval" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.snmpPollInterval')}
+                  </label>
+                  <input
+                    id="add-snmp-poll-interval"
+                    type="text"
+                    min={10}
+                    max={3600}
+                    value={addSnmpPollInterval}
+                    onChange={(e) => setAddSnmpPollInterval(Number(e.target.value))}
+                    aria-label={t('settings.routers.snmpPollInterval')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                </div>
+              </div>
+            )}
+          </div>
+        )}
         {error && <p className="mt-2 text-caption text-danger">{error}</p>}
         </form>
         )}
@@ -1002,23 +1071,36 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
             </DialogHeader>
             <form onSubmit={(e) => void saveEdit(e)} className="space-y-3">
               <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
-                <input
-                  type="text"
-                  required
-                  value={editHost}
-                  onChange={(e) => setEditHost(e.target.value)}
-                  placeholder={t('settings.routers.host')}
-                  aria-label={t('settings.routers.host')}
-                  className="rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
-                />
-                <input
-                  type="text"
-                  value={editName}
-                  onChange={(e) => setEditName(e.target.value)}
-                  placeholder={t('settings.routers.name')}
-                  aria-label={t('settings.routers.name')}
-                  className="rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
-                />
+                <div>
+                  <label htmlFor="edit-host" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.host')}
+                  </label>
+                  <input
+                    id="edit-host"
+                    type="text"
+                    required
+                    value={editHost}
+                    onChange={(e) => setEditHost(e.target.value)}
+                    placeholder={t('settings.routers.host')}
+                    aria-label={t('settings.routers.host')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                </div>
+                <div>
+                  <label htmlFor="edit-name" className="mb-1 flex items-center gap-1 text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.name')}
+                    <InfoTip text={t('settings.routers.nameOverrideHint')} />
+                  </label>
+                  <input
+                    id="edit-name"
+                    type="text"
+                    value={editName}
+                    onChange={(e) => setEditName(e.target.value)}
+                    placeholder={t('settings.routers.name')}
+                    aria-label={t('settings.routers.name')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                </div>
               </div>
               <div>
                 <label htmlFor="ssh-port" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
@@ -1072,6 +1154,7 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
                 <label className="flex cursor-pointer items-center gap-2 text-sm text-text-secondary">
                   <Switch checked={editAgentOnly} onCheckedChange={setEditAgentOnly} />
                   {t('settings.routers.agentOnly')}
+                  <InfoTip text={t('settings.routers.agentOnlyHint')} />
                 </label>
                 {editType === 'managed-switch' && (
                   <label className="flex cursor-pointer items-start gap-2 text-sm text-text-secondary">
@@ -1083,26 +1166,29 @@ function RoutersManager({ reduce, onSaved }: { reduce: boolean; onSaved: () => v
                   </label>
                 )}
               </div>
-              <div>
-                <label htmlFor="firmware-target" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
-                  {t('settings.routers.firmwareTarget')}
-                </label>
-                <input
-                  id="firmware-target"
-                  type="text"
-                  value={editFirmwareTarget}
-                  onChange={(e) => setEditFirmwareTarget(e.target.value)}
-                  placeholder={t('settings.routers.firmwareTargetPlaceholder')}
-                  aria-label={t('settings.routers.firmwareTarget')}
-                  className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
-                />
-                <p className="mt-1 text-caption leading-relaxed text-text-muted">{t('settings.routers.firmwareTargetHint')}</p>
-              </div>
+              {(editType === 'openwrt' || editType === 'glinet') && (
+                <div>
+                  <label htmlFor="firmware-target" className="mb-1 block text-caption font-medium uppercase tracking-[0.06em] text-text-muted">
+                    {t('settings.routers.firmwareTarget')}
+                  </label>
+                  <input
+                    id="firmware-target"
+                    type="text"
+                    value={editFirmwareTarget}
+                    onChange={(e) => setEditFirmwareTarget(e.target.value)}
+                    placeholder={t('settings.routers.firmwareTargetPlaceholder')}
+                    aria-label={t('settings.routers.firmwareTarget')}
+                    className="w-full rounded-lg border border-border bg-elevated px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
+                  />
+                  <p className="mt-1 text-caption leading-relaxed text-text-muted">{t('settings.routers.firmwareTargetHint')}</p>
+                </div>
+              )}
               {(editType === 'managed-switch' || editType === 'external' || editSnmpEnabled) && (
                 <div className="space-y-2.5 rounded-lg border border-border bg-canvas/50 p-3">
                   <label className="flex cursor-pointer items-center gap-2 text-sm text-text-secondary">
                     <Switch checked={editSnmpEnabled} onCheckedChange={setEditSnmpEnabled} />
                     {t('settings.routers.snmpEnabled')}
+                    <InfoTip text={t('settings.routers.snmpEnabledHint')} />
                   </label>
                   {editSnmpEnabled && (
                     <div className="grid grid-cols-2 gap-2.5">

+ 24 - 6
server-go/internal/adapters/live.go

@@ -258,6 +258,10 @@ type Live struct {
 	// snmpFdbCount (#928): último conteo de entradas FDB por router SNMP,
 	// para loguear solo cuando el resultado cambia.
 	snmpFdbCount map[string]int
+	// snmpBrMac (#1036): última MAC base del bridge leída por SNMP por
+	// router. Cache para no perderla cuando el equipo no contesta el OID
+	// en un poll (la MAC alimenta el matching por MAC de la topología).
+	snmpBrMac map[string]string
 	// snmpPollStats (#930): contadores de éxito/fallo del poll SNMP por
 	// router (ok, fail, consecFail, timestamps, último error). Protegido
 	// por mu; en memoria (no persiste entre reinicios).
@@ -410,6 +414,7 @@ func NewLive(cfg *config.Config, d *db.DB, initial []RouterConfig, pool *SSHPool
 		snmpPorts:            map[string]map[string]snmpPortSample{},
 		snmpLastPoll:         map[string]time.Time{},
 		snmpFdbCount:         map[string]int{},
+		snmpBrMac:            map[string]string{},
 		snmpPollStats:        map[string]*snmpPollStat{},
 		ping:                 pingHost,
 		snmpLastMetricsTick:  map[string]int64{},
@@ -565,6 +570,11 @@ func (l *Live) SetRouters(list []RouterConfig) {
 			delete(l.snmpLastPoll, id)
 		}
 	}
+	for id := range l.snmpBrMac {
+		if !ids[id] {
+			delete(l.snmpBrMac, id)
+		}
+	}
 	for id := range l.snmpLastMetricsTick {
 		if !ids[id] {
 			delete(l.snmpLastMetricsTick, id)
@@ -3242,6 +3252,12 @@ func (l *Live) GetRouterDetail(ctx context.Context, id string) (*RouterDetail, e
 		}
 		netdev := portNetdev(port)
 		all := portMacs[netdev]
+		// #1036: portMacs se construye iterando el FDB (mapa), así que el
+		// ORDEN de las MACs por boca cambia en cada tick. Con 2-3 MACs la
+		// heurística de "primera con hostname DHCP" elegía un dispositivo
+		// distinto por ciclo y la etiqueta del puerto flappeaba. Orden
+		// estable: la selección queda determinista entre polls.
+		sort.Strings(all)
 		// 1) ¿Otro router al otro lado? (uplink router↔router)
 		neighbor := ""
 		for _, mac := range all {
@@ -3338,8 +3354,8 @@ func (l *Live) GetRouterDetail(ctx context.Context, id string) (*RouterDetail, e
 			// virtual, no el equipo enchufado). La label curada del puerto ya
 			// identifica el físico; aquí se cuenta lo que hay detrás (#291).
 			if len(all) > 3 {
-				port.ConnectedTo = fmt.Sprintf("%d dispositivos", len(all))
-				port.Detail = "agregación · ¿hipervisor o switch?"
+				// deviceCount lo traduce la app; aquí NO se formatea texto (#1036).
+				port.DeviceCount = len(all)
 				enriched = append(enriched, port)
 				continue
 			}
@@ -3659,7 +3675,7 @@ func (l *Live) GetUsteer(context.Context) (*Usteer, error) {
 		if name == "" {
 			name = cfg.ID
 		}
-		if cfg.AgentOnly {
+		if cfg.AgentOnly || cfg.SnmpEnabled {
 			mesh = append(mesh, UsteerMesh{RouterID: cfg.ID, Name: name, Usteer: false, ApsSeen: 0})
 			continue
 		}
@@ -3991,8 +4007,9 @@ func (l *Live) GetDot11r(ctx context.Context) (*Dot11rOverview, error) {
 			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 {
+		// Agent-only (switches sin SSH ni wifi) y los sondeados por SNMP (sin
+		// SSH en absoluto, #1026) se listan como Available=false.
+		if cfg.AgentOnly || cfg.SnmpEnabled {
 			out.Routers = append(out.Routers, r)
 			continue
 		}
@@ -4290,7 +4307,8 @@ func (l *Live) GetSurvey(ctx context.Context) (*SurveyOverview, error) {
 			name = cfg.ID
 		}
 		r := SurveyRouter{RouterID: cfg.ID, Name: name, Radios: []SurveyRadio{}}
-		if cfg.AgentOnly {
+		// Agent-only y SNMP (#1026): unidades sin SSH; se listan sin radios.
+		if cfg.AgentOnly || cfg.SnmpEnabled {
 			out.Routers = append(out.Routers, r)
 			continue
 		}

+ 57 - 0
server-go/internal/adapters/live_snmp_skip_test.go

@@ -0,0 +1,57 @@
+package adapters
+
+import (
+	"context"
+	"testing"
+)
+
+// issue #1026: las sondas SSH de features (usteer, 802.11r, survey) deben
+// saltar las unidades sondeadas por SNMP, igual que las agent-only: esas
+// unidades no tienen SSH en absoluto y cada intento genera ruido de backoff
+// en el pool. Los tests usan pool nil como tripwire: si la guarda no salta,
+// l.pool.Run paniquea por nil pointer y el test falla.
+
+func TestGetUsteerSkipsSnmpRouters(t *testing.T) {
+	l := NewLive(nil, nil, []RouterConfig{
+		{ID: "sw1", Name: "Switch 1", Host: "192.168.1.10", SnmpEnabled: true},
+	}, nil)
+
+	u, err := l.GetUsteer(context.Background())
+	if err != nil {
+		t.Fatalf("unexpected error: %v", err)
+	}
+	// Sin APs (la unidad SNMP se salta) la función devuelve (nil, nil).
+	if u != nil {
+		t.Fatalf("expected nil Usteer, got %+v", u)
+	}
+}
+
+func TestGetDot11rSkipsSnmpRouters(t *testing.T) {
+	l := NewLive(nil, nil, []RouterConfig{
+		{ID: "sw1", Name: "Switch 1", Host: "192.168.1.10", SnmpEnabled: true},
+	}, nil)
+
+	d, err := l.GetDot11r(context.Background())
+	if err != nil {
+		t.Fatalf("unexpected error: %v", err)
+	}
+	// Ningún router con wifi disponible -> (nil, nil).
+	if d != nil {
+		t.Fatalf("expected nil Dot11rOverview, got %+v", d)
+	}
+}
+
+func TestGetSurveySkipsSnmpRouters(t *testing.T) {
+	l := NewLive(nil, nil, []RouterConfig{
+		{ID: "sw1", Name: "Switch 1", Host: "192.168.1.10", SnmpEnabled: true},
+	}, nil)
+
+	s, err := l.GetSurvey(context.Background())
+	if err != nil {
+		t.Fatalf("unexpected error: %v", err)
+	}
+	// Ningún router respondió -> (nil, nil).
+	if s != nil {
+		t.Fatalf("expected nil SurveyOverview, got %+v", s)
+	}
+}

+ 12 - 0
server-go/internal/adapters/snmp_live.go

@@ -46,6 +46,17 @@ func (l *Live) pollRouterSNMP(cfg RouterConfig) (*routerPolled, error) {
 	if sysErr != nil {
 		log.Printf("[netpulse] SNMP system %s: %v", cfg.LogLabel(), sysErr)
 	}
+	// #1036: MAC propia del switch (dot1dBaseBridgeAddress). Sin ella el
+	// equipo no tenía MAC en flota ni casaba por MAC en topología. Cache:
+	// si el OID no contesta en este poll se conserva la última conocida.
+	brMac, _ := npsnmp.PollBridgeAddress(session)
+	l.mu.Lock()
+	if brMac == "" {
+		brMac = l.snmpBrMac[cfg.ID]
+	} else {
+		l.snmpBrMac[cfg.ID] = brMac
+	}
+	l.mu.Unlock()
 	ports, ifErr := npsnmp.PollIfTable(session)
 	if ifErr != nil {
 		log.Printf("[netpulse] SNMP ifTable %s: %v", cfg.LogLabel(), ifErr)
@@ -166,6 +177,7 @@ func (l *Live) pollRouterSNMP(cfg RouterConfig) (*routerPolled, error) {
 		net:       netPtr,
 		ports:     ethPorts,
 		fdb:       fdbMap,
+		brMac:     brMac,
 		polledAt:  now.UnixMilli(),
 	}
 	l.mu.Lock()

+ 4 - 0
server-go/internal/adapters/types.go

@@ -565,6 +565,10 @@ type EthPort struct {
 	Sfp         *SfpInfo `json:"sfp,omitempty"`
 	ConnectedTo string   `json:"connectedTo,omitempty"`
 	DeviceMac   string   `json:"deviceMac,omitempty"`
+	// DeviceCount > 0 indica agregación: hay N MACs detrás de la boca y no
+	// podemos nombrar un único par (hipervisor o switch). El cliente traduce
+	// con su i18n; el server NO pre-formatea (#1036).
+	DeviceCount int `json:"deviceCount,omitempty"`
 	Detail      string   `json:"detail,omitempty"`
 	// Snmp indica que el puerto proviene de un switch gestionado por SNMP
 	// (issue #414). Se usa para aplicar histeresis temporal en ghost-port.

+ 24 - 3
server-go/internal/roamevents/collector.go

@@ -3,8 +3,10 @@
 //
 // El feed viene de `logread` en cada router con SSH. Una goroutine dedicada
 // (Collector) corre cada 60s, hace SSH `logread | grep -E 'AP-STA-CONNECTED|
-// AP-STA-DISCONNECTED|dawn:'` por router, parsea cada línea a un RoamEvent y
-// lo inserta con INSERT OR IGNORE (dedup por content_hash).
+// AP-STA-DISCONNECTED|IEEE 802.11: (dis)associated|dawn:|usteer:'` por router,
+// parsea cada línea a un RoamEvent y lo inserta con INSERT OR IGNORE (dedup
+// por content_hash). El formato IEEE 802.11 cubre wpad-mbedtls, que no emite
+// AP-STA-* (#1038).
 //
 // Solo se ingestan 3 tipos de eventos: connected, disconnected, dawn_decision.
 // BEACON-REQ/RESP se descartan (90% del ruido, valor bajo sin contexto FT).
@@ -128,7 +130,9 @@ func (c *Collector) tick() {
 
 func (c *Collector) collectRouter(h RouterHost) {
 	// grep extiende el set a futuro (eventos FT, etc.) sin tocar el binario.
-	cmd := "logread 2>/dev/null | grep -E 'AP-STA-CONNECTED|AP-STA-DISCONNECTED|dawn:|usteer:' | tail -100"
+	// "IEEE 802.11: (dis)associated" cubre el formato de wpad-mbedtls que
+	// no emite AP-STA-CONNECTED/DISCONNECTED (#1038).
+	cmd := "logread 2>/dev/null | grep -E 'AP-STA-CONNECTED|AP-STA-DISCONNECTED|IEEE 802\\.11: associated|IEEE 802\\.11: disassociated|dawn:|usteer:' | tail -100"
 	out, err := c.runner.Run(h.Host, cmd, 8*time.Second)
 	if err != nil {
 		return
@@ -229,6 +233,13 @@ var (
 	// hostapd sin prefijo de iface: "AP-STA-CONNECTED <mac>"
 	hostapdConnShortRe = regexp.MustCompile(`^AP-STA-(CONNECTED|DISCONNECTED)\s+([0-9a-fA-F:]{17})`)
 
+	// hostapd formato wpad-mbedtls (#1038): no emite AP-STA-* sino
+	//   "phy1-ap0: STA <mac> IEEE 802.11: associated (aid 1)"
+	//   "phy1-ap0: STA <mac> IEEE 802.11: disassociated"
+	//   "phy1-ap0: STA <mac> IEEE 802.11: disassociated due to inactivity"
+	// El sufijo (aid N / due to inactivity) lo tolera el \b final.
+	hostapdAssocRe = regexp.MustCompile(`^(\S+):\s+STA\s+([0-9a-fA-F:]{17})\s+IEEE 802\.11:\s+(dis)?associated\b`)
+
 	// dawn: "Client / BSSID = <mac> / <bssid>: <action>"
 	dawnClientRe = regexp.MustCompile(`Client\s*/\s*BSSID\s*=\s*([0-9a-fA-F:]{17})\s*/\s*([0-9a-fA-F:]{17}):\s*(.+)`)
 
@@ -301,6 +312,16 @@ func parseHostapd(rest, routerID string, ts int64) (Event, bool) {
 		}
 		return Event{TsMs: ts, RouterID: routerID, Type: typ, MAC: mac}, true
 	}
+	// Caso wpad-mbedtls (#1038): "phy1-ap0: STA <mac> IEEE 802.11: associated (aid 1)"
+	if m := hostapdAssocRe.FindStringSubmatch(rest); m != nil {
+		iface := m[1]
+		mac := m[2]
+		typ := TypeConnected
+		if m[3] == "dis" {
+			typ = TypeDisconnected
+		}
+		return Event{TsMs: ts, RouterID: routerID, Type: typ, MAC: mac, Iface: iface}, true
+	}
 	return Event{}, false
 }
 

+ 20 - 0
server-go/internal/roamevents/collector_test.go

@@ -120,6 +120,26 @@ func TestParseHostapdConnected(t *testing.T) {
 			want:  TypeDisconnected,
 			iface: "wlan0",
 		},
+		{
+			// #1038: wpad-mbedtls no emite AP-STA-*; formato real de
+			// OpenWrt 25.12.5 reportado por crowedavid.
+			name:  "mbedtls-associated",
+			line:  "Thu Oct  1 19:56:50 2026 daemon.info hostapd: phy1-ap0: STA 04:95:e6:76:55:a1 IEEE 802.11: associated (aid 1)",
+			want:  TypeConnected,
+			iface: "phy1-ap0",
+		},
+		{
+			name:  "mbedtls-disassociated",
+			line:  "Thu Oct  1 20:04:52 2026 daemon.info hostapd: phy1-ap0: STA 04:95:e6:76:55:a1 IEEE 802.11: disassociated",
+			want:  TypeDisconnected,
+			iface: "phy1-ap0",
+		},
+		{
+			name:  "mbedtls-disassociated-inactivity",
+			line:  "Thu Oct  1 20:04:52 2026 daemon.info hostapd: phy1-ap0: STA 04:95:e6:76:55:a1 IEEE 802.11: disassociated due to inactivity",
+			want:  TypeDisconnected,
+			iface: "phy1-ap0",
+		},
 	}
 	for _, c := range cases {
 		t.Run(c.name, func(t *testing.T) {

+ 5 - 0
server-go/internal/snmp/oids.go

@@ -14,6 +14,11 @@ const (
 	OidIfOperStatus= ".1.3.6.1.2.1.2.2.1.8"
 	OidIfInOctets  = ".1.3.6.1.2.1.2.2.1.10"
 	OidIfInErrors  = ".1.3.6.1.2.1.2.2.1.14"
+
+	// OidDot1dBaseBridgeAddress (BRIDGE-MIB): MAC base del bridge del
+	// switch. Fuente para la MAC propia de un switch sondeado por SNMP
+	// (#1036): sin ella el equipo no casaba por MAC en topología.
+	OidDot1dBaseBridgeAddress = ".1.3.6.1.2.1.17.1.1.0"
 	OidIfOutOctets = ".1.3.6.1.2.1.2.2.1.16"
 	OidIfOutErrors = ".1.3.6.1.2.1.2.2.1.20"
 

+ 39 - 0
server-go/internal/snmp/system.go

@@ -56,3 +56,42 @@ func uint64Val(v gosnmp.SnmpPDU) uint64 {
 	}
 	return gosnmp.ToBigInt(v.Value).Uint64()
 }
+
+// PollBridgeAddress lee la MAC base del bridge (dot1dBaseBridgeAddress).
+// Devuelve "" (sin error) si el equipo no contesta el OID: es opcional y
+// NO debe tumbar el poll (#1036). La MAC se normaliza a MAYÚSCULAS, la
+// capitalización canónica del sistema (#960).
+func PollBridgeAddress(s *gosnmp.GoSNMP) (string, error) {
+	result, err := s.Get([]string{OidDot1dBaseBridgeAddress})
+	if err != nil {
+		return "", nil
+	}
+	for _, v := range result.Variables {
+		if v.Name != OidDot1dBaseBridgeAddress {
+			continue
+		}
+		return bridgeMacFromPDU(v), nil
+	}
+	return "", nil
+}
+
+// bridgeMacFromPDU convierte el OCTET STRING de dot1dBaseBridgeAddress a
+// MAC MAYÚSCULAS canónica ("" si el dato no es usable).
+func bridgeMacFromPDU(v gosnmp.SnmpPDU) string {
+	if v.Type == gosnmp.NoSuchObject || v.Type == gosnmp.NoSuchInstance {
+		return ""
+	}
+	var b []byte
+	switch val := v.Value.(type) {
+	case []byte:
+		b = val
+	case string:
+		b = []byte(val)
+	default:
+		return ""
+	}
+	if len(b) < 6 {
+		return ""
+	}
+	return fmt.Sprintf("%02X:%02X:%02X:%02X:%02X:%02X", b[0], b[1], b[2], b[3], b[4], b[5])
+}

+ 28 - 0
server-go/internal/snmp/system_test.go

@@ -0,0 +1,28 @@
+package snmp
+
+import (
+	"testing"
+
+	"github.com/gosnmp/gosnmp"
+)
+
+// #1036: la MAC base del bridge se normaliza a MAYÚSCULAS (#960) o "" si
+// el dato no es usable (OID ausente, payload corto).
+func TestBridgeMacFromPDU(t *testing.T) {
+	good := gosnmp.SnmpPDU{Name: OidDot1dBaseBridgeAddress, Type: gosnmp.OctetString, Value: []byte{0x04, 0x95, 0xe6, 0x76, 0x55, 0xa1}}
+	if got := bridgeMacFromPDU(good); got != "04:95:E6:76:55:A1" {
+		t.Errorf("bytes: got %q", got)
+	}
+	str := gosnmp.SnmpPDU{Name: OidDot1dBaseBridgeAddress, Type: gosnmp.OctetString, Value: string([]byte{0xa4, 0x7e, 0xfa, 0x65, 0x0c, 0xaa})}
+	if got := bridgeMacFromPDU(str); got != "A4:7E:FA:65:0C:AA" {
+		t.Errorf("string: got %q", got)
+	}
+	short := gosnmp.SnmpPDU{Name: OidDot1dBaseBridgeAddress, Type: gosnmp.OctetString, Value: []byte{0x01, 0x02}}
+	if got := bridgeMacFromPDU(short); got != "" {
+		t.Errorf("short: got %q, want vacío", got)
+	}
+	noObj := gosnmp.SnmpPDU{Name: OidDot1dBaseBridgeAddress, Type: gosnmp.NoSuchObject, Value: nil}
+	if got := bridgeMacFromPDU(noObj); got != "" {
+		t.Errorf("nosuchobject: got %q, want vacío", got)
+	}
+}