strongswan: Fix pools to be only generated once
authorMartin Pecka <peci1@seznam.cz>
Sun, 7 Jan 2024 22:23:57 +0000 (23:23 +0100)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Tue, 19 Nov 2024 16:05:33 +0000 (08:05 -0800)
Before this commit, if a user configures multiple remotes in UCI,
each remote generates one output section of pools.
This doesn't hurt because swanctl just merges all of them,
but it is apparently not needed to have N copies of the same.

This commit changes the behavior to only create one pools
section at the end of the generated swanctl config.

Signed-off-by: Martin Pecka <peci1@seznam.cz>
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
net/strongswan/files/swanctl.init

index b081f776f0771b33ed29d7f7ab8f62b0395ed1e4..8a7e9a3ec5b62cdb78c4cf17e60fe1dc0d4d2c54 100644 (file)
@@ -610,10 +610,6 @@ config_remote() {
                fatal "AuthenticationMode $auth_mode not supported"
        fi
 
-       swanctl_xappend0 "pools {"
-       config_list_foreach "$conf" pools config_pool
-       swanctl_xappend0 "}"
-
        swanctl_xappend0 ""
 }
 
@@ -689,6 +685,10 @@ prepare_env() {
        config_load ipsec
        config_foreach config_ipsec ipsec
        config_foreach config_remote remote
+       
+       swanctl_xappend0 "pools {"
+       config_foreach config_pool pools
+       swanctl_xappend0 "}"
 
        do_postamble
 }