aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/process.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-03 17:28:40 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-03 17:28:40 (GMT)
commitfb8f5fc6fd9534721a9ce2ce4af479e585062add (patch)
tree591e59b843caf88231015b7f97b796ac467401e3 /wlantest/process.c
parent1da4da6f76d17399c72ddb295e0d9d298e2f919e (diff)
downloadhostap-fb8f5fc6fd9534721a9ce2ce4af479e585062add.zip
hostap-fb8f5fc6fd9534721a9ce2ce4af479e585062add.tar.gz
hostap-fb8f5fc6fd9534721a9ce2ce4af479e585062add.tar.bz2
wlantest: Count number of STA ACK'ed Deauth/Disassoc frames
Diffstat (limited to 'wlantest/process.c')
-rw-r--r--wlantest/process.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/wlantest/process.c b/wlantest/process.c
index 6cdb10b..f740a64 100644
--- a/wlantest/process.c
+++ b/wlantest/process.c
@@ -100,6 +100,25 @@ static int rx_duplicate(struct wlantest *wt, const struct ieee80211_hdr *hdr,
}
+static void rx_ack(struct wlantest *wt, const struct ieee80211_hdr *hdr)
+{
+ struct ieee80211_hdr *last = (struct ieee80211_hdr *) wt->last_hdr;
+ u16 fc;
+
+ if (wt->last_len < 24 || (last->addr1[0] & 0x01) ||
+ os_memcmp(hdr->addr1, last->addr2, ETH_ALEN) != 0) {
+ wpa_printf(MSG_MSGDUMP, "Unknown Ack frame (previous frame "
+ "not seen)");
+ return;
+ }
+
+ /* Ack to the previous frame */
+ fc = le_to_host16(last->frame_control);
+ if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT)
+ rx_mgmt_ack(wt, last);
+}
+
+
static void rx_frame(struct wlantest *wt, const u8 *data, size_t len)
{
const struct ieee80211_hdr *hdr;
@@ -129,6 +148,8 @@ static void rx_frame(struct wlantest *wt, const u8 *data, size_t len)
if (len < 10)
break;
wt->rx_ctrl++;
+ if (WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_ACK)
+ rx_ack(wt, hdr);
break;
case WLAN_FC_TYPE_DATA:
if (len < 24)
@@ -142,6 +163,10 @@ static void rx_frame(struct wlantest *wt, const u8 *data, size_t len)
WLAN_FC_GET_TYPE(fc));
break;
}
+
+ os_memcpy(wt->last_hdr, data, len > sizeof(wt->last_hdr) ?
+ sizeof(wt->last_hdr) : len);
+ wt->last_len = len;
}