aboutsummaryrefslogtreecommitdiff
path: root/src/rsn_supp/pmksa_cache.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2012-12-03 15:08:10 -0800
committerDmitry Shmidt <dimitrysh@google.com>2012-12-20 10:35:12 -0800
commitd5e4923d04122f81300fa68fb07d64ede28fd44d (patch)
tree29f99bf419804daf82e32e67911628df0c2e5f39 /src/rsn_supp/pmksa_cache.c
parent90f44d5ff88189e0972bcd376b662d898e4c3c2e (diff)
downloadwpa_supplicant_8-d5e4923d04122f81300fa68fb07d64ede28fd44d.tar.gz
Accumulative patch from commit f5f37d3a4fc2df2a24676b4f95afca15ed793cba
Author: Jouni Malinen <j@w1.fi> Date: Sun Nov 25 22:05:32 2012 +0200 Fix REAUTHENTICATE command after PMKSA caching The current PMKSA cache entry needs to be clear to allow EAPOL reauthentication to be started in case this association used PMKSA caching. - Remove old WPS_OOB NCF - WPS: Add preliminary NFC connection handover support for Enrollee - WPS: Reenable the networks disabled during wpa_wpas_reassoc - P2P: Avoid multi-channel scans when they are not needed - P2P: Allow discoverable interval for p2p_find to be configured - P2P: Allow all channels with multi-channel concurrency - Bonjour changes - Remove disassociate - HS 2.0 changes - Add preliminary support for using SQLite for eap_user database - Add SAE support - Add disallow_aps parameter to disallow BSSIDs/SSIDs Change-Id: I85358a05b39d46b8db49acdad667e771c580b05c Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/rsn_supp/pmksa_cache.c')
-rw-r--r--src/rsn_supp/pmksa_cache.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/rsn_supp/pmksa_cache.c b/src/rsn_supp/pmksa_cache.c
index 9783e7c4..df675834 100644
--- a/src/rsn_supp/pmksa_cache.c
+++ b/src/rsn_supp/pmksa_cache.c
@@ -25,7 +25,7 @@ struct rsn_pmksa_cache {
struct wpa_sm *sm; /* TODO: get rid of this reference(?) */
void (*free_cb)(struct rsn_pmksa_cache_entry *entry, void *ctx,
- int replace);
+ enum pmksa_free_reason reason);
void *ctx;
};
@@ -41,11 +41,11 @@ static void _pmksa_cache_free_entry(struct rsn_pmksa_cache_entry *entry)
static void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa,
struct rsn_pmksa_cache_entry *entry,
- int replace)
+ enum pmksa_free_reason reason)
{
wpa_sm_remove_pmkid(pmksa->sm, entry->aa, entry->pmkid);
pmksa->pmksa_count--;
- pmksa->free_cb(entry, pmksa->ctx, replace);
+ pmksa->free_cb(entry, pmksa->ctx, reason);
_pmksa_cache_free_entry(entry);
}
@@ -61,7 +61,7 @@ static void pmksa_cache_expire(void *eloop_ctx, void *timeout_ctx)
pmksa->pmksa = entry->next;
wpa_printf(MSG_DEBUG, "RSN: expired PMKSA cache entry for "
MACSTR, MAC2STR(entry->aa));
- pmksa_cache_free_entry(pmksa, entry, 0);
+ pmksa_cache_free_entry(pmksa, entry, PMKSA_EXPIRE);
}
pmksa_cache_set_expiration(pmksa);
@@ -164,22 +164,9 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
pmksa->pmksa = pos->next;
else
prev->next = pos->next;
- if (pos == pmksa->sm->cur_pmksa) {
- /* We are about to replace the current PMKSA
- * cache entry. This happens when the PMKSA
- * caching attempt fails, so we don't want to
- * force pmksa_cache_free_entry() to disconnect
- * at this point. Let's just make sure the old
- * PMKSA cache entry will not be used in the
- * future.
- */
- wpa_printf(MSG_DEBUG, "RSN: replacing current "
- "PMKSA entry");
- pmksa->sm->cur_pmksa = NULL;
- }
wpa_printf(MSG_DEBUG, "RSN: Replace PMKSA entry for "
"the current AP");
- pmksa_cache_free_entry(pmksa, pos, 1);
+ pmksa_cache_free_entry(pmksa, pos, PMKSA_REPLACE);
/*
* If OKC is used, there may be other PMKSA cache
@@ -214,7 +201,7 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
"PMKSA cache entry (for " MACSTR ") to "
"make room for new one",
MAC2STR(pos->aa));
- pmksa_cache_free_entry(pmksa, pos, 0);
+ pmksa_cache_free_entry(pmksa, pos, PMKSA_FREE);
}
}
@@ -265,7 +252,7 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx)
pmksa->pmksa = entry->next;
tmp = entry;
entry = entry->next;
- pmksa_cache_free_entry(pmksa, tmp, 0);
+ pmksa_cache_free_entry(pmksa, tmp, PMKSA_FREE);
removed++;
} else {
prev = entry;
@@ -507,7 +494,7 @@ int pmksa_cache_list(struct rsn_pmksa_cache *pmksa, char *buf, size_t len)
*/
struct rsn_pmksa_cache *
pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
- void *ctx, int replace),
+ void *ctx, enum pmksa_free_reason reason),
void *ctx, struct wpa_sm *sm)
{
struct rsn_pmksa_cache *pmksa;