Browse Source

adblock: release 3.6.1

* 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>
lilik-openwrt-22.03
Dirk Brenken 6 years ago
parent
commit
9ec73489e0
3 changed files with 39 additions and 21 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +2
    -1
      net/adblock/files/README.md
  3. +36
    -19
      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.6.0
PKG_VERSION:=3.6.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>


+ 2
- 1
net/adblock/files/README.md View 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\_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\_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\_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\_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\_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\_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) * 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)


+ 36
- 19
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.6.0"
adb_ver="3.6.1"
adb_sysver="unknown" adb_sysver="unknown"
adb_enabled=0 adb_enabled=0
adb_debug=0 adb_debug=0
@ -37,6 +37,7 @@ adb_hashold=""
adb_hashnew="" adb_hashnew=""
adb_report=0 adb_report=0
adb_repiface="br-lan" adb_repiface="br-lan"
adb_replisten="53"
adb_repdir="/tmp" adb_repdir="/tmp"
adb_reputil="$(command -v tcpdump)" adb_reputil="$(command -v tcpdump)"
adb_repchunkcnt="5" adb_repchunkcnt="5"
@ -749,19 +750,22 @@ f_jsnup()
fi fi
json_load_file "${adb_rtfile}" >/dev/null 2>&1 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 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 fi
> "${adb_rtfile}" > "${adb_rtfile}"
@ -1053,7 +1057,7 @@ f_main()
# #
f_report() 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}" ] if [ ! -x "${adb_reputil}" ]
then then
@ -1062,17 +1066,30 @@ f_report()
fi fi
bg_pid="$(pgrep -f "^${adb_reputil}.*adb_report\.pcap$" | awk '{ORS=" "; print $1}')" 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 then
if [ -n "${bg_pid}" ] if [ -n "${bg_pid}" ]
then then
kill -HUP ${bg_pid} kill -HUP ${bg_pid}
while $(kill -0 ${bg_pid} 2>/dev/null)
do
sleep 1
done
unset bg_pid
fi fi
return 0
fi fi
if [ -z "${bg_pid}" ] && [ "${adb_action}" != "report" ]
if [ -z "${bg_pid}" ] && [ "${adb_action}" != "report" ] && [ "${adb_action}" != "stop" ]
then 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 fi
if [ "${adb_action}" = "report" ] if [ "${adb_action}" = "report" ]
then then
@ -1211,7 +1228,7 @@ f_report()
fi fi
fi 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 # source required system libraries


Loading…
Cancel
Save