mirror of
https://github.com/OISF/suricata.git
synced 2026-10-11 22:09:53 +00:00
counters: regular counter Incr API update
This commit is contained in:
@@ -682,7 +682,7 @@ TmEcode DecodePfring(ThreadVars *tv, Packet *p, void *data)
|
||||
|
||||
/* If suri has set vlan during reading, we increase vlan counter */
|
||||
if (p->vlan_idx) {
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
}
|
||||
|
||||
DecodeEthernet(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p));
|
||||
|
||||
+7
-7
@@ -150,7 +150,7 @@ static void AppLayerIncFlowCounter(ThreadVars *tv, Flow *f)
|
||||
{
|
||||
const StatsCounterId id = applayer_counters[f->alproto][f->protomap].counter_id;
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void AppLayerIncGapErrorCounter(ThreadVars *tv, Flow *f)
|
||||
{
|
||||
const StatsCounterId id = applayer_counters[f->alproto][f->protomap].gap_error_id;
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void AppLayerIncAllocErrorCounter(ThreadVars *tv, Flow *f)
|
||||
{
|
||||
const StatsCounterId id = applayer_counters[f->alproto][f->protomap].alloc_error_id;
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void AppLayerIncParserErrorCounter(ThreadVars *tv, Flow *f)
|
||||
{
|
||||
const StatsCounterId id = applayer_counters[f->alproto][f->protomap].parser_error_id;
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void AppLayerIncInternalErrorCounter(ThreadVars *tv, Flow *f)
|
||||
{
|
||||
const StatsCounterId id = applayer_counters[f->alproto][f->protomap].internal_error_id;
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,10 +206,10 @@ static void AppLayerIncrErrorExcPolicyCounter(ThreadVars *tv, Flow *f, enum Exce
|
||||
StatsCounterId g_id = eps_error_summary.eps_id[policy];
|
||||
|
||||
if (likely(id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
if (likely(g_id.id > 0)) {
|
||||
StatsIncr(tv, g_id);
|
||||
StatsCounterIncr(&tv->stats, g_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -162,9 +162,9 @@ void StatsCounterAddI64(StatsThreadContext *stats, StatsCounterId id, int64_t x)
|
||||
* \param id Index of the counter in the counter array
|
||||
* \param pca Counter array that holds the local counters for this TM
|
||||
*/
|
||||
void StatsIncr(ThreadVars *tv, StatsCounterId id)
|
||||
void StatsCounterIncr(StatsThreadContext *stats, StatsCounterId id)
|
||||
{
|
||||
StatsPrivateThreadContext *pca = &tv->stats.priv;
|
||||
StatsPrivateThreadContext *pca = &stats->priv;
|
||||
#if defined (UNITTESTS) || defined (FUZZ)
|
||||
if (pca->initialized == 0)
|
||||
return;
|
||||
@@ -1473,8 +1473,8 @@ static int StatsTestCntArraySize07(void)
|
||||
StatsGetAllCountersArray(&tv.stats.pub, &tv.stats.priv);
|
||||
pca = &tv.stats.priv;
|
||||
|
||||
StatsIncr(&tv, id1);
|
||||
StatsIncr(&tv, id2);
|
||||
StatsCounterIncr(&tv.stats, id1);
|
||||
StatsCounterIncr(&tv.stats, id2);
|
||||
|
||||
FAIL_IF_NOT(pca->size == 3);
|
||||
|
||||
@@ -1492,7 +1492,7 @@ static int StatsTestUpdateCounter08(void)
|
||||
StatsGetAllCountersArray(&tv.stats.pub, &tv.stats.priv);
|
||||
StatsPrivateThreadContext *pca = &tv.stats.priv;
|
||||
|
||||
StatsIncr(&tv, c1);
|
||||
StatsCounterIncr(&tv.stats, c1);
|
||||
StatsCounterAddI64(&tv.stats, c1, 100);
|
||||
FAIL_IF_NOT(pca->head[c1.id].v == 101);
|
||||
|
||||
@@ -1516,7 +1516,7 @@ static int StatsTestUpdateCounter09(void)
|
||||
StatsGetAllCountersArray(&tv.stats.pub, &tv.stats.priv);
|
||||
StatsPrivateThreadContext *pca = &tv.stats.priv;
|
||||
|
||||
StatsIncr(&tv, c5);
|
||||
StatsCounterIncr(&tv.stats, c5);
|
||||
StatsCounterAddI64(&tv.stats, c5, 100);
|
||||
|
||||
FAIL_IF_NOT(pca->head[c1.id].v == 0);
|
||||
@@ -1540,9 +1540,9 @@ static int StatsTestUpdateGlobalCounter10(void)
|
||||
StatsGetAllCountersArray(&tv.stats.pub, &tv.stats.priv);
|
||||
StatsPrivateThreadContext *pca = &tv.stats.priv;
|
||||
|
||||
StatsIncr(&tv, c1);
|
||||
StatsCounterIncr(&tv.stats, c1);
|
||||
StatsCounterAddI64(&tv.stats, c2, 100);
|
||||
StatsIncr(&tv, c3);
|
||||
StatsCounterIncr(&tv.stats, c3);
|
||||
StatsCounterAddI64(&tv.stats, c3, 100);
|
||||
|
||||
StatsUpdateCounterArray(pca, &tv.stats.pub);
|
||||
@@ -1570,7 +1570,7 @@ static int StatsTestCounterValues11(void)
|
||||
StatsGetAllCountersArray(&tv.stats.pub, &tv.stats.priv);
|
||||
StatsPrivateThreadContext *pca = &tv.stats.priv;
|
||||
|
||||
StatsIncr(&tv, c1);
|
||||
StatsCounterIncr(&tv.stats, c1);
|
||||
StatsCounterAddI64(&tv.stats, c2, 256);
|
||||
StatsCounterAddI64(&tv.stats, c3, 257);
|
||||
StatsCounterAddI64(&tv.stats, c4, 16843024);
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ StatsCounterGlobalId StatsRegisterGlobalCounter(const char *cname, uint64_t (*Fu
|
||||
/* functions used to update local counter values */
|
||||
void StatsCounterAddI64(StatsThreadContext *, StatsCounterId, int64_t);
|
||||
void StatsCounterSetI64(StatsThreadContext *, StatsCounterId, int64_t);
|
||||
void StatsIncr(struct ThreadVars_ *, StatsCounterId);
|
||||
void StatsCounterIncr(StatsThreadContext *, StatsCounterId);
|
||||
void StatsDecr(struct ThreadVars_ *, StatsCounterId);
|
||||
|
||||
void StatsCounterMaxUpdateI64(StatsThreadContext *, StatsCounterMaxId id, int64_t x);
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
int DecodeARP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_arp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_arp);
|
||||
|
||||
if (unlikely(len < ARP_HEADER_MIN_LEN)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, ARP_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ int DecodeCHDLC(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_chdlc);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_chdlc);
|
||||
|
||||
if (unlikely(len < CHDLC_HEADER_LEN)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, CHDLC_PKT_TOO_SMALL);
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ void DecodeERSPANConfig(void)
|
||||
int DecodeERSPANTypeI(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
const uint8_t *pkt, uint32_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_erspan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_erspan);
|
||||
|
||||
return DecodeEthernet(tv, dtv, p, pkt, len);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ int DecodeERSPAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_erspan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_erspan);
|
||||
|
||||
if (len < sizeof(ErspanHdr)) {
|
||||
ENGINE_SET_EVENT(p,ERSPAN_HEADER_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ int DecodeESP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_esp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_esp);
|
||||
|
||||
if (!PacketIncreaseCheckLayers(p)) {
|
||||
return TM_ECODE_FAILED;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ int DecodeETag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_etag);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_etag);
|
||||
|
||||
if (len < ETAG_HEADER_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, ETAG_HEADER_TOO_SMALL);
|
||||
|
||||
@@ -44,7 +44,7 @@ int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_eth);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_eth);
|
||||
|
||||
if (unlikely(len < ETHERNET_HEADER_LEN)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, ETHERNET_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ int DecodeGeneve(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t
|
||||
#endif
|
||||
|
||||
/* Increment stats counter for Geneve packets */
|
||||
StatsIncr(tv, dtv->counter_geneve);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_geneve);
|
||||
|
||||
/* Determine first protocol encapsulated after Geneve header */
|
||||
eth_type = SCNtohs(geneve_hdr->eth_type);
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ int DecodeGRE(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
|
||||
GRESreHdr *gsre = NULL;
|
||||
GREPPtPHd *gre_pptp_h = NULL;
|
||||
|
||||
StatsIncr(tv, dtv->counter_gre);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_gre);
|
||||
|
||||
if(len < GRE_HDR_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, GRE_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ static int DecodePartialIPV4(Packet* p, uint8_t* partial_packet, uint16_t len)
|
||||
*/
|
||||
int DecodeICMPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_icmpv4);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_icmpv4);
|
||||
|
||||
if (len < ICMPV4_HEADER_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, ICMPV4_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ int DecodeICMPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
const IPV6Hdr *ip6h = PacketGetIPv6(p);
|
||||
int full_hdr = 0;
|
||||
StatsIncr(tv, dtv->counter_icmpv6);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_icmpv6);
|
||||
|
||||
if (len < ICMPV6_HEADER_LEN) {
|
||||
SCLogDebug("ICMPV6_PKT_TOO_SMALL");
|
||||
|
||||
+3
-3
@@ -515,7 +515,7 @@ static const IPV4Hdr *DecodeIPV4Packet(Packet *p, const uint8_t *pkt, uint16_t l
|
||||
int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
const uint8_t *pkt, uint16_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_ipv4);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv4);
|
||||
|
||||
SCLogDebug("pkt %p len %"PRIu16"", pkt, len);
|
||||
|
||||
@@ -586,7 +586,7 @@ int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
if (tp != NULL) {
|
||||
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV4);
|
||||
PacketEnqueueNoLock(&tv->decode_pq, tp);
|
||||
StatsIncr(tv, dtv->counter_ipv6inipv4);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv6inipv4);
|
||||
}
|
||||
FlowSetupPacket(p);
|
||||
break;
|
||||
@@ -597,7 +597,7 @@ int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
if (tp != NULL) {
|
||||
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV4);
|
||||
PacketEnqueueNoLock(&tv->decode_pq, tp);
|
||||
StatsIncr(tv, dtv->counter_ipv4inipv4);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv4inipv4);
|
||||
}
|
||||
FlowSetupPacket(p);
|
||||
break;
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ static void DecodeIPv4inIPv6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, c
|
||||
if (tp != NULL) {
|
||||
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
|
||||
PacketEnqueueNoLock(&tv->decode_pq,tp);
|
||||
StatsIncr(tv, dtv->counter_ipv4inipv6);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv4inipv6);
|
||||
}
|
||||
FlowSetupPacket(p);
|
||||
} else {
|
||||
@@ -79,7 +79,7 @@ static int DecodeIP6inIP6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
if (tp != NULL) {
|
||||
PKT_SET_SRC(tp, PKT_SRC_DECODER_IPV6);
|
||||
PacketEnqueueNoLock(&tv->decode_pq,tp);
|
||||
StatsIncr(tv, dtv->counter_ipv6inipv6);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv6inipv6);
|
||||
}
|
||||
FlowSetupPacket(p);
|
||||
} else {
|
||||
@@ -548,7 +548,7 @@ static const IPV6Hdr *DecodeIPV6Packet(
|
||||
|
||||
int DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint16_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_ipv6);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ipv6);
|
||||
|
||||
if (!PacketIncreaseCheckLayers(p)) {
|
||||
return TM_ECODE_FAILED;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ int DecodeMPLS(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
int label;
|
||||
uint8_t event = 0;
|
||||
|
||||
StatsIncr(tv, dtv->counter_mpls);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_mpls);
|
||||
|
||||
if (!PacketIncreaseCheckLayers(p)) {
|
||||
return TM_ECODE_FAILED;
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ int DecodeNSH(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_nsh);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_nsh);
|
||||
|
||||
/* Check minimum header size */
|
||||
if (len < sizeof(NshHdr)) {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ int DecodeNull(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_null);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_null);
|
||||
|
||||
if (unlikely(len < HDR_SIZE)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, LTNULL_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_ppp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ppp);
|
||||
if (unlikely(len < 1)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, PPP_PKT_TOO_SMALL);
|
||||
return TM_ECODE_FAILED;
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ int DecodePPPOEDiscovery(
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_pppoe);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_pppoe);
|
||||
|
||||
if (len < PPPOE_DISCOVERY_HEADER_MIN_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);
|
||||
@@ -124,7 +124,7 @@ int DecodePPPOESession(
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_pppoe);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_pppoe);
|
||||
|
||||
if (len < PPPOE_SESSION_HEADER_MIN_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, PPPOE_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ int DecodeRaw(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_raw);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_raw);
|
||||
|
||||
/* If it is ipv4 or ipv6 it should at least be the size of ipv4 */
|
||||
if (unlikely(len < IPV4_HEADER_LEN)) {
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ static int DecodeSCTPPacket(ThreadVars *tv, Packet *p, const uint8_t *pkt, uint1
|
||||
int DecodeSCTP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
const uint8_t *pkt, uint16_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_sctp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_sctp);
|
||||
|
||||
if (unlikely(DecodeSCTPPacket(tv, p,pkt,len) < 0)) {
|
||||
PacketClearL4(p);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ int DecodeSll(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_sll);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_sll);
|
||||
|
||||
if (unlikely(len < SLL_HEADER_LEN)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, SLL_PKT_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ int DecodeSll2(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_sll2);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_sll2);
|
||||
|
||||
if (unlikely(len < SLL2_HEADER_LEN)) {
|
||||
ENGINE_SET_INVALID_EVENT(p, SLL2_PKT_TOO_SMALL);
|
||||
|
||||
+5
-5
@@ -250,15 +250,15 @@ static int DecodeTCPPacket(
|
||||
|
||||
/* update counters */
|
||||
if ((tcph->th_flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK)) {
|
||||
StatsIncr(tv, dtv->counter_tcp_synack);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_tcp_synack);
|
||||
} else if (tcph->th_flags & (TH_SYN)) {
|
||||
StatsIncr(tv, dtv->counter_tcp_syn);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_tcp_syn);
|
||||
}
|
||||
if (tcph->th_flags & (TH_RST)) {
|
||||
StatsIncr(tv, dtv->counter_tcp_rst);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_tcp_rst);
|
||||
}
|
||||
if (tcph->th_flags & (TH_URG)) {
|
||||
StatsIncr(tv, dtv->counter_tcp_urg);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_tcp_urg);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -272,7 +272,7 @@ static int DecodeTCPPacket(
|
||||
|
||||
int DecodeTCP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint16_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_tcp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_tcp);
|
||||
|
||||
if (unlikely(DecodeTCPPacket(tv, dtv, p, pkt, len) < 0)) {
|
||||
SCLogDebug("invalid TCP packet");
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
PKT_SET_SRC(tp, PKT_SRC_DECODER_TEREDO);
|
||||
/* add the tp to the packet queue. */
|
||||
PacketEnqueueNoLock(&tv->decode_pq,tp);
|
||||
StatsIncr(tv, dtv->counter_teredo);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_teredo);
|
||||
return TM_ECODE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ static int DecodeUDPPacket(ThreadVars *t, Packet *p, const uint8_t *pkt, uint16_
|
||||
int DecodeUDP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
const uint8_t *pkt, uint16_t len)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_udp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_udp);
|
||||
|
||||
if (unlikely(DecodeUDPPacket(tv, p, pkt,len) < 0)) {
|
||||
PacketClearL4(p);
|
||||
|
||||
+4
-4
@@ -59,11 +59,11 @@ int DecodeVLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
uint16_t proto;
|
||||
|
||||
if (p->vlan_idx == 0)
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
else if (p->vlan_idx == 1)
|
||||
StatsIncr(tv, dtv->counter_vlan_qinq);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan_qinq);
|
||||
else if (p->vlan_idx == 2)
|
||||
StatsIncr(tv, dtv->counter_vlan_qinqinq);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan_qinqinq);
|
||||
|
||||
if(len < VLAN_HEADER_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, VLAN_HEADER_TOO_SMALL);
|
||||
@@ -108,7 +108,7 @@ int DecodeIEEE8021ah(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_ieee8021ah);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ieee8021ah);
|
||||
|
||||
if (len < IEEE8021AH_HEADER_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, IEEE8021AH_HEADER_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ int DecodeVNTag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t
|
||||
{
|
||||
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
|
||||
|
||||
StatsIncr(tv, dtv->counter_vntag);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vntag);
|
||||
|
||||
if (len < VNTAG_HEADER_LEN) {
|
||||
ENGINE_SET_INVALID_EVENT(p, VNTAG_HEADER_TOO_SMALL);
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ int DecodeVXLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
|
||||
#endif
|
||||
|
||||
/* Increment stats counter for VXLAN packets */
|
||||
StatsIncr(tv, dtv->counter_vxlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vxlan);
|
||||
|
||||
EthernetHdr *ethh = (EthernetHdr *)(pkt + VXLAN_HEADER_LEN);
|
||||
int decode_tunnel_proto = DECODE_TUNNEL_UNSET;
|
||||
|
||||
+8
-9
@@ -236,7 +236,7 @@ void PacketFree(Packet *p)
|
||||
void PacketDecodeFinalize(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
|
||||
{
|
||||
if (p->flags & PKT_IS_INVALID) {
|
||||
StatsIncr(tv, dtv->counter_invalid);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_invalid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ void PacketUpdateEngineEventCounters(ThreadVars *tv,
|
||||
continue;
|
||||
else if (e > DECODE_EVENT_PACKET_MAX && !stats_stream_events)
|
||||
continue;
|
||||
StatsIncr(tv, dtv->counter_engine_events[e]);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_engine_events[e]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,8 +775,7 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
|
||||
void DecodeUpdatePacketCounters(ThreadVars *tv,
|
||||
const DecodeThreadVars *dtv, const Packet *p)
|
||||
{
|
||||
StatsIncr(tv, dtv->counter_pkts);
|
||||
//StatsIncr(tv, dtv->counter_pkts_per_sec);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_pkts);
|
||||
StatsCounterAddI64(&tv->stats, dtv->counter_bytes, GET_PKT_LEN(p));
|
||||
StatsCounterAvgAddI64(&tv->stats, dtv->counter_avg_pkt_size, GET_PKT_LEN(p));
|
||||
StatsCounterMaxUpdateI64(&tv->stats, dtv->counter_max_pkt_size, GET_PKT_LEN(p));
|
||||
@@ -1023,16 +1022,16 @@ void CaptureStatsUpdate(ThreadVars *tv, const Packet *p)
|
||||
|
||||
CaptureStats *s = &t_capture_stats;
|
||||
if (unlikely(PacketCheckAction(p, ACTION_REJECT_ANY))) {
|
||||
StatsIncr(tv, s->counter_ips_rejected);
|
||||
StatsCounterIncr(&tv->stats, s->counter_ips_rejected);
|
||||
} else if (unlikely(PacketCheckAction(p, ACTION_DROP))) {
|
||||
StatsIncr(tv, s->counter_ips_blocked);
|
||||
StatsCounterIncr(&tv->stats, s->counter_ips_blocked);
|
||||
} else if (unlikely(p->flags & PKT_STREAM_MODIFIED)) {
|
||||
StatsIncr(tv, s->counter_ips_replaced);
|
||||
StatsCounterIncr(&tv->stats, s->counter_ips_replaced);
|
||||
} else {
|
||||
StatsIncr(tv, s->counter_ips_accepted);
|
||||
StatsCounterIncr(&tv->stats, s->counter_ips_accepted);
|
||||
}
|
||||
if (p->drop_reason != PKT_DROP_REASON_NOT_SET) {
|
||||
StatsIncr(tv, s->counter_drop_reason[p->drop_reason]);
|
||||
StatsCounterIncr(&tv->stats, s->counter_drop_reason[p->drop_reason]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1512,7 +1512,7 @@ static inline bool DecodeNetworkLayer(ThreadVars *tv, DecodeThreadVars *dtv,
|
||||
break;
|
||||
default:
|
||||
SCLogDebug("unknown ether type: %" PRIx16 "", proto);
|
||||
StatsIncr(tv, dtv->counter_ethertype_unknown);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_ethertype_unknown);
|
||||
ENGINE_SET_EVENT(p, ETHERNET_UNKNOWN_ETHERTYPE);
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-4
@@ -454,7 +454,7 @@ static void DefragExceptionPolicyStatsIncr(
|
||||
{
|
||||
StatsCounterId id = dtv->counter_defrag_memcap_eps.eps_id[policy];
|
||||
if (likely(id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ DefragTracker *DefragGetTrackerFromHash(ThreadVars *tv, DecodeThreadVars *dtv, P
|
||||
SCMutexUnlock(&dt->lock);
|
||||
|
||||
DefragTrackerMoveToSpare(dt);
|
||||
StatsIncr(tv, dtv->counter_defrag_tracker_timeout);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_tracker_timeout);
|
||||
goto tracker_removed;
|
||||
} else if (!dt->remove && DefragTrackerCompare(dt, p)) {
|
||||
/* found our tracker, keep locked & return */
|
||||
@@ -715,9 +715,9 @@ static DefragTracker *DefragTrackerGetUsedDefragTracker(ThreadVars *tv, const De
|
||||
SCMutexUnlock(&dt->lock);
|
||||
|
||||
if (incr_reuse_cnt) {
|
||||
StatsIncr(tv, dtv->counter_defrag_tracker_hard_reuse);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_tracker_hard_reuse);
|
||||
} else {
|
||||
StatsIncr(tv, dtv->counter_defrag_tracker_soft_reuse);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_tracker_soft_reuse);
|
||||
}
|
||||
|
||||
(void) SC_ATOMIC_ADD(defragtracker_prune_idx, (defrag_config.hash_size - cnt));
|
||||
|
||||
+6
-6
@@ -872,7 +872,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
|
||||
ENGINE_SET_EVENT(p, IPV6_FRAG_IGNORED);
|
||||
}
|
||||
if (tv != NULL && dtv != NULL) {
|
||||
StatsIncr(tv, dtv->counter_defrag_no_frags);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_no_frags);
|
||||
}
|
||||
goto error_remove_tracker;
|
||||
}
|
||||
@@ -925,7 +925,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
|
||||
if (tracker->af == AF_INET) {
|
||||
r = Defrag4Reassemble(tv, tracker, p);
|
||||
if (r != NULL && tv != NULL && dtv != NULL) {
|
||||
StatsIncr(tv, dtv->counter_defrag_ipv4_reassembled);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_ipv4_reassembled);
|
||||
const uint32_t len = GET_PKT_LEN(r) - (uint32_t)tracker->ip_hdr_offset;
|
||||
DEBUG_VALIDATE_BUG_ON(len > UINT16_MAX);
|
||||
if (DecodeIPV4(tv, dtv, r, GET_PKT_DATA(r) + tracker->ip_hdr_offset,
|
||||
@@ -941,7 +941,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
|
||||
else if (tracker->af == AF_INET6) {
|
||||
r = Defrag6Reassemble(tv, tracker, p);
|
||||
if (r != NULL && tv != NULL && dtv != NULL) {
|
||||
StatsIncr(tv, dtv->counter_defrag_ipv6_reassembled);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_ipv6_reassembled);
|
||||
const uint32_t len = GET_PKT_LEN(r) - (uint32_t)tracker->ip_hdr_offset;
|
||||
DEBUG_VALIDATE_BUG_ON(len > UINT16_MAX);
|
||||
if (DecodeIPV6(tv, dtv, r, GET_PKT_DATA(r) + tracker->ip_hdr_offset,
|
||||
@@ -1085,16 +1085,16 @@ Defrag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
|
||||
}
|
||||
|
||||
if (af == AF_INET) {
|
||||
StatsIncr(tv, dtv->counter_defrag_ipv4_fragments);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_ipv4_fragments);
|
||||
} else if (af == AF_INET6) {
|
||||
StatsIncr(tv, dtv->counter_defrag_ipv6_fragments);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_ipv6_fragments);
|
||||
}
|
||||
|
||||
/* return a locked tracker or NULL */
|
||||
tracker = DefragGetTracker(tv, dtv, p);
|
||||
if (tracker == NULL) {
|
||||
if (tv != NULL && dtv != NULL) {
|
||||
StatsIncr(tv, dtv->counter_defrag_max_hit);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_defrag_max_hit);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+4
-4
@@ -180,13 +180,13 @@ static int DetectLuaRunMatch(
|
||||
SCLuaSbState *context = SCLuaSbGetContext(tlua->luastate);
|
||||
uint32_t flag = 0;
|
||||
if (context->blocked_function_error) {
|
||||
StatsIncr(det_ctx->tv, det_ctx->lua_blocked_function_errors);
|
||||
StatsCounterIncr(&det_ctx->tv->stats, det_ctx->lua_blocked_function_errors);
|
||||
flag = FLAG_BLOCKED_FUNCTION_LOGGED;
|
||||
} else if (context->instruction_count_error) {
|
||||
StatsIncr(det_ctx->tv, det_ctx->lua_instruction_limit_errors);
|
||||
StatsCounterIncr(&det_ctx->tv->stats, det_ctx->lua_instruction_limit_errors);
|
||||
flag = FLAG_INSTRUCTION_LIMIT_LOGGED;
|
||||
} else if (context->memory_limit_error) {
|
||||
StatsIncr(det_ctx->tv, det_ctx->lua_memory_limit_errors);
|
||||
StatsCounterIncr(&det_ctx->tv->stats, det_ctx->lua_memory_limit_errors);
|
||||
reason = "memory limit exceeded";
|
||||
flag = FLAG_MEMORY_LIMIT_LOGGED;
|
||||
} else {
|
||||
@@ -200,7 +200,7 @@ static int DetectLuaRunMatch(
|
||||
tlua->flags |= flag;
|
||||
}
|
||||
|
||||
StatsIncr(det_ctx->tv, det_ctx->lua_rule_errors);
|
||||
StatsCounterIncr(&det_ctx->tv->stats, det_ctx->lua_rule_errors);
|
||||
while (lua_gettop(tlua->luastate) > 0) {
|
||||
lua_pop(tlua->luastate, 1);
|
||||
}
|
||||
|
||||
+15
-15
@@ -588,20 +588,20 @@ static inline void FlowUpdateCounter(ThreadVars *tv, DecodeThreadVars *dtv,
|
||||
#ifdef UNITTESTS
|
||||
if (tv && dtv) {
|
||||
#endif
|
||||
StatsIncr(tv, dtv->counter_flow_total);
|
||||
StatsIncr(tv, dtv->counter_flow_active);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_total);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_active);
|
||||
switch (proto){
|
||||
case IPPROTO_UDP:
|
||||
StatsIncr(tv, dtv->counter_flow_udp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_udp);
|
||||
break;
|
||||
case IPPROTO_TCP:
|
||||
StatsIncr(tv, dtv->counter_flow_tcp);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_tcp);
|
||||
break;
|
||||
case IPPROTO_ICMP:
|
||||
StatsIncr(tv, dtv->counter_flow_icmp4);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_icmp4);
|
||||
break;
|
||||
case IPPROTO_ICMPV6:
|
||||
StatsIncr(tv, dtv->counter_flow_icmp6);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_icmp6);
|
||||
break;
|
||||
}
|
||||
#ifdef UNITTESTS
|
||||
@@ -646,12 +646,12 @@ static inline Flow *FlowSpareSync(ThreadVars *tv, FlowLookupStruct *fls,
|
||||
* so there should be 99 left if we're in full sync.
|
||||
* If len is below 99, means the spare sync is incomplete */
|
||||
/* Track these instances */
|
||||
StatsIncr(tv, fls->dtv->counter_flow_spare_sync_incomplete);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_spare_sync_incomplete);
|
||||
}
|
||||
} else if (fls->spare_queue.len == 0) {
|
||||
StatsIncr(tv, fls->dtv->counter_flow_spare_sync_empty);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_spare_sync_empty);
|
||||
}
|
||||
StatsIncr(tv, fls->dtv->counter_flow_spare_sync);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_spare_sync);
|
||||
}
|
||||
#ifdef UNITTESTS
|
||||
}
|
||||
@@ -669,7 +669,7 @@ static void FlowExceptionPolicyStatsIncr(
|
||||
#endif
|
||||
StatsCounterId id = fls->dtv->counter_flow_memcap_eps.eps_id[policy];
|
||||
if (likely(id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
|
||||
#ifdef DEBUG
|
||||
if (g_eps_flow_memcap != UINT64_MAX && g_eps_flow_memcap == p->pcap_cnt) {
|
||||
NoFlowHandleIPS(tv, fls, p);
|
||||
StatsIncr(tv, fls->dtv->counter_flow_memcap);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_memcap);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -726,7 +726,7 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
|
||||
#ifdef UNITTESTS
|
||||
if (tv != NULL && fls->dtv != NULL) {
|
||||
#endif
|
||||
StatsIncr(tv, fls->dtv->counter_flow_memcap);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_memcap);
|
||||
#ifdef UNITTESTS
|
||||
}
|
||||
#endif
|
||||
@@ -735,7 +735,7 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
|
||||
#ifdef UNITTESTS
|
||||
if (tv != NULL && fls->dtv != NULL) {
|
||||
#endif
|
||||
StatsIncr(tv, fls->dtv->counter_flow_get_used);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_get_used);
|
||||
#ifdef UNITTESTS
|
||||
}
|
||||
#endif
|
||||
@@ -750,7 +750,7 @@ static Flow *FlowGetNew(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
|
||||
#ifdef UNITTESTS
|
||||
if (tv != NULL && fls->dtv != NULL) {
|
||||
#endif
|
||||
StatsIncr(tv, fls->dtv->counter_flow_memcap);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_memcap);
|
||||
#ifdef UNITTESTS
|
||||
}
|
||||
#endif
|
||||
@@ -776,7 +776,7 @@ static Flow *TcpReuseReplace(ThreadVars *tv, FlowLookupStruct *fls, FlowBucket *
|
||||
#ifdef UNITTESTS
|
||||
if (tv != NULL && fls->dtv != NULL) {
|
||||
#endif
|
||||
StatsIncr(tv, fls->dtv->counter_flow_tcp_reuse);
|
||||
StatsCounterIncr(&tv->stats, fls->dtv->counter_flow_tcp_reuse);
|
||||
#ifdef UNITTESTS
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -866,7 +866,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
|
||||
next_run_ms = 0;
|
||||
prev_emerg = true;
|
||||
SCLogNotice("Flow emergency mode entered...");
|
||||
StatsIncr(th_v, ftd->cnt.flow_emerg_mode_enter);
|
||||
StatsCounterIncr(&th_v->stats, ftd->cnt.flow_emerg_mode_enter);
|
||||
}
|
||||
if (ts_ms >= next_run_ms) {
|
||||
if (ftd->instance == 0) {
|
||||
@@ -886,7 +886,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
|
||||
if (emerg) {
|
||||
/* in emergency mode, do a full pass of the hash table */
|
||||
FlowTimeoutHash(&ftd->timeout, ts, ftd->min, ftd->max, &counters);
|
||||
StatsIncr(th_v, ftd->cnt.flow_mgr_full_pass);
|
||||
StatsCounterIncr(&th_v->stats, ftd->cnt.flow_mgr_full_pass);
|
||||
} else {
|
||||
SCLogDebug("hash %u:%u slice starting at %u with %u rows", ftd->min, ftd->max, pos,
|
||||
rows_per_wu);
|
||||
@@ -895,7 +895,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
|
||||
FlowTimeoutHashInChunks(&ftd->timeout, ts, ftd->min, ftd->max, &counters,
|
||||
rows_per_wu, &pos, ftd->instance);
|
||||
if (ppos > pos) {
|
||||
StatsIncr(th_v, ftd->cnt.flow_mgr_full_pass);
|
||||
StatsCounterIncr(&th_v->stats, ftd->cnt.flow_mgr_full_pass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
|
||||
(uintmax_t)SCTIME_SECS(ts), (uintmax_t)SCTIME_USECS(ts),
|
||||
spare_pool_len * 100 / MAX(flow_config.prealloc, 1));
|
||||
|
||||
StatsIncr(th_v, ftd->cnt.flow_emerg_mode_over);
|
||||
StatsCounterIncr(&th_v->stats, ftd->cnt.flow_emerg_mode_over);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -153,12 +153,12 @@ 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]);
|
||||
StatsCounterIncr(&tv->stats, fec->flow_tcp_state[ssn->state]);
|
||||
if (ssn->flags & STREAMTCP_FLAG_LOSSY_BE_LIBERAL) {
|
||||
StatsIncr(tv, fec->flow_tcp_liberal);
|
||||
StatsCounterIncr(&tv->stats, fec->flow_tcp_liberal);
|
||||
}
|
||||
}
|
||||
StatsIncr(tv, fec->flow_state[f->flow_state]);
|
||||
StatsCounterIncr(&tv->stats, fec->flow_state[f->flow_state]);
|
||||
}
|
||||
|
||||
void FlowEndCountersRegister(ThreadVars *t, FlowEndCounters *fec);
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ static inline void FlowUpdateFlowRate(
|
||||
f);
|
||||
f->flags |= FLOW_IS_ELEPHANT;
|
||||
if (tv != NULL) {
|
||||
StatsIncr(tv, dtv->counter_flow_elephant);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_flow_elephant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -513,12 +513,12 @@ static inline int PcapWrite(
|
||||
if (pl->bpfp) {
|
||||
if (pcap_offline_filter(pl->bpfp, pl->h, data) == 0) {
|
||||
SCLogDebug("Packet doesn't match filter, will not be logged.");
|
||||
StatsIncr(tv, td->counter_filtered_bpf);
|
||||
StatsCounterIncr(&tv->stats, td->counter_filtered_bpf);
|
||||
return TM_ECODE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
StatsIncr(tv, td->counter_written);
|
||||
StatsCounterIncr(&tv->stats, td->counter_written);
|
||||
|
||||
pcap_dump((u_char *)pl->pcap_dumper, pl->h, data);
|
||||
if (pl->compression.format == PCAP_LOG_COMPRESSION_FORMAT_NONE) {
|
||||
|
||||
@@ -149,18 +149,18 @@ static void OutputFilestoreFinalizeFiles(ThreadVars *tv, const OutputFilestoreLo
|
||||
if (SCPathExists(final_filename)) {
|
||||
OutputFilestoreUpdateFileTime(tmp_filepath, final_filename);
|
||||
if (unlink(tmp_filepath) != 0) {
|
||||
StatsIncr(tv, oft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, oft->fs_error_counter);
|
||||
WARN_ONCE(WOT_UNLINK, "Failed to remove temporary file %s: %s", tmp_filepath,
|
||||
strerror(errno));
|
||||
}
|
||||
} else if (rename(tmp_filepath, final_filename) != 0) {
|
||||
StatsIncr(tv, oft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, oft->fs_error_counter);
|
||||
WARN_ONCE(WOT_RENAME, "Failed to rename %s to %s: %s", tmp_filepath, final_filename,
|
||||
strerror(errno));
|
||||
if (unlink(tmp_filepath) != 0) {
|
||||
/* Just increment, don't log as has_fs_errors would
|
||||
* already be set above. */
|
||||
StatsIncr(tv, oft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, oft->fs_error_counter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
|
||||
|
||||
file_fd = open(filename, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644);
|
||||
if (file_fd == -1) {
|
||||
StatsIncr(tv, aft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, aft->fs_error_counter);
|
||||
SCLogWarning("Filestore (v2) failed to create %s: %s", filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
|
||||
ff->fd = file_fd;
|
||||
} else {
|
||||
if (FileGetMaxOpenFiles() > 0) {
|
||||
StatsIncr(tv, aft->counter_max_hits);
|
||||
StatsCounterIncr(&tv->stats, aft->counter_max_hits);
|
||||
}
|
||||
ff->fd = -1;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
|
||||
return -1;
|
||||
file_fd = open(filename, O_APPEND | O_NOFOLLOW | O_WRONLY);
|
||||
if (file_fd == -1) {
|
||||
StatsIncr(tv, aft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, aft->fs_error_counter);
|
||||
WARN_ONCE(WOT_OPEN, "Filestore (v2) failed to open file %s: %s", filename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
@@ -254,7 +254,7 @@ static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet
|
||||
char tmp_filename[PATH_MAX] = "";
|
||||
snprintf(tmp_filename, sizeof(tmp_filename), "file.%u", ff->file_store_id);
|
||||
(void)PathMerge(filename, sizeof(filename), ctx->tmpdir, tmp_filename);
|
||||
StatsIncr(tv, aft->fs_error_counter);
|
||||
StatsCounterIncr(&tv->stats, aft->fs_error_counter);
|
||||
WARN_ONCE(WOT_WRITE, "Filestore (v2) failed to write to %s: %s", filename,
|
||||
strerror(errno));
|
||||
if (ff->fd != -1) {
|
||||
|
||||
@@ -1390,7 +1390,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
* us from alloc'ing packets at line rate */
|
||||
PacketPoolWait();
|
||||
|
||||
StatsIncr(ptv->tv, ptv->capture_afp_poll);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afp_poll);
|
||||
|
||||
r = poll(&fds, 1, POLL_TIMEOUT);
|
||||
|
||||
@@ -1400,7 +1400,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
|
||||
if (r > 0 &&
|
||||
(fds.revents & (POLLHUP|POLLRDHUP|POLLERR|POLLNVAL))) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afp_poll_signal);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afp_poll_signal);
|
||||
if (fds.revents & (POLLHUP | POLLRDHUP)) {
|
||||
AFPSwitchState(ptv, AFP_STATE_DOWN);
|
||||
continue;
|
||||
@@ -1418,7 +1418,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
continue;
|
||||
}
|
||||
} else if (r > 0) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afp_poll_data);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afp_poll_data);
|
||||
r = AFPReadFunc(ptv);
|
||||
switch (r) {
|
||||
case AFP_READ_OK:
|
||||
@@ -1435,14 +1435,14 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
AFPSwitchState(ptv, AFP_STATE_DOWN);
|
||||
continue;
|
||||
case AFP_SURI_FAILURE:
|
||||
StatsIncr(ptv->tv, ptv->capture_errors);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_errors);
|
||||
break;
|
||||
case AFP_KERNEL_DROP:
|
||||
AFPDumpCounters(ptv);
|
||||
break;
|
||||
}
|
||||
} else if (unlikely(r == 0)) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afp_poll_timeout);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afp_poll_timeout);
|
||||
/* Trigger one dump of stats every second */
|
||||
current_time = time(NULL);
|
||||
if (current_time != last_dump) {
|
||||
@@ -1453,7 +1453,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
TmThreadsCaptureHandleTimeout(tv, NULL);
|
||||
|
||||
} else if ((r < 0) && (errno != EINTR)) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afp_poll_err);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afp_poll_err);
|
||||
SCLogWarning("%s: poll failure: %s", ptv->iface, strerror(errno));
|
||||
AFPSwitchState(ptv, AFP_STATE_DOWN);
|
||||
continue;
|
||||
@@ -2785,7 +2785,7 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data)
|
||||
DecodeLinkLayer(tv, dtv, p->datalink, p, GET_PKT_DATA(p), GET_PKT_LEN(p));
|
||||
/* post-decoding put vlan hdr back into the raw data) */
|
||||
if (afp_vlan_hdr) {
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
UpdateRawDataForVLANHdr(p);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -731,16 +731,16 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
* performance. xdp_busy_poll must be disabled for kernels < 5.11
|
||||
*/
|
||||
if (!ptv->xsk.enable_busy_poll) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_poll);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_poll);
|
||||
|
||||
r = poll(&ptv->xsk.fd, 1, POLL_TIMEOUT);
|
||||
|
||||
/* Report poll results */
|
||||
if (r <= 0) {
|
||||
if (r == 0) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_poll_timeout);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_poll_timeout);
|
||||
} else if (r < 0) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_poll_failed);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_poll_failed);
|
||||
SCLogWarning("poll failed with retval %d", r);
|
||||
AFXDPSwitchState(ptv, AFXDP_STATE_DOWN);
|
||||
}
|
||||
@@ -752,7 +752,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
|
||||
rcvd = xsk_ring_cons__peek(&ptv->xsk.rx, ptv->xsk.busy_poll_budget, &idx_rx);
|
||||
if (!rcvd) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_empty_reads);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_empty_reads);
|
||||
ssize_t ret = WakeupSocket(ptv);
|
||||
if (ret < 0) {
|
||||
SCLogWarning("recv failed with retval %ld", ret);
|
||||
@@ -764,7 +764,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
|
||||
uint32_t res = xsk_ring_prod__reserve(&ptv->umem.fq, rcvd, &idx_fq);
|
||||
while (res != rcvd) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_failed_reads);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_failed_reads);
|
||||
ssize_t ret = WakeupSocket(ptv);
|
||||
if (ret < 0) {
|
||||
SCLogWarning("recv failed with retval %ld", ret);
|
||||
@@ -779,7 +779,7 @@ static TmEcode ReceiveAFXDPLoop(ThreadVars *tv, void *data, void *slot)
|
||||
for (uint32_t i = 0; i < rcvd; i++) {
|
||||
p = PacketGetFromQueueOrAlloc();
|
||||
if (unlikely(p == NULL)) {
|
||||
StatsIncr(ptv->tv, ptv->capture_afxdp_acquire_pkt_failed);
|
||||
StatsCounterIncr(&ptv->tv->stats, ptv->capture_afxdp_acquire_pkt_failed);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -931,7 +931,7 @@ static TmEcode DecodeAFXDP(ThreadVars *tv, Packet *p, void *data)
|
||||
|
||||
/* If suri has set vlan during reading, we increase vlan counter */
|
||||
if (p->vlan_idx) {
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
}
|
||||
|
||||
/* call the decoder */
|
||||
|
||||
+1
-1
@@ -835,7 +835,7 @@ static TmEcode DecodeDPDK(ThreadVars *tv, Packet *p, void *data)
|
||||
|
||||
/* If suri has set vlan during reading, we increase vlan counter */
|
||||
if (p->vlan_idx) {
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
}
|
||||
|
||||
/* call the decoder */
|
||||
|
||||
@@ -513,7 +513,7 @@ ProcessErfDagRecord(ErfDagThreadVars *ewtn, char *prec)
|
||||
uint64_t usecs = ts >> 32;
|
||||
p->ts = SCTIME_ADD_USECS(p->ts, usecs);
|
||||
|
||||
StatsIncr(ewtn->tv, ewtn->packets);
|
||||
StatsCounterIncr(&ewtn->tv->stats, ewtn->packets);
|
||||
ewtn->bytes += wlen;
|
||||
|
||||
if (TmThreadsSlotProcessPkt(ewtn->tv, ewtn->slot, p) != TM_ECODE_OK) {
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ static TmEcode DecodeLib(ThreadVars *tv, Packet *p, void *data)
|
||||
|
||||
/* If suri has set vlan during reading, we increase vlan counter */
|
||||
if (p->vlan_idx) {
|
||||
StatsIncr(tv, dtv->counter_vlan);
|
||||
StatsCounterIncr(&tv->stats, dtv->counter_vlan);
|
||||
}
|
||||
|
||||
/* call the decoder */
|
||||
|
||||
@@ -538,7 +538,7 @@ static int DoHandleData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
|
||||
/* we had an overlap with different data */
|
||||
if (result) {
|
||||
StreamTcpSetEvent(p, STREAM_REASSEMBLY_OVERLAP_DIFFERENT_DATA);
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_reass_overlap_diff_data);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_reass_overlap_diff_data);
|
||||
}
|
||||
|
||||
/* insert the temp buffer now that we've (possibly) updated
|
||||
@@ -546,7 +546,7 @@ static int DoHandleData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
|
||||
int res = InsertSegmentDataCustom(stream, handle, buf, p->payload_len);
|
||||
if (res != SC_OK) {
|
||||
if (res == SC_ENOMEM) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_segment_memcap);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_segment_memcap);
|
||||
StreamTcpSetEvent(p, STREAM_REASSEMBLY_INSERT_MEMCAP);
|
||||
} else if (res == SC_ELIMIT) {
|
||||
StreamTcpSetEvent(p, STREAM_REASSEMBLY_INSERT_LIMIT);
|
||||
@@ -649,11 +649,11 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
|
||||
/* no overlap, straight data insert */
|
||||
int res = InsertSegmentDataCustom(stream, seg, pkt_data, pkt_datalen);
|
||||
if (res != SC_OK) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_reass_data_normal_fail);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_reass_data_normal_fail);
|
||||
StreamTcpRemoveSegmentFromStream(stream, seg);
|
||||
StreamTcpSegmentReturntoPool(seg);
|
||||
if (res == SC_ENOMEM) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_segment_memcap);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_segment_memcap);
|
||||
SCReturnInt(-SC_ENOMEM);
|
||||
}
|
||||
SCReturnInt(-1);
|
||||
@@ -667,12 +667,12 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
|
||||
}
|
||||
|
||||
/* XXX should we exclude 'retransmissions' here? */
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_reass_overlap);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_reass_overlap);
|
||||
|
||||
/* now let's consider the data in the overlap case */
|
||||
int res = DoHandleData(tv, ra_ctx, stream, seg, dup_seg, p);
|
||||
if (res < 0) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_reass_data_overlap_fail);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_reass_data_overlap_fail);
|
||||
|
||||
if (r == 1) // r == 2 mean seg wasn't added to stream
|
||||
StreamTcpRemoveSegmentFromStream(stream, seg);
|
||||
|
||||
@@ -610,7 +610,7 @@ static void StreamTcpReassembleExceptionPolicyStatsIncr(
|
||||
{
|
||||
StatsCounterId id = ra_ctx->counter_tcp_reas_eps.eps_id[policy];
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
|
||||
}
|
||||
urg_data = 1; /* only treat last 1 byte as out of band. */
|
||||
if (stream_config.urgent_policy == TCP_STREAM_URGENT_OOB) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_urgent_oob);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_urgent_oob);
|
||||
}
|
||||
|
||||
/* depending on hitting the OOB limit, update urg_data or not */
|
||||
@@ -831,7 +831,7 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
|
||||
if (stream->flags & STREAMTCP_STREAM_FLAG_DEPTH_REACHED) {
|
||||
StreamTcpSetEvent(p, STREAM_REASSEMBLY_DEPTH_REACHED);
|
||||
/* increment stream depth counter */
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_stream_depth);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_stream_depth);
|
||||
p->app_update_direction = UPDATE_DIR_PACKET;
|
||||
}
|
||||
if (size == 0) {
|
||||
@@ -1299,7 +1299,7 @@ static int ReassembleUpdateAppLayer(ThreadVars *tv, TcpReassemblyThreadCtx *ra_c
|
||||
|
||||
StreamTcpSetEvent(p, STREAM_REASSEMBLY_SEQ_GAP);
|
||||
(*stream)->flags |= STREAMTCP_STREAM_FLAG_HAS_GAP;
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_reass_gap);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_reass_gap);
|
||||
ssn->flags |= STREAMTCP_FLAG_LOSSY_BE_LIBERAL;
|
||||
|
||||
/* AppLayerHandleTCPData has likely updated progress. */
|
||||
@@ -2121,7 +2121,7 @@ TcpSegment *StreamTcpGetSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx)
|
||||
{
|
||||
TcpSegment *seg = StreamTcpThreadCacheGetSegment();
|
||||
if (seg) {
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_segment_from_cache);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_segment_from_cache);
|
||||
memset(&seg->sbseg, 0, sizeof(seg->sbseg));
|
||||
return seg;
|
||||
}
|
||||
@@ -2132,10 +2132,10 @@ TcpSegment *StreamTcpGetSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx)
|
||||
if (seg == NULL) {
|
||||
/* Increment the counter to show that we are not able to serve the
|
||||
segment request due to memcap limit */
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_segment_memcap);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_segment_memcap);
|
||||
} else {
|
||||
memset(&seg->sbseg, 0, sizeof(seg->sbseg));
|
||||
StatsIncr(tv, ra_ctx->counter_tcp_segment_from_pool);
|
||||
StatsCounterIncr(&tv->stats, ra_ctx->counter_tcp_segment_from_pool);
|
||||
}
|
||||
|
||||
return seg;
|
||||
|
||||
+24
-24
@@ -900,7 +900,7 @@ static void StreamTcpSsnMemcapExceptionPolicyStatsIncr(
|
||||
{
|
||||
const StatsCounterId id = stt->counter_tcp_ssn_memcap_eps.eps_id[policy];
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,14 +939,14 @@ static TcpSession *StreamTcpNewSession(ThreadVars *tv, StreamTcpThread *stt, Pac
|
||||
#ifdef UNITTESTS
|
||||
if (tv)
|
||||
#endif
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_from_cache);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_from_cache);
|
||||
} else {
|
||||
p->flow->protoctx = PoolThreadGetById(ssn_pool, (uint16_t)id);
|
||||
if (p->flow->protoctx != NULL)
|
||||
#ifdef UNITTESTS
|
||||
if (tv)
|
||||
#endif
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_from_pool);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_from_pool);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
SCMutexLock(&ssn_pool_mutex);
|
||||
@@ -1141,7 +1141,7 @@ static void StreamTcpMidstreamExceptionPolicyStatsIncr(
|
||||
{
|
||||
const StatsCounterId id = stt->counter_tcp_midstream_eps.eps_id[policy];
|
||||
if (likely(tv && id.id > 0)) {
|
||||
StatsIncr(tv, id);
|
||||
StatsCounterIncr(&tv->stats, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1218,12 +1218,12 @@ static int StreamTcpPacketStateNone(
|
||||
if (ssn == NULL) {
|
||||
ssn = StreamTcpNewSession(tv, stt, p, stt->ssn_pool_id);
|
||||
if (ssn == NULL) {
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_memcap);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_memcap);
|
||||
return -1;
|
||||
}
|
||||
StatsIncr(tv, stt->counter_tcp_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_active_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_midstream_pickups);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_active_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_midstream_pickups);
|
||||
}
|
||||
/* set the state */
|
||||
StreamTcpPacketSetState(p, ssn, TCP_FIN_WAIT1);
|
||||
@@ -1313,12 +1313,12 @@ static int StreamTcpPacketStateNone(
|
||||
if (ssn == NULL) {
|
||||
ssn = StreamTcpNewSession(tv, stt, p, stt->ssn_pool_id);
|
||||
if (ssn == NULL) {
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_memcap);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_memcap);
|
||||
return -1;
|
||||
}
|
||||
StatsIncr(tv, stt->counter_tcp_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_active_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_midstream_pickups);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_active_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_midstream_pickups);
|
||||
}
|
||||
|
||||
/* reverse packet and flow */
|
||||
@@ -1406,12 +1406,12 @@ static int StreamTcpPacketStateNone(
|
||||
if (ssn == NULL) {
|
||||
ssn = StreamTcpNewSession(tv, stt, p, stt->ssn_pool_id);
|
||||
if (ssn == NULL) {
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_memcap);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_memcap);
|
||||
return -1;
|
||||
}
|
||||
|
||||
StatsIncr(tv, stt->counter_tcp_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_active_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_active_sessions);
|
||||
}
|
||||
|
||||
/* set the state */
|
||||
@@ -1487,12 +1487,12 @@ static int StreamTcpPacketStateNone(
|
||||
if (ssn == NULL) {
|
||||
ssn = StreamTcpNewSession(tv, stt, p, stt->ssn_pool_id);
|
||||
if (ssn == NULL) {
|
||||
StatsIncr(tv, stt->counter_tcp_ssn_memcap);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ssn_memcap);
|
||||
return -1;
|
||||
}
|
||||
StatsIncr(tv, stt->counter_tcp_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_active_sessions);
|
||||
StatsIncr(tv, stt->counter_tcp_midstream_pickups);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_active_sessions);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_midstream_pickups);
|
||||
}
|
||||
/* set the state */
|
||||
StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED);
|
||||
@@ -3023,7 +3023,7 @@ static int HandleEstablishedPacketToServer(
|
||||
if ((ssn->flags & STREAMTCP_FLAG_ASYNC) == 0 &&
|
||||
SEQ_GT(ssn->server.last_ack, ssn->server.next_seq)) {
|
||||
STREAM_PKT_FLAG_SET(p, STREAM_PKT_FLAG_ACK_UNSEEN_DATA);
|
||||
StatsIncr(tv, stt->counter_tcp_ack_unseen_data);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ack_unseen_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3173,7 +3173,7 @@ static int HandleEstablishedPacketToClient(
|
||||
if ((ssn->flags & STREAMTCP_FLAG_ASYNC) == 0 &&
|
||||
SEQ_GT(ssn->client.last_ack, ssn->client.next_seq)) {
|
||||
STREAM_PKT_FLAG_SET(p, STREAM_PKT_FLAG_ACK_UNSEEN_DATA);
|
||||
StatsIncr(tv, stt->counter_tcp_ack_unseen_data);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_ack_unseen_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5650,7 +5650,7 @@ static inline void CheckThreadId(ThreadVars *tv, Packet *p, StreamTcpThread *stt
|
||||
if (unlikely((FlowThreadId)tv->id != p->flow->thread_id[idx])) {
|
||||
SCLogDebug("wrong thread: flow has %u, we are %d", p->flow->thread_id[idx], tv->id);
|
||||
if (p->pkt_src == PKT_SRC_WIRE) {
|
||||
StatsIncr(tv, stt->counter_tcp_wrong_thread);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_wrong_thread);
|
||||
if ((p->flow->flags & FLOW_WRONG_THREAD) == 0) {
|
||||
p->flow->flags |= FLOW_WRONG_THREAD;
|
||||
StreamTcpSetEvent(p, STREAM_WRONG_THREAD);
|
||||
@@ -6088,7 +6088,7 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueueNoLock *pq)
|
||||
if (!(p->flags & PKT_PSEUDO_STREAM_END)) {
|
||||
if (stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) {
|
||||
if (StreamTcpValidateChecksum(p) == 0) {
|
||||
StatsIncr(tv, stt->counter_tcp_invalid_checksum);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_invalid_checksum);
|
||||
return TM_ECODE_OK;
|
||||
}
|
||||
}
|
||||
@@ -7027,7 +7027,7 @@ static void StreamTcpPseudoPacketCreateDetectLogFlush(ThreadVars *tv,
|
||||
SCLogDebug("np %p", np);
|
||||
PacketEnqueueNoLock(pq, np);
|
||||
|
||||
StatsIncr(tv, stt->counter_tcp_pseudo);
|
||||
StatsCounterIncr(&tv->stats, stt->counter_tcp_pseudo);
|
||||
SCReturn;
|
||||
error:
|
||||
FlowDeReference(&np->flow);
|
||||
|
||||
Reference in New Issue
Block a user