Browse Source

Merge pull request #6570 from dibdot/adblock

adblock: bugfix 3.5.4 v2
lilik-openwrt-22.03
Dirk Brenken 7 years ago
committed by GitHub
parent
commit
ad41a6fdd3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +18
    -14
      net/adblock/files/adblock.sh

+ 1
- 1
net/adblock/Makefile View File

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


+ 18
- 14
net/adblock/files/adblock.sh View File

@ -10,7 +10,7 @@
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="3.5.4"
adb_ver="3.5.4-2"
adb_sysver="unknown"
adb_enabled=0
adb_debug=0
@ -360,7 +360,7 @@ f_count()
#
f_extconf()
{
local uci_config
local uci_config port port_list="53 853 5353"
case "${adb_dns}" in
dnsmasq)
@ -395,20 +395,24 @@ f_extconf()
uci_config="firewall"
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
uci -q batch <<-EOF
set firewall.adblock_dns="redirect"
set firewall.adblock_dns.name="Adblock DNS"
set firewall.adblock_dns.src="lan"
set firewall.adblock_dns.proto="tcp udp"
set firewall.adblock_dns.src_dport="53 853 5353"
set firewall.adblock_dns.dest_port="53 853 5353"
set firewall.adblock_dns.target="DNAT"
EOF
elif [ -n "$(uci -q get firewall.adblock_dns)" ] && ([ ${adb_enabled} -eq 0 ] || [ ${adb_forcedns} -eq 0 ])
for port in ${port_list}
do
uci_add firewall "redirect" "adblock_dns_${port}"
uci_set firewall "adblock_dns_${port}" "name" "Adblock DNS, port ${port}"
uci_set firewall "adblock_dns_${port}" "src" "lan"
uci_set firewall "adblock_dns_${port}" "proto" "tcp udp"
uci_set firewall "adblock_dns_${port}" "src_dport" "${port}"
uci_set firewall "adblock_dns_${port}" "dest_port" "${port}"
uci_set firewall "adblock_dns_${port}" "target" "DNAT"
done
elif [ -n "$(uci -q get firewall.adblock_dns_53)" ] && ([ ${adb_enabled} -eq 0 ] || [ ${adb_forcedns} -eq 0 ])
then
uci -q delete firewall.adblock_dns
for port in ${port_list}
do
uci_remove firewall "adblock_dns_${port}"
done
fi
f_uci "${uci_config}"
}


Loading…
Cancel
Save