Browse Source

Merge pull request #4197 from EricLuehrsen/unbound_init

unbound: improve interface trigger behavior
lilik-openwrt-22.03
Hannu Nyman 8 years ago
committed by GitHub
parent
commit
2f202c3505
5 changed files with 53 additions and 13 deletions
  1. +1
    -1
      net/unbound/Makefile
  2. +20
    -1
      net/unbound/files/odhcpd.awk
  3. +18
    -4
      net/unbound/files/unbound.init
  4. +1
    -0
      net/unbound/files/unbound.ntpd
  5. +13
    -7
      net/unbound/files/unbound.sh

+ 1
- 1
net/unbound/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=unbound PKG_NAME:=unbound
PKG_VERSION:=1.6.1 PKG_VERSION:=1.6.1
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_LICENSE:=BSD-3-Clause PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE


+ 20
- 1
net/unbound/files/odhcpd.awk View File

@ -28,10 +28,13 @@
/^#/ { /^#/ {
# We need to pick out DHCP v4 or v6 records # We need to pick out DHCP v4 or v6 records
net = $2 ; id = $3 ; cls = $4 ; hst = $5 ; adr = $9 ;
net = $2 ; id = $3 ; cls = $4 ; hst = $5 ; adr = $9 ; adr2 = $10
cdr = adr ; cdr = adr ;
cdr2 = adr2 ;
sub( /\/.*/, "", adr ) ; sub( /\/.*/, "", adr ) ;
sub( /.*\//, "", cdr ) ; sub( /.*\//, "", cdr ) ;
sub( /\/.*/, "", adr2 ) ;
sub( /.*\//, "", cdr2 ) ;
if ( bisolt == 1 ) { if ( bisolt == 1 ) {
@ -132,6 +135,22 @@
print ( x "\n" y ) > hostfile ; print ( x "\n" y ) > hostfile ;
} }
} }
if (( cdr2 == 128 ) && ( hst != "-" )) {
if ( bconf == 1 ) {
x = ( "local-data: \"" fqdn ". 120 IN AAAA " adr2 "\"" ) ;
y = ( "local-data-ptr: \"" adr2 " 120 " fqdn "\"" ) ;
print ( x "\n" y ) > hostfile ;
}
else {
# odhcp puts GA and ULA on the same line (position 9 and 10)
qpr2 = ipv6_ptr( adr2 ) ;
x = ( fqdn ". 120 IN AAAA " adr2 ) ;
y = ( qpr2 ". 120 IN PTR " fqdn ) ;
print ( x "\n" y ) > hostfile ;
}
}
} }
} }


+ 18
- 4
net/unbound/files/unbound.init View File

@ -9,7 +9,8 @@
# #
############################################################################## ##############################################################################
START=60
START=19
STOP=50
USE_PROCD=1 USE_PROCD=1
PROG=/usr/sbin/unbound PROG=/usr/sbin/unbound
@ -19,9 +20,18 @@ PROG=/usr/sbin/unbound
############################################################################## ##############################################################################
boot() {
UNBOUND_BOOT=1
start "$@"
}
##############################################################################
start_service() { start_service() {
# WAIT! Unbound often takes its time writing closure stats to syslog
pidof $PROG && sleep 1
if [ -n "$UNBOUND_BOOT" ] ; then
# Load procd triggers (rc) and use event IFUP to really start
return 0
fi
# complex UCI work # complex UCI work
unbound_start unbound_start
@ -37,13 +47,17 @@ start_service() {
stop_service() { stop_service() {
unbound_stop unbound_stop
# Wait! on restart Unbound may take time writing closure stats to syslog
pidof $PROG && sleep 1
} }
############################################################################## ##############################################################################
service_triggers() { service_triggers() {
# use soft reload to prevent continuous stop-start and cache flush
procd_add_reload_trigger "unbound" procd_add_reload_trigger "unbound"
procd_add_raw_trigger "interface.*" 2000 /etc/init.d/unbound restart
procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload
} }
############################################################################## ##############################################################################


+ 1
- 0
net/unbound/files/unbound.ntpd View File

@ -20,6 +20,7 @@
if [ "$ACTION" = stratum -a ! -f "$UNBOUND_TIMEFILE" ] ; then if [ "$ACTION" = stratum -a ! -f "$UNBOUND_TIMEFILE" ] ; then
echo "ntpd: $( date )" > $UNBOUND_TIMEFILE echo "ntpd: $( date )" > $UNBOUND_TIMEFILE
/etc/init.d/unbound enabled && /etc/init.d/unbound restart /etc/init.d/unbound enabled && /etc/init.d/unbound restart
# Yes, hard RESTART. We need to be absolutely sure to enable DNSSEC.
fi fi
############################################################################## ##############################################################################


+ 13
- 7
net/unbound/files/unbound.sh View File

@ -315,7 +315,7 @@ unbound_mkdir() {
# Debian-like package dns-root-data # Debian-like package dns-root-data
cp -p /usr/share/dns/root.hints $UNBOUND_HINTFILE cp -p /usr/share/dns/root.hints $UNBOUND_HINTFILE
else
elif [ ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "iterator will use built-in root hints" logger -t unbound -s "iterator will use built-in root hints"
fi fi
fi fi
@ -329,7 +329,7 @@ unbound_mkdir() {
elif [ -x $UNBOUND_ANCHOR ] ; then elif [ -x $UNBOUND_ANCHOR ] ; then
$UNBOUND_ANCHOR -a $UNBOUND_KEYFILE $UNBOUND_ANCHOR -a $UNBOUND_KEYFILE
else
elif [ ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "validator will use built-in trust anchor" logger -t unbound -s "validator will use built-in trust anchor"
fi fi
fi fi
@ -526,7 +526,7 @@ unbound_conf() {
echo echo
} >> $UNBOUND_CONFFILE } >> $UNBOUND_CONFFILE
else
elif [ ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "default memory resource consumption" logger -t unbound -s "default memory resource consumption"
fi fi
@ -602,7 +602,9 @@ unbound_conf() {
;; ;;
*) *)
logger -t unbound -s "default recursion configuration"
if [ ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "default recursion configuration"
fi
;; ;;
esac esac
@ -822,7 +824,11 @@ unbound_uci() {
if [ "$UNBOUND_B_DNSMASQ" -gt 0 ] ; then if [ "$UNBOUND_B_DNSMASQ" -gt 0 ] ; then
UNBOUND_D_DHCP_LINK=dnsmasq UNBOUND_D_DHCP_LINK=dnsmasq
logger -t unbound -s "Please use 'dhcp_link' selector instead"
if [ ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "Please use 'dhcp_link' selector instead"
fi
fi fi
fi fi
@ -835,7 +841,7 @@ unbound_uci() {
fi fi
if [ "$UNBOUND_D_DHCP_LINK" = "none" ] ; then
if [ "$UNBOUND_D_DHCP_LINK" = "none" -a ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "cannot forward to dnsmasq" logger -t unbound -s "cannot forward to dnsmasq"
fi fi
fi fi
@ -849,7 +855,7 @@ unbound_uci() {
fi fi
if [ "$UNBOUND_D_DHCP_LINK" = "none" ] ; then
if [ "$UNBOUND_D_DHCP_LINK" = "none" -a ! -f "$UNBOUND_TIMEFILE" ] ; then
logger -t unbound -s "cannot receive records from odhcpd" logger -t unbound -s "cannot receive records from odhcpd"
fi fi
fi fi


Loading…
Cancel
Save