adblock: release 4.5.5-1

* added an separate adblock rundir (/var/run/adblock)
* refine the cpu/core detection
* behaviour change: allowlist domains now also removes subdomains from the blocklist
* flock/serialize the etag writing in the f_etag function
* code clean-up/linting

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2026-04-17 09:56:57 +02:00
parent feaaf2d99b
commit 157bd82ac0
7 changed files with 953 additions and 799 deletions
+2 -2
View File
@@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_VERSION:=4.5.4
PKG_RELEASE:=3
PKG_VERSION:=4.5.5
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
+46 -46
View File
@@ -19,64 +19,64 @@ for option in ${old_options}; do
old_values="$(uci -q get ${config}.global.${option})"
for value in ${old_values}; do
case "${option}" in
"adb_sources")
if ! uci -q get ${config}.global.adb_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_feed="${value}"
fi
"adb_sources")
if ! uci -q get ${config}.global.adb_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_feed="${value}"
fi
;;
"adb_hag_sources")
if ! uci -q get ${config}.global.adb_hag_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_hag_feed="${value}"
fi
"adb_hag_sources")
if ! uci -q get ${config}.global.adb_hag_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_hag_feed="${value}"
fi
;;
"adb_hst_sources")
if ! uci -q get ${config}.global.adb_hst_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_hst_feed="${value}"
fi
"adb_hst_sources")
if ! uci -q get ${config}.global.adb_hst_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_hst_feed="${value}"
fi
;;
"adb_stb_sources")
if ! uci -q get ${config}.global.adb_stb_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_stb_feed="${value}"
fi
"adb_stb_sources")
if ! uci -q get ${config}.global.adb_stb_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_stb_feed="${value}"
fi
;;
"adb_utc_sources")
if ! uci -q get ${config}.global.adb_utc_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_utc_feed="${value}"
fi
"adb_utc_sources")
if ! uci -q get ${config}.global.adb_utc_feed | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_utc_feed="${value}"
fi
;;
"adb_fetchutil")
uci -q set ${config}.global.adb_fetchcmd="${value}"
"adb_fetchutil")
uci -q set ${config}.global.adb_fetchcmd="${value}"
;;
"adb_tmpbase")
uci -q set ${config}.global.adb_basedir="${value}"
"adb_tmpbase")
uci -q set ${config}.global.adb_basedir="${value}"
;;
"adb_nice")
uci -q set ${config}.global.adb_nicelimit="${value}"
"adb_nice")
uci -q set ${config}.global.adb_nicelimit="${value}"
;;
"adb_hag_feed")
inplace="1"
if ! printf "%s" "${value}" | grep -qE "^(wildcard/|domains/)"; then
uci -q del_list ${config}.global.adb_hag_feed="${value}"
uci -q add_list ${config}.global.adb_hag_feed="wildcard/${value}"
fi
"adb_hag_feed")
inplace="1"
if ! printf '%s' "${value}" | grep -qE "^(wildcard/|domains/)"; then
uci -q del_list ${config}.global.adb_hag_feed="${value}"
uci -q add_list ${config}.global.adb_hag_feed="wildcard/${value}"
fi
;;
"adb_forcedns" | "adb_dnsforce")
uci -q set ${config}.global.adb_nftforce="${value}"
"adb_forcedns" | "adb_dnsforce")
uci -q set ${config}.global.adb_nftforce="${value}"
;;
"adb_zonelist")
if ! uci -q get ${config}.global.adb_nftdevforce | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_nftdevforce="${value}"
fi
"adb_zonelist")
if ! uci -q get ${config}.global.adb_nftdevforce | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_nftdevforce="${value}"
fi
;;
"adb_portlist")
if ! uci -q get ${config}.global.adb_nftportforce | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_nftportforce="${value}"
fi
"adb_portlist")
if ! uci -q get ${config}.global.adb_nftportforce | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_nftportforce="${value}"
fi
;;
"adb_replisten")
if ! uci -q get ${config}.global.adb_repport | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_repport="${value}"
fi
"adb_replisten")
if ! uci -q get ${config}.global.adb_repport | grep -q "${value}"; then
uci -q add_list ${config}.global.adb_repport="${value}"
fi
;;
esac
done
+1 -1
View File
@@ -67,7 +67,7 @@ When the DNS server on your router receives DNS requests, you will sort out quer
* Provides a 'DNS Blocklist Shift', where the generated final DNS blocklist is moved to the backup directory and only a soft link to this file is set in memory. As long as your backup directory is located on an external drive, you should activate this option to save valuable RAM.
* Feed parsing by a very fast & secure domain validator, all domain rules and feed information are placed in an external JSON file ('/etc/adblock/adblock.feeds')
* Overall duplicate removal in generated blocklist file 'adb_list.overall'
* Additional local allowlist for manual overrides, located in '/etc/adblock/adblock.allowlist' (only exact matches).
* Additional local allowlist for manual overrides, located in '/etc/adblock/adblock.allowlist'
* Additional local blocklist for manual overrides, located in '/etc/adblock/adblock.blocklist'
* Implements firewallbased DNS Control to force DNS interfaces/ports and to redirect to external unfiltered/filtered DNS server
* Includes firewallbased Remote DNS Allow, a CGI-Interface to allow certain MACs temporary bypass the local adblock DNS
+11 -11
View File
@@ -55,12 +55,12 @@ fi
# validate MAC address
#
case "${query_mac}" in
[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f])
query_mac="$(tolower "${query_mac}")"
;;
*)
query_mac=""
;;
[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f])
query_mac="$(tolower "${query_mac}")"
;;
*)
query_mac=""
;;
esac
# validate mode
@@ -195,9 +195,9 @@ fi
#
nft_macremote="$(tolower "${nft_macremote}")"
case " ${nft_macremote} " in
*" ${query_mac} "*)
nft_authorized="1"
;;
*" ${query_mac} "*)
nft_authorized="1"
;;
esac
if [ "${nft_authorized}" = "0" ]; then
printf '%s\n' "
@@ -210,7 +210,7 @@ fi
# extract remaining timeout
#
remaining="$(nft list set inet adblock mac_remote 2>/dev/null | \
remaining="$(nft list set inet adblock mac_remote 2>/dev/null |
awk -v mac="${query_mac}" '
$0 ~ mac {
for (i = 1; i <= NF; i++) {
@@ -246,7 +246,7 @@ if [ -z "${remaining}" ] && [ "${query_mode}" = "renew" ]; then
<div class=\"spinner\"></div>
</div>
</div></body></html>"
nft add element inet adblock mac_remote "{ ${query_mac//[!0-9a-f:]} }" >/dev/null 2>&1
nft add element inet adblock mac_remote "{ ${query_mac//[!0-9a-f:]/} }" >/dev/null 2>&1
printf '%s\n' "<script>window.location.href='?mac=${query_mac}';</script>"
exit 0
fi
+10 -8
View File
@@ -15,19 +15,21 @@ extra_command "report" "[<cli>|<mail>|<gen>|<json>] Print DNS statistics"
adb_init="/etc/init.d/adblock"
adb_script="/usr/bin/adblock.sh"
adb_pidfile="/var/run/adblock.pid"
adb_rundir="/var/run/adblock"
adb_pidfile="/var/run/adblock/adblock.pid"
if [ -z "${IPKG_INSTROOT}" ]; then
[ ! -d "${adb_rundir}" ] && mkdir -p "${adb_rundir}"
case "${action}" in
"boot")
"${adb_init}" running && exit 0
;;
"boot")
"${adb_init}" running && exit 0
;;
esac
if [ -s "${adb_pidfile}" ]; then
case "${action}" in
"start"|"stop"|"restart"|"reload"|"report"|"suspend"|"resume"|"search")
exit 1
;;
"start" | "stop" | "restart" | "reload" | "report" | "suspend" | "resume" | "search")
exit 1
;;
esac
fi
fi
@@ -89,7 +91,7 @@ status_service() {
local key keylist value values
json_init
json_load_file "/var/run/adb_runtime.json" >/dev/null 2>&1
json_load_file "/var/run/adblock/adblock.runtime.json" >/dev/null 2>&1
json_get_keys keylist
if [ -n "${keylist}" ]; then
printf '%s\n' "::: adblock runtime information"
+4 -1
View File
@@ -21,7 +21,10 @@ adb_mailprofile="$(uci_get adblock global adb_mailprofile "adb_notify")"
# info preparation
#
sys_info="$(strings /etc/banner 2>/dev/null; "${adb_ubuscmd}" call system board | "${adb_awkcmd}" 'BEGIN{FS="[{}\"]"}{if($2=="kernel"||$2=="hostname"||$2=="system"||$2=="model"||$2=="description")printf " + %-12s: %s\n",$2,$4}' 2>/dev/null)"
sys_info="$(
strings /etc/banner 2>/dev/null
"${adb_ubuscmd}" call system board | "${adb_awkcmd}" 'BEGIN{FS="[{}\"]"}{if($2=="kernel"||$2=="hostname"||$2=="system"||$2=="model"||$2=="description")printf " + %-12s: %s\n",$2,$4}' 2>/dev/null
)"
adb_info="$(/etc/init.d/adblock status 2>/dev/null)"
rep_info="${1}"
if [ -x "${adb_logreadcmd}" ]; then
File diff suppressed because it is too large Load Diff