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
+4
View File
@@ -3,6 +3,10 @@ interface=wlxc83a35a4ee55
# hostapd adds the wlan to the bridge after setting AP mode; the bridge itself + its
# wired member + the gateway IP are defined under /etc/systemd/network (2x-van-br0/lan).
bridge=br0
# Control socket so van-ap-watchdog (and hostapd_cli) can read the AP's real state
# (state=ENABLED means it's actually beaconing) — used to detect a wedged radio that
# stays "running" but stops serving after a USB glitch.
ctrl_interface=/var/run/hostapd
driver=nl80211
ssid=VanLink
country_code=CA