wlantest: Add counters for AP deauth/disassoc while asleep/awake

These can be used to check whether the STA is in power save mode
and because of that, is not seeing disconnection notifications.
This commit is contained in:
Jouni Malinen 2011-01-07 16:52:56 +02:00 committed by Jouni Malinen
parent 7e7a57ae3f
commit e7ba4e2c74
3 changed files with 22 additions and 4 deletions

View file

@ -204,10 +204,14 @@ static void rx_mgmt_deauth(struct wlantest *wt, const u8 *data, size_t len,
return; return;
} }
if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) {
sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DEAUTH_RX : sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DEAUTH_RX :
WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX]++; WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX]++;
if (sta->pwrmgt && !sta->pspoll)
sta->counters[WLANTEST_STA_COUNTER_DEAUTH_RX_ASLEEP]++;
else else
sta->counters[WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE]++;
} else
sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DEAUTH_TX : sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DEAUTH_TX :
WLANTEST_STA_COUNTER_INVALID_DEAUTH_TX]++; WLANTEST_STA_COUNTER_INVALID_DEAUTH_TX]++;
@ -529,10 +533,16 @@ static void rx_mgmt_disassoc(struct wlantest *wt, const u8 *data, size_t len,
return; return;
} }
if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) {
sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DISASSOC_RX : sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DISASSOC_RX :
WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX]++; WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX]++;
if (sta->pwrmgt && !sta->pspoll)
sta->counters[
WLANTEST_STA_COUNTER_DISASSOC_RX_ASLEEP]++;
else else
sta->counters[
WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE]++;
} else
sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DISASSOC_TX : sta->counters[valid ? WLANTEST_STA_COUNTER_VALID_DISASSOC_TX :
WLANTEST_STA_COUNTER_INVALID_DISASSOC_TX]++; WLANTEST_STA_COUNTER_INVALID_DISASSOC_TX]++;

View file

@ -547,6 +547,10 @@ static const struct sta_counters sta_counters[] = {
WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK }, WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK },
{ "invalid_disassoc_rx_ack", { "invalid_disassoc_rx_ack",
WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK }, WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK },
{ "deauth_rx_asleep", WLANTEST_STA_COUNTER_DEAUTH_RX_ASLEEP },
{ "deauth_rx_awake", WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE },
{ "disassoc_rx_asleep", WLANTEST_STA_COUNTER_DISASSOC_RX_ASLEEP },
{ "disassoc_rx_awake", WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE },
{ NULL, 0 } { NULL, 0 }
}; };

View file

@ -101,6 +101,10 @@ enum wlantest_sta_counter {
WLANTEST_STA_COUNTER_VALID_DISASSOC_RX_ACK, WLANTEST_STA_COUNTER_VALID_DISASSOC_RX_ACK,
WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK, WLANTEST_STA_COUNTER_INVALID_DEAUTH_RX_ACK,
WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK, WLANTEST_STA_COUNTER_INVALID_DISASSOC_RX_ACK,
WLANTEST_STA_COUNTER_DEAUTH_RX_ASLEEP,
WLANTEST_STA_COUNTER_DEAUTH_RX_AWAKE,
WLANTEST_STA_COUNTER_DISASSOC_RX_ASLEEP,
WLANTEST_STA_COUNTER_DISASSOC_RX_AWAKE,
NUM_WLANTEST_STA_COUNTER NUM_WLANTEST_STA_COUNTER
}; };