]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Relocate the declaration of the hostapd_find_by_sta() function to top
authorManish Dharanenthiran <quic_mdharane@quicinc.com>
Fri, 19 Jul 2024 04:16:37 +0000 (09:46 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 6 Aug 2024 17:17:47 +0000 (20:17 +0300)
The hostapd_find_by_sta() function may be utilized by multiple driver
events. Therefore, it should be declared at the outset to ensure
accessibility by all event handlers.

No functional changes.

Signed-off-by: Manish Dharanenthiran <quic_mdharane@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/drv_callbacks.c

index c74e551c5a55229c5e15784a9ffb9bca4abebfea..c7e43d9d4cb0f4187b756d54de0ed32dc4cdfcdf 100644 (file)
@@ -250,6 +250,52 @@ out:
 #endif /* CONFIG_IEEE80211BE */
 
 
+#if defined(HOSTAPD) || defined(CONFIG_IEEE80211BE)
+static struct hostapd_data * hostapd_find_by_sta(struct hostapd_iface *iface,
+                                                const u8 *src, bool rsn,
+                                                struct sta_info **sta_ret)
+{
+       struct hostapd_data *hapd;
+       struct sta_info *sta;
+       unsigned int j;
+
+       if (sta_ret)
+               *sta_ret = NULL;
+
+       for (j = 0; j < iface->num_bss; j++) {
+               hapd = iface->bss[j];
+               sta = ap_get_sta(hapd, src);
+               if (sta && (sta->flags & WLAN_STA_ASSOC) &&
+                   (!rsn || sta->wpa_sm)) {
+                       if (sta_ret)
+                               *sta_ret = sta;
+                       return hapd;
+               }
+#ifdef CONFIG_IEEE80211BE
+               if (hapd->conf->mld_ap) {
+                       struct hostapd_data *p_hapd;
+
+                       for_each_mld_link(p_hapd, hapd) {
+                               if (p_hapd == hapd)
+                                       continue;
+
+                               sta = ap_get_sta(p_hapd, src);
+                               if (sta && (sta->flags & WLAN_STA_ASSOC) &&
+                                   (!rsn || sta->wpa_sm)) {
+                                       if (sta_ret)
+                                               *sta_ret = sta;
+                                       return p_hapd;
+                               }
+                       }
+               }
+#endif /* CONFIG_IEEE80211BE */
+       }
+
+       return NULL;
+}
+#endif /* HOSTAPD || CONFIG_IEEE80211BE */
+
+
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                        const u8 *req_ies, size_t req_ies_len,
                        const u8 *resp_ies, size_t resp_ies_len,
@@ -1986,50 +2032,6 @@ static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
 }
 
 
-static struct hostapd_data * hostapd_find_by_sta(struct hostapd_iface *iface,
-                                                const u8 *src, bool rsn,
-                                                struct sta_info **sta_ret)
-{
-       struct hostapd_data *hapd;
-       struct sta_info *sta;
-       unsigned int j;
-
-       if (sta_ret)
-               *sta_ret = NULL;
-
-       for (j = 0; j < iface->num_bss; j++) {
-               hapd = iface->bss[j];
-               sta = ap_get_sta(hapd, src);
-               if (sta && (sta->flags & WLAN_STA_ASSOC) &&
-                   (!rsn || sta->wpa_sm)) {
-                       if (sta_ret)
-                               *sta_ret = sta;
-                       return hapd;
-               }
-#ifdef CONFIG_IEEE80211BE
-               if (hapd->conf->mld_ap) {
-                       struct hostapd_data *p_hapd;
-
-                       for_each_mld_link(p_hapd, hapd) {
-                               if (p_hapd == hapd)
-                                       continue;
-
-                               sta = ap_get_sta(p_hapd, src);
-                               if (sta && (sta->flags & WLAN_STA_ASSOC) &&
-                                   (!rsn || sta->wpa_sm)) {
-                                       if (sta_ret)
-                                               *sta_ret = sta;
-                                       return p_hapd;
-                               }
-                       }
-               }
-#endif /* CONFIG_IEEE80211BE */
-       }
-
-       return NULL;
-}
-
-
 static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
                                   const u8 *data, size_t data_len,
                                   enum frame_encryption encrypted,