treewide: code and documentation cleanup

Tidy up a few bits of code - nothing very significant.
Documentation fixes and updates

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Ian Clowes 2022-04-02 17:33:45 +01:00 committed by Nick Hainke
parent 48b12eef7c
commit 4cf9d0bc51
7 changed files with 18 additions and 20 deletions

View file

@ -27,11 +27,11 @@ remove any items that are no longer used. To do this:
ubus call dawn reload_config
The configuration file on the original DAWN instance should
now have newly written sections containing only current parameter values.
now have newly written sections containing only current parameter values.
You can also start two instances of DAWN with an empty configuration file
then use this method to write the default configuration for the relevant
sections.
## What Can Be Configured?
The parameters that control DAWN are listed alphabetically below. This
section describes how they are grouped to provide various features.
@ -286,4 +286,3 @@ grep 'CONFIG-H:' `find . -type f -name "*.[ch]"`|sed 's/^.*CONFIG-.: *\(.*\)$/|\
|Parameter|Purpose|Notes [Default is bracketed]|
|---------|-------|-----|
|hostapd_dir|Path to hostapd runtime information|[/var/run/hostapd]|

View file

@ -7,8 +7,7 @@ DAWN collects and shares information about the APs and clients in the
network by using several standard components. The below assumes it is
running on an OpenWrt device.
![OpenWrtInANuthshell](https://raw.githubusercontent.com/PolynomialDivision
/upload_stuff/master/dawn_pictures/openwrt_in_a_nutshell_dawn.png)
![OpenWrtInANuthshell](https://raw.githubusercontent.com/PolynomialDivision/upload_stuff/master/dawn_pictures/openwrt_in_a_nutshell_dawn.png)
Information about capability of the AP and current clients is discovered
via the hostapd and iwinfo. The task to do this is scheduled by a timer.
@ -105,7 +104,7 @@ Now you need to clone DAWN, e.g. into your home directory
You must then add a symlink. In the OpenWrt branch do something like
ln -s ~/DAWN/.git/ ~openwrt/feeds/packages/net/dawn/git-src
ln -s ~/DAWN/.git/ ~/openwrt/feeds/packages/net/dawn/git-src
Now compile dawn
@ -179,4 +178,3 @@ algorithms to ensure that expected behaviour occurs. At the time of
writing a number of *.script files exist that can be passed to
test_storage, but these haven't necessarily been maintained as the code
has evolved from when they were originally written.

View file

@ -147,4 +147,3 @@ kicking_threshold parameter.
}
}
}

View file

@ -30,7 +30,7 @@ Top tip from the [configuration guide](CONFIGURE.md):
## How DAWN Works
Each DAWN instance gathers information about two types of client: those
that are currently connected to the host AP, plus those querying whether
to connect. It then shares that information with other DAWN instances.
to connect. It then shares that information with other DAWN instances.
Each then has a view of how well any AP can "see" each client device, and
that then allows DAWN to steer a client to a different AP when appropriate.
@ -68,9 +68,8 @@ that adds some DAWN information to the management interface of an OpenWrt device
NB: As of early-2022 it hasn't had the developer attention it needs
recently, so may not be working as well as you might like.
## Developers
If you want to use versions of DAWN that are not fully packaged yet or to
work on a fork of the code yourself then see the [Developer
Guide](DEVELOPER.md).

View file

@ -16,8 +16,6 @@ struct network_config_s network_config;
struct time_config_s timeout_config;
struct local_config_s local_config;
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
static client* client_array_get_client_for_bssid(struct dawn_mac bssid_mac, struct dawn_mac client_mac);
static int compare_station_count(ap* ap_entry_own, ap* ap_entry_to_compare, struct dawn_mac client_addr);

View file

@ -5,8 +5,6 @@
#include "datastorage.h"
#include "dawn_iwinfo.h"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
char hostapd_dir_glob[HOSTAPD_DIR_LEN];
int call_iwinfo(char *client_addr);
@ -182,7 +180,7 @@ int get_rssi(const char *ifname, struct dawn_mac client_addr) {
iwinfo_finish();
return INT_MIN;
} else if (len <= 0) {
dawnlog_warning("No station connected\n");
dawnlog_trace("No station connected to %s\n", ifname);
iwinfo_finish();
return INT_MIN;
}
@ -238,7 +236,7 @@ int get_expected_throughput(const char *ifname, struct dawn_mac client_addr) {
iwinfo_finish();
return INT_MIN;
} else if (len <= 0) {
dawnlog_warning("No station connected\n");
dawnlog_trace("No station connected to %s\n", ifname);
iwinfo_finish();
return INT_MIN;
}

View file

@ -707,11 +707,11 @@ static int hostapd_notify(struct ubus_context* ctx_local, struct ubus_object* ob
dawnlog_debug_func("Entering...");
if (dawnlog_showing(DAWNLOG_DEBUG))
if (dawnlog_showing(DAWNLOG_TRACE))
{
char* str = blobmsg_format_json(msg, true);
dawn_regmem(str);
dawnlog_info("hostapd sent %s = %s\n", method, str);
dawnlog_trace("hostapd sent %s = %s\n", method, str);
dawn_free(str);
str = NULL;
}
@ -1572,7 +1572,15 @@ static int get_network(struct ubus_context *ctx_local, struct ubus_object *obj,
blob_buf_init(&b, 0);
dawn_regmem(&b);
dawn_mutex_lock(&ap_array_mutex);
dawn_mutex_lock(&client_array_mutex);
build_network_overview(&b);
dawn_mutex_unlock(&client_array_mutex);
dawn_mutex_unlock(&ap_array_mutex);
ret = ubus_send_reply(ctx_local, req, b.head);
if (ret)
dawnlog_error("Failed to send network overview: %s\n", ubus_strerror(ret));
@ -2061,7 +2069,6 @@ int build_hearing_map_sort_client(struct blob_buf *b) {
}
// FIXME: Should we have more mutex protection while accessing these lists?
int build_network_overview(struct blob_buf *b) {
dawnlog_debug_func("Entering...");