From adc6a5d81a895ded4f86216e8307eefcb7f3dfde Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Fri, 27 Jan 2017 13:43:19 +0900 Subject: [PATCH] mesh: Check remote peer HT Operation element The remote mesh STA which had configuration disable_ht40=1 could have HT Capabilities element which includes Supported Channel Width Set = 1 (both 20 MHz and 40 MHz operation is supported) even though it had HT Operation element which includes STA Channel Width = 0 (20 MHz channel width only). Previously, local peer recognized such a remote peer as 40 MHz band width enabled STA because local peer only checked HT Capabilities element. This could cause disconnection between disable_ht40=1 mesh STA and disable_ht40=0 mesh STA. They could establish a mesh BSS but could not ping with ath9k_htc device. This commit fixes the issue by refering HT Operation element. Signed-off-by: Masashi Honma --- wpa_supplicant/mesh_mpm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index 6c3fa14c8..1a0fd5f47 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -11,6 +11,7 @@ #include "utils/common.h" #include "utils/eloop.h" #include "common/ieee802_11_defs.h" +#include "common/hw_features_common.h" #include "ap/hostapd.h" #include "ap/sta_info.h" #include "ap/ieee802_11.h" @@ -646,6 +647,9 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, struct mesh_conf *conf = wpa_s->ifmsh->mconf; struct hostapd_data *data = wpa_s->ifmsh->bss[0]; struct sta_info *sta; +#ifdef CONFIG_IEEE80211N + struct ieee80211_ht_operation *oper; +#endif /* CONFIG_IEEE80211N */ int ret; if (elems->mesh_config_len >= 7 && @@ -677,6 +681,16 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, #ifdef CONFIG_IEEE80211N copy_sta_ht_capab(data, sta, elems->ht_capabilities); + + oper = (struct ieee80211_ht_operation *) elems->ht_operation; + if (oper && + !(oper->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH)) { + wpa_msg(wpa_s, MSG_DEBUG, MACSTR + " does not support 40 MHz bandwidth", + MAC2STR(sta->addr)); + set_disable_ht40(sta->ht_capabilities, 1); + } + update_ht_state(data, sta); #endif /* CONFIG_IEEE80211N */