Passive Client Taxonomy
[mech_eap.git] / src / ap / ieee802_11.c
index e3b7391..f1c396b 100644 (file)
@@ -42,6 +42,9 @@
 #include "hw_features.h"
 #include "ieee802_11.h"
 #include "dfs.h"
+#include "mbo_ap.h"
+#include "rrm.h"
+#include "taxonomy.h"
 
 
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
@@ -139,6 +142,7 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd)
        int capab = WLAN_CAPABILITY_ESS;
        int privacy;
        int dfs;
+       int i;
 
        /* Check if any of configured channels require DFS */
        dfs = hostapd_is_dfs_required(hapd->iface);
@@ -186,8 +190,12 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd)
            (hapd->iconf->spectrum_mgmt_required || dfs))
                capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
 
-       if (hapd->conf->radio_measurements)
-               capab |= IEEE80211_CAP_RRM;
+       for (i = 0; i < RRM_CAPABILITIES_IE_LEN; i++) {
+               if (hapd->conf->radio_measurements[i]) {
+                       capab |= IEEE80211_CAP_RRM;
+                       break;
+               }
+       }
 
        return capab;
 }
@@ -511,6 +519,9 @@ static void auth_sae_retransmit_timer(void *eloop_ctx, void *eloop_data)
        if (sae_check_big_sync(sta))
                return;
        sta->sae->sync++;
+       wpa_printf(MSG_DEBUG, "SAE: Auth SAE retransmit timer for " MACSTR
+                  " (sync=%d state=%d)",
+                  MAC2STR(sta->addr), sta->sae->sync, sta->sae->state);
 
        switch (sta->sae->state) {
        case SAE_COMMITTED:
@@ -553,6 +564,18 @@ static void sae_set_retransmit_timer(struct hostapd_data *hapd,
 }
 
 
+void sae_accept_sta(struct hostapd_data *hapd, struct sta_info *sta)
+{
+       sta->flags |= WLAN_STA_AUTH;
+       sta->auth_alg = WLAN_AUTH_SAE;
+       mlme_authenticate_indication(hapd, sta);
+       wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
+       sta->sae->state = SAE_ACCEPTED;
+       wpa_auth_pmksa_add_sae(hapd->wpa_auth, sta->addr,
+                              sta->sae->pmk, sta->sae->pmkid);
+}
+
+
 static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta,
                       const u8 *bssid, u8 auth_transaction)
 {
@@ -675,13 +698,7 @@ static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta,
 
                        sae_set_retransmit_timer(hapd, sta);
                } else {
-                       sta->flags |= WLAN_STA_AUTH;
-                       sta->auth_alg = WLAN_AUTH_SAE;
-                       mlme_authenticate_indication(hapd, sta);
-                       wpa_auth_sm_event(sta->wpa_sm, WPA_AUTH);
-                       sta->sae->state = SAE_ACCEPTED;
-                       wpa_auth_pmksa_add_sae(hapd->wpa_auth, sta->addr,
-                                              sta->sae->pmk, sta->sae->pmkid);
+                       sae_accept_sta(hapd, sta);
                }
                break;
        case SAE_ACCEPTED:
@@ -690,6 +707,7 @@ static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta,
                                   ") doing reauthentication",
                                   MAC2STR(sta->addr));
                        ap_free_sta(hapd, sta);
+                       wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr);
                } else {
                        if (sae_check_big_sync(sta))
                                return WLAN_STATUS_SUCCESS;
@@ -710,6 +728,44 @@ static int sae_sm_step(struct hostapd_data *hapd, struct sta_info *sta,
 }
 
 
+static void sae_pick_next_group(struct hostapd_data *hapd, struct sta_info *sta)
+{
+       struct sae_data *sae = sta->sae;
+       int i, *groups = hapd->conf->sae_groups;
+
+       if (sae->state != SAE_COMMITTED)
+               return;
+
+       wpa_printf(MSG_DEBUG, "SAE: Previously selected group: %d", sae->group);
+
+       for (i = 0; groups && groups[i] > 0; i++) {
+               if (sae->group == groups[i])
+                       break;
+       }
+
+       if (!groups || groups[i] <= 0) {
+               wpa_printf(MSG_DEBUG,
+                          "SAE: Previously selected group not found from the current configuration");
+               return;
+       }
+
+       for (;;) {
+               i++;
+               if (groups[i] <= 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "SAE: No alternative group enabled");
+                       return;
+               }
+
+               if (sae_set_group(sae, groups[i]) < 0)
+                       continue;
+
+               break;
+       }
+       wpa_printf(MSG_DEBUG, "SAE: Selected new group: %d", groups[i]);
+}
+
+
 static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                            const struct ieee80211_mgmt *mgmt, size_t len,
                            u16 auth_transaction, u16 status_code)
