ap: keep AP beaconing across USB re-enumeration

Starlink's USB ethernet shares a hub with the rtw89 Wi-Fi adapter; when Starlink
flaps, the hub re-enumerates and tears the radio down, so hostapd loses its
interface and exits. Two stock defaults left the AP dark: Restart=on-failure
misses clean exits, and the 5-in-10s start limit makes systemd give up during a
re-enumeration storm.

- hostapd-restart.conf drop-in: Restart=always, RestartSec=5, StartLimitIntervalSec=0
  so hostapd retries forever until the interface returns (verified: SIGKILL -> back
  to state=ENABLED in ~7s).
- van-ap-watchdog daemon: backstop for the case systemd can't see (hostapd running
  but radio wedged). Polls hostapd_cli status; restarts hostapd if the iface is
  present but not ENABLED, waits it out if the iface is mid-re-enumeration.
- hostapd.conf: add ctrl_interface so the watchdog can read the real AP state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-07-01 14:36:14 -04:00
co-authored by Claude Opus 4.8
parent 830ef52641
commit 877fa14d0c
6 changed files with 164 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=VanLink AP watchdog — recover hostapd if the radio wedges after a USB glitch
After=hostapd.service
Wants=hostapd.service
[Service]
Type=simple
ExecStart=/usr/local/sbin/van-ap-watchdog
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target