Support for custom fastd config files in /etc/fastd/

Enabled all options for fastd to support any config file
This commit is contained in:
bioxz 2014-04-05 05:23:26 +02:00
parent 2ced9d31f7
commit 2dc73f260c
2 changed files with 12 additions and 5 deletions

View File

@ -62,21 +62,21 @@ config FASTD_ENABLE_MAC_GHASH
config FASTD_WITH_CMDLINE_USER
bool "Include support for setting user/group related options on the command line"
depends on PACKAGE_fastd
default n
default y
config FASTD_WITH_CMDLINE_LOGGING
bool "Include support for setting logging related options on the command line"
depends on PACKAGE_fastd
default n
default y
config FASTD_WITH_CMDLINE_OPERATION
bool "Include support for setting options related to the VPN operation (like mode, interface, encryption method) on the command line"
depends on PACKAGE_fastd
default n
default y
config FASTD_WITH_CMDLINE_COMMANDS
bool "Include support for setting handler scripts (e.g. --on-up) on the command line"
depends on PACKAGE_fastd
default n
default y
endmenu

View File

@ -110,6 +110,13 @@ append_options() {
done
}
append_custom_configs() {
local fastd_configs=/etc/fastd/
for f in $(ls $fastd_configs)
do
eval echo 'include \"$fastd_configs$f\"\;'
done
}
generate_config_secret() {
echo "secret $(escape_string "$1");"
@ -305,7 +312,7 @@ start_instance() {
chown "$user" "$SERVICE_PID_FILE"
fi
(generate_config_secret "$secret"; generate_config "$s") | service_start "$FASTD_COMMAND" --config - --daemon --pid-file "$SERVICE_PID_FILE"
(generate_config_secret "$secret"; generate_config "$s"; append_custom_configs) | service_start "$FASTD_COMMAND" --config - --daemon --pid-file "$SERVICE_PID_FILE"
if ! ifconfig "$interface" >/dev/null 2>&1; then
error "$s: startup failed"