]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: remove wrapper func
authorVictor Julien <vjulien@oisf.net>
Thu, 15 Sep 2022 18:07:28 +0000 (20:07 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 1 Oct 2022 18:14:45 +0000 (20:14 +0200)
src/detect-engine-state.c
src/detect-engine-state.h
src/detect.c

index aef8133639b6e110336ccee972bfc5fdf5c0dda2..0a1a3b30f13e16902fb1e448a38383ce986221c0 100644 (file)
@@ -246,25 +246,6 @@ void DetectRunStoreStateTx(
     SCLogDebug("Stored for TX %"PRIu64, tx_id);
 }
 
-/** \brief update flow's inspection id's
- *
- *  \param f unlocked flow
- *  \param flags direction and disruption flags
- *  \param tag_txs_as_inspected if true all 'complete' txs will be marked
- *                              'inspected'
- *
- *  \note it is possible that f->alstate, f->alparser are NULL */
-void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags,
-        const bool tag_txs_as_inspected)
-{
-    if (f->alparser && f->alstate) {
-        AppLayerParserSetTransactionInspectId(f, f->alparser,
-                                              f->alstate, flags,
-                                              tag_txs_as_inspected);
-    }
-    return;
-}
-
 static inline void ResetTxState(DetectEngineState *s)
 {
     if (s) {
index 3dc86847aa23135004fde08df398bc9d3df376ec..d6265b3a9bab09a8ff77a7149fe95b0e3f5132f8 100644 (file)
@@ -108,15 +108,6 @@ DetectEngineState *DetectEngineStateAlloc(void);
  */
 void DetectEngineStateFree(DetectEngineState *state);
 
-/**
- *  \brief Update the inspect id.
- *
- *  \param f unlocked flow
- *  \param flags direction and disruption flags
- */
-void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags,
-        const bool tag_txs_as_inspected);
-
 void DetectEngineStateResetTxs(Flow *f);
 
 void DeStateRegisterTests(void);
index 7b469ed05e0a7289ee4d2da85a660c7dc78765ad..6b6699ca6a559808ac2272eb50b42e99eccb2f0a 100644 (file)
@@ -921,7 +921,8 @@ static inline void DetectRunPostRules(
     /* see if we need to increment the inspect_id and reset the de_state */
     if (pflow && pflow->alstate) {
         PACKET_PROFILING_DETECT_START(p, PROF_DETECT_TX_UPDATE);
-        DeStateUpdateInspectTransactionId(pflow, scratch->flow_flags, (scratch->sgh == NULL));
+        AppLayerParserSetTransactionInspectId(pflow, pflow->alparser, pflow->alstate,
+                scratch->flow_flags, (scratch->sgh == NULL));
         PACKET_PROFILING_DETECT_END(p, PROF_DETECT_TX_UPDATE);
     }
 
@@ -1661,20 +1662,19 @@ static void DetectFlow(ThreadVars *tv,
                        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
                        Packet *p)
 {
+    Flow *const f = p->flow;
+
     if (p->flags & PKT_NOPACKET_INSPECTION) {
         /* 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 = ((p->flow->flags & FLOW_NOPACKET_INSPECTION));
+        const int pass = ((f->flags & FLOW_NOPACKET_INSPECTION));
         if (pass) {
-            uint8_t flags;
-            if (p->flowflags & FLOW_PKT_TOSERVER) {
-                flags = STREAM_TOSERVER;
-            } else {
-                flags = STREAM_TOCLIENT;
+            uint8_t flags = STREAM_FLAGS_FOR_PACKET(p);
+            flags = FlowGetDisruptionFlags(f, flags);
+            if (f->alstate) {
+                AppLayerParserSetTransactionInspectId(f, f->alparser, f->alstate, flags, true);
             }
-            flags = FlowGetDisruptionFlags(p->flow, flags);
-            DeStateUpdateInspectTransactionId(p->flow, flags, true);
         }
         SCLogDebug("p->pcap %"PRIu64": no detection on packet, "
                 "PKT_NOPACKET_INSPECTION is set", p->pcap_cnt);
@@ -1682,7 +1682,7 @@ static void DetectFlow(ThreadVars *tv,
     }
 
     /* if flow is set to drop, we enforce that here */
-    if (p->flow->flags & FLOW_ACTION_DROP) {
+    if (f->flags & FLOW_ACTION_DROP) {
         PacketDrop(p, ACTION_DROP, PKT_DROP_REASON_FLOW_DROP);
         SCReturn;
     }