openvpn: fix handling of list options
authorMatt Merhar <mattmerhar@protonmail.com>
Sat, 22 Jun 2019 07:05:14 +0000 (03:05 -0400)
committerPetr Štetiar <ynezz@true.cz>
Wed, 3 Jul 2019 05:45:00 +0000 (07:45 +0200)
This addresses an issue where the list option specified in
/etc/config/openvpn i.e. 'tls_cipher' would instead show up in the
generated openvpn-<name>.conf as 'ncp-ciphers'. For context,
'ncp_ciphers' appears after 'tls_cipher' in OPENVPN_LIST from
openvpn.options.

Also, the ordering of the options in the UCI config file is now
preserved when generating the OpenVPN config. The two currently
supported list options deal with cipher preferences.

Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
package/network/services/openvpn/Makefile
package/network/services/openvpn/files/openvpn.init

index f01b74d8aaf5779fd2d32f7188facfefdbae1cba..30c74789a445812db5e6b52b80083de879aa0ffa 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=openvpn
 
 PKG_VERSION:=2.4.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=\
        https://build.openvpn.net/downloads/releases/ \
index ebb05640d80f3249adc101687ed8b440aba61d52..a7d35d1a985ed609971ac2c6a8161e97cc4decb0 100644 (file)
@@ -53,13 +53,14 @@ append_list() {
        local p; local v; local s="$1"; shift
 
        list_cb_append() {
-               v="$1:${v}"
+               v="${v}:$1"
        }
 
        for p in $*; do
+               unset v
                config_list_foreach "$s" "$p" list_cb_append
+               [ -n "$v" ] && append_param "$s" "$p" && echo " ${v:1}" >> "/var/etc/openvpn-$s.conf"
        done
-       [ -n "$v" ] && append_param "$s" "$p" && echo " ${v%*:}" >> "/var/etc/openvpn-$s.conf"
 }
 
 section_enabled() {