tunneldigger: add broker_selection option to expose load balancing capabilities

Using the broker_selection param makes it possible to decide by use (default),
always use the first available broker to connect or select a random broker

See also: 51a5e46ad1/client/l2tp_client.c (L1331-L1333)

Signed-off-by: Florian Maurer <f.maurer@outlook.de>
This commit is contained in:
Florian Maurer
2025-09-15 21:22:49 +02:00
committed by Nick Hainke
parent 9a9fcc4651
commit 296c15c1f2
3 changed files with 17 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=tunneldigger PKG_NAME:=tunneldigger
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE_URL:=https://github.com/wlanslovenija/tunneldigger.git PKG_SOURCE_URL:=https://github.com/wlanslovenija/tunneldigger.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git

View File

@@ -5,4 +5,5 @@ config broker
option uuid 'abcd' option uuid 'abcd'
option interface 'l2tp0' option interface 'l2tp0'
option limit_bw_down '1024' option limit_bw_down '1024'
option broker_selection 'usage'
option enabled '0' option enabled '0'

View File

@@ -22,6 +22,7 @@ parse_broker() {
config_get hook_script "$section" hook_script config_get hook_script "$section" hook_script
config_get bind_interface "$section" bind_interface config_get bind_interface "$section" bind_interface
config_get group "$section" group config_get group "$section" group
config_get broker_selection "$section" broker_selection
[ $enabled -eq 0 ] && return [ $enabled -eq 0 ] && return
@@ -38,6 +39,20 @@ parse_broker() {
network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}" network_get_device _bind_interface "${bind_interface}" || _bind_interface="${bind_interface}"
append broker_opts "-I ${_bind_interface}" append broker_opts "-I ${_bind_interface}"
} }
[ ! -z "${broker_selection}" ] && {
# Set broker selection.
case "${broker_selection}" in
usage)
append broker_opts "-a"
;;
first)
append broker_opts "-g"
;;
random)
append broker_opts "-r"
;;
esac
}
if [ -z "$uuid" ]; then if [ -z "$uuid" ]; then
missing uuid missing uuid