openvpn: fix ipchange hotplug event

In f8a8b71e26 openvpn introduced new hotplug events.
For server config, ipchange hotplug event produces an error.
So, make ipchange hotplug event for client only

Fixes https://github.com/openwrt/packages/issues/21200

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
This commit is contained in:
Ivan Pavlov 2023-06-07 20:58:42 +03:00 committed by Rosen Penev
parent 1813bf2c6e
commit 808f67d615
2 changed files with 4 additions and 3 deletions

View file

@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openvpn PKG_NAME:=openvpn
PKG_VERSION:=2.5.8 PKG_VERSION:=2.5.8
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE_URL:=\ PKG_SOURCE_URL:=\
https://build.openvpn.net/downloads/releases/ \ https://build.openvpn.net/downloads/releases/ \

View file

@ -140,10 +140,11 @@ openvpn_get_credentials() {
openvpn_add_instance() { openvpn_add_instance() {
local name="$1" local name="$1"
local dir="$2" local dir="$2"
local conf="$3" local conf=$(basename "$3")
local security="$4" local security="$4"
local up="$5" local up="$5"
local down="$6" local down="$6"
local client=$(grep -qEx "client|tls-client" "$dir/$conf" && echo 1)
procd_open_instance "$name" procd_open_instance "$name"
procd_set_param command "$PROG" \ procd_set_param command "$PROG" \
@ -155,7 +156,7 @@ openvpn_add_instance() {
--down "/usr/libexec/openvpn-hotplug down $name" \ --down "/usr/libexec/openvpn-hotplug down $name" \
--route-up "/usr/libexec/openvpn-hotplug route-up $name" \ --route-up "/usr/libexec/openvpn-hotplug route-up $name" \
--route-pre-down "/usr/libexec/openvpn-hotplug route-pre-down $name" \ --route-pre-down "/usr/libexec/openvpn-hotplug route-pre-down $name" \
--ipchange "/usr/libexec/openvpn-hotplug ipchange $name" \ ${client:+--ipchange "/usr/libexec/openvpn-hotplug ipchange $name"} \
${up:+--setenv user_up "$up"} \ ${up:+--setenv user_up "$up"} \
${down:+--setenv user_down "$down"} \ ${down:+--setenv user_down "$down"} \
--script-security "${security:-2}" \ --script-security "${security:-2}" \