int i;
/* Parsing WMM Parameter Element */
- if (ieee802_11_parse_elems(ies, ies_len, &elems, 1) != ParseOK) {
+ if (ieee802_11_parse_elems(ies, ies_len, &elems, 1) == ParseFailed) {
wpa_printf(MSG_DEBUG, "WMM AC: could not parse assoc ies");
return NULL;
}
}
if (elems.wmm_len != sizeof(*wmm_params)) {
- wpa_printf(MSG_WARNING, "WMM AC: Invalid WMM ie length");
+ wpa_printf(MSG_DEBUG, "WMM AC: Invalid WMM ie length");
return NULL;
}
wmm_ac_del_ts_idx(wpa_s, ac, idx);
- wpa_printf(MSG_INFO,
+ wpa_printf(MSG_DEBUG,
"TS was deleted successfully (tsid=%u address=" MACSTR ")",
tsid, MAC2STR(sa));
}
/* make sure we have a matching addts request */
if (!req || req->dialog_token != resp_dialog_token) {
- wpa_printf(MSG_ERROR,
+ wpa_printf(MSG_DEBUG,
"WMM AC: no req with dialog=%u, ignoring frame",
resp_dialog_token);
return;
tsid != wmm_ac_get_tsid(&req->tspec) ||
up != wmm_ac_get_user_priority(&req->tspec) ||
dir != wmm_ac_get_direction(&req->tspec)) {
- wpa_printf(MSG_ERROR,
+ wpa_printf(MSG_DEBUG,
"WMM AC: ADDTS params do not match, ignoring frame");
return;
}
/* delete pending request */
wmm_ac_del_req(wpa_s, 0);
- wpa_printf(MSG_INFO,
+ wpa_printf(MSG_DEBUG,
"ADDTS response status=%d tsid=%u up=%u direction=%u",
status_code, tsid, up, dir);
struct wmm_tspec_element *tspec;
if (wpa_s->wmm_ac_assoc_info == NULL) {
- wpa_printf(MSG_WARNING,
+ wpa_printf(MSG_DEBUG,
"WMM AC: WMM AC is disabled, ignoring action frame");
return;
}
if (action != WMM_ACTION_CODE_ADDTS_RESP &&
action != WMM_ACTION_CODE_DELTS) {
- wpa_printf(MSG_WARNING,
+ wpa_printf(MSG_DEBUG,
"WMM AC: Unknown action (%d), ignoring action frame",
action);
return;
struct wmm_ac_assoc_data *assoc_info = wpa_s->wmm_ac_assoc_info;
enum ts_dir_idx idx;
int pos = 0;
- u8 ac;
+ u8 ac, up;
if (!assoc_info) {
return wpa_scnprintf(buf, buflen - pos,
dir = wmm_ac_get_direction(tspec);
dir_str = get_direction_str(dir);
tsid = wmm_ac_get_tsid(tspec);
+ up = wmm_ac_get_user_priority(tspec);
pos += wpa_scnprintf(buf + pos, buflen - pos,
- "\tTSID = %u\n"
+ "\tTSID=%u UP=%u\n"
"\tAddress = "MACSTR"\n"
"\tWMM AC dir = %s\n"
"\tTotal admitted time = %u\n\n",
- tsid,
+ tsid, up,
MAC2STR(wpa_s->bssid),
dir_str,
le_to_host16(tspec->medium_time));
return pos;
}
+
+
+static u8 wmm_ac_get_tspecs_count(struct wpa_supplicant *wpa_s)
+{
+ int ac, dir, tspecs_count = 0;
+
+ for (ac = 0; ac < WMM_AC_NUM; ac++) {
+ for (dir = 0; dir < TS_DIR_IDX_COUNT; dir++) {
+ if (wpa_s->tspecs[ac][dir])
+ tspecs_count++;
+ }
+ }
+
+ return tspecs_count;
+}
+
+
+void wmm_ac_save_tspecs(struct wpa_supplicant *wpa_s)
+{
+ int ac, dir, tspecs_count;
+
+ wpa_printf(MSG_DEBUG, "WMM AC: Save last configured tspecs");
+
+ if (!wpa_s->wmm_ac_assoc_info)
+ return;
+
+ tspecs_count = wmm_ac_get_tspecs_count(wpa_s);
+ if (!tspecs_count) {
+ wpa_printf(MSG_DEBUG, "WMM AC: No configured TSPECs");
+ return;
+ }
+
+ wpa_printf(MSG_DEBUG, "WMM AC: Saving tspecs");
+
+ wmm_ac_clear_saved_tspecs(wpa_s);
+ wpa_s->last_tspecs = os_calloc(tspecs_count,
+ sizeof(*wpa_s->last_tspecs));
+ if (!wpa_s->last_tspecs) {
+ wpa_printf(MSG_ERROR, "WMM AC: Failed to save tspecs!");
+ return;
+ }
+
+ for (ac = 0; ac < WMM_AC_NUM; ac++) {
+ for (dir = 0; dir < TS_DIR_IDX_COUNT; dir++) {
+ if (!wpa_s->tspecs[ac][dir])
+ continue;
+
+ wpa_s->last_tspecs[wpa_s->last_tspecs_count++] =
+ *wpa_s->tspecs[ac][dir];
+ }
+ }
+
+ wpa_printf(MSG_DEBUG, "WMM AC: Successfully saved %d TSPECs",
+ wpa_s->last_tspecs_count);
+}
+
+
+void wmm_ac_clear_saved_tspecs(struct wpa_supplicant *wpa_s)
+{
+ if (wpa_s->last_tspecs) {
+ wpa_printf(MSG_DEBUG, "WMM AC: Clear saved tspecs");
+ os_free(wpa_s->last_tspecs);
+ wpa_s->last_tspecs = NULL;
+ wpa_s->last_tspecs_count = 0;
+ }
+}
+
+
+int wmm_ac_restore_tspecs(struct wpa_supplicant *wpa_s)
+{
+ unsigned int i;
+
+ if (!wpa_s->wmm_ac_assoc_info || !wpa_s->last_tspecs_count)
+ return 0;
+
+ wpa_printf(MSG_DEBUG, "WMM AC: Restore %u saved tspecs",
+ wpa_s->last_tspecs_count);
+
+ for (i = 0; i < wpa_s->last_tspecs_count; i++)
+ wmm_ac_add_ts(wpa_s, wpa_s->bssid, &wpa_s->last_tspecs[i]);
+
+ return 0;
+}