]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/mesh_mpm.c
FT: Remove and re-add STA entry after FT protocol success with PMF
[thirdparty/hostap.git] / wpa_supplicant / mesh_mpm.c
index 308366f64162d8179de805a20c277cabdf076088..4925b5cdeca8e65e31cc3f6ce1eee71bcc7a4c22 100644 (file)
@@ -233,12 +233,10 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
                  2 + 24 + /* peering management */
                  2 + 96 + 32 + 32 + /* AMPE (96 + max GTKlen + max IGTKlen) */
                  2 + 16;  /* MIC */
-#ifdef CONFIG_IEEE80211N
        if (type != PLINK_CLOSE && wpa_s->mesh_ht_enabled) {
                buf_len += 2 + 26 + /* HT capabilities */
                           2 + 22;  /* HT operation */
        }
-#endif /* CONFIG_IEEE80211N */
 #ifdef CONFIG_IEEE80211AC
        if (type != PLINK_CLOSE && wpa_s->mesh_vht_enabled) {
                buf_len += 2 + 12 + /* VHT Capabilities */
@@ -354,7 +352,6 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
                                   wpabuf_put(buf, PMKID_LEN));
        }
 
-#ifdef CONFIG_IEEE80211N
        if (type != PLINK_CLOSE && wpa_s->mesh_ht_enabled) {
                u8 ht_capa_oper[2 + 26 + 2 + 22];
 
@@ -362,7 +359,6 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s,
                pos = hostapd_eid_ht_operation(bss, pos);
                wpabuf_put_data(buf, ht_capa_oper, pos - ht_capa_oper);
        }
-#endif /* CONFIG_IEEE80211N */
 #ifdef CONFIG_IEEE80211AC
        if (type != PLINK_CLOSE && wpa_s->mesh_vht_enabled) {
                u8 vht_capa_oper[2 + 12 + 2 + 5];
@@ -696,9 +692,7 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        struct mesh_conf *conf = wpa_s->ifmsh->mconf;
        struct hostapd_data *data = wpa_s->ifmsh->bss[0];
        struct sta_info *sta;
-#ifdef CONFIG_IEEE80211N
        struct ieee80211_ht_operation *oper;
-#endif /* CONFIG_IEEE80211N */
        int ret;
 
        if (elems->mesh_config_len >= 7 &&
@@ -710,11 +704,12 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        }
 
        sta = ap_get_sta(data, addr);
-       if (!sta) {
-               sta = ap_sta_add(data, addr);
-               if (!sta)
-                       return NULL;
-       }
+       if (sta)
+               return NULL;
+
+       sta = ap_sta_add(data, addr);
+       if (!sta)
+               return NULL;
 
        /* Set WMM by default since Mesh STAs are QoS STAs */
        sta->flags |= WLAN_STA_WMM;
@@ -728,7 +723,6 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        if (!sta->my_lid)
                mesh_mpm_init_link(wpa_s, sta);
 
-#ifdef CONFIG_IEEE80211N
        copy_sta_ht_capab(data, sta, elems->ht_capabilities);
 
        oper = (struct ieee80211_ht_operation *) elems->ht_operation;
@@ -742,7 +736,6 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
        }
 
        update_ht_state(data, sta);
-#endif /* CONFIG_IEEE80211N */
 
 #ifdef CONFIG_IEEE80211AC
        copy_sta_vht_capab(data, sta, elems->vht_capabilities);
@@ -876,7 +869,8 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
                wpa_hexdump_key(MSG_DEBUG, "mesh: MTK", sta->mtk, sta->mtk_len);
                wpa_drv_set_key(wpa_s, wpa_cipher_to_alg(conf->pairwise_cipher),
                                sta->addr, 0, 0, seq, sizeof(seq),
-                               sta->mtk, sta->mtk_len);
+                               sta->mtk, sta->mtk_len,
+                               KEY_FLAG_PAIRWISE_RX_TX);
 
                wpa_hexdump_key(MSG_DEBUG, "mesh: RX MGTK Key RSC",
                                sta->mgtk_rsc, sizeof(sta->mgtk_rsc));
@@ -885,7 +879,8 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
                wpa_drv_set_key(wpa_s, wpa_cipher_to_alg(conf->group_cipher),
                                sta->addr, sta->mgtk_key_id, 0,
                                sta->mgtk_rsc, sizeof(sta->mgtk_rsc),
-                               sta->mgtk, sta->mgtk_len);
+                               sta->mgtk, sta->mgtk_len,
+                               KEY_FLAG_GROUP_RX);
 
                if (sta->igtk_len) {
                        wpa_hexdump_key(MSG_DEBUG, "mesh: RX IGTK Key RSC",
@@ -897,7 +892,8 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
                                wpa_cipher_to_alg(conf->mgmt_group_cipher),
                                sta->addr, sta->igtk_key_id, 0,
                                sta->igtk_rsc, sizeof(sta->igtk_rsc),
-                               sta->igtk, sta->igtk_len);
+                               sta->igtk, sta->igtk_len,
+                               KEY_FLAG_GROUP_RX);
                }
        }