openvpn: use also append for dev_type and ovpnproto options
authorFlorian Eckert <redacted>
Thu, 5 Mar 2026 12:28:11 +0000 (13:28 +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 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 <redacted>
net/openvpn/files/lib/netifd/proto/openvpn.sh

index 6025a38739e92d643c232fe57455f6573d4dde0c..d55ea97f3a25d64391d306e4fd6393f3e612b389 100755 (executable)
@@ -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" \
git clone https://git.99rst.org/PROJECT