From: Victor Julien Date: Wed, 22 May 2024 10:41:20 +0000 (+0200) Subject: defrag: timeout/reuse start of list X-Git-Tag: suricata-8.0.0-beta1~1228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26a73503aaf43da89a0efde33be26a41596ac1fc;p=thirdparty%2Fsuricata.git defrag: timeout/reuse start of list --- diff --git a/src/defrag-hash.c b/src/defrag-hash.c index 5c1de9482d..b342abb237 100644 --- a/src/defrag-hash.c +++ b/src/defrag-hash.c @@ -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; diff --git a/src/defrag-timeout.c b/src/defrag-timeout.c index 2d7c96f028..44e57956e0 100644 --- a/src/defrag-timeout.c +++ b/src/defrag-timeout.c @@ -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); }