]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Remove unnecessary outer for loop in authorizing ML STA
authorAdil Saeed Musthafa <quic_adilm@quicinc.com>
Thu, 21 Nov 2024 06:53:25 +0000 (22:53 -0800)
committerJouni Malinen <j@w1.fi>
Wed, 27 Nov 2024 17:07:58 +0000 (19:07 +0200)
Remove unnecessary outer for loop in ieee802_1x_ml_set_sta_authorized().
The inner for loop in this function is what actually iterates over the
partner links. The outer for loop did not have any relevance. Fix this.

Signed-off-by: Adil Saeed Musthafa <quic_adilm@quicinc.com>
src/ap/ieee802_1x.c

index 34de54a5ec8dfea1c11eedb603e36beca29b7caf..e8d21ff7ac0b7293234c07ff792aafff76b76fb1 100644 (file)
@@ -149,7 +149,7 @@ static void ieee802_1x_ml_set_sta_authorized(struct hostapd_data *hapd,
                                             bool authorized)
 {
 #ifdef CONFIG_IEEE80211BE
-       unsigned int i, link_id;
+       unsigned int i;
 
        if (!hostapd_is_mld_ap(hapd))
                return;
@@ -161,32 +161,30 @@ static void ieee802_1x_ml_set_sta_authorized(struct hostapd_data *hapd,
        if (authorized && hapd->mld_link_id != sta->mld_assoc_link_id)
                return;
 
-       for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) {
-               struct mld_link_info *link = &sta->mld_info.links[link_id];
+       for (i = 0; i < hapd->iface->interfaces->count; i++) {
+               struct sta_info *tmp_sta;
+               struct mld_link_info *link;
+               struct hostapd_data *tmp_hapd =
+                       hapd->iface->interfaces->iface[i]->bss[0];
 
-               if (!link->valid)
+               if (!hostapd_is_ml_partner(hapd, tmp_hapd))
                        continue;
 
-               for (i = 0; i < hapd->iface->interfaces->count; i++) {
-                       struct sta_info *tmp_sta;
-                       struct hostapd_data *tmp_hapd =
-                               hapd->iface->interfaces->iface[i]->bss[0];
+               link = &sta->mld_info.links[tmp_hapd->mld_link_id];
+               if (!link->valid)
+                       continue;
 
-                       if (!hostapd_is_ml_partner(hapd, tmp_hapd))
+               for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
+                    tmp_sta = tmp_sta->next) {
+                       if (tmp_sta == sta ||
+                           tmp_sta->mld_assoc_link_id !=
+                           sta->mld_assoc_link_id ||
+                           tmp_sta->aid != sta->aid)
                                continue;
 
-                       for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
-                            tmp_sta = tmp_sta->next) {
-                               if (tmp_sta == sta ||
-                                   tmp_sta->mld_assoc_link_id !=
-                                   sta->mld_assoc_link_id ||
-                                   tmp_sta->aid != sta->aid)
-                                       continue;
-
-                               ieee802_1x_set_authorized(tmp_hapd, tmp_sta,
-                                                         authorized, true);
-                               break;
-                       }
+                       ieee802_1x_set_authorized(tmp_hapd, tmp_sta,
+                                                 authorized, true);
+                       break;
                }
        }
 #endif /* CONFIG_IEEE80211BE */