WNM: Provide option to disable/enable BTM support in STA

Add support to disable/enable BTM support using configuration and
wpa_cli command. This is useful mainly for testing purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Ankita Bajaj 2019-05-30 19:44:55 +05:30 committed by Jouni Malinen
parent 4068d683f5
commit ef59f98729
6 changed files with 29 additions and 1 deletions

View file

@ -4869,6 +4869,9 @@ static const struct global_parse_data global_fields[] = {
{ INT_RANGE(gas_rand_mac_addr, 0, 2), 0 }, { INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
{ INT_RANGE(dpp_config_processing, 0, 2), 0 }, { INT_RANGE(dpp_config_processing, 0, 2), 0 },
{ INT_RANGE(coloc_intf_reporting, 0, 1), 0 }, { INT_RANGE(coloc_intf_reporting, 0, 1), 0 },
#ifdef CONFIG_WNM
{ INT_RANGE(disable_btm, 0, 1), CFG_CHANGED_DISABLE_BTM },
#endif /* CONFIG_WNM */
}; };
#undef FUNC #undef FUNC

View file

@ -374,6 +374,7 @@ struct wpa_cred {
#define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16) #define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16)
#define CFG_CHANGED_SCHED_SCAN_PLANS BIT(17) #define CFG_CHANGED_SCHED_SCAN_PLANS BIT(17)
#define CFG_CHANGED_WOWLAN_TRIGGERS BIT(18) #define CFG_CHANGED_WOWLAN_TRIGGERS BIT(18)
#define CFG_CHANGED_DISABLE_BTM BIT(19)
/** /**
* struct wpa_config - wpa_supplicant configuration data * struct wpa_config - wpa_supplicant configuration data
@ -1527,6 +1528,15 @@ struct wpa_config {
* By default, permanent MAC address is used. * By default, permanent MAC address is used.
*/ */
int p2p_interface_random_mac_addr; int p2p_interface_random_mac_addr;
/**
* disable_btm - Disable BSS transition management in STA
* - Set to 0 to enable BSS transition management
* - Set to 1 to disable BSS transition management
*
* By default BSS transition management is enabled
*/
int disable_btm;
}; };

View file

@ -1545,6 +1545,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (config->p2p_interface_random_mac_addr) if (config->p2p_interface_random_mac_addr)
fprintf(f, "p2p_interface_random_mac_addr=%d\n", fprintf(f, "p2p_interface_random_mac_addr=%d\n",
config->p2p_interface_random_mac_addr); config->p2p_interface_random_mac_addr);
if (config->disable_btm)
fprintf(f, "disable_btm=1\n");
} }
#endif /* CONFIG_NO_CONFIG_WRITE */ #endif /* CONFIG_NO_CONFIG_WRITE */

View file

@ -1371,6 +1371,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
const u8 *vendor; const u8 *vendor;
#endif /* CONFIG_MBO */ #endif /* CONFIG_MBO */
if (wpa_s->conf->disable_btm)
return;
if (end - pos < 5) if (end - pos < 5)
return; return;

View file

@ -1711,7 +1711,8 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
case 2: /* Bits 16-23 */ case 2: /* Bits 16-23 */
#ifdef CONFIG_WNM #ifdef CONFIG_WNM
*pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */ *pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
*pos |= 0x08; /* Bit 19 - BSS Transition */ if (!wpa_s->conf->disable_btm)
*pos |= 0x08; /* Bit 19 - BSS Transition */
#endif /* CONFIG_WNM */ #endif /* CONFIG_WNM */
break; break;
case 3: /* Bits 24-31 */ case 3: /* Bits 24-31 */
@ -6630,6 +6631,9 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s)
wpa_s->conf->wowlan_triggers); wpa_s->conf->wowlan_triggers);
} }
if (wpa_s->conf->changed_parameters & CFG_CHANGED_DISABLE_BTM)
wpa_supplicant_set_default_scan_ies(wpa_s);
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
wpas_wps_update_config(wpa_s); wpas_wps_update_config(wpa_s);
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */

View file

@ -1516,6 +1516,12 @@ fast_reauth=1
# Transitioning between states). # Transitioning between states).
#fst_llt=100 #fst_llt=100
# BSS Transition Management
# disable_btm - Disable BSS transition management in STA
# Set to 0 to enable BSS transition management (default behavior)
# Set to 1 to disable BSS transition management
#disable_btm=0
# Example blocks: # Example blocks:
# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers