flow: take flow pkt & byte count out of debug

Until now the flow packet and byte counters were only available in
DEBUG mode. For logging purposes they are now available always.
pull/1058/head
Victor Julien 12 years ago
parent e6ee5feaba
commit bd490736c2

@ -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"

@ -29,16 +29,12 @@
#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; \

@ -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);

@ -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 {

@ -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));

Loading…
Cancel
Save