From be20045045fe60f03a4eaffa8b02f46ae4e259a3 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 5 Mar 2026 13:28:11 +0100 Subject: [PATCH] openvpn: use also append for dev_type and ovpnproto 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 use that. 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/openvpn/files/lib/netifd/proto/openvpn.sh b/net/openvpn/files/lib/netifd/proto/openvpn.sh index 6025a38739..d55ea97f3a 100755 --- a/net/openvpn/files/lib/netifd/proto/openvpn.sh +++ b/net/openvpn/files/lib/netifd/proto/openvpn.sh @@ -101,6 +101,11 @@ proto_openvpn_setup() { exec_params= + json_get_var dev_type dev_type + [ -z "$dev_type" ] && append exec_params " --dev-type tun" + json_get_var ovpnproto ovpnproto + [ -n "$ovpnproto" ] && append exec_params " --proto $ovpnproto" + # alllow deprecated OpenVPN configuration values by default json_get_var ALLOW_DEPRECATED allow_deprecated [ -z "$ALLOW_DEPRECATED" ] && ALLOW_DEPRECATED=0 @@ -150,12 +155,8 @@ proto_openvpn_setup() { # Testing option # ${tls_exit:+--tls-exit} \ - json_get_var dev_type dev_type - json_get_var ovpnproto ovpnproto # shellcheck disable=SC2086 proto_run_command "$config" openvpn \ - $([ -z "$dev_type" ] && echo " --dev-type tun") \ - $([ -z "$ovpnproto" ] && echo " --proto $ovpnproto") \ --cd "$cd_dir" \ --status "/var/run/openvpn.$config.status" \ --syslog "openvpn_$config" \