hostap: Fix the security mode in AP

For AP we should use the security mode from the SSID as stations can
have a different security than the configure one. E.g., WPA/WPA2 in AP
vs WPA in STA1 and WPA2 in STA2.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2024-01-08 22:03:56 +05:30 committed by Alberto Escolar
parent 8729141da1
commit d8600d57cc

View file

@ -643,15 +643,20 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
u8 *_ssid = ssid->ssid;
size_t ssid_len = ssid->ssid_len;
struct status_resp cli_status;
bool is_ap;
int proto;
if (!ssid) {
wpa_printf(MSG_ERROR, "Failed to get current ssid");
goto out;
}
is_ap = ssid->mode == WPAS_MODE_AP;
/* For AP its always the configured one */
proto = is_ap ? ssid->proto : wpa_s->wpa_proto;
os_memcpy(status->bssid, wpa_s->bssid, WIFI_MAC_ADDR_LEN);
status->band = wpas_band_to_zephyr(wpas_freq_to_band(wpa_s->assoc_freq));
status->security = wpas_key_mgmt_to_zephyr(wpa_s->key_mgmt, wpa_s->wpa_proto);
status->security = wpas_key_mgmt_to_zephyr(wpa_s->key_mgmt, proto);
status->mfp = ssid->ieee80211w; /* Same mapping */
ieee80211_freq_to_chan(wpa_s->assoc_freq, &channel);
status->channel = channel;