For better readability and type checking.
Ticket: #5517.
return PKT_IS_UDP(p);
}
+static inline bool PacketIsICMPv4(const Packet *p)
+{
+ return PKT_IS_ICMPV4(p);
+}
+
/** \brief Structure to hold thread specific data for all decode modules */
typedef struct DecodeThreadVars_
{
{
const DetectCsumData *cd = (const DetectCsumData *)ctx;
- if (!PacketIsIPv4(p) || !PKT_IS_ICMPV4(p) || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p))
+ if (!PacketIsIPv4(p) || !PacketIsICMPv4(p) || p->proto != IPPROTO_ICMP || PKT_IS_PSEUDOPKT(p))
return 0;
if (p->flags & PKT_IGNORE_CHECKSUM) {
return false;
uint16_t pid;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
switch (ICMPV4_GET_TYPE(p)){
case ICMP_ECHOREPLY:
case ICMP_ECHO:
if (PKT_IS_PSEUDOPKT(p))
return false;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
switch (ICMPV4_GET_TYPE(p)){
case ICMP_ECHOREPLY:
case ICMP_ECHO:
{
SCEnter();
- if (!PKT_IS_ICMPV4(p)) {
+ if (!PacketIsICMPv4(p)) {
SCReturnPtr(NULL, "InspectionBuffer");
}
return 0;
uint8_t picode;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
picode = ICMPV4_GET_CODE(p);
} else if (PKT_IS_ICMPV6(p)) {
picode = ICMPV6_GET_CODE(p);
}
uint8_t picode;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
picode = ICMPV4_GET_CODE(p);
} else if (PKT_IS_ICMPV6(p)) {
picode = ICMPV6_GET_CODE(p);
return 0;
uint8_t pitype;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
pitype = ICMPV4_GET_TYPE(p);
} else if (PKT_IS_ICMPV6(p)) {
pitype = ICMPV6_GET_TYPE(p);
}
uint8_t pitype;
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
pitype = ICMPV4_GET_TYPE(p);
} else if (PKT_IS_ICMPV6(p)) {
pitype = ICMPV6_GET_TYPE(p);
/* HACK: prevent the wrong sgh (or NULL) from being stored in the
* flow's sgh pointers */
- if (PKT_IS_ICMPV4(p) && ICMPV4_DEST_UNREACH_IS_VALID(p)) {
+ if (PacketIsICMPv4(p) && ICMPV4_DEST_UNREACH_IS_VALID(p)) {
; /* no-op */
} else {
/* store the found sgh (or NULL) in the flow to save us
}
}
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
if (ICMPV4_IS_ERROR_MSG(p)) {
return 0;
}
} else if (PacketIsUDP(p)) {
SET_UDP_SRC_PORT(p,&f->sp);
SET_UDP_DST_PORT(p,&f->dp);
- } else if (PKT_IS_ICMPV4(p)) {
+ } else if (PacketIsICMPv4(p)) {
f->icmp_s.type = p->icmp_s.type;
f->icmp_s.code = p->icmp_s.code;
FlowSetICMPv4CounterPart(f);
*/
static inline int FlowUpdateSeenFlag(const Packet *p)
{
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
if (ICMPV4_IS_ERROR_MSG(p)) {
return 0;
}
}
break;
case IPPROTO_ICMP:
- if (PKT_IS_ICMPV4(p)) {
+ if (PacketIsICMPv4(p)) {
jb_set_uint(js, "icmp_id", ICMPV4_GET_ID(p));
jb_set_uint(js, "icmp_seq", ICMPV4_GET_SEQ(p));
- } else if(PKT_IS_ICMPV6(p)) {
+ } else if (PKT_IS_ICMPV6(p)) {
jb_set_uint(js, "icmp_id", ICMPV6_GET_ID(p));
jb_set_uint(js, "icmp_seq", ICMPV6_GET_SEQ(p));
}