88 static inline uint8_t DetectRulePacketRules(
ThreadVars *
const tv,
123 DetectRunInspectIPOnly(th_v,
de_ctx, det_ctx, pflow, p);
126 DetectRunGetRuleGroup(
de_ctx, p, pflow, &scratch);
129 if (scratch.
sgh == NULL) {
131 SCLogDebug(
"no sgh for this packet, nothing to match against");
135 "packet %" PRIu64
": no sgh, need to apply default policies",
PcapPacketCntGet(p));
138 DetectRunPrefilterPkt(th_v,
de_ctx, det_ctx, p, &scratch);
142 const uint8_t pkt_policy = DetectRulePacketRules(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
160 if (p->
proto == IPPROTO_TCP) {
163 DetectRunAppendDefaultAccept(det_ctx, p);
175 DetectRunFrames(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
183 DetectRunAppendDefaultAccept(det_ctx, p);
186 }
else if (p->
proto == IPPROTO_UDP) {
187 DetectRunFrames(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
191 DetectRunTx(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
200 DetectRunAppendDefaultAccept(det_ctx, p);
204 DetectRunPostRules(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
206 DetectRunCleanup(det_ctx, p, pflow);
231 if (scratch.
sgh == NULL) {
232 SCLogDebug(
"no sgh for this packet, nothing to match against");
237 DetectRunPrefilterPkt(th_v,
de_ctx, det_ctx, p, &scratch);
241 const uint8_t pkt_policy = DetectRulePacketRules(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
248 DetectRunPostRules(th_v,
de_ctx, det_ctx, p, pflow, &scratch);
250 DetectRunCleanup(det_ctx, p, pflow);
263 SCLogDebug(
"running match functions, sm %p", smd);
300 }
else if (p->
proto == 0) {
301 if (!(PacketIsIPv4(p) || PacketIsIPv6(p))) {
310 int proto = PacketGetIPProto(p);
311 if (
proto == IPPROTO_TCP) {
315 const uint16_t port = dir ? p->
dp : p->
sp;
320 SCLogDebug(
"TCP list %p, port %u, direction %s, sghport %p, sgh %p", list, port,
321 dir ?
"toserver" :
"toclient", sghport, sgh);
322 }
else if (
proto == IPPROTO_UDP) {
324 uint16_t port = dir ? p->
dp : p->
sp;
328 SCLogDebug(
"UDP list %p, port %u, direction %s, sghport %p, sgh %p", list, port,
329 dir ?
"toserver" :
"toclient", sghport, sgh);
337 static inline void DetectPrefilterCopyDeDup(
345 while (final_cnt-- > 0) {
350 if (
likely(
id != previous_id)) {
367 DetectPostInspectFileFlagsUpdate(
Flow *f,
const SigGroupHead *sgh, uint8_t direction)
372 SCLogDebug(
"requesting disabling all file features for flow");
376 SCLogDebug(
"requesting disabling filestore for flow");
380 if (!(sgh->
flags & SIG_GROUP_HEAD_HAVEFILEMAGIC)) {
381 SCLogDebug(
"requesting disabling magic for flow");
386 SCLogDebug(
"requesting disabling md5 for flow");
390 SCLogDebug(
"requesting disabling sha1 for flow");
394 SCLogDebug(
"requesting disabling sha256 for flow");
398 if (flow_file_flags != 0) {
414 SCLogDebug(
"STREAMTCP_STREAM_FLAG_DISABLE_RAW ssn.client");
419 DetectPostInspectFileFlagsUpdate(pflow,
429 SCLogDebug(
"STREAMTCP_STREAM_FLAG_DISABLE_RAW ssn.server");
434 DetectPostInspectFileFlagsUpdate(pflow,
439 static inline void DetectRunGetRuleGroup(
447 bool use_flow_sgh =
false;
450 if (PacketGetIPProto(p) == pflow->
proto) {
454 SCLogDebug(
"sgh = pflow->sgh_toserver; => %p", sgh);
458 SCLogDebug(
"sgh = pflow->sgh_toclient; => %p", sgh);
464 if (!(use_flow_sgh)) {
477 DetectRunPostGetFirstRuleGroup(p, pflow, sgh);
497 SCLogDebug(
"testing against \"ip-only\" signatures");
516 static inline bool DetectRunInspectRuleHeader(
526 const bool fv = f->
flowvar != NULL;
528 SCLogDebug(
"skipping sig as the flow has no flowvars and sig "
529 "has SIG_FLAG_REQUIRE_FLOWVAR flag set.");
534 if (!(s->
proto == NULL)) {
535 const uint8_t s_proto_flags = s->
proto->
flags;
547 if (PacketIsEthernet(p) &&
581 SCLogDebug(
"port-less protocol and sig needs ports");
587 if (PacketIsIPv4(p)) {
590 }
else if (PacketIsIPv6(p)) {
597 if (PacketIsIPv4(p)) {
600 }
else if (PacketIsIPv6(p)) {
628 DetectPrefilterCopyDeDup(
de_ctx, det_ctx);
643 static bool IsOnlyTxInDirection(
Flow *f, uint64_t txid, uint8_t dir)
646 if (tx_cnt == txid + 1) {
650 if (tx_cnt == txid + 2) {
665 static int SortHelper(
const void *a,
const void *b)
671 return sa->
iid > sb->
iid ? 1 : -1;
674 static inline bool SkipFwRules(
const Packet *p)
676 if (p->
flow != NULL) {
700 SCLogDebug(
"packet %" PRIu64
": drop PKT_DROP_REASON_DEFAULT_PACKET_POLICY",
712 SCLogDebug(
"packet %" PRIu64
": accept scope hook upgraded to packet",
732 static inline uint8_t DetectRulePacketRules(
ThreadVars *
const tv,
737 bool fw_verdict =
false;
757 bool skip_fw = SkipFwRules(p);
758 uint32_t sflags, next_sflags = 0;
760 next_s = *match_array++;
761 next_sflags = next_s->
flags;
763 while (match_cnt--) {
765 bool break_out_of_packet_filter =
false;
766 uint8_t alert_flags = 0;
771 sflags = next_sflags;
773 next_s = *match_array++;
774 next_sflags = next_s->
flags;
786 }
else if (have_fw_rules) {
793 break_out_of_packet_filter =
true;
816 if (SigDsizePrefilter(p, s, sflags))
827 if (DetectRunInspectRuleHeader(p, pflow, s, sflags) ==
false) {
838 DetectRunPostMatch(
tv, det_ctx, p, s);
856 if (pflow->
proto != IPPROTO_UDP) {
872 SCLogDebug(
"sig_array_len %u det_ctx->pmq.rule_id_array_cnt %u",
875 for (uint32_t x = 0; x < match_cnt; x++) {
876 *r++ = match_array[x];
877 SCLogDebug(
"appended %u", match_array[x]->
id);
884 if (
ts->app_inspect == NULL) {
896 uint32_t skipped = 0;
897 for (uint32_t x = 0; x < match_cnt; x++) {
899 if (last_sig == *
m) {
906 match_cnt -= skipped;
908 next_s = *match_array++;
909 next_sflags = next_s->
flags;
956 break_out_of_packet_filter =
true;
960 DetectVarProcessList(det_ctx, pflow, p);
961 DetectReplaceFree(det_ctx);
965 if (break_out_of_packet_filter)
975 if (skip_fw || fw_verdict) {
995 uint8_t flow_flags = 0;
996 bool app_decoder_events =
false;
1018 det_ctx->pkt_stream_add_cnt++;
1027 flow_flags = STREAM_TOSERVER;
1030 flow_flags = STREAM_TOCLIENT;
1036 flow_flags |= STREAM_EOF;
1067 (p->
proto == IPPROTO_UDP) ||
1079 SCLogDebug(
"packet doesn't have established flag set (proto %d)", p->
proto);
1118 SCLogDebug(
"packet %" PRIu64
": default action as no verdict set %02x (pkt %s)",
1131 if (pflow != NULL) {
1154 FatalError(
"failed to allocate %" PRIu64
" bytes",
1158 SCLogDebug(
"array initialized to %u elements (%"PRIu64
" bytes)",
1170 const uint32_t need)
1181 uint32_t new_size = needed;
1184 FatalError(
"failed to expand to %" PRIu64
" bytes",
1190 SCLogDebug(
"array expanded from %u to %u elements (%"PRIu64
" bytes -> %"PRIu64
" bytes)",
1203 DetectRunTxSortHelper(
const void *a,
const void *b)
1207 if (s1->
id == s0->
id) {
1214 return s0->
id > s1->
id ? 1 : -1;
1218 #define TRACE_SID_TXS(sid,txs,...) \
1220 char _trace_buf[2048]; \
1221 snprintf(_trace_buf, sizeof(_trace_buf), __VA_ARGS__); \
1222 SCLogNotice("%p/%"PRIu64"/%u: %s", txs->tx_ptr, txs->tx_id, sid, _trace_buf); \
1225 #define TRACE_SID_TXS(sid,txs,...)
1234 tx_ptr = SCDoH2GetDnsTx(tx_ptr, flow_flags);
1239 }
else if (engine_alproto != alproto && engine_alproto !=
ALPROTO_UNKNOWN) {
1263 const uint8_t in_flow_flags,
1267 uint32_t *stored_flags,
1271 const uint8_t flow_flags = in_flow_flags;
1272 const int direction = (flow_flags & STREAM_TOSERVER) ? 0 : 1;
1273 uint32_t inspect_flags = stored_flags ? *stored_flags : 0;
1274 int total_matches = 0;
1275 uint16_t file_no_match = 0;
1276 bool retval =
false;
1277 bool mpm_before_progress =
false;
1278 bool mpm_in_progress =
false;
1280 TRACE_SID_TXS(s->
id, tx,
"starting %s", direction ?
"toclient" :
"toserver");
1283 if (
likely(stored_flags == NULL)) {
1285 if (DetectRunInspectRuleHeader(p, f, s, s->
flags) ==
false) {
1302 TRACE_SID_TXS(s->
id, tx,
"engine %p inspect_flags %x", engine, inspect_flags);
1305 if (!(inspect_flags &
BIT_U32(engine->
id)) &&
1309 if (tx_ptr == NULL) {
1313 engine = engine->
next;
1323 SCLogDebug(
"tx progress %d < engine progress %d",
1330 "engine->mpm: t->tx_progress %u > engine->progress %u, so set "
1331 "mpm_before_progress",
1333 mpm_before_progress =
true;
1336 "engine->mpm: t->tx_progress %u == engine->progress %u, so set "
1340 mpm_in_progress =
true;
1345 uint8_t engine_flags = flow_flags;
1346 if (direction != engine->
dir) {
1347 engine_flags = flow_flags ^ (STREAM_TOCLIENT | STREAM_TOSERVER);
1353 TRACE_SID_TXS(s->
id, tx,
"stream skipped, stored result %d used instead", match);
1358 mpm_before_progress =
true;
1372 de_ctx, det_ctx, engine, s, f, engine_flags, alstate, tx_ptr, tx->
tx_id);
1377 TRACE_SID_TXS(s->
id, tx,
"stream ran, store result %d for next tx (if any)", match);
1382 engine = engine->
next;
1389 engine = engine->
next;
1401 if (engine->
mpm && mpm_before_progress) {
1407 direction != engine->
dir) {
1411 if (direction == 0 && engine->
next == NULL) {
1415 engine = engine->
next;
1419 engine = engine->
next;
1420 }
while (engine != NULL);
1421 TRACE_SID_TXS(s->
id, tx,
"inspect_flags %x, total_matches %u, engine %p",
1422 inspect_flags, total_matches, engine);
1424 if (engine == NULL && total_matches) {
1431 *stored_flags = inspect_flags;
1432 TRACE_SID_TXS(s->
id, tx,
"continue inspect flags %08x", inspect_flags);
1439 if (file_no_match) {
1450 inspect_flags, flow_flags, file_no_match);
1454 "mpm won't trigger for it anymore");
1458 "we may have to revisit anyway");
1460 inspect_flags, flow_flags, file_no_match);
1464 "mpm will revisit it");
1465 }
else if (inspect_flags != 0 || file_no_match != 0) {
1468 inspect_flags, flow_flags, file_no_match);
1477 NULL, 0, NULL, NULL, 0, 0, 0, 0, \
1485 const uint64_t tx_id,
void *tx_ptr,
const int tx_end_state,
const uint8_t flow_flags)
1490 if (!updated && tx_progress < tx_end_state && ((flow_flags & STREAM_EOF) == 0)) {
1494 const uint8_t inspected_flag =
1497 SCLogDebug(
"%" PRIu64
" tx already fully inspected for %s. Flags %02x", tx_id,
1498 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient", txd->
flags);
1505 SCLogDebug(
"%" PRIu64
" tx should not be inspected in direction %s. Flags %02x", tx_id,
1506 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient", txd->
flags);
1511 const uint8_t detect_progress =
1514 const int dir_int = (flow_flags & STREAM_TOSERVER) ? 0 : 1;
1517 tx_de_state ? &tx_de_state->
dir_state[dir_int] : NULL;
1523 .detect_progress = detect_progress,
1524 .detect_progress_orig = detect_progress,
1525 .tx_progress = tx_progress,
1526 .tx_end_state = tx_end_state,
1531 static inline void StoreDetectProgress(
1535 if (flow_flags & STREAM_TOSERVER) {
1544 static inline void RuleMatchCandidateMergeStateRules(
1562 uint32_t j = *array_idx;
1571 uint32_t k = *array_idx;
1593 if (s->
iid <= s0->
id) {
1638 const uint8_t direction,
const uint8_t progress)
1641 if (direction & STREAM_TOSERVER) {
1642 policy = &policies[alproto].
ts[progress];
1643 SCLogDebug(
"packet %" PRIu64
", hook:%u, toserver, policy: action %02x scope %u",
1646 policy = &policies[alproto].
tc[progress];
1647 SCLogDebug(
"packet %" PRIu64
", hook:%u, toclient, policy: action %02x scope %u",
1652 SCLogDebug(
"dropping packet PKT_DROP_REASON_DEFAULT_APP_POLICY");
1663 "packet %" PRIu64
" hook %u default policy ACCEPT",
PcapPacketCntGet(p), progress);
1686 const uint8_t start_hook,
const uint8_t end_hook,
const bool is_last)
1688 uint8_t actions = 0;
1689 for (uint8_t hook = start_hook; hook <= end_hook; hook++) {
1691 direction & STREAM_TOSERVER ?
"toserver" :
"toclient", hook);
1696 actions |= policy->
action;
1705 DetectRunAppendDefaultAccept(det_ctx, p);
1709 SCLogDebug(
"ACTION_SCOPE_TX, setting APP_LAYER_TX_ACCEPT");
1711 DetectRunAppendDefaultAccept(det_ctx, p);
1712 SCLogDebug(
"DetectRunAppendDefaultAccept for last tx");
1719 DetectRunAppendDefaultAccept(det_ctx, p);
1743 DetectRunAppendDefaultAccept(det_ctx, p);
1754 const bool accept_tx_applies_to_packet = last_tx;
1755 if (accept_tx_applies_to_packet) {
1756 SCLogDebug(
"accept:(tx|hook): should be applied to the packet");
1757 DetectRunAppendDefaultAccept(det_ctx, p);
1763 SCLogDebug(
"APP_LAYER_TX_ACCEPT, so skip rule");
1776 SCLogDebug(
"missing fw rules at list start: sid %u, progress %u (%u:%u)", s->
id,
1812 const Signature *s,
const uint32_t can_idx,
const uint32_t can_size,
1823 if (can_idx + 1 < can_size) {
1829 SCLogDebug(
"peek: next sid progress %u != current progress %u, so current "
1830 "is last for progress",
1835 SCLogDebug(
"peek: missing progress, so we'll drop that unless we get a "
1836 "sweeping accept first");
1841 SCLogDebug(
"peek: next sid not a fw rule, so current is last for progress");
1846 SCLogDebug(
"peek: no peek beyond last rule");
1848 SCLogDebug(
"peek: there are no rules to allow the state after this rule");
1891 static inline bool ApplyAcceptToPacket(
1936 SCLogDebug(
"fw fw_skip_app_filter:%s tx_fw_verdict:%s skip_fw_hook:%s "
1937 "skip_before_progress:%u fw_last_for_progress:%s fw_next_progress_missing:%s",
1945 const uint8_t last_hook =
1947 ? (uint8_t)tx_end_state
1960 SCLogDebug(
"accept:tx applied, skip_fw_hook, skip_before_progress %u",
1966 SCLogDebug(
"ACTION_ACCEPT with ACTION_SCOPE_FLOW");
1989 if (rule_cnt == 0) {
1991 DetectRunAppendDefaultAccept(det_ctx, p);
1997 DetectRunAppendDefaultAccept(det_ctx, p);
2014 tx, p, alproto, flow_flags & (STREAM_TOSERVER | STREAM_TOCLIENT),
2036 const uint8_t flow_flags = scratch->
flow_flags;
2038 void *
const alstate = f->
alstate;
2039 const uint8_t ipproto = f->
proto;
2049 uint32_t fw_verdicted = 0;
2050 uint32_t tx_inspected = 0;
2058 if (ires.
tx_ptr == NULL) {
2059 SCLogDebug(
"%p/%" PRIu64
" no transaction to inspect", ires.
tx_ptr, tx_id_min);
2064 GetDetectTx(ipproto, alproto, ires.
tx_id, ires.
tx_ptr, tx_end_state, flow_flags);
2066 SCLogDebug(
"%p/%"PRIu64
" no transaction to inspect",
2072 tx_id_min = tx.
tx_id + 1;
2074 const bool last_tx = (total_txs == tx.
tx_id + 1);
2082 bool do_sort =
false;
2083 uint32_t array_idx = 0;
2093 SCLogDebug(
"%p/%"PRIu64
" rules added from prefilter: %u candidates",
2097 if (!(RuleMatchCandidateTxArrayHasSpace(det_ctx, total_rules))) {
2098 RuleMatchCandidateTxArrayExpand(det_ctx, total_rules);
2112 if (!(RuleMatchCandidateTxArrayHasSpace(det_ctx, total_rules))) {
2113 RuleMatchCandidateTxArrayExpand(det_ctx, total_rules);
2119 uint32_t x = array_idx;
2121 RuleMatchCandidateMergeStateRules(det_ctx, &array_idx);
2125 const uint32_t old = array_idx;
2130 if (have_new_file) {
2131 SCLogDebug(
"%p/%"PRIu64
" destate: need to consider new file",
2138 for (; tx_store != NULL; tx_store = tx_store->
next) {
2144 store_cnt++, state_cnt++)
2161 do_sort |= (old && old != array_idx);
2167 DetectRunTxSortHelper);
2176 for (uint32_t i = 0; i < array_idx; i++) {
2193 SCLogDebug(
"%s: tx_progress %u tx %p have_fw_rules %s array_idx %u detect_progress_orig %u "
2194 "cur detect_progress %u",
2195 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient", tx.
tx_progress,
2199 if (have_fw_rules) {
2202 const int r = DetectTxFirewallNoRulesApplyPolicies(
2203 det_ctx, p, f, &tx, alproto, flow_flags, array_idx, last_tx);
2215 for (uint32_t i = 0; i < array_idx; i++) {
2221 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient", tx.
tx_progress,
2224 if (have_fw_rules) {
2229 det_ctx, p, &tx, flow_flags & (STREAM_TOSERVER | STREAM_TOCLIENT), s, i,
2230 &fw_state, last_tx);
2231 SCLogDebug(
"fw fw_skip_app_filter:%s tx_fw_verdict:%s skip_fw_hook:%s "
2232 "skip_before_progress:%u fw_last_for_progress:%s "
2233 "fw_next_progress_missing:%s",
2250 while ((i + 1) < array_idx &&
2252 SCLogDebug(
"%p/%" PRIu64
" inspecting SKIP NEXT: sid %u (%u), flags %08x",
2258 s->
id, s->
iid, inspect_flags ? *inspect_flags : 0);
2260 if (inspect_flags) {
2263 " inspecting: sid %u (%u), flags %08x DE_STATE_FLAG_FULL_INSPECT",
2270 const bool fw_accept_to_packet = ApplyAcceptToPacket(last_tx, &tx, s);
2272 det_ctx, p, flow_flags, s, &tx, tx_end_state, last_tx, &fw_state);
2273 if (fw_accept_to_packet)
2274 DetectRunAppendDefaultAccept(det_ctx, p);
2280 " inspecting: sid %u (%u), flags %08x DE_STATE_FLAG_SIG_CANT_MATCH",
2292 if (have_fw_rules) {
2294 det_ctx, p, f, &tx, s, i, array_idx, &fw_state);
2295 SCLogDebug(
"fw fw_skip_app_filter:%s tx_fw_verdict:%s skip_fw_hook:%s "
2296 "skip_before_progress:%u fw_last_for_progress:%s "
2297 "fw_next_progress_missing:%s",
2310 const int r = DetectRunTxInspectRule(
tv,
de_ctx, det_ctx, p, f, flow_flags,
2311 alstate, &tx, s, inspect_flags, can, scratch);
2314 DetectRunPostMatch(
tv, det_ctx, p, s);
2323 det_ctx, p, flow_flags, s, &tx, tx_end_state, last_tx, &fw_state);
2328 const bool fw_accept_to_packet = ApplyAcceptToPacket(last_tx, &tx, s);
2329 if (fw_accept_to_packet) {
2330 SCLogDebug(
"accept:(tx|hook): should be applied to the packet");
2334 SCLogDebug(
"drop packet because of rule with drop action");
2337 SCLogDebug(
"drop flow because of rule with drop action");
2346 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient",
2358 SCLogDebug(
"accept hook(s)? current hook %u (tx.detect_progress %u) max %u",
2369 DetectRunAppendDefaultAccept(det_ctx, p);
2374 DetectVarProcessList(det_ctx, p->
flow, p);
2383 uint32_t prev_array_idx = array_idx;
2386 if (
ts->app_inspect != NULL) {
2394 SCLogDebug(
"%p/%" PRIu64
" rule %u (%u) added from 'post match' prefilter",
2398 SCLogDebug(
"%p/%" PRIu64
" rules added from 'post match' prefilter: %u", tx.
tx_ptr,
2399 tx.
tx_id, array_idx - prev_array_idx);
2400 if (prev_array_idx != array_idx) {
2403 DetectRunTxSortHelper);
2421 flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient");
2422 const uint8_t inspected_flag = (flow_flags & STREAM_TOSERVER)
2426 SCLogDebug(
"%p/%" PRIu64
" tx is done for direction %s. Progress %02x", tx.
tx_ptr,
2427 tx.
tx_id, flow_flags & STREAM_TOSERVER ?
"toserver" :
"toclient",
2449 tx_inspected, fw_verdicted);
2451 if (tx_inspected == 0 && fw_verdicted == 0 && have_fw_rules) {
2452 DetectRunAppendDefaultAccept(det_ctx, p);
2467 SCLogDebug(
"pcap_cnt %" PRIu64
": %s: skip frame inspection for TCP w/o APP UPDATE",
2472 if (frames_container == NULL) {
2477 frames = &frames_container->
toserver;
2479 frames = &frames_container->
toclient;
2482 for (uint32_t idx = 0; idx < frames->
cnt; idx++) {
2485 if (frame == NULL) {
2490 uint32_t array_idx = 0;
2498 SCLogDebug(
"%p/%" PRIi64
" rules added from prefilter: %u candidates", frame, frame->
id,
2503 if (!(RuleMatchCandidateTxArrayHasSpace(
2504 det_ctx, total_rules))) {
2505 RuleMatchCandidateTxArrayExpand(det_ctx, total_rules);
2520 uint32_t x = array_idx;
2531 SCLogDebug(
"%p/%" PRIi64
" rule %u (%u) added from 'match' list", frame, frame->
id,
2535 SCLogDebug(
"%p/%" PRIi64
" rules added from 'match' list: %u", frame, frame->
id,
2540 for (uint32_t i = 0; i < array_idx; i++) {
2547 while ((i + 1) < array_idx &&
2551 SCLogDebug(
"%p/%" PRIi64
" inspecting: sid %u (%u)", frame, frame->
id, s->
id, s->
iid);
2554 SCLogDebug(
"%p/%" PRIi64
" Start sid %u", frame, frame->
id, s->
id);
2558 bool r = DetectRunInspectRuleHeader(p, f, s, s->
flags);
2563 DetectRunPostMatch(
tv, det_ctx, p, s);
2568 "%p/%" PRIi64
" sig %u (%u) matched", frame, frame->
id, s->
id, s->
iid);
2575 DetectVarProcessList(det_ctx, p->
flow, p);
2586 "frame->inspect_progress: %" PRIu64
" -> not updated", frame->
inspect_progress);
2589 SCLogDebug(
"%p/%" PRIi64
" rules inspected, running cleanup", frame, frame->
id);
2637 SCLogDebug(
"p->pcap %" PRIu64
": no detection on packet, "
2638 "PKT_NOPACKET_INSPECTION is set",
2696 if (det_ctx == NULL) {
2697 printf(
"ERROR: Detect has no thread ctx\n");
2703 SCLogDebug(
"Detect Engine using new det_ctx - %p",
2714 if (tenant_id > 0 && tenant_id < det_ctx->mt_det_ctxs_cnt) {
2717 if (det_ctx == NULL)
2725 SCLogDebug(
"MT de_ctx %p det_ctx %p (tenant %u)",
de_ctx, det_ctx, tenant_id);
2736 DetectFlow(
tv,
de_ctx, det_ctx, p);
2738 DetectNoFlow(
tv,
de_ctx, det_ctx, p);
2741 #ifdef PROFILE_RULES
2744 gettimeofday(&
ts, NULL);
2745 if (
ts.tv_sec != det_ctx->rule_perf_last_sync) {
2746 SCProfilingRuleThreatAggregate(det_ctx);
2747 det_ctx->rule_perf_last_sync =
ts.tv_sec;
2761 DetectPostInspectFileFlagsUpdate(f, NULL , STREAM_TOSERVER);
2762 DetectPostInspectFileFlagsUpdate(f, NULL , STREAM_TOCLIENT);
2773 DetectFlow(
tv,
de_ctx, det_ctx, p);
2775 DetectNoFlow(
tv,
de_ctx, det_ctx, p);