src: remove some unused parameters

pull/11199/head
Philippe Antoine 2 years ago committed by Victor Julien
parent aeb200e001
commit a262e203f9

@ -460,7 +460,7 @@ static AppLayerProtoDetectProbingParserPort *AppLayerProtoDetectGetProbingParser
* \brief Call the probing expectation to see if there is some for this flow. * \brief Call the probing expectation to see if there is some for this flow.
* *
*/ */
static AppProto AppLayerProtoDetectPEGetProto(Flow *f, uint8_t ipproto, uint8_t flags) static AppProto AppLayerProtoDetectPEGetProto(Flow *f, uint8_t flags)
{ {
AppProto alproto = ALPROTO_UNKNOWN; AppProto alproto = ALPROTO_UNKNOWN;
@ -1444,7 +1444,7 @@ AppProto AppLayerProtoDetectGetProto(AppLayerProtoDetectThreadCtx *tctx, Flow *f
/* Look if flow can be found in expectation list */ /* Look if flow can be found in expectation list */
if (!FLOW_IS_PE_DONE(f, flags)) { if (!FLOW_IS_PE_DONE(f, flags)) {
alproto = AppLayerProtoDetectPEGetProto(f, ipproto, flags); alproto = AppLayerProtoDetectPEGetProto(f, flags);
} }
end: end:

@ -464,8 +464,8 @@ Frame *AppLayerFrameNewByPointer(Flow *f, const StreamSlice *stream_slice,
return r; return r;
} }
static Frame *AppLayerFrameUdp(Flow *f, const StreamSlice *stream_slice, static Frame *AppLayerFrameUdp(
const uint32_t frame_start_rel, const int64_t len, int dir, uint8_t frame_type) Flow *f, const uint32_t frame_start_rel, const int64_t len, int dir, uint8_t frame_type)
{ {
BUG_ON(f->proto != IPPROTO_UDP); BUG_ON(f->proto != IPPROTO_UDP);
@ -511,7 +511,7 @@ Frame *AppLayerFrameNewByRelativeOffset(Flow *f, const StreamSlice *stream_slice
BUG_ON(f->alparser == NULL); BUG_ON(f->alparser == NULL);
if (f->proto == IPPROTO_UDP) { if (f->proto == IPPROTO_UDP) {
return AppLayerFrameUdp(f, stream_slice, frame_start_rel, len, dir, frame_type); return AppLayerFrameUdp(f, frame_start_rel, len, dir, frame_type);
} }
FramesContainer *frames_container = AppLayerFramesSetupContainer(f); FramesContainer *frames_container = AppLayerFramesSetupContainer(f);
@ -666,8 +666,7 @@ Frame *AppLayerFrameGetById(Flow *f, const int dir, const FrameId frame_id)
return FrameGetById(frames, frame_id); return FrameGetById(frames, frame_id);
} }
static inline bool FrameIsDone( static inline bool FrameIsDone(const Frame *frame, const uint64_t abs_right_edge)
const Frame *frame, const uint64_t abs_offset, const uint64_t abs_right_edge)
{ {
/* frame with negative length means we don't know the size yet. */ /* frame with negative length means we don't know the size yet. */
if (frame->len < 0) if (frame->len < 0)
@ -688,7 +687,6 @@ static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
SCLogDebug("start: left edge %" PRIu64 ", left_edge_rel %u, stream base %" PRIu64, SCLogDebug("start: left edge %" PRIu64 ", left_edge_rel %u, stream base %" PRIu64,
(uint64_t)frames->left_edge_rel + STREAM_BASE_OFFSET(stream), frames->left_edge_rel, (uint64_t)frames->left_edge_rel + STREAM_BASE_OFFSET(stream), frames->left_edge_rel,
STREAM_BASE_OFFSET(stream)); STREAM_BASE_OFFSET(stream));
const uint64_t abs_offset = STREAM_BASE_OFFSET(stream);
const uint64_t acked = StreamTcpGetUsable(stream, eof); const uint64_t acked = StreamTcpGetUsable(stream, eof);
uint64_t le = STREAM_APP_PROGRESS(stream); uint64_t le = STREAM_APP_PROGRESS(stream);
@ -699,7 +697,7 @@ static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
if (i < FRAMES_STATIC_CNT) { if (i < FRAMES_STATIC_CNT) {
Frame *frame = &frames->sframes[i]; Frame *frame = &frames->sframes[i];
FrameDebug("prune(s)", frames, frame); FrameDebug("prune(s)", frames, frame);
if (eof || FrameIsDone(frame, abs_offset, acked)) { if (eof || FrameIsDone(frame, acked)) {
// remove by not incrementing 'x' // remove by not incrementing 'x'
SCLogDebug("removing %p id %" PRIi64, frame, frame->id); SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
FrameDebug("remove(s)", frames, frame); FrameDebug("remove(s)", frames, frame);
@ -720,7 +718,7 @@ static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
const uint16_t o = i - FRAMES_STATIC_CNT; const uint16_t o = i - FRAMES_STATIC_CNT;
Frame *frame = &frames->dframes[o]; Frame *frame = &frames->dframes[o];
FrameDebug("prune(d)", frames, frame); FrameDebug("prune(d)", frames, frame);
if (eof || FrameIsDone(frame, abs_offset, acked)) { if (eof || FrameIsDone(frame, acked)) {
// remove by not incrementing 'x' // remove by not incrementing 'x'
SCLogDebug("removing %p id %" PRIi64, frame, frame->id); SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
FrameDebug("remove(d)", frames, frame); FrameDebug("remove(d)", frames, frame);

@ -216,8 +216,7 @@ int HTPFileOpenWithRange(HtpState *s, HtpTxUserData *txud, const uint8_t *filena
* \retval -1 error * \retval -1 error
* \retval -2 file doesn't need storing * \retval -2 file doesn't need storing
*/ */
int HTPFileStoreChunk( int HTPFileStoreChunk(HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, uint8_t direction)
HtpState *s, HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, uint8_t direction)
{ {
SCEnter(); SCEnter();
@ -303,8 +302,8 @@ bool HTPFileCloseHandleRange(const StreamingBufferConfig *sbcfg, FileContainer *
* \retval -1 error * \retval -1 error
* \retval -2 not storing files on this flow/tx * \retval -2 not storing files on this flow/tx
*/ */
int HTPFileClose(HtpState *s, HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, int HTPFileClose(
uint8_t flags, uint8_t direction) HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, uint8_t flags, uint8_t direction)
{ {
SCEnter(); SCEnter();

@ -33,11 +33,11 @@ int HTPFileOpenWithRange(HtpState *, HtpTxUserData *, const uint8_t *, uint16_t,
uint32_t, htp_tx_t *, bstr *rawvalue, HtpTxUserData *htud); uint32_t, htp_tx_t *, bstr *rawvalue, HtpTxUserData *htud);
bool HTPFileCloseHandleRange(const StreamingBufferConfig *sbcfg, FileContainer *, const uint16_t, bool HTPFileCloseHandleRange(const StreamingBufferConfig *sbcfg, FileContainer *, const uint16_t,
HttpRangeContainerBlock *, const uint8_t *, uint32_t); HttpRangeContainerBlock *, const uint8_t *, uint32_t);
int HTPFileStoreChunk(HtpState *, HtpTxUserData *, const uint8_t *, uint32_t, uint8_t); int HTPFileStoreChunk(HtpTxUserData *, const uint8_t *, uint32_t, uint8_t);
int HTPParseContentRange(bstr *rawvalue, HTTPContentRange *range); int HTPParseContentRange(bstr *rawvalue, HTTPContentRange *range);
int HTPFileClose(HtpState *, HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, int HTPFileClose(HtpTxUserData *tx, const uint8_t *data, uint32_t data_len, uint8_t flags,
uint8_t flags, uint8_t direction); uint8_t direction);
void HTPFileParserRegisterTests(void); void HTPFileParserRegisterTests(void);

@ -1465,8 +1465,7 @@ static int HtpRequestBodyHandleMultipart(HtpState *hstate, HtpTxUserData *htud,
printf("FILEDATA (final chunk) END: \n"); printf("FILEDATA (final chunk) END: \n");
#endif #endif
if (!(htud->tsflags & HTP_DONTSTORE)) { if (!(htud->tsflags & HTP_DONTSTORE)) {
if (HTPFileClose(hstate, htud, filedata, filedata_len, flags, STREAM_TOSERVER) == if (HTPFileClose(htud, filedata, filedata_len, flags, STREAM_TOSERVER) == -1) {
-1) {
goto end; goto end;
} }
} }
@ -1497,8 +1496,7 @@ static int HtpRequestBodyHandleMultipart(HtpState *hstate, HtpTxUserData *htud,
#endif #endif
if (!(htud->tsflags & HTP_DONTSTORE)) { if (!(htud->tsflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk( result = HTPFileStoreChunk(htud, filedata, filedata_len, STREAM_TOSERVER);
hstate, htud, filedata, filedata_len, STREAM_TOSERVER);
if (result == -1) { if (result == -1) {
goto end; goto end;
} else if (result == -2) { } else if (result == -2) {
@ -1598,7 +1596,7 @@ static int HtpRequestBodyHandleMultipart(HtpState *hstate, HtpTxUserData *htud,
} else if (result == -2) { } else if (result == -2) {
htud->tsflags |= HTP_DONTSTORE; htud->tsflags |= HTP_DONTSTORE;
} else { } else {
if (HTPFileClose(hstate, htud, NULL, 0, 0, STREAM_TOSERVER) == -1) { if (HTPFileClose(htud, NULL, 0, 0, STREAM_TOSERVER) == -1) {
goto end; goto end;
} }
} }
@ -1675,7 +1673,7 @@ static int HtpRequestBodyHandleMultipart(HtpState *hstate, HtpTxUserData *htud,
} else if (result == -2) { } else if (result == -2) {
htud->tsflags |= HTP_DONTSTORE; htud->tsflags |= HTP_DONTSTORE;
} else { } else {
if (HTPFileClose(hstate, htud, NULL, 0, 0, STREAM_TOSERVER) == -1) { if (HTPFileClose(htud, NULL, 0, 0, STREAM_TOSERVER) == -1) {
goto end; goto end;
} }
} }
@ -1763,7 +1761,7 @@ static int HtpRequestBodyHandlePOSTorPUT(HtpState *hstate, HtpTxUserData *htud,
/* otherwise, just store the data */ /* otherwise, just store the data */
if (!(htud->tsflags & HTP_DONTSTORE)) { if (!(htud->tsflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, htud, data, data_len, STREAM_TOSERVER); result = HTPFileStoreChunk(htud, data, data_len, STREAM_TOSERVER);
if (result == -1) { if (result == -1) {
goto end; goto end;
} else if (result == -2) { } else if (result == -2) {
@ -1843,7 +1841,7 @@ static int HtpResponseBodyHandle(HtpState *hstate, HtpTxUserData *htud,
/* otherwise, just store the data */ /* otherwise, just store the data */
if (!(htud->tcflags & HTP_DONTSTORE)) { if (!(htud->tcflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, htud, data, data_len, STREAM_TOCLIENT); result = HTPFileStoreChunk(htud, data, data_len, STREAM_TOCLIENT);
SCLogDebug("result %d", result); SCLogDebug("result %d", result);
if (result == -1) { if (result == -1) {
goto end; goto end;
@ -1959,7 +1957,7 @@ static int HTPCallbackRequestBodyData(htp_tx_data_t *d)
} else { } else {
if (tx_ud->tsflags & HTP_FILENAME_SET) { if (tx_ud->tsflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored"); SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, tx_ud, NULL, 0, FILE_TRUNCATED, STREAM_TOSERVER); (void)HTPFileClose(tx_ud, NULL, 0, FILE_TRUNCATED, STREAM_TOSERVER);
tx_ud->tsflags &= ~HTP_FILENAME_SET; tx_ud->tsflags &= ~HTP_FILENAME_SET;
} }
} }
@ -2050,7 +2048,7 @@ static int HTPCallbackResponseBodyData(htp_tx_data_t *d)
} else { } else {
if (tx_ud->tcflags & HTP_FILENAME_SET) { if (tx_ud->tcflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored"); SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, tx_ud, NULL, 0, FILE_TRUNCATED, STREAM_TOCLIENT); (void)HTPFileClose(tx_ud, NULL, 0, FILE_TRUNCATED, STREAM_TOCLIENT);
tx_ud->tcflags &= ~HTP_FILENAME_SET; tx_ud->tcflags &= ~HTP_FILENAME_SET;
} }
} }
@ -2273,7 +2271,7 @@ static int HTPCallbackRequestComplete(htp_tx_t *tx)
if (htud != NULL) { if (htud != NULL) {
if (htud->tsflags & HTP_FILENAME_SET) { if (htud->tsflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored"); SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, htud, NULL, 0, 0, STREAM_TOSERVER); (void)HTPFileClose(htud, NULL, 0, 0, STREAM_TOSERVER);
htud->tsflags &= ~HTP_FILENAME_SET; htud->tsflags &= ~HTP_FILENAME_SET;
if (abs_right_edge < (uint64_t)UINT32_MAX) { if (abs_right_edge < (uint64_t)UINT32_MAX) {
StreamTcpReassemblySetMinInspectDepth( StreamTcpReassemblySetMinInspectDepth(
@ -2328,7 +2326,7 @@ static int HTPCallbackResponseComplete(htp_tx_t *tx)
if (htud != NULL) { if (htud != NULL) {
if (htud->tcflags & HTP_FILENAME_SET) { if (htud->tcflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored"); SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, htud, NULL, 0, 0, STREAM_TOCLIENT); (void)HTPFileClose(htud, NULL, 0, 0, STREAM_TOCLIENT);
htud->tcflags &= ~HTP_FILENAME_SET; htud->tcflags &= ~HTP_FILENAME_SET;
} }
} }

@ -1056,7 +1056,7 @@ int AppLayerDeSetup(void)
SCReturnInt(0); SCReturnInt(0);
} }
AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv) AppLayerThreadCtx *AppLayerGetCtxThread(void)
{ {
SCEnter(); SCEnter();

@ -102,7 +102,7 @@ int AppLayerDeSetup(void);
* \retval Pointer to the newly create thread context, on success; * \retval Pointer to the newly create thread context, on success;
* NULL, on failure. * NULL, on failure.
*/ */
AppLayerThreadCtx *AppLayerGetCtxThread(ThreadVars *tv); AppLayerThreadCtx *AppLayerGetCtxThread(void);
/** /**
* \brief Destroys the context created by AppLayerGetCtxThread(). * \brief Destroys the context created by AppLayerGetCtxThread().
@ -121,21 +121,15 @@ void AppLayerRegisterThreadCounters(ThreadVars *tv);
void AppLayerProfilingResetInternal(AppLayerThreadCtx *app_tctx); void AppLayerProfilingResetInternal(AppLayerThreadCtx *app_tctx);
static inline void AppLayerProfilingReset(AppLayerThreadCtx *app_tctx)
{
#ifdef PROFILING
AppLayerProfilingResetInternal(app_tctx);
#endif
}
void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *p); void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *p);
static inline void AppLayerProfilingStore(AppLayerThreadCtx *app_tctx, Packet *p)
{
#ifdef PROFILING #ifdef PROFILING
AppLayerProfilingStoreInternal(app_tctx, p); #define AppLayerProfilingReset(app_tctx) AppLayerProfilingResetInternal(app_tctx)
#define AppLayerProfilingStore(app_tctx, p) AppLayerProfilingStoreInternal(app_tctx, p)
#else
#define AppLayerProfilingReset(app_tctx)
#define AppLayerProfilingStore(app_tctx, p)
#endif #endif
}
void AppLayerRegisterGlobalCounters(void); void AppLayerRegisterGlobalCounters(void);

@ -776,7 +776,7 @@ DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv)
if ((dtv = SCCalloc(1, sizeof(DecodeThreadVars))) == NULL) if ((dtv = SCCalloc(1, sizeof(DecodeThreadVars))) == NULL)
return NULL; return NULL;
dtv->app_tctx = AppLayerGetCtxThread(tv); dtv->app_tctx = AppLayerGetCtxThread();
if (OutputFlowLogThreadInit(tv, NULL, &dtv->output_flow_thread_data) != TM_ECODE_OK) { if (OutputFlowLogThreadInit(tv, NULL, &dtv->output_flow_thread_data) != TM_ECODE_OK) {
SCLogError("initializing flow log API for thread failed"); SCLogError("initializing flow log API for thread failed");

@ -480,7 +480,7 @@ static int FragBitsTestParse03 (void)
memset(&tv, 0, sizeof(ThreadVars)); memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&dtv, 0, sizeof(DecodeThreadVars));
dtv.app_tctx = AppLayerGetCtxThread(&tv); dtv.app_tctx = AppLayerGetCtxThread();
FlowInitConfig(FLOW_QUIET); FlowInitConfig(FLOW_QUIET);
@ -562,7 +562,7 @@ static int FragBitsTestParse04 (void)
memset(&tv, 0, sizeof(ThreadVars)); memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&dtv, 0, sizeof(DecodeThreadVars));
dtv.app_tctx = AppLayerGetCtxThread(&tv); dtv.app_tctx = AppLayerGetCtxThread();
FlowInitConfig(FLOW_QUIET); FlowInitConfig(FLOW_QUIET);

@ -246,7 +246,7 @@ int DetectReplaceLongPatternMatchTest(uint8_t *raw_eth_pkt, uint16_t pktsize,
PacketCopyData(p, raw_eth_pkt, pktsize); PacketCopyData(p, raw_eth_pkt, pktsize);
memset(&dtv, 0, sizeof(DecodeThreadVars)); memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v)); memset(&th_v, 0, sizeof(th_v));
dtv.app_tctx = AppLayerGetCtxThread(&th_v); dtv.app_tctx = AppLayerGetCtxThread();
FlowInitConfig(FLOW_QUIET); FlowInitConfig(FLOW_QUIET);
DecodeEthernet(&th_v, &dtv, p, GET_PKT_DATA(p), pktsize); DecodeEthernet(&th_v, &dtv, p, GET_PKT_DATA(p), pktsize);

@ -560,7 +560,7 @@ TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv)
if (unlikely(ra_ctx == NULL)) if (unlikely(ra_ctx == NULL))
return NULL; return NULL;
ra_ctx->app_tctx = AppLayerGetCtxThread(tv); ra_ctx->app_tctx = AppLayerGetCtxThread();
SCMutexLock(&segment_thread_pool_mutex); SCMutexLock(&segment_thread_pool_mutex);
if (segment_thread_pool == NULL) { if (segment_thread_pool == NULL) {

@ -139,7 +139,7 @@ TmEcode TmThreadsSlotVarRun(ThreadVars *tv, Packet *p, TmSlot *slot)
/* handle error */ /* handle error */
if (unlikely(r == TM_ECODE_FAILED)) { if (unlikely(r == TM_ECODE_FAILED)) {
/* Encountered error. Return packets to packetpool and return */ /* Encountered error. Return packets to packetpool and return */
TmThreadsSlotProcessPktFail(tv, s, NULL); TmThreadsSlotProcessPktFail(tv, NULL);
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }
if (s->tm_flags & TM_FLAG_DECODE_TM) { if (s->tm_flags & TM_FLAG_DECODE_TM) {

@ -141,7 +141,7 @@ static inline void TmThreadsCleanDecodePQ(PacketQueueNoLock *pq)
} }
} }
static inline void TmThreadsSlotProcessPktFail(ThreadVars *tv, TmSlot *s, Packet *p) static inline void TmThreadsSlotProcessPktFail(ThreadVars *tv, Packet *p)
{ {
if (p != NULL) { if (p != NULL) {
TmqhOutputPacketpool(tv, p); TmqhOutputPacketpool(tv, p);
@ -176,7 +176,7 @@ static inline bool TmThreadsHandleInjectedPackets(ThreadVars *tv)
#endif #endif
TmEcode r = TmThreadsSlotVarRun(tv, extra_p, tv->tm_flowworker); TmEcode r = TmThreadsSlotVarRun(tv, extra_p, tv->tm_flowworker);
if (r == TM_ECODE_FAILED) { if (r == TM_ECODE_FAILED) {
TmThreadsSlotProcessPktFail(tv, tv->tm_flowworker, extra_p); TmThreadsSlotProcessPktFail(tv, extra_p);
break; break;
} }
tv->tmqh_out(tv, extra_p); tv->tmqh_out(tv, extra_p);
@ -199,7 +199,7 @@ static inline TmEcode TmThreadsSlotProcessPkt(ThreadVars *tv, TmSlot *s, Packet
TmEcode r = TmThreadsSlotVarRun(tv, p, s); TmEcode r = TmThreadsSlotVarRun(tv, p, s);
if (unlikely(r == TM_ECODE_FAILED)) { if (unlikely(r == TM_ECODE_FAILED)) {
TmThreadsSlotProcessPktFail(tv, s, p); TmThreadsSlotProcessPktFail(tv, p);
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }

@ -178,7 +178,7 @@ static const char *SCClassConfGetConfFilename(const DetectEngineCtx *de_ctx)
/** /**
* \brief Releases resources used by the Classification Config API. * \brief Releases resources used by the Classification Config API.
*/ */
static void SCClassConfDeInitLocalResources(DetectEngineCtx *de_ctx, FILE *fd) static void SCClassConfDeInitLocalResources(FILE *fd)
{ {
if (fd != NULL) { if (fd != NULL) {
fclose(fd); fclose(fd);
@ -549,7 +549,7 @@ bool SCClassConfLoadClassificationConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
ret = false; ret = false;
} }
SCClassConfDeInitLocalResources(de_ctx, fd); SCClassConfDeInitLocalResources(fd);
return ret; return ret;
} }

@ -61,7 +61,7 @@ void SetMasterExceptionPolicy(void)
g_eps_master_switch = ExceptionPolicyParse("exception-policy", true); g_eps_master_switch = ExceptionPolicyParse("exception-policy", true);
} }
static enum ExceptionPolicy GetMasterExceptionPolicy(const char *option) static enum ExceptionPolicy GetMasterExceptionPolicy(void)
{ {
return g_eps_master_switch; return g_eps_master_switch;
} }
@ -208,7 +208,7 @@ static enum ExceptionPolicy ExceptionPolicyGetDefault(
{ {
enum ExceptionPolicy p = EXCEPTION_POLICY_NOT_SET; enum ExceptionPolicy p = EXCEPTION_POLICY_NOT_SET;
if (g_eps_have_exception_policy) { if (g_eps_have_exception_policy) {
p = GetMasterExceptionPolicy(option); p = GetMasterExceptionPolicy();
if (p == EXCEPTION_POLICY_AUTO) { if (p == EXCEPTION_POLICY_AUTO) {
p = ExceptionPolicyPickAuto(midstream, support_flow); p = ExceptionPolicyPickAuto(midstream, support_flow);

@ -167,13 +167,11 @@ static const char *SCRConfGetConfFilename(const DetectEngineCtx *de_ctx)
/** /**
* \brief Releases local resources used by the Reference Config API. * \brief Releases local resources used by the Reference Config API.
*/ */
static void SCRConfDeInitLocalResources(DetectEngineCtx *de_ctx, FILE *fd) static void SCRConfDeInitLocalResources(FILE *fd)
{ {
if (fd != NULL) { if (fd != NULL) {
fclose(fd); fclose(fd);
} }
return;
} }
/** /**
@ -506,7 +504,7 @@ int SCRConfLoadReferenceConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
} }
bool rc = SCRConfParseFile(de_ctx, fd); bool rc = SCRConfParseFile(de_ctx, fd);
SCRConfDeInitLocalResources(de_ctx, fd); SCRConfDeInitLocalResources(fd);
return rc ? 0 : -1; return rc ? 0 : -1;
} }

@ -153,9 +153,9 @@ static inline bool RegionsIntersect(const StreamingBufferConfig *cfg,
/** \internal /** \internal
* \brief find the first region for merging. * \brief find the first region for merging.
*/ */
static StreamingBufferRegion *FindFirstRegionForOffset(const StreamingBuffer *sb, static StreamingBufferRegion *FindFirstRegionForOffset(const StreamingBufferConfig *cfg,
const StreamingBufferConfig *cfg, StreamingBufferRegion *r, const uint64_t offset, StreamingBufferRegion *r, const uint64_t offset, const uint32_t len,
const uint32_t len, StreamingBufferRegion **prev) StreamingBufferRegion **prev)
{ {
const uint64_t data_re = offset + len; const uint64_t data_re = offset + len;
SCLogDebug("looking for first region matching %" PRIu64 "/%" PRIu64, offset, data_re); SCLogDebug("looking for first region matching %" PRIu64 "/%" PRIu64, offset, data_re);
@ -172,9 +172,8 @@ static StreamingBufferRegion *FindFirstRegionForOffset(const StreamingBuffer *sb
return NULL; return NULL;
} }
static StreamingBufferRegion *FindLargestRegionForOffset(const StreamingBuffer *sb, static StreamingBufferRegion *FindLargestRegionForOffset(const StreamingBufferConfig *cfg,
const StreamingBufferConfig *cfg, StreamingBufferRegion *r, const uint64_t offset, StreamingBufferRegion *r, const uint64_t offset, const uint32_t len)
const uint32_t len)
{ {
const uint64_t data_re = offset + len; const uint64_t data_re = offset + len;
SCLogDebug("starting at %p/%" PRIu64 ", offset %" PRIu64 ", data_re %" PRIu64, r, SCLogDebug("starting at %p/%" PRIu64 ", offset %" PRIu64 ", data_re %" PRIu64, r,
@ -197,9 +196,8 @@ static StreamingBufferRegion *FindLargestRegionForOffset(const StreamingBuffer *
return candidate; return candidate;
} }
static StreamingBufferRegion *FindRightEdge(const StreamingBuffer *sb, static StreamingBufferRegion *FindRightEdge(const StreamingBufferConfig *cfg,
const StreamingBufferConfig *cfg, StreamingBufferRegion *r, const uint64_t offset, StreamingBufferRegion *r, const uint64_t offset, const uint32_t len)
const uint32_t len)
{ {
const uint64_t data_re = offset + len; const uint64_t data_re = offset + len;
StreamingBufferRegion *candidate = r; StreamingBufferRegion *candidate = r;
@ -368,8 +366,8 @@ static int WARN_UNUSED SBBInit(StreamingBuffer *sb, const StreamingBufferConfig
* *
* [gap][block] * [gap][block]
**/ **/
static int WARN_UNUSED SBBInitLeadingGap(StreamingBuffer *sb, const StreamingBufferConfig *cfg, static int WARN_UNUSED SBBInitLeadingGap(
StreamingBufferRegion *region, uint64_t offset, uint32_t data_len) StreamingBuffer *sb, const StreamingBufferConfig *cfg, uint64_t offset, uint32_t data_len)
{ {
DEBUG_VALIDATE_BUG_ON(!RB_EMPTY(&sb->sbb_tree)); DEBUG_VALIDATE_BUG_ON(!RB_EMPTY(&sb->sbb_tree));
@ -1384,21 +1382,21 @@ static StreamingBufferRegion *BufferInsertAtRegionDo(StreamingBuffer *sb,
SCLogDebug("offset %" PRIu64 ", len %u", offset, len); SCLogDebug("offset %" PRIu64 ", len %u", offset, len);
StreamingBufferRegion *start_prev = NULL; StreamingBufferRegion *start_prev = NULL;
StreamingBufferRegion *start = StreamingBufferRegion *start =
FindFirstRegionForOffset(sb, cfg, &sb->region, offset, len, &start_prev); FindFirstRegionForOffset(cfg, &sb->region, offset, len, &start_prev);
if (start) { if (start) {
const uint64_t insert_re = offset + len; const uint64_t insert_re = offset + len;
const uint64_t insert_start_offset = MIN(start->stream_offset, offset); const uint64_t insert_start_offset = MIN(start->stream_offset, offset);
uint64_t insert_adjusted_re = insert_re; uint64_t insert_adjusted_re = insert_re;
SCLogDebug("start region %p/%" PRIu64 "/%u", start, start->stream_offset, start->buf_size); SCLogDebug("start region %p/%" PRIu64 "/%u", start, start->stream_offset, start->buf_size);
StreamingBufferRegion *big = FindLargestRegionForOffset(sb, cfg, start, offset, len); StreamingBufferRegion *big = FindLargestRegionForOffset(cfg, start, offset, len);
DEBUG_VALIDATE_BUG_ON(big == NULL); DEBUG_VALIDATE_BUG_ON(big == NULL);
if (big == NULL) { if (big == NULL) {
sc_errno = SC_EINVAL; sc_errno = SC_EINVAL;
return NULL; return NULL;
} }
SCLogDebug("big region %p/%" PRIu64 "/%u", big, big->stream_offset, big->buf_size); SCLogDebug("big region %p/%" PRIu64 "/%u", big, big->stream_offset, big->buf_size);
StreamingBufferRegion *end = FindRightEdge(sb, cfg, big, offset, len); StreamingBufferRegion *end = FindRightEdge(cfg, big, offset, len);
DEBUG_VALIDATE_BUG_ON(end == NULL); DEBUG_VALIDATE_BUG_ON(end == NULL);
if (end == NULL) { if (end == NULL) {
sc_errno = SC_EINVAL; sc_errno = SC_EINVAL;
@ -1461,8 +1459,7 @@ static StreamingBufferRegion *BufferInsertAtRegionDo(StreamingBuffer *sb,
* \note sets sc_errno * \note sets sc_errno
*/ */
static StreamingBufferRegion *BufferInsertAtRegion(StreamingBuffer *sb, static StreamingBufferRegion *BufferInsertAtRegion(StreamingBuffer *sb,
const StreamingBufferConfig *cfg, const uint8_t *data, const uint32_t data_len, const StreamingBufferConfig *cfg, const uint32_t data_len, const uint64_t data_offset)
const uint64_t data_offset)
{ {
SCLogDebug("data_offset %" PRIu64 ", data_len %u, re %" PRIu64, data_offset, data_len, SCLogDebug("data_offset %" PRIu64 ", data_len %u, re %" PRIu64, data_offset, data_len,
data_offset + data_len); data_offset + data_len);
@ -1519,7 +1516,7 @@ int StreamingBufferInsertAt(StreamingBuffer *sb, const StreamingBufferConfig *cf
return SC_EINVAL; return SC_EINVAL;
} }
StreamingBufferRegion *region = BufferInsertAtRegion(sb, cfg, data, data_len, offset); StreamingBufferRegion *region = BufferInsertAtRegion(sb, cfg, data_len, offset);
if (region == NULL) { if (region == NULL) {
return sc_errno; return sc_errno;
} }
@ -1590,7 +1587,7 @@ int StreamingBufferInsertAt(StreamingBuffer *sb, const StreamingBufferConfig *cf
} else { } else {
/* gap before data in empty list */ /* gap before data in empty list */
SCLogDebug("empty sbb list: invoking SBBInitLeadingGap"); SCLogDebug("empty sbb list: invoking SBBInitLeadingGap");
if ((r = SBBInitLeadingGap(sb, cfg, region, offset, data_len)) != SC_OK) if ((r = SBBInitLeadingGap(sb, cfg, offset, data_len)) != SC_OK)
return r; return r;
} }
} }
@ -1603,7 +1600,7 @@ int StreamingBufferInsertAt(StreamingBuffer *sb, const StreamingBufferConfig *cf
} else { } else {
/* gap before data in empty list */ /* gap before data in empty list */
SCLogDebug("empty sbb list: invoking SBBInitLeadingGap"); SCLogDebug("empty sbb list: invoking SBBInitLeadingGap");
if ((r = SBBInitLeadingGap(sb, cfg, region, offset, data_len)) != SC_OK) if ((r = SBBInitLeadingGap(sb, cfg, offset, data_len)) != SC_OK)
return r; return r;
} }
if (rel_offset == region->buf_offset) { if (rel_offset == region->buf_offset) {

@ -344,9 +344,8 @@ error:
* \retval -1 error * \retval -1 error
*/ */
static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid, static int SetupThresholdRule(DetectEngineCtx *de_ctx, uint32_t id, uint32_t gid,
uint8_t parsed_type, uint8_t parsed_track, uint32_t parsed_count, uint8_t parsed_type, uint8_t parsed_track, uint32_t parsed_count, uint32_t parsed_seconds,
uint32_t parsed_seconds, uint32_t parsed_timeout, uint8_t parsed_new_action, uint32_t parsed_timeout, uint8_t parsed_new_action)
const char *th_ip)
{ {
Signature *s = NULL; Signature *s = NULL;
SigMatch *sm = NULL; SigMatch *sm = NULL;
@ -894,9 +893,8 @@ static int SCThresholdConfAddThresholdtype(char *rawstr, DetectEngineCtx *de_ctx
parsed_count, parsed_seconds, parsed_timeout, parsed_new_action, parsed_count, parsed_seconds, parsed_timeout, parsed_new_action,
th_ip); th_ip);
} else { } else {
r = SetupThresholdRule(de_ctx, id, gid, parsed_type, parsed_track, r = SetupThresholdRule(de_ctx, id, gid, parsed_type, parsed_track, parsed_count,
parsed_count, parsed_seconds, parsed_timeout, parsed_new_action, parsed_seconds, parsed_timeout, parsed_new_action);
th_ip);
} }
if (r < 0) { if (r < 0) {
goto error; goto error;

Loading…
Cancel
Save