@@ -732,6 +788,13 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                sta->sae->sync = 0;
        }
 
+       if (sta->mesh_sae_pmksa_caching) {
+               wpa_printf(MSG_DEBUG,
+                          "SAE: Cancel use of mesh PMKSA caching because peer starts SAE authentication");
+               wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr);
+               sta->mesh_sae_pmksa_caching = 0;
+       }
+
        if (auth_transaction == 1) {
                const u8 *token = NULL, *pos, *end;
                size_t token_len = 0;
@@ -790,6 +853,16 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                        return;
                }
 
+               if ((hapd->conf->mesh & MESH_ENABLED) &&
+                   status_code ==
+                   WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED &&
+                   sta->sae->tmp) {
+                       wpa_printf(MSG_DEBUG,
+                                  "SAE: Peer did not accept our SAE group");
+                       sae_pick_next_group(hapd, sta);
+                       goto remove_sta;
+               }
+
                if (status_code != WLAN_STATUS_SUCCESS)
                        goto remove_sta;
 
@@ -1205,8 +1278,8 @@ static void handle_auth(struct hostapd_data *hapd,
                sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTH |
                                WLAN_STA_AUTHORIZED);
 
-               if (hostapd_sta_add(hapd, sta->addr, 0, 0, 0, 0, 0,
-                                   NULL, NULL, sta->flags, 0, 0, 0)) {
+               if (hostapd_sta_add(hapd, sta->addr, 0, 0, NULL, 0, 0,
+                                   NULL, NULL, sta->flags, 0, 0, 0, 0)) {
                        hostapd_logger(hapd, sta->addr,
                                       HOSTAPD_MODULE_IEEE80211,
                                       HOSTAPD_LEVEL_NOTICE,
@@ -1313,6 +1386,9 @@ int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta)
                return 0;
        }
 
+       if (TEST_FAIL())
+               return -1;
+
        for (i = 0; i < AID_WORDS; i++) {
                if (hapd->sta_aid[i] == (u32) -1)
                        continue;
@@ -1713,6 +1789,27 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
                sta->mb_ies = NULL;
 #endif /* CONFIG_FST */
 
+#ifdef CONFIG_MBO
+       mbo_ap_check_sta_assoc(hapd, sta, &elems);
+
+       if (hapd->conf->mbo_enabled && (hapd->conf->wpa & 2) &&
+           elems.mbo && sta->cell_capa && !(sta->flags & WLAN_STA_MFP) &&
+           hapd->conf->ieee80211w != NO_MGMT_FRAME_PROTECTION) {
+               wpa_printf(MSG_INFO,
+                          "MBO: Reject WPA2 association without PMF");
+               return WLAN_STATUS_UNSPECIFIED_FAILURE;
+       }
+#endif /* CONFIG_MBO */
+
+       ap_copy_sta_supp_op_classes(sta, elems.supp_op_classes,
+                                   elems.supp_op_classes_len);
+
+       if ((sta->capability & WLAN_CAPABILITY_RADIO_MEASUREMENT) &&
+           elems.rrm_enabled &&
+           elems.rrm_enabled_len >= sizeof(sta->rrm_enabled_capa))
+               os_memcpy(sta->rrm_enabled_capa, elems.rrm_enabled,
+                         sizeof(sta->rrm_enabled_capa));
+
        return WLAN_STATUS_SUCCESS;
 }
 
@@ -1739,6 +1836,63 @@ static void send_deauth(struct hostapd_data *hapd, const u8 *addr,
 }
 
 
+static int add_associated_sta(struct hostapd_data *hapd,
+                             struct sta_info *sta)
+{
+       struct ieee80211_ht_capabilities ht_cap;
+       struct ieee80211_vht_capabilities vht_cap;
+
+       /*
+        * Remove the STA entry to ensure the STA PS state gets cleared and
+        * configuration gets updated. This is relevant for cases, such as
+        * FT-over-the-DS, where a station re-associates back to the same AP but
+        * skips the authentication flow, or if working with a driver that
+        * does not support full AP client state.
+        */
+       if (!sta->added_unassoc)
+               hostapd_drv_sta_remove(hapd, sta->addr);
+
+#ifdef CONFIG_IEEE80211N
+       if (sta->flags & WLAN_STA_HT)
+               hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap);
+#endif /* CONFIG_IEEE80211N */
+#ifdef CONFIG_IEEE80211AC
+       if (sta->flags & WLAN_STA_VHT)
+               hostapd_get_vht_capab(hapd, sta->vht_capabilities, &vht_cap);
+#endif /* CONFIG_IEEE80211AC */
+
+       /*
+        * Add the station with forced WLAN_STA_ASSOC flag. The sta->flags
+        * will be set when the ACK frame for the (Re)Association Response frame
+        * is processed (TX status driver event).
+        */
+       if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability,
+                           sta->supported_rates, sta->supported_rates_len,
+                           sta->listen_interval,
+                           sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
+                           sta->flags & WLAN_STA_VHT ? &vht_cap : NULL,
+                           sta->flags | WLAN_STA_ASSOC, sta->qosinfo,
+                           sta->vht_opmode, sta->p2p_ie ? 1 : 0,
+                           sta->added_unassoc)) {
+               hostapd_logger(hapd, sta->addr,
+                              HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_NOTICE,
+                              "Could not %s STA to kernel driver",
+                              sta->added_unassoc ? "set" : "add");
+
+               if (sta->added_unassoc) {
+                       hostapd_drv_sta_remove(hapd, sta->addr);
+                       sta->added_unassoc = 0;
+               }
+
+               return -1;
+       }
+
+       sta->added_unassoc = 0;
+
+       return 0;
+}
+
+
 static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
                           u16 status_code, int reassoc, const u8 *ies,
                           size_t ies_len)
