]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag: timeout/reuse start of list
authorVictor Julien <vjulien@oisf.net>
Wed, 22 May 2024 10:41:20 +0000 (12:41 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 4 Jun 2024 04:28:26 +0000 (06:28 +0200)
src/defrag-hash.c
src/defrag-timeout.c

index 5c1de9482d8ab40237e2248373572809221ae30f..b342abb23700a98deb06fc7d52735aaa9821b131 100644 (file)
@@ -682,7 +682,7 @@ static DefragTracker *DefragTrackerGetUsedDefragTracker(void)
         if (DRLOCK_TRYLOCK(hb) != 0)
             continue;
 
-        DefragTracker *dt = hb->tail;
+        DefragTracker *dt = hb->head;
         if (dt == NULL) {
             DRLOCK_UNLOCK(hb);
             continue;
index 2d7c96f028ccd0cd04dd03459d49d6e0106952e5..44e57956e0c7f6965e9f6b1007e074190ea8b7d6 100644 (file)
@@ -69,11 +69,11 @@ static uint32_t DefragTrackerHashRowTimeout(
 
     do {
         if (SCMutexTrylock(&dt->lock) != 0) {
-            dt = dt->hprev;
+            dt = dt->hnext;
             continue;
         }
 
-        DefragTracker *next_dt = dt->hprev;
+        DefragTracker *next_dt = dt->hnext;
 
         /* check if the tracker is fully timed out and
          * ready to be discarded. */
@@ -131,13 +131,13 @@ uint32_t DefragTimeoutHash(SCTime_t ts)
 
         /* defrag hash bucket is now locked */
 
-        if (hb->tail == NULL) {
+        if (hb->head == NULL) {
             DRLOCK_UNLOCK(hb);
             continue;
         }
 
         /* we have a tracker, or more than one */
-        cnt += DefragTrackerHashRowTimeout(hb, hb->tail, ts);
+        cnt += DefragTrackerHashRowTimeout(hb, hb->head, ts);
         DRLOCK_UNLOCK(hb);
     }