The cross-file handling of variables that are populated in 'config_ipsec' but
then written to 'strongswan.conf' in the 'do postamble' section is prone
to errors, as variables are often overlooked. The config file
'strongswan.conf' is now generated in a single function without the need to
use global variables.
This commit does not change the function and is a preparatory commit.
Signed-off-by: Florian Eckert <redacted>
config_ipsec() {
local conf="$1"
+ local debug install_routes routing_tables_ignored device_list
+
local rtinstall_enabled
local routing_table
local routing_table_id
done
[ -n "$device_list" ] && WAIT_FOR_INTF=0 || WAIT_FOR_INTF=1
fi
-}
-do_postamble() {
- swan_xappend0 "# generated by /etc/init.d/swanctl"
swan_xappend0 "charon {"
swan_xappend1 "install_routes = $install_routes"
[ -n "$routing_tables_ignored" ] && swan_xappend1 "ignore_routing_tables = $routing_tables_ignored"
prepare_env() {
mkdir -p /var/ipsec /var/swanctl
- # needed by do_postamble
- local debug install_routes routing_tables_ignored device_list
-
config_load ipsec
# Generate /var/ipsec/strongswan.conf
swan_reset
+ swan_xappend0 "# generated by /etc/init.d/swanctl"
config_foreach config_ipsec ipsec
- do_postamble
# Generate /var/swanctl/swanctl.conf
swanctl_reset