]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag: don't return after a cleaning. 69/head
authorEric Leblond <eric@regit.org>
Thu, 13 Sep 2012 09:57:07 +0000 (11:57 +0200)
committerEric Leblond <eric@regit.org>
Thu, 13 Sep 2012 10:43:12 +0000 (12:43 +0200)
This patch changes the policy of the timeout function by cleaning
every timeouted trackers.
Previous code was only freeing the first tracker and this was resulting
in calling the timeout function continuously. One of my previous patch
has modified the function to avoid to run it more than twice a second.
But as it was not taken into account the fact only the first tracker was
freed, the result was that a lot of tracker could not be allocated.

src/defrag.c

index 0f7bc696ba32fd0931b393096a2d3917fb0286d8..6cd548003ae22452dec26788e41d751d05a86098 100644 (file)
@@ -1012,10 +1012,10 @@ done:
 }
 
 /**
- * \brief Timeout a tracker.
+ * \brief Timeout trackers.
  *
- * Called when we fail to get a tracker from the pool.  The first
- * tracker that has expired will be released back to the pool then the
+ * Called when we fail to get a tracker from the pool.  The trackers
+ * that has expired will be released back to the pool then the
  * function will exit.
  *
  * Intended to be called with the tracker pool already locked.
@@ -1040,6 +1040,7 @@ DefragTimeoutTracker(ThreadVars *tv, DecodeThreadVars *dtv, DefragContext *dc,
     }
     while (next != NULL) {
         tracker = HashListTableGetListData(next);
+        next = HashListTableGetListNext(next);
 
         if (tracker->timeout < (unsigned int)p->ts.tv_sec) {
             int af_family = tracker->af;
@@ -1057,10 +1058,7 @@ DefragTimeoutTracker(ThreadVars *tv, DecodeThreadVars *dtv, DefragContext *dc,
                         tv->sc_perf_pca);
                 }
             }
-            return;
         }
-
-        next = HashListTableGetListNext(next);
     }
 }