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>
swanctl_xappend0 ""
}
-do_preamble() {
- swanctl_xappend0 "# generated by /etc/init.d/swanctl"
-}
-
config_ipsec() {
local conf="$1"
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"
config_foreach config_mschapv2_secret mschapv2_secrets
swanctl_xappend0 "}"
- do_postamble
}
reload_service() {