]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode: add stats counters for ipv4/ipv6 over ipv4
authorJuliana Fajardini <jufajardini@oisf.net>
Wed, 11 Jun 2025 21:29:58 +0000 (18:29 -0300)
committerVictor Julien <victor@inliniac.net>
Sat, 21 Jun 2025 19:32:48 +0000 (21:32 +0200)
These existed for ipv6 over ipv6, and ipv4 over ipv6, but not for the
ipv4 counterpart.

Task #7758

etc/schema.json
src/decode-ipv4.c
src/decode.c
src/decode.h

index 79071ef3f6617bd03643846082b979dc3862e577..5149a7dd4c5daefa2a102feeae79e65709ee96b9 100644 (file)
                         "ipv4": {
                             "type": "integer"
                         },
+                        "ipv4_in_ipv4": {
+                            "type": "integer"
+                        },
                         "ipv4_in_ipv6": {
                             "type": "integer"
                         },
                         "ipv6": {
                             "type": "integer"
                         },
+                        "ipv6_in_ipv4": {
+                            "type": "integer"
+                        },
                         "ipv6_in_ipv6": {
                             "type": "integer"
                         },
index 2420f9c6aced3d98fb6181199ba13282524c0232..01979f8edd849550dc7617942f0f9a46932e34ec 100644 (file)
@@ -591,6 +591,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);
             }
             FlowSetupPacket(p);
             break;
@@ -601,6 +602,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);
             }
             FlowSetupPacket(p);
             break;
index ad4ea19bd81ee6f4c41aebc97683599d72541637..6c225b0abce443abdb98d8241583d823da4002b3 100644 (file)
@@ -664,6 +664,8 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
     dtv->counter_vntag = StatsRegisterCounter("decoder.vntag", tv);
     dtv->counter_ieee8021ah = StatsRegisterCounter("decoder.ieee8021ah", tv);
     dtv->counter_teredo = StatsRegisterCounter("decoder.teredo", tv);
+    dtv->counter_ipv4inipv4 = StatsRegisterCounter("decoder.ipv4_in_ipv4", tv);
+    dtv->counter_ipv6inipv4 = StatsRegisterCounter("decoder.ipv6_in_ipv4", tv);
     dtv->counter_ipv4inipv6 = StatsRegisterCounter("decoder.ipv4_in_ipv6", tv);
     dtv->counter_ipv6inipv6 = StatsRegisterCounter("decoder.ipv6_in_ipv6", tv);
     dtv->counter_mpls = StatsRegisterCounter("decoder.mpls", tv);
index bd0fdb4cd9acaaee14824051bd64a74dea655ade..62c699d7b2d5d3f341c61879554f2c3965710a45 100644 (file)
@@ -1007,6 +1007,8 @@ typedef struct DecodeThreadVars_
     uint16_t counter_pppoe;
     uint16_t counter_teredo;
     uint16_t counter_mpls;
+    uint16_t counter_ipv4inipv4;
+    uint16_t counter_ipv6inipv4;
     uint16_t counter_ipv4inipv6;
     uint16_t counter_ipv6inipv6;
     uint16_t counter_erspan;