RRM: Send response when Beacon report request is not supported/refused

Send Radio Measurement response with measurement mode set to reject
in the following cases:
 1. Reporting conditions is not supported.
 2. No valid channels found for the measurement

Sending a response with an incapable indication will stop the AP from
sending other measurement requests of the same type as specified
in IEEE Std 802.11-2016, 11.11.6.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
This commit is contained in:
Avraham Stern 2017-06-11 15:41:21 +03:00 committed by Jouni Malinen
parent 3756acfd48
commit 705e2909c6

View file

@ -967,7 +967,7 @@ static int wpas_rm_handle_beacon_req_subelem(struct wpa_supplicant *wpa_s,
BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS) { BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS) {
wpa_printf(MSG_DEBUG, "Invalid reporting detail: %u", wpa_printf(MSG_DEBUG, "Invalid reporting detail: %u",
subelem[0]); subelem[0]);
return 0; return -1;
} }
break; break;
@ -1034,6 +1034,7 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
u32 interval_usec; u32 interval_usec;
u32 _rand; u32 _rand;
int ret = 0, res; int ret = 0, res;
u8 reject_mode;
if (len < sizeof(*req)) if (len < sizeof(*req))
return -1; return -1;
@ -1067,9 +1068,12 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
res = wpas_rm_handle_beacon_req_subelem( res = wpas_rm_handle_beacon_req_subelem(
wpa_s, data, subelems[0], subelems[1], &subelems[2]); wpa_s, data, subelems[0], subelems[1], &subelems[2]);
if (res != 1) { if (res < 0) {
ret = res; ret = res;
goto out; goto out;
} else if (!res) {
reject_mode = MEASUREMENT_REPORT_MODE_REJECT_INCAPABLE;
goto out_reject;
} }
elems_len -= 2 + subelems[1]; elems_len -= 2 + subelems[1];
@ -1087,7 +1091,8 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
req->variable, len - sizeof(*req)); req->variable, len - sizeof(*req));
if (!params->freqs) { if (!params->freqs) {
wpa_printf(MSG_DEBUG, "Beacon request: No valid channels"); wpa_printf(MSG_DEBUG, "Beacon request: No valid channels");
goto out; reject_mode = MEASUREMENT_REPORT_MODE_REJECT_REFUSED;
goto out_reject;
} }
params->duration = le_to_host16(req->duration); params->duration = le_to_host16(req->duration);
@ -1111,6 +1116,13 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
eloop_register_timeout(0, interval_usec, wpas_rrm_scan_timeout, wpa_s, eloop_register_timeout(0, interval_usec, wpas_rrm_scan_timeout, wpa_s,
NULL); NULL);
return 1; return 1;
out_reject:
if (!is_multicast_ether_addr(wpa_s->rrm.dst_addr) &&
wpas_rrm_report_elem(buf, elem_token, reject_mode,
MEASURE_TYPE_BEACON, NULL, 0) < 0) {
wpa_printf(MSG_DEBUG, "RRM: Failed to add report element");
ret = -1;
}
out: out:
wpas_clear_beacon_rep_data(wpa_s); wpas_clear_beacon_rep_data(wpa_s);
return ret; return ret;