aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/rx_data.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-20 20:34:42 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-20 20:34:42 (GMT)
commitee3b84beb3829339107826add05dd3bc894f54f5 (patch)
tree9074281011ae3adf674675d10e232b6ac192672e /wlantest/rx_data.c
parentaebe76594bea12ba7ae139e05853c7e8a678759e (diff)
downloadhostap-ee3b84beb3829339107826add05dd3bc894f54f5.zip
hostap-ee3b84beb3829339107826add05dd3bc894f54f5.tar.gz
hostap-ee3b84beb3829339107826add05dd3bc894f54f5.tar.bz2
wlantest: Parse ICMP echo packet and record STA ping success
Diffstat (limited to 'wlantest/rx_data.c')
-rw-r--r--wlantest/rx_data.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/wlantest/rx_data.c b/wlantest/rx_data.c
index 3c59f1f..a344054 100644
--- a/wlantest/rx_data.c
+++ b/wlantest/rx_data.c
@@ -13,6 +13,7 @@
*/
#include "utils/includes.h"
+#include <linux/if_ether.h>
#include "utils/common.h"
#include "common/defs.h"
@@ -58,23 +59,32 @@ static const char * data_stype(u16 stype)
}
-static void rx_data_eth(struct wlantest *wt, const u8 *dst, const u8 *src,
+static void rx_data_eth(struct wlantest *wt, const u8 *bssid,
+ const u8 *sta_addr, const u8 *dst, const u8 *src,
u16 ethertype, const u8 *data, size_t len, int prot)
{
- if (ethertype == ETH_P_PAE)
+ switch (ethertype) {
+ case ETH_P_PAE:
rx_data_eapol(wt, dst, src, data, len, prot);
+ break;
+ case ETH_P_IP:
+ rx_data_ip(wt, bssid, sta_addr, dst, src, data, len);
+ break;
+ }
}
-static void rx_data_process(struct wlantest *wt, const u8 *dst, const u8 *src,
+static void rx_data_process(struct wlantest *wt, const u8 *bssid,
+ const u8 *sta_addr,
+ const u8 *dst, const u8 *src,
const u8 *data, size_t len, int prot)
{
if (len == 0)
return;
if (len >= 8 && os_memcmp(data, "\xaa\xaa\x03\x00\x00\x00", 6) == 0) {
- rx_data_eth(wt, dst, src, WPA_GET_BE16(data + 6),
- data + 8, len - 8, prot);
+ rx_data_eth(wt, bssid, sta_addr, dst, src,
+ WPA_GET_BE16(data + 6), data + 8, len - 8, prot);
return;
}
@@ -156,7 +166,8 @@ static void rx_data_bss_prot_group(struct wlantest *wt,
decrypted = ccmp_decrypt(bss->gtk[keyid], hdr, data, len,
&dlen);
if (decrypted) {
- rx_data_process(wt, dst, src, decrypted, dlen, 1);
+ rx_data_process(wt, bss->bssid, NULL, dst, src, decrypted,
+ dlen, 1);
os_memcpy(bss->rsc[keyid], pn, 6);
write_pcap_decrypted(wt, (const u8 *) hdr, 24 + (qos ? 2 : 0),
decrypted, dlen);
@@ -267,7 +278,8 @@ static void rx_data_bss_prot(struct wlantest *wt,
else
decrypted = ccmp_decrypt(sta->ptk.tk1, hdr, data, len, &dlen);
if (decrypted) {
- rx_data_process(wt, dst, src, decrypted, dlen, 1);
+ rx_data_process(wt, bss->bssid, sta->addr, dst, src, decrypted,
+ dlen, 1);
os_memcpy(rsc, pn, 6);
write_pcap_decrypted(wt, (const u8 *) hdr, 24 + (qos ? 2 : 0),
decrypted, dlen);
@@ -302,8 +314,17 @@ static void rx_data_bss(struct wlantest *wt, const struct ieee80211_hdr *hdr,
if (prot)
rx_data_bss_prot(wt, hdr, qos, dst, src, data, len);
- else
- rx_data_process(wt, dst, src, data, len, 0);
+ else {
+ const u8 *bssid, *sta_addr;
+ if (fc & WLAN_FC_TODS) {
+ bssid = hdr->addr1;
+ sta_addr = hdr->addr2;
+ } else {
+ bssid = hdr->addr2;
+ sta_addr = hdr->addr1;
+ }
+ rx_data_process(wt, bssid, sta_addr, dst, src, data, len, 0);
+ }
}