Fix WMM and MFP STA flag setting with flags_or/flags_and
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 11 May 2009 10:49:57 +0000 (13:49 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 11 May 2009 10:49:57 +0000 (13:49 +0300)
These were included correctly in total_flags, but not in
flags_or/flags_and.

hostapd/ieee802_11.c

index 907aa9b..33acb76 100644 (file)
@@ -1615,6 +1615,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
        struct ht_cap_ie ht_cap;
 #endif /* CONFIG_IEEE80211N */
        struct ht_cap_ie *ht_cap_ptr = NULL;
+       int set_flags, flags_and, flags_or;
 
        if (!ok) {
                hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
@@ -1699,13 +1700,12 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
                /* VLAN ID already set (e.g., by PMKSA caching), so bind STA */
                ap_sta_bind_vlan(hapd, sta, 0);
        }
-       if (sta->flags & WLAN_STA_SHORT_PREAMBLE) {
-               hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
-                                     WLAN_STA_SHORT_PREAMBLE, ~0);
-       } else {
-               hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
-                                     0, ~WLAN_STA_SHORT_PREAMBLE);
-       }
+
+       set_flags = WLAN_STA_SHORT_PREAMBLE | WLAN_STA_WMM | WLAN_STA_MFP;
+       flags_or = sta->flags & set_flags;
+       flags_and = sta->flags | ~set_flags;
+       hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
+                             flags_or, flags_and);
 
        if (sta->auth_alg == WLAN_AUTH_FT)
                wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);