From: Florian Eckert Date: Thu, 5 Mar 2026 12:31:17 +0000 (+0100) Subject: openvpn: use append for the remaining options X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=337a449c03c597b49f2e18a7fd241d8945288e80;p=openwrt-packages.git openvpn: use append for the remaining options 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 --- diff --git a/net/openvpn/files/lib/netifd/proto/openvpn.sh b/net/openvpn/files/lib/netifd/proto/openvpn.sh index d55ea97f3..c065465c6 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. }