]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: take flow pkt & byte count out of debug
authorVictor Julien <victor@inliniac.net>
Wed, 7 May 2014 07:16:46 +0000 (09:16 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 28 Jul 2014 13:47:44 +0000 (15:47 +0200)
Until now the flow packet and byte counters were only available in
DEBUG mode. For logging purposes they are now available always.

src/alert-debuglog.c
src/flow-util.h
src/flow.c
src/flow.h
src/output-json-flow.c

index 944aa7a76ddb1900753d1279516d9824c65eac07..c50a6becdfea05b9554e4dbdfced298dec6899b4 100644 (file)
@@ -216,13 +216,11 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da
         FLOWLOCK_RDLOCK(p->flow);
         CreateTimeString(&p->flow->startts, timebuf, sizeof(timebuf));
         MemBufferWriteString(aft->buffer, "FLOW Start TS:     %s\n", timebuf);
-#ifdef DEBUG
         MemBufferWriteString(aft->buffer, "FLOW PKTS TODST:   %"PRIu32"\n"
                              "FLOW PKTS TOSRC:   %"PRIu32"\n"
                              "FLOW Total Bytes:  %"PRIu64"\n",
                              p->flow->todstpktcnt, p->flow->tosrcpktcnt,
                              p->flow->todstbytecnt + p->flow->tosrcbytecnt);
-#endif
         MemBufferWriteString(aft->buffer,
                              "FLOW IPONLY SET:   TOSERVER: %s, TOCLIENT: %s\n"
                              "FLOW ACTION:       DROP: %s\n"
index df1e588542a16b00c72f57fb8a7968b6ba830224..afa7cf8a9ccc6b84465e0b5df130a07c288fbafc 100644 (file)
 
 #define COPY_TIMESTAMP(src,dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec)
 
-#ifdef DEBUG
 #define RESET_COUNTERS(f) do { \
         (f)->todstpktcnt = 0; \
         (f)->tosrcpktcnt = 0; \
         (f)->todstbytecnt = 0; \
         (f)->tosrcbytecnt = 0; \
     } while (0)
-#else
-#define RESET_COUNTERS(f)
-#endif
 
 #define FLOW_INITIALIZE(f) do { \
         (f)->sp = 0; \
index 728e1225dbe114ceef499892ea27bffcd3c30752..3ba14d7464f0d20126567ba26743785a05e352d6 100644 (file)
@@ -254,23 +254,17 @@ void FlowHandlePacket(ThreadVars *tv, Packet *p)
         if (FlowUpdateSeenFlag(p)) {
             f->flags |= FLOW_TO_DST_SEEN;
         }
-#ifdef DEBUG
         f->todstpktcnt++;
         f->todstbytecnt += GET_PKT_LEN(p);
-#endif
         p->flowflags |= FLOW_PKT_TOSERVER;
     } else {
         if (FlowUpdateSeenFlag(p)) {
             f->flags |= FLOW_TO_SRC_SEEN;
         }
-#ifdef DEBUG
         f->tosrcpktcnt++;
         f->tosrcbytecnt += GET_PKT_LEN(p);
-#endif
         p->flowflags |= FLOW_PKT_TOCLIENT;
     }
-#ifdef DEBUG
-#endif
 
     if ((f->flags & FLOW_TO_DST_SEEN) && (f->flags & FLOW_TO_SRC_SEEN)) {
         SCLogDebug("pkt %p FLOW_PKT_ESTABLISHED", p);
index a51aa369f3d64fe7116b4972832a54da00416226..d1896d2019df9dec5202d484d2b459776ebbf601 100644 (file)
@@ -377,12 +377,11 @@ typedef struct Flow_
     struct Flow_ *lnext; /* list */
     struct Flow_ *lprev;
     struct timeval startts;
-#ifdef DEBUG
+
     uint32_t todstpktcnt;
     uint32_t tosrcpktcnt;
     uint64_t todstbytecnt;
     uint64_t tosrcbytecnt;
-#endif
 } Flow;
 
 enum {
index 5ae39ae8cc089611597f2532f411a5437ca7f7e6..3579bb5e76004ed1740bffbf1015365c6e0f7bb2 100644 (file)
@@ -187,8 +187,6 @@ static void JsonFlowLogJSON(JsonFlowLogThread *aft, json_t *js, Flow *f)
 
     json_object_set_new(hjs, "app_proto", json_string(AppProtoToString(f->alproto)));
 
-    /* debug until we move this out of the debug wrapper in the flow code */
-#ifdef DEBUG
     json_object_set_new(hjs, "pkts_toserver",
             json_integer(f->todstpktcnt));
     json_object_set_new(hjs, "pkts_toclient",
@@ -198,8 +196,6 @@ static void JsonFlowLogJSON(JsonFlowLogThread *aft, json_t *js, Flow *f)
     json_object_set_new(hjs, "bytes_toclient",
             json_integer(f->tosrcbytecnt));
 
-
-#endif
     char timebuf1[64], timebuf2[64];
 
     CreateIsoTimeString(&f->startts, timebuf1, sizeof(timebuf1));