aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ibss_rsn.c
diff options
context:
space:
mode:
authorXi Chen <Xi.Chen2@Atheros.com>2011-03-18 15:04:46 (GMT)
committerJouni Malinen <j@w1.fi>2011-03-18 15:04:46 (GMT)
commitea244d2156791e9701ead185a99faf685e9df008 (patch)
tree0520d5e6328187bbdff79358e32923bd82191311 /wpa_supplicant/ibss_rsn.c
parent2f646b6e83f47b99202f7b18d5d45ef633c6cfa5 (diff)
downloadhostap-ea244d2156791e9701ead185a99faf685e9df008.zip
hostap-ea244d2156791e9701ead185a99faf685e9df008.tar.gz
hostap-ea244d2156791e9701ead185a99faf685e9df008.tar.bz2
IBSS RSN: Clear IBSS RSN peers based on peer lost events
Diffstat (limited to 'wpa_supplicant/ibss_rsn.c')
-rw-r--r--wpa_supplicant/ibss_rsn.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c
index c3e4f6f..55ea790 100644
--- a/wpa_supplicant/ibss_rsn.c
+++ b/wpa_supplicant/ibss_rsn.c
@@ -426,6 +426,46 @@ int ibss_rsn_start(struct ibss_rsn *ibss_rsn, const u8 *addr)
}
+void ibss_rsn_stop(struct ibss_rsn *ibss_rsn, const u8 *peermac)
+{
+ struct ibss_rsn_peer *peer, *prev;
+
+ if (ibss_rsn == NULL)
+ return;
+
+ if (peermac == NULL) {
+ /* remove all peers */
+ wpa_printf(MSG_DEBUG, "%s: Remove all peers", __func__);
+ peer = ibss_rsn->peers;
+ while (peer) {
+ prev = peer;
+ peer = peer->next;
+ ibss_rsn_free(prev);
+ ibss_rsn->peers = peer;
+ }
+ } else {
+ /* remove specific peer */
+ wpa_printf(MSG_DEBUG, "%s: Remove specific peer " MACSTR,
+ __func__, MAC2STR(peermac));
+
+ for (prev = NULL, peer = ibss_rsn->peers; peer != NULL;
+ prev = peer, peer = peer->next) {
+ if (os_memcmp(peermac, peer->addr, ETH_ALEN) == 0) {
+ if (prev == NULL)
+ ibss_rsn->peers = peer->next;
+ else
+ prev->next = peer->next;
+ ibss_rsn_free(peer);
+ wpa_printf(MSG_DEBUG, "%s: Successfully "
+ "removed a specific peer",
+ __func__);
+ break;
+ }
+ }
+ }
+}
+
+
struct ibss_rsn * ibss_rsn_init(struct wpa_supplicant *wpa_s)
{
struct ibss_rsn *ibss_rsn;