]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RRM: Send response when Beacon report request is not supported/refused
authorAvraham Stern <avraham.stern@intel.com>
Sun, 11 Jun 2017 12:41:21 +0000 (15:41 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 17 Jul 2017 15:00:56 +0000 (18:00 +0300)
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>
wpa_supplicant/rrm.c

index f1b70c323ec9eb9aa467243852e03c9a24b95e3a..55f7f8306a9506e8685560f7a7321e39b1549404 100644 (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) {
                        wpa_printf(MSG_DEBUG, "Invalid reporting detail: %u",
                                   subelem[0]);
-                       return 0;
+                       return -1;
                }
 
                break;
@@ -1034,6 +1034,7 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
        u32 interval_usec;
        u32 _rand;
        int ret = 0, res;
+       u8 reject_mode;
 
        if (len < sizeof(*req))
                return -1;
@@ -1067,9 +1068,12 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
 
                res = wpas_rm_handle_beacon_req_subelem(
                        wpa_s, data, subelems[0], subelems[1], &subelems[2]);
-               if (res != 1) {
+               if (res < 0) {
                        ret = res;
                        goto out;
+               } else if (!res) {
+                       reject_mode = MEASUREMENT_REPORT_MODE_REJECT_INCAPABLE;
+                       goto out_reject;
                }
 
                elems_len -= 2 + subelems[1];
@@ -1087,7 +1091,8 @@ wpas_rm_handle_beacon_req(struct wpa_supplicant *wpa_s,
                req->variable, len - sizeof(*req));
        if (!params->freqs) {
                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);
@@ -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,
                               NULL);
        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:
        wpas_clear_beacon_rep_data(wpa_s);
        return ret;