From: Juliana Fajardini Date: Mon, 8 Aug 2022 14:04:59 +0000 (-0300) Subject: decode: validate if dropped packet has drop reason X-Git-Tag: suricata-7.0.0-beta1~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abd595d695ce477cccd80ec22ebcc156a544f65e;p=thirdparty%2Fsuricata.git decode: validate if dropped packet has drop reason Related to Bug #5458 --- diff --git a/src/tmqh-packetpool.c b/src/tmqh-packetpool.c index 92b017a038..c7b5586259 100644 --- a/src/tmqh-packetpool.c +++ b/src/tmqh-packetpool.c @@ -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");