2 * AP mode helper functions
3 * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "common/ieee802_11_defs.h"
23 int hostapd_register_probereq_cb(struct hostapd_data
*hapd
,
24 int (*cb
)(void *ctx
, const u8
*sa
,
25 const u8
*ie
, size_t ie_len
),
28 struct hostapd_probereq_cb
*n
;
30 n
= os_realloc(hapd
->probereq_cb
, (hapd
->num_probereq_cb
+ 1) *
31 sizeof(struct hostapd_probereq_cb
));
35 hapd
->probereq_cb
= n
;
36 n
= &hapd
->probereq_cb
[hapd
->num_probereq_cb
];
37 hapd
->num_probereq_cb
++;
47 struct hostapd_data
*hapd
;
51 static int prune_associations(struct hostapd_iface
*iface
, void *ctx
)
53 struct prune_data
*data
= ctx
;
54 struct sta_info
*osta
;
55 struct hostapd_data
*ohapd
;
58 for (j
= 0; j
< iface
->num_bss
; j
++) {
59 ohapd
= iface
->bss
[j
];
60 if (ohapd
== data
->hapd
)
62 osta
= ap_get_sta(ohapd
, data
->addr
);
66 ap_sta_disassociate(ohapd
, osta
, WLAN_REASON_UNSPECIFIED
);
73 * hostapd_prune_associations - Remove extraneous associations
74 * @hapd: Pointer to BSS data for the most recent association
75 * @addr: Associated STA address
77 * This function looks through all radios and BSS's for previous
78 * (stale) associations of STA. If any are found they are removed.
80 void hostapd_prune_associations(struct hostapd_data
*hapd
, const u8
*addr
)
82 struct prune_data data
;
85 if (hapd
->iface
->for_each_interface
)
86 hapd
->iface
->for_each_interface(hapd
->iface
->interfaces
,
87 prune_associations
, &data
);