aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-01-24 12:03:03 (GMT)
committerJouni Malinen <j@w1.fi>2011-01-24 12:03:03 (GMT)
commiteb4923fdae82a8d9609762bfc87d3012e9f29414 (patch)
treed7e7fe2e5213528313cf7feb0b847224025b4ab6 /wlantest
parent8a1cf4be21ffe223997ec28c0e9f2be362db00f2 (diff)
downloadhostap-eb4923fdae82a8d9609762bfc87d3012e9f29414.zip
hostap-eb4923fdae82a8d9609762bfc87d3012e9f29414.tar.gz
hostap-eb4923fdae82a8d9609762bfc87d3012e9f29414.tar.bz2
wlantest: Add counters for TDLS setup frames
Diffstat (limited to 'wlantest')
-rw-r--r--wlantest/rx_tdls.c18
-rw-r--r--wlantest/wlantest_cli.c5
-rw-r--r--wlantest/wlantest_ctrl.h5
3 files changed, 25 insertions, 3 deletions
diff --git a/wlantest/rx_tdls.c b/wlantest/rx_tdls.c
index 05509b4..fd18c08 100644
--- a/wlantest/rx_tdls.c
+++ b/wlantest/rx_tdls.c
@@ -188,6 +188,7 @@ static void rx_data_tdls_setup_request(struct wlantest *wt, const u8 *bssid,
const u8 *data, size_t len)
{
struct ieee802_11_elems elems;
+ struct wlantest_tdls *tdls;
if (len < 3)
return;
@@ -201,7 +202,9 @@ static void rx_data_tdls_setup_request(struct wlantest *wt, const u8 *bssid,
" initiator STA " MACSTR " responder STA " MACSTR,
MAC2STR(elems.link_id), MAC2STR(elems.link_id + ETH_ALEN),
MAC2STR(elems.link_id + 2 * ETH_ALEN));
- get_tdls(wt, elems.link_id);
+ tdls = get_tdls(wt, elems.link_id);
+ if (tdls)
+ tdls->counters[WLANTEST_TDLS_COUNTER_SETUP_REQ]++;
}
@@ -234,6 +237,10 @@ static void rx_data_tdls_setup_response(struct wlantest *wt, const u8 *bssid,
tdls = get_tdls(wt, elems.link_id);
if (!tdls)
return;
+ if (status)
+ tdls->counters[WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL]++;
+ else
+ tdls->counters[WLANTEST_TDLS_COUNTER_SETUP_RESP_OK]++;
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
return;
if (tdls_verify_mic(tdls, 2, &elems) == 0) {
@@ -259,8 +266,6 @@ static void rx_data_tdls_setup_confirm(struct wlantest *wt, const u8 *bssid,
wpa_printf(MSG_DEBUG, "TDLS Setup Confirm " MACSTR " -> "
MACSTR " (status %d)",
MAC2STR(src), MAC2STR(dst), status);
- if (status != WLAN_STATUS_SUCCESS)
- return;
if (ieee802_11_parse_elems(data + 3, len - 3, &elems, 1) ==
ParseFailed || elems.link_id == NULL)
@@ -273,6 +278,13 @@ static void rx_data_tdls_setup_confirm(struct wlantest *wt, const u8 *bssid,
tdls = get_tdls(wt, elems.link_id);
if (tdls == NULL)
return;
+ if (status)
+ tdls->counters[WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL]++;
+ else
+ tdls->counters[WLANTEST_TDLS_COUNTER_SETUP_CONF_OK]++;
+
+ if (status != WLAN_STATUS_SUCCESS)
+ return;
tdls->link_up = 1;
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
diff --git a/wlantest/wlantest_cli.c b/wlantest/wlantest_cli.c
index 4b99c0e..05e0121 100644
--- a/wlantest/wlantest_cli.c
+++ b/wlantest/wlantest_cli.c
@@ -752,6 +752,11 @@ static const struct tdls_counters tdls_counters[] = {
{ "invalid_direct_link", WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK },
{ "valid_ap_path", WLANTEST_TDLS_COUNTER_VALID_AP_PATH },
{ "invalid_ap_path", WLANTEST_TDLS_COUNTER_INVALID_AP_PATH },
+ { "setup_req", WLANTEST_TDLS_COUNTER_SETUP_REQ },
+ { "setup_resp_ok", WLANTEST_TDLS_COUNTER_SETUP_RESP_OK },
+ { "setup_resp_fail", WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL },
+ { "setup_conf_ok", WLANTEST_TDLS_COUNTER_SETUP_CONF_OK },
+ { "setup_conf_fail", WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL },
{ NULL, 0 }
};
diff --git a/wlantest/wlantest_ctrl.h b/wlantest/wlantest_ctrl.h
index be26eff..9bcee2b 100644
--- a/wlantest/wlantest_ctrl.h
+++ b/wlantest/wlantest_ctrl.h
@@ -114,6 +114,11 @@ enum wlantest_tdls_counter {
WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK,
WLANTEST_TDLS_COUNTER_VALID_AP_PATH,
WLANTEST_TDLS_COUNTER_INVALID_AP_PATH,
+ WLANTEST_TDLS_COUNTER_SETUP_REQ,
+ WLANTEST_TDLS_COUNTER_SETUP_RESP_OK,
+ WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL,
+ WLANTEST_TDLS_COUNTER_SETUP_CONF_OK,
+ WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL,
NUM_WLANTEST_TDLS_COUNTER
};