aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/rx_tdls.c
diff options
context:
space:
mode:
Diffstat (limited to 'wlantest/rx_tdls.c')
-rw-r--r--wlantest/rx_tdls.c85
1 files changed, 43 insertions, 42 deletions
diff --git a/wlantest/rx_tdls.c b/wlantest/rx_tdls.c
index 08a29a5..1c506ac 100644
--- a/wlantest/rx_tdls.c
+++ b/wlantest/rx_tdls.c
@@ -28,11 +28,11 @@ static struct wlantest_tdls * get_tdls(struct wlantest *wt, const u8 *linkid,
if (bss == NULL && bssid) {
bss = bss_find(wt, bssid);
if (bss)
- wpa_printf(MSG_INFO, "TDLS: Incorrect BSSID " MACSTR
- " in LinkId?! (init=" MACSTR " resp="
- MACSTR ")",
- MAC2STR(linkid), MAC2STR(linkid + ETH_ALEN),
- MAC2STR(linkid + 2 * ETH_ALEN));
+ add_note(wt, MSG_INFO, "TDLS: Incorrect BSSID " MACSTR
+ " in LinkId?! (init=" MACSTR " resp="
+ MACSTR ")",
+ MAC2STR(linkid), MAC2STR(linkid + ETH_ALEN),
+ MAC2STR(linkid + 2 * ETH_ALEN));
}
if (bss == NULL)
return NULL;
@@ -125,8 +125,8 @@ static int tdls_derive_tpk(struct wlantest_tdls *tdls, const u8 *bssid,
}
-static int tdls_verify_mic(struct wlantest_tdls *tdls, u8 trans_seq,
- struct ieee802_11_elems *elems)
+static int tdls_verify_mic(struct wlantest *wt, struct wlantest_tdls *tdls,
+ u8 trans_seq, struct ieee802_11_elems *elems)
{
u8 *buf, *pos;
int len;
@@ -181,10 +181,10 @@ static int tdls_verify_mic(struct wlantest_tdls *tdls, u8 trans_seq,
rx_ftie = (const struct rsn_ftie *) elems->ftie;
if (os_memcmp(mic, rx_ftie->mic, 16) == 0) {
- wpa_printf(MSG_DEBUG, "TDLS: Valid MIC");
+ add_note(wt, MSG_DEBUG, "TDLS: Valid MIC");
return 0;
}
- wpa_printf(MSG_DEBUG, "TDLS: Invalid MIC");
+ add_note(wt, MSG_DEBUG, "TDLS: Invalid MIC");
return -1;
}
@@ -198,8 +198,8 @@ static void rx_data_tdls_setup_request(struct wlantest *wt, const u8 *bssid,
struct wlantest_tdls *tdls;
if (len < 3) {
- wpa_printf(MSG_INFO, "Too short TDLS Setup Request " MACSTR
- " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
+ add_note(wt, MSG_INFO, "Too short TDLS Setup Request " MACSTR
+ " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
return;
}
wpa_printf(MSG_DEBUG, "TDLS Setup Request " MACSTR " -> "
@@ -230,8 +230,8 @@ static void rx_data_tdls_setup_response_failure(struct wlantest *wt,
struct wlantest_sta *sta;
if (status == WLAN_STATUS_SUCCESS) {
- wpa_printf(MSG_INFO, "TDLS: Invalid TDLS Setup Response from "
- MACSTR, MAC2STR(sta_addr));
+ add_note(wt, MSG_INFO, "TDLS: Invalid TDLS Setup Response from "
+ MACSTR, MAC2STR(sta_addr));
return;
}
@@ -245,13 +245,13 @@ static void rx_data_tdls_setup_response_failure(struct wlantest *wt,
dl_list_for_each(tdls, &bss->tdls, struct wlantest_tdls, list) {
if (tdls->resp == sta) {
if (dialog_token != tdls->dialog_token) {
- wpa_printf(MSG_DEBUG, "TDLS: Dialog token "
- "mismatch in TDLS Setup Response "
- "(failure)");
+ add_note(wt, MSG_DEBUG, "TDLS: Dialog token "
+ "mismatch in TDLS Setup Response "
+ "(failure)");
break;
}
- wpa_printf(MSG_DEBUG, "TDLS: Found matching TDLS "
- "setup session based on dialog token");
+ add_note(wt, MSG_DEBUG, "TDLS: Found matching TDLS "
+ "setup session based on dialog token");
tdls->counters[
WLANTEST_TDLS_COUNTER_SETUP_RESP_FAIL]++;
break;
@@ -270,8 +270,8 @@ static void rx_data_tdls_setup_response(struct wlantest *wt, const u8 *bssid,
struct wlantest_tdls *tdls;
if (len < 3) {
- wpa_printf(MSG_INFO, "Too short TDLS Setup Response " MACSTR
- " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
+ add_note(wt, MSG_INFO, "Too short TDLS Setup Response " MACSTR
+ " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
return;
}
status = WPA_GET_LE16(data);
@@ -279,8 +279,8 @@ static void rx_data_tdls_setup_response(struct wlantest *wt, const u8 *bssid,
MACSTR " (status %d)",
MAC2STR(src), MAC2STR(dst), status);
if (len < 5 && status == 0) {
- wpa_printf(MSG_INFO, "Too short TDLS Setup Response " MACSTR
- " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
+ add_note(wt, MSG_INFO, "Too short TDLS Setup Response " MACSTR
+ " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
return;
}
@@ -310,10 +310,10 @@ static void rx_data_tdls_setup_response(struct wlantest *wt, const u8 *bssid,
if (tdls_derive_tpk(tdls, bssid, elems.ftie, elems.ftie_len) < 1)
return;
- if (tdls_verify_mic(tdls, 2, &elems) == 0) {
+ if (tdls_verify_mic(wt, tdls, 2, &elems) == 0) {
tdls->dialog_token = data[2];
- wpa_printf(MSG_DEBUG, "TDLS: Dialog Token for the link: %u",
- tdls->dialog_token);
+ add_note(wt, MSG_DEBUG, "TDLS: Dialog Token for the link: %u",
+ tdls->dialog_token);
}
}
@@ -328,8 +328,8 @@ static void rx_data_tdls_setup_confirm_failure(struct wlantest *wt,
struct wlantest_sta *sta;
if (status == WLAN_STATUS_SUCCESS) {
- wpa_printf(MSG_INFO, "TDLS: Invalid TDLS Setup Confirm from "
- MACSTR, MAC2STR(src));
+ add_note(wt, MSG_INFO, "TDLS: Invalid TDLS Setup Confirm from "
+ MACSTR, MAC2STR(src));
return;
}
@@ -343,13 +343,13 @@ static void rx_data_tdls_setup_confirm_failure(struct wlantest *wt,
dl_list_for_each(tdls, &bss->tdls, struct wlantest_tdls, list) {
if (tdls->init == sta) {
if (dialog_token != tdls->dialog_token) {
- wpa_printf(MSG_DEBUG, "TDLS: Dialog token "
- "mismatch in TDLS Setup Confirm "
- "(failure)");
+ add_note(wt, MSG_DEBUG, "TDLS: Dialog token "
+ "mismatch in TDLS Setup Confirm "
+ "(failure)");
break;
}
- wpa_printf(MSG_DEBUG, "TDLS: Found matching TDLS "
- "setup session based on dialog token");
+ add_note(wt, MSG_DEBUG, "TDLS: Found matching TDLS "
+ "setup session based on dialog token");
tdls->counters[
WLANTEST_TDLS_COUNTER_SETUP_CONF_FAIL]++;
break;
@@ -369,8 +369,8 @@ static void rx_data_tdls_setup_confirm(struct wlantest *wt, const u8 *bssid,
u8 link_id[3 * ETH_ALEN];
if (len < 3) {
- wpa_printf(MSG_INFO, "Too short TDLS Setup Confirm " MACSTR
- " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
+ add_note(wt, MSG_INFO, "Too short TDLS Setup Confirm " MACSTR
+ " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
return;
}
status = WPA_GET_LE16(data);
@@ -407,10 +407,10 @@ static void rx_data_tdls_setup_confirm(struct wlantest *wt, const u8 *bssid,
goto remove_reverse;
return;
}
- if (tdls_verify_mic(tdls, 3, &elems) == 0) {
+ if (tdls_verify_mic(wt, tdls, 3, &elems) == 0) {
tdls->dialog_token = data[2];
- wpa_printf(MSG_DEBUG, "TDLS: Dialog Token for the link: %u",
- tdls->dialog_token);
+ add_note(wt, MSG_DEBUG, "TDLS: Dialog Token for the link: %u",
+ tdls->dialog_token);
}
remove_reverse:
@@ -425,13 +425,14 @@ remove_reverse:
os_memcpy(link_id + 2 * ETH_ALEN, elems.link_id + ETH_ALEN, ETH_ALEN);
tdls = get_tdls(wt, link_id, 0, bssid);
if (tdls) {
- wpa_printf(MSG_DEBUG, "TDLS: Remove reverse link entry");
+ add_note(wt, MSG_DEBUG, "TDLS: Remove reverse link entry");
tdls_deinit(tdls);
}
}
-static int tdls_verify_mic_teardown(struct wlantest_tdls *tdls, u8 trans_seq,
+static int tdls_verify_mic_teardown(struct wlantest *wt,
+ struct wlantest_tdls *tdls, u8 trans_seq,
const u8 *reason_code,
struct ieee802_11_elems *elems)
{
@@ -479,10 +480,10 @@ static int tdls_verify_mic_teardown(struct wlantest_tdls *tdls, u8 trans_seq,
rx_ftie = (const struct rsn_ftie *) elems->ftie;
if (os_memcmp(mic, rx_ftie->mic, 16) == 0) {
- wpa_printf(MSG_DEBUG, "TDLS: Valid MIC");
+ add_note(wt, MSG_DEBUG, "TDLS: Valid MIC");
return 0;
}
- wpa_printf(MSG_DEBUG, "TDLS: Invalid MIC");
+ add_note(wt, MSG_DEBUG, "TDLS: Invalid MIC");
return -1;
}
@@ -515,7 +516,7 @@ static void rx_data_tdls_teardown(struct wlantest *wt, const u8 *bssid,
if (tdls) {
tdls->link_up = 0;
tdls->counters[WLANTEST_TDLS_COUNTER_TEARDOWN]++;
- tdls_verify_mic_teardown(tdls, 4, data, &elems);
+ tdls_verify_mic_teardown(wt, tdls, 4, data, &elems);
}
}