From 262b3b5dc1aaa6f46546f653a7fd8dcb3792fa5a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 4 Apr 2021 12:46:28 -0400 Subject: [PATCH] Improve drop count printing --- dropcount.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dropcount.sh b/dropcount.sh index f67abf7..3cfc4ab 100755 --- a/dropcount.sh +++ b/dropcount.sh @@ -10,7 +10,17 @@ bpftool map dump id "$(bpftool map show | grep drop_cnt_map | awk '{ print $1 }' "Found "*) ;; *) if [ "$KEY" != "" ]; then - echo "$KEY: $CNT" + if [ "$KEY" = "0x00000000" ]; then + echo "Invalid packet length: $CNT" + elif [ "$KEY" = "0x00000001" ]; then + echo "Invalid VLAN tag: $CNT" + elif [ "$KEY" = "0x00000002" ]; then + echo "Invalid/rejected IHL IPv4 field: $CNT" + elif [ "$KEY" = "0x00000003" ]; then + echo "Rejected IPv6 fragments: $CNT" + else + echo "$KEY: $CNT" + fi fi KEY=$(echo "$LINE" | awk '{ print "0x" $4 $3 $2 $1 }') CNT=0 -- 2.39.5