From 5626900e35a300d6616b26f377057408a0f97768 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Tue, 31 Mar 2020 19:05:10 +0200 Subject: [PATCH] adblock: update 4.0.1 * fix dependency issue * fix query timeouts in web frontend (seen with many selected lists), now the query comes back latest after 30 seconds, to prevent any timeouts, with all results to this point. * add missing parameter in readme.md Signed-off-by: Dirk Brenken --- net/adblock/Makefile | 4 ++-- net/adblock/files/README.md | 7 ++++--- net/adblock/files/adblock.sh | 15 +++++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index fadf6e028..cce57ec21 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock -PKG_VERSION:=4.0.0 +PKG_VERSION:=4.0.1 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken @@ -17,7 +17,7 @@ define Package/adblock SECTION:=net CATEGORY:=Network TITLE:=Powerful adblock script to block ad/abuse domains by using DNS - DEPENDS:=+jshn +jsonfilter +coreutils +coreutils-sort @(PACKAGE_aria2||PACKAGE_curl||PACKAGE_wget||PACKAGE_uclient-fetch&&(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl)) + DEPENDS:=+jshn +jsonfilter +coreutils +coreutils-sort PKGARCH:=all endef diff --git a/net/adblock/files/README.md b/net/adblock/files/README.md index a2540958f..150f64951 100644 --- a/net/adblock/files/README.md +++ b/net/adblock/files/README.md @@ -130,7 +130,6 @@ Available commands: | :---------------- | :------------------------ | :--------------------------------------------------------------------------------------------- | | adb_enabled | 1, enabled | set to 0 to disable the adblock service | | adb_dns | -, auto-detected | 'dnsmasq', 'unbound', 'named', 'kresd' or 'raw' | -| adb_dnsdir | -, auto-detected | path for the generated blocklist file 'adb_list.overall' | | adb_fetchutil | -, auto-detected | 'uclient-fetch', 'wget', 'curl' or 'aria2c' | | adb_fetchparm | -, auto-detected | special config options for the selected download utility | | adb_trigger | -, not set | trigger network interface or 'not set' to use a time-based startup | @@ -139,11 +138,13 @@ Available commands: | adb_nice | 0, standard prio. | valid nice level range 0-19 of the adblock processes | | adb_forcedns | 0, disabled | set to 1 to force DNS requests to the local resolver | | adb_maxqueue | 4 | size of the download queue to handle downloads & list processing in parallel | +| adb_dnsdir | -, auto-detected | path for the generated blocklist file 'adb_list.overall' | +| adb_dnstimeout | 10 | timeout in seconds to wait for a successful DNS backend restart | +| adb_dnsinstance | 0, first instance | set to the relevant dns backend instance used by adblock (dnsmasq only) | | adb_dnsfilereset | 0, disabled | set to 1 to purge the final DNS blocklist file after DNS backend loading | | adb_dnsflush | 0, disabled | set to 1 to flush the DNS Cache before & after adblock processing | | adb_dnsinotify | -, not set | set to 1 to prevent adblock triggered restarts for DNS backends with autoload functions | | adb_dnsallow | -, not set | set to 1 to disable selective DNS whitelisting (RPZ pass through) | -| adb_dnstimeout | 10 | timeout in seconds to wait for a successful DNS backend restart | | adb_lookupdomain | example.com | external domain to check for a successful DNS backend restart or 'false' to disable this check | | adb_portlist | 53 853 5353 | space separated list of firewall ports which should be redirected locally | | adb_report | 0, disabled | set to 1 to enable the background tcpdump gathering process for reporting | @@ -253,7 +254,7 @@ This file is directly parsed in LuCI and accessible via CLI, just call _/etc/ini + yoyo x S general https://pgl.yoyo.org -To add new or edit existing sources extract the compressed JSON file _gunzip /etc/adblock/adblock.sources.gz_. +To add new or edit existing sources extract the compressed JSON file _gunzip /etc/adblock/adblock.sources.gz_. A valid JSON source object contains the following required information, e.g.:

 	[...]
diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh
index a1f594f7d..8ab369475 100755
--- a/net/adblock/files/adblock.sh
+++ b/net/adblock/files/adblock.sh
@@ -11,7 +11,7 @@
 export LC_ALL=C
 export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 set -o pipefail
-adb_ver="4.0.0"
+adb_ver="4.0.1"
 adb_enabled=0
 adb_debug=0
 adb_forcedns=0
@@ -354,7 +354,7 @@ f_fetch()
 		do
 			if { [ "${util}" = "uclient-fetch" ] && [ -n "$(printf "%s" "${adb_packages}" | grep "^libustream-")" ]; } || \
 				{ [ "${util}" = "wget" ] && [ -n "$(printf "%s" "${adb_packages}" | grep "^wget -")" ]; } || \
-				{ [ "${util}" != "uclient-fetch" ] && [ "${util}" != "wget" ]; }
+				[ "${util}" = "curl" ] || [ "${util}" = "aria2c" ]
 			then
 				if [ -x "$(command -v "${util}")" ]
 				then
@@ -960,7 +960,7 @@ f_switch()
 #
 f_query()
 {
-	local search result prefix suffix field domain="${1}" tld="${1#*.}"
+	local search result prefix suffix field query_start query_end query_timeout=30 domain="${1}" tld="${1#*.}"
 
 	if [ -z "${domain}" ] || [ "${domain}" = "${tld}" ]
 	then
@@ -993,6 +993,7 @@ f_query()
 				field=1
 			;;
 		esac
+		query_start="$(date "+%s")"
 		if [ "${adb_dnsfilereset}" -eq 0 ]
 		then
 			while [ "${domain}" != "${tld}" ]
@@ -1024,6 +1025,12 @@ f_query()
 				if [ "${?}" -eq 0 ]
 				then
 					result="true"
+					query_end="$(date "+%s")"
+					if [ "$((query_end-query_start))" -gt "${query_timeout}" ]
+					then
+						printf "%s\\n\\n" "  - [...]"
+						break
+					fi
 				fi
 			done
 			if [ "${result}" != "true" ]
@@ -1097,7 +1104,7 @@ f_jsnup()
 		json_close_object
 	done
 	json_close_array
-	json_add_string "dns_backend" "${adb_dns}, ${adb_dnsdir}"
+	json_add_string "dns_backend" "${adb_dns:-"-"}, ${adb_dnsdir:-"-"}"
 	json_add_string "run_utils" "${utils:-"-"}"
 	json_add_string "run_ifaces" "trigger: ${adb_trigger:-"-"}, report: ${adb_repiface:-"-"}"	
 	json_add_string "run_directories" "base: ${adb_tmpbase}, backup: ${adb_backupdir}, report: ${adb_reportdir}, jail: ${adb_jaildir}"