datastorage: fixes to linked list handling

general: fixed whitespace and typos
memory audit: on by default in build
memory audit: enhanced audit info
ubus: refactor denied_req expiry to assist datastorage testing
datastorage: fixed performance bug in handling of linked list entry expiry
datastorage: fixed SEGV in skip list handling
test_storage: added linked list memory allocation stress tests
This commit is contained in:
Ian Clowes 2020-08-05 11:03:06 +01:00 committed by Polynomialdivision
parent 34da5328f6
commit 117a340b9d
11 changed files with 395 additions and 275 deletions

View file

@ -283,8 +283,7 @@ int handle_network_msg(char* msg) {
if (strncmp(method, "probe", 5) == 0) {
probe_entry *entry = parse_to_probe_req(data_buf.head);
if (entry != NULL) {
entry->time = time(0);
if (entry != insert_to_array(entry, false, false, false)) // use 802.11k values
if (entry != insert_to_array(entry, false, false, false, time(0))) // use 802.11k values
{
// insert found an existing entry, rather than linking in our new one
dawn_free(entry);
@ -425,11 +424,9 @@ dump_client(struct blob_attr** tb, struct dawn_mac client_addr, const char* bssi
memset(client_entry->signature, 0, SIGNATURE_LEN);
}
client_entry->time = time(0);
pthread_mutex_lock(&client_array_mutex);
// If entry was akraedy in list it won't be added, so free memorY
if (client_entry != insert_client_to_array(client_entry))
if (client_entry != insert_client_to_array(client_entry, time(0)))
dawn_free(client_entry);
pthread_mutex_unlock(&client_array_mutex);
}
@ -559,8 +556,7 @@ int parse_to_clients(struct blob_attr* msg, int do_kick, uint32_t id) {
ap_entry->hostname[0] = '\0';
}
ap_entry->time = time(0);
insert_to_ap_array(ap_entry);
insert_to_ap_array(ap_entry, time(0));
if (do_kick && dawn_metric.kicking) {
update_iw_info(ap_entry->bssid_addr);