Skip to contentSkip to conversation

Change in openvpn[master]: dns: fix systemd dns-updown script

Openvpn-devel In review d12fk (Code Review) 3 participants 6 messages Aug 13, 2025 – Aug 19, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1755094344000.Id800cad0e92e0abc0d96079fdb5a9d57578e1446@...2715...

#1 lore raw

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=email

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

---
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

distro/dns-scripts/systemd-dns-updown.sh +5 -3
index 9006e28..ed3947a 100644
@@ -189,11 +189,13 @@
             domains+="${!domain_var} "
         done
         {
+            local i=1
             local maxns=3
-            local server_var=dns_server_${n}_address_*
-            for addr_var in ${!server_var}; do
-                [ $((maxns--)) -gt 0 ] || break
+            while [ "${i}" -le "${maxns}" ]; do
+                local addr_var=dns_server_${n}_address_${i}
+                [ -n "${!addr_var}" ] || break
                 echo "nameserver ${!addr_var}"
+                i=$((i+1))
             done
             [ -z "$domains" ] || echo "search $domains"
         } | /sbin/resolvconf -a "$dev"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446
Gerrit-Change-Number: 1144
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email )

Change subject: dns: fix systemd dns-updown script
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
Ran t_client tests on a resolvconf system with and without this change. Can confirm it resolves the issue.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446
Gerrit-Change-Number: 1144
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Mon, 18 Aug 2025 16:43:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 dns: fix systemd dns-updown script

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

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

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1144
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

distro/dns-scripts/systemd-dns-updown.sh +5 -3
index 9006e28..ed3947a 100644
@@ -189,11 +189,13 @@
             domains+="${!domain_var} "
         done
         {
+            local i=1
             local maxns=3
-            local server_var=dns_server_${n}_address_*
-            for addr_var in ${!server_var}; do
-                [ $((maxns--)) -gt 0 ] || break
+            while [ "${i}" -le "${maxns}" ]; do
+                local addr_var=dns_server_${n}_address_${i}
+                [ -n "${!addr_var}" ] || break
                 echo "nameserver ${!addr_var}"
+                i=$((i+1))
             done
             [ -z "$domains" ] || echo "search $domains"
         } | /sbin/resolvconf -a "$dev"
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: dns: fix systemd dns-updown script

In addition to the ACK from Frank I tested this on a "Debian Unstable" system, after "apt install resolvconf" gave me a resolvconf binary (and kicked out systemd-resolvconf). Does not work without the patch, with the error message reported by Ralf Hildebrandt on -users, works with the patch.

Your patch has been applied to the master branch.

commit 72a0e6f94f16a6dcfe2b445758d42dedaba11b92

Author: Heiko Hund
Date:   Mon Aug 18 18:46:08 2025 +0200
     dns: fix systemd dns-updown script

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32621.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32621.html

---
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/2

distro/dns-scripts/systemd-dns-updown.sh +5 -3
index 9006e28..ed3947a 100644
@@ -189,11 +189,13 @@
             domains+="${!domain_var} "
         done
         {
+            local i=1
             local maxns=3
-            local server_var=dns_server_${n}_address_*
-            for addr_var in ${!server_var}; do
-                [ $((maxns--)) -gt 0 ] || break
+            while [ "${i}" -le "${maxns}" ]; do
+                local addr_var=dns_server_${n}_address_${i}
+                [ -n "${!addr_var}" ] || break
                 echo "nameserver ${!addr_var}"
+                i=$((i+1))
             done
             [ -z "$domains" ] || echo "search $domains"
         } | /sbin/resolvconf -a "$dev"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446
Gerrit-Change-Number: 1144
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email )

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32621.html

---
M distro/dns-scripts/systemd-dns-updown.sh

1 file changed, 5 insertions(+), 3 deletions(-)
distro/dns-scripts/systemd-dns-updown.sh +5 -3
index 9006e28..ed3947a 100644
@@ -189,11 +189,13 @@
             domains+="${!domain_var} "
         done
         {
+            local i=1
             local maxns=3
-            local server_var=dns_server_${n}_address_*
-            for addr_var in ${!server_var}; do
-                [ $((maxns--)) -gt 0 ] || break
+            while [ "${i}" -le "${maxns}" ]; do
+                local addr_var=dns_server_${n}_address_${i}
+                [ -n "${!addr_var}" ] || break
                 echo "nameserver ${!addr_var}"
+                i=$((i+1))
             done
             [ -z "$domains" ] || echo "search $domains"
         } | /sbin/resolvconf -a "$dev"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1144?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id800cad0e92e0abc0d96079fdb5a9d57578e1446
Gerrit-Change-Number: 1144
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged