From 9ce01ecce501b847dc96793602beaee69d64a5a0 Mon Sep 17 00:00:00 2001 From: Ian Clowes Date: Thu, 6 Jan 2022 09:14:49 +0100 Subject: [PATCH] datastorage: fix multi-SSID Bug that could proably cause ineffciency or confusion in multi-SSID environments. Adjusted erroneus match test in ap_array_insert(). Signed-off-by: Ian Clowes --- src/storage/datastorage.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index 54139b7..28c8ef8 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -1233,15 +1233,12 @@ ap *insert_to_ap_array(ap* entry, time_t expiry) { pthread_mutex_lock(&ap_array_mutex); - // TODO: Why do we delete and add here? + // TODO: Why do we delete and add here rather than update existing? ap* old_entry = *ap_array_find_first_entry(entry->bssid_addr, entry->ssid); if (old_entry != NULL && - !mac_is_equal_bb((old_entry)->bssid_addr, entry->bssid_addr) && + mac_is_equal_bb((old_entry)->bssid_addr, entry->bssid_addr) && !strcmp((char*)old_entry->ssid, (char*)entry->ssid)) - old_entry = NULL; - - if (old_entry != NULL) ap_array_delete(old_entry); entry->time = expiry;