]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode: validate if dropped packet has drop reason
authorJuliana Fajardini <jufajardini@oisf.net>
Mon, 8 Aug 2022 14:04:59 +0000 (11:04 -0300)
committerVictor Julien <vjulien@oisf.net>
Thu, 25 Aug 2022 10:38:08 +0000 (12:38 +0200)
Related to
Bug #5458

src/tmqh-packetpool.c

index 92b017a038b4c6d12bef781dfae0585e3516c313..c7b5586259396c20a275d01ebf9abd71d2b72697 100644 (file)
@@ -49,6 +49,7 @@
 #include "util-error.h"
 #include "util-profiling.h"
 #include "util-device.h"
+#include "util-validate.h"
 
 /* Number of freed packet to save for one pool before freeing them. */
 #define MAX_PENDING_RETURN_PACKETS 32
@@ -450,6 +451,11 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
         SCLogDebug("tunnel stuff done, move on (proot %d)", proot);
     }
 
+    /* Check that the drop reason has been set, if we have a drop */
+    if (PacketTestAction(p, ACTION_DROP)) {
+        DEBUG_VALIDATE_BUG_ON((p)->drop_reason == PKT_DROP_REASON_NOT_SET);
+    }
+
     /* we're done with the tunnel root now as well */
     if (proot == true) {
         SCLogDebug("getting rid of root pkt... alloc'd %s", p->root->flags & PKT_ALLOC ? "true" : "false");