]> git.bitcoin.ninja Git - flowspec-xdp/commitdiff
Don't fail to print dropcount when zero rules are installed main
authorMatt Corallo <git@bluematt.me>
Tue, 10 Sep 2024 01:02:38 +0000 (01:02 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 10 Sep 2024 01:06:52 +0000 (01:06 +0000)
dropcount.sh

index 6960ef9b15c7bed89e050cf39036bfa4d0f0cb52..18d96a231bd2b546c67443a5b598aed988f3a12e 100755 (executable)
@@ -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 ))