]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Report received beacon report with BEACON-RESP-RX event
authorJouni Malinen <j@w1.fi>
Sun, 1 Jan 2017 23:08:01 +0000 (01:08 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 3 Jan 2017 14:02:58 +0000 (16:02 +0200)
The new hostapd control interface event "BEACON-RESP-RX <STA address>
<dialog token> <report mode> <beacon report>" is now used to report
received beacon reports as a reponse to the REQ_BEACON operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/rrm.c
src/common/wpa_ctrl.h

index 1ca7428c54ab6a0d98b7c2c017887c515760a3c7..28e8cc9be3bb413233b1452cccfdb53af378b0c7 100644 (file)
@@ -71,24 +71,47 @@ static void hostapd_handle_range_report(struct hostapd_data *hapd, u8 token,
 }
 
 
+static void hostapd_handle_beacon_report(struct hostapd_data *hapd,
+                                        const u8 *addr, u8 token, u8 rep_mode,
+                                        const u8 *pos, size_t len)
+{
+       char report[2 * 255 + 1];
+
+       wpa_printf(MSG_DEBUG, "Beacon report token %u len %zu from " MACSTR,
+                  token, len, MAC2STR(addr));
+       /* Skip to the beginning of the Beacon report */
+       if (len < 3)
+               return;
+       pos += 3;
+       len -= 3;
+       report[0] = '\0';
+       if (wpa_snprintf_hex(report, sizeof(report), pos, len) < 0)
+               return;
+       wpa_msg(hapd->msg_ctx, MSG_INFO, BEACON_RESP_RX MACSTR " %u %02x %s",
+               MAC2STR(addr), token, rep_mode, report);
+}
+
+
 static void hostapd_handle_radio_msmt_report(struct hostapd_data *hapd,
                                             const u8 *buf, size_t len)
 {
        const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) buf;
        const u8 *pos, *ie, *end;
-       u8 token;
+       u8 token, rep_mode;
 
        end = buf + len;
        token = mgmt->u.action.u.rrm.dialog_token;
        pos = mgmt->u.action.u.rrm.variable;
 
        while ((ie = get_ie(pos, end - pos, WLAN_EID_MEASURE_REPORT))) {
-               if (ie[1] < 5) {
+               if (ie[1] < 3) {
                        wpa_printf(MSG_DEBUG, "Bad Measurement Report element");
                        break;
                }
 
-               wpa_printf(MSG_DEBUG, "Measurement report type %u", ie[4]);
+               rep_mode = ie[3];
+               wpa_printf(MSG_DEBUG, "Measurement report mode 0x%x type %u",
+                          rep_mode, ie[4]);
 
                switch (ie[4]) {
                case MEASURE_TYPE_LCI:
@@ -97,6 +120,10 @@ static void hostapd_handle_radio_msmt_report(struct hostapd_data *hapd,
                case MEASURE_TYPE_FTM_RANGE:
                        hostapd_handle_range_report(hapd, token, ie + 2, ie[1]);
                        break;
+               case MEASURE_TYPE_BEACON:
+                       hostapd_handle_beacon_report(hapd, mgmt->sa, token,
+                                                    rep_mode, ie + 2, ie[1]);
+                       break;
                default:
                        wpa_printf(MSG_DEBUG,
                                   "Measurement report type %u is not supported",
index b68527ee32cbf987dd0bdad5b86e6bc0b07912fd..ec4e879225078d3920006437f1abca99afad13a4 100644 (file)
@@ -290,6 +290,8 @@ extern "C" {
 
 /* parameters: <STA address> <dialog token> <ack=0/1> */
 #define BEACON_REQ_TX_STATUS "BEACON-REQ-TX-STATUS "
+/* parameters: <STA address> <dialog token> <report mode> <beacon report> */
+#define BEACON_RESP_RX "BEACON-RESP-RX "
 
 /* PMKSA cache entry added; parameters: <BSSID> <network_id> */
 #define PMKSA_CACHE_ADDED "PMKSA-CACHE-ADDED "