From 5cfcdc8c823976b386bb00ec8066d7d1d9cd1a30 Mon Sep 17 00:00:00 2001 From: HiGarfield <32226909+HiGarfield@users.noreply.github.com> Date: Tue, 14 Jul 2020 20:00:10 +0800 Subject: [PATCH] openvpn: fix uci-defaults script (#5103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复防火墙端口号。用户如果设置自定义端口,例如1197,则升级固件时,需要uci查询用户设定的自定义端口号,然后打开防火墙端口。 --- .../luci-app-openvpn-server/root/etc/uci-defaults/openvpn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn b/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn index 115d258828..a41bbad56c 100755 --- a/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn +++ b/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn @@ -1,5 +1,8 @@ #!/bin/sh +openvpn_port="$(uci -q get openvpn.myvpn.port)" +[ -z "$openvpn_port" ] && openvpn_port=1194 + uci -q batch <<-EOF >/dev/null delete network.vpn0 set network.vpn0=interface @@ -14,7 +17,7 @@ uci -q batch <<-EOF >/dev/null set firewall.openvpn.target='ACCEPT' set firewall.openvpn.src='wan' set firewall.openvpn.proto='tcp udp' - set firewall.openvpn.dest_port='1194' + set firewall.openvpn.dest_port="$openvpn_port" delete firewall.vpn set firewall.vpn=zone