|
|
|
@ -62,7 +62,7 @@ struct DNSTcpHeader_ {
|
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
|
typedef struct DNSTcpHeader_ DNSTcpHeader;
|
|
|
|
|
|
|
|
|
|
static uint16_t DNSTcpProbingParser(uint8_t *input, uint32_t ilen,
|
|
|
|
|
static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
|
|
|
|
|
uint32_t *offset);
|
|
|
|
|
|
|
|
|
|
/** \internal
|
|
|
|
@ -317,7 +317,7 @@ static int DNSTCPRequestParse(Flow *f, void *dstate,
|
|
|
|
|
|
|
|
|
|
/* Clear gap state. */
|
|
|
|
|
if (dns_state->gap_ts) {
|
|
|
|
|
if (DNSTcpProbingParser(input, input_len, NULL) == ALPROTO_DNS) {
|
|
|
|
|
if (DNSTcpProbingParser(f, input, input_len, NULL) == ALPROTO_DNS) {
|
|
|
|
|
SCLogDebug("New data probed as DNS, clearing gap state.");
|
|
|
|
|
BufferReset(dns_state);
|
|
|
|
|
dns_state->gap_ts = 0;
|
|
|
|
@ -557,7 +557,7 @@ static int DNSTCPResponseParse(Flow *f, void *dstate,
|
|
|
|
|
|
|
|
|
|
/* Clear gap state. */
|
|
|
|
|
if (dns_state->gap_tc) {
|
|
|
|
|
if (DNSTcpProbingParser(input, input_len, NULL) == ALPROTO_DNS) {
|
|
|
|
|
if (DNSTcpProbingParser(f, input, input_len, NULL) == ALPROTO_DNS) {
|
|
|
|
|
SCLogDebug("New data probed as DNS, clearing gap state.");
|
|
|
|
|
BufferReset(dns_state);
|
|
|
|
|
dns_state->gap_tc = 0;
|
|
|
|
@ -639,7 +639,8 @@ bad_data:
|
|
|
|
|
SCReturnInt(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint16_t DNSTcpProbingParser(uint8_t *input, uint32_t ilen, uint32_t *offset)
|
|
|
|
|
static uint16_t DNSTcpProbingParser(Flow *f, uint8_t *input, uint32_t ilen,
|
|
|
|
|
uint32_t *offset)
|
|
|
|
|
{
|
|
|
|
|
if (ilen == 0 || ilen < sizeof(DNSTcpHeader)) {
|
|
|
|
|
SCLogDebug("ilen too small, hoped for at least %"PRIuMAX, (uintmax_t)sizeof(DNSTcpHeader));
|
|
|
|
@ -679,7 +680,7 @@ static uint16_t DNSTcpProbingParser(uint8_t *input, uint32_t ilen, uint32_t *off
|
|
|
|
|
* This is a minimal parser that just checks that the input contains enough
|
|
|
|
|
* data for a TCP DNS response.
|
|
|
|
|
*/
|
|
|
|
|
static uint16_t DNSTcpProbeResponse(uint8_t *input, uint32_t len,
|
|
|
|
|
static uint16_t DNSTcpProbeResponse(Flow *f, uint8_t *input, uint32_t len,
|
|
|
|
|
uint32_t *offset)
|
|
|
|
|
{
|
|
|
|
|
if (len == 0 || len < sizeof(DNSTcpHeader)) {
|
|
|
|
|