wlantest: Add per-STA counter for (Re)AssocResp comeback frames

This commit is contained in:
Jouni Malinen 2010-11-21 21:24:20 +02:00
parent fc686b1994
commit cdd71e307e
3 changed files with 44 additions and 0 deletions

View 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;

View 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 }
};

View 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
};