adblock: release 3.6.1 7781/head
authorDirk Brenken <dev@brenken.org>
Wed, 26 Dec 2018 20:19:21 +0000 (21:19 +0100)
committerDirk Brenken <dev@brenken.org>
Wed, 26 Dec 2018 20:19:21 +0000 (21:19 +0100)
* report engine supports multiple listening ports, set
  'adb_replisten' to a space separated list of ports,
  default '53'
* report engine supports multiple interfaces, set 'adb_repiface'
  to 'any'
* small fixes

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.sh

index 405326e5a09cb619d1c505cf7a8f8e581eb3349d..07a2bd88468c6bfe85ec2e4f26283ba28e504e2c 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=3.6.0
+PKG_VERSION:=3.6.1
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index 4dee3f70100e87f1066821086b46b926a4cd97a4..b1f00dfa7da81075c35f2a060bf29fafcabfe20d 100644 (file)
@@ -153,8 +153,9 @@ A lot of people already use adblocker plugins within their desktop browsers, but
     * adb\_backup_mode => do not automatically update blocklists during startup, use backups instead (bool/default: '0', disabled)
     * adb\_report => enable the background tcpdump gathering process to provide a detailed DNS Query Report (bool/default: '0', disabled)
     * adb\_repdir => target directory for dns related report files generated by tcpdump (default: '/tmp')
+    * adb\_repiface => reporting interface used by tcpdump, set to 'any' for multiple interfaces (default: 'br-lan')
+    * adb\_replisten => space separated list of reporting port(s) used by tcpdump (default: '53')
     * adb\_repchunksize => report chunk size used by tcpdump in MB (int/default: '1')
-    * adb\_repiface => reporting interface used by tcpdump (default: 'br-lan')
     * adb\_repchunkcnt => report chunk count used by tcpdump (default: '5')
     * adb\_maxqueue => size of the download queue to handle downloads & list processing in parallel (int/default: '8')
     * adb\_jail => builds an additional 'Jail' list (/tmp/adb_list.jail) to block access to all domains except those listed in the whitelist file (bool/default: '0', disabled)
index fb956b41ac8233b3e99ccfbef760b8866258d14e..ffc520b6f3f8cab788fdfca226b34938ee00d179 100755 (executable)
@@ -10,7 +10,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="3.6.0"
+adb_ver="3.6.1"
 adb_sysver="unknown"
 adb_enabled=0
 adb_debug=0
@@ -37,6 +37,7 @@ adb_hashold=""
 adb_hashnew=""
 adb_report=0
 adb_repiface="br-lan"
+adb_replisten="53"
 adb_repdir="/tmp"
 adb_reputil="$(command -v tcpdump)"
 adb_repchunkcnt="5"
@@ -749,19 +750,22 @@ f_jsnup()
        fi
 
        json_load_file "${adb_rtfile}" >/dev/null 2>&1
-       json_select "data"
-       if [ -z "${adb_fetchinfo}" ]
-       then
-               json_get_var adb_fetchinfo "fetch_utility"
-       fi
-       if [ -z "${adb_cnt}" ]
-       then
-               json_get_var adb_cnt "overall_domains"
-               adb_cnt="${adb_cnt%% *}"
-       fi
-       if [ -z "${run_time}" ]
+       json_select "data" >/dev/null 2>&1
+       if [ ${?} -eq 0 ]
        then
-               json_get_var run_time "last_rundate"
+               if [ -z "${adb_fetchinfo}" ]
+               then
+                       json_get_var adb_fetchinfo "fetch_utility"
+               fi
+               if [ -z "${adb_cnt}" ]
+               then
+                       json_get_var adb_cnt "overall_domains"
+                       adb_cnt="${adb_cnt%% *}"
+               fi
+               if [ -z "${run_time}" ]
+               then
+                       json_get_var run_time "last_rundate"
+               fi
        fi
 
        > "${adb_rtfile}"
@@ -1053,7 +1057,7 @@ f_main()
 #
 f_report()
 {
-       local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hold cnt=0 print="${1:-"true"}"
+       local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hold ports cnt=0 print="${1:-"true"}"
 
        if [ ! -x "${adb_reputil}" ]
        then
@@ -1062,17 +1066,30 @@ f_report()
        fi
 
        bg_pid="$(pgrep -f "^${adb_reputil}.*adb_report\.pcap$" | awk '{ORS=" "; print $1}')"
-       if [ ${adb_report} -eq 0 ] || ([ -n "${bg_pid}" ] && [ "${adb_action}" = "stop" ])
+       if [ ${adb_report} -eq 0 ] || ([ -n "${bg_pid}" ] && ([ "${adb_action}" = "stop" ] || [ "${adb_action}" = "restart" ]))
        then
                if [ -n "${bg_pid}" ]
                then
                        kill -HUP ${bg_pid}
+                       while $(kill -0 ${bg_pid} 2>/dev/null)
+                       do
+                               sleep 1
+                       done
+                       unset bg_pid
                fi
-               return 0
        fi
-       if [ -z "${bg_pid}" ] && [ "${adb_action}" != "report" ]
+       if [ -z "${bg_pid}" ] && [ "${adb_action}" != "report" ] && [ "${adb_action}" != "stop" ]
        then
-               ("${adb_reputil}" -nn -s0 -l -i ${adb_repiface} port 53 -C${adb_repchunksize} -W${adb_repchunkcnt} -w "${adb_repdir}/adb_report.pcap" >/dev/null 2>&1 &)
+               for port in ${adb_replisten}
+               do
+                       if [ -z "${ports}" ]
+                       then
+                               ports="port ${port}"
+                       else
+                               ports="${ports} or port ${port}"
+                       fi
+               done
+               ("${adb_reputil}" -nn -s0 -l -i ${adb_repiface} ${ports} -C${adb_repchunksize} -W${adb_repchunkcnt} -w "${adb_repdir}/adb_report.pcap" >/dev/null 2>&1 &)
        fi
        if [ "${adb_action}" = "report" ]
        then
@@ -1211,7 +1228,7 @@ f_report()
                        fi
                fi
        fi
-       f_log "debug" "f_report ::: action: ${adb_action}, report: ${adb_report}, print: ${print}, reputil: ${adb_reputil}, repdir: ${adb_repdir}, repiface: ${adb_repiface}, repchunksize: ${adb_repchunksize}, repchunkcnt: ${adb_repchunkcnt}, bg_pid: ${bg_pid}"
+       f_log "debug" "f_report ::: action: ${adb_action}, report: ${adb_report}, print: ${print}, reputil: ${adb_reputil}, repdir: ${adb_repdir}, repiface: ${adb_repiface}, replisten: ${adb_replisten}, repchunksize: ${adb_repchunksize}, repchunkcnt: ${adb_repchunkcnt}, bg_pid: ${bg_pid}"
 }
 
 # source required system libraries