openvpn: use append for the remaining options
authorFlorian Eckert <redacted>
Thu, 5 Mar 2026 12:31:17 +0000 (13:31 +0100)
committerFlorian Eckert <redacted>
Wed, 11 Mar 2026 13:22:41 +0000 (14:22 +0100)
There is already the 'append' command, which assembles all parameters that
are called 'proto_run_command'. Let´s move also the last params to the
top. To ensure that the sequence is correct, the parameters must be added
at the beginning, so that user parameters can overwrite them.

Signed-off-by: Florian Eckert <redacted>
net/openvpn/files/lib/netifd/proto/openvpn.sh

index d55ea97f3a25d64391d306e4fd6393f3e612b389..c065465c693170714fcfdc2602fb102ad49ba795 100755 (executable)
@@ -97,7 +97,7 @@ proto_openvpn_init_config() {
 
 proto_openvpn_setup() {
        local config="$1"
-       local exec_params
+       local exec_params cd_dir
 
        exec_params=
 
@@ -106,6 +106,14 @@ proto_openvpn_setup() {
        json_get_var ovpnproto ovpnproto
        [ -n "$ovpnproto" ] && append exec_params " --proto $ovpnproto"
 
+       # shellcheck disable=SC2154
+       cd_dir="${config_file%/*}"
+       [ "$cd_dir" = "$config_file" ] && cd_dir="/"
+       append exec_params " --cd $cd_dir"
+       append exec_params " --status /var/run/openvpn.$config.status"
+       append exec_params " --syslog openvpn_$config"
+       append exec_params " --tmp-dir /var/run"
+
        # alllow deprecated OpenVPN configuration values by default
        json_get_var ALLOW_DEPRECATED allow_deprecated
        [ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0
@@ -148,20 +156,11 @@ proto_openvpn_setup() {
                append exec_params " --auth-user-pass $auth_user_pass"
        fi
 
-       # shellcheck disable=SC2154
-       cd_dir="${config_file%/*}"
-       [ "$cd_dir" = "$config_file" ] && cd_dir="/"
-
        # Testing option
        # ${tls_exit:+--tls-exit} \
 
        # shellcheck disable=SC2086
-       proto_run_command "$config" openvpn \
-               --cd "$cd_dir" \
-               --status "/var/run/openvpn.$config.status" \
-               --syslog "openvpn_$config" \
-               --tmp-dir "/var/run" \
-               $exec_params
+       proto_run_command "$config" openvpn $exec_params
 
        # last param wins; user provided status or syslog supersedes these.
 }
git clone https://git.99rst.org/PROJECT