]> 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)
committerJuliana Fajardini <jufajardini@oisf.net>
Wed, 31 Aug 2022 16:19:41 +0000 (13:19 -0300)
Related to
Bug #5458

(cherry picked from commit abd595d695ce477cccd80ec22ebcc156a544f65e)

src/tmqh-packetpool.c

index 3b84f3608175d43d48898c7597cb44371890615f..e400da5849a0fac22be8b1b29b8e4329b64a2eb5 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");