summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-06-14 13:53:51 +0100
committerRoy Marples <roy@marples.name>2019-06-14 13:53:51 +0100
commitb743f1401fe7420e6a8a9b8866d64a237c257127 (patch)
tree6690e2821fb28b6731cd85ef9e97e87866a6f9ce /hooks
parent271775fb2370dc9eb8774f90abbba7cb30c5efbf (diff)
downloaddhcpcd-b743f1401fe7420e6a8a9b8866d64a237c257127.tar.xz
RA: expire RDNSS and DNSSL entries
This allows us to remember N fully expired RA's which works around an obscure issue where a received RA has no lifetime or any prefixes with lifetimes but does have an instruction to start DHCP6. It was harmless but filled the log with spam and now there is no log spam!
Diffstat (limited to 'hooks')
-rw-r--r--hooks/20-resolv.conf36
1 files changed, 18 insertions, 18 deletions
diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf
index 61c75e82..cf323749 100644
--- a/hooks/20-resolv.conf
+++ b/hooks/20-resolv.conf
@@ -69,30 +69,26 @@ build_resolv_conf()
}
# Extract any ND DNS options from the RA
-# For now, we ignore the lifetime of the DNS options unless they
-# are absent or zero.
-# In this case they are removed from consideration.
-# See draft-gont-6man-slaac-dns-config-issues-01 for issues
-# regarding DNS option lifetime in ND messages.
+# Obey the lifetimes
eval_nd_dns()
{
- eval ltime=\$nd${i}_rdnss${j}_lifetime
- if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
- rdnss=
- else
+
+ eval rdnsstime=\$nd${i}_rdnss${j}_lifetime
+ [ -z "$rdnsstime" ] && return 1
+ ltime=$(($rdnsstime - $offset))
+ if [ "$ltime" -gt 0 ]; then
eval rdnss=\$nd${i}_rdnss${j}_servers
+ [ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
fi
- eval ltime=\$nd${i}_dnssl${j}_lifetime
- if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then
- dnssl=
- else
+
+ eval dnssltime=\$nd${i}_dnssl${j}_lifetime
+ [ -z "$dnssltime" ] && return 1
+ ltime=$(($dnssltime - $offset))
+ if [ "$ltime" -gt 0 ]; then
eval dnssl=\$nd${i}_dnssl${j}_search
+ [ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
fi
- [ -z "${rdnss}${dnssl}" ] && return 1
-
- [ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss"
- [ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl"
j=$(($j + 1))
return 0
}
@@ -106,12 +102,16 @@ add_resolv_conf()
i=1
j=1
while true; do
+ eval acquired=\$nd${i}_acquired
+ [ -z "$acquired" ] && break
+ eval now=\$nd${i}_now
+ [ -z "$now" ] && break
+ offset=$(($now - $acquired))
while true; do
eval_nd_dns || break
done
i=$(($i + 1))
j=1
- eval_nd_dns || break
done
[ -n "$new_rdnss" ] && \
new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss"