RRM: Add support for including extended ID elements in beacon report
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
c88c08f0cc
commit
2d4f905214
3 changed files with 26 additions and 9 deletions
|
@ -2137,14 +2137,15 @@ enum beacon_report_mode {
|
||||||
BEACON_REPORT_MODE_TABLE = 2,
|
BEACON_REPORT_MODE_TABLE = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IEEE Std 802.11-2016, Table 9-88 - Beacon Request subelement IDs */
|
/* IEEE Std 802.11-2020, Table 9-104 - Optional subelement IDs for
|
||||||
/* IEEE P802.11-REVmd/D2.0, Table 9-106 - Optional subelement IDs for
|
|
||||||
* Beacon request */
|
* Beacon request */
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_SSID 0
|
#define WLAN_BEACON_REQUEST_SUBELEM_SSID 0
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_INFO 1 /* Beacon Reporting */
|
#define WLAN_BEACON_REQUEST_SUBELEM_INFO 1 /* Beacon Reporting */
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_DETAIL 2 /* Reporting Detail */
|
#define WLAN_BEACON_REQUEST_SUBELEM_DETAIL 2 /* Reporting Detail */
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_REQUEST 10
|
#define WLAN_BEACON_REQUEST_SUBELEM_REQUEST 10
|
||||||
|
#define WLAN_BEACON_REQUEST_SUBELEM_EXT_REQUEST 11
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL 51 /* AP Channel Report */
|
#define WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL 51 /* AP Channel Report */
|
||||||
|
#define WLAN_BEACON_REQUEST_SUBELEM_WIDE_BW_CS 163
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_LAST_INDICATION 164
|
#define WLAN_BEACON_REQUEST_SUBELEM_LAST_INDICATION 164
|
||||||
#define WLAN_BEACON_REQUEST_SUBELEM_VENDOR 221
|
#define WLAN_BEACON_REQUEST_SUBELEM_VENDOR 221
|
||||||
|
|
||||||
|
|
|
@ -772,6 +772,7 @@ int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len,
|
||||||
|
|
||||||
|
|
||||||
static int wpas_beacon_rep_add_frame_body(struct bitfield *eids,
|
static int wpas_beacon_rep_add_frame_body(struct bitfield *eids,
|
||||||
|
struct bitfield *ext_eids,
|
||||||
enum beacon_report_detail detail,
|
enum beacon_report_detail detail,
|
||||||
struct wpa_bss *bss, u8 *buf,
|
struct wpa_bss *bss, u8 *buf,
|
||||||
size_t buf_len, const u8 **ies_buf,
|
size_t buf_len, const u8 **ies_buf,
|
||||||
|
@ -828,7 +829,9 @@ static int wpas_beacon_rep_add_frame_body(struct bitfield *eids,
|
||||||
*/
|
*/
|
||||||
while (ies_len > 2 && 2U + ies[1] <= ies_len && rem_len > 0) {
|
while (ies_len > 2 && 2U + ies[1] <= ies_len && rem_len > 0) {
|
||||||
if (detail == BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS ||
|
if (detail == BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS ||
|
||||||
(eids && bitfield_is_set(eids, ies[0]))) {
|
(eids && bitfield_is_set(eids, ies[0])) ||
|
||||||
|
(ext_eids && ies[0] == WLAN_EID_EXTENSION && ies[1] &&
|
||||||
|
bitfield_is_set(ext_eids, ies[2]))) {
|
||||||
u8 elen = ies[1];
|
u8 elen = ies[1];
|
||||||
|
|
||||||
if (2 + elen > buf + buf_len - pos ||
|
if (2 + elen > buf + buf_len - pos ||
|
||||||
|
@ -876,7 +879,8 @@ static int wpas_add_beacon_rep_elem(struct beacon_rep_data *data,
|
||||||
|
|
||||||
os_memcpy(buf, rep, sizeof(*rep));
|
os_memcpy(buf, rep, sizeof(*rep));
|
||||||
|
|
||||||
ret = wpas_beacon_rep_add_frame_body(data->eids, data->report_detail,
|
ret = wpas_beacon_rep_add_frame_body(data->eids, data->ext_eids,
|
||||||
|
data->report_detail,
|
||||||
bss, buf + sizeof(*rep),
|
bss, buf + sizeof(*rep),
|
||||||
14 + *ie_len, ie, ie_len,
|
14 + *ie_len, ie, ie_len,
|
||||||
idx == 0);
|
idx == 0);
|
||||||
|
@ -1043,6 +1047,7 @@ static int wpas_rm_handle_beacon_req_subelem(struct wpa_supplicant *wpa_s,
|
||||||
struct beacon_rep_data *data,
|
struct beacon_rep_data *data,
|
||||||
u8 sid, u8 slen, const u8 *subelem)
|
u8 sid, u8 slen, const u8 *subelem)
|
||||||
{
|
{
|
||||||
|
struct bitfield *eids;
|
||||||
u8 report_info, i;
|
u8 report_info, i;
|
||||||
|
|
||||||
switch (sid) {
|
switch (sid) {
|
||||||
|
@ -1096,6 +1101,7 @@ static int wpas_rm_handle_beacon_req_subelem(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WLAN_BEACON_REQUEST_SUBELEM_REQUEST:
|
case WLAN_BEACON_REQUEST_SUBELEM_REQUEST:
|
||||||
|
case WLAN_BEACON_REQUEST_SUBELEM_EXT_REQUEST:
|
||||||
if (data->report_detail !=
|
if (data->report_detail !=
|
||||||
BEACON_REPORT_DETAIL_REQUESTED_ONLY) {
|
BEACON_REPORT_DETAIL_REQUESTED_ONLY) {
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
|
@ -1111,20 +1117,28 @@ static int wpas_rm_handle_beacon_req_subelem(struct wpa_supplicant *wpa_s,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->eids) {
|
if ((sid == WLAN_BEACON_REQUEST_SUBELEM_REQUEST &&
|
||||||
|
data->eids) ||
|
||||||
|
(sid == WLAN_BEACON_REQUEST_SUBELEM_EXT_REQUEST &&
|
||||||
|
data->ext_eids)) {
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"Beacon Request: Request subelement appears more than once");
|
"Beacon Request: Request sub elements appear more than once");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->eids = bitfield_alloc(255);
|
eids = bitfield_alloc(255);
|
||||||
if (!data->eids) {
|
if (!eids) {
|
||||||
wpa_printf(MSG_DEBUG, "Failed to allocate EIDs bitmap");
|
wpa_printf(MSG_DEBUG, "Failed to allocate EIDs bitmap");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sid == WLAN_BEACON_REQUEST_SUBELEM_REQUEST)
|
||||||
|
data->eids = eids;
|
||||||
|
else
|
||||||
|
data->ext_eids = eids;
|
||||||
|
|
||||||
for (i = 0; i < slen; i++)
|
for (i = 0; i < slen; i++)
|
||||||
bitfield_set(data->eids, subelem[i]);
|
bitfield_set(eids, subelem[i]);
|
||||||
break;
|
break;
|
||||||
case WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL:
|
case WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL:
|
||||||
/* Skip - it will be processed when freqs are added */
|
/* Skip - it will be processed when freqs are added */
|
||||||
|
@ -1587,6 +1601,7 @@ void wpas_clear_beacon_rep_data(struct wpa_supplicant *wpa_s)
|
||||||
|
|
||||||
eloop_cancel_timeout(wpas_rrm_scan_timeout, wpa_s, NULL);
|
eloop_cancel_timeout(wpas_rrm_scan_timeout, wpa_s, NULL);
|
||||||
bitfield_free(data->eids);
|
bitfield_free(data->eids);
|
||||||
|
bitfield_free(data->ext_eids);
|
||||||
os_free(data->scan_params.freqs);
|
os_free(data->scan_params.freqs);
|
||||||
os_memset(data, 0, sizeof(*data));
|
os_memset(data, 0, sizeof(*data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,6 +492,7 @@ struct beacon_rep_data {
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
enum beacon_report_detail report_detail;
|
enum beacon_report_detail report_detail;
|
||||||
struct bitfield *eids;
|
struct bitfield *eids;
|
||||||
|
struct bitfield *ext_eids;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue