hostapd: Add mechanism to track unconnected stations
[mech_eap.git] / src / ap / hostapd.c
index 5135d3e..e4d7bfc 100644 (file)
@@ -355,6 +355,22 @@ static void hostapd_cleanup(struct hostapd_data *hapd)
 }
 
 
+static void sta_track_deinit(struct hostapd_iface *iface)
+{
+       struct hostapd_sta_info *info;
+
+       if (!iface->num_sta_seen)
+               return;
+
+       while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info,
+                                    list))) {
+               dl_list_del(&info->list);
+               iface->num_sta_seen--;
+               os_free(info);
+       }
+}
+
+
 static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
 {
        wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
@@ -370,6 +386,7 @@ static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
        os_free(iface->basic_rates);
        iface->basic_rates = NULL;
        ap_list_deinit(iface);
+       sta_track_deinit(iface);
 }
 
 
@@ -1385,7 +1402,7 @@ static void fst_hostapd_get_channel_info_cb(void *ctx,
 }
 
 
-static void fst_hostapd_set_ies_cb(void *ctx, struct wpabuf *fst_ies)
+static void fst_hostapd_set_ies_cb(void *ctx, const struct wpabuf *fst_ies)
 {
        struct hostapd_data *hapd = ctx;
 
@@ -1623,6 +1640,7 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
        hostapd_tx_queue_params(iface);
 
        ap_list_init(iface);
+       dl_list_init(&iface->sta_seen);
 
        hostapd_set_acl(hapd);
 
@@ -2926,4 +2944,18 @@ struct hostapd_data * hostapd_get_iface(struct hapd_interfaces *interfaces,
 
 void hostapd_periodic_iface(struct hostapd_iface *iface)
 {
+       size_t i;
+
+       ap_list_timer(iface);
+
+       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 */
+       }
 }