adblock: bugfix 3.5.4 v2
authorDirk Brenken <redacted>
Tue, 24 Jul 2018 19:53:03 +0000 (21:53 +0200)
committerDirk Brenken <redacted>
Tue, 24 Jul 2018 19:53:03 +0000 (21:53 +0200)
* fix wrong firewall syntax of the last commit

Signed-off-by: Dirk Brenken <redacted>
net/adblock/Makefile
net/adblock/files/adblock.sh

index 25dea76babca9630364cd0201749e4443ecdaad3..4b199597ea8062a22eacbd5701f604dd2dfedaf1 100644 (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>
 
index bff62dabf2f8e55acb887632f2bab2156df29443..e91f8e9d7a7d49936c30303f949cca34c5111299 100755 (executable)
@@ -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}"
 }
git clone https://git.99rst.org/PROJECT