|
@@ -65,8 +65,8 @@ static void rx_mgmt_beacon(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
&elems, 0) == ParseFailed) {
|
|
|
if (bss->parse_error_reported)
|
|
|
return;
|
|
|
- wpa_printf(MSG_INFO, "Invalid IEs in a Beacon frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Invalid IEs in a Beacon frame from "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
bss->parse_error_reported = 1;
|
|
|
return;
|
|
|
}
|
|
@@ -92,8 +92,8 @@ static void rx_mgmt_probe_resp(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
&elems, 0) == ParseFailed) {
|
|
|
if (bss->parse_error_reported)
|
|
|
return;
|
|
|
- wpa_printf(MSG_INFO, "Invalid IEs in a Probe Response frame "
|
|
|
- "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Invalid IEs in a Probe Response frame "
|
|
|
+ "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
bss->parse_error_reported = 1;
|
|
|
return;
|
|
|
}
|
|
@@ -121,8 +121,8 @@ static void rx_mgmt_auth(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 6) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Authentication frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Authentication frame from "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -136,9 +136,9 @@ static void rx_mgmt_auth(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
|
|
|
if (alg == 0 && trans == 2 && status == 0) {
|
|
|
if (sta->state == STATE1) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 2 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 2 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE2;
|
|
|
}
|
|
|
}
|
|
@@ -150,28 +150,29 @@ static void rx_mgmt_auth(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void deauth_all_stas(struct wlantest_bss *bss)
|
|
|
+static void deauth_all_stas(struct wlantest *wt, struct wlantest_bss *bss)
|
|
|
{
|
|
|
struct wlantest_sta *sta;
|
|
|
dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
|
|
|
if (sta->state == STATE1)
|
|
|
continue;
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 1 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 1 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void tdls_link_down(struct wlantest_bss *bss, struct wlantest_sta *sta)
|
|
|
+static void tdls_link_down(struct wlantest *wt, struct wlantest_bss *bss,
|
|
|
+ struct wlantest_sta *sta)
|
|
|
{
|
|
|
struct wlantest_tdls *tdls;
|
|
|
dl_list_for_each(tdls, &bss->tdls, struct wlantest_tdls, list) {
|
|
|
if ((tdls->init == sta || tdls->resp == sta) && tdls->link_up)
|
|
|
{
|
|
|
- wpa_printf(MSG_DEBUG, "TDLS: Set link down based on "
|
|
|
- "STA deauth/disassoc");
|
|
|
+ add_note(wt, MSG_DEBUG, "TDLS: Set link down based on "
|
|
|
+ "STA deauth/disassoc");
|
|
|
tdls->link_up = 0;
|
|
|
}
|
|
|
}
|
|
@@ -196,8 +197,8 @@ static void rx_mgmt_deauth(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
sta = sta_get(bss, mgmt->sa);
|
|
|
|
|
|
if (len < 24 + 2) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Deauthentication frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Deauthentication frame from "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -210,7 +211,7 @@ static void rx_mgmt_deauth(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
|
|
|
if (sta == NULL) {
|
|
|
if (valid && mgmt->da[0] == 0xff)
|
|
|
- deauth_all_stas(bss);
|
|
|
+ deauth_all_stas(wt, bss);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -232,19 +233,19 @@ static void rx_mgmt_deauth(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
WLANTEST_STA_COUNTER_INVALID_DEAUTH_TX]++;
|
|
|
|
|
|
if (!valid) {
|
|
|
- wpa_printf(MSG_INFO, "Do not change STA " MACSTR " State "
|
|
|
- "since Disassociation frame was not protected "
|
|
|
- "correctly", MAC2STR(sta->addr));
|
|
|
+ add_note(wt, MSG_INFO, "Do not change STA " MACSTR " State "
|
|
|
+ "since Disassociation frame was not protected "
|
|
|
+ "correctly", MAC2STR(sta->addr));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (sta->state != STATE1) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 1 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 1 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE1;
|
|
|
}
|
|
|
- tdls_link_down(bss, sta);
|
|
|
+ tdls_link_down(wt, bss, sta);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -264,8 +265,8 @@ static void rx_mgmt_assoc_req(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 4) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Association Request frame "
|
|
|
- "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Association Request frame "
|
|
|
+ "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -280,8 +281,8 @@ static void rx_mgmt_assoc_req(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
if (ieee802_11_parse_elems(mgmt->u.assoc_req.variable,
|
|
|
len - (mgmt->u.assoc_req.variable - data),
|
|
|
&elems, 0) == ParseFailed) {
|
|
|
- wpa_printf(MSG_INFO, "Invalid IEs in Association Request "
|
|
|
- "frame from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Invalid IEs in Association Request "
|
|
|
+ "frame from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -315,8 +316,8 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 6) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Association Response frame "
|
|
|
- "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Association Response frame "
|
|
|
+ "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -335,17 +336,17 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
size_t ies_len = len - (mgmt->u.assoc_resp.variable - data);
|
|
|
if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) ==
|
|
|
ParseFailed) {
|
|
|
- wpa_printf(MSG_INFO, "Failed to parse IEs in "
|
|
|
- "AssocResp from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Failed to parse IEs in "
|
|
|
+ "AssocResp from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
} else if (elems.timeout_int == NULL ||
|
|
|
elems.timeout_int_len != 5 ||
|
|
|
elems.timeout_int[0] !=
|
|
|
WLAN_TIMEOUT_ASSOC_COMEBACK) {
|
|
|
- wpa_printf(MSG_INFO, "No valid Timeout Interval IE "
|
|
|
- "with Assoc Comeback time in AssocResp "
|
|
|
- "(status=30) from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "No valid Timeout Interval IE "
|
|
|
+ "with Assoc Comeback time in AssocResp "
|
|
|
+ "(status=30) from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
} else {
|
|
|
sta->counters[
|
|
|
WLANTEST_STA_COUNTER_ASSOCRESP_COMEBACK]++;
|
|
@@ -356,21 +357,22 @@ static void rx_mgmt_assoc_resp(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
return;
|
|
|
|
|
|
if ((aid & 0xc000) != 0xc000) {
|
|
|
- wpa_printf(MSG_DEBUG, "Two MSBs of the AID were not set to 1 "
|
|
|
- "in Association Response from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_DEBUG, "Two MSBs of the AID were not set to 1 "
|
|
|
+ "in Association Response from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
}
|
|
|
sta->aid = aid & 0xc000;
|
|
|
|
|
|
if (sta->state < STATE2) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR " was not in State 2 when "
|
|
|
- "getting associated", MAC2STR(sta->addr));
|
|
|
+ add_note(wt, MSG_DEBUG,
|
|
|
+ "STA " MACSTR " was not in State 2 when "
|
|
|
+ "getting associated", MAC2STR(sta->addr));
|
|
|
}
|
|
|
|
|
|
if (sta->state < STATE3) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 3 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 3 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE3;
|
|
|
}
|
|
|
}
|
|
@@ -393,8 +395,8 @@ static void rx_mgmt_reassoc_req(struct wlantest *wt, const u8 *data,
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 4 + ETH_ALEN) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Reassociation Request frame "
|
|
|
- "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Reassociation Request frame "
|
|
|
+ "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -410,8 +412,8 @@ static void rx_mgmt_reassoc_req(struct wlantest *wt, const u8 *data,
|
|
|
if (ieee802_11_parse_elems(mgmt->u.reassoc_req.variable,
|
|
|
len - (mgmt->u.reassoc_req.variable - data),
|
|
|
&elems, 0) == ParseFailed) {
|
|
|
- wpa_printf(MSG_INFO, "Invalid IEs in Reassociation Request "
|
|
|
- "frame from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Invalid IEs in Reassociation Request "
|
|
|
+ "frame from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -447,8 +449,8 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 6) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Reassociation Response frame "
|
|
|
- "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Reassociation Response frame "
|
|
|
+ "from " MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -467,17 +469,17 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
|
|
|
size_t ies_len = len - (mgmt->u.reassoc_resp.variable - data);
|
|
|
if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) ==
|
|
|
ParseFailed) {
|
|
|
- wpa_printf(MSG_INFO, "Failed to parse IEs in "
|
|
|
- "ReassocResp from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Failed to parse IEs in "
|
|
|
+ "ReassocResp from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
} else if (elems.timeout_int == NULL ||
|
|
|
elems.timeout_int_len != 5 ||
|
|
|
elems.timeout_int[0] !=
|
|
|
WLAN_TIMEOUT_ASSOC_COMEBACK) {
|
|
|
- wpa_printf(MSG_INFO, "No valid Timeout Interval IE "
|
|
|
- "with Assoc Comeback time in ReassocResp "
|
|
|
- "(status=30) from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "No valid Timeout Interval IE "
|
|
|
+ "with Assoc Comeback time in ReassocResp "
|
|
|
+ "(status=30) from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
} else {
|
|
|
sta->counters[
|
|
|
WLANTEST_STA_COUNTER_REASSOCRESP_COMEBACK]++;
|
|
@@ -488,35 +490,36 @@ static void rx_mgmt_reassoc_resp(struct wlantest *wt, const u8 *data,
|
|
|
return;
|
|
|
|
|
|
if ((aid & 0xc000) != 0xc000) {
|
|
|
- wpa_printf(MSG_DEBUG, "Two MSBs of the AID were not set to 1 "
|
|
|
- "in Reassociation Response from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_DEBUG, "Two MSBs of the AID were not set to 1 "
|
|
|
+ "in Reassociation Response from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
}
|
|
|
sta->aid = aid & 0xc000;
|
|
|
|
|
|
if (sta->state < STATE2) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR " was not in State 2 when "
|
|
|
- "getting associated", MAC2STR(sta->addr));
|
|
|
+ add_note(wt, MSG_DEBUG,
|
|
|
+ "STA " MACSTR " was not in State 2 when "
|
|
|
+ "getting associated", MAC2STR(sta->addr));
|
|
|
}
|
|
|
|
|
|
if (sta->state < STATE3) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 3 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 3 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE3;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void disassoc_all_stas(struct wlantest_bss *bss)
|
|
|
+static void disassoc_all_stas(struct wlantest *wt, struct wlantest_bss *bss)
|
|
|
{
|
|
|
struct wlantest_sta *sta;
|
|
|
dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
|
|
|
if (sta->state <= STATE2)
|
|
|
continue;
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 2 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 2 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE2;
|
|
|
}
|
|
|
}
|
|
@@ -540,8 +543,8 @@ static void rx_mgmt_disassoc(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
sta = sta_get(bss, mgmt->sa);
|
|
|
|
|
|
if (len < 24 + 2) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Disassociation frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Disassociation frame from "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -554,7 +557,7 @@ static void rx_mgmt_disassoc(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
|
|
|
if (sta == NULL) {
|
|
|
if (valid && mgmt->da[0] == 0xff)
|
|
|
- disassoc_all_stas(bss);
|
|
|
+ disassoc_all_stas(wt, bss);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -578,24 +581,25 @@ static void rx_mgmt_disassoc(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
WLANTEST_STA_COUNTER_INVALID_DISASSOC_TX]++;
|
|
|
|
|
|
if (!valid) {
|
|
|
- wpa_printf(MSG_INFO, "Do not change STA " MACSTR " State "
|
|
|
- "since Disassociation frame was not protected "
|
|
|
- "correctly", MAC2STR(sta->addr));
|
|
|
+ add_note(wt, MSG_INFO, "Do not change STA " MACSTR " State "
|
|
|
+ "since Disassociation frame was not protected "
|
|
|
+ "correctly", MAC2STR(sta->addr));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (sta->state < STATE2) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR " was not in State 2 or 3 "
|
|
|
- "when getting disassociated", MAC2STR(sta->addr));
|
|
|
+ add_note(wt, MSG_DEBUG,
|
|
|
+ "STA " MACSTR " was not in State 2 or 3 "
|
|
|
+ "when getting disassociated", MAC2STR(sta->addr));
|
|
|
}
|
|
|
|
|
|
if (sta->state > STATE2) {
|
|
|
- wpa_printf(MSG_DEBUG, "STA " MACSTR
|
|
|
- " moved to State 2 with " MACSTR,
|
|
|
- MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
+ add_note(wt, MSG_DEBUG, "STA " MACSTR
|
|
|
+ " moved to State 2 with " MACSTR,
|
|
|
+ MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
sta->state = STATE2;
|
|
|
}
|
|
|
- tdls_link_down(bss, sta);
|
|
|
+ tdls_link_down(wt, bss, sta);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -612,10 +616,10 @@ static void rx_mgmt_action_sa_query_req(struct wlantest *wt,
|
|
|
id = sta->ap_sa_query_tr;
|
|
|
else
|
|
|
id = sta->sta_sa_query_tr;
|
|
|
- wpa_printf(MSG_INFO, "SA Query Request " MACSTR " -> " MACSTR
|
|
|
- " (trans_id=%02x%02x)%s",
|
|
|
- MAC2STR(mgmt->sa), MAC2STR(mgmt->da), rx_id[0], rx_id[1],
|
|
|
- valid ? "" : " (invalid protection)");
|
|
|
+ add_note(wt, MSG_INFO, "SA Query Request " MACSTR " -> " MACSTR
|
|
|
+ " (trans_id=%02x%02x)%s",
|
|
|
+ MAC2STR(mgmt->sa), MAC2STR(mgmt->da), rx_id[0], rx_id[1],
|
|
|
+ valid ? "" : " (invalid protection)");
|
|
|
os_memcpy(id, mgmt->u.action.u.sa_query_req.trans_id, 2);
|
|
|
if (os_memcmp(mgmt->sa, sta->addr, ETH_ALEN) == 0)
|
|
|
sta->counters[valid ?
|
|
@@ -643,11 +647,11 @@ static void rx_mgmt_action_sa_query_resp(struct wlantest *wt,
|
|
|
else
|
|
|
id = sta->ap_sa_query_tr;
|
|
|
match = os_memcmp(rx_id, id, 2) == 0;
|
|
|
- wpa_printf(MSG_INFO, "SA Query Response " MACSTR " -> " MACSTR
|
|
|
- " (trans_id=%02x%02x; %s)%s",
|
|
|
- MAC2STR(mgmt->sa), MAC2STR(mgmt->da), rx_id[0], rx_id[1],
|
|
|
- match ? "match" : "mismatch",
|
|
|
- valid ? "" : " (invalid protection)");
|
|
|
+ add_note(wt, MSG_INFO, "SA Query Response " MACSTR " -> " MACSTR
|
|
|
+ " (trans_id=%02x%02x; %s)%s",
|
|
|
+ MAC2STR(mgmt->sa), MAC2STR(mgmt->da), rx_id[0], rx_id[1],
|
|
|
+ match ? "match" : "mismatch",
|
|
|
+ valid ? "" : " (invalid protection)");
|
|
|
if (os_memcmp(mgmt->sa, sta->addr, ETH_ALEN) == 0)
|
|
|
sta->counters[(valid && match) ?
|
|
|
WLANTEST_STA_COUNTER_VALID_SAQUERYRESP_TX :
|
|
@@ -665,16 +669,16 @@ static void rx_mgmt_action_sa_query(struct wlantest *wt,
|
|
|
size_t len, int valid)
|
|
|
{
|
|
|
if (len < 24 + 2 + WLAN_SA_QUERY_TR_ID_LEN) {
|
|
|
- wpa_printf(MSG_INFO, "Too short SA Query frame from " MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short SA Query frame from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (len > 24 + 2 + WLAN_SA_QUERY_TR_ID_LEN) {
|
|
|
size_t elen = len - (24 + 2 + WLAN_SA_QUERY_TR_ID_LEN);
|
|
|
- wpa_printf(MSG_INFO, "Unexpected %u octets of extra data at "
|
|
|
- "the end of SA Query frame from " MACSTR,
|
|
|
- (unsigned) elen, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Unexpected %u octets of extra data at "
|
|
|
+ "the end of SA Query frame from " MACSTR,
|
|
|
+ (unsigned) elen, MAC2STR(mgmt->sa));
|
|
|
wpa_hexdump(MSG_INFO, "SA Query extra data",
|
|
|
((const u8 *) mgmt) + len - elen, elen);
|
|
|
}
|
|
@@ -687,10 +691,10 @@ static void rx_mgmt_action_sa_query(struct wlantest *wt,
|
|
|
rx_mgmt_action_sa_query_resp(wt, sta, mgmt, len, valid);
|
|
|
break;
|
|
|
default:
|
|
|
- wpa_printf(MSG_INFO, "Unexpected SA Query action value %u "
|
|
|
- "from " MACSTR,
|
|
|
- mgmt->u.action.u.sa_query_req.action,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Unexpected SA Query action value %u "
|
|
|
+ "from " MACSTR,
|
|
|
+ mgmt->u.action.u.sa_query_req.action,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -704,11 +708,11 @@ static void rx_mgmt_action(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
|
|
|
mgmt = (const struct ieee80211_mgmt *) data;
|
|
|
if (mgmt->da[0] & 0x01) {
|
|
|
- wpa_printf(MSG_DEBUG, "Group addressed Action frame: DA="
|
|
|
- MACSTR " SA=" MACSTR " BSSID=" MACSTR
|
|
|
- " category=%u",
|
|
|
- MAC2STR(mgmt->da), MAC2STR(mgmt->sa),
|
|
|
- MAC2STR(mgmt->bssid), mgmt->u.action.category);
|
|
|
+ add_note(wt, MSG_DEBUG, "Group addressed Action frame: DA="
|
|
|
+ MACSTR " SA=" MACSTR " BSSID=" MACSTR
|
|
|
+ " category=%u",
|
|
|
+ MAC2STR(mgmt->da), MAC2STR(mgmt->sa),
|
|
|
+ MAC2STR(mgmt->bssid), mgmt->u.action.category);
|
|
|
return; /* Ignore group addressed Action frames for now */
|
|
|
}
|
|
|
bss = bss_get(wt, mgmt->bssid);
|
|
@@ -722,8 +726,8 @@ static void rx_mgmt_action(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
return;
|
|
|
|
|
|
if (len < 24 + 1) {
|
|
|
- wpa_printf(MSG_INFO, "Too short Action frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Too short Action frame from " MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -735,9 +739,9 @@ static void rx_mgmt_action(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
|
|
|
if (mgmt->u.action.category != WLAN_ACTION_PUBLIC &&
|
|
|
sta->state < STATE3) {
|
|
|
- wpa_printf(MSG_INFO, "Action frame sent when STA is not in "
|
|
|
- "State 3 (SA=" MACSTR " DATA=" MACSTR ")",
|
|
|
- MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
+ add_note(wt, MSG_INFO, "Action frame sent when STA is not in "
|
|
|
+ "State 3 (SA=" MACSTR " DATA=" MACSTR ")",
|
|
|
+ MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
}
|
|
|
|
|
|
switch (mgmt->u.action.category) {
|
|
@@ -813,9 +817,9 @@ static int check_bip(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
data[len - 17] != 16) {
|
|
|
/* No MMIE */
|
|
|
if (bss->rsn_capab & WPA_CAPABILITY_MFPC) {
|
|
|
- wpa_printf(MSG_INFO, "Robust group-addressed "
|
|
|
- "management frame sent without BIP by "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Robust group-addressed "
|
|
|
+ "management frame sent without BIP by "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
bss->counters[WLANTEST_BSS_COUNTER_MISSING_BIP_MMIE]++;
|
|
|
return -1;
|
|
|
}
|
|
@@ -825,13 +829,13 @@ static int check_bip(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
mmie = data + len - 16;
|
|
|
keyid = WPA_GET_LE16(mmie);
|
|
|
if (keyid & 0xf000) {
|
|
|
- wpa_printf(MSG_INFO, "MMIE KeyID reserved bits not zero "
|
|
|
- "(%04x) from " MACSTR, keyid, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "MMIE KeyID reserved bits not zero "
|
|
|
+ "(%04x) from " MACSTR, keyid, MAC2STR(mgmt->sa));
|
|
|
keyid &= 0x0fff;
|
|
|
}
|
|
|
if (keyid < 4 || keyid > 5) {
|
|
|
- wpa_printf(MSG_INFO, "Unexpected MMIE KeyID %u from " MACSTR,
|
|
|
- keyid, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Unexpected MMIE KeyID %u from " MACSTR,
|
|
|
+ keyid, MAC2STR(mgmt->sa));
|
|
|
bss->counters[WLANTEST_BSS_COUNTER_INVALID_BIP_MMIE]++;
|
|
|
return 0;
|
|
|
}
|
|
@@ -840,25 +844,25 @@ static int check_bip(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
wpa_hexdump(MSG_MSGDUMP, "MMIE MIC", mmie + 8, 8);
|
|
|
|
|
|
if (!bss->igtk_set[keyid]) {
|
|
|
- wpa_printf(MSG_DEBUG, "No IGTK known to validate BIP frame");
|
|
|
+ add_note(wt, MSG_DEBUG, "No IGTK known to validate BIP frame");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
if (os_memcmp(mmie + 2, bss->ipn[keyid], 6) <= 0) {
|
|
|
- wpa_printf(MSG_INFO, "BIP replay detected: SA=" MACSTR,
|
|
|
- MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "BIP replay detected: SA=" MACSTR,
|
|
|
+ MAC2STR(mgmt->sa));
|
|
|
wpa_hexdump(MSG_INFO, "RX IPN", mmie + 2, 6);
|
|
|
wpa_hexdump(MSG_INFO, "Last RX IPN", bss->ipn[keyid], 6);
|
|
|
}
|
|
|
|
|
|
if (check_mmie_mic(bss->igtk[keyid], data, len) < 0) {
|
|
|
- wpa_printf(MSG_INFO, "Invalid MMIE MIC in a frame from "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Invalid MMIE MIC in a frame from "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
bss->counters[WLANTEST_BSS_COUNTER_INVALID_BIP_MMIE]++;
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- wpa_printf(MSG_DEBUG, "Valid MMIE MIC");
|
|
|
+ add_note(wt, MSG_DEBUG, "Valid MMIE MIC");
|
|
|
os_memcpy(bss->ipn[keyid], mmie + 2, 6);
|
|
|
bss->counters[WLANTEST_BSS_COUNTER_VALID_BIP_MMIE]++;
|
|
|
|
|
@@ -890,7 +894,7 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
else
|
|
|
sta = sta_get(bss, hdr->addr1);
|
|
|
if (sta == NULL || !sta->ptk_set) {
|
|
|
- wpa_printf(MSG_MSGDUMP, "No PTK known to decrypt the frame");
|
|
|
+ add_note(wt, MSG_MSGDUMP, "No PTK known to decrypt the frame");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -898,22 +902,22 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
return NULL;
|
|
|
|
|
|
if (!(data[24 + 3] & 0x20)) {
|
|
|
- wpa_printf(MSG_INFO, "Expected CCMP frame from " MACSTR
|
|
|
- " did not have ExtIV bit set to 1",
|
|
|
- MAC2STR(hdr->addr2));
|
|
|
+ add_note(wt, MSG_INFO, "Expected CCMP frame from " MACSTR
|
|
|
+ " did not have ExtIV bit set to 1",
|
|
|
+ MAC2STR(hdr->addr2));
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
if (data[24 + 2] != 0 || (data[24 + 3] & 0x1f) != 0) {
|
|
|
- wpa_printf(MSG_INFO, "CCMP mgmt frame from " MACSTR " used "
|
|
|
- "non-zero reserved bit", MAC2STR(hdr->addr2));
|
|
|
+ add_note(wt, MSG_INFO, "CCMP mgmt frame from " MACSTR " used "
|
|
|
+ "non-zero reserved bit", MAC2STR(hdr->addr2));
|
|
|
}
|
|
|
|
|
|
keyid = data[24 + 3] >> 6;
|
|
|
if (keyid != 0) {
|
|
|
- wpa_printf(MSG_INFO, "Unexpected non-zero KeyID %d in "
|
|
|
- "individually addressed Management frame from "
|
|
|
- MACSTR, keyid, MAC2STR(hdr->addr2));
|
|
|
+ add_note(wt, MSG_INFO, "Unexpected non-zero KeyID %d in "
|
|
|
+ "individually addressed Management frame from "
|
|
|
+ MACSTR, keyid, MAC2STR(hdr->addr2));
|
|
|
}
|
|
|
|
|
|
if (os_memcmp(hdr->addr1, hdr->addr3, ETH_ALEN) == 0)
|
|
@@ -924,12 +928,12 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
|
|
|
ccmp_get_pn(pn, data + 24);
|
|
|
if (os_memcmp(pn, rsc, 6) <= 0) {
|
|
|
u16 seq_ctrl = le_to_host16(hdr->seq_ctrl);
|
|
|
- wpa_printf(MSG_INFO, "CCMP/TKIP replay detected: A1=" MACSTR
|
|
|
- " A2=" MACSTR " A3=" MACSTR " seq=%u frag=%u",
|
|
|
- MAC2STR(hdr->addr1), MAC2STR(hdr->addr2),
|
|
|
- MAC2STR(hdr->addr3),
|
|
|
- WLAN_GET_SEQ_SEQ(seq_ctrl),
|
|
|
- WLAN_GET_SEQ_FRAG(seq_ctrl));
|
|
|
+ add_note(wt, MSG_INFO, "CCMP/TKIP replay detected: A1=" MACSTR
|
|
|
+ " A2=" MACSTR " A3=" MACSTR " seq=%u frag=%u",
|
|
|
+ MAC2STR(hdr->addr1), MAC2STR(hdr->addr2),
|
|
|
+ MAC2STR(hdr->addr3),
|
|
|
+ WLAN_GET_SEQ_SEQ(seq_ctrl),
|
|
|
+ WLAN_GET_SEQ_FRAG(seq_ctrl));
|
|
|
wpa_hexdump(MSG_INFO, "RX PN", pn, 6);
|
|
|
wpa_hexdump(MSG_INFO, "RSC", rsc, 6);
|
|
|
}
|
|
@@ -980,9 +984,9 @@ static int check_mgmt_ccmp(struct wlantest *wt, const u8 *data, size_t len)
|
|
|
if ((sta->rsn_capab & WPA_CAPABILITY_MFPC) &&
|
|
|
(sta->state == STATE3 ||
|
|
|
WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_ACTION)) {
|
|
|
- wpa_printf(MSG_INFO, "Robust individually-addressed "
|
|
|
- "management frame sent without CCMP by "
|
|
|
- MACSTR, MAC2STR(mgmt->sa));
|
|
|
+ add_note(wt, MSG_INFO, "Robust individually-addressed "
|
|
|
+ "management frame sent without CCMP by "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa));
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -1105,8 +1109,8 @@ static void rx_mgmt_deauth_ack(struct wlantest *wt,
|
|
|
if (sta == NULL)
|
|
|
return;
|
|
|
|
|
|
- wpa_printf(MSG_DEBUG, "DEAUTH from " MACSTR " acknowledged by " MACSTR,
|
|
|
- MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
+ add_note(wt, MSG_DEBUG, "DEAUTH from " MACSTR " acknowledged by "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) {
|
|
|
int c;
|
|
|
c = wt->last_mgmt_valid ?
|
|
@@ -1135,8 +1139,8 @@ static void rx_mgmt_disassoc_ack(struct wlantest *wt,
|
|
|
if (sta == NULL)
|
|
|
return;
|
|
|
|
|
|
- wpa_printf(MSG_DEBUG, "DISASSOC from " MACSTR " acknowledged by "
|
|
|
- MACSTR, MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
+ add_note(wt, MSG_DEBUG, "DISASSOC from " MACSTR " acknowledged by "
|
|
|
+ MACSTR, MAC2STR(mgmt->sa), MAC2STR(mgmt->da));
|
|
|
if (os_memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN) == 0) {
|
|
|
int c;
|
|
|
c = wt->last_mgmt_valid ?
|