mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
unbound: improve robustness with dhcp scripts
When for example 'package/net/adblock' and DNSSEC vs NTP robustness is enabled, significant restart thrashing can occur at boot up. DHCP lease triggers may be occuring at the same time. Unbounds DNS-DHCP may be incomplete until new DHCP solicit events. Solve this by leaving a passive but complete host conf file during lease trigger. Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
This commit is contained in:
+16
-10
@@ -45,42 +45,48 @@ odhcpd_zonedata() {
|
||||
local dhcp_ls_add=$UNBOUND_VARDIR/dhcp_lease.add
|
||||
local dhcp_ls_del=$UNBOUND_VARDIR/dhcp_lease.del
|
||||
local dhcp_origin=$( uci get dhcp.@odhcpd[0].leasefile )
|
||||
|
||||
|
||||
config_load unbound
|
||||
config_foreach odhcpd_settings unbound
|
||||
|
||||
|
||||
if [ "$UNBOUND_D_DHCP_LINK" = "odhcpd" -a -f "$dhcp_origin" ] ; then
|
||||
# Capture the lease file which could be changing often,
|
||||
# and unbound-control only for changes in hosts (or else...)
|
||||
# Capture the lease file which could be changing often
|
||||
cat $dhcp_origin | sort > $dhcp_ls_new
|
||||
touch $dhcp_ls_old
|
||||
sort $dhcp_ls_new $dhcp_ls_old $dhcp_ls_old | uniq -u > $dhcp_ls_add
|
||||
sort $dhcp_ls_old $dhcp_ls_new $dhcp_ls_new | uniq -u > $dhcp_ls_del
|
||||
|
||||
# Go through the messy business of coding up A, AAAA, and PTR records.
|
||||
# Go through the messy business of coding up A, AAAA, and PTR records
|
||||
# This static conf will be available if Unbound restarts asynchronously
|
||||
awk -v hostfile=$UNBOUND_DHCP_CONF -v domain=$UNBOUND_TXT_DOMAIN \
|
||||
-v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=1 \
|
||||
-f /usr/lib/unbound/odhcpd.awk $dhcp_ls_new
|
||||
|
||||
# Deleting and adding all records into Unbound can be a burden in a
|
||||
# high density environment. Use unbound-control incrementally.
|
||||
awk -v hostfile=$dns_ls_del -v domain=$UNBOUND_TXT_DOMAIN \
|
||||
-v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 \
|
||||
-v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=0 \
|
||||
-f /usr/lib/unbound/odhcpd.awk $dhcp_ls_del
|
||||
|
||||
awk -v hostfile=$dns_ls_add -v domain=$UNBOUND_TXT_DOMAIN \
|
||||
-v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 \
|
||||
-v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=0 \
|
||||
-f /usr/lib/unbound/odhcpd.awk $dhcp_ls_add
|
||||
|
||||
|
||||
if [ -f "$dns_ls_del" ] ; then
|
||||
cat $dns_ls_del | $UNBOUND_CONTROL_CFG local_datas_remove
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ -f "$dns_ls_add" ] ; then
|
||||
cat $dns_ls_add | $UNBOUND_CONTROL_CFG local_datas
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# prepare next round
|
||||
mv $dhcp_ls_new $dhcp_ls_old
|
||||
rm -f $dns_ls_del $dns_ls_add
|
||||
rm -f $dns_ls_del $dns_ls_add $dhcp_ls_del $dhcp_ls_add
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user