]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Add STA flag to indicate the current WNM-Sleep-Mode state
authorJouni Malinen <j@w1.fi>
Fri, 27 Dec 2013 17:06:52 +0000 (19:06 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Dec 2013 17:35:12 +0000 (19:35 +0200)
This can be useful for displaying the current STA state and also for
determining whether some operations are likely to fail or need
additional delay.

Signed-hostap: Jouni Malinen <j@w1.fi>

hostapd/dump_state.c
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/ap/sta_info.h
src/ap/wnm_ap.c

index fcd98905159c26326dd7ecd1b9e020339f0b332e..2fa387f1479e4262c4ffbe49a10e75f1fa595224 100644 (file)
@@ -103,7 +103,7 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
                fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr));
 
                fprintf(f,
-                       "  AID=%d flags=0x%x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
+                       "  AID=%d flags=0x%x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
                        "\n"
                        "  capability=0x%x listen_interval=%d\n",
                        sta->aid,
@@ -126,6 +126,10 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
                        (sta->flags & WLAN_STA_WDS ? "[WDS]" : ""),
                        (sta->flags & WLAN_STA_NONERP ? "[NonERP]" : ""),
                        (sta->flags & WLAN_STA_WPS2 ? "[WPS2]" : ""),
+                       (sta->flags & WLAN_STA_GAS ? "[GAS]" : ""),
+                       (sta->flags & WLAN_STA_VHT ? "[VHT]" : ""),
+                       (sta->flags & WLAN_STA_WNM_SLEEP_MODE ?
+                        "[WNM_SLEEP_MODE]" : ""),
                        sta->capability,
                        sta->listen_interval);
 
index d0b2c1f3aaf14c7ac03e0b4860c295ef70f881fe..b1f7142e12430198181f3aaac959951bed516cf5 100644 (file)
@@ -299,6 +299,7 @@ skip_wpa_check:
 
        new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0;
        sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
+       sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
 
        if (reassoc && (sta->auth_alg == WLAN_AUTH_FT))
                wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
index 7c550e462777b7b8c7c47525dfa8235111e6733d..09bdf559a05f8ea76b6cf49c33c7e1be2aec33e9 100644 (file)
@@ -1931,6 +1931,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
        if (sta->flags & WLAN_STA_ASSOC)
                new_assoc = 0;
        sta->flags |= WLAN_STA_ASSOC;
+       sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
        if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa) ||
            sta->auth_alg == WLAN_AUTH_FT) {
                /*
index c696bd5e42084b95c71ffec57c247eaa58c37db1..291f9db520e96ba950f236137005408939c02d54 100644 (file)
@@ -29,6 +29,7 @@
 #define WLAN_STA_WPS2 BIT(16)
 #define WLAN_STA_GAS BIT(17)
 #define WLAN_STA_VHT BIT(18)
+#define WLAN_STA_WNM_SLEEP_MODE BIT(19)
 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
 #define WLAN_STA_NONERP BIT(31)
index 9d4363a115713f86aa881da51bfe19e9f8602c17..4089b6c2c62e497332efb034b9b3b933b7c938a6 100644 (file)
@@ -155,6 +155,7 @@ static int ieee802_11_send_wnmsleep_resp(struct hostapd_data *hapd,
                 */
                if (wnmsleep_ie.status == WNM_STATUS_SLEEP_ACCEPT &&
                    wnmsleep_ie.action_type == WNM_SLEEP_MODE_ENTER) {
+                       sta->flags |= WLAN_STA_WNM_SLEEP_MODE;
                        hostapd_drv_wnm_oper(hapd, WNM_SLEEP_ENTER_CONFIRM,
                                             addr, NULL, NULL);
                        wpa_set_wnmsleep(sta->wpa_sm, 1);
@@ -168,6 +169,7 @@ static int ieee802_11_send_wnmsleep_resp(struct hostapd_data *hapd,
                     wnmsleep_ie.status ==
                     WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE) &&
                    wnmsleep_ie.action_type == WNM_SLEEP_MODE_EXIT) {
+                       sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
                        wpa_set_wnmsleep(sta->wpa_sm, 0);
                        hostapd_drv_wnm_oper(hapd, WNM_SLEEP_EXIT_CONFIRM,
                                             addr, NULL, NULL);