|
|
|
|
@ -55,10 +55,6 @@ struct AppLayerThreadCtx_ {
|
|
|
|
|
/* App layer parser thread context, from AppLayerParserThreadCtxAlloc(). */
|
|
|
|
|
AppLayerParserThreadCtx *alp_tctx;
|
|
|
|
|
|
|
|
|
|
uint16_t counter_dns_memuse;
|
|
|
|
|
uint16_t counter_dns_memcap_state;
|
|
|
|
|
uint16_t counter_dns_memcap_global;
|
|
|
|
|
|
|
|
|
|
#ifdef PROFILING
|
|
|
|
|
uint64_t ticks_start;
|
|
|
|
|
uint64_t ticks_end;
|
|
|
|
|
@ -70,19 +66,6 @@ struct AppLayerThreadCtx_ {
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** \todo move this into the DNS code. Problem is that there we can't
|
|
|
|
|
* access AppLayerThreadCtx internals. */
|
|
|
|
|
static void DNSUpdateCounters(ThreadVars *tv, AppLayerThreadCtx *app_tctx)
|
|
|
|
|
{
|
|
|
|
|
uint64_t memuse = 0, memcap_state = 0, memcap_global = 0;
|
|
|
|
|
|
|
|
|
|
DNSMemcapGetCounters(&memuse, &memcap_state, &memcap_global);
|
|
|
|
|
|
|
|
|
|
StatsSetUI64(tv, app_tctx->counter_dns_memuse, memuse);
|
|
|
|
|
StatsSetUI64(tv, app_tctx->counter_dns_memcap_state, memcap_state);
|
|
|
|
|
StatsSetUI64(tv, app_tctx->counter_dns_memcap_global, memcap_global);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** L7 layer dispatchers *****/
|
|
|
|
|
|
|
|
|
|
static void DisableAppLayer(Flow *f)
|
|
|
|
|
@ -434,9 +417,6 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \fixme a bit hacky but will be improved in 2.1 */
|
|
|
|
|
if (*alproto == ALPROTO_DNS)
|
|
|
|
|
DNSUpdateCounters(tv, app_tctx);
|
|
|
|
|
goto end;
|
|
|
|
|
failure:
|
|
|
|
|
r = -1;
|
|
|
|
|
@ -461,7 +441,6 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
|
|
|
|
|
SCEnter();
|
|
|
|
|
|
|
|
|
|
int r = 0;
|
|
|
|
|
AppProto alproto;
|
|
|
|
|
|
|
|
|
|
FLOWLOCK_WRLOCK(f);
|
|
|
|
|
|
|
|
|
|
@ -516,13 +495,10 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
|
|
|
|
|
"for l7");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
alproto = f->alproto;
|
|
|
|
|
|
|
|
|
|
FLOWLOCK_UNLOCK(f);
|
|
|
|
|
PACKET_PROFILING_APP_STORE(tctx, p);
|
|
|
|
|
|
|
|
|
|
if (alproto == ALPROTO_DNS)
|
|
|
|
|
DNSUpdateCounters(tv, tctx);
|
|
|
|
|
SCReturnInt(r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -599,13 +575,6 @@ AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv)
|
|
|
|
|
if ((app_tctx->alp_tctx = AppLayerParserThreadCtxAlloc()) == NULL)
|
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
|
/* tv is allowed to be NULL in unittests */
|
|
|
|
|
if (tv != NULL) {
|
|
|
|
|
app_tctx->counter_dns_memuse = StatsRegisterCounter("dns.memuse", tv);
|
|
|
|
|
app_tctx->counter_dns_memcap_state = StatsRegisterCounter("dns.memcap_state", tv);
|
|
|
|
|
app_tctx->counter_dns_memcap_global = StatsRegisterCounter("dns.memcap_global", tv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
|
error:
|
|
|
|
|
AppLayerDestroyCtxThread(app_tctx);
|
|
|
|
|
|