mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
treewide: cleanup code
- Revise some messages so meaning is clearer - Fix some whitespace, etc - Simplify a coiuple of small functions [cleanup commit message] Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
parent
829fa0faed
commit
b7e3d6f34d
4 changed files with 31 additions and 24 deletions
|
|
@ -303,10 +303,10 @@ int handle_network_msg(char* msg) {
|
|||
dawn_mutex_require(&probe_array_mutex);
|
||||
if (entry != insert_to_probe_array(entry, false, true, false, time(0))) // use 802.11k values
|
||||
{
|
||||
// insert found an existing entry, rather than linking in our new one
|
||||
dawnlog_info("Remote PROBE updated client / BSSID = " MACSTR " / " MACSTR " \n",
|
||||
MAC2STR(entry->client_addr.u8), MAC2STR(entry->bssid_addr.u8));
|
||||
|
||||
// insert found an existing entry, rather than linking in our new one
|
||||
dawn_free(entry);
|
||||
entry = NULL;
|
||||
}
|
||||
|
|
@ -664,7 +664,7 @@ enum {
|
|||
};
|
||||
|
||||
static const struct blobmsg_policy uci_table_policy[__UCI_TABLE_MAX] = {
|
||||
[UCI_CONFIG_VERSION ] = {.name = "version", .type = BLOBMSG_TYPE_STRING},
|
||||
[UCI_CONFIG_VERSION] = {.name = "version", .type = BLOBMSG_TYPE_STRING},
|
||||
[UCI_TABLE_METRIC] = {.name = "metric", .type = BLOBMSG_TYPE_TABLE},
|
||||
[UCI_TABLE_TIMES] = {.name = "times", .type = BLOBMSG_TYPE_TABLE}
|
||||
};
|
||||
|
|
@ -803,7 +803,7 @@ static int handle_uci_config(struct blob_attr* msg) {
|
|||
int band;
|
||||
|
||||
blobmsg_parse(uci_band_metric_policy, __UCI_BAND_METRIC_MAX, tb_band_metric,
|
||||
blobmsg_data(attr), blobmsg_len(attr));
|
||||
blobmsg_data(attr), blobmsg_len(attr));
|
||||
|
||||
for (band = 0; band < __DAWN_BAND_MAX; band++) {
|
||||
if (!strcmp(band_name, band_config_name[band]))
|
||||
|
|
|
|||
|
|
@ -811,14 +811,17 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
|||
return;
|
||||
}
|
||||
|
||||
char *data_str = blobmsg_format_json(msg, 1);
|
||||
dawn_regmem(data_str);
|
||||
|
||||
struct blob_buf b = {0};
|
||||
blob_buf_init(&b, 0);
|
||||
dawn_regmem(&b);
|
||||
|
||||
char* data_str = blobmsg_format_json(msg, 1);
|
||||
dawn_regmem(data_str);
|
||||
|
||||
blobmsg_add_json_from_string(&b, data_str);
|
||||
dawn_free(data_str);
|
||||
data_str = NULL;
|
||||
|
||||
blobmsg_add_u32(&b, "collision_domain", network_config.collision_domain);
|
||||
blobmsg_add_u32(&b, "bandwidth", network_config.bandwidth);
|
||||
|
||||
|
|
@ -852,9 +855,6 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
|||
print_ap_array();
|
||||
dawn_mutex_unlock(&ap_array_mutex);
|
||||
|
||||
dawn_free(data_str);
|
||||
data_str = NULL;
|
||||
|
||||
blob_buf_free(&b);
|
||||
dawn_unregmem(&b);
|
||||
|
||||
|
|
@ -1078,7 +1078,7 @@ void update_hostapd_sockets(struct uloop_timeout *t) {
|
|||
uloop_timeout_set(&hostapd_timer, timeout_config.update_hostapd * 1000);
|
||||
}
|
||||
|
||||
void ubus_set_nr(){
|
||||
void ubus_set_nr() {
|
||||
dawnlog_debug_func("Entering...");
|
||||
|
||||
struct hostapd_sock_entry *sub;
|
||||
|
|
@ -2053,9 +2053,13 @@ static void blobmsg_add_nr(struct blob_buf* b_local, ap* i) {
|
|||
static int mac_is_in_entry_list(const struct dawn_mac mac, const struct mac_entry_s *list) {
|
||||
dawnlog_debug_func("Entering...");
|
||||
|
||||
for (const struct mac_entry_s *i = list; i; i = i->next_mac)
|
||||
if (mac_is_equal_bb(i->mac, mac))
|
||||
while (list)
|
||||
{
|
||||
if (mac_is_equal_bb(list->mac, mac))
|
||||
return 1;
|
||||
list = list->next_mac;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue