Browse Source

adblock: update 3.8.1

* fix a possible race condition during DNS file reset on slow hardware
* optimize DNS restart behaviour in 'null' blocking mode
* mute useless warnings

Signed-off-by: Dirk Brenken <dev@brenken.org>
lilik-openwrt-22.03
Dirk Brenken 5 years ago
parent
commit
866878aa78
No known key found for this signature in database GPG Key ID: 9D71CD547BFAE684
2 changed files with 13 additions and 16 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +12
    -15
      net/adblock/files/adblock.sh

+ 1
- 1
net/adblock/Makefile View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=adblock PKG_NAME:=adblock
PKG_VERSION:=3.8.0
PKG_VERSION:=3.8.1
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+ PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org> PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>


+ 12
- 15
net/adblock/files/adblock.sh View File

@ -10,7 +10,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="3.8.0"
adb_ver="3.8.1"
adb_sysver="unknown" adb_sysver="unknown"
adb_enabled=0 adb_enabled=0
adb_debug=0 adb_debug=0
@ -443,20 +443,14 @@ f_extconf()
# #
f_dnsup() f_dnsup()
{ {
local dns_up cache_util cache_rc cnt=0
local dns_service dns_up dns_pid dns_procfile cache_util cache_rc cnt=0
if [ "${adb_dnsflush}" -eq 0 ] && [ "${adb_enabled}" -eq 1 ] && [ "${adb_rc}" -eq 0 ] if [ "${adb_dnsflush}" -eq 0 ] && [ "${adb_enabled}" -eq 1 ] && [ "${adb_rc}" -eq 0 ]
then then
case "${adb_dns}" in case "${adb_dns}" in
"dnsmasq") "dnsmasq")
if [ "${adb_dnsvariant}" = "nxdomain" ]
then
killall -q -HUP "${adb_dns}"
cache_rc=${?}
elif [ "${adb_dnsvariant% *}" = "null" ]
then
"/etc/init.d/${adb_dns}" restart >/dev/null 2>&1
fi
killall -q -HUP "${adb_dns}"
cache_rc=${?}
;; ;;
"unbound") "unbound")
cache_util="$(command -v unbound-control)" cache_util="$(command -v unbound-control)"
@ -487,8 +481,11 @@ f_dnsup()
adb_rc=1 adb_rc=1
while [ "${cnt}" -le 10 ] while [ "${cnt}" -le 10 ]
do do
dns_up="$(ubus -S call service list "{\"name\":\"${adb_dns}\"}" | jsonfilter -l1 -e "@[\"${adb_dns}\"].instances.*.running")"
if [ "${dns_up}" = "true" ]
dns_service="$(ubus -S call service list "{\"name\":\"${adb_dns}\"}")"
dns_up="$(printf "%s" "${dns_service}" | jsonfilter -l1 -e "@[\"${adb_dns}\"].instances.*.running")"
dns_pid="$(printf "%s" "${dns_service}" | jsonfilter -l1 -e "@[\"${adb_dns}\"].instances.*.pid")"
dns_procfile="$(ls -l /proc/${dns_pid}/fd 2>/dev/null | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")"
if [ "${dns_up}" = "true" ] && [ -n "${dns_pid}" ] && [ -z "${dns_procfile}" ]
then then
case "${adb_dns}" in case "${adb_dns}" in
"unbound") "unbound")
@ -891,7 +888,7 @@ f_bgserv()
( "${adb_ubusservice}" &) ( "${adb_ubusservice}" &)
elif [ -n "${bg_pid}" ] && [ "${status}" = "stop" ] elif [ -n "${bg_pid}" ] && [ "${status}" = "stop" ]
then then
kill -HUP ${bg_pid}
kill -HUP ${bg_pid} 2>/dev/null
fi fi
f_log "debug" "f_bgserv ::: status: ${status:-"-"}, bg_pid: ${bg_pid:-"-"}, dns_filereset: ${adb_dnsfilereset:-"-"}, ubus_service: ${adb_ubusservice:-"-"}" f_log "debug" "f_bgserv ::: status: ${status:-"-"}, bg_pid: ${bg_pid:-"-"}, dns_filereset: ${adb_dnsfilereset:-"-"}, ubus_service: ${adb_ubusservice:-"-"}"
} }
@ -1041,9 +1038,9 @@ f_main()
then then
if [ "${adb_dnsfilereset}" = "true" ] if [ "${adb_dnsfilereset}" = "true" ]
then then
f_bgserv "start"
> "${adb_dnsdir}"/"${adb_dnsfile}" > "${adb_dnsdir}"/"${adb_dnsfile}"
f_log "info" "blocklist with overall ${adb_cnt} domains loaded successfully and reset afterwards (${adb_sysver})" f_log "info" "blocklist with overall ${adb_cnt} domains loaded successfully and reset afterwards (${adb_sysver})"
f_bgserv "start"
else else
f_log "info" "blocklist with overall ${adb_cnt} domains loaded successfully (${adb_sysver})" f_log "info" "blocklist with overall ${adb_cnt} domains loaded successfully (${adb_sysver})"
fi fi
@ -1075,7 +1072,7 @@ f_report()
then then
if [ -n "${bg_pid}" ] if [ -n "${bg_pid}" ]
then then
kill -HUP ${bg_pid}
kill -HUP ${bg_pid} 2>/dev/null
while $(kill -0 ${bg_pid} 2>/dev/null) while $(kill -0 ${bg_pid} 2>/dev/null)
do do
sleep 1 sleep 1


Loading…
Cancel
Save