ndpi: use flow access functions

To prevent direct access to the flow structure and be subject to changes
in its size.

Ticket: #8632
pull/16053/head
Jason Ish 3 months ago committed by Victor Julien
parent 358b0b621b
commit 06235a3232

@ -24,6 +24,7 @@
#include "detect-engine-helper.h"
#include "detect-parse.h"
#include "flow.h"
#include "flow-callbacks.h"
#include "flow-storage.h"
#include "output-eve.h"
@ -129,9 +130,11 @@ static void OnFlowInit(ThreadVars *tv, Flow *f, const Packet *p, void *_data)
static void OnFlowUpdate(ThreadVars *tv, Flow *f, Packet *p, void *_data)
{
const uint8_t flow_proto = SCFlowGetIPProtocol(f);
/* Ignore packets that have a different protocol than the
* flow. This can happen with ICMP unreachable packets. */
if (p->proto != f->proto) {
if (p->proto != flow_proto) {
return;
}
@ -169,9 +172,10 @@ static void OnFlowUpdate(ThreadVars *tv, Flow *f, Packet *p, void *_data)
flowctx->detection_completed = true;
}
} else {
uint16_t max_num_pkts = (f->proto == IPPROTO_UDP) ? 8 : 24;
uint16_t max_num_pkts = (flow_proto == IPPROTO_UDP) ? 8 : 24;
if ((f->todstpktcnt + f->tosrcpktcnt) > max_num_pkts) {
if ((SCFlowGetToServerPacketCount(f) + SCFlowGetToClientPacketCount(f)) >
max_num_pkts) {
uint8_t proto_guessed;
flowctx->detected_l7_protocol =

Loading…
Cancel
Save