@@ -1791,7 +1945,23 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 
 #ifdef CONFIG_IEEE80211AC
        if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) {
-               p = hostapd_eid_vht_capabilities(hapd, p);
+               u32 nsts = 0, sta_nsts;
+
+               if (hapd->conf->use_sta_nsts && sta->vht_capabilities) {
+                       struct ieee80211_vht_capabilities *capa;
+
+                       nsts = (hapd->iface->conf->vht_capab >>
+                               VHT_CAP_BEAMFORMEE_STS_OFFSET) & 7;
+                       capa = sta->vht_capabilities;
+                       sta_nsts = (le_to_host32(capa->vht_capabilities_info) >>
+                                   VHT_CAP_BEAMFORMEE_STS_OFFSET) & 7;
+
+                       if (nsts < sta_nsts)
+                               nsts = 0;
+                       else
+                               nsts = sta_nsts;
+               }
+               p = hostapd_eid_vht_capabilities(hapd, p, nsts);
                p = hostapd_eid_vht_operation(hapd, p);
        }
 #endif /* CONFIG_IEEE80211AC */
@@ -1859,6 +2029,16 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
                p = hostapd_eid_p2p_manage(hapd, p);
 #endif /* CONFIG_P2P_MANAGER */
 
+       p = hostapd_eid_mbo(hapd, p, buf + sizeof(buf) - p);
+
+       if (hapd->conf->assocresp_elements &&
+           (size_t) (buf + sizeof(buf) - p) >=
+           wpabuf_len(hapd->conf->assocresp_elements)) {
+               os_memcpy(p, wpabuf_head(hapd->conf->assocresp_elements),
+                         wpabuf_len(hapd->conf->assocresp_elements));
+               p += wpabuf_len(hapd->conf->assocresp_elements);
+       }
+
        send_len += p - reply->u.assoc_resp.variable;
 
        if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0) {
@@ -1992,6 +2172,19 @@ static void handle_assoc(struct hostapd_data *hapd,
                goto fail;
        }
 
+#ifdef CONFIG_MBO
+       if (hapd->conf->mbo_enabled && hapd->mbo_assoc_disallow) {
+               resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
+               goto fail;
+       }
+#endif /* CONFIG_MBO */
+
+       /*
+        * sta->capability is used in check_assoc_ies() for RRM enabled
+        * capability element.
+        */
+       sta->capability = capab_info;
+
        /* followed by SSID and Supported rates; and HT capabilities if 802.11n
         * is used */
        resp = check_assoc_ies(hapd, sta, pos, left, reassoc);
@@ -2005,7 +2198,6 @@ static void handle_assoc(struct hostapd_data *hapd,
                goto fail;
        }
 
-       sta->capability = capab_info;
        sta->listen_interval = listen_interval;
 
        if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
@@ -2075,10 +2267,41 @@ static void handle_assoc(struct hostapd_data *hapd,
         * remove the STA immediately. */
        sta->timeout_next = STA_NULLFUNC;
 
+#ifdef CONFIG_TAXONOMY
+       taxonomy_sta_info_assoc_req(hapd, sta, pos, left);
+#endif /* CONFIG_TAXONOMY */
+
  fail:
+       /*
+        * In case of a successful response, add the station to the driver.
+        * Otherwise, the kernel may ignore Data frames before we process the
+        * ACK frame (TX status). In case of a failure, this station will be
+        * removed.
+        *
+        * Note that this is not compliant with the IEEE 802.11 standard that
+        * states that a non-AP station should transition into the
+        * authenticated/associated state only after the station acknowledges
+        * the (Re)Association Response frame. However, still do this as:
+        *
+        * 1. In case the station does not acknowledge the (Re)Association
+        *    Response frame, it will be removed.
+        * 2. Data frames will be dropped in the kernel until the station is
+        *    set into authorized state, and there are no significant known
+        *    issues with processing other non-Data Class 3 frames during this
+        *    window.
+        */
+       if (resp == WLAN_STATUS_SUCCESS && add_associated_sta(hapd, sta))
+               resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
+
        reply_res = send_assoc_resp(hapd, sta, resp, reassoc, pos, left);
-       if (sta->added_unassoc && (resp != WLAN_STATUS_SUCCESS ||
-                                  reply_res != WLAN_STATUS_SUCCESS)) {
+
+       /*
+        * Remove the station in case tranmission of a success response fails
+        * (the STA was added associated to the driver) or if the station was
+        * previously added unassociated.
+        */
+       if ((reply_res != WLAN_STATUS_SUCCESS &&
+            resp == WLAN_STATUS_SUCCESS) || sta->added_unassoc) {
                hostapd_drv_sta_remove(hapd, sta->addr);
                sta->added_unassoc = 0;
        }
@@ -2345,6 +2568,9 @@ static int handle_action(struct hostapd_data *hapd,
                                return 1;
                }
                break;
+       case WLAN_ACTION_RADIO_MEASUREMENT:
+               hostapd_handle_radio_measurement(hapd, (const u8 *) mgmt, len);
+               return 1;
        }
 
        hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
@@ -2352,8 +2578,9 @@ static int handle_action(struct hostapd_data *hapd,
                       "handle_action - unknown action category %d or invalid "
                       "frame",
                       mgmt->u.action.category);
-       if (!(mgmt->da[0] & 0x01) && !(mgmt->u.action.category & 0x80) &&
-           !(mgmt->sa[0] & 0x01)) {
+       if (!is_multicast_ether_addr(mgmt->da) &&
+           !(mgmt->u.action.category & 0x80) &&
+           !is_multicast_ether_addr(mgmt->sa)) {
                struct ieee80211_mgmt *resp;
 
                /*
@@ -2400,7 +2627,6 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
                    struct hostapd_frame_info *fi)
 {
        struct ieee80211_mgmt *mgmt;
-       int broadcast;
        u16 fc, stype;
        int ret = 0;
 
@@ -2416,11 +2642,7 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
                return 1;
        }
 
-       broadcast = mgmt->bssid[0] == 0xff && mgmt->bssid[1] == 0xff &&
-               mgmt->bssid[2] == 0xff && mgmt->bssid[3] == 0xff &&
-               mgmt->bssid[4] == 0xff && mgmt->bssid[5] == 0xff;
-
-       if (!broadcast &&
+       if (!is_broadcast_ether_addr(mgmt->bssid) &&
 #ifdef CONFIG_P2P
            /* Invitation responses can be sent with the peer MAC as BSSID */
            !((hapd->conf->p2p & P2P_GROUP_OWNER) &&
@@ -2574,8 +2796,6 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
        u16 status;
        struct sta_info *sta;
        int new_assoc = 1;
-       struct ieee80211_ht_capabilities ht_cap;
-       struct ieee80211_vht_capabilities vht_cap;
 
        sta = ap_get_sta(hapd, mgmt->da);
        if (!sta) {
@@ -2589,21 +2809,26 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
                wpa_printf(MSG_INFO,
                           "handle_assoc_cb(reassoc=%d) - too short payload (len=%lu)",
                           reassoc, (unsigned long) len);
-               goto remove_sta;
+               hostapd_drv_sta_remove(hapd, sta->addr);
+               return;
        }
 
+       if (reassoc)
+               status = le_to_host16(mgmt->u.reassoc_resp.status_code);
+       else
+               status = le_to_host16(mgmt->u.assoc_resp.status_code);
+
        if (!ok) {
                hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_DEBUG,
                               "did not acknowledge association response");
                sta->flags &= ~WLAN_STA_ASSOC_REQ_OK;
-               goto remove_sta;
-       }
+               /* The STA is added only in case of SUCCESS */
+               if (status == WLAN_STATUS_SUCCESS)
+                       hostapd_drv_sta_remove(hapd, sta->addr);
 
-       if (reassoc)
-               status = le_to_host16(mgmt->u.reassoc_resp.status_code);
-       else
-               status = le_to_host16(mgmt->u.assoc_resp.status_code);
+               return;
+       }
 
        if (status != WLAN_STATUS_SUCCESS)
                return;
@@ -2639,54 +2864,6 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
        sta->sa_query_timed_out = 0;
 #endif /* CONFIG_IEEE80211W */
 
-       /*
-        * Remove the STA entry in order to make sure the STA PS state gets
-        * cleared and configuration gets updated in case of reassociation back
-        * to the same AP.
-        *
-        * This is relevant for cases, such as FT over the DS, where a station
-        * reassociates back to the same AP but skips the authentication flow
-        * and if working with a driver that doesn't support full AP client
-        * state.
-        */
-       if (!sta->added_unassoc)
-               hostapd_drv_sta_remove(hapd, sta->addr);
-
-#ifdef CONFIG_IEEE80211N
-       if (sta->flags & WLAN_STA_HT)
-               hostapd_get_ht_capab(hapd, sta->ht_capabilities, &ht_cap);
-#endif /* CONFIG_IEEE80211N */
-#ifdef CONFIG_IEEE80211AC
-       if (sta->flags & WLAN_STA_VHT)
-               hostapd_get_vht_capab(hapd, sta->vht_capabilities, &vht_cap);
-#endif /* CONFIG_IEEE80211AC */
-
-       if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability,
-                           sta->supported_rates, sta->supported_rates_len,
-                           sta->listen_interval,
-                           sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
-                           sta->flags & WLAN_STA_VHT ? &vht_cap : NULL,
-                           sta->flags, sta->qosinfo, sta->vht_opmode,
-                           sta->added_unassoc)) {
-               hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
-                              HOSTAPD_LEVEL_NOTICE,
-                              "Could not %s STA to kernel driver",
-                              sta->added_unassoc ? "set" : "add");
-               ap_sta_disconnect(hapd, sta, sta->addr,
-                                 WLAN_REASON_DISASSOC_AP_BUSY);
-               if (sta->added_unassoc)
-                       goto remove_sta;
-               return;
-       }
-
-       /*
-        * added_unassoc flag is set for a station that was added to the driver
-        * in unassociated state. Clear this flag once the station has completed
-        * association, to make sure the STA entry will be cleared from the
-        * driver in case of reassociation back to the same AP.
-        */
-       sta->added_unassoc = 0;
-
        if (sta->flags & WLAN_STA_WDS) {
                int ret;
                char ifname_wds[IFNAMSIZ + 1];
@@ -2718,13 +2895,25 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
        else
                wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC);
        hapd->new_assoc_sta_cb(hapd, sta, !new_assoc);
-
        ieee802_1x_notify_port_enabled(sta->eapol_sm, 1);
 
-remove_sta:
-       if (sta->added_unassoc) {
-               hostapd_drv_sta_remove(hapd, sta->addr);
-               sta->added_unassoc = 0;
+       if (sta->pending_eapol_rx) {
+               struct os_reltime now, age;
+
+               os_get_reltime(&now);
+               os_reltime_sub(&now, &sta->pending_eapol_rx->rx_time, &age);
+               if (age.sec == 0 && age.usec < 200000) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Process pending EAPOL frame that was received from " MACSTR " just before association notification",
+                                  MAC2STR(sta->addr));
+                       ieee802_1x_receive(
+                               hapd, mgmt->da,
+                               wpabuf_head(sta->pending_eapol_rx->buf),
+                               wpabuf_len(sta->pending_eapol_rx->buf));
+               }
+               wpabuf_free(sta->pending_eapol_rx->buf);
+               os_free(sta->pending_eapol_rx);
+               sta->pending_eapol_rx = NULL;
        }
 }
 
@@ -2734,7 +2923,7 @@ static void handle_deauth_cb(struct hostapd_data *hapd,
                             size_t len, int ok)
 {
        struct sta_info *sta;
-       if (mgmt->da[0] & 0x01)
+       if (is_multicast_ether_addr(mgmt->da))
                return;
        sta = ap_get_sta(hapd, mgmt->da);
        if (!sta) {
@@ -2758,7 +2947,7 @@ static void handle_disassoc_cb(struct hostapd_data *hapd,
                               size_t len, int ok)
 {
        struct sta_info *sta;
-       if (mgmt->da[0] & 0x01)
+       if (is_multicast_ether_addr(mgmt->da))
                return;
        sta = ap_get_sta(hapd, mgmt->da);
        if (!sta) {
@@ -2814,7 +3003,7 @@ void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
                handle_assoc_cb(hapd, mgmt, len, 1, ok);
                break;
        case WLAN_FC_STYPE_PROBE_RESP:
-               wpa_printf(MSG_EXCESSIVE, "mgmt::proberesp cb");
+               wpa_printf(MSG_EXCESSIVE, "mgmt::proberesp cb ok=%d", ok);
                break;
        case WLAN_FC_STYPE_DEAUTH:
                wpa_printf(MSG_DEBUG, "mgmt::deauth cb");
@@ -2825,7 +3014,7 @@ void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
                handle_disassoc_cb(hapd, mgmt, len, ok);
                break;
        case WLAN_FC_STYPE_ACTION:
-               wpa_printf(MSG_DEBUG, "mgmt::action cb");
+               wpa_printf(MSG_DEBUG, "mgmt::action cb ok=%d", ok);
                break;
        default:
                wpa_printf(MSG_INFO, "unknown mgmt cb frame subtype %d", stype);
@@ -2923,6 +3112,8 @@ void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr)
        }
        if (sta == NULL)
                return;
+       wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POLL_OK MACSTR,
+               MAC2STR(sta->addr));
        if (!(sta->flags & WLAN_STA_PENDING_POLL))
                return;
 
@@ -2961,7 +3152,7 @@ void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src,
 
        wpa_printf(MSG_DEBUG, "Data/PS-poll frame from not associated STA "
                   MACSTR, MAC2STR(src));
-       if (src[0] & 0x01) {
+       if (is_multicast_ether_addr(src)) {
                /* Broadcast bit set in SA?! Ignore the frame silently. */
                return;
        }