detect/dns: convert to v2 inspect API

pull/5635/head
Victor Julien 6 years ago
parent 8c7423fcb8
commit db0665bccc

@ -74,14 +74,12 @@ static int DetectDnsOpcodeMatch(DetectEngineThreadCtx *det_ctx,
return rs_dns_opcode_match(txv, (void *)ctx, flags); return rs_dns_opcode_match(txv, (void *)ctx, flags);
} }
static int DetectEngineInspectRequestGenericDnsOpcode(ThreadVars *tv, static int DetectEngineInspectRequestGenericDnsOpcode(DetectEngineCtx *de_ctx,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine,
const Signature *s, const SigMatchData *smd, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Flow *f, uint8_t flags, void *alstate,
void *txv, uint64_t tx_id)
{ {
return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd, return DetectEngineInspectGenericList(
f, flags, alstate, txv, tx_id); NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
} }
void DetectDnsOpcodeRegister(void) void DetectDnsOpcodeRegister(void)
@ -94,13 +92,11 @@ void DetectDnsOpcodeRegister(void)
sigmatch_table[DETECT_AL_DNS_OPCODE].AppLayerTxMatch = sigmatch_table[DETECT_AL_DNS_OPCODE].AppLayerTxMatch =
DetectDnsOpcodeMatch; DetectDnsOpcodeMatch;
DetectAppLayerInspectEngineRegister("dns.opcode", DetectAppLayerInspectEngineRegister2("dns.opcode", ALPROTO_DNS, SIG_FLAG_TOSERVER, 0,
ALPROTO_DNS, SIG_FLAG_TOSERVER, 0, DetectEngineInspectRequestGenericDnsOpcode, NULL);
DetectEngineInspectRequestGenericDnsOpcode);
DetectAppLayerInspectEngineRegister("dns.opcode", DetectAppLayerInspectEngineRegister2("dns.opcode", ALPROTO_DNS, SIG_FLAG_TOCLIENT, 0,
ALPROTO_DNS, SIG_FLAG_TOCLIENT, 0, DetectEngineInspectRequestGenericDnsOpcode, NULL);
DetectEngineInspectRequestGenericDnsOpcode);
dns_opcode_list_id = DetectBufferTypeGetByName("dns.opcode"); dns_opcode_list_id = DetectBufferTypeGetByName("dns.opcode");
} }

@ -232,12 +232,10 @@ void DetectDnsQueryRegister (void)
g_dns_query_buffer_id = DetectBufferTypeGetByName("dns_query"); g_dns_query_buffer_id = DetectBufferTypeGetByName("dns_query");
/* register these generic engines from here for now */ /* register these generic engines from here for now */
DetectAppLayerInspectEngineRegister("dns_request", DetectAppLayerInspectEngineRegister2(
ALPROTO_DNS, SIG_FLAG_TOSERVER, 1, "dns_request", ALPROTO_DNS, SIG_FLAG_TOSERVER, 1, DetectEngineInspectDnsRequest, NULL);
DetectEngineInspectDnsRequest); DetectAppLayerInspectEngineRegister2("dns_response", ALPROTO_DNS, SIG_FLAG_TOCLIENT, 1,
DetectAppLayerInspectEngineRegister("dns_response", DetectEngineInspectDnsResponse, NULL);
ALPROTO_DNS, SIG_FLAG_TOCLIENT, 1,
DetectEngineInspectDnsResponse);
DetectBufferTypeSetDescriptionByName("dns_request", DetectBufferTypeSetDescriptionByName("dns_request",
"dns requests"); "dns requests");

@ -47,20 +47,18 @@
#include "util-unittest-helper.h" #include "util-unittest-helper.h"
#include "util-validate.h" #include "util-validate.h"
int DetectEngineInspectDnsRequest(ThreadVars *tv, int DetectEngineInspectDnsRequest(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
const Signature *s, const SigMatchData *smd, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
{ {
return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd, return DetectEngineInspectGenericList(
f, flags, alstate, txv, tx_id); NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
} }
int DetectEngineInspectDnsResponse(ThreadVars *tv, int DetectEngineInspectDnsResponse(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
const Signature *s, const SigMatchData *smd, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
{ {
return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd, return DetectEngineInspectGenericList(
f, flags, alstate, txv, tx_id); NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
} }

@ -23,13 +23,11 @@
#ifndef __DETECT_ENGINE_DNS_H__ #ifndef __DETECT_ENGINE_DNS_H__
#define __DETECT_ENGINE_DNS_H__ #define __DETECT_ENGINE_DNS_H__
int DetectEngineInspectDnsRequest(ThreadVars *tv, int DetectEngineInspectDnsRequest(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
const Signature *s, const SigMatchData *smd, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id); int DetectEngineInspectDnsResponse(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
int DetectEngineInspectDnsResponse(ThreadVars *tv, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
const Signature *s, const SigMatchData *smd,
Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
#endif /* __DETECT_ENGINE_DNS_H__ */ #endif /* __DETECT_ENGINE_DNS_H__ */

Loading…
Cancel
Save