]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Provide option to disable/enable BTM support in STA
authorAnkita Bajaj <bankita@codeaurora.org>
Thu, 30 May 2019 14:14:55 +0000 (19:44 +0530)
committerJouni Malinen <jouni@codeaurora.org>
Fri, 14 Jun 2019 20:10:51 +0000 (23:10 +0300)
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>
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant.conf

index e7cba4847e5baee0624dde0f5dcb6b75b4b03bc5..7a62f96d6e7737618a8082718fc3e576cee3ff18 100644 (file)
@@ -4869,6 +4869,9 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
        { INT_RANGE(dpp_config_processing, 0, 2), 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
index abbd8c90e2b5d656a8ce35694a97d252bf580631..6a297ecfe5bd6d40f6c31dd698183e504452608f 100644 (file)
@@ -374,6 +374,7 @@ struct wpa_cred {
 #define CFG_CHANGED_P2P_PASSPHRASE_LEN BIT(16)
 #define CFG_CHANGED_SCHED_SCAN_PLANS BIT(17)
 #define CFG_CHANGED_WOWLAN_TRIGGERS BIT(18)
+#define CFG_CHANGED_DISABLE_BTM BIT(19)
 
 /**
  * struct wpa_config - wpa_supplicant configuration data
@@ -1527,6 +1528,15 @@ struct wpa_config {
         * By default, permanent MAC address is used.
         */
        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;
 };
 
 
index fe5a0115a436cd54e3657970c8d106c6e85ec456..77c326df54de212f01535ceb66bed71f2036a358 100644 (file)
@@ -1545,6 +1545,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
        if (config->p2p_interface_random_mac_addr)
                fprintf(f, "p2p_interface_random_mac_addr=%d\n",
                        config->p2p_interface_random_mac_addr);
+       if (config->disable_btm)
+               fprintf(f, "disable_btm=1\n");
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
index f5a4cb739e4bcd3cee79b4856bd803528811b5b8..c14764963b781c5d3a958e4761dac199de147685 100644 (file)
@@ -1371,6 +1371,9 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
        const u8 *vendor;
 #endif /* CONFIG_MBO */
 
+       if (wpa_s->conf->disable_btm)
+               return;
+
        if (end - pos < 5)
                return;
 
index f82d18fe27c6604291e5973801bdbcff9db184e8..2002b129fc32a93221062a5d3864fafffdb178db 100644 (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 */
 #ifdef CONFIG_WNM
                *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 */
                break;
        case 3: /* Bits 24-31 */
@@ -6630,6 +6631,9 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s)
                                   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
        wpas_wps_update_config(wpa_s);
 #endif /* CONFIG_WPS */
index 842a8dbe01e9e1940e9db7a5261f17f12f3d0b31..1159bdcdc59bb2fcab6beed4278731a0453681a2 100644 (file)
@@ -1516,6 +1516,12 @@ fast_reauth=1
 # Transitioning between states).
 #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:
 
 # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers