mirror of
https://github.com/openwrt/packages.git
synced 2025-12-28 03:30:05 +04:00
banip: update 1.5.0-5
* fix a reporting issue with multiple ports/protocols
Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 737c0601cb)
This commit is contained in:
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=banip
|
||||
PKG_VERSION:=1.5.0
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
||||
|
||||
@@ -1509,18 +1509,25 @@ f_report() {
|
||||
set_proto=""
|
||||
set_dport=""
|
||||
for chain in _inbound _outbound; do
|
||||
for expr in 0 1; do
|
||||
for expr in 0 1 2; do
|
||||
if [ "${chain}" = "_inbound" ] && [ -z "${set_cntinbound}" ]; then
|
||||
set_cntinbound="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[${expr}].match.right=\"@${item}\"].expr[*].counter.packets")"
|
||||
elif [ "${chain}" = "_outbound" ] && [ -z "${set_cntoutbound}" ]; then
|
||||
set_cntoutbound="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[${expr}].match.right=\"@${item}\"].expr[*].counter.packets")"
|
||||
fi
|
||||
[ "${expr}" = "1" ] && [ -z "${set_dport}" ] && set_dport="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[${expr}].match.right=\"@${item}\"].expr[*].match.right.set")"
|
||||
[ "${expr}" = "1" ] && [ -z "${set_proto}" ] && set_proto="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[${expr}].match.right=\"@${item}\"].expr[*].match.left.payload.protocol")"
|
||||
[ -z "${set_proto}" ] && set_proto="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[2].match.right=\"@${item}\"].expr[0].match.right.set")"
|
||||
[ -z "${set_proto}" ] && set_proto="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[1].match.right=\"@${item}\"].expr[0].match.left.payload.protocol")"
|
||||
[ -z "${set_dport}" ] && set_dport="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[2].match.right=\"@${item}\"].expr[1].match.right.set")"
|
||||
[ -z "${set_dport}" ] && set_dport="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[2].match.right=\"@${item}\"].expr[1].match.right")"
|
||||
[ -z "${set_dport}" ] && set_dport="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[1].match.right=\"@${item}\"].expr[0].match.right.set")"
|
||||
[ -z "${set_dport}" ] && set_dport="$(printf "%s" "${table_json}" | "${ban_jsoncmd}" -ql1 -e "@.nftables[@.rule.chain=\"${chain}\"][@.expr[1].match.right=\"@${item}\"].expr[0].match.right")"
|
||||
done
|
||||
done
|
||||
if [ -n "${set_proto}" ] && [ -n "${set_dport}" ]; then
|
||||
sum_setports="$((sum_setports + 1))"
|
||||
set_proto="${set_proto//[\{\}\":]/}"
|
||||
set_proto="${set_proto#\[ *}"
|
||||
set_proto="${set_proto%* \]}"
|
||||
set_dport="${set_dport//[\{\}\":]/}"
|
||||
set_dport="${set_dport#\[ *}"
|
||||
set_dport="${set_dport%* \]}"
|
||||
|
||||
Reference in New Issue
Block a user