adblock: update 4.0.1
authorDirk Brenken <dev@brenken.org>
Tue, 31 Mar 2020 17:05:10 +0000 (19:05 +0200)
committerDirk Brenken <dev@brenken.org>
Tue, 31 Mar 2020 17:05:10 +0000 (19:05 +0200)
* 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 <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.sh

index fadf6e0287a39878755445b83dca34e6659402b1..cce57ec217a95c19b2241420ef0c258cd98e9d46 100644 (file)
@@ -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 <dev@brenken.org>
@@ -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
 
index a2540958f047ebf554ae63948dc0d9185ae27ce3..150f6495111714a7d0cdc802dfd5cb90cb302bbc 100644 (file)
@@ -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
 </code></pre>
 
-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.:
 <pre><code>
        [...]
index a1f594f7d25a6beeea5074ea6bf779d837781a13..8ab369475f0996c58b4bb4a3f8b5f7f6ed8a347b 100755 (executable)
@@ -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}"