Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "includes.h"
00016
00017 #include "common.h"
00018 #include "common/ieee802_11_defs.h"
00019 #include "sta_info.h"
00020 #include "hostapd.h"
00021
00022
00023 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
00024 int (*cb)(void *ctx, const u8 *sa,
00025 const u8 *ie, size_t ie_len),
00026 void *ctx)
00027 {
00028 struct hostapd_probereq_cb *n;
00029
00030 n = os_realloc(hapd->probereq_cb, (hapd->num_probereq_cb + 1) *
00031 sizeof(struct hostapd_probereq_cb));
00032 if (n == NULL)
00033 return -1;
00034
00035 hapd->probereq_cb = n;
00036 n = &hapd->probereq_cb[hapd->num_probereq_cb];
00037 hapd->num_probereq_cb++;
00038
00039 n->cb = cb;
00040 n->ctx = ctx;
00041
00042 return 0;
00043 }
00044
00045
00046 struct prune_data {
00047 struct hostapd_data *hapd;
00048 const u8 *addr;
00049 };
00050
00051 static int prune_associations(struct hostapd_iface *iface, void *ctx)
00052 {
00053 struct prune_data *data = ctx;
00054 struct sta_info *osta;
00055 struct hostapd_data *ohapd;
00056 size_t j;
00057
00058 for (j = 0; j < iface->num_bss; j++) {
00059 ohapd = iface->bss[j];
00060 if (ohapd == data->hapd)
00061 continue;
00062 osta = ap_get_sta(ohapd, data->addr);
00063 if (!osta)
00064 continue;
00065
00066 ap_sta_disassociate(ohapd, osta, WLAN_REASON_UNSPECIFIED);
00067 }
00068
00069 return 0;
00070 }
00071
00080 void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr)
00081 {
00082 struct prune_data data;
00083 data.hapd = hapd;
00084 data.addr = addr;
00085 if (hapd->iface->for_each_interface)
00086 hapd->iface->for_each_interface(hapd->iface->interfaces,
00087 prune_associations, &data);
00088 }