fix: return key (PSK) from get_ssids() for drift detection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Manivong
2026-06-04 13:28:40 +02:00
co-authored by Claude Sonnet 4.6
parent 0493520e5f
commit 77c9d386db
+16
View File
@@ -1088,6 +1088,11 @@ class OpenWrtDriver(AccessPointDriver):
client_isolation = entry.get("isolate", "0") == "1" client_isolation = entry.get("isolate", "0") == "1"
_max_raw = entry.get("maxassoc") _max_raw = entry.get("maxassoc")
max_clients: Optional[int] = int(_max_raw) if _max_raw and str(_max_raw).isdigit() else None max_clients: Optional[int] = int(_max_raw) if _max_raw and str(_max_raw).isdigit() else None
_disassoc_raw = entry.get("disassoc_low_ack")
disassoc_low_ack: Optional[bool] = (_disassoc_raw == "1") if _disassoc_raw is not None else None
_max_inact_raw = entry.get("max_inactivity")
max_inactivity: Optional[int] = int(_max_inact_raw) if _max_inact_raw and str(_max_inact_raw).isdigit() else None
key: str = entry.get("key", "") or ""
if ssid in result: if ssid in result:
# Merge: append band if not already present # Merge: append band if not already present
@@ -1114,6 +1119,14 @@ class OpenWrtDriver(AccessPointDriver):
# Max clients: keep first non-None value # Max clients: keep first non-None value
if max_clients is not None and result[ssid].get("max_clients") is None: if max_clients is not None and result[ssid].get("max_clients") is None:
result[ssid]["max_clients"] = max_clients result[ssid]["max_clients"] = max_clients
# disassoc_low_ack / max_inactivity: keep first explicit value
if disassoc_low_ack is not None and result[ssid].get("disassoc_low_ack") is None:
result[ssid]["disassoc_low_ack"] = disassoc_low_ack
if max_inactivity is not None and result[ssid].get("max_inactivity") is None:
result[ssid]["max_inactivity"] = max_inactivity
# key: keep first non-empty value seen
if key and not result[ssid].get("key"):
result[ssid]["key"] = key
else: else:
ssid_bands[ssid] = [band] if band else [] ssid_bands[ssid] = [band] if band else []
result[ssid] = { result[ssid] = {
@@ -1132,6 +1145,9 @@ class OpenWrtDriver(AccessPointDriver):
"ieee80211r": ft_enabled, "ieee80211r": ft_enabled,
"mobility_domain": ft_mobility_domain, "mobility_domain": ft_mobility_domain,
"ft_over_ds": ft_over_ds, "ft_over_ds": ft_over_ds,
"disassoc_low_ack": disassoc_low_ack,
"max_inactivity": max_inactivity,
"key": key,
} }
return result return result