]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move hostapd_acl_expire() to use common AP periodic cleanup mechanism
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 20 Jul 2015 10:39:22 +0000 (13:39 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 20 Jul 2015 10:39:22 +0000 (13:39 +0300)
This reduces number of periodic eloop timeouts when AP mode operations
are in progress.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/hostapd.c
src/ap/ieee802_11_auth.c
src/ap/ieee802_11_auth.h

index 5135d3e06bb2f55967003f6d43bab5b347163f4f..0ae8f4a68209bbfdd64b0bbe9a7aa83cd0c5d073 100644 (file)
@@ -2926,4 +2926,16 @@ struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
 
 void hostapd_periodic_iface(struct hostapd_iface *iface)
 {
+       size_t i;
+
+       for (i = 0; i < iface->num_bss; i++) {
+               struct hostapd_data *hapd = iface->bss[i];
+
+               if (!hapd->started)
+                       continue;
+
+#ifndef CONFIG_NO_RADIUS
+               hostapd_acl_expire(hapd);
+#endif /* CONFIG_NO_RADIUS */
+       }
 }
index 0238257ddc82da95578f8df0d89574f8e72c0544..531a67da412c68a4a1ae354ec637ee20ba3ee676 100644 (file)
@@ -399,19 +399,15 @@ static void hostapd_acl_expire_queries(struct hostapd_data *hapd,
 
 /**
  * hostapd_acl_expire - ACL cache expiration callback
- * @eloop_ctx: struct hostapd_data *
- * @timeout_ctx: Not used
+ * @hapd: struct hostapd_data *
  */
-static void hostapd_acl_expire(void *eloop_ctx, void *timeout_ctx)
+void hostapd_acl_expire(struct hostapd_data *hapd)
 {
-       struct hostapd_data *hapd = eloop_ctx;
        struct os_reltime now;
 
        os_get_reltime(&now);
        hostapd_acl_expire_cache(hapd, &now);
        hostapd_acl_expire_queries(hapd, &now);
-
-       eloop_register_timeout(10, 0, hostapd_acl_expire, hapd, NULL);
 }
 
 
@@ -615,8 +611,6 @@ int hostapd_acl_init(struct hostapd_data *hapd)
        if (radius_client_register(hapd->radius, RADIUS_AUTH,
                                   hostapd_acl_recv_radius, hapd))
                return -1;
-
-       eloop_register_timeout(10, 0, hostapd_acl_expire, hapd, NULL);
 #endif /* CONFIG_NO_RADIUS */
 
        return 0;
@@ -632,8 +626,6 @@ void hostapd_acl_deinit(struct hostapd_data *hapd)
        struct hostapd_acl_query_data *query, *prev;
 
 #ifndef CONFIG_NO_RADIUS
-       eloop_cancel_timeout(hostapd_acl_expire, hapd, NULL);
-
        hostapd_acl_cache_free(hapd->acl_cache);
 #endif /* CONFIG_NO_RADIUS */
 
index 2bc1065a226c94a4cb9598f25890a6871d955fb6..b66f244b3ebc4138d6c91d0b90aa2cc0bd534555 100644 (file)
@@ -24,5 +24,6 @@ int hostapd_allowed_address(struct hostapd_data *hapd, const u8 *addr,
 int hostapd_acl_init(struct hostapd_data *hapd);
 void hostapd_acl_deinit(struct hostapd_data *hapd);
 void hostapd_free_psk_list(struct hostapd_sta_wpa_psk_short *psk);
+void hostapd_acl_expire(struct hostapd_data *hapd);
 
 #endif /* IEEE802_11_AUTH_H */