banip: update 0.8.8-2
* process local lists in strict sequential order to prevent possible race conditions * support ranges in the IP search, too * fix some minor search issues Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
a9cda91502
commit
c3084be415
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=banip
|
||||
PKG_VERSION:=0.8.8
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
||||
|
|
|
@ -1309,10 +1309,10 @@ f_search() {
|
|||
local item table_sets ip proto hold cnt result_flag="/var/run/banIP.search" input="${1}"
|
||||
|
||||
if [ -n "${input}" ]; then
|
||||
ip="$(printf "%s" "${input}" | "${ban_awkcmd}" 'BEGIN{RS="(([0-9]{1,3}\\.){3}[0-9]{1,3})+"}{printf "%s",RT}')"
|
||||
ip="$(printf "%s" "${input}" | "${ban_awkcmd}" 'BEGIN{RS="(([0-9]{1,3}\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])(\/(1?[0-9]|2?[0-9]|3?[0-2]))?[[:space:]]*$)"}{printf "%s",RT}')"
|
||||
[ -n "${ip}" ] && proto="v4"
|
||||
if [ -z "${proto}" ]; then
|
||||
ip="$(printf "%s" "${input}" | "${ban_awkcmd}" 'BEGIN{RS="([A-Fa-f0-9]{1,4}::?){3,7}[A-Fa-f0-9]{1,4}"}{printf "%s",RT}')"
|
||||
ip="$(printf "%s" "${input}" | "${ban_awkcmd}" 'BEGIN{RS="(([0-9A-f]{0,4}:){1,7}[0-9A-f]{0,4}:?(\/(1?[0-2][0-8]|[0-9][0-9]))?)([[:space:]].*|$)"}{printf "%s",RT}')"
|
||||
[ -n "${ip}" ] && proto="v6"
|
||||
fi
|
||||
fi
|
||||
|
@ -1327,10 +1327,7 @@ f_search() {
|
|||
printf " %s\n" "---"
|
||||
cnt="1"
|
||||
for item in ${table_sets}; do
|
||||
if [ -f "${result_flag}" ]; then
|
||||
rm -f "${result_flag}"
|
||||
return
|
||||
fi
|
||||
[ -f "${result_flag}" ] && break
|
||||
(
|
||||
if "${ban_nftcmd}" get element inet banIP "${item}" "{ ${ip} }" >/dev/null 2>&1; then
|
||||
printf " %s\n" "IP found in Set '${item}'"
|
||||
|
@ -1342,7 +1339,7 @@ f_search() {
|
|||
cnt="$((cnt + 1))"
|
||||
done
|
||||
wait
|
||||
printf " %s\n" "IP not found"
|
||||
[ -f "${result_flag}" ] && rm -f "${result_flag}" || printf " %s\n" "IP not found"
|
||||
}
|
||||
|
||||
# Set survey
|
||||
|
|
|
@ -61,22 +61,17 @@ f_log "info" "start banIP download processes"
|
|||
|
||||
cnt="1"
|
||||
for feed in allowlist ${ban_feed} blocklist; do
|
||||
# local feeds
|
||||
# local feeds (sequential processing)
|
||||
#
|
||||
if [ "${feed}" = "allowlist" ] || [ "${feed}" = "blocklist" ]; then
|
||||
for proto in 4MAC 6MAC 4 6; do
|
||||
[ "${feed}" = "blocklist" ] && wait
|
||||
(f_down "${feed}" "${proto}") &
|
||||
[ "${feed}" = "blocklist" ] || { [ "${feed}" = "allowlist" ] && { [ "${proto}" = "4MAC" ] || [ "${proto}" = "6MAC" ]; }; } && wait
|
||||
hold="$((cnt % ban_cores))"
|
||||
[ "${hold}" = "0" ] && wait
|
||||
cnt="$((cnt + 1))"
|
||||
f_down "${feed}" "${proto}"
|
||||
done
|
||||
wait
|
||||
continue
|
||||
fi
|
||||
|
||||
# external feeds
|
||||
# external feeds (parallel processing on multicore hardware)
|
||||
#
|
||||
if ! json_select "${feed}" >/dev/null 2>&1; then
|
||||
f_log "info" "remove unknown feed '${feed}'"
|
||||
|
|
Loading…
Reference in New Issue