]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counter: tcp liberal counter
authorVictor Julien <vjulien@oisf.net>
Sun, 28 Nov 2021 19:11:54 +0000 (20:11 +0100)
committerVictor Julien <vjulien@oisf.net>
Mon, 13 Jun 2022 10:58:20 +0000 (12:58 +0200)
src/flow-util.c
src/flow-util.h

index 289caa3e66fc03b1c8c41976a3d0fe0983ea009c..5bb77525985ddfe02d41d53617473b100a8c08ab 100644 (file)
@@ -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);
 }
index 9e11693a0d13fc8c44d1e6940fc91b84ea47a6f2..7ef542ea2668c7532635f8198bdc7014681e7958 100644 (file)
@@ -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]);
 }