stats: update ips capture counters centrally

This adds support to all capture methods for these counters.

The updates happen only on "real" packets, not on encapsulated
packets.

Ticket: #4756.
pull/9288/head
Victor Julien 2 years ago
parent 6a1138e2b1
commit d56f34370d

@ -1186,9 +1186,6 @@ TmEcode NFQSetVerdict(Packet *p)
*/ */
TmEcode VerdictNFQ(ThreadVars *tv, Packet *p, void *data) TmEcode VerdictNFQ(ThreadVars *tv, Packet *p, void *data)
{ {
/* update counters */
CaptureStatsUpdate(tv, p);
/* if this is a tunnel packet we check if we are ready to verdict /* if this is a tunnel packet we check if we are ready to verdict
* already. */ * already. */
if (IS_TUNNEL_PKT(p)) { if (IS_TUNNEL_PKT(p)) {

@ -748,9 +748,6 @@ static TmEcode WinDivertVerdictHelper(ThreadVars *tv, Packet *p)
SCEnter(); SCEnter();
WinDivertThreadVars *wd_tv = WinDivertGetThread(p->windivert_v.thread_num); WinDivertThreadVars *wd_tv = WinDivertGetThread(p->windivert_v.thread_num);
/* update counters */
CaptureStatsUpdate(tv, p);
#ifdef COUNTERS #ifdef COUNTERS
WinDivertQueueVars *wd_qv = WinDivertGetQueue(wd_tv->thread_num); WinDivertQueueVars *wd_qv = WinDivertGetQueue(wd_tv->thread_num);
#endif /* COUNTERS */ #endif /* COUNTERS */

@ -370,6 +370,8 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
if (IS_TUNNEL_ROOT_PKT(p)) { if (IS_TUNNEL_ROOT_PKT(p)) {
SCLogDebug("IS_TUNNEL_ROOT_PKT == TRUE"); SCLogDebug("IS_TUNNEL_ROOT_PKT == TRUE");
CaptureStatsUpdate(t, p);
const uint16_t outstanding = TUNNEL_PKT_TPR(p) - TUNNEL_PKT_RTV(p); const uint16_t outstanding = TUNNEL_PKT_TPR(p) - TUNNEL_PKT_RTV(p);
SCLogDebug("root pkt: outstanding %u", outstanding); SCLogDebug("root pkt: outstanding %u", outstanding);
if (outstanding == 0) { if (outstanding == 0) {
@ -429,6 +431,9 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
SCSpinUnlock(lock); SCSpinUnlock(lock);
SCLogDebug("tunnel stuff done, move on (proot %d)", proot); SCLogDebug("tunnel stuff done, move on (proot %d)", proot);
} else {
CaptureStatsUpdate(t, p);
} }
SCLogDebug("[packet %p][%s] %s", p, SCLogDebug("[packet %p][%s] %s", p,

Loading…
Cancel
Save