Merge pull request #8027 from dibdot/adblock

adblock: bugfix 3.6.4
This commit is contained in:
Dirk Brenken 2019-01-24 16:24:24 +01:00 committed by GitHub
commit 4aa7adf041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 178 additions and 169 deletions

View file

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

View file

@ -10,7 +10,7 @@
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="3.6.3"
adb_ver="3.6.4"
adb_sysver="unknown"
adb_enabled=0
adb_debug=0
@ -1056,14 +1056,18 @@ f_main()
#
f_report()
{
local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hold ports cnt=0 search="${1}" count="${2}" filter="${3}" print="${4}"
local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hold ports cnt=0 search="${1}" count="${2}" filter="${3}" print="${4}"
if [ ! -x "${adb_reputil}" ]
if [ ${adb_report} -eq 1 ] && [ ! -x "${adb_reputil}" ]
then
f_log "info" "Please install the package 'tcpdump-mini' manually to use the adblock reporting feature!"
return 0
f_log "info" "Please install the package 'tcpdump-mini' to use the adblock reporting feature!"
elif [ ${adb_report} -eq 0 ] && [ "${adb_action}" = "report" ]
then
f_log "info" "Please enable the extra option 'adb_report' to use the adblock reporting feature!"
fi
if [ -x "${adb_reputil}" ]
then
bg_pid="$(pgrep -f "^${adb_reputil}.*adb_report\.pcap$" | awk '{ORS=" "; print $1}')"
if [ ${adb_report} -eq 0 ] || ([ -n "${bg_pid}" ] && ([ "${adb_action}" = "stop" ] || [ "${adb_action}" = "restart" ]))
then
@ -1077,7 +1081,10 @@ local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hol
unset bg_pid
fi
fi
fi
if [ -x "${adb_reputil}" ] && [ ${adb_report} -eq 1 ]
then
if [ -z "${bg_pid}" ] && [ "${adb_action}" != "report" ] && [ "${adb_action}" != "stop" ]
then
for port in ${adb_replisten}
@ -1090,6 +1097,7 @@ local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hol
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 &)
bg_pid="$(pgrep -f "^${adb_reputil}.*adb_report\.pcap$" | awk '{ORS=" "; print $1}')"
fi
if [ "${adb_action}" = "report" ] && [ "${filter}" = "false" ]
@ -1247,6 +1255,7 @@ local bg_pid total blocked percent rep_clients rep_domains rep_blocked index hol
printf "%s\n%s\n%s\n" ":::" "::: no reporting data available yet" ":::"
fi
fi
fi
f_log "debug" "f_report ::: action: ${adb_action}, report: ${adb_report}, search: ${1}, count: ${2}, filter: ${3}, print: ${4}, reputil: ${adb_reputil}, repdir: ${adb_repdir}, repiface: ${adb_repiface}, replisten: ${adb_replisten}, repchunksize: ${adb_repchunksize}, repchunkcnt: ${adb_repchunkcnt}, bg_pid: ${bg_pid}"
}