Feature #488 » 0002-Convert-to-atomic-and-disable-check-on-HTP-config-ch.patch
src/app-layer-htp.c | ||
---|---|---|
static uint64_t htp_state_memcnt = 0;
|
||
#endif
|
||
/** part of the engine needs the request body (e.g. http_client_body keyword) */
|
||
uint8_t need_htp_request_body = 0;
|
||
/** part of the engine needs the request body multipart header (e.g. filename
|
||
* and / or fileext keywords) */
|
||
uint8_t need_htp_request_multipart_hdr = 0;
|
||
/** part of the engine needs the request file (e.g. log-file module) */
|
||
uint8_t need_htp_request_file = 0;
|
||
/** part of the engine needs the request body (e.g. file_data keyword) */
|
||
uint8_t need_htp_response_body = 0;
|
||
SCEnumCharMap http_decoder_event_table[ ] = {
|
||
{ "UNKNOWN_ERROR",
|
||
HTTP_DECODER_EVENT_UNKNOWN_ERROR},
|
||
... | ... | |
void AppLayerHtpEnableRequestBodyCallback(void)
|
||
{
|
||
SCEnter();
|
||
need_htp_request_body = 1;
|
||
SC_ATOMIC_OR(htp_need, HTP_REQUEST_BODY);
|
||
SCReturn;
|
||
}
|
||
... | ... | |
void AppLayerHtpEnableResponseBodyCallback(void)
|
||
{
|
||
SCEnter();
|
||
need_htp_response_body = 1;
|
||
SC_ATOMIC_OR(htp_need, HTP_RESPONSE_BODY);
|
||
SCReturn;
|
||
}
|
||
... | ... | |
SCEnter();
|
||
AppLayerHtpEnableRequestBodyCallback();
|
||
need_htp_request_multipart_hdr = 1;
|
||
SC_ATOMIC_OR(htp_need, HTP_REQUEST_MULTIPART);
|
||
SCReturn;
|
||
}
|
||
... | ... | |
AppLayerHtpEnableRequestBodyCallback();
|
||
AppLayerHtpEnableResponseBodyCallback();
|
||
need_htp_request_file = 1;
|
||
SC_ATOMIC_OR(htp_need, HTP_REQUEST_FILE);
|
||
SCReturn;
|
||
}
|
||
... | ... | |
{
|
||
SCEnter();
|
||
if (need_htp_request_body == 0)
|
||
if (SC_ATOMIC_GET(htp_need) & HTP_REQUEST_BODY)
|
||
SCReturnInt(HOOK_OK);
|
||
#ifdef PRINT
|
||
... | ... | |
{
|
||
SCEnter();
|
||
if (need_htp_response_body == 0)
|
||
if (SC_ATOMIC_GET(htp_need) & HTP_RESPONSE_BODY)
|
||
SCReturnInt(HOOK_OK);
|
||
HtpState *hstate = (HtpState *)d->tx->connp->user_data;
|
||
... | ... | |
AppLayerRegisterProto(proto_name, ALPROTO_HTTP, STREAM_TOCLIENT,
|
||
HTPHandleResponseData);
|
||
SC_ATOMIC_INIT(htp_need);
|
||
HTPConfigure();
|
||
SCReturn;
|
||
}
|
src/app-layer-htp.h | ||
---|---|---|
} HtpState;
|
||
/** part of the engine needs the request body (e.g. http_client_body keyword) */
|
||
extern uint8_t need_htp_request_body;
|
||
#define HTP_REQUEST_BODY 1 << 0
|
||
/** part of the engine needs the request body multipart header (e.g. filename
|
||
* and / or fileext keywords) */
|
||
extern uint8_t need_htp_request_multipart_hdr;
|
||
#define HTP_REQUEST_MULTIPART 1 << 1
|
||
/** part of the engine needs the request file (e.g. log-file module) */
|
||
extern uint8_t need_htp_request_file;
|
||
#define HTP_REQUEST_FILE 1 << 2
|
||
/** part of the engine needs the request body (e.g. file_data keyword) */
|
||
extern uint8_t need_htp_response_body;
|
||
#define HTP_RESPONSE_BODY 1 << 3
|
||
SC_ATOMIC_DECLARE(uint32_t, htp_need);
|
||
void RegisterHTPParsers(void);
|
||
void HTPParserRegisterTests(void);
|
src/detect-engine.c | ||
---|---|---|
exit(EXIT_FAILURE);
|
||
}
|
||
uint8_t local_need_htp_request_body = need_htp_request_body;
|
||
uint8_t local_need_htp_request_multipart_hdr = need_htp_request_multipart_hdr;
|
||
uint8_t local_need_htp_request_file = need_htp_request_file;
|
||
uint8_t local_need_htp_response_body = need_htp_response_body;
|
||
if (SigLoadSignatures(de_ctx, NULL, FALSE) < 0) {
|
||
SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed.");
|
||
if (de_ctx->failure_fatal)
|
||
exit(EXIT_FAILURE);
|
||
}
|
||
if (local_need_htp_request_body != need_htp_request_body ||
|
||
local_need_htp_request_multipart_hdr != need_htp_request_multipart_hdr ||
|
||
local_need_htp_request_file != need_htp_request_file ||
|
||
local_need_htp_response_body != need_htp_response_body) {
|
||
SCLogInfo("===== New ruleset requires enabling htp features that "
|
||
"can't be enabled at runtime. You will have to restart "
|
||
"engine to load the new ruleset =====");
|
||
DetectEngineCtxFree(de_ctx);
|
||
UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2);
|
||
TmThreadsSetFlag(tv_local, THV_CLOSED);
|
||
pthread_exit(NULL);
|
||
}
|
||
SCThresholdConfInitContext(de_ctx, NULL);
|
||
/* start the process of swapping detect threads ctxs */
|
- « Previous
- 1
- 2
- 3
- 4
- Next »