]> git.99rst.org Git - openwrt-packages.git/commitdiff
strongswan: merging the swanctl and strongswan configurations block by block
authorFlorian Eckert <redacted>
Thu, 9 Jul 2026 12:00:30 +0000 (14:00 +0200)
committerPhilip Prindeville <redacted>
Thu, 16 Jul 2026 20:27:36 +0000 (14:27 -0600)
In the 'prepare_env' function, the configuration setup for 'swanctl' and
'strongswan' is not grouped into blocks, so it is not clear which functions
depend on each other.

With this change, the 'strongswan' configuration is set up first,
followed by the 'swanctl' configuration.

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

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

index 59090490d788363e3803c38ef650c39212e8ca40..57def8809843621243e4ab3243bfc3e233e6fa2f 100644 (file)
@@ -652,10 +652,6 @@ config_remote() {
        swanctl_xappend0 ""
 }
 
-do_preamble() {
-       swanctl_xappend0 "# generated by /etc/init.d/swanctl"
-}
-
 config_ipsec() {
        local conf="$1"
 
@@ -714,15 +710,19 @@ do_postamble() {
 prepare_env() {
        mkdir -p /var/ipsec /var/swanctl
 
-       swan_reset
-       swanctl_reset
-       do_preamble
-
        # needed by do_postamble
        local debug install_routes routing_tables_ignored device_list
 
        config_load ipsec
+
+       # Generate /var/ipsec/strongswan.conf
+       swan_reset
        config_foreach config_ipsec ipsec
+       do_postamble
+
+       # Generate /var/swanctl/swanctl.conf
+       swanctl_reset
+       swanctl_xappend0 "# generated by /etc/init.d/swanctl"
        config_foreach config_remote remote
        
        swanctl_xappend0 "# Global config"
@@ -736,7 +736,6 @@ prepare_env() {
        config_foreach config_mschapv2_secret mschapv2_secrets
        swanctl_xappend0 "}"
 
-       do_postamble
 }
 
 reload_service() {
git clone https://git.99rst.org/PROJECT