]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: handle vlan counter
authorEric Leblond <eric@regit.org>
Tue, 4 Feb 2014 10:49:42 +0000 (11:49 +0100)
committerEric Leblond <eric@regit.org>
Fri, 7 Feb 2014 12:32:48 +0000 (13:32 +0100)
This patch adds a vlan counter increment in decodeAFP. This
is needed to take into account vlan_id set by the packet
reading function.

src/source-af-packet.c

index 63f3a6632ea55291761ba8c4c041f3aa1bac4516..0a3c5f00ed515ec3e9445881df6e9c741dd30cbb 100644 (file)
@@ -1688,6 +1688,11 @@ TmEcode DecodeAFP(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packet
     SCPerfCounterAddUI64(dtv->counter_avg_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
     SCPerfCounterSetUI64(dtv->counter_max_pkt_size, tv->sc_perf_pca, GET_PKT_LEN(p));
 
+    /* If suri has set vlan during reading, we increase vlan counter */
+    if (p->vlan_idx) {
+        SCPerfCounterIncr(dtv->counter_vlan, tv->sc_perf_pca);
+    }
+
     /* call the decoder */
     switch(p->datalink) {
         case LINKTYPE_LINUX_SLL: