Merge pull request #6570 from dibdot/adblock

adblock: bugfix 3.5.4 v2
This commit is contained in:
Dirk Brenken 2018-07-24 22:14:52 +02:00 committed by GitHub
commit ad41a6fdd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View file

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

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.5.4" adb_ver="3.5.4-2"
adb_sysver="unknown" adb_sysver="unknown"
adb_enabled=0 adb_enabled=0
adb_debug=0 adb_debug=0
@ -360,7 +360,7 @@ f_count()
# #
f_extconf() f_extconf()
{ {
local uci_config local uci_config port port_list="53 853 5353"
case "${adb_dns}" in case "${adb_dns}" in
dnsmasq) dnsmasq)
@ -395,20 +395,24 @@ f_extconf()
uci_config="firewall" uci_config="firewall"
if [ ${adb_enabled} -eq 1 ] && [ ${adb_forcedns} -eq 1 ] && \ if [ ${adb_enabled} -eq 1 ] && [ ${adb_forcedns} -eq 1 ] && \
[ -z "$(uci -q get firewall.adblock_dns)" ] && [ $(/etc/init.d/firewall enabled; printf '%u' ${?}) -eq 0 ] [ -z "$(uci -q get firewall.adblock_dns_53)" ] && [ $(/etc/init.d/firewall enabled; printf '%u' ${?}) -eq 0 ]
then then
uci -q batch <<-EOF for port in ${port_list}
set firewall.adblock_dns="redirect" do
set firewall.adblock_dns.name="Adblock DNS" uci_add firewall "redirect" "adblock_dns_${port}"
set firewall.adblock_dns.src="lan" uci_set firewall "adblock_dns_${port}" "name" "Adblock DNS, port ${port}"
set firewall.adblock_dns.proto="tcp udp" uci_set firewall "adblock_dns_${port}" "src" "lan"
set firewall.adblock_dns.src_dport="53 853 5353" uci_set firewall "adblock_dns_${port}" "proto" "tcp udp"
set firewall.adblock_dns.dest_port="53 853 5353" uci_set firewall "adblock_dns_${port}" "src_dport" "${port}"
set firewall.adblock_dns.target="DNAT" uci_set firewall "adblock_dns_${port}" "dest_port" "${port}"
EOF uci_set firewall "adblock_dns_${port}" "target" "DNAT"
elif [ -n "$(uci -q get firewall.adblock_dns)" ] && ([ ${adb_enabled} -eq 0 ] || [ ${adb_forcedns} -eq 0 ]) done
elif [ -n "$(uci -q get firewall.adblock_dns_53)" ] && ([ ${adb_enabled} -eq 0 ] || [ ${adb_forcedns} -eq 0 ])
then then
uci -q delete firewall.adblock_dns for port in ${port_list}
do
uci_remove firewall "adblock_dns_${port}"
done
fi fi
f_uci "${uci_config}" f_uci "${uci_config}"
} }