From e05b6f44e34eebd8bf9eb27f98dafeaa969ce822 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sun, 28 Nov 2021 20:11:54 +0100 Subject: [PATCH] counter: tcp liberal counter --- src/flow-util.c | 1 + src/flow-util.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/flow-util.c b/src/flow-util.c index 289caa3e66..5bb7752598 100644 --- a/src/flow-util.c +++ b/src/flow-util.c @@ -306,4 +306,5 @@ void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec) fec->flow_tcp_state[i] = StatsRegisterCounter(name, t); } + fec->flow_tcp_liberal = StatsRegisterCounter("flow.end.tcp_liberal", t); } diff --git a/src/flow-util.h b/src/flow-util.h index 9e11693a0d..7ef542ea26 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -157,6 +157,7 @@ uint8_t FlowGetReverseProtoMapping(uint8_t rproto); typedef struct FlowEndCounters_ { uint16_t flow_state[FLOW_STATE_SIZE]; uint16_t flow_tcp_state[TCP_CLOSED + 1]; + uint16_t flow_tcp_liberal; } FlowEndCounters; static inline void FlowEndCountersUpdate(ThreadVars *tv, FlowEndCounters *fec, Flow *f) @@ -164,6 +165,9 @@ static inline void FlowEndCountersUpdate(ThreadVars *tv, FlowEndCounters *fec, F if (f->proto == IPPROTO_TCP && f->protoctx != NULL) { TcpSession *ssn = f->protoctx; StatsIncr(tv, fec->flow_tcp_state[ssn->state]); + if (ssn->lossy_be_liberal) { + StatsIncr(tv, fec->flow_tcp_liberal); + } } StatsIncr(tv, fec->flow_state[f->flow_state]); }