controller: selectable hotspot protocol (WPA2/WPA3) with device capability probing

Probe the selected WiFi device with iw to determine which hotspot
protocols it can host: WPA2 requires AP mode; WPA3 requires SAE in AP
mode (SAE_OFFLOAD_AP, or a mac80211 driver with the CMAC cipher for
software SAE).  The Raspberry Pi's brcmfmac supports neither, so Pis
correctly offer WPA2 only (verified against real Pi 4/Pi 5 iw output).

The protocol is saved as hotspot.protocol in controller.yaml.
enable_hotspot() now always sets the Hotspot connection's key-mgmt
explicitly (sae + required PMF for WPA3) so a reused profile cannot
keep a stale protocol, and reverts to WPA2 if the driver rejects SAE.

New GET /api/hotspot/protocols endpoint; protocol dropdowns added to
both the ControllerPage React UI and the fallback controller UI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-28 19:52:39 -06:00 • committed by lrnselfreliance
parent 2355095391
commit 8687816b84
10 changed files with 545 additions and 16 deletions

View file

@ -164,12 +164,20 @@ class HotspotDevicesResponse(BaseModel):
devices: list[str] = Field(description="Available WiFi device names")
class HotspotProtocolsResponse(BaseModel):
"""Response model for /api/hotspot/protocols endpoint."""
device: str = Field(description="WiFi device name that was probed")
protocols: list[str] = Field(description="Hotspot protocols the device can host (wpa2, wpa3)")
class HotspotSettingsRequest(BaseModel):
"""Request model for updating hotspot settings; only provided values are changed."""
device: Optional[str] = Field(default=None, description="WiFi device name")
ssid: Optional[str] = Field(default=None, description="Hotspot SSID")
password: Optional[str] = Field(default=None, description="Hotspot password (8 to 63 characters)")
protocol: Optional[str] = Field(default=None, description="Hotspot protocol (wpa2 or wpa3)")
class HotspotSettingsResponse(BaseModel):
@ -178,6 +186,7 @@ class HotspotSettingsResponse(BaseModel):
device: str = Field(description="WiFi device name")
ssid: str = Field(description="Hotspot SSID")
password: str = Field(description="Hotspot password")
protocol: str = Field(description="Hotspot protocol (wpa2 or wpa3)")
class HotspotActionResponse(BaseModel):