]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: remove FLOW_NOPACKET_INSPECTION flag
authorVictor Julien <vjulien@oisf.net>
Thu, 13 Mar 2025 08:20:57 +0000 (09:20 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 7 Apr 2025 20:04:13 +0000 (22:04 +0200)
It was not used separately from FLOW_ACTION_PASS.

src/alert-debuglog.c
src/detect-engine-alert.c
src/detect.c
src/flow-timeout.c
src/flow.c
src/flow.h
src/tests/detect.c
src/util-exception-policy.c

index f04aad78afc4aa8c2dd02dce5f6be77b154c6969..4ad9d2f8cefc0260dc36edcabf6ab5f2f8f6c7c9 100644 (file)
@@ -217,10 +217,9 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da
                              p->flow->todstbytecnt + p->flow->tosrcbytecnt);
         MemBufferWriteString(aft->buffer,
                 "FLOW ACTION:       DROP: %s\n"
-                "FLOW NOINSPECTION: PACKET: %s, PAYLOAD: %s, APP_LAYER: %s\n"
+                "FLOW PAYLOAD: %s, APP_LAYER: %s\n"
                 "FLOW APP_LAYER:    DETECTED: %s, PROTO %" PRIu16 "\n",
                 p->flow->flags & FLOW_ACTION_DROP ? "TRUE" : "FALSE",
-                p->flow->flags & FLOW_NOPACKET_INSPECTION ? "TRUE" : "FALSE",
                 p->flow->flags & FLOW_NOPAYLOAD_INSPECTION ? "TRUE" : "FALSE",
                 applayer ? "TRUE" : "FALSE",
                 (p->flow->alproto != ALPROTO_UNKNOWN) ? "TRUE" : "FALSE", p->flow->alproto);
index cf893700caf897deb73c2cf4762d6b26ec5b7e36..51f1896800cdde62cca80c20631c5ebec0f5c9ff 100644 (file)
@@ -168,7 +168,6 @@ static inline void RuleActionToFlow(const uint8_t action, Flow *f)
             if (action & ACTION_PASS) {
                 f->flags |= FLOW_ACTION_PASS;
                 SCLogDebug("setting flow action pass");
-                FlowSetNoPacketInspectionFlag(f);
             }
         }
     }
index 800db969c80910f575311a43375affe06b908559..0b43f32af2f82930a213cc7b9d1f83a644664246 100644 (file)
@@ -1938,11 +1938,11 @@ static void DetectFlow(ThreadVars *tv,
 {
     Flow *const f = p->flow;
 
-    if (p->flags & PKT_NOPACKET_INSPECTION) {
+    if (p->flags & PKT_NOPACKET_INSPECTION || f->flags & (FLOW_ACTION_PASS)) {
         /* hack: if we are in pass the entire flow mode, we need to still
          * update the inspect_id forward. So test for the condition here,
          * and call the update code if necessary. */
-        const int pass = ((f->flags & FLOW_NOPACKET_INSPECTION));
+        const int pass = ((f->flags & (FLOW_ACTION_PASS)));
         if (pass) {
             uint8_t flags = STREAM_FLAGS_FOR_PACKET(p);
             flags = FlowGetDisruptionFlags(f, flags);
index afec5d3d81bea3b20b53423f86ee5824e968bf3c..961a07bc40655349b82d73f5dfbc45df09f92a80 100644 (file)
@@ -94,9 +94,6 @@ static inline Packet *FlowPseudoPacketSetup(
     p->vlan_idx = f->vlan_idx;
     p->livedev = (struct LiveDevice_ *)f->livedev;
 
-    if (f->flags & FLOW_NOPACKET_INSPECTION) {
-        DecodeSetNoPacketInspectionFlag(p);
-    }
     if (f->flags & FLOW_NOPAYLOAD_INSPECTION) {
         DecodeSetNoPayloadInspectionFlag(p);
     }
index 4374c955564a206c4dbc5d7f260d327d85d666c1..a07ea762a1bb2732e7bf51f03fbe2152574866cb 100644 (file)
@@ -507,11 +507,7 @@ void FlowHandlePacketUpdate(Flow *f, Packet *p, ThreadVars *tv, DecodeThreadVars
     if (f->flags & FLOW_ACTION_DROP) {
         PacketDrop(p, ACTION_DROP, PKT_DROP_REASON_FLOW_DROP);
     }
-    /*set the detection bypass flags*/
-    if (f->flags & FLOW_NOPACKET_INSPECTION) {
-        SCLogDebug("setting FLOW_NOPACKET_INSPECTION flag on flow %p", f);
-        DecodeSetNoPacketInspectionFlag(p);
-    }
+
     if (f->flags & FLOW_NOPAYLOAD_INSPECTION) {
         SCLogDebug("setting FLOW_NOPAYLOAD_INSPECTION flag on flow %p", f);
         DecodeSetNoPayloadInspectionFlag(p);
index 53d4c8bb51c6a1428a0af316b01510b86a54998f..3e07ee8e11daf56a6e55bb34fe6397660819bed5 100644 (file)
@@ -60,8 +60,8 @@ typedef struct AppLayerParserState_ AppLayerParserState;
 
 // vacancy bit 4
 
-/** Packet belonging to this flow should not be inspected at all */
-#define FLOW_NOPACKET_INSPECTION        BIT_U32(5)
+// vacancy bit 5
+
 /** Packet payloads belonging to this flow should not be inspected */
 #define FLOW_NOPAYLOAD_INSPECTION       BIT_U32(6)
 
@@ -599,20 +599,6 @@ static inline void *FlowGetAppState(const Flow *f)
     return f->alstate;
 }
 
-/** \brief Set the No Packet Inspection Flag without locking the flow.
- *
- * \param f Flow to set the flag in
- */
-static inline  void FlowSetNoPacketInspectionFlag(Flow *f)
-{
-    SCEnter();
-
-    SCLogDebug("flow %p", f);
-    f->flags |= FLOW_NOPACKET_INSPECTION;
-
-    SCReturn;
-}
-
 /** \brief Set the No payload inspection Flag without locking the flow.
  *
  * \param f Flow to set the flag in
index 0baf2fc82214e55df8686de8cd931d85a4acc8a3..59c8ba31a1de08e14c15d867a0d248ab124dc099 100644 (file)
@@ -4597,7 +4597,6 @@ static int SigTestDropFlow03(void)
     /* Second part.. Let's feed with another packet */
     if (StreamTcpCheckFlowDrops(p2) == 1) {
         SCLogDebug("This flow/stream triggered a drop rule");
-        FlowSetNoPacketInspectionFlag(p2->flow);
         DecodeSetNoPacketInspectionFlag(p2);
         StreamTcpDisableAppLayer(p2->flow);
         p2->action |= ACTION_DROP;
index f467f70f4b253a48012fb08f93c29739f28d5ecd..f6d06add1a9600226282281924a98432d24470bb 100644 (file)
@@ -156,7 +156,6 @@ void ExceptionPolicyApply(Packet *p, enum ExceptionPolicy policy, enum PacketDro
             if (p->flow) {
                 p->flow->flags |= FLOW_ACTION_DROP;
                 FlowSetNoPayloadInspectionFlag(p->flow);
-                FlowSetNoPacketInspectionFlag(p->flow);
                 StreamTcpDisableAppLayer(p->flow);
             }
             /* fall through */
@@ -173,7 +172,6 @@ void ExceptionPolicyApply(Packet *p, enum ExceptionPolicy policy, enum PacketDro
             SCLogDebug("EXCEPTION_POLICY_PASS_FLOW");
             if (p->flow) {
                 p->flow->flags |= FLOW_ACTION_PASS;
-                FlowSetNoPacketInspectionFlag(p->flow); // TODO util func
             }
             /* fall through */
         case EXCEPTION_POLICY_PASS_PACKET: