From 6bf3cd77549a61ec328d0bfda2fc6604ba2ab2e9 Mon Sep 17 00:00:00 2001 From: Ian Clowes Date: Mon, 31 Jan 2022 10:52:40 +0000 Subject: [PATCH] ubus/datastorage/msghandler: cleanup - Simplify linked list search - code was unnecessarily complex for no benefit - AP record is uniquely identified by BSSID, so remove unnecessary search on SSID as well - Change some data handling to simplify passing of records, pointers, etc - Assure sort order to simplify generating network map - Removed unused fields for collision domain and bandwidth [cleanup commit message] Signed-off-by: Nick Hainke --- src/include/datastorage.h | 42 +++++---- src/storage/datastorage.c | 193 ++++++++++++++++++-------------------- src/test/test_storage.c | 18 ++-- src/utils/msghandler.c | 14 +-- src/utils/ubus.c | 37 ++++---- 5 files changed, 147 insertions(+), 157 deletions(-) diff --git a/src/include/datastorage.h b/src/include/datastorage.h index 146b66a..8bcce6b 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -246,24 +246,26 @@ typedef struct client_s { uint8_t rrm_enabled_capa; //the first byte is enough } client; +// (1) Set in parse_to_clients() +// (2) Set by list insert operations typedef struct ap_s { - struct ap_s* next_ap; - struct dawn_mac bssid_addr; - uint32_t freq; // ap_get_nr() - uint8_t ht_support; // eval_probe_metric() - uint8_t vht_support; // eval_probe_metric() - uint32_t channel_utilization; // eval_probe_metric() - time_t time; // remove_old...entries - uint32_t station_count; // compare_station_count() <- better_ap_available() - uint8_t ssid[SSID_MAX_LEN + 1]; // compare_sid() < -better_ap_available() - char neighbor_report[NEIGHBOR_REPORT_LEN]; - uint32_t op_class; // ubus_send_beacon_report() - uint32_t channel; // ubus_send_beacon_report() - uint32_t collision_domain; // TODO: ap_get_collision_count() never evaluated? - uint32_t bandwidth; // TODO: Never evaluated? - uint32_t ap_weight; // eval_probe_metric() - char iface[MAX_INTERFACE_NAME]; - char hostname[HOST_NAME_MAX]; + struct ap_s* next_ap; // (2) + struct dawn_mac bssid_addr; // (1) + uint32_t freq; // ap_get_nr() // (1) + uint8_t ht_support; // eval_probe_metric() // (1) + uint8_t vht_support; // eval_probe_metric() // (1) + uint32_t channel_utilization; // eval_probe_metric() // (1) + time_t time; // remove_old...entries // (2) + uint32_t station_count; // compare_station_count() <- better_ap_available() // (1) + uint8_t ssid[SSID_MAX_LEN + 1]; // compare_sid() < -better_ap_available() // (1) + char neighbor_report[NEIGHBOR_REPORT_LEN]; // (1) // TODO: Check whether we should store and AP one or generate on fly for client + uint32_t op_class; // ubus_send_beacon_report() // (1) + uint32_t channel; // ubus_send_beacon_report() // (1) + //uint32_t collision_domain; // TODO: ap_get_collision_count() never evaluated? + //uint32_t bandwidth; // TODO: Never evaluated? + uint32_t ap_weight; // eval_probe_metric() // (1) + char iface[MAX_INTERFACE_NAME]; // (1) + char hostname[HOST_NAME_MAX]; // (1) } ap; // ---------------- Defines ---------------- @@ -307,7 +309,7 @@ void remove_old_client_entries(time_t current_time, long long int threshold); client *insert_client_to_array(client *entry, time_t expiry); -int kick_clients(ap* kicking_ap, uint32_t id); +int kick_clients(struct dawn_mac bssid, uint32_t id); void update_iw_info(struct dawn_mac bssid); @@ -329,11 +331,11 @@ void remove_old_ap_entries(time_t current_time, long long int threshold); void print_ap_array(); -ap *ap_array_get_ap(struct dawn_mac bssid_mac, const uint8_t* ssid); +ap *ap_array_get_ap(struct dawn_mac bssid_mac); int probe_array_set_all_probe_count(struct dawn_mac client_addr, uint32_t probe_count); -int ap_get_collision_count(int col_domain); +//int ap_get_collision_count(int col_domain); void send_beacon_reports(ap *a, int id); diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index a0b6e26..abbb537 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -158,52 +158,6 @@ static probe_entry** probe_array_find_first_entry(struct dawn_mac client_mac, st return lo_ptr; } -static ap** ap_array_find_first_entry(struct dawn_mac bssid_mac, const uint8_t* ssid) -{ - int lo = 0; - ap** lo_ptr = &ap_set; - int hi = ap_entry_last; - - dawnlog_debug_func("Entering..."); - - while (lo < hi) { - ap** i = lo_ptr; - int scan_pos = lo; - int this_cmp; - - // m is next test position of binary search - int m = (lo + hi) / 2; - - // find entry with ordinal position m - while (scan_pos++ < m) - { - i = &((*i)->next_ap); - } - - if (ssid) - { - this_cmp = strcmp((char*)(*i)->ssid, (char*)ssid); - } - else - { - this_cmp = 0; - } - this_cmp = this_cmp ? this_cmp : mac_compare_bb((*i)->bssid_addr, bssid_mac); - - if (this_cmp < 0) - { - lo = m + 1; - lo_ptr = &((*i)->next_ap); - } - else - { - hi = m; - } - } - - return lo_ptr; -} - // Manage a list of client entries sorted by BSSID and client MAC static struct client_s** client_skip_array_find_first_entry(struct dawn_mac client_mac, struct dawn_mac bssid_mac, bool do_bssid) { @@ -538,7 +492,7 @@ int better_ap_available(ap *kicking_ap, struct dawn_mac client_mac, struct kicki continue; } - ap* candidate_ap = ap_array_get_ap(i->bssid_addr, kicking_ap->ssid); + ap* candidate_ap = ap_array_get_ap(i->bssid_addr); if (candidate_ap == NULL) { dawnlog_trace("Candidate AP not in array\n"); @@ -621,9 +575,11 @@ int better_ap_available(ap *kicking_ap, struct dawn_mac client_mac, struct kicki return kick; } -int kick_clients(ap* kicking_ap, uint32_t id) { +int kick_clients(struct dawn_mac bssid_mac, uint32_t id) { dawnlog_debug_func("Entering..."); + ap* kicking_ap = ap_array_get_ap(bssid_mac); + pthread_mutex_lock(&client_array_mutex); pthread_mutex_lock(&probe_array_mutex); @@ -1167,29 +1123,47 @@ probe_entry* insert_to_array(probe_entry* entry, int inc_counter, int save_80211 return entry; // return pointer to what we used, which may not be what was passed in } -ap *insert_to_ap_array(ap* entry, time_t expiry) { - dawnlog_debug_func("Entering..."); - - pthread_mutex_lock(&ap_array_mutex); - - // 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) && - !strcmp((char*)old_entry->ssid, (char*)entry->ssid)) - ap_array_delete(old_entry); - - entry->time = expiry; - ap_array_insert(entry); - pthread_mutex_unlock(&ap_array_mutex); - - print_ap_array(); +static __inline__ ap* ap_array_unlink_entry(ap** i) +{ + ap* entry = *i; + *i = entry->next_ap; + entry = NULL; + ap_entry_last--; return entry; } +static ap* ap_array_update_entry(ap* entry) { + dawnlog_debug_func("Entering..."); + ap* old_entry = NULL; + ap** i = &ap_set; + while (*i != NULL && mac_compare_bb(entry->bssid_addr, (*i)->bssid_addr) != 0) { + i = &((*i)->next_ap); + } + + // Check that the SSID has not changed + if (*i && strcmp((char*)(*i)->ssid, (char*)entry->ssid) == 0) + { + // Swap entries if same SSID... + old_entry = *i; + entry->next_ap = old_entry->next_ap; + old_entry->next_ap = NULL; + *i = entry; + } + else + { + // ... otherwise find new position + if (*i) + old_entry = ap_array_unlink_entry(i); + + ap_array_insert(entry); + } + + return old_entry; +} + +#if 0 // Delete pending if no longer required // TODO: What is collision domain used for? int ap_get_collision_count(int col_domain) { @@ -1207,65 +1181,78 @@ int ap_get_collision_count(int col_domain) { return ret_sta_count; } +#endif + +ap *insert_to_ap_array(ap* entry, time_t expiry) { + dawnlog_debug_func("Entering..."); + + entry->time = expiry; + + pthread_mutex_lock(&ap_array_mutex); + ap* old_entry = ap_array_update_entry(entry); + pthread_mutex_unlock(&ap_array_mutex); + + if (old_entry) + dawn_free(old_entry); + + print_ap_array(); + + return entry; +} -// TODO: Do we need to order this set? Scan of randomly arranged elements is just -// as quick if we're not using an optimised search. -void ap_array_insert(ap* entry) { - ap** i; +// AP entries are sorted by SSID and BSSID to simplify display of network tree + void ap_array_insert(ap* entry) { dawnlog_debug_func("Entering...");; - for (i = &ap_set; *i != NULL; i = &((*i)->next_ap)) { - // TODO: Not sure these tests are right way around to ensure SSID / MAC ordering - // TODO: Do we do any SSID checks elsewhere? - int sc = strcmp((char*)entry->ssid, (char*)(*i)->ssid); - if ((sc < 0) || (sc == 0 && mac_compare_bb(entry->bssid_addr, (*i)->bssid_addr) < 0)) { - break; + ap** insert_pos = &ap_set; + + while (*insert_pos != NULL) + { + int this_cmp = strcmp((char*)entry->ssid, (char*)(*insert_pos)->ssid); + + if (this_cmp == 0) + { + this_cmp = mac_compare_bb(entry->bssid_addr, (*insert_pos)->bssid_addr); } + + if (this_cmp <= 0) + break; + + insert_pos = &((*insert_pos)->next_ap); } - entry->next_ap = *i; - *i = entry; + entry->next_ap = *insert_pos; + *insert_pos = entry; ap_entry_last++; } -ap* ap_array_get_ap(struct dawn_mac bssid_mac, const uint8_t* ssid) { +ap* ap_array_get_ap(struct dawn_mac bssid_mac) { dawnlog_debug_func("Entering...");; pthread_mutex_lock(&ap_array_mutex); - ap* ret = *ap_array_find_first_entry(bssid_mac, ssid); + ap* ret = ap_set; + + while (ret && mac_compare_bb(bssid_mac, ret->bssid_addr) != 0) { + ret = ret->next_ap; + } pthread_mutex_unlock(&ap_array_mutex); - if (ret != NULL && !mac_is_equal_bb((ret)->bssid_addr, bssid_mac)) - ret = NULL; - return ret; } -static __inline__ void ap_array_unlink_next(ap** i) -{ - dawnlog_debug_func("Entering...");; - - ap* entry = *i; - *i = entry->next_ap; - dawn_free(entry); - entry = NULL; - ap_entry_last--; -} - -int ap_array_delete(ap *entry) { +int ap_array_delete(ap* entry) { int not_found = 1; dawnlog_debug_func("Entering...");; - // TODO: Some parts of AP entry management look at SSID as well. Not this? ap** i = &ap_set; - while ( *i != NULL) { + while (*i != NULL) { if (*i == entry) { - ap_array_unlink_next(i); + dawn_free(ap_array_unlink_entry(i)); not_found = 0; break; } @@ -1308,7 +1295,7 @@ void remove_old_ap_entries(time_t current_time, long long int threshold) { ap **i = &ap_set; while (*i != NULL) { if (((*i)->time) < (current_time - threshold)) { - ap_array_unlink_next(i); + dawn_free(ap_array_unlink_entry(i)); } else { i = &((*i)->next_ap); @@ -1470,10 +1457,10 @@ void print_client_array() { static void print_ap_entry(int level, ap *entry) { if (dawnlog_showing(DAWNLOG_INFO)) { - dawnlog_info("ssid: %s, bssid_addr: " MACSTR ", freq: %d, ht: %d, vht: %d, chan_utilz: %d, col_d: %d, bandwidth: %d, col_count: %d neighbor_report: %s\n", - entry->ssid, MAC2STR(entry->bssid_addr.u8), entry->freq, entry->ht_support, entry->vht_support, - entry->channel_utilization, entry->collision_domain, entry->bandwidth, - ap_get_collision_count(entry->collision_domain), entry->neighbor_report + dawnlog_info("ssid: %s, bssid_addr: " MACSTR ", freq: %d, ht: %d, vht: %d, chan_utilz: %d, neighbor_report: %s\n", + entry->ssid, MAC2STR(entry->bssid_addr.u8), entry->freq, entry->ht_support, entry->vht_support, entry->channel_utilization, + //entry->collision_domain, ap_get_collision_count(entry->collision_domain), // TODO: Fix format string if readding + entry->neighbor_report ); } } diff --git a/src/test/test_storage.c b/src/test/test_storage.c index df341d8..e3ae6fc 100644 --- a/src/test/test_storage.c +++ b/src/test/test_storage.c @@ -175,7 +175,7 @@ static int array_auto_helper(int action, int i0, int i1) time_moves_on(); } else - ap_array_delete(ap_array_get_ap(this_mac, NULL)); + ap_array_delete(ap_array_get_ap(this_mac)); break; case HELPER_CLIENT: ; // Empty statement to allow label before declaration @@ -681,8 +681,8 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) memset(ap0->ssid, '*', SSID_MAX_LEN); ap0->ssid[SSID_MAX_LEN] = '\0'; ap0->neighbor_report[0] = 0; - ap0->collision_domain = 0; - ap0->bandwidth = 0; + //ap0->collision_domain = 0; + //ap0->bandwidth = 0; ap0->ap_weight = 0; args_required = 1; @@ -701,8 +701,8 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) else if (!strncmp(fn, "stations=", 9)) load_u32(&ap0->station_count, fn + 9); else if (!strncmp(fn, "ssid=", 5)) load_ssid(ap0->ssid, fn + 5); else if (!strncmp(fn, "neighbors=", 10)) load_string(NEIGHBOR_REPORT_LEN, ap0->neighbor_report, fn + 10); - else if (!strncmp(fn, "col_d=", 6)) load_u32(&ap0->collision_domain, fn + 6); - else if (!strncmp(fn, "bandwidth=", 10)) load_u32(&ap0->bandwidth, fn + 10); + //else if (!strncmp(fn, "col_d=", 6)) load_u32(&ap0->collision_domain, fn + 6); + //else if (!strncmp(fn, "bandwidth=", 10)) load_u32(&ap0->bandwidth, fn + 10); else if (!strncmp(fn, "weight=", 7)) load_u32(&ap0->ap_weight, fn + 7); else { printf("ERROR: Loading AP, but don't recognise assignment \"%s\"\n", fn); @@ -876,7 +876,7 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) hwaddr_aton(argv[1], kick_mac.u8); load_u32(&kick_id, argv[2]); - while ((kick_clients(ap_array_get_ap(kick_mac, NULL), kick_id) != 0) && safety_count--); + while ((kick_clients(kick_mac, kick_id) != 0) && safety_count--); } } else if (strcmp(*argv, "better_ap_available") == 0) @@ -911,11 +911,11 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) strcpy(nb, argv[4]); } strncpy(neighbor.nr, nb, NEIGHBOR_REPORT_LEN); - tr = better_ap_available(ap_array_get_ap(bssid_mac, NULL), client_mac, &neighbor_list); + tr = better_ap_available(ap_array_get_ap(bssid_mac), client_mac, &neighbor_list); } else { - tr = better_ap_available(ap_array_get_ap(bssid_mac, NULL), client_mac, NULL); + tr = better_ap_available(ap_array_get_ap(bssid_mac), client_mac, NULL); } printf("better_ap_available returned %d (with neighbour report %s)\n", tr, nb); @@ -940,7 +940,7 @@ static int consume_actions(int argc, char* argv[], int harness_verbosity) } else { - ap* ap_entry = ap_array_get_ap(pr0->bssid_addr, NULL); + ap* ap_entry = ap_array_get_ap(pr0->bssid_addr); int this_metric = eval_probe_metric(pr0, ap_entry); dawnlog_info("Score: %d of:\n", this_metric); diff --git a/src/utils/msghandler.c b/src/utils/msghandler.c index ff753aa..63c7a37 100644 --- a/src/utils/msghandler.c +++ b/src/utils/msghandler.c @@ -66,8 +66,8 @@ enum { CLIENT_TABLE_VHT, CLIENT_TABLE_CHAN_UTIL, CLIENT_TABLE_NUM_STA, - CLIENT_TABLE_COL_DOMAIN, - CLIENT_TABLE_BANDWIDTH, + //CLIENT_TABLE_COL_DOMAIN, + //CLIENT_TABLE_BANDWIDTH, CLIENT_TABLE_WEIGHT, CLIENT_TABLE_NEIGHBOR, CLIENT_TABLE_IFACE, @@ -84,8 +84,8 @@ static const struct blobmsg_policy client_table_policy[__CLIENT_TABLE_MAX] = { [CLIENT_TABLE_VHT] = {.name = "vht_supported", .type = BLOBMSG_TYPE_INT8}, [CLIENT_TABLE_CHAN_UTIL] = {.name = "channel_utilization", .type = BLOBMSG_TYPE_INT32}, [CLIENT_TABLE_NUM_STA] = {.name = "num_sta", .type = BLOBMSG_TYPE_INT32}, - [CLIENT_TABLE_COL_DOMAIN] = {.name = "collision_domain", .type = BLOBMSG_TYPE_INT32}, - [CLIENT_TABLE_BANDWIDTH] = {.name = "bandwidth", .type = BLOBMSG_TYPE_INT32}, + //[CLIENT_TABLE_COL_DOMAIN] = {.name = "collision_domain", .type = BLOBMSG_TYPE_INT32}, + //[CLIENT_TABLE_BANDWIDTH] = {.name = "bandwidth", .type = BLOBMSG_TYPE_INT32}, [CLIENT_TABLE_WEIGHT] = {.name = "ap_weight", .type = BLOBMSG_TYPE_INT32}, [CLIENT_TABLE_NEIGHBOR] = {.name = "neighbor_report", .type = BLOBMSG_TYPE_STRING}, [CLIENT_TABLE_IFACE] = {.name = "iface", .type = BLOBMSG_TYPE_STRING}, @@ -530,7 +530,7 @@ int parse_to_clients(struct blob_attr* msg, int do_kick, uint32_t id) { if (tb[CLIENT_TABLE_SSID]) { strcpy((char*)ap_entry->ssid, blobmsg_get_string(tb[CLIENT_TABLE_SSID])); } - +#if 0 // Pending deletion if no longer required if (tb[CLIENT_TABLE_COL_DOMAIN]) { ap_entry->collision_domain = blobmsg_get_u32(tb[CLIENT_TABLE_COL_DOMAIN]); } @@ -544,7 +544,7 @@ int parse_to_clients(struct blob_attr* msg, int do_kick, uint32_t id) { else { ap_entry->bandwidth = -1; } - +#endif ap_entry->station_count = num_stations; if (tb[CLIENT_TABLE_WEIGHT]) { @@ -582,7 +582,7 @@ int parse_to_clients(struct blob_attr* msg, int do_kick, uint32_t id) { if (do_kick && dawn_metric.kicking) { update_iw_info(ap_entry->bssid_addr); - kick_clients(ap_entry, id); + kick_clients(ap_entry->bssid_addr, id); } } return 0; diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 9741c68..30675f5 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -288,7 +288,7 @@ int parse_to_beacon_rep(struct blob_attr *msg) { } const uint8_t *ssid = (const uint8_t*)blobmsg_get_string(tb[BEACON_REP_SSID]); - ap *ap_entry_rep = ap_array_get_ap(msg_bssid, ssid); + ap *ap_entry_rep = ap_array_get_ap(msg_bssid); // no client from network!! if (ap_entry_rep == NULL) { @@ -396,7 +396,7 @@ bool discard_entry = true; else { // find own probe entry and calculate score - ap* this_ap = ap_array_get_ap(tmp->bssid_addr, tmp->ssid); + ap* this_ap = ap_array_get_ap(tmp->bssid_addr); if (this_ap != NULL && better_ap_available(this_ap, tmp->client_addr, NULL) > 0) { dawnlog_trace("Deny authentication due to better AP available"); deny_request = 1; @@ -468,8 +468,8 @@ int discard_entry = true; else { // find own probe entry and calculate score - ap* this_ap = ap_array_get_ap(tmp->bssid_addr, tmp->ssid); - if (this_ap != NULL && better_ap_available(this_ap, tmp->client_addr, NULL) > 0) { + ap* this_ap = ap_array_get_ap(assoc_req->bssid_addr); + if (this_ap != NULL && better_ap_available(this_ap, assoc_req->client_addr, NULL) > 0) { dawnlog_trace("Deny association due to better AP available"); deny_request = 1; } @@ -537,7 +537,7 @@ static int handle_probe_req(struct blob_attr* msg) { else { // find own probe entry and calculate score - ap* this_ap = ap_array_get_ap(probe_req_updated->bssid_addr, probe_req_updated->ssid); + ap* this_ap = ap_array_get_ap(probe_req_updated->bssid_addr); if (this_ap != NULL && better_ap_available(this_ap, probe_req_updated->client_addr, NULL) > 0) { dawnlog_trace("Deny probe due to better AP available"); deny_request = 1; @@ -729,14 +729,15 @@ int dawn_init_ubus(const char *ubus_socket, const char *hostapd_dir) { } static int get_band_from_bssid(struct dawn_mac bssid) { - ap *a; - dawnlog_debug_func("Entering..."); +int ret = -1; - for (a = ap_set; a; a = a->next_ap) { - if (mac_is_equal_bb(a->bssid_addr, bssid)) - return get_band(a->freq); - } - return -1; + dawnlog_debug_func("Entering..."); + ap* a = ap_array_get_ap(bssid); + + if (a) + ret = get_band(a->freq); + + return ret; } static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_attr *msg) { @@ -979,7 +980,7 @@ void update_beacon_reports(struct uloop_timeout *t) { struct hostapd_sock_entry *sub; list_for_each_entry(sub, &hostapd_sock_list, list) { - if (sub->subscribed && (a = ap_array_get_ap(sub->bssid_addr, (uint8_t*)sub->ssid))) { + if (sub->subscribed && (a = ap_array_get_ap(sub->bssid_addr))) { dawnlog_debug("Sending beacon report Sub!\n"); send_beacon_reports(a, sub->id); } @@ -1715,7 +1716,7 @@ int build_hearing_map_sort_client(struct blob_buf *b) { ssid_list = blobmsg_open_table(b, (char*)m->ssid); probe_entry* i = probe_set; while (i != NULL) { - ap *ap_entry_i = ap_array_get_ap(i->bssid_addr, m->ssid); + ap *ap_entry_i = ap_array_get_ap(i->bssid_addr); if (ap_entry_i == NULL) { i = i->next_probe; @@ -1734,7 +1735,7 @@ int build_hearing_map_sort_client(struct blob_buf *b) { k != NULL && mac_is_equal_bb(k->client_addr, i->client_addr); k = k->next_probe) { - ap *ap_k = ap_array_get_ap(k->bssid_addr, m->ssid); + ap *ap_k = ap_array_get_ap(k->bssid_addr); if (ap_k == NULL || strcmp((char*)ap_k->ssid, (char*)m->ssid) != 0) { continue; @@ -1845,7 +1846,7 @@ int build_network_overview(struct blob_buf *b) { } blobmsg_add_u8(b, "ht", k->ht); blobmsg_add_u8(b, "vht", k->vht); - blobmsg_add_u32(b, "collision_count", ap_get_collision_count(m->collision_domain)); + //blobmsg_add_u32(b, "collision_count", ap_get_collision_count(m->collision_domain)); pthread_mutex_lock(&probe_array_mutex); @@ -1912,7 +1913,7 @@ int ap_get_nr(struct blob_buf *b_local, struct dawn_mac own_bssid_addr, const ch void* nbs = blobmsg_open_array(b_local, "list"); - own_ap = ap_array_get_ap(own_bssid_addr, (uint8_t*)ssid); + own_ap = ap_array_get_ap(own_bssid_addr); if (!own_ap) return -1; for (int band = 0; band < __DAWN_BAND_MAX; band++) { @@ -1931,7 +1932,7 @@ int ap_get_nr(struct blob_buf *b_local, struct dawn_mac own_bssid_addr, const ch pthread_mutex_unlock(&ap_array_mutex); for (n = preferred_list; n; n = n->next_mac) { - if ((i = ap_array_get_ap(n->mac, (uint8_t*)ssid))) + if ((i = ap_array_get_ap(n->mac))) blobmsg_add_nr(b_local, i); } blobmsg_close_array(b_local, nbs);