From 77c9d386db5c58e7da52bcc6ae4db30b85f53e09 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Thu, 4 Jun 2026 13:28:40 +0200 Subject: [PATCH] fix: return key (PSK) from get_ssids() for drift detection Co-Authored-By: Claude Sonnet 4.6 --- napalm_openwrt/openwrt.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/napalm_openwrt/openwrt.py b/napalm_openwrt/openwrt.py index 04c1932..2079aa6 100644 --- a/napalm_openwrt/openwrt.py +++ b/napalm_openwrt/openwrt.py @@ -1088,6 +1088,11 @@ class OpenWrtDriver(AccessPointDriver): client_isolation = entry.get("isolate", "0") == "1" _max_raw = entry.get("maxassoc") 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: # Merge: append band if not already present @@ -1114,6 +1119,14 @@ class OpenWrtDriver(AccessPointDriver): # Max clients: keep first non-None value if max_clients is not None and result[ssid].get("max_clients") is None: 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: ssid_bands[ssid] = [band] if band else [] result[ssid] = { @@ -1132,6 +1145,9 @@ class OpenWrtDriver(AccessPointDriver): "ieee80211r": ft_enabled, "mobility_domain": ft_mobility_domain, "ft_over_ds": ft_over_ds, + "disassoc_low_ack": disassoc_low_ack, + "max_inactivity": max_inactivity, + "key": key, } return result