Go to the documentation of this file.
51 static int DetectTemplateMatch(
58 if (PacketIsIPv4(p)) {
59 const IPV4Hdr *ip4h = PacketGetIPv4(p);
61 }
else if (PacketIsIPv6(p)) {
62 const IPV6Hdr *ip6h = PacketGetIPv6(p);
96 if (templated == NULL)
101 DetectTemplateFree(
de_ctx, templated);
111 static void PrefilterPacketTemplateMatch(
118 if (PacketIsIPv4(p)) {
119 const IPV4Hdr *ip4h = PacketGetIPv4(p);
121 }
else if (PacketIsIPv6(p)) {
122 const IPV6Hdr *ip6h = PacketGetIPv6(p);
132 if (!PrefilterPacketHeaderExtraMatch(
ctx, p))
136 du8.mode =
ctx->v1.u8[0];
137 du8.arg1 =
ctx->v1.u8[1];
138 du8.arg2 =
ctx->v1.u8[2];
142 SCLogDebug(
"packet matches template/hl %u", ptemplate);
143 PrefilterAddSids(&det_ctx->
pmq,
ctx->sigs_array,
ctx->sigs_cnt);
153 static bool PrefilterTemplateIsPrefilterable(
const Signature *s)
void DetectTemplateRegister(void)
Registration function for template: keyword.
#define SIG_MASK_REQUIRE_REAL_PKT
SigTableElmt * sigmatch_table
#define IPV6_GET_RAW_HLIM(ip6h)
void(* Free)(DetectEngineCtx *, void *)
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Container for matching data for a signature group.
#define SIGMATCH_INFO_UINT8
main detection engine ctx
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
DetectUintData_u8 * DetectU8Parse(const char *u8str)
This function is used to parse u8 options passed via some u8 keyword.
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
DetectUintData_u8 DetectU8Data
void PrefilterPacketU8Set(PrefilterPacketHeaderValue *v, void *smctx)
#define IPV4_GET_RAW_IPTTL(ip4h)
int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, SignatureMask mask, void(*Set)(PrefilterPacketHeaderValue *v, void *), bool(*Compare)(PrefilterPacketHeaderValue v, void *), void(*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
int DetectU8Match(const uint8_t parg, const DetectUintData_u8 *du8)
bool(* SupportsPrefilter)(const Signature *s)
bool PrefilterPacketU8Compare(PrefilterPacketHeaderValue v, void *smctx)
void DetectTemplateRegisterTests(void)
this function registers unit tests for DetectTemplate
#define DEBUG_VALIDATE_BUG_ON(exp)
void(* RegisterTests)(void)
#define SIG_FLAG_REQUIRE_PACKET