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:
@@ -5,6 +5,9 @@ config usteer
|
|||||||
# Log messages to syslog (0/1)
|
# Log messages to syslog (0/1)
|
||||||
option 'syslog' '1'
|
option 'syslog' '1'
|
||||||
|
|
||||||
|
# Disable network communication (0/1)
|
||||||
|
option local_mode '0'
|
||||||
|
|
||||||
# Use IPv6 for remote exchange
|
# Use IPv6 for remote exchange
|
||||||
option 'ipv6' '0'
|
option 'ipv6' '0'
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ uci_usteer() {
|
|||||||
|
|
||||||
uci_option_to_json_bool "$cfg" syslog
|
uci_option_to_json_bool "$cfg" syslog
|
||||||
uci_option_to_json_bool "$cfg" ipv6
|
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" load_kick_enabled
|
||||||
uci_option_to_json_bool "$cfg" assoc_steering
|
uci_option_to_json_bool "$cfg" assoc_steering
|
||||||
uci_option_to_json_string "$cfg" node_up_script
|
uci_option_to_json_string "$cfg" node_up_script
|
||||||
|
8
remote.c
8
remote.c
@@ -315,6 +315,9 @@ interface_recv_msg(struct interface *iface, char *addr_str, void *buf, int len)
|
|||||||
struct blob_attr *cur;
|
struct blob_attr *cur;
|
||||||
int rem;
|
int rem;
|
||||||
|
|
||||||
|
if (config.local_mode)
|
||||||
|
return;
|
||||||
|
|
||||||
if (blob_pad_len(data) != len) {
|
if (blob_pad_len(data) != len) {
|
||||||
MSG(DEBUG, "Invalid message length (header: %d, real: %d)\n", blob_pad_len(data), len);
|
MSG(DEBUG, "Invalid message length (header: %d, real: %d)\n", blob_pad_len(data), len);
|
||||||
return;
|
return;
|
||||||
@@ -606,7 +609,7 @@ usteer_check_timeout(void)
|
|||||||
int timeout = config.remote_node_timeout;
|
int timeout = config.remote_node_timeout;
|
||||||
|
|
||||||
list_for_each_entry_safe(node, tmp, &remote_nodes, list) {
|
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);
|
remote_node_free(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -653,7 +656,8 @@ usteer_send_update_timer(struct uloop_timeout *t)
|
|||||||
usteer_update_time();
|
usteer_update_time();
|
||||||
uloop_timeout_set(t, config.remote_update_interval);
|
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();
|
c = usteer_update_init();
|
||||||
for_each_local_node(node)
|
for_each_local_node(node)
|
||||||
usteer_send_node(node, NULL);
|
usteer_send_node(node, NULL);
|
||||||
|
1
ubus.c
1
ubus.c
@@ -149,6 +149,7 @@ struct cfg_item {
|
|||||||
_cfg(BOOL, syslog), \
|
_cfg(BOOL, syslog), \
|
||||||
_cfg(U32, debug_level), \
|
_cfg(U32, debug_level), \
|
||||||
_cfg(BOOL, ipv6), \
|
_cfg(BOOL, ipv6), \
|
||||||
|
_cfg(BOOL, local_mode), \
|
||||||
_cfg(U32, sta_block_timeout), \
|
_cfg(U32, sta_block_timeout), \
|
||||||
_cfg(U32, local_sta_timeout), \
|
_cfg(U32, local_sta_timeout), \
|
||||||
_cfg(U32, local_sta_update), \
|
_cfg(U32, local_sta_update), \
|
||||||
|
Reference in New Issue
Block a user