]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move wpa_sm_remove_pmkid() call to PMKSA cache entry freeing
authorJouni Malinen <j@w1.fi>
Sun, 20 Nov 2011 10:53:29 +0000 (12:53 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 20 Nov 2011 10:53:29 +0000 (12:53 +0200)
This makes it clearer that the PMKSA caching entry gets removed from
the driver regardless of how the internal entry from wpa_supplicant
gets cleared. In practice, this call was skipped only for the case
when the entry for the current AP was being updated, so the previous
version was likely to work with all drivers. Anyway, it is cleaner
to explicitly remove the old entry even in that case before the new
entry gets added.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/rsn_supp/pmksa_cache.c

index 04c9d297220dffff845a8bef865bcb525f458125..3877efb3821c82933d1a3efbf0fb47a663b4ffc9 100644 (file)
@@ -49,6 +49,7 @@ static void pmksa_cache_free_entry(struct rsn_pmksa_cache *pmksa,
                                   struct rsn_pmksa_cache_entry *entry,
                                   int replace)
 {
+       wpa_sm_remove_pmkid(pmksa->sm, entry->aa, entry->pmkid);
        pmksa->pmksa_count--;
        pmksa->free_cb(entry, pmksa->ctx, replace);
        _pmksa_cache_free_entry(entry);
@@ -66,7 +67,6 @@ 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));
-               wpa_sm_remove_pmkid(pmksa->sm, entry->aa, entry->pmkid);
                pmksa_cache_free_entry(pmksa, entry, 0);
        }
 
@@ -207,7 +207,6 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
                wpa_printf(MSG_DEBUG, "RSN: removed the oldest PMKSA cache "
                           "entry (for " MACSTR ") to make room for new one",
                           MAC2STR(pos->aa));
-               wpa_sm_remove_pmkid(pmksa->sm, pos->aa, pos->pmkid);
                pmksa_cache_free_entry(pmksa, pos, 0);
        }
 
@@ -258,7 +257,6 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx)
                                pmksa->pmksa = entry->next;
                        tmp = entry;
                        entry = entry->next;
-                       wpa_sm_remove_pmkid(pmksa->sm, tmp->aa, tmp->pmkid);
                        pmksa_cache_free_entry(pmksa, tmp, 0);
                        removed++;
                } else {