Skip to content

Commit dabdf57

Browse files
committed
resolv: Fix processing more DNSSL options than RDNSS
1 parent 79c195b commit dabdf57

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

hooks/20-resolv.conf

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,30 @@ eval_nd_dns()
8181
{
8282

8383
eval rdnsstime=\$nd${i}_rdnss${j}_lifetime
84-
[ -z "$rdnsstime" ] && return 1
85-
ltime=$(($rdnsstime - $offset))
86-
if [ "$ltime" -gt 0 ]; then
87-
eval rdnss=\$nd${i}_rdnss${j}_servers
88-
[ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
84+
if [ -n "$rdnsstime" ]; then
85+
ltime=$(($rdnsstime - $offset))
86+
if [ "$ltime" -gt 0 ]; then
87+
eval rdnss=\$nd${i}_rdnss${j}_servers
88+
if [ -n "$rdnss" ]; then
89+
new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
90+
fi
91+
fi
8992
fi
9093

9194
eval dnssltime=\$nd${i}_dnssl${j}_lifetime
92-
[ -z "$dnssltime" ] && return 1
93-
ltime=$(($dnssltime - $offset))
94-
if [ "$ltime" -gt 0 ]; then
95-
eval dnssl=\$nd${i}_dnssl${j}_search
96-
[ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
95+
if [ -n "$dnssltime" ]; then
96+
ltime=$(($dnssltime - $offset))
97+
if [ "$ltime" -gt 0 ]; then
98+
eval dnssl=\$nd${i}_dnssl${j}_search
99+
if [ -n "$dnssl" ]; then
100+
new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
101+
fi
102+
fi
97103
fi
98104

105+
# Break when we don't have either
106+
[ -z "$rdnsstime" ] && [ -z "$dnssltime" ] && return 1
107+
99108
j=$(($j + 1))
100109
return 0
101110
}

0 commit comments

Comments
 (0)