]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/threshold: minor code cleanup
authorVictor Julien <vjulien@oisf.net>
Tue, 9 Jan 2024 15:39:22 +0000 (16:39 +0100)
committerVictor Julien <vjulien@oisf.net>
Fri, 28 Jun 2024 07:44:28 +0000 (09:44 +0200)
Packet pointer is not used during allocation.

src/detect-engine-threshold.c

index 220330828880db6c3b739127fed728b6d8383c72..36655983cfcb25cc83f02e54b158f99f7496520b 100644 (file)
@@ -421,9 +421,8 @@ int ThresholdIPPairTimeoutCheck(IPPair *pair, SCTime_t ts)
     return new_head == NULL;
 }
 
-static DetectThresholdEntry *
-DetectThresholdEntryAlloc(const DetectThresholdData *td, Packet *p,
-                          uint32_t sid, uint32_t gid)
+static DetectThresholdEntry *DetectThresholdEntryAlloc(
+        const DetectThresholdData *td, uint32_t sid, uint32_t gid)
 {
     SCEnter();
 
@@ -701,7 +700,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
                     ret = 1;
                 }
             } else {
-                *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid);
+                *new_tsh = DetectThresholdEntryAlloc(td, sid, gid);
 
                 ret = 1;
             }
@@ -728,7 +727,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
                 if (td->count == 1)  {
                     ret = 1;
                 } else {
-                    *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid);
+                    *new_tsh = DetectThresholdEntryAlloc(td, sid, gid);
                 }
             }
             break;
@@ -764,7 +763,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
                     }
                 }
             } else {
-                *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid);
+                *new_tsh = DetectThresholdEntryAlloc(td, sid, gid);
 
                 /* for the first match we return 1 to
                  * indicate we should alert */
@@ -793,7 +792,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
                     lookup_tsh->current_count = 1;
                 }
             } else {
-                *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid);
+                *new_tsh = DetectThresholdEntryAlloc(td, sid, gid);
             }
             break;
         }
@@ -805,7 +804,7 @@ static int ThresholdHandlePacket(Packet *p, DetectThresholdEntry *lookup_tsh,
             if (lookup_tsh && IsThresholdReached(lookup_tsh, td, p->ts)) {
                 RateFilterSetAction(p, pa, td->new_action);
             } else if (!lookup_tsh) {
-                *new_tsh = DetectThresholdEntryAlloc(td, p, sid, gid);
+                *new_tsh = DetectThresholdEntryAlloc(td, sid, gid);
             }
             break;
         }