tunneldigger-broker: update config file and init for v0.4.0
authorPerry Melange <isprotejesvalkata@gmail.com>
Thu, 17 Aug 2023 20:46:11 +0000 (22:46 +0200)
committerNick Hainke <vincent@systemli.org>
Wed, 23 Aug 2023 11:46:32 +0000 (13:46 +0200)
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
(cherry picked from commit 99dfea773019fc8fb194a22e7beba4e94ed8df66)

net/tunneldigger-broker/files/config.default
net/tunneldigger-broker/files/tunneldigger-broker.init

index 13bb45113ec934174e7ea5f6e84207ec3e62119b..ce911cdc1f091481b7e1cc6882d262d4e2c9b5f2 100644 (file)
@@ -3,16 +3,23 @@ config broker
        list port '123'
        list port '8942'
        option interface 'loopback'
-       option max_cookies '1024'
        option max_tunnels '1024'
-       option port_base '20000'
        option tunnel_id_base '100'
-       option tunnel_timeout '60'
        option pmtu '0'
-       option namespace 'production'
        option connection_rate_limit '0.2'
+       option connection_rate_limit_per_ip_count '0'
+       option connection_rate_limit_per_ip_time '0'
 
 config log
-       option filename '/dev/null'
        option verbosity 'INFO'
        option log_ip_addresses '0'
+
+# To automatically put tunnel interfaces into pre-exitsing bridges
+# via the hook scripts, then create a bridge section for each 
+# supported mtu.  If pmtu is set to non-zero above, then only that 
+# bridge is needed.  To isolate the bridge ports, set isolate to '1'.
+# '0' is the default
+#config bridge
+#      option interface 'br-mybridge'
+#      option mtu '1446'
+#      option isolate '1'
index 5c0888b0450b28d55285c4c412d9261f5727e684..1fa98fea761a9501978ffc5103a42613dab65da6 100755 (executable)
@@ -54,7 +54,7 @@ parse_broker() {
                cfg_append_kv address "${address}"
        }
 
-       OPTIONS="max_cookies max_tunnels port_base tunnel_id_base tunnel_timeout namespace connection_rate_limit pmtu"
+       OPTIONS="max_tunnels tunnel_id_base connection_rate_limit connection_rate_limit_per_ip_count connection_rate_limit_per_ip_time pmtu"
        for option in ${OPTIONS}; do
                cfg_append_option "$section" "${option}" "${option}"
        done
@@ -66,13 +66,14 @@ parse_broker() {
        cfg_append_kv "session.up" "${HOOKPATH}/setup"
        cfg_append_kv "session.pre-down" "${HOOKPATH}/teardown"
        cfg_append_kv "session.mtu-changed" "${HOOKPATH}/mtu-changed"
+       cfg_append_kv "broker.connection-rate-limit" "${HOOKPATH}/connection-rate-limit"
 }
 
 parse_log() {
        local section="$1"
        cfg_append_section log
        
-       OPTIONS="filename verbosity"
+       OPTIONS="verbosity"
        for option in ${OPTIONS}; do
                cfg_append_option "$section" "${option}" "${option}"
        done
@@ -97,8 +98,25 @@ start_service() {
        procd_set_param command "/usr/bin/python"
        procd_append_param command -m tunneldigger_broker.main
        procd_append_param command "${CONFIGFILE}"
+
+       # Set up a trigger when the interface changes state
+       local netdev
+       network_get_physdev netdev $(uci show "tunneldigger-broker.@broker[0].interface" | cut -d \' -f 2)
+       procd_set_param netdev $netdev
+
        procd_set_param respawn
        procd_set_param stdout 1
        procd_set_param stderr 1
        procd_close_instance
 }
+
+reload_service() {
+       restart
+}
+
+service_triggers() {
+       local interface=$(uci show "tunneldigger-broker.@broker[0].interface" | cut -d \' -f 2)
+       procd_add_interface_trigger "interface.*.up" $interface /etc/init.d/tunneldigger-broker restart
+       procd_add_reload_trigger "tunneldigger-broker"
+}
+