From: "d12fk (Code Review)" Date: Thu, 3 Jul 2025 03:56:32 +0000 References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <1e751e26de29953125e6029499f8ebdf3d986cc6-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="QylsivAmPnY="; 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: plaisthos , flichtenheld Cc: openvpn-devel --QylsivAmPnY= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1076?usp=3Demail to review the following change. 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 --- M distro/dns-scripts/macos-dns-updown.sh 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/1076/1 diff --git a/distro/dns-scripts/macos-dns-updown.sh b/distro/dns-scripts/ma= cos-dns-updown.sh index 282b034..536235e 100644 --- a/distro/dns-scripts/macos-dns-updown.sh +++ b/distro/dns-scripts/macos-dns-updown.sh @@ -26,6 +26,17 @@ # dns_server_1_sni dns.mycorp.in # +i=3D1 +lockfile=3D/tmp/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: 1 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --QylsivAmPnY= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

d12fk would like plaisthos and flichtenheld to review t= his change.

V= iew Change

mac dns: do not run dns-updown in parallel

In case mo= re than one openvpn connection is coming up or going down at
the same ti= me, there is potential for breakage, since the operations
performed are = not atomic.

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

Change-Id: I7adfaa= 08df6a17545cca8264d7230b5e65e49719
Signed-off-by: Heiko Hund <heiko@...220...= ..2662...>
---
M distro/dns-scripts/macos-dns-updown.sh
1 file = changed, 11 insertions(+), 0 deletions(-)

git pull ssh://gerrit.o=
penvpn.net:29418/openvpn refs/changes/76/1076/1
diff --git a/distro=
/dns-scripts/macos-dns-updown.sh b/distro/dns-scripts/macos-dns-updown.sh
index 282b034..536235e 100644
--- a/distro/d= ns-scripts/macos-dns-updown.sh
+++ b/distro/dns-scripts/mac= os-dns-updown.sh
@@ -26,6 +26,17 @@
# dn= s_server_1_sni dns.mycorp.in
#
+i=3D1
+lockfile=3D/tmp/openvpn-dns-updown.lock
+while ! /usr/bin/shlo= ck -f $lockfile -p $$; do
+ if [ $((++i)) -gt 10 ]; then
+ echo "dns-updown failed, could not acquire = lock"
+ e= xit 1
+ fi<= br>+ 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 change 1076. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7adfaa08df6a17545cca8264d72= 30b5e65e49719
Gerrit-Change-Number: 1076
Gerrit-PatchSet: 1
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-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--QylsivAmPnY=--