out:
if (ipp)
IPPairRelease(ipp);
- return;
}
/**
static void FTPIncrMemuse(uint64_t size)
{
- (void) SC_ATOMIC_ADD(ftp_memuse, size);
- return;
+ (void)SC_ATOMIC_ADD(ftp_memuse, size);
}
static void FTPDecrMemuse(uint64_t size)
{
- (void) SC_ATOMIC_SUB(ftp_memuse, size);
- return;
+ (void)SC_ATOMIC_SUB(ftp_memuse, size);
}
uint64_t FTPMemuseGlobalCounter(void)
SCFree(td);
}
-
- return;
}
static FTPTransaction *FTPTransactionCreate(FtpState *state)
{
static void HTPIncrMemuse(uint64_t size)
{
- (void) SC_ATOMIC_ADD(htp_memuse, size);
- return;
+ (void)SC_ATOMIC_ADD(htp_memuse, size);
}
static void HTPDecrMemuse(uint64_t size)
{
- (void) SC_ATOMIC_SUB(htp_memuse, size);
- return;
+ (void)SC_ATOMIC_SUB(htp_memuse, size);
}
uint64_t HTPMemuseGlobalCounter(void)
* config, we have to set the soft limit as well. If libhtp starts using
* the soft limit in the future, we at least make sure we control what
* it's value is. */
- htp_config_set_field_limits(cfg_prec->cfg,
- (size_t)HTP_CONFIG_DEFAULT_FIELD_LIMIT_SOFT,
+ htp_config_set_field_limits(cfg_prec->cfg, (size_t)HTP_CONFIG_DEFAULT_FIELD_LIMIT_SOFT,
(size_t)HTP_CONFIG_DEFAULT_FIELD_LIMIT_HARD);
- return;
}
/* hack: htp random range code expects random values in range of 0-RAND_MAX,
}
htp_config_register_request_line(cfg_prec->cfg, HTPCallbackRequestLine);
- return;
}
static void HTPConfigParseParameters(HTPCfgRec *cfg_prec, ConfNode *s,
p->name);
}
} /* TAILQ_FOREACH(p, &default_config->head, next) */
-
- return;
}
void HTPConfigure(void)
void HtpConfigCreateBackup(void)
{
cfglist_backup = cfglist;
-
- return;
}
void HtpConfigRestoreBackup(void)
{
cfglist = cfglist_backup;
-
- return;
}
/** \test Test case where chunks are sent in smaller chunks and check the
}
ValidateParsers();
- return;
}
#ifdef UNITTESTS
AppLayerParserRegisterProtocolUnittests(IPPROTO_TCP, ALPROTO_SMB, SMBParserRegisterTests);
#endif
-
- return;
}
#ifdef UNITTESTS
SCFree(td);
}
-
- return;
}
static void SMTPTransactionFree(SMTPTransaction *tx, SMTPState *state)
}
SCFree(smtp_state);
-
- return;
}
static void SMTPSetMpmState(void)
}
mpm_table[SMTP_MPM].Prepare(smtp_mpm_ctx);
-
}
static void SMTPFreeMpmState(void)
}
}
return NULL;
-
}
static int SMTPStateGetAlstateProgress(void *vtx, uint8_t direction)
#ifdef UNITTESTS
AppLayerParserRegisterProtocolUnittests(IPPROTO_TCP, ALPROTO_SMTP, SMTPParserRegisterTests);
#endif
- return;
}
/**
UtRegisterTest("SMTPParserTest13", SMTPParserTest13);
UtRegisterTest("SMTPParserTest14", SMTPParserTest14);
#endif /* UNITTESTS */
-
- return;
}
TAILQ_INIT(&ssl_state->client_connp.certs);
SCFree(ssl_state);
-
- return;
}
static void SSLStateTransactionFree(void *state, uint64_t tx_id)
} else {
SCLogConfig("Parser disabled for %s protocol. Protocol detection still on.", proto_name);
}
-
- return;
}
/**
failure:
DisableAppLayer(tv, f, p);
- return;
}
static int TCPProtoDetectTriggerOpposingSide(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
while ((c = strchr(string, '_')))
*c = '-';
-
- return;
}
/**
*val = tmpint;
return 1;
-
}
int ConfGetChildValueIntWithDefault(const ConfNode *base, const ConfNode *dflt,
{
root_backup = root;
root = NULL;
-
- return;
}
/**
{
root = root_backup;
root_backup = NULL;
-
- return;
}
/**
#endif
pca->head[id].value += x;
pca->head[id].updates++;
- return;
}
/**
#endif
pca->head[id].value++;
pca->head[id].updates++;
- return;
}
/**
#endif
pca->head[id].value--;
pca->head[id].updates++;
- return;
}
/**
}
pca->head[id].updates++;
-
- return;
}
static ConfNode *GetConfig(void) {
}
memset(&stats_table, 0, sizeof(stats_table));
SCMutexUnlock(&stats_table_mutex);
-
- return;
}
/**
if (pc != NULL) {
SCFree(pc);
}
-
- return;
}
/**
pc->value = pcae->value;
pc->updates = pcae->updates;
- return;
}
/**
s, d, IPV6_GET_RAW_CLASS(icmp6_ip6h), IPV6_GET_RAW_FLOW(icmp6_ip6h),
IPV6_GET_RAW_NH(icmp6_ip6h), IPV6_GET_RAW_PLEN(icmp6_ip6h), IPV6_GET_RAW_HLIM(icmp6_ip6h));
#endif
-
- return;
}
/** \retval type counterpart type or -1 */
} else {
ENGINE_SET_EVENT(p, IPV4_IN_IPV6_WRONG_IP_VER);
}
- return;
}
/**
DEvents[i].event_name, tv);
}
}
-
- return;
}
void DecodeUpdatePacketCounters(ThreadVars *tv,
{
if (data != NULL)
SCFree(data);
-
- return;
}
static void DefragPolicyAddHostInfo(char *host_ip_range, uint64_t timeout)
SCLogConfig("defrag memory usage: %"PRIu64" bytes, maximum: %"PRIu64,
SC_ATOMIC_GET(defrag_memuse), SC_ATOMIC_GET(defrag_config.memcap));
}
-
- return;
}
/** \brief print some defrag stats
}
(void) SC_ATOMIC_SUB(defrag_memuse, defrag_config.hash_size * sizeof(DefragTrackerHashRow));
DefragTrackerQueueDestroy(&defragtracker_spare_q);
- return;
}
/** \brief compare two raw ipv6 addrs
static void DetectAppLayerProtocolFree(DetectEngineCtx *de_ctx, void *ptr)
{
SCFree(ptr);
- return;
}
/** \internal
sigmatch_table[DETECT_AL_APP_LAYER_PROTOCOL].SetupPrefilter =
PrefilterSetupAppProto;
sigmatch_table[DETECT_AL_APP_LAYER_PROTOCOL].SupportsPrefilter =
- PrefilterAppProtoIsPrefilterable;
- return;
+ PrefilterAppProtoIsPrefilterable;
}
/**********************************Unittests***********************************/
SCFree((void *)bed->name);
SCFree(bed);
}
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/**
if (cd != NULL)
SCFree(cd);
-
- return;
}
/* ---------------------------------- Unit Tests --------------------------- */
char *dir = dirname(tmp);
BUG_ON(dir == NULL);
strlcpy(out, dir, outs);
- return;
}
static int SetupLoadPath(const DetectEngineCtx *de_ctx,
char *dir = dirname(tmp);
BUG_ON(dir == NULL);
strlcpy(out, dir, outs);
- return;
}
static int SetupLoadPath(const DetectEngineCtx *de_ctx,
b[1] = htonl(b[1]);
b[2] = htonl(b[2]);
b[3] = htonl(b[3]);
-
- return;
}
/**
b[1] = htonl(b[1]);
b[2] = htonl(b[2]);
b[3] = htonl(b[3]);
-
- return;
}
/**
b[1] = htonl(a[1]);
b[2] = htonl(a[2]);
b[3] = htonl(a[3]);
-
- return;
}
int DetectAddressCutIPv6(DetectEngineCtx *de_ctx, DetectAddress *a,
UtRegisterTest("AddressTestIPv6CutNot04", AddressTestIPv6CutNot04);
UtRegisterTest("AddressTestIPv6CutNot05", AddressTestIPv6CutNot05);
#endif /* UNITTESTS */
-
- return;
}
return;
SCFree(ag);
- return;
}
/**
HashListTableFree(de_ctx->address_table);
de_ctx->address_table = NULL;
- return;
}
static bool DetectAddressMapAdd(DetectEngineCtx *de_ctx, const char *string,
gh->ipv6_head = NULL;
}
}
-
- return;
}
/**
SCLogDebug("%s/%s", ip, mask);
// printf("%s/%s", ip, mask);
}
-
- return;
}
#endif
SCLogDebug("Appending sid %" PRIu32 ", s->num %" PRIu32 " to alert queue", s->id, s->num);
det_ctx->alert_queue_size++;
- return;
}
/** \internal
SCFree(pat);
fprintf(fp, "\n");
- return;
}
/**
fclose(de_ctx->ea->rule_engine_analysis_fp);
de_ctx->ea->rule_engine_analysis_fp = NULL;
-
- return;
}
static void CleanupRuleAnalyzer(DetectEngineCtx *de_ctx)
fprintf(ea_ctx->rule_engine_analysis_fp, "(with %d transform(s)) ", bt->transforms.cnt);
}
fprintf(ea_ctx->rule_engine_analysis_fp, "buffer.\n");
-
- return;
}
void EngineAnalysisRulesFailure(const DetectEngineCtx *de_ctx, char *line, char *file, int lineno)
}
fprintf(fp, "\n");
}
- return;
}
fprintf(fp, "%s\n", js_s);
free(js_s);
fclose(fp);
- return;
}
static int RulesGroupByProto(DetectEngineCtx *de_ctx)
UtRegisterTest("IPOnlyTestBug5168v1", IPOnlyTestBug5168v1);
UtRegisterTest("IPOnlyTestBug5168v2", IPOnlyTestBug5168v2);
#endif
-
- return;
}
-
cd->id, s->num, flags|MPM_PATTERN_CTX_OWNS_ID);
}
}
-
- return;
}
#define SGH_PROTO(sgh, p) ((sgh)->init->protos[(p)] == 1)
cd->flags |= DETECT_CONTENT_MPM;
s->init_data->mpm_sm_list = mpm_sm_list;
s->init_data->mpm_sm = mpm_sm;
- return;
}
static SigMatch *GetMpmForList(const Signature *s, SigMatch *list, SigMatch *mpm_sm,
#endif
/* assign to signature */
SetMpm(s, mpm_sm, mpm_sm_list);
- return;
}
/** \internal
HashListTableFree(de_ctx->mpm_hash_table);
de_ctx->mpm_hash_table = NULL;
- return;
}
static void MpmStoreSetup(const DetectEngineCtx *de_ctx, MpmStore *ms)
UtRegisterTest("PayloadTestSig33", PayloadTestSig33);
UtRegisterTest("PayloadTestSig34", PayloadTestSig34);
#endif /* UNITTESTS */
-
- return;
}
HashListTableFree(de_ctx->dport_hash_table);
de_ctx->dport_hash_table = NULL;
-
- return;
}
/*---------------------- Unittests -------------------------*/
}
#endif /* UNITTESTS */
-
PrefilterCleanupRuleGroup(de_ctx, sgh);
SCFree(sgh);
-
- return;
}
/**
HashListTableFree(de_ctx->sgh_hash_table);
de_ctx->sgh_hash_table = NULL;
-
- return;
}
/**
}
sgh->init->sig_cnt = cnt;
#endif
- return;
}
/**
sgh->filestore_cnt++;
}
}
-
- return;
}
/** \brief build an array of rule id's for sigs with no prefilter
de_ctx->sc_sig_order_funcs = temp;
else
prev->next = temp;
-
- return;
}
/**
}
}
SCFree(state);
-
- return;
}
static void StoreFileNoMatchCnt(DetectEngineState *de_state, uint16_t file_no_match, uint8_t direction)
{
de_state->dir_state[(direction & STREAM_TOSERVER) ? 0 : 1].filestore_cnt += file_no_match;
-
- return;
}
static bool StoreFilestoreSigsCantMatch(const SigGroupHead *sgh, const DetectEngineState *de_state, uint8_t direction)
UtRegisterTest("DeStateSigTest09", DeStateSigTest09);
UtRegisterTest("DeStateSigTest10", DeStateSigTest10);
#endif
-
- return;
}
/**
HashListTableFree(g_buffer_type_hash);
g_buffer_type_hash = NULL;
- return;
}
#endif
static int DetectBufferTypeAdd(const char *string)
DetectEngineCtxFree(de_ctx);
}
return NULL;
-
}
DetectEngineCtx *DetectEngineCtxInitStubForMT(void)
{
ConfDeInit();
ConfRestoreContextBackup();
-
- return;
}
static int DetectEngineTest01(void)
UtRegisterTest("DetectEngineTest08", DetectEngineTest08);
UtRegisterTest("DetectEngineTest09", DetectEngineTest09);
#endif
- return;
}
new->next = ip->next;
ip->next = new;
}
- return;
}
/**
DetectBufferTypeSupportsMultiInstance("file.magic");
g_file_magic_buffer_id = DetectBufferTypeGetByName("file.magic");
- SCLogDebug("registering filemagic rule option");
- return;
+ SCLogDebug("registering filemagic rule option");
}
#define FILEMAGIC_MIN_SIZE 512
g_file_match_list_id = DetectBufferTypeRegister("files");
SCLogDebug("registering filemd5 rule option");
- return;
}
/**
filehandler_table[DETECT_FILE_NAME].Callback = DetectEngineInspectFilename;
DetectBufferTypeSupportsMultiInstance("file.name");
- return;
}
static int DetectFileextSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
g_file_match_list_id = DetectBufferTypeRegister("files");
SCLogDebug("registering filesha1 rule option");
- return;
}
/**
g_file_match_list_id = DetectBufferTypeRegister("files");
SCLogDebug("registering filesha256 rule option");
- return;
}
/**
"http2", ALPROTO_HTTP2, SIG_FLAG_TOCLIENT, 0, DetectEngineInspectGenericList, NULL);
g_http2_match_buffer_id = DetectBufferTypeRegister("http2");
- return;
}
/**
DetectPktMpmRegister("icmpv4.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
DetectPktInspectEngineRegister("icmpv4.hdr", GetData, DetectEngineInspectPktBufferGeneric);
-
- return;
}
/**
#endif
sigmatch_table[DETECT_ICMPV6MTU].SupportsPrefilter = PrefilterIcmpv6mtuIsPrefilterable;
sigmatch_table[DETECT_ICMPV6MTU].SetupPrefilter = PrefilterSetupIcmpv6mtu;
- return;
}
// returns 0 on no mtu, and 1 if mtu
DetectPktMpmRegister("icmpv6.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
- DetectPktInspectEngineRegister("icmpv6.hdr", GetData,
- DetectEngineInspectPktBufferGeneric);
-
- return;
+ DetectPktInspectEngineRegister("icmpv6.hdr", GetData, DetectEngineInspectPktBufferGeneric);
}
/**
SigMatchFree(de_ctx, sm);
sm = tmp_sm;
}
-
- return;
}
static void DetectIPProtoFree(DetectEngineCtx *de_ctx, void *ptr)
end:
SigFree(NULL, sig);
return result;
-
}
static int DetectIPProtoTestSetup16(void)
end:
SigFree(NULL, sig);
return result;
-
}
static int DetectIPProtoTestSetup17(void)
end:
SigFree(NULL, sig);
return result;
-
}
static int DetectIPProtoTestSetup18(void)
end:
SigFree(NULL, sig);
return result;
-
}
static int DetectIPProtoTestSetup19(void)
DetectPktMpmRegister("ipv4.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
- DetectPktInspectEngineRegister("ipv4.hdr", GetData,
- DetectEngineInspectPktBufferGeneric);
-
- return;
+ DetectPktInspectEngineRegister("ipv4.hdr", GetData, DetectEngineInspectPktBufferGeneric);
}
/**
DetectPktMpmRegister("ipv6.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
- DetectPktInspectEngineRegister("ipv6.hdr", GetData,
- DetectEngineInspectPktBufferGeneric);
-
- return;
+ DetectPktInspectEngineRegister("ipv6.hdr", GetData, DetectEngineInspectPktBufferGeneric);
}
/**
DetectEngineInspectGenericList, NULL);
SCLogDebug("registering lua rule option");
- return;
}
/* Flags for DetectLuaThreadData. */
sm->prev->next = sm->next;
if (sm->next != NULL)
sm->next->prev = sm->prev;
-
- return;
}
/**
sm->next = NULL;
*dst_sm_list_tail = sm;
}
-
- return;
}
int SigMatchListSMBelongsTo(const Signature *s, const SigMatch *key_sm)
{
if (data != NULL)
SCFree(data);
-
- return;
}
/**
HashListTableFree(de_ctx->dup_sig_hash_table);
de_ctx->dup_sig_hash_table = NULL;
-
- return;
}
/**
pcre2_use_jit = 0;
}
#endif
-
- return;
}
/**
VarNameStoreUnregister(pd->capids[i], pd->captypes[i]);
}
SCFree(pd);
-
- return;
}
#ifdef UNITTESTS /* UNITTESTS */
UtRegisterTest("DetectPcreParseHttpHost", DetectPcreParseHttpHost);
UtRegisterTest("DetectPcreParseCaptureTest", DetectPcreParseCaptureTest);
-
}
#endif /* UNITTESTS */
{
if (ptr != NULL)
SCFree(ptr);
-
- return;
}
#ifdef UNITTESTS
DetectPktMpmRegister("tcp.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
- DetectPktInspectEngineRegister("tcp.hdr", GetData,
- DetectEngineInspectPktBufferGeneric);
-
- return;
+ DetectPktInspectEngineRegister("tcp.hdr", GetData, DetectEngineInspectPktBufferGeneric);
}
/**
sigmatch_table[DETECT_TCPMSS].Free = DetectTcpmssFree;
sigmatch_table[DETECT_TCPMSS].SupportsPrefilter = PrefilterTcpmssIsPrefilterable;
sigmatch_table[DETECT_TCPMSS].SetupPrefilter = PrefilterSetupTcpmss;
-
- return;
}
/**
sigmatch_table[DETECT_TEMPLATE2].Free = DetectTemplate2Free;
sigmatch_table[DETECT_TEMPLATE2].SupportsPrefilter = PrefilterTemplate2IsPrefilterable;
sigmatch_table[DETECT_TEMPLATE2].SetupPrefilter = PrefilterSetupTemplate2;
-
- return;
}
/**
UtRegisterTest("DetectTosTest09", DetectTosTest09);
UtRegisterTest("DetectTosTest10", DetectTosTest10);
UtRegisterTest("DetectTosTest12", DetectTosTest12);
- return;
}
#endif
#endif
sigmatch_table[DETECT_TTL].SupportsPrefilter = PrefilterTtlIsPrefilterable;
sigmatch_table[DETECT_TTL].SetupPrefilter = PrefilterSetupTtl;
-
- return;
}
/**
DetectPktMpmRegister("udp.hdr", 2, PrefilterGenericMpmPktRegister, GetData);
- DetectPktInspectEngineRegister("udp.hdr", GetData,
- DetectEngineInspectPktBufferGeneric);
- return;
+ DetectPktInspectEngineRegister("udp.hdr", GetData, DetectEngineInspectPktBufferGeneric);
}
/**
/* see if the packet matches one or more of the sigs */
DetectRun(tv, de_ctx, det_ctx, p);
- return;
}
/** \brief Detection engine thread wrapper.
#ifdef UNITTESTS
#include "tests/detect.c"
#endif
-
/* reset count, so we can kill and respawn (unix socket) */
SC_ATOMIC_SET(flowmgr_cnt, 0);
- return;
}
/** \internal
FatalError("flow manager thread spawn failed");
}
}
- return;
}
typedef struct FlowRecyclerThreadData_ {
FatalError("flow recycler thread spawn failed");
}
}
- return;
}
/**
/* reset count, so we can kill and respawn (unix socket) */
SC_ATOMIC_SET(flowrec_cnt, 0);
- return;
}
void TmModuleFlowManagerRegister (void)
}
FBLOCK_UNLOCK(fb);
}
- return;
}
/**
{
/* Carry out flow reassembly for unattended flows */
FlowForceReassemblyForHash();
- return;
}
AppLayerParserStateCleanup(f, f->alstate, f->alparser);
f->alstate = NULL;
f->alparser = NULL;
- return;
}
/** \brief Set the IPOnly scanned flag for 'direction'.
*/
void FlowSetIPOnlyFlag(Flow *f, int direction)
{
- direction ? (f->flags |= FLOW_TOSERVER_IPONLY_SET) :
- (f->flags |= FLOW_TOCLIENT_IPONLY_SET);
- return;
+ direction ? (f->flags |= FLOW_TOSERVER_IPONLY_SET) : (f->flags |= FLOW_TOCLIENT_IPONLY_SET);
}
/** \brief Set flag to indicate that flow has alerts
SCLogConfig("flow size %u, memcap allows for %" PRIu64 " flows. Per hash row in perfect "
"conditions %" PRIu64,
sz, flow_memcap_copy / sz, (flow_memcap_copy / sz) / flow_config.hash_size);
- return;
}
void FlowReset(void)
FlowQueueDestroy(&flow_recycle_q);
FlowSparePoolDestroy();
DEBUG_VALIDATE_BUG_ON(SC_ATOMIC_GET(flow_memuse) != 0);
- return;
}
/**
SCLogDebug("deltas: new: -%u est: -%u closed: -%u bypassed: -%u",
d->new_timeout, d->est_timeout, d->closed_timeout, d->bypassed_timeout);
}
-
- return;
}
/**
SCLogConfig("host memory usage: %"PRIu64" bytes, maximum: %"PRIu64,
SC_ATOMIC_GET(host_memuse), SC_ATOMIC_GET(host_config.memcap));
}
-
- return;
}
/** \brief print some host stats
SCLogPerf("hostbits added: %" PRIu32 ", removed: %" PRIu32 ", max memory usage: %" PRIu32 "",
hostbits_added, hostbits_removed, hostbits_memuse_max);
#endif /* HOSTBITS_STATS */
- SCLogPerf("host memory usage: %"PRIu64" bytes, maximum: %"PRIu64,
- SC_ATOMIC_GET(host_memuse), SC_ATOMIC_GET(host_config.memcap));
- return;
+ SCLogPerf("host memory usage: %" PRIu64 " bytes, maximum: %" PRIu64, SC_ATOMIC_GET(host_memuse),
+ SC_ATOMIC_GET(host_config.memcap));
}
/** \brief shutdown the flow engine
}
(void) SC_ATOMIC_SUB(host_memuse, host_config.hash_size * sizeof(HostHashRow));
HostQueueDestroy(&host_spare_q);
- return;
}
/** \brief Cleanup the host engine
HRLOCK_UNLOCK(hb);
}
}
-
- return;
}
/* calculate the hash key for this packet
{
RegisterHostStorageTests();
}
-
SCLogConfig("ippair memory usage: %"PRIu64" bytes, maximum: %"PRIu64,
SC_ATOMIC_GET(ippair_memuse), SC_ATOMIC_GET(ippair_config.memcap));
}
-
- return;
}
/** \brief print some ippair stats
SCLogPerf("ippairbits added: %" PRIu32 ", removed: %" PRIu32 ", max memory usage: %" PRIu32 "",
ippairbits_added, ippairbits_removed, ippairbits_memuse_max);
#endif /* IPPAIRBITS_STATS */
- SCLogPerf("ippair memory usage: %"PRIu64" bytes, maximum: %"PRIu64,
+ SCLogPerf("ippair memory usage: %" PRIu64 " bytes, maximum: %" PRIu64,
SC_ATOMIC_GET(ippair_memuse), SC_ATOMIC_GET(ippair_config.memcap));
- return;
}
/** \brief shutdown the flow engine
}
(void) SC_ATOMIC_SUB(ippair_memuse, ippair_config.hash_size * sizeof(IPPairHashRow));
IPPairQueueDestroy(&ippair_spare_q);
- return;
}
/** \brief Cleanup the ippair engine
HRLOCK_UNLOCK(hb);
}
}
-
- return;
}
/** \brief compare two raw ipv6 addrs
PcapLogProfileSetup();
SC_ATOMIC_INIT(thread_cnt);
SC_ATOMIC_SET(thread_cnt, 1); /* first id is 1 */
- return;
}
#define PCAPLOG_PROFILE_START \
}
SCFree(pf);
}
-
- return;
}
/**
pcre2_code_free(pcre_timestamp_code);
pcre2_match_data_free(pcre_timestamp_match);
-
- return;
}
/**
{
if (data != NULL)
SCFree(data);
-
- return;
}
static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, uint8_t value)
*cat = (uint8_t)c;
strlcpy(shortname, ptrs[1], shortname_len);
return 0;
-
}
/**
fclose(fp);
fp = NULL;
return r;
-
}
int SRepLoadFileFromFD(SRepCIDRTree *cidr_ctx, FILE *fp)
"each flow are assigned to a single detect "
"thread.",
RunModeIdsAFPAutoFp, AFPRunModeEnableIPS);
- return;
}
"Workers af-xdp mode, each thread does all"
" tasks from acquisition to logging",
RunModeIdsAFXDPWorkers, NULL);
-
- return;
}
#ifdef HAVE_AF_XDP
"Workers DAG mode, each thread does all "
" tasks from acquisition to logging",
RunModeIdsErfDagWorkers, NULL);
-
- return;
}
int RunModeIdsErfDagSingle(void)
"Multi threaded ERF file mode. Packets from "
"each flow are assigned to a single detect thread",
RunModeErfFileAutoFp, NULL);
-
- return;
}
int RunModeErfFileSingle(void)
RunModeRegisterNewRunMode(RUNMODE_IPFW, "workers",
"Multi queue IPFW IPS mode with one thread per queue", RunModeIpsIPFWWorker, NULL);
-
- return;
}
int RunModeIpsIPFWAutoFp(void)
"each flow are assigned to a single detect "
"thread.",
RunModeIdsNetmapAutoFp, NetmapRunModeEnableIPS);
- return;
}
#ifdef HAVE_NETMAP
RUNMODE_NFLOG, "single", "Single threaded nflog mode", RunModeIdsNflogSingle, NULL);
RunModeRegisterNewRunMode(
RUNMODE_NFLOG, "workers", "Workers nflog mode", RunModeIdsNflogWorkers, NULL);
- return;
}
RunModeRegisterNewRunMode(RUNMODE_NFQ, "workers",
"Multi queue NFQ IPS mode with one thread per queue", RunModeIpsNFQWorker, NULL);
- return;
}
int RunModeIpsNFQAutoFp(void)
"Multi-threaded pcap file mode. Packets from each flow are assigned to a consistent "
"detection thread",
RunModeFilePcapAutoFp, NULL);
-
- return;
}
/**
"Workers pcap live mode, each thread does all"
" tasks from acquisition to logging",
RunModeIdsPcapWorkers, NULL);
-
- return;
}
static void PcapDerefConfig(void *conf)
"Workers pfring mode, each thread does all"
" tasks from acquisition to logging",
RunModeIdsPfringWorkers, NULL);
- return;
}
#ifdef HAVE_PFRING
#ifdef UNITTESTS
UtRunModeRegister();
#endif
- return;
}
/**
"-----------------------\n");
}
}
-
- return;
}
static const char *RunModeGetConfOrDefault(int capture_mode, const char *capture_plugin_name)
}
mode->RunModeFunc = RunModeFunc;
mode->RunModeIsIPSEnabled = RunModeIsIPSEnabled;
-
- return;
}
/**
void StreamTcpReassembleIncrMemuse(uint64_t size)
{
(void) SC_ATOMIC_ADD(ra_memuse, size);
- SCLogDebug("REASSEMBLY %"PRIu64", incr %"PRIu64, StreamTcpReassembleMemuseGlobalCounter(), size);
- return;
+ SCLogDebug("REASSEMBLY %" PRIu64 ", incr %" PRIu64, StreamTcpReassembleMemuseGlobalCounter(),
+ size);
}
/**
BUG_ON(postsize > presize);
}
#endif
- SCLogDebug("REASSEMBLY %"PRIu64", decr %"PRIu64, StreamTcpReassembleMemuseGlobalCounter(), size);
- return;
+ SCLogDebug("REASSEMBLY %" PRIu64 ", decr %" PRIu64, StreamTcpReassembleMemuseGlobalCounter(),
+ size);
}
uint64_t StreamTcpReassembleMemuseGlobalCounter(void)
void StreamTcpIncrMemuse(uint64_t size)
{
(void) SC_ATOMIC_ADD(st_memuse, size);
- SCLogDebug("STREAM %"PRIu64", incr %"PRIu64, StreamTcpMemuseCounter(), size);
- return;
+ SCLogDebug("STREAM %" PRIu64 ", incr %" PRIu64, StreamTcpMemuseCounter(), size);
}
void StreamTcpDecrMemuse(uint64_t size)
BUG_ON(postsize > presize);
}
#endif
- SCLogDebug("STREAM %"PRIu64", decr %"PRIu64, StreamTcpMemuseCounter(), size);
- return;
+ SCLogDebug("STREAM %" PRIu64 ", decr %" PRIu64, StreamTcpMemuseCounter(), size);
}
uint64_t StreamTcpMemuseCounter(void)
else if (stream->os_policy == OS_POLICY_OLD_SOLARIS)
stream->os_policy = OS_POLICY_SOLARIS;
- SCLogDebug("Policy is %"PRIu8"", stream->os_policy);
-
+ SCLogDebug("Policy is %" PRIu8 "", stream->os_policy);
}
/**
StreamTcpSetEvent(p, STREAM_SUSPECTED_RST_INJECT);
return;
}
- return;
}
/**
if (size > ssn->reassembly_depth || size == 0) {
ssn->reassembly_depth = size;
}
-
- return;
}
const char *StreamTcpStateAsString(const enum TcpState state)
b->slot_next = slot;
}
}
- return;
}
#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined sun
}
SCMutexUnlock(&tv_root_lock);
-
- return;
}
static bool ThreadStillHasPackets(ThreadVars *tv)
}
SCMutexUnlock(&tv_root_lock);
- return;
}
/**
* don't process the last live packets together
* with FFR packets */
TmThreadDrainPacketThreads();
- return;
}
#ifdef DEBUG_VALIDATION
}
}
SCMutexUnlock(&tv_root_lock);
- return;
}
#define MIN_WAIT_TIME 100
for (i = 0; i < TVT_MAX; i++) {
TmThreadKillThreadsFamily(i);
}
-
- return;
}
static void TmThreadFree(ThreadVars *tv)
FatalError("Error initializing the tv->cond condition "
"variable");
}
-
- return;
}
static void TmThreadDeinitMC(ThreadVars *tv)
SCCtrlCondDestroy(tv->ctrl_cond);
SCFree(tv->ctrl_cond);
}
- return;
}
/**
if (TmThreadsCheckFlag(tv, THV_KILL))
break;
}
-
- return;
}
/**
while (!TmThreadsCheckFlag(tv, flags)) {
SleepUsec(100);
}
-
- return;
}
/**
void TmThreadContinue(ThreadVars *tv)
{
TmThreadsUnsetFlag(tv, THV_PAUSE);
- return;
}
static TmEcode WaitOnThreadsRunningByType(const int t)
}
}
SCMutexUnlock(&tv_root_lock);
- return;
}
/**
}
}
SCMutexUnlock(&tv_root_lock);
- return;
}
/**
} else {
tmqh_table[TMQH_FLOW].OutHandler = TmqhOutputFlowHash;
}
-
- return;
}
void TmqhFlowPrintAutofpHandler(void)
fctx->size);
SCFree(fctx->queues);
SCFree(fctx);
-
- return;
}
void TmqhOutputFlowHash(ThreadVars *tv, Packet *p)
PacketEnqueue(q, p);
SCCondSignal(&q->cond_q);
SCMutexUnlock(&q->mutex_q);
-
- return;
}
/**
PacketEnqueue(q, p);
SCCondSignal(&q->cond_q);
SCMutexUnlock(&q->mutex_q);
-
- return;
}
static void TmqhOutputFlowFTPHash(ThreadVars *tv, Packet *p)
PacketEnqueue(q, p);
SCCondSignal(&q->cond_q);
SCMutexUnlock(&q->mutex_q);
-
- return;
}
#ifdef UNITTESTS
UtRegisterTest("TmqhOutputFlowSetupCtxTest03",
TmqhOutputFlowSetupCtxTest03);
#endif
-
- return;
}
DEBUG_VALIDATE_BUG_ON(p->flow != NULL);
TmqhOutputPacketpool(NULL, p);
}
-
- return;
}
/** number of packets to keep reserved when calculating the pending
FatalError("Unix socket init failed");
}
}
- return;
}
// TODO can't think of a good name
}
SCMutexUnlock(&tv_root_lock);
- return;
}
#else /* BUILD_UNIX_SOCKET */
void UnixManagerThreadSpawn(int mode)
{
SCLogError("Unix socket is not compiled");
- return;
}
void UnixSocketKillSocketThread(void)
{
- return;
}
void UnixManagerThreadSpawnNonRunmode(const bool unix_socket_enabled)
{
- return;
}
#endif /* BUILD_UNIX_SOCKET */
}
SCMutexInit(&thread_affinity[i].taf_mutex, NULL);
}
- return;
}
void BuildCpusetWithCallback(const char *name, ConfNode *node,
#ifdef UNITTESTS
UtRegisterTest("SCAtomicTest01", SCAtomicTest01);
#endif
-
- return;
}
void MemBufferFree(MemBuffer *buffer)
{
SCFree(buffer);
-
- return;
}
void MemBufferPrintToFP(MemBuffer *buffer, FILE *fp)
}
de_ctx->class_conf_regex_match =
pcre2_match_data_create_from_pattern(de_ctx->class_conf_regex, NULL);
- return;
}
void SCClassConfDeinit(DetectEngineCtx *de_ctx)
HashTableFree(de_ctx->class_conf_ht);
de_ctx->class_conf_ht = NULL;
-
- return;
}
/**
SCFree(ct);
}
-
- return;
}
/**
void SCClassConfClasstypeHashFree(void *ch)
{
SCClassConfDeAllocClasstype(ch);
-
- return;
}
/**
SCMutexUnlock(&sc_log_fg_filters_m[i]);
sc_log_fg_filters[i] = NULL;
}
-
- return;
}
/**
if (thread_list != NULL)
thread_list->entered--;
-
- return;
}
/**
sc_log_fd_filters = NULL;
- SCMutexUnlock( &sc_log_fd_filters_m );
-
- return;
+ SCMutexUnlock(&sc_log_fd_filters_m);
}
/**
sc_log_fg_filters[listtype] = fgf_file_temp;
else
fgf_file->next = fgf_file_temp;
-
- return;
}
/**
fgf_file->func = fgf_func_temp;
else
fgf_func->next = fgf_func_temp;
-
- return;
}
/**
fgf_func->line = fgf_line_temp;
else
fgf_line->next = fgf_line_temp;
-
- return;
}
/**
SCFree(fdf->func);
SCFree(fdf);
}
-
- return;
}
-
#if defined (OS_WIN32)
SCMutexUnlock(&sc_log_stream_lock);
#endif /* OS_WIN32 */
-
- return;
}
/**
//syslog_r(syslog_log_level, NULL, "%s", msg);
syslog(syslog_log_level, "%s", msg);
-
- return;
}
/**
SCFree(temp);
}
-
- return;
}
/**
/* we also set it to a global var, as it is easier to access it */
sc_log_global_log_level = sc_lc->log_level;
-
- return;
}
SCLogLevel SCLogGetLogLevel(void)
printf("Error allocating memory\n");
exit(EXIT_FAILURE);
}
-
- return;
}
/**
sc_lc->op_ifaces = op_ifaces_ctx;
sc_lc->op_ifaces_cnt++;
}
- return;
}
/**
sc_lc->op_filter_regex_match =
pcre2_match_data_create_from_pattern(sc_lc->op_filter_regex, NULL);
}
-
- return;
}
/**
SCLogFreeLogOPIfaceCtx(sc_lid->op_ifaces);
SCFree(sc_lid);
}
-
- return;
}
#endif
#endif
SCLogFreeLogOPIfaceCtx(sc_lc->op_ifaces);
SCFree(sc_lc);
}
-
- return;
}
/**
prev->next = iface_ctx;
sc_lid->op_ifaces_cnt++;
-
- return;
}
#ifdef UNITTESTS
//SCOutputPrint(sc_did->startup_message);
rs_log_set_level(sc_log_global_log_level);
- return;
}
void SCLogLoadConfig(int daemon, int verbose, uint32_t userid, uint32_t groupid)
#if defined (OS_WIN32)
SCMutexDestroy(&sc_log_stream_lock);
#endif /* OS_WIN32 */
-
- return;
}
//------------------------------------Unit_Tests--------------------------------
SCFree(eb->key[1]);
}
SCFree(eb);
- return;
}
/**
{
if (data != NULL)
SCFree(data);
-
- return;
}
/**
SCRadixReleaseRadixTree(sc_hinfo_tree);
sc_hinfo_tree = NULL;
}
-
- return;
}
/**
{
sc_hinfo_tree_backup = sc_hinfo_tree;
sc_hinfo_tree = NULL;
-
- return;
}
static void SCHInfoRestoreContextBackup(void)
{
sc_hinfo_tree = sc_hinfo_tree_backup;
sc_hinfo_tree_backup = NULL;
-
- return;
}
/**
UtRegisterTest("SCHInfoTestLoadFromConfig04", SCHInfoTestLoadFromConfig04);
UtRegisterTest("SCHInfoTestLoadFromConfig05", SCHInfoTestLoadFromConfig05);
#endif /* UNITTESTS */
-
}
}
stream[i] &= mask;
}
-
- return;
}
void LandlockSandboxing(SCInstance *suri)
{
- return;
}
#else /* HAVE_LINUX_LANDLOCK_H */
UtRegisterTest("MacSetTest04", MacSetTest04);
UtRegisterTest("MacSetTest05", MacSetTest05);
#endif
-
- return;
}
//ConfNode *ac_conf;
//const char *hash_val = NULL;
- //ConfNode *pm = ConfGetNode("pattern-matcher");
-
- return;
+ // ConfNode *pm = ConfGetNode("pattern-matcher");
}
/**
output_state->pids = ptmp;
output_state->pids[output_state->no_of_entries - 1] = pid;
-
- return;
}
/**
/* add this pattern id, to the output table of the last state, where the
* pattern ends in the trie */
SCACSetOutputState(state, pid, mpm_ctx);
-
- return;
}
/**
ctx->goto_table[0][ascii_code] = 0;
}
}
-
- return;
}
static inline void SCACDetermineLevel1Gap(MpmCtx *mpm_ctx)
int32_t newstate = SCACInitNewState(mpm_ctx);
ctx->goto_table[0][u] = newstate;
}
-
- return;
}
static inline int SCACStateQueueIsEmpty(StateQueue *q)
if (q->top == q->bot) {
FatalError("Just ran out of space in the queue. Please file a bug report on this");
}
-
- return;
}
static inline int32_t SCACDequeue(StateQueue *q)
output_src_state->pids[i];
}
}
-
- return;
}
/**
}
}
SCFree(q);
-
- return;
}
/**
}
SCFree(q);
}
-
- return;
}
static inline void SCACClubOutputStatePresenceWithDeltaTable(MpmCtx *mpm_ctx)
}
}
}
-
- return;
}
static inline void SCACInsertCaseSensitiveEntriesForPatterns(MpmCtx *mpm_ctx)
}
}
}
-
- return;
}
#if 0
}
}
}
-
- return;
}
#endif
ctx->goto_table = NULL;
SCFree(ctx->failure_table);
ctx->failure_table = NULL;
-
- return;
}
/**
mpm_ctx->ctx = NULL;
mpm_ctx->memory_cnt--;
mpm_ctx->memory_size -= sizeof(SCACCtx);
-
- return;
}
/**
printf("Largest: %" PRIu32 "\n", mpm_ctx->maxlen);
printf("Total states in the state table: %" PRIu32 "\n", ctx->state_count);
printf("\n");
-
- return;
}
mpm_table[MPM_AC].RegisterUnittests = SCACRegisterTests;
#endif
mpm_table[MPM_AC].feature_flags = MPM_FEATURE_FLAG_DEPTH | MPM_FEATURE_FLAG_OFFSET;
- return;
}
/*************************************Unittests********************************/
void SCHSPrintSearchStats(MpmThreadCtx *mpm_thread_ctx)
{
- return;
}
void SCHSPrintInfo(MpmCtx *mpm_ctx)
if (TmThreadSpawn(buf_monitor_tv) != 0) {
FatalError("Failed to spawn thread for NapatechBufMonitor - Killing engine.");
}
-
- return;
}
bool NapatechSetupNuma(uint32_t stream, uint32_t numa)
static void PoolTestFree(void *ptr)
{
- return;
}
static int PoolTestInit01 (void)
DetectPortFree(de_ctx, new_port);
if (stack != NULL)
SCFree(stack);
- return;
}
/**
"\\x%02X", buf[u]);
}
}
-
- return;
}
void PrintRawDataFp(FILE *fp, const uint8_t *buf, uint32_t buflen)
}
if (ch != 16)
PrintBufferData((char *)dst_buf, dst_buf_offset_ptr, dst_buf_size, "\n");
-
- return;
}
void PrintStringsToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32_t dst_buf_size,
}
}
dst_buf[dst_buf_size - 1] = 0;
-
- return;
}
static const char *PrintInetIPv6(const void *src, char *dst, socklen_t size)
lookup_fn->ticks_cnt++;
lookup_fn->cont += l->cont;
}
-
- return;
}
/** \param p void ptr to Packet struct */
#endif
#endif
-
"name: \"%s\"; number: %d",
proto_ent->name, proto_ent->number);
}
- return;
}
static void ProtoNameHashFreeFunc(void *data)
static void SCRadixDeAllocSCRadixUserData(SCRadixUserData *user_data)
{
SCFree(user_data);
-
- return;
}
/**
new->next = prev->next;
prev->next = new;
}
-
- return;
}
/**
FatalError("prefix or user NULL");
}
- SCRadixAppendToSCRadixUserDataList(SCRadixAllocSCRadixUserData(netmask, user),
- &prefix->user_data);
-
- return;
+ SCRadixAppendToSCRadixUserDataList(
+ SCRadixAllocSCRadixUserData(netmask, user), &prefix->user_data);
}
/**
prev = temp;
temp = temp->next;
}
-
- return;
}
/**
SCFree(prefix);
}
-
- return;
}
/**
SCFree(node);
}
-
- return;
}
/**
SCRadixReleaseRadixSubtree(node->right, tree);
SCRadixReleaseNode(node, tree);
}
-
- return;
}
/**
SCRadixReleaseRadixSubtree(tree->head, tree);
tree->head = NULL;
SCFree(tree);
- return;
}
/**
for (i = dest->netmask_cnt, j = 0; j < src->netmask_cnt; i++, j++)
dest->netmasks[i] = src->netmasks[j];
-
- return;
}
/**
return;
}
node->netmasks = ptmp;
-
- return;
}
/**
SCRadixReleaseNode(parent, tree);
SCRadixReleaseNode(node, tree);
SCRadixReleasePrefix(prefix, tree);
-
- return;
}
/**
SCRadixValidateIPv4Key(key_stream, netmask);
#endif
SCRadixRemoveKey(key_stream, 32, tree, netmask);
- return;
}
/**
void SCRadixRemoveKeyIPV4(uint8_t *key_stream, SCRadixTree *tree)
{
SCRadixRemoveKey(key_stream, 32, tree, 32);
- return;
}
/**
SCRadixValidateIPv6Key(key_stream, netmask);
#endif
SCRadixRemoveKey(key_stream, 128, tree, netmask);
- return;
}
/**
void SCRadixRemoveKeyIPV6(uint8_t *key_stream, SCRadixTree *tree)
{
SCRadixRemoveKey(key_stream, 128, tree, 128);
- return;
}
/**
} else {
printf("inter_node)\n");
}
-
- return;
}
/**
SCRadixPrintRadixSubtree(node->left, level + 1, PrintData);
SCRadixPrintRadixSubtree(node->right, level + 1, PrintData);
}
-
- return;
}
/**
printf("Printing the Radix Tree: \n");
SCRadixPrintRadixSubtree(tree->head, 0, tree->PrintData);
-
- return;
}
/*------------------------------------Unit_Tests------------------------------*/
UtRegisterTest("SCRadixTestIPV4NetblockInsertion26",
SCRadixTestIPV4NetblockInsertion26);
#endif
-
- return;
}
}
de_ctx->reference_conf_regex_match =
pcre2_match_data_create_from_pattern(de_ctx->reference_conf_regex, NULL);
- return;
}
void SCReferenceConfDeinit(DetectEngineCtx *de_ctx)
HashTableFree(de_ctx->reference_conf_ht);
de_ctx->reference_conf_ht = NULL;
-
- return;
}
/**
SCFree(ref);
}
-
- return;
}
/**
void SCRConfReferenceHashFree(void *data)
{
SCRConfDeAllocSCRConfReference(data);
-
- return;
}
/**
UtRegisterTest("SCRConfTest05", SCRConfTest05);
UtRegisterTest("SCRConfTest06", SCRConfTest06);
#endif /* UNITTESTS */
-
- return;
}
UtRegisterTest("SCRuleVarsMTest01", SCRuleVarsMTest01);
#endif
-
- return;
}
action.sa_flags = 0;
sigaction(sig, &action, 0);
#endif /* OS_WIN32 */
-
- return;
}
}
*data = NULL;
*data_len = 0;
- return;
}
/** \brief get the data for one SBB */
*data = NULL;
*data_len = 0;
- return;
}
void StreamingBufferSegmentGetData(const StreamingBuffer *sb,
}
*data = NULL;
*data_len = 0;
- return;
}
/**
(void) SC_ATOMIC_SUB(ctx->memuse, ctx->config.hash_size * sizeof(THashHashRow));
THashDataQueueDestroy(&ctx->spare_q);
SCFree(ctx);
- return;
}
/** \brief Walk the hash
}
HRLOCK_UNLOCK(hb);
}
- return;
}
/* calculate the hash key for this packet
{
if (fd != NULL)
fclose(fd);
- return;
}
/** \internal
void UtRunModeRegister(void)
{
RunModeRegisterNewRunMode(RUNMODE_UNITTEST, "unittest", "Unittest mode", NULL, NULL);
-
- return;
}
/*