]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
defrag: don't use message for repetitive error 68/head
authorEric Leblond <eric@regit.org>
Sun, 9 Sep 2012 20:48:46 +0000 (22:48 +0200)
committerEric Leblond <eric@regit.org>
Mon, 10 Sep 2012 16:11:26 +0000 (18:11 +0200)
When nothing can be fetch from the pool, this can repeat frequently.
Thus displaying a message in the log will not help. This patch
uses a counter instead of a log message. As this is a sort of memcap
this is conformed to what is done for other issues of the same type.

src/decode.c
src/decode.h
src/defrag.c

index 4bdd287587891b0defa014f910b8601968650e13..a6b5548ff92bcf3348b21d2e99e1a5aa0e864ebc 100644 (file)
@@ -357,6 +357,9 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
     dtv->counter_defrag_ipv6_timeouts =
         SCPerfTVRegisterCounter("defrag.ipv6.timeouts", tv,
             SC_PERF_TYPE_UINT64, "NULL");
+    dtv->counter_defrag_max_hit =
+        SCPerfTVRegisterCounter("defrag.max_frag_hits", tv,
+            SC_PERF_TYPE_UINT64, "NULL");
 
     tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
     SCPerfAddToClubbedTMTable(tv->name, &tv->sc_perf_pctx);
index eb62bcd341def08db6c87be1e1823122eb909ad7..035f25c474f7fa859a1f466dd391d55e86544c71 100644 (file)
@@ -564,6 +564,7 @@ typedef struct DecodeThreadVars_
     uint16_t counter_defrag_ipv6_fragments;
     uint16_t counter_defrag_ipv6_reassembled;
     uint16_t counter_defrag_ipv6_timeouts;
+    uint16_t counter_defrag_max_hit;
 } DecodeThreadVars;
 
 /**
index 99a320a8489ae2211eb2020a933cbdadd2d2d393..729f884407b893f668293e3df0daf14bb4dfd080 100644 (file)
@@ -1133,8 +1133,8 @@ DefragGetTracker(ThreadVars *tv, DecodeThreadVars *dtv, DefragContext *dc,
         }
         SCMutexUnlock(&dc->tracker_pool_lock);
         if (tracker == NULL) {
-            /* Report memory error - actually a pool allocation error. */
-            SCLogError(SC_ERR_MEM_ALLOC, "Defrag: Failed to allocate tracker.");
+            SCPerfCounterIncr(dtv->counter_defrag_max_hit,
+                tv->sc_perf_pca);
             goto done;
         }
         DefragTrackerReset(tracker);