From: "cron2 (Code Review)" Date: Tue, 15 Jul 2025 14:10:08 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <6d4379c8a29df93cc939222cbd8cb3e532f778b0-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="hwi8ZInljUM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: mac dns: do not run dns-updown in parallel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: d12fk , plaisthos , flichtenheld Cc: openvpn-devel --hwi8ZInljUM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#5) to the change originally created by= d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1076?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by plaisthos Change subject: mac dns: do not run dns-updown in parallel ...................................................................... mac dns: do not run dns-updown in parallel In case more than one openvpn connection is coming up or going down at the same time, there is potential for breakage, since the operations performed are not atomic. Introduce a locking mechanism, which let's scripts run in sequence, to prevent races between them. Change-Id: I7adfaa08df6a17545cca8264d7230b5e65e49719 Signed-off-by: Heiko Hund Acked-by: Arne Schwabe Message-Id: <20250711100700.241668-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 108.html Signed-off-by: Gert Doering --- M distro/dns-scripts/macos-dns-updown.sh 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/1076/5 diff --git a/distro/dns-scripts/macos-dns-updown.sh b/distro/dns-scripts/ma= cos-dns-updown.sh index 73bbee9..fb17b2b0 100644 --- a/distro/dns-scripts/macos-dns-updown.sh +++ b/distro/dns-scripts/macos-dns-updown.sh @@ -26,6 +26,23 @@ # dns_server_1_sni dns.mycorp.in # +lockdir=3D/var/lock +if [ ! -d "${lockdir}" ]; then + /bin/mkdir "${lockdir}" + /bin/chmod 1777 "${lockdir}" +fi + +i=3D1 +lockfile=3D"${lockdir}/openvpn-dns-updown.lock" +while ! /usr/bin/shlock -f $lockfile -p $$; do + if [ $((++i)) -gt 10 ]; then + echo "dns-updown failed, could not acquire lock" + exit 1 + fi + sleep 0.2 +done +trap "/bin/rm -f ${lockfile}" EXIT + [ -z "${dns_vars_file}" ] || . "${dns_vars_file}" itf_dns_key=3D"State:/Network/Service/openvpn-${dev}/DNS" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1076?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I7adfaa08df6a17545cca8264d7230b5e65e49719 Gerrit-Change-Number: 1076 Gerrit-PatchSet: 5 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --hwi8ZInljUM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #5 to the change originally cr= eated by d12fk.

View Change

The following approvals got outdated an= d were removed: Code-Review+2 by plaisthos

mac dns: do not run dns-updown in parallel
In case more than one openvpn connection is coming up or going down atthe same time, there is potential for breakage, since the operations
pe= rformed are not atomic.

Introduce a locking mechanism, which let'= ;s scripts run in sequence, to
prevent races between them.

Change= -Id: I7adfaa08df6a17545cca8264d7230b5e65e49719
Signed-off-by: Heiko Hund= <heiko@...2662...>
Acked-by: Arne Schwabe <arne-openvpn@...2068...= 7...>
Message-Id: <20250711100700.241668-1-frank@...2641...>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg3= 2108.html
Signed-off-by: Gert Doering <gert@...1296...>
---
= M distro/dns-scripts/macos-dns-updown.sh
1 file changed, 17 insertions(+= ), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn=
 refs/changes/76/1076/5
diff --git a/distro/dns-scripts/macos-dns-u=
pdown.sh b/distro/dns-scripts/macos-dns-updown.sh
index 73b= bee9..fb17b2b0 100644
--- a/distro/dns-scripts/macos-dns-up= down.sh
+++ b/distro/dns-scripts/macos-dns-updown.sh=
@@ -26,6 +26,23 @@
# dns_server_1_sni dns.myco= rp.in
#

+lockdir=3D/var/lock
+if [ ! -d "${lockdir}" ]; then
<= span style=3D"color: hsl(120, 100%, 40%);">+ /bin/mkdir "${lockdir}= "
+ /bin/chmo= d 1777 "${lockdir}"
+fi
+=
+i=3D1
+lockfile=3D"${lockdir}/openvpn-dns-= updown.lock"
+wh= ile ! /usr/bin/shlock -f $lockfile -p $$; do
+ if [ $((++i)) -gt 10 ]; then
+ echo "dns-updown failed,= could not acquire lock"
+ exit 1
+ fi
+ slee= p 0.2
+done+trap "/bin/rm -f ${lockf= ile}" EXIT
+
[ -z "${dns_vars_file}" ] || . "${dns_vars_fil= e}"

itf_dns_key=3D"State:/Netw= ork/Service/openvpn-${dev}/DNS"

To= view, visit change 1076. To unsubscribe, or for help writing mail filters, vis= it settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7adfaa08df6a17545cca8264d72= 30b5e65e49719
Gerrit-Change-Number: 1076
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--hwi8ZInljUM=--