From: Florian Eckert Date: Thu, 5 Mar 2026 12:28:11 +0000 (+0100) Subject: openvpn: use also append for dev_type and ovpnproto options X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=be20045045fe60f03a4eaffa8b02f46ae4e259a3;p=openwrt-packages.git openvpn: use also append for dev_type and ovpnproto options 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 --- diff --git a/net/openvpn/files/lib/netifd/proto/openvpn.sh b/net/openvpn/files/lib/netifd/proto/openvpn.sh index 6025a3873..d55ea97f3 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" \