From: Matt Corallo Date: Tue, 10 Sep 2024 01:02:38 +0000 (+0000) Subject: Don't fail to print dropcount when zero rules are installed X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;p=flowspec-xdp Don't fail to print dropcount when zero rules are installed --- diff --git a/dropcount.sh b/dropcount.sh index 6960ef9..18d96a2 100755 --- a/dropcount.sh +++ b/dropcount.sh @@ -34,7 +34,7 @@ echo "$MAP_CONTENTS" | { echo -e "${PACKETS[2]}\t$(( ${BYTES[2]} / 1000 ))\tInvalid/rejected IHL IPv4 field" echo -e "${PACKETS[3]}\t$(( ${BYTES[3]} / 1000 ))\tRejected IPv6 fragments" C=4 - if [ "$(wc -l "$(dirname ${BASH_SOURCE[0]})/installed-rules.txt")" != "0" ]; then + if [ "$(cat "$(dirname ${BASH_SOURCE[0]})/installed-rules.txt" | wc -c)" -gt "1" ]; then while read LINE; do echo -e "${PACKETS["$C"]}\t$(( ${BYTES["$C"]} / 1000 ))\t$LINE" C=$(( $C + 1 ))