]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Add per-STA counter for (Re)AssocResp comeback frames
authorJouni Malinen <j@w1.fi>
Sun, 21 Nov 2010 19:24:20 +0000 (21:24 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 21 Nov 2010 19:24:20 +0000 (21:24 +0200)
wlantest/rx_mgmt.c
wlantest/wlantest_cli.c
wlantest/wlantest_ctrl.h

index e9ab330352965352201a09530f1e141a7f0c28ec..4921d8d56c35b0e5bfcf59927112ad341d06e754 100644 (file)
@@ -290,6 +290,26 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len)
                   MAC2STR(mgmt->sa), MAC2STR(mgmt->da), capab, status,
                   aid & 0x3fff);
 
+       if (status == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY) {
+               struct ieee802_11_elems elems;
+               const u8 *ies = mgmt->u.assoc_resp.variable;
+               size_t ies_len = len - (mgmt->u.assoc_resp.variable - data);
+               if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) ==
+                   ParseFailed) {
+                       wpa_printf(MSG_INFO, "Failed to parse IEs in "
+                                  "AssocResp from " MACSTR,
+                                  MAC2STR(mgmt->sa));
+               } else if (elems.timeout_int == 0 ||
+                          elems.timeout_int_len != 5) {
+                       wpa_printf(MSG_INFO, "No valid Timeout Interval IE in "
+                                  "AssocResp (status=30) from " MACSTR,
+                                  MAC2STR(mgmt->sa));
+               } else {
+                       sta->counters[
+                               WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK]++;
+               }
+       }
+
        if (status)
                return;
 
@@ -399,6 +419,26 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
                   MAC2STR(mgmt->sa), MAC2STR(mgmt->da), capab, status,
                   aid & 0x3fff);
 
+       if (status == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY) {
+               struct ieee802_11_elems elems;
+               const u8 *ies = mgmt->u.reassoc_resp.variable;
+               size_t ies_len = len - (mgmt->u.reassoc_resp.variable - data);
+               if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) ==
+                   ParseFailed) {
+                       wpa_printf(MSG_INFO, "Failed to parse IEs in "
+                                  "ReassocResp from " MACSTR,
+                                  MAC2STR(mgmt->sa));
+               } else if (elems.timeout_int == 0 ||
+                          elems.timeout_int_len != 5) {
+                       wpa_printf(MSG_INFO, "No valid Timeout Interval IE in "
+                                  "ReassocResp (status=30) from " MACSTR,
+                                  MAC2STR(mgmt->sa));
+               } else {
+                       sta->counters[
+                               WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK]++;
+               }
+       }
+
        if (status)
                return;
 
index 290aa2c0b24aea452fc13cce40ea9b5dab6031e8..301d6f80351fc468fabf074adc1272c8b3b32009 100644 (file)
@@ -462,6 +462,8 @@ static const struct sta_counters sta_counters[] = {
        { "invalid_saqueryresp_rx",
          WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_RX },
        { "ping_ok", WLANTEST_STA_COUNTER_PING_OK },
+       { "assocresp_comeback", WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK },
+       { "reassocresp_comeback", WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK },
        { NULL, 0 }
 };
 
index a6de9acae9d8d1691da1662c6eec7c973e04bbbb..eeaa5f94d2488444415b7ca86a7984047ca7587e 100644 (file)
@@ -86,6 +86,8 @@ enum wlantest_sta_counter {
        WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_TX,
        WLANTEST_STA_COUNTER_INVALID_SAQUERYRESP_RX,
        WLANTEST_STA_COUNTER_PING_OK,
+       WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK,
+       WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK,
        NUM_WLANTEST_STA_COUNTER
 };