Go to the documentation of this file.
46 static void DetectIcmpSeqRegisterTests(
void);
50 static bool PrefilterIcmpSeqIsPrefilterable(
const Signature *s);
71 static inline bool GetIcmpSeq(
Packet *p, uint16_t *
seq)
75 if (PacketIsICMPv4(p)) {
85 SCLogDebug(
"ICMPV4_GET_SEQ(p) %"PRIu16
" (network byte order), "
95 }
else if (PacketIsICMPv6(p)) {
99 SCLogDebug(
"ICMPV6_GET_SEQ(p) %"PRIu16
" (network byte order), "
135 if (!GetIcmpSeq(p, &seqn))
179 SCDetectU16Free(ptr);
192 if (!GetIcmpSeq(p, &seqn))
196 du16.mode =
ctx->v1.u8[0];
197 du16.arg1 =
ctx->v1.u16[1];
198 du16.arg2 =
ctx->v1.u16[2];
201 PrefilterAddSids(&det_ctx->
pmq,
ctx->sigs_array,
ctx->sigs_cnt);
211 static bool PrefilterIcmpSeqIsPrefilterable(
const Signature *s)
231 static int DetectIcmpSeqParseTest01 (
void)
234 iseq = SCDetectU16UnquoteParse(
"300");
245 static int DetectIcmpSeqParseTest02 (
void)
248 iseq = SCDetectU16UnquoteParse(
" 300 ");
258 static int DetectIcmpSeqParseTest03 (
void)
265 static void DetectIcmpSeqRegisterTests (
void)
267 UtRegisterTest(
"DetectIcmpSeqParseTest01", DetectIcmpSeqParseTest01);
268 UtRegisterTest(
"DetectIcmpSeqParseTest02", DetectIcmpSeqParseTest02);
269 UtRegisterTest(
"DetectIcmpSeqParseTest03", DetectIcmpSeqParseTest03);
#define SIGMATCH_INFO_UINT16
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
#define SIG_MASK_REQUIRE_REAL_PKT
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
void PrefilterPacketU16Set(PrefilterPacketHeaderValue *v, void *smctx)
#define ICMP_INFO_REQUEST
SigTableElmt * sigmatch_table
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.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define ICMPV6_GET_SEQ(p)
main detection engine ctx
struct Packet_::@33::@40 icmp_s
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define ICMP6_ECHO_REQUEST
#define ICMPV4_GET_SEQ(p)
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
#define ICMP_ADDRESSREPLY
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
void DetectIcmpSeqRegister(void)
Registration function for icmp_seq.
SignatureInitData * init_data
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 DetectU16Match(const uint16_t parg, const DetectUintData_u16 *du16)
bool PrefilterPacketU16Compare(PrefilterPacketHeaderValue v, void *smctx)
bool(* SupportsPrefilter)(const Signature *s)
a single match condition for a signature
#define ICMP_TIMESTAMPREPLY
#define ICMPV6_GET_TYPE(icmp6h)
DetectUintData_u16 DetectU16Data
#define DEBUG_VALIDATE_BUG_ON(exp)
void DetectIcmpSeqFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectU16Data
void(* RegisterTests)(void)
#define SIG_FLAG_REQUIRE_PACKET