]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Process received WNM Notification Request for beacon protection failures
authorJouni Malinen <jouni@codeaurora.org>
Wed, 1 Apr 2020 13:29:24 +0000 (16:29 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 1 Apr 2020 13:30:12 +0000 (16:30 +0300)
Report received notifications for beacon protection failures in syslog
and control interface.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/wnm_ap.c

index 891f90f298a0dd888f83065e0060ca8341e8bd3b..67281b38d166479c38b1697cb17caf4955bb1c2c 100644 (file)
@@ -522,6 +522,30 @@ static void ieee802_11_rx_bss_trans_mgmt_resp(struct hostapd_data *hapd,
 }
 
 
+static void wnm_beacon_protection_failure(struct hostapd_data *hapd,
+                                         const u8 *addr)
+{
+       struct sta_info *sta;
+
+       if (!hapd->conf->beacon_prot)
+               return;
+
+       sta = ap_get_sta(hapd, addr);
+       if (!sta || !(sta->flags & WLAN_STA_AUTHORIZED)) {
+               wpa_printf(MSG_DEBUG, "Station " MACSTR
+                          " not found for received WNM-Notification Request",
+                          MAC2STR(addr));
+               return;
+       }
+
+       hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+                      HOSTAPD_LEVEL_INFO,
+                      "Beacon protection failure reported");
+       wpa_msg(hapd->msg_ctx, MSG_INFO, WPA_EVENT_UNPROT_BEACON "reporter="
+               MACSTR, MAC2STR(addr));
+}
+
+
 static void ieee802_11_rx_wnm_notification_req(struct hostapd_data *hapd,
                                               const u8 *addr, const u8 *buf,
                                               size_t len)
@@ -540,8 +564,14 @@ static void ieee802_11_rx_wnm_notification_req(struct hostapd_data *hapd,
                   MAC2STR(addr), dialog_token, type);
        wpa_hexdump(MSG_MSGDUMP, "WNM: Notification Request subelements",
                    buf, len);
-       if (type == WLAN_EID_VENDOR_SPECIFIC)
+       switch (type) {
+       case WNM_NOTIF_TYPE_BEACON_PROTECTION_FAILURE:
+               wnm_beacon_protection_failure(hapd, addr);
+               break;
+       case WNM_NOTIF_TYPE_VENDOR_SPECIFIC:
                mbo_ap_wnm_notification_req(hapd, addr, buf, len);
+               break;
+       }
 }