From: "d12fk (Code Review)" Date: Wed, 13 Aug 2025 14:12:26 +0000 References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="MGztJrLqUI8="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: dns: fix systemd dns-updown script List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --MGztJrLqUI8= 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/+/1144?usp=3Demail to review the following change. Change subject: dns: fix systemd dns-updown script ...................................................................... dns: fix systemd dns-updown script In the resolvconf part of the script there was one instance of a dynamic variable using _* left. The _* ones do not work as the regular ones, but only when you directly place them within ${!}, not indirectly using a variable. Convert the code to use a loop and a check, like in all the other places in the script. Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446 Signed-off-by: Heiko Hund --- M distro/dns-scripts/systemd-dns-updown.sh 1 file changed, 5 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1144/1 diff --git a/distro/dns-scripts/systemd-dns-updown.sh b/distro/dns-scripts/= systemd-dns-updown.sh index 9006e28..ed3947a 100644 --- a/distro/dns-scripts/systemd-dns-updown.sh +++ b/distro/dns-scripts/systemd-dns-updown.sh @@ -189,11 +189,13 @@ domains+=3D"${!domain_var} " done { + local i=3D1 local maxns=3D3 - local server_var=3Ddns_server_${n}_address_* - for addr_var in ${!server_var}; do - [ $((maxns--)) -gt 0 ] || break + while [ "${i}" -le "${maxns}" ]; do + local addr_var=3Ddns_server_${n}_address_${i} + [ -n "${!addr_var}" ] || break echo "nameserver ${!addr_var}" + i=3D$((i+1)) done [ -z "$domains" ] || echo "search $domains" } | /sbin/resolvconf -a "$dev" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1144?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: Id800cad0e92e0abc0d96079fdb5a9d57578e1446 Gerrit-Change-Number: 1144 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 --MGztJrLqUI8= 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

dns: fix systemd dns-updown script

In the resolvconf = part of the script there was one instance of a dynamic
variable using _*= left. The _* ones do not work as the regular ones, but
only when you di= rectly place them within ${!}, not indirectly using a
variable.

C= onvert the code to use a loop and a check, like in all the other places
= in the script.

Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446<= br>Signed-off-by: Heiko Hund <heiko@...2662...>
---
M distro/dn= s-scripts/systemd-dns-updown.sh
1 file changed, 5 insertions(+), 3 delet= ions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chan=
ges/44/1144/1
diff --git a/distro/dns-scripts/systemd-dns-updown.sh=
 b/distro/dns-scripts/systemd-dns-updown.sh
index 9006e28..= ed3947a 100644
--- a/distro/dns-scripts/systemd-dns-updown.= sh
+++ b/distro/dns-scripts/systemd-dns-updown.sh@@ -189,11 +189,13 @@
domains+=3D"= ${!domain_var} "
done
= {
+ loca= l i=3D1
local maxns=3D3
- local server_var=3Ddns_server_$= {n}_address_*
- = for addr_var in ${!server_var}; do
- [ $((maxns--)) -gt 0 ] || break
= + while [ "${i}= " -le "${maxns}" ]; do
+ local addr_var=3Ddns_server_${n}_address_= ${i}
+ = [ -n "${!addr_var}" ] || break
= echo "nameserver ${!addr_var}"
+ i=3D$((i+1))
= done
[ -z "$domains" ] || echo &= quot;search $domains"
} | /sbin/resolvconf -a= "$dev"

To view, visit change 1144. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id800cad0e92e0abc0d96079fdb5= a9d57578e1446
Gerrit-Change-Number: 1144
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
--MGztJrLqUI8=--