add local_mode config option

This prevents communication with other usteer nodes and allows it to be
used for purely local band steering / load balancing

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau
2022-03-17 10:00:12 +01:00
parent 98247d1eda
commit 32fed79117
5 changed files with 12 additions and 2 deletions

View File

@@ -5,6 +5,9 @@ config usteer
# Log messages to syslog (0/1)
option 'syslog' '1'
# Disable network communication (0/1)
option local_mode '0'
# Use IPv6 for remote exchange
option 'ipv6' '0'

View File

@@ -66,6 +66,7 @@ uci_usteer() {
uci_option_to_json_bool "$cfg" syslog
uci_option_to_json_bool "$cfg" ipv6
uci_option_to_json_bool "$cfg" local_mode
uci_option_to_json_bool "$cfg" load_kick_enabled
uci_option_to_json_bool "$cfg" assoc_steering
uci_option_to_json_string "$cfg" node_up_script

View File

@@ -315,6 +315,9 @@ interface_recv_msg(struct interface *iface, char *addr_str, void *buf, int len)
struct blob_attr *cur;
int rem;
if (config.local_mode)
return;
if (blob_pad_len(data) != len) {
MSG(DEBUG, "Invalid message length (header: %d, real: %d)\n", blob_pad_len(data), len);
return;
@@ -606,7 +609,7 @@ usteer_check_timeout(void)
int timeout = config.remote_node_timeout;
list_for_each_entry_safe(node, tmp, &remote_nodes, list) {
if (node->check++ > timeout)
if (config.local_mode || node->check++ > timeout)
remote_node_free(node);
}
}
@@ -653,7 +656,8 @@ usteer_send_update_timer(struct uloop_timeout *t)
usteer_update_time();
uloop_timeout_set(t, config.remote_update_interval);
if (!avl_is_empty(&local_nodes) || host_info_blob) {
if (!config.local_mode &&
(!avl_is_empty(&local_nodes) || host_info_blob)) {
c = usteer_update_init();
for_each_local_node(node)
usteer_send_node(node, NULL);

1
ubus.c
View File

@@ -149,6 +149,7 @@ struct cfg_item {
_cfg(BOOL, syslog), \
_cfg(U32, debug_level), \
_cfg(BOOL, ipv6), \
_cfg(BOOL, local_mode), \
_cfg(U32, sta_block_timeout), \
_cfg(U32, local_sta_timeout), \
_cfg(U32, local_sta_update), \

View File

@@ -149,6 +149,7 @@ struct usteer_config {
uint32_t debug_level;
bool ipv6;
bool local_mode;
uint32_t sta_block_timeout;
uint32_t local_sta_timeout;