Skip to content

Commit 72a0e6f

Browse files
d12fkcron2
authored andcommitted
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 <[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]>
1 parent acc8f82 commit 72a0e6f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,13 @@ function do_resolvconf {
189189
domains+="${!domain_var} "
190190
done
191191
{
192+
local i=1
192193
local maxns=3
193-
local server_var=dns_server_${n}_address_*
194-
for addr_var in ${!server_var}; do
195-
[ $((maxns--)) -gt 0 ] || break
194+
while [ "${i}" -le "${maxns}" ]; do
195+
local addr_var=dns_server_${n}_address_${i}
196+
[ -n "${!addr_var}" ] || break
196197
echo "nameserver ${!addr_var}"
198+
i=$((i+1))
197199
done
198200
[ -z "$domains" ] || echo "search $domains"
199201
} | /sbin/resolvconf -a "$dev"

0 commit comments

Comments
 (0)