From: Florian Eckert Date: Thu, 9 Jul 2026 12:44:44 +0000 (+0200) Subject: strongswan: move strongswan install_routes check into subfunction X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=89530694ff8ace88e92f244c655951e2eee111fb;p=openwrt-packages.git strongswan: move strongswan install_routes check into subfunction 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 --- diff --git a/net/strongswan/files/swanctl.init b/net/strongswan/files/swanctl.init index ecdc613c8..a041b5c63 100644 --- a/net/strongswan/files/swanctl.init +++ b/net/strongswan/files/swanctl.init @@ -652,20 +652,28 @@ config_remote() { swanctl_xappend0 "" } +config_charon_install_routes() { + local conf="$1" + + local rtinstall_enabled install_routes + + config_get_bool rtinstall_enabled "$conf" rtinstall_enabled 1 + [ $rtinstall_enabled -eq 1 ] && install_routes=yes || install_routes=no + + swan_xappend1 "install_routes = $install_routes" +} + config_strongswan_generate() { local conf="$1" - local debug install_routes routing_tables_ignored device_list + local debug routing_tables_ignored device_list - local rtinstall_enabled local routing_table local routing_table_id local interface local interface_list config_get debug "$conf" debug 0 - config_get_bool rtinstall_enabled "$conf" rtinstall_enabled 1 - [ $rtinstall_enabled -eq 1 ] && install_routes=yes || install_routes=no # prepare extra charon config option ignore_routing_tables for routing_table in $(config_get "$conf" "ignore_routing_tables"); do @@ -691,7 +699,7 @@ config_strongswan_generate() { fi swan_xappend0 "charon {" - swan_xappend1 "install_routes = $install_routes" + config_charon_install_routes "$conf" [ -n "$routing_tables_ignored" ] && swan_xappend1 "ignore_routing_tables = $routing_tables_ignored" [ -n "$device_list" ] && swan_xappend1 "interfaces_use = $device_list" swan_xappend1 "start-scripts {"