196
196
pmksa->pmksa = pos->next;
198
198
prev->next = pos->next;
199
if (pos == pmksa->sm->cur_pmksa) {
200
/* We are about to replace the current PMKSA
201
* cache entry. This happens when the PMKSA
202
* caching attempt fails, so we don't want to
203
* force pmksa_cache_free_entry() to disconnect
204
* at this point. Let's just make sure the old
205
* PMKSA cache entry will not be used in the
208
wpa_printf(MSG_DEBUG, "RSN: replacing current "
210
pmksa->sm->cur_pmksa = NULL;
199
212
wpa_printf(MSG_DEBUG, "RSN: Replace PMKSA entry for "
200
213
"the current AP");
201
214
pmksa_cache_free_entry(pmksa, pos, 1);
427
440
int pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len)
431
444
struct rsn_pmksa_cache_entry *entry;
432
445
struct os_time now;
434
447
os_get_time(&now);
435
pos += snprintf(pos, buf + len - pos,
436
"Index / AA / PMKID / expiration (in seconds) / "
448
ret = snprintf(pos, buf + len - pos,
449
"Index / AA / PMKID / expiration (in seconds) / "
451
if (ret < 0 || ret >= buf + len - pos)
439
455
entry = sm->pmksa->pmksa;
442
pos += snprintf(pos, buf + len - pos, "%d " MACSTR " ",
443
i, MAC2STR(entry->aa));
458
ret = snprintf(pos, buf + len - pos, "%d " MACSTR " ",
459
i, MAC2STR(entry->aa));
460
if (ret < 0 || ret >= buf + len - pos)
444
463
pos += wpa_snprintf_hex(pos, buf + len - pos, entry->pmkid,
446
pos += snprintf(pos, buf + len - pos, " %d %d\n",
447
(int) (entry->expiration - now.sec),
448
entry->opportunistic);
465
ret = snprintf(pos, buf + len - pos, " %d %d\n",
466
(int) (entry->expiration - now.sec),
467
entry->opportunistic);
468
if (ret < 0 || ret >= buf + len - pos)
449
471
entry = entry->next;
451
473
return pos - buf;