wlantest: Add counters for TDLS setup frames
This commit is contained in:
parent
8a1cf4be21
commit
eb4923fdae
3 changed files with 25 additions and 3 deletions
|
@ -188,6 +188,7 @@ static void rx_data_tdls_setup_request(struct wlantest *wt, const u8 *bssid,
|
||||||
const u8 *data, size_t len)
|
const u8 *data, size_t len)
|
||||||
{
|
{
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
|
struct wlantest_tdls *tdls;
|
||||||
|
|
||||||
if (len < 3)
|
if (len < 3)
|
||||||
return;
|
return;
|
||||||
|
@ -201,7 +202,9 @@ static void rx_data_tdls_setup_request(struct wlantest *wt, const u8 *bssid,
|
||||||
" initiator STA " MACSTR " responder STA " MACSTR,
|
" initiator STA " MACSTR " responder STA " MACSTR,
|
||||||
MAC2STR(elems.link_id), MAC2STR(elems.link_id + ETH_ALEN),
|
MAC2STR(elems.link_id), MAC2STR(elems.link_id + ETH_ALEN),
|
||||||
MAC2STR(elems.link_id + 2 * 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);
|
tdls = get_tdls(wt, elems.link_id);
|
||||||
if (!tdls)
|
if (!tdls)
|
||||||
return;
|
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)
|
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
|
||||||
return;
|
return;
|
||||||
if (tdls_verify_mic(tdls, 2, &elems) == 0) {
|
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 " -> "
|
wpa_printf(MSG_DEBUG, "TDLS Setup Confirm " MACSTR " -> "
|
||||||
MACSTR " (status %d)",
|
MACSTR " (status %d)",
|
||||||
MAC2STR(src), MAC2STR(dst), status);
|
MAC2STR(src), MAC2STR(dst), status);
|
||||||
if (status != WLAN_STATUS_SUCCESS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ieee802_11_parse_elems(data + 3, len - 3, &elems, 1) ==
|
if (ieee802_11_parse_elems(data + 3, len - 3, &elems, 1) ==
|
||||||
ParseFailed || elems.link_id == NULL)
|
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);
|
tdls = get_tdls(wt, elems.link_id);
|
||||||
if (tdls == NULL)
|
if (tdls == NULL)
|
||||||
return;
|
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;
|
tdls->link_up = 1;
|
||||||
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
|
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
|
||||||
|
|
|
@ -752,6 +752,11 @@ static const struct tdls_counters tdls_counters[] = {
|
||||||
{ "invalid_direct_link", WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK },
|
{ "invalid_direct_link", WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK },
|
||||||
{ "valid_ap_path", WLANTEST_TDLS_COUNTER_VALID_AP_PATH },
|
{ "valid_ap_path", WLANTEST_TDLS_COUNTER_VALID_AP_PATH },
|
||||||
{ "invalid_ap_path", WLANTEST_TDLS_COUNTER_INVALID_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 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,11 @@ enum wlantest_tdls_counter {
|
||||||
WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK,
|
WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK,
|
||||||
WLANTEST_TDLS_COUNTER_VALID_AP_PATH,
|
WLANTEST_TDLS_COUNTER_VALID_AP_PATH,
|
||||||
WLANTEST_TDLS_COUNTER_INVALID_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
|
NUM_WLANTEST_TDLS_COUNTER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue