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 <clowes_ian@hotmail.com>
This commit is contained in:
Ian Clowes 2022-01-06 09:14:49 +01:00 committed by Nick Hainke
parent 9187665f8e
commit 9ce01ecce5

View file

@ -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;