dns: remove C wrapper functions to Rust

Remove registration of C wrapper functions and register
the Rust functions directly for UDP.
pull/4679/head
Jason Ish 6 years ago committed by Victor Julien
parent 1b44f839e6
commit 0af9a3a5f7

@ -77,6 +77,7 @@ include = ["AppLayerGetTxIterTuple"]
# default: []
exclude = [
"AppLayerDecoderEvents",
"AppLayerParserState",
"CLuaState",
"DetectEngineState",
"Flow",
@ -118,7 +119,6 @@ item_types = ["structs","opaque","functions"]
# [export]
# prefix = "capi_"
[export.rename]
"DNSState" = "RSDNSState"
"DNSTransaction" = "RSDNSTransaction"
"JsonT" = "json_t"
"CLuaState" = "lua_State"

@ -23,6 +23,7 @@ use crate::filecontainer::*;
/// Opaque C types.
pub enum DetectEngineState {}
pub enum AppLayerDecoderEvents {}
pub enum AppLayerParserState {}
// From app-layer-events.h
pub type AppLayerEventType = std::os::raw::c_int;

@ -639,21 +639,24 @@ pub extern "C" fn rs_dns_state_free(state: *mut std::os::raw::c_void) {
}
#[no_mangle]
pub extern "C" fn rs_dns_state_tx_free(state: &mut DNSState,
pub extern "C" fn rs_dns_state_tx_free(state: *mut std::os::raw::c_void,
tx_id: u64)
{
let state = cast_pointer!(state, DNSState);
state.free_tx(tx_id);
}
/// C binding parse a DNS request. Returns 1 on success, -1 on failure.
#[no_mangle]
pub extern "C" fn rs_dns_parse_request(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut std::os::raw::c_void,
state: *mut std::os::raw::c_void,
_pstate: *mut core::AppLayerParserState,
input: *const u8,
input_len: u32,
_data: *mut std::os::raw::c_void)
-> i8 {
_data: *mut std::os::raw::c_void,
_flags: u8)
-> std::os::raw::c_int {
let state = cast_pointer!(state, DNSState);
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
if state.parse_request(buf) {
1
@ -664,12 +667,14 @@ pub extern "C" fn rs_dns_parse_request(_flow: *mut core::Flow,
#[no_mangle]
pub extern "C" fn rs_dns_parse_response(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut std::os::raw::c_void,
state: *mut std::os::raw::c_void,
_pstate: *mut core::AppLayerParserState,
input: *const u8,
input_len: u32,
_data: *mut std::os::raw::c_void)
-> i8 {
_data: *mut std::os::raw::c_void,
_flags: u8)
-> std::os::raw::c_int {
let state = cast_pointer!(state, DNSState);
let buf = unsafe{std::slice::from_raw_parts(input, input_len as usize)};
if state.parse_response(buf) {
1
@ -681,17 +686,19 @@ pub extern "C" fn rs_dns_parse_response(_flow: *mut core::Flow,
/// C binding parse a DNS request. Returns 1 on success, -1 on failure.
#[no_mangle]
pub extern "C" fn rs_dns_parse_request_tcp(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut std::os::raw::c_void,
state: *mut std::os::raw::c_void,
_pstate: *mut core::AppLayerParserState,
input: *const u8,
input_len: u32,
_data: *mut std::os::raw::c_void)
-> i8 {
_data: *mut std::os::raw::c_void,
_flags: u8)
-> std::os::raw::c_int {
let state = cast_pointer!(state, DNSState);
if input_len > 0 {
if input != std::ptr::null_mut() {
let buf = unsafe{
std::slice::from_raw_parts(input, input_len as usize)};
return state.parse_request_tcp(buf);
return state.parse_request_tcp(buf) as std::os::raw::c_int;
}
state.request_gap(input_len);
}
@ -700,17 +707,19 @@ pub extern "C" fn rs_dns_parse_request_tcp(_flow: *mut core::Flow,
#[no_mangle]
pub extern "C" fn rs_dns_parse_response_tcp(_flow: *mut core::Flow,
state: &mut DNSState,
_pstate: *mut std::os::raw::c_void,
state: *mut std::os::raw::c_void,
_pstate: *mut core::AppLayerParserState,
input: *const u8,
input_len: u32,
_data: *mut std::os::raw::c_void)
-> i8 {
_data: *mut std::os::raw::c_void,
_flags: u8)
-> std::os::raw::c_int {
let state = cast_pointer!(state, DNSState);
if input_len > 0 {
if input != std::ptr::null_mut() {
let buf = unsafe{
std::slice::from_raw_parts(input, input_len as usize)};
return state.parse_response_tcp(buf);
return state.parse_response_tcp(buf) as std::os::raw::c_int;
}
state.response_gap(input_len);
}
@ -727,9 +736,9 @@ pub extern "C" fn rs_dns_state_progress_completion_status(
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_alstate_progress(_tx: &mut DNSTransaction,
pub extern "C" fn rs_dns_tx_get_alstate_progress(_tx: *mut std::os::raw::c_void,
_direction: u8)
-> u8
-> std::os::raw::c_int
{
// This is a stateless parser, just the existence of a transaction
// means its complete.
@ -738,10 +747,11 @@ pub extern "C" fn rs_dns_tx_get_alstate_progress(_tx: &mut DNSTransaction,
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_set_detect_flags(tx: &mut DNSTransaction,
pub extern "C" fn rs_dns_tx_set_detect_flags(tx: *mut std::os::raw::c_void,
dir: u8,
flags: u64)
{
let tx = cast_pointer!(tx, DNSTransaction);
if dir & core::STREAM_TOSERVER != 0 {
tx.detect_flags_ts = flags as u64;
} else {
@ -750,10 +760,11 @@ pub extern "C" fn rs_dns_tx_set_detect_flags(tx: &mut DNSTransaction,
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_detect_flags(tx: &mut DNSTransaction,
pub extern "C" fn rs_dns_tx_get_detect_flags(tx: *mut std::os::raw::c_void,
dir: u8)
-> u64
{
let tx = cast_pointer!(tx, DNSTransaction);
if dir & core::STREAM_TOSERVER != 0 {
return tx.detect_flags_ts as u64;
} else {
@ -762,34 +773,38 @@ pub extern "C" fn rs_dns_tx_get_detect_flags(tx: &mut DNSTransaction,
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_set_logged(_state: &mut DNSState,
tx: &mut DNSTransaction,
pub extern "C" fn rs_dns_tx_set_logged(_state: *mut std::os::raw::c_void,
tx: *mut std::os::raw::c_void,
logged: u32)
{
let tx = cast_pointer!(tx, DNSTransaction);
tx.logged.set(logged);
}
#[no_mangle]
pub extern "C" fn rs_dns_tx_get_logged(_state: &mut DNSState,
tx: &mut DNSTransaction)
pub extern "C" fn rs_dns_tx_get_logged(_state: *mut std::os::raw::c_void,
tx: *mut std::os::raw::c_void)
-> u32
{
let tx = cast_pointer!(tx, DNSTransaction);
return tx.logged.get();
}
#[no_mangle]
pub extern "C" fn rs_dns_state_get_tx_count(state: &mut DNSState)
pub extern "C" fn rs_dns_state_get_tx_count(state: *mut std::os::raw::c_void)
-> u64
{
let state = cast_pointer!(state, DNSState);
SCLogDebug!("rs_dns_state_get_tx_count: returning {}", state.tx_id);
return state.tx_id;
}
#[no_mangle]
pub extern "C" fn rs_dns_state_get_tx(state: &mut DNSState,
pub extern "C" fn rs_dns_state_get_tx(state: *mut std::os::raw::c_void,
tx_id: u64)
-> *mut DNSTransaction
-> *mut std::os::raw::c_void
{
let state = cast_pointer!(state, DNSState);
match state.get_tx(tx_id) {
Some(tx) => {
return unsafe{transmute(tx)};
@ -802,17 +817,20 @@ pub extern "C" fn rs_dns_state_get_tx(state: &mut DNSState,
#[no_mangle]
pub extern "C" fn rs_dns_state_set_tx_detect_state(
tx: &mut DNSTransaction,
de_state: &mut core::DetectEngineState)
tx: *mut std::os::raw::c_void,
de_state: &mut core::DetectEngineState) -> std::os::raw::c_int
{
let tx = cast_pointer!(tx, DNSTransaction);
tx.de_state = Some(de_state);
return 0;
}
#[no_mangle]
pub extern "C" fn rs_dns_state_get_tx_detect_state(
tx: &mut DNSTransaction)
tx: *mut std::os::raw::c_void)
-> *mut core::DetectEngineState
{
let tx = cast_pointer!(tx, DNSTransaction);
match tx.de_state {
Some(ds) => {
return ds;

@ -24,11 +24,6 @@
#ifndef __APP_LAYER_DNS_COMMON_H__
#define __APP_LAYER_DNS_COMMON_H__
#include "app-layer-protos.h"
#include "app-layer-parser.h"
/** Opaque Rust types. */
/** \brief DNS packet header */
typedef struct DNSHeader_ {
uint16_t tx_id;
@ -39,7 +34,4 @@ typedef struct DNSHeader_ {
uint16_t additional_rr;
} __attribute__((__packed__)) DNSHeader;
void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, AppProto alproto);
void DNSAppLayerRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto);
#endif /* __APP_LAYER_DNS_COMMON_H__ */

@ -32,24 +32,6 @@
static void RustDNSTCPParserRegisterTests(void);
#endif
static int RustDNSTCPParseRequest(Flow *f, void *state,
AppLayerParserState *pstate, const uint8_t *input, uint32_t input_len,
void *local_data, const uint8_t flags)
{
SCLogDebug("RustDNSTCPParseRequest");
return rs_dns_parse_request_tcp(f, state, pstate, input, input_len,
local_data);
}
static int RustDNSTCPParseResponse(Flow *f, void *state,
AppLayerParserState *pstate, const uint8_t *input, uint32_t input_len,
void *local_data, const uint8_t flags)
{
SCLogDebug("RustDNSTCPParseResponse");
return rs_dns_parse_response_tcp(f, state, pstate, input, input_len,
local_data);
}
static uint16_t RustDNSTCPProbe(Flow *f, uint8_t direction,
const uint8_t *input, uint32_t len, uint8_t *rdir)
{
@ -66,53 +48,6 @@ static uint16_t RustDNSTCPProbe(Flow *f, uint8_t direction,
return ALPROTO_DNS;
}
static int RustDNSGetAlstateProgress(void *tx, uint8_t direction)
{
return rs_dns_tx_get_alstate_progress(tx, direction);
}
static uint64_t RustDNSGetTxCnt(void *alstate)
{
return rs_dns_state_get_tx_count(alstate);
}
static void *RustDNSGetTx(void *alstate, uint64_t tx_id)
{
return rs_dns_state_get_tx(alstate, tx_id);
}
static void RustDNSSetTxLogged(void *alstate, void *tx, LoggerId logged)
{
rs_dns_tx_set_logged(alstate, tx, logged);
}
static LoggerId RustDNSGetTxLogged(void *alstate, void *tx)
{
return rs_dns_tx_get_logged(alstate, tx);
}
static void RustDNSStateTransactionFree(void *state, uint64_t tx_id)
{
rs_dns_state_tx_free(state, tx_id);
}
static DetectEngineState *RustDNSGetTxDetectState(void *tx)
{
return rs_dns_state_get_tx_detect_state(tx);
}
static int RustDNSSetTxDetectState(void *tx,
DetectEngineState *s)
{
rs_dns_state_set_tx_detect_state(tx, s);
return 0;
}
static AppLayerDecoderEvents *RustDNSGetEvents(void *tx)
{
return rs_dns_state_get_events(tx);
}
void RegisterDNSTCPParsers(void)
{
const char *proto_name = "dns";
@ -146,24 +81,24 @@ void RegisterDNSTCPParsers(void)
if (AppLayerParserConfParserEnabled("tcp", proto_name)) {
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_DNS, STREAM_TOSERVER,
RustDNSTCPParseRequest);
rs_dns_parse_request_tcp);
AppLayerParserRegisterParser(IPPROTO_TCP , ALPROTO_DNS, STREAM_TOCLIENT,
RustDNSTCPParseResponse);
rs_dns_parse_response_tcp);
AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_DNS,
rs_dns_state_tcp_new, rs_dns_state_free);
AppLayerParserRegisterTxFreeFunc(IPPROTO_TCP, ALPROTO_DNS,
RustDNSStateTransactionFree);
rs_dns_state_tx_free);
AppLayerParserRegisterGetEventsFunc(IPPROTO_TCP, ALPROTO_DNS,
RustDNSGetEvents);
rs_dns_state_get_events);
AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_DNS,
RustDNSGetTxDetectState, RustDNSSetTxDetectState);
AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_DNS, RustDNSGetTx);
rs_dns_state_get_tx_detect_state, rs_dns_state_set_tx_detect_state);
AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_DNS, rs_dns_state_get_tx);
AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_DNS,
RustDNSGetTxCnt);
rs_dns_state_get_tx_count);
AppLayerParserRegisterLoggerFuncs(IPPROTO_TCP, ALPROTO_DNS,
RustDNSGetTxLogged, RustDNSSetTxLogged);
rs_dns_tx_get_logged, rs_dns_tx_set_logged);
AppLayerParserRegisterGetStateProgressFunc(IPPROTO_TCP, ALPROTO_DNS,
RustDNSGetAlstateProgress);
rs_dns_tx_get_alstate_progress);
AppLayerParserRegisterGetStateProgressCompletionStatus(ALPROTO_DNS,
rs_dns_state_progress_completion_status);
AppLayerParserRegisterGetEventInfo(IPPROTO_TCP, ALPROTO_DNS,
@ -286,7 +221,7 @@ static int RustDNSTCPParserTestMultiRecord(void)
};
size_t reqlen = sizeof(req);
RSDNSState *state = rs_dns_state_new();
void *state = rs_dns_state_new();
Flow *f = UTHBuildFlow(AF_INET, "1.2.3.4", "1.2.3.5", 1024, 53);
FAIL_IF_NULL(f);
@ -294,7 +229,7 @@ static int RustDNSTCPParserTestMultiRecord(void)
f->alproto = ALPROTO_DNS;
f->alstate = state;
FAIL_IF(RustDNSTCPParseRequest(f, f->alstate, NULL, req, reqlen,
FAIL_IF(rs_dns_parse_request_tcp(f, f->alstate, NULL, req, reqlen,
NULL, STREAM_START) < 0);
FAIL_IF(rs_dns_state_get_tx_count(state) != 20);

@ -32,22 +32,6 @@
static void RustDNSUDPParserRegisterTests(void);
#endif
static int RustDNSUDPParseRequest(Flow *f, void *state,
AppLayerParserState *pstate, const uint8_t *input, uint32_t input_len,
void *local_data, const uint8_t flags)
{
return rs_dns_parse_request(f, state, pstate, input, input_len,
local_data);
}
static int RustDNSUDPParseResponse(Flow *f, void *state,
AppLayerParserState *pstate, const uint8_t *input, uint32_t input_len,
void *local_data, const uint8_t flags)
{
return rs_dns_parse_response(f, state, pstate, input, input_len,
local_data);
}
static uint16_t DNSUDPProbe(Flow *f, uint8_t direction,
const uint8_t *input, uint32_t len, uint8_t *rdir)
{
@ -63,62 +47,6 @@ static uint16_t DNSUDPProbe(Flow *f, uint8_t direction,
return ALPROTO_DNS;
}
static int RustDNSGetAlstateProgress(void *tx, uint8_t direction)
{
return rs_dns_tx_get_alstate_progress(tx, direction);
}
static uint64_t RustDNSGetTxCnt(void *alstate)
{
return rs_dns_state_get_tx_count(alstate);
}
static void *RustDNSGetTx(void *alstate, uint64_t tx_id)
{
return rs_dns_state_get_tx(alstate, tx_id);
}
static void RustDNSSetTxLogged(void *alstate, void *tx, LoggerId logged)
{
rs_dns_tx_set_logged(alstate, tx, logged);
}
static LoggerId RustDNSGetTxLogged(void *alstate, void *tx)
{
return rs_dns_tx_get_logged(alstate, tx);
}
static void RustDNSStateTransactionFree(void *state, uint64_t tx_id)
{
rs_dns_state_tx_free(state, tx_id);
}
static DetectEngineState *RustDNSGetTxDetectState(void *tx)
{
return rs_dns_state_get_tx_detect_state(tx);
}
static int RustDNSSetTxDetectState(void *tx, DetectEngineState *s)
{
rs_dns_state_set_tx_detect_state(tx, s);
return 0;
}
static void RustDNSSetDetectFlags(void *tx, uint8_t dir, uint64_t flags)
{
rs_dns_tx_set_detect_flags(tx, dir, flags);
}
static uint64_t RustDNSGetDetectFlags(void *tx, uint8_t dir)
{
return rs_dns_tx_get_detect_flags(tx, dir);
}
static AppLayerDecoderEvents *RustDNSGetEvents(void *tx)
{
return rs_dns_state_get_events(tx);
}
void RegisterDNSUDPParsers(void)
{
const char *proto_name = "dns";
@ -155,27 +83,27 @@ void RegisterDNSUDPParsers(void)
if (AppLayerParserConfParserEnabled("udp", proto_name)) {
AppLayerParserRegisterParser(IPPROTO_UDP, ALPROTO_DNS, STREAM_TOSERVER,
RustDNSUDPParseRequest);
rs_dns_parse_request);
AppLayerParserRegisterParser(IPPROTO_UDP, ALPROTO_DNS, STREAM_TOCLIENT,
RustDNSUDPParseResponse);
rs_dns_parse_response);
AppLayerParserRegisterStateFuncs(IPPROTO_UDP, ALPROTO_DNS,
rs_dns_state_new, rs_dns_state_free);
AppLayerParserRegisterTxFreeFunc(IPPROTO_UDP, ALPROTO_DNS,
RustDNSStateTransactionFree);
rs_dns_state_tx_free);
AppLayerParserRegisterGetEventsFunc(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetEvents);
rs_dns_state_get_events);
AppLayerParserRegisterDetectStateFuncs(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetTxDetectState, RustDNSSetTxDetectState);
rs_dns_state_get_tx_detect_state, rs_dns_state_set_tx_detect_state);
AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetDetectFlags, RustDNSSetDetectFlags);
rs_dns_tx_get_detect_flags, rs_dns_tx_set_detect_flags);
AppLayerParserRegisterGetTx(IPPROTO_UDP, ALPROTO_DNS, RustDNSGetTx);
AppLayerParserRegisterGetTx(IPPROTO_UDP, ALPROTO_DNS, rs_dns_state_get_tx);
AppLayerParserRegisterGetTxCnt(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetTxCnt);
rs_dns_state_get_tx_count);
AppLayerParserRegisterLoggerFuncs(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetTxLogged, RustDNSSetTxLogged);
rs_dns_tx_get_logged, rs_dns_tx_set_logged);
AppLayerParserRegisterGetStateProgressFunc(IPPROTO_UDP, ALPROTO_DNS,
RustDNSGetAlstateProgress);
rs_dns_tx_get_alstate_progress);
AppLayerParserRegisterGetStateProgressCompletionStatus(ALPROTO_DNS,
rs_dns_state_progress_completion_status);
@ -225,7 +153,7 @@ static int RustDNSUDPParserTest01 (void)
f->alstate = rs_dns_state_new();
FAIL_IF_NULL(f->alstate);
FAIL_IF_NOT(RustDNSUDPParseResponse(f, f->alstate, NULL, buf, buflen,
FAIL_IF_NOT(rs_dns_parse_response(f, f->alstate, NULL, buf, buflen,
NULL, STREAM_START));
UTHFreeFlow(f);
@ -256,7 +184,7 @@ static int RustDNSUDPParserTest02 (void)
f->alstate = rs_dns_state_new();
FAIL_IF_NULL(f->alstate);
FAIL_IF_NOT(RustDNSUDPParseResponse(f, f->alstate, NULL, buf, buflen,
FAIL_IF_NOT(rs_dns_parse_response(f, f->alstate, NULL, buf, buflen,
NULL, STREAM_START));
UTHFreeFlow(f);
@ -287,7 +215,7 @@ static int RustDNSUDPParserTest03 (void)
f->alstate = rs_dns_state_new();
FAIL_IF_NULL(f->alstate);
FAIL_IF_NOT(RustDNSUDPParseResponse(f, f->alstate, NULL, buf, buflen,
FAIL_IF_NOT(rs_dns_parse_response(f, f->alstate, NULL, buf, buflen,
NULL, STREAM_START));
UTHFreeFlow(f);
@ -321,7 +249,7 @@ static int RustDNSUDPParserTest04 (void)
f->alstate = rs_dns_state_new();
FAIL_IF_NULL(f->alstate);
FAIL_IF_NOT(RustDNSUDPParseResponse(f, f->alstate, NULL, buf, buflen,
FAIL_IF_NOT(rs_dns_parse_response(f, f->alstate, NULL, buf, buflen,
NULL, STREAM_START));
UTHFreeFlow(f);
@ -355,7 +283,7 @@ static int RustDNSUDPParserTest05 (void)
f->alstate = rs_dns_state_new();
FAIL_IF_NULL(f->alstate);
FAIL_IF(RustDNSUDPParseResponse(f, f->alstate, NULL, buf, buflen,
FAIL_IF(rs_dns_parse_response(f, f->alstate, NULL, buf, buflen,
NULL, STREAM_START) != -1);
UTHFreeFlow(f);

@ -54,7 +54,7 @@
#include "stream-tcp.h"
#include "app-layer.h"
#include "app-layer-dns-common.h"
#include "app-layer-parser.h"
#include "detect-dns-query.h"
#include "detect-engine-dns.h"
@ -275,7 +275,7 @@ static int DetectDnsQueryTest01(void)
0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -380,7 +380,7 @@ static int DetectDnsQueryTest02(void)
0x65, 0x03, 0x6E, 0x65, 0x74, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p1 = NULL, *p2 = NULL, *p3 = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -534,7 +534,7 @@ static int DetectDnsQueryTest03(void)
0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -623,7 +623,7 @@ static int DetectDnsQueryTest04(void)
0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p1 = NULL, *p2 = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -764,7 +764,7 @@ static int DetectDnsQueryTest05(void)
0x65, 0x03, 0x6E, 0x65, 0x74, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -950,7 +950,7 @@ static int DetectDnsQueryTest06(void)
0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p = NULL;
Signature *s = NULL;
ThreadVars tv;
@ -1066,7 +1066,7 @@ static int DetectDnsQueryTest07(void)
0x65, 0x03, 0x6E, 0x65, 0x74, 0x00,
0x00, 0x10, 0x00, 0x01, };
Flow f;
RSDNSState *dns_state = NULL;
void *dns_state = NULL;
Packet *p1 = NULL, *p2 = NULL, *p3 = NULL;
Signature *s = NULL;
ThreadVars tv;

@ -190,7 +190,7 @@ static void AlertJsonDnp3(const Flow *f, const uint64_t tx_id, json_t *js)
static void AlertJsonDns(const Flow *f, const uint64_t tx_id, json_t *js)
{
RSDNSState *dns_state = (RSDNSState *)FlowGetAppState(f);
void *dns_state = (void *)FlowGetAppState(f);
if (dns_state) {
void *txptr = AppLayerParserGetTx(f->proto, ALPROTO_DNS,
dns_state, tx_id);

Loading…
Cancel
Save