2008-02-28 02:34:43 +01:00
|
|
|
/*
|
|
|
|
* hostapd / WMM (Wi-Fi Multimedia)
|
|
|
|
* Copyright 2002-2003, Instant802 Networks, Inc.
|
|
|
|
* Copyright 2005-2006, Devicescape Software, Inc.
|
2009-12-25 23:05:40 +01:00
|
|
|
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
2008-02-28 02:34:43 +01:00
|
|
|
*
|
2013-12-24 21:59:52 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-28 02:34:43 +01:00
|
|
|
*/
|
|
|
|
|
2009-12-25 23:05:40 +01:00
|
|
|
#include "utils/includes.h"
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-12-25 23:05:40 +01:00
|
|
|
#include "utils/common.h"
|
2009-12-25 23:31:51 +01:00
|
|
|
#include "common/ieee802_11_defs.h"
|
|
|
|
#include "common/ieee802_11_common.h"
|
2008-02-28 02:34:43 +01:00
|
|
|
#include "hostapd.h"
|
|
|
|
#include "ieee802_11.h"
|
|
|
|
#include "sta_info.h"
|
2009-12-25 23:05:40 +01:00
|
|
|
#include "ap_config.h"
|
2010-11-24 14:19:50 +01:00
|
|
|
#include "ap_drv_ops.h"
|
2009-12-25 00:12:50 +01:00
|
|
|
#include "wmm.h"
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2019-04-03 18:07:53 +02:00
|
|
|
#ifndef MIN
|
|
|
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
#ifndef MAX
|
|
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-03-04 15:23:44 +01:00
|
|
|
static inline u8 wmm_aci_aifsn(int aifsn, int acm, int aci)
|
|
|
|
{
|
|
|
|
u8 ret;
|
|
|
|
ret = (aifsn << WMM_AC_AIFNS_SHIFT) & WMM_AC_AIFSN_MASK;
|
|
|
|
if (acm)
|
|
|
|
ret |= WMM_AC_ACM;
|
|
|
|
ret |= (aci << WMM_AC_ACI_SHIFT) & WMM_AC_ACI_MASK;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline u8 wmm_ecw(int ecwmin, int ecwmax)
|
|
|
|
{
|
|
|
|
return ((ecwmin << WMM_AC_ECWMIN_SHIFT) & WMM_AC_ECWMIN_MASK) |
|
|
|
|
((ecwmax << WMM_AC_ECWMAX_SHIFT) & WMM_AC_ECWMAX_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-03 18:07:53 +02:00
|
|
|
static void
|
|
|
|
wmm_set_regulatory_limit(const struct hostapd_wmm_ac_params *wmm_conf,
|
|
|
|
struct hostapd_wmm_ac_params *wmm,
|
|
|
|
const struct hostapd_wmm_rule *wmm_reg)
|
|
|
|
{
|
|
|
|
int ac;
|
|
|
|
|
|
|
|
for (ac = 0; ac < WMM_AC_NUM; ac++) {
|
|
|
|
wmm[ac].cwmin = MAX(wmm_conf[ac].cwmin, wmm_reg[ac].min_cwmin);
|
|
|
|
wmm[ac].cwmax = MAX(wmm_conf[ac].cwmax, wmm_reg[ac].min_cwmax);
|
|
|
|
wmm[ac].aifs = MAX(wmm_conf[ac].aifs, wmm_reg[ac].min_aifs);
|
|
|
|
wmm[ac].txop_limit =
|
|
|
|
MIN(wmm_conf[ac].txop_limit, wmm_reg[ac].max_txop);
|
|
|
|
wmm[ac].admission_control_mandatory =
|
|
|
|
wmm_conf[ac].admission_control_mandatory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate WMM regulatory limit if any.
|
|
|
|
*/
|
|
|
|
static void wmm_calc_regulatory_limit(struct hostapd_data *hapd,
|
|
|
|
struct hostapd_wmm_ac_params *acp)
|
|
|
|
{
|
|
|
|
struct hostapd_hw_modes *mode = hapd->iface->current_mode;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
os_memcpy(acp, hapd->iconf->wmm_ac_params,
|
|
|
|
sizeof(hapd->iconf->wmm_ac_params));
|
|
|
|
|
|
|
|
for (c = 0; mode && c < mode->num_channels; c++) {
|
|
|
|
struct hostapd_channel_data *chan = &mode->channels[c];
|
|
|
|
|
|
|
|
if (chan->freq != hapd->iface->freq)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (chan->wmm_rules_valid)
|
|
|
|
wmm_set_regulatory_limit(hapd->iconf->wmm_ac_params,
|
|
|
|
acp, chan->wmm_rules);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check if we need to update set count. Since both were initialized to
|
|
|
|
* zero we can compare the whole array in one shot.
|
|
|
|
*/
|
|
|
|
if (os_memcmp(acp, hapd->iface->prev_wmm,
|
|
|
|
sizeof(hapd->iconf->wmm_ac_params)) != 0) {
|
|
|
|
os_memcpy(hapd->iface->prev_wmm, acp,
|
|
|
|
sizeof(hapd->iconf->wmm_ac_params));
|
|
|
|
hapd->parameter_set_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
/*
|
|
|
|
* Add WMM Parameter Element to Beacon, Probe Response, and (Re)Association
|
|
|
|
* Response frames.
|
|
|
|
*/
|
|
|
|
u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
u8 *pos = eid;
|
2009-03-04 11:33:24 +01:00
|
|
|
struct wmm_parameter_element *wmm =
|
|
|
|
(struct wmm_parameter_element *) (pos + 2);
|
2019-04-03 18:07:53 +02:00
|
|
|
struct hostapd_wmm_ac_params wmmp[WMM_AC_NUM] = { 0 };
|
2008-02-28 02:34:43 +01:00
|
|
|
int e;
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
if (!hapd->conf->wmm_enabled)
|
2008-02-28 02:34:43 +01:00
|
|
|
return eid;
|
2019-04-03 18:07:53 +02:00
|
|
|
wmm_calc_regulatory_limit(hapd, wmmp);
|
2008-02-28 02:34:43 +01:00
|
|
|
eid[0] = WLAN_EID_VENDOR_SPECIFIC;
|
2009-03-04 11:33:24 +01:00
|
|
|
wmm->oui[0] = 0x00;
|
|
|
|
wmm->oui[1] = 0x50;
|
|
|
|
wmm->oui[2] = 0xf2;
|
|
|
|
wmm->oui_type = WMM_OUI_TYPE;
|
|
|
|
wmm->oui_subtype = WMM_OUI_SUBTYPE_PARAMETER_ELEMENT;
|
|
|
|
wmm->version = WMM_VERSION;
|
|
|
|
wmm->qos_info = hapd->parameter_set_count & 0xf;
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2011-12-17 10:45:53 +01:00
|
|
|
if (hapd->conf->wmm_uapsd &&
|
|
|
|
(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_UAPSD))
|
2010-04-11 10:32:15 +02:00
|
|
|
wmm->qos_info |= 0x80;
|
|
|
|
|
2011-02-10 21:10:40 +01:00
|
|
|
wmm->reserved = 0;
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
/* fill in a parameter set record for each AC */
|
|
|
|
for (e = 0; e < 4; e++) {
|
2009-03-04 11:33:24 +01:00
|
|
|
struct wmm_ac_parameter *ac = &wmm->ac[e];
|
2019-04-03 18:07:53 +02:00
|
|
|
struct hostapd_wmm_ac_params *acp = &wmmp[e];
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-03-04 15:23:44 +01:00
|
|
|
ac->aci_aifsn = wmm_aci_aifsn(acp->aifs,
|
|
|
|
acp->admission_control_mandatory,
|
|
|
|
e);
|
|
|
|
ac->cw = wmm_ecw(acp->cwmin, acp->cwmax);
|
2009-03-04 11:33:24 +01:00
|
|
|
ac->txop_limit = host_to_le16(acp->txop_limit);
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
pos = (u8 *) (wmm + 1);
|
2008-02-28 02:34:43 +01:00
|
|
|
eid[1] = pos - eid - 2; /* element length */
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-17 11:41:00 +01:00
|
|
|
/*
|
|
|
|
* This function is called when a station sends an association request with
|
|
|
|
* WMM info element. The function returns 1 on success or 0 on any error in WMM
|
|
|
|
* element. eid does not include Element ID and Length octets.
|
|
|
|
*/
|
2009-11-29 21:10:38 +01:00
|
|
|
int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid, size_t len)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
2009-03-04 11:33:24 +01:00
|
|
|
struct wmm_information_element *wmm;
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
wpa_hexdump(MSG_MSGDUMP, "WMM IE", eid, len);
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
if (len < sizeof(struct wmm_information_element)) {
|
|
|
|
wpa_printf(MSG_DEBUG, "Too short WMM IE (len=%lu)",
|
2008-02-28 02:34:43 +01:00
|
|
|
(unsigned long) len);
|
2011-12-17 11:41:00 +01:00
|
|
|
return 0;
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
wmm = (struct wmm_information_element *) eid;
|
|
|
|
wpa_printf(MSG_DEBUG, "Validating WMM IE: OUI %02x:%02x:%02x "
|
2009-03-04 15:28:47 +01:00
|
|
|
"OUI type %d OUI sub-type %d version %d QoS info 0x%x",
|
2009-03-04 11:33:24 +01:00
|
|
|
wmm->oui[0], wmm->oui[1], wmm->oui[2], wmm->oui_type,
|
2009-03-04 15:28:47 +01:00
|
|
|
wmm->oui_subtype, wmm->version, wmm->qos_info);
|
|
|
|
if (wmm->oui_subtype != WMM_OUI_SUBTYPE_INFORMATION_ELEMENT ||
|
2009-03-04 11:33:24 +01:00
|
|
|
wmm->version != WMM_VERSION) {
|
2009-03-04 15:28:47 +01:00
|
|
|
wpa_printf(MSG_DEBUG, "Unsupported WMM IE Subtype/Version");
|
2011-12-17 11:41:00 +01:00
|
|
|
return 0;
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
2011-12-17 11:41:00 +01:00
|
|
|
return 1;
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
static void wmm_send_action(struct hostapd_data *hapd, const u8 *addr,
|
|
|
|
const struct wmm_tspec_element *tspec,
|
2008-02-28 02:34:43 +01:00
|
|
|
u8 action_code, u8 dialogue_token, u8 status_code)
|
|
|
|
{
|
|
|
|
u8 buf[256];
|
|
|
|
struct ieee80211_mgmt *m = (struct ieee80211_mgmt *) buf;
|
2009-03-04 11:33:24 +01:00
|
|
|
struct wmm_tspec_element *t = (struct wmm_tspec_element *)
|
|
|
|
m->u.action.u.wmm_action.variable;
|
2008-02-28 02:34:43 +01:00
|
|
|
int len;
|
|
|
|
|
|
|
|
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
|
|
|
HOSTAPD_LEVEL_DEBUG,
|
|
|
|
"action response - reason %d", status_code);
|
|
|
|
os_memset(buf, 0, sizeof(buf));
|
|
|
|
m->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
|
|
|
|
WLAN_FC_STYPE_ACTION);
|
|
|
|
os_memcpy(m->da, addr, ETH_ALEN);
|
|
|
|
os_memcpy(m->sa, hapd->own_addr, ETH_ALEN);
|
|
|
|
os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
|
2008-08-31 10:06:58 +02:00
|
|
|
m->u.action.category = WLAN_ACTION_WMM;
|
2009-03-04 11:33:24 +01:00
|
|
|
m->u.action.u.wmm_action.action_code = action_code;
|
|
|
|
m->u.action.u.wmm_action.dialog_token = dialogue_token;
|
|
|
|
m->u.action.u.wmm_action.status_code = status_code;
|
|
|
|
os_memcpy(t, tspec, sizeof(struct wmm_tspec_element));
|
2008-02-28 02:34:43 +01:00
|
|
|
len = ((u8 *) (t + 1)) - buf;
|
|
|
|
|
2020-01-03 12:34:37 +01:00
|
|
|
if (hostapd_drv_send_mlme(hapd, m, len, 0, NULL, 0, 0) < 0)
|
2013-11-02 11:51:30 +01:00
|
|
|
wpa_printf(MSG_INFO, "wmm_send_action: send failed");
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-09 21:25:58 +01:00
|
|
|
int wmm_process_tspec(struct wmm_tspec_element *tspec)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
2017-02-11 11:09:11 +01:00
|
|
|
u64 medium_time;
|
|
|
|
unsigned int pps, duration;
|
|
|
|
unsigned int up, psb, dir, tid;
|
2009-03-06 19:12:31 +01:00
|
|
|
u16 val, surplus;
|
|
|
|
|
|
|
|
up = (tspec->ts_info[1] >> 3) & 0x07;
|
|
|
|
psb = (tspec->ts_info[1] >> 2) & 0x01;
|
|
|
|
dir = (tspec->ts_info[0] >> 5) & 0x03;
|
|
|
|
tid = (tspec->ts_info[0] >> 1) & 0x0f;
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: TS Info: UP=%d PSB=%d Direction=%d TID=%d",
|
|
|
|
up, psb, dir, tid);
|
|
|
|
val = le_to_host16(tspec->nominal_msdu_size);
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Nominal MSDU Size: %d%s",
|
|
|
|
val & 0x7fff, val & 0x8000 ? " (fixed)" : "");
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Mean Data Rate: %u bps",
|
|
|
|
le_to_host32(tspec->mean_data_rate));
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Minimum PHY Rate: %u bps",
|
|
|
|
le_to_host32(tspec->minimum_phy_rate));
|
|
|
|
val = le_to_host16(tspec->surplus_bandwidth_allowance);
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Surplus Bandwidth Allowance: %u.%04u",
|
|
|
|
val >> 13, 10000 * (val & 0x1fff) / 0x2000);
|
|
|
|
|
|
|
|
val = le_to_host16(tspec->nominal_msdu_size);
|
|
|
|
if (val == 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Invalid Nominal MSDU Size (0)");
|
2009-03-09 21:25:58 +01:00
|
|
|
return WMM_ADDTS_STATUS_INVALID_PARAMETERS;
|
2009-03-06 19:12:31 +01:00
|
|
|
}
|
|
|
|
/* pps = Ceiling((Mean Data Rate / 8) / Nominal MSDU Size) */
|
|
|
|
pps = ((le_to_host32(tspec->mean_data_rate) / 8) + val - 1) / val;
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Packets-per-second estimate for TSPEC: %d",
|
|
|
|
pps);
|
|
|
|
|
|
|
|
if (le_to_host32(tspec->minimum_phy_rate) < 1000000) {
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Too small Minimum PHY Rate");
|
2009-03-09 21:25:58 +01:00
|
|
|
return WMM_ADDTS_STATUS_INVALID_PARAMETERS;
|
2009-03-06 19:12:31 +01:00
|
|
|
}
|
2008-02-28 02:34:43 +01:00
|
|
|
|
2009-03-06 19:12:31 +01:00
|
|
|
duration = (le_to_host16(tspec->nominal_msdu_size) & 0x7fff) * 8 /
|
|
|
|
(le_to_host32(tspec->minimum_phy_rate) / 1000000) +
|
|
|
|
50 /* FIX: proper SIFS + ACK duration */;
|
|
|
|
|
|
|
|
/* unsigned binary number with an implicit binary point after the
|
|
|
|
* leftmost 3 bits, i.e., 0x2000 = 1.0 */
|
|
|
|
surplus = le_to_host16(tspec->surplus_bandwidth_allowance);
|
|
|
|
if (surplus <= 0x2000) {
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Surplus Bandwidth Allowance not "
|
|
|
|
"greater than unity");
|
2009-03-09 21:25:58 +01:00
|
|
|
return WMM_ADDTS_STATUS_INVALID_PARAMETERS;
|
2009-03-06 19:12:31 +01:00
|
|
|
}
|
|
|
|
|
2017-02-11 11:09:11 +01:00
|
|
|
medium_time = (u64) surplus * pps * duration / 0x2000;
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Estimated medium time: %lu",
|
|
|
|
(unsigned long) medium_time);
|
2009-03-06 19:12:31 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: store list of granted (and still active) TSPECs and check
|
|
|
|
* whether there is available medium time for this request. For now,
|
|
|
|
* just refuse requests that would by themselves take very large
|
|
|
|
* portion of the available bandwidth.
|
|
|
|
*/
|
|
|
|
if (medium_time > 750000) {
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: Refuse TSPEC request for over "
|
|
|
|
"75%% of available bandwidth");
|
2009-03-09 21:25:58 +01:00
|
|
|
return WMM_ADDTS_STATUS_REFUSED;
|
2009-03-06 19:12:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert to 32 microseconds per second unit */
|
|
|
|
tspec->medium_time = host_to_le16(medium_time / 32);
|
2009-03-04 11:33:24 +01:00
|
|
|
|
2009-03-09 21:25:58 +01:00
|
|
|
return WMM_ADDTS_STATUS_ADMISSION_ACCEPTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void wmm_addts_req(struct hostapd_data *hapd,
|
2009-12-13 22:25:30 +01:00
|
|
|
const struct ieee80211_mgmt *mgmt,
|
2019-11-23 16:39:55 +01:00
|
|
|
const struct wmm_tspec_element *tspec, size_t len)
|
2009-03-09 21:25:58 +01:00
|
|
|
{
|
2009-12-13 22:25:30 +01:00
|
|
|
const u8 *end = ((const u8 *) mgmt) + len;
|
2009-03-09 21:25:58 +01:00
|
|
|
int res;
|
2019-11-23 16:39:55 +01:00
|
|
|
struct wmm_tspec_element tspec_resp;
|
2009-03-09 21:25:58 +01:00
|
|
|
|
2009-12-13 22:25:30 +01:00
|
|
|
if ((const u8 *) (tspec + 1) > end) {
|
2009-03-09 21:25:58 +01:00
|
|
|
wpa_printf(MSG_DEBUG, "WMM: TSPEC overflow in ADDTS Request");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "WMM: ADDTS Request (Dialog Token %d) for TSPEC "
|
|
|
|
"from " MACSTR,
|
|
|
|
mgmt->u.action.u.wmm_action.dialog_token,
|
|
|
|
MAC2STR(mgmt->sa));
|
|
|
|
|
2019-11-23 16:39:55 +01:00
|
|
|
os_memcpy(&tspec_resp, tspec, sizeof(struct wmm_tspec_element));
|
|
|
|
res = wmm_process_tspec(&tspec_resp);
|
2009-03-09 21:25:58 +01:00
|
|
|
wpa_printf(MSG_DEBUG, "WMM: ADDTS processing result: %d", res);
|
|
|
|
|
2019-11-23 16:39:55 +01:00
|
|
|
wmm_send_action(hapd, mgmt->sa, &tspec_resp, WMM_ACTION_CODE_ADDTS_RESP,
|
2009-03-09 21:25:58 +01:00
|
|
|
mgmt->u.action.u.wmm_action.dialog_token, res);
|
2008-02-28 02:34:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-13 22:25:30 +01:00
|
|
|
void hostapd_wmm_action(struct hostapd_data *hapd,
|
|
|
|
const struct ieee80211_mgmt *mgmt, size_t len)
|
2008-02-28 02:34:43 +01:00
|
|
|
{
|
|
|
|
int action_code;
|
|
|
|
int left = len - IEEE80211_HDRLEN - 4;
|
2009-12-13 22:25:30 +01:00
|
|
|
const u8 *pos = ((const u8 *) mgmt) + IEEE80211_HDRLEN + 4;
|
2008-02-28 02:34:43 +01:00
|
|
|
struct ieee802_11_elems elems;
|
|
|
|
struct sta_info *sta = ap_get_sta(hapd, mgmt->sa);
|
|
|
|
|
|
|
|
/* check that the request comes from a valid station */
|
|
|
|
if (!sta ||
|
2009-03-04 11:33:24 +01:00
|
|
|
(sta->flags & (WLAN_STA_ASSOC | WLAN_STA_WMM)) !=
|
|
|
|
(WLAN_STA_ASSOC | WLAN_STA_WMM)) {
|
2008-02-28 02:34:43 +01:00
|
|
|
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
|
|
|
|
HOSTAPD_LEVEL_DEBUG,
|
2009-03-04 11:33:24 +01:00
|
|
|
"wmm action received is not from associated wmm"
|
2008-02-28 02:34:43 +01:00
|
|
|
" station");
|
|
|
|
/* TODO: respond with action frame refused status code */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-29 01:21:53 +02:00
|
|
|
if (left < 0)
|
|
|
|
return; /* not a valid WMM Action frame */
|
|
|
|
|
2008-02-28 02:34:43 +01:00
|
|
|
/* extract the tspec info element */
|
2008-10-29 20:33:46 +01:00
|
|
|
if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
|
2008-02-28 02:34:43 +01:00
|
|
|
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
|
|
|
|
HOSTAPD_LEVEL_DEBUG,
|
2009-03-04 11:33:24 +01:00
|
|
|
"hostapd_wmm_action - could not parse wmm "
|
2008-02-28 02:34:43 +01:00
|
|
|
"action");
|
|
|
|
/* TODO: respond with action frame invalid parameters status
|
|
|
|
* code */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
if (!elems.wmm_tspec ||
|
|
|
|
elems.wmm_tspec_len != (sizeof(struct wmm_tspec_element) - 2)) {
|
2008-02-28 02:34:43 +01:00
|
|
|
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
|
|
|
|
HOSTAPD_LEVEL_DEBUG,
|
2009-03-04 11:33:24 +01:00
|
|
|
"hostapd_wmm_action - missing or wrong length "
|
2008-02-28 02:34:43 +01:00
|
|
|
"tspec");
|
|
|
|
/* TODO: respond with action frame invalid parameters status
|
|
|
|
* code */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: check the request is for an AC with ACM set, if not, refuse
|
|
|
|
* request */
|
|
|
|
|
2009-03-04 11:33:24 +01:00
|
|
|
action_code = mgmt->u.action.u.wmm_action.action_code;
|
2008-02-28 02:34:43 +01:00
|
|
|
switch (action_code) {
|
2009-03-04 11:33:24 +01:00
|
|
|
case WMM_ACTION_CODE_ADDTS_REQ:
|
|
|
|
wmm_addts_req(hapd, mgmt, (struct wmm_tspec_element *)
|
|
|
|
(elems.wmm_tspec - 2), len);
|
2008-02-28 02:34:43 +01:00
|
|
|
return;
|
|
|
|
#if 0
|
|
|
|
/* TODO: needed for client implementation */
|
2009-03-04 11:33:24 +01:00
|
|
|
case WMM_ACTION_CODE_ADDTS_RESP:
|
|
|
|
wmm_setup_request(hapd, mgmt, len);
|
2008-02-28 02:34:43 +01:00
|
|
|
return;
|
|
|
|
/* TODO: handle station teardown requests */
|
2009-03-04 11:33:24 +01:00
|
|
|
case WMM_ACTION_CODE_DELTS:
|
|
|
|
wmm_teardown(hapd, mgmt, len);
|
2008-02-28 02:34:43 +01:00
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
|
|
|
|
HOSTAPD_LEVEL_DEBUG,
|
2009-03-04 11:33:24 +01:00
|
|
|
"hostapd_wmm_action - unknown action code %d",
|
2008-02-28 02:34:43 +01:00
|
|
|
action_code);
|
|
|
|
}
|