]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add support for using SA Query with drivers that implement MLME
authorMahesh Palivela <mpalivel@qca.qualcomm.com>
Mon, 22 Aug 2011 21:35:26 +0000 (14:35 -0700)
committerJouni Malinen <j@w1.fi>
Wed, 1 Aug 2012 10:11:56 +0000 (13:11 +0300)
This allows the SA Query mechanism in hostapd to be used with drivers
that implement authentication and association MLME/SME.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/drv_callbacks.c
src/ap/sta_info.c
src/drivers/driver_atheros.c

index eeda19e7ed06cacd83c66abf780fe12a7ea453b4..273a1932054c8f5d92c54e4d85f0537b3b4d51e0 100644 (file)
@@ -182,6 +182,39 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                        }
                        goto fail;
                }
+#ifdef CONFIG_IEEE80211W
+               if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
+                   sta->sa_query_count > 0)
+                       ap_check_sa_query_timeout(hapd, sta);
+               if ((sta->flags & WLAN_STA_MFP) && !sta->sa_query_timed_out &&
+                   (sta->auth_alg != WLAN_AUTH_FT)) {
+                       /*
+                        * STA has already been associated with MFP and SA
+                        * Query timeout has not been reached. Reject the
+                        * association attempt temporarily and start SA Query,
+                        * if one is not pending.
+                        */
+
+                       if (sta->sa_query_count == 0)
+                               ap_sta_start_sa_query(hapd, sta);
+
+#ifdef CONFIG_IEEE80211R
+                       status = WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY;
+
+                       p = hostapd_eid_assoc_comeback_time(hapd, sta, p);
+
+                       hostapd_sta_assoc(hapd, addr, reassoc, status, buf,
+                                         p - buf);
+#endif /* CONFIG_IEEE80211R */
+                       return 0;
+               }
+
+               if (wpa_auth_uses_mfp(sta->wpa_sm))
+                       sta->flags |= WLAN_STA_MFP;
+               else
+                       sta->flags &= ~WLAN_STA_MFP;
+#endif /* CONFIG_IEEE80211W */
+
 #ifdef CONFIG_IEEE80211R
                if (sta->auth_alg == WLAN_AUTH_FT) {
                        status = wpa_ft_validate_reassoc(sta->wpa_sm, req_ies,
@@ -445,6 +478,9 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
 {
        struct sta_info *sta;
 
+        wpa_printf(MSG_DEBUG, "RX_ACTION cat %d action plen %d",
+                  action->category, (int) action->len);
+
        sta = ap_get_sta(hapd, action->sa);
        if (sta == NULL) {
                wpa_printf(MSG_DEBUG, "%s: station not found", __func__);
@@ -457,6 +493,15 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
                wpa_ft_action_rx(sta->wpa_sm, action->data, action->len);
        }
 #endif /* CONFIG_IEEE80211R */
+#ifdef CONFIG_IEEE80211W
+       if (action->category == WLAN_ACTION_SA_QUERY && action->len >= 4) {
+               wpa_printf(MSG_DEBUG, "%s: SA_QUERY_ACTION length %d",
+                          __func__, (int) action->len);
+               ieee802_11_sa_query_action(hapd, action->sa,
+                                          *(action->data + 1),
+                                          action->data + 2);
+       }
+#endif /* CONFIG_IEEE80211W */
 }
 
 
index 95b701cc6e10c71b85c767bd79223d2062a97eed..34c3c3000449d3c45c35ea3ffd57a28960fad84c 100644 (file)
@@ -818,9 +818,7 @@ static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx)
                       HOSTAPD_LEVEL_DEBUG,
                       "association SA Query attempt %d", sta->sa_query_count);
 
-#ifdef NEED_AP_MLME
        ieee802_11_send_sa_query_req(hapd, sta->addr, trans_id);
-#endif /* NEED_AP_MLME */
 }
 
 
index 73898d3fbe4ce011ed142491d8f20f65c1c3199f..97747dd12083f51c849ace6ce031c82aa44d3e10 100644 (file)
@@ -862,7 +862,8 @@ static int atheros_receive_pkt(struct atheros_driver_data *drv)
 #endif /* CONFIG_WPS */
 #ifdef CONFIG_IEEE80211R
        filt.app_filterype |= (IEEE80211_FILTER_TYPE_ASSOC_REQ |
-                              IEEE80211_FILTER_TYPE_AUTH);
+                              IEEE80211_FILTER_TYPE_AUTH |
+                              IEEE80211_FILTER_TYPE_ACTION);
 #endif
        if (filt.app_filterype) {
                ret = set80211priv(drv, IEEE80211_IOCTL_FILTERFRAME, &filt,