Skip to content

Commit 2565be7

Browse files
Liam-qkkrish2718
authored andcommitted
[nrf fromtree] modules: hostap: Fix getting error stations twt capability issue.
1. When external station connects to soft ap, zephyr hostap will fill sta_info before sending mgmt event to l2 wifi layer. sta_info.twt_capable should be filled with external station capability rather than soft ap self. 2. Rename hapd_is_twt_capable to hapd_get_sta_he_twt_capable. Try to get twt_capa form capability of external station rather than soft ap. Signed-off-by: Qiankun Li <[email protected]> (cherry picked from commit 7ffc538)
1 parent 367186f commit 2565be7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

modules/hostap/src/hapd_events.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,17 @@ static enum wifi_link_mode hapd_get_sta_link_mode(struct hostapd_iface *iface,
3535
}
3636
}
3737

38-
static bool hapd_is_twt_capable(struct hostapd_iface *iface, struct sta_info *sta)
38+
#define HE_MACCAP_TWT_REQUESTER BIT(1)
39+
40+
static bool hapd_get_sta_he_twt_capable(struct hostapd_iface *iface, struct sta_info *sta)
3941
{
4042
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX
41-
return hostapd_get_he_twt_responder(iface->bss[0], IEEE80211_MODE_AP);
43+
if (sta->flags & WLAN_STA_HE) {
44+
return (sta->he_capab->he_mac_capab_info[0]
45+
& HE_MACCAP_TWT_REQUESTER ? true : false);
46+
} else {
47+
return false;
48+
}
4249
#else
4350
return false;
4451
#endif
@@ -73,7 +80,7 @@ int hostapd_send_wifi_mgmt_ap_sta_event(struct hostapd_iface *ap_ctx,
7380

7481
if (event == NET_EVENT_WIFI_CMD_AP_STA_CONNECTED) {
7582
sta_info.link_mode = hapd_get_sta_link_mode(ap_ctx, sta);
76-
sta_info.twt_capable = hapd_is_twt_capable(ap_ctx, sta);
83+
sta_info.twt_capable = hapd_get_sta_he_twt_capable(ap_ctx, sta);
7784
}
7885

7986
return supplicant_send_wifi_mgmt_event(ifname,

0 commit comments

Comments
 (0)