]>
git.ipfire.org Git - thirdparty/hostap.git/blob - src/ap/utils.c
2 * AP mode helper functions
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "common/ieee802_11_defs.h"
18 int hostapd_register_probereq_cb(struct hostapd_data
*hapd
,
19 int (*cb
)(void *ctx
, const u8
*sa
,
20 const u8
*da
, const u8
*bssid
,
21 const u8
*ie
, size_t ie_len
,
25 struct hostapd_probereq_cb
*n
;
27 n
= os_realloc_array(hapd
->probereq_cb
, hapd
->num_probereq_cb
+ 1,
28 sizeof(struct hostapd_probereq_cb
));
32 hapd
->probereq_cb
= n
;
33 n
= &hapd
->probereq_cb
[hapd
->num_probereq_cb
];
34 hapd
->num_probereq_cb
++;
44 struct hostapd_data
*hapd
;
48 static int prune_associations(struct hostapd_iface
*iface
, void *ctx
)
50 struct prune_data
*data
= ctx
;
51 struct sta_info
*osta
;
52 struct hostapd_data
*ohapd
;
55 for (j
= 0; j
< iface
->num_bss
; j
++) {
56 ohapd
= iface
->bss
[j
];
57 if (ohapd
== data
->hapd
)
60 /* Don't prune STAs belong to same FST */
61 if (ohapd
->iface
->fst
&&
62 data
->hapd
->iface
->fst
&&
63 fst_are_ifaces_aggregated(ohapd
->iface
->fst
,
64 data
->hapd
->iface
->fst
))
66 #endif /* CONFIG_FST */
67 osta
= ap_get_sta(ohapd
, data
->addr
);
71 wpa_printf(MSG_INFO
, "%s: Prune association for " MACSTR
,
72 ohapd
->conf
->iface
, MAC2STR(osta
->addr
));
73 ap_sta_disassociate(ohapd
, osta
, WLAN_REASON_UNSPECIFIED
);
80 * hostapd_prune_associations - Remove extraneous associations
81 * @hapd: Pointer to BSS data for the most recent association
82 * @addr: Associated STA address
84 * This function looks through all radios and BSS's for previous
85 * (stale) associations of STA. If any are found they are removed.
87 void hostapd_prune_associations(struct hostapd_data
*hapd
, const u8
*addr
)
89 struct prune_data data
;
92 if (hapd
->iface
->interfaces
&&
93 hapd
->iface
->interfaces
->for_each_interface
)
94 hapd
->iface
->interfaces
->for_each_interface(
95 hapd
->iface
->interfaces
, prune_associations
, &data
);