decode/icmpv4: switch ptr checks to PKT_IS_ICMPV4

To prepare future changes to the Packet header pointers.

Ticket: #5517.
pull/10971/head
Victor Julien 1 year ago committed by Victor Julien
parent c9ef85e620
commit 54b9f344b7

@ -682,7 +682,7 @@ static int DetectICMPV4CsumMatch(DetectEngineThreadCtx *det_ctx,
{ {
const DetectCsumData *cd = (const DetectCsumData *)ctx; const DetectCsumData *cd = (const DetectCsumData *)ctx;
if (!PacketIsIPv4(p) || p->icmpv4h == NULL || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p)) if (!PacketIsIPv4(p) || !PKT_IS_ICMPV4(p) || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p))
return 0; return 0;
if (p->flags & PKT_IGNORE_CHECKSUM) { if (p->flags & PKT_IGNORE_CHECKSUM) {

@ -95,7 +95,7 @@ static InspectionBuffer *GetData(DetectEngineThreadCtx *det_ctx,
{ {
SCEnter(); SCEnter();
if (p->icmpv4h == NULL) { if (!PKT_IS_ICMPV4(p)) {
SCReturnPtr(NULL, "InspectionBuffer"); SCReturnPtr(NULL, "InspectionBuffer");
} }

@ -176,7 +176,7 @@ void FlowInit(Flow *f, const Packet *p)
} else if (PKT_IS_UDP(p)) { } else if (PKT_IS_UDP(p)) {
SET_UDP_SRC_PORT(p,&f->sp); SET_UDP_SRC_PORT(p,&f->sp);
SET_UDP_DST_PORT(p,&f->dp); SET_UDP_DST_PORT(p,&f->dp);
} else if (p->icmpv4h != NULL) { } else if (PKT_IS_ICMPV4(p)) {
f->icmp_s.type = p->icmp_s.type; f->icmp_s.type = p->icmp_s.type;
f->icmp_s.code = p->icmp_s.code; f->icmp_s.code = p->icmp_s.code;
FlowSetICMPv4CounterPart(f); FlowSetICMPv4CounterPart(f);

Loading…
Cancel
Save