From: "cron2 (Code Review)" Date: Tue, 19 Aug 2025 10:52:00 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., 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="BNCvLY32xao="; 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: d12fk Cc: flichtenheld , plaisthos , openvpn-devel --BNCvLY32xao= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/11= 44?usp=3Demail ) 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 Acked-by: Frank Lichtenheld Message-Id: <20250818164608.39836-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 621.html Signed-off-by: Gert Doering --- M distro/dns-scripts/systemd-dns-updown.sh 1 file changed, 5 insertions(+), 3 deletions(-) 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: 2 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --BNCvLY32xao= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

dns: fix systemd dns-updown script

In = the resolvconf part of the script there was one instance of a dynamic
va= riable using _* left. The _* ones do not work as the regular ones, but
o= nly when you directly place them within ${!}, not indirectly using a
var= iable.

Convert the code to use a loop and a check, like in all the o= ther places
in the script.

Change-Id: Id800cad0e92e0abc0d96079fdb= 5a9d57578e1446
Signed-off-by: Heiko Hund <heiko@...2662...>
Ack= ed-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <202508= 18164608.39836-1-frank@...2641...>
URL: https://www.mail-archive.com/= openvpn-devel@lists.sourceforge.net/msg32621.html
Signed-off-by: Gert Do= ering <gert@...1296...>
---
M distro/dns-scripts/systemd-dns-up= down.sh
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/distro/dns-scripts/systemd-dns-updown.sh b/distro/dns-scrip=
ts/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} &quo= t;
done
{
+ local i=3D1

<= span> local maxns=3D3
- local server_var=3Ddns_server_${n}_address_*=
- for addr_var in = ${!server_var}; do
- = [ $((maxns--)) -gt 0 ] || break
+ while [ "${i}" -le "${m= axns}" ]; do
+ = local addr_var=3Ddns_server_${n}_address_${i}
+ [ -n "${!addr_= var}" ] || break
echo "nameserve= r ${!addr_var}"
= + i=3D$((i+1))
done
<= span> [ -z "$domains" ] || echo "search $domains= "
} | /sbin/resolvconf -a "$dev"

To view, visit change 1144. To unsubscribe, o= r for help writing mail filters, visit settings.

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