From 337a449c03c597b49f2e18a7fd241d8945288e80 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 5 Mar 2026 13:31:17 +0100 Subject: [PATCH] openvpn: use append for the remaining options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- net/openvpn/files/lib/netifd/proto/openvpn.sh | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/net/openvpn/files/lib/netifd/proto/openvpn.sh b/net/openvpn/files/lib/netifd/proto/openvpn.sh index d55ea97f3a..c065465c69 100755 --- a/net/openvpn/files/lib/netifd/proto/openvpn.sh +++ b/net/openvpn/files/lib/netifd/proto/openvpn.sh @@ -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. }