WNM: Add testing option to reject BSS Transition Management Request
authorvamsi krishna <vamsin@qti.qualcomm.com>
Thu, 15 Sep 2016 08:35:53 +0000 (14:05 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 25 Sep 2016 14:31:26 +0000 (17:31 +0300)
For testing purposes, it is useful to have an option to be able to
reject BTM Request sent by AP in order to verify the AP behavior upon
BTM Request rejection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant_i.h

index 231464f..4131833 100644 (file)
@@ -515,6 +515,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
                wpa_s->ignore_auth_resp = !!atoi(value);
        } else if (os_strcasecmp(cmd, "ignore_assoc_disallow") == 0) {
                wpa_s->ignore_assoc_disallow = !!atoi(value);
+       } else if (os_strcasecmp(cmd, "reject_btm_req_reason") == 0) {
+               wpa_s->reject_btm_req_reason = atoi(value);
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifndef CONFIG_NO_CONFIG_BLOBS
        } else if (os_strcmp(cmd, "blob") == 0) {
@@ -7205,6 +7207,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
        wpa_s->p2p_go_csa_on_inv = 0;
        wpa_s->ignore_auth_resp = 0;
        wpa_s->ignore_assoc_disallow = 0;
+       wpa_s->reject_btm_req_reason = 0;
        wpa_sm_set_test_assoc_ie(wpa_s->wpa, NULL);
 #endif /* CONFIG_TESTING_OPTIONS */
 
index 7674825..1b3409c 100644 (file)
@@ -1159,6 +1159,19 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
                   wpa_s->wnm_dialog_token, wpa_s->wnm_mode,
                   wpa_s->wnm_dissoc_timer, valid_int);
 
+#if defined(CONFIG_MBO) && defined(CONFIG_TESTING_OPTIONS)
+       if (wpa_s->reject_btm_req_reason) {
+               wpa_printf(MSG_INFO,
+                          "WNM: Testing - reject BSS Transition Management Request: reject_btm_req_reason=%d",
+                          wpa_s->reject_btm_req_reason);
+               wnm_send_bss_transition_mgmt_resp(wpa_s,
+                                                 wpa_s->wnm_dialog_token,
+                                                 wpa_s->reject_btm_req_reason,
+                                                 0, NULL);
+               return;
+       }
+#endif /* CONFIG_MBO && CONFIG_TESTING_OPTIONS */
+
        pos += 5;
 
        if (wpa_s->wnm_mode & WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED) {
index 3b58593..9455e25 100644 (file)
@@ -1023,6 +1023,7 @@ struct wpa_supplicant {
        struct l2_packet_data *l2_test;
        unsigned int extra_roc_dur;
        enum wpa_supplicant_test_failure test_failure;
+       unsigned int reject_btm_req_reason;
        unsigned int p2p_go_csa_on_inv:1;
        unsigned int ignore_auth_resp:1;
        unsigned int ignore_assoc_disallow:1;