]> git.99rst.org Git - openwrt-packages.git/commitdiff
strongswan: move strongswan interfaces_use check into subfunction
authorFlorian Eckert <redacted>
Fri, 10 Jul 2026 11:03:30 +0000 (13:03 +0200)
committerPhilip Prindeville <redacted>
Thu, 16 Jul 2026 20:27:36 +0000 (14:27 -0600)
This makes the generation process clearer and more extensible.

This commit does not change the function and is a preparatory commit.

Signed-off-by: Florian Eckert <redacted>
net/strongswan/files/swanctl.init

index 2a927d678f46f9a3e166be0cd9a5610f7da43587..a42f07f0e6740708c85845f537f3b48868255411 100644 (file)
@@ -652,6 +652,25 @@ config_remote() {
        swanctl_xappend0 ""
 }
 
+config_charon_interfaces_use() {
+       local conf="$1"
+
+       local interface interface_list device_list
+
+       config_list_foreach "$conf" interface append_var interface_list
+       if [ -z "$interface_list" ]; then
+               WAIT_FOR_INTF=0
+       else
+               for interface in $interface_list; do
+                       network_get_device device $interface
+                       [ -n "$device" ] && append device_list "$device" ","
+               done
+               [ -n "$device_list" ] && WAIT_FOR_INTF=0 || WAIT_FOR_INTF=1
+       fi
+
+       [ -n "$device_list" ] && swan_xappend1 "interfaces_use = $device_list"
+}
+
 config_charon_ignore_routing_tables() {
        local conf="$1"
 
@@ -686,29 +705,14 @@ config_charon_install_routes() {
 config_strongswan_generate() {
        local conf="$1"
 
-       local debug device_list
-
-       local interface
-       local interface_list
+       local debug
 
        config_get debug "$conf" debug 0
 
-       config_list_foreach "$conf" interface append_var interface_list
-
-       if [ -z "$interface_list" ]; then
-               WAIT_FOR_INTF=0
-       else
-               for interface in $interface_list; do
-                       network_get_device device $interface
-                       [ -n "$device" ] && append device_list "$device" ","
-               done
-               [ -n "$device_list" ] && WAIT_FOR_INTF=0 || WAIT_FOR_INTF=1
-       fi
-
        swan_xappend0 "charon {"
        config_charon_install_routes "$conf"
        config_charon_ignore_routing_tables "$conf"
-       [ -n "$device_list" ] && swan_xappend1 "interfaces_use = $device_list"
+       config_charon_interfaces_use "$conf"
        swan_xappend1 "start-scripts {"
        swan_xappend2 "load-all = /usr/sbin/swanctl --load-all --noprompt"
        swan_xappend1 "}"
git clone https://git.99rst.org/PROJECT