Skip to content

Commit

Permalink
detect/alert: Drop packet if rule is pkt only
Browse files Browse the repository at this point in the history
This commit modifies the logic used to determine the disposition of a
flow/packet.

If the rule contains packet match properties, the flow shouldn't be
dropped.

Issue: 5578
  • Loading branch information
jlucovsky committed Oct 20, 2023
1 parent 757fa21 commit 7638a3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/detect-engine-alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,13 @@ static inline void FlowApplySignatureActions(
if ((pa->flags & (PACKET_ALERT_FLAG_STATE_MATCH | PACKET_ALERT_FLAG_STREAM_MATCH)) ||
(s->flags & (SIG_FLAG_IPONLY | SIG_FLAG_LIKE_IPONLY | SIG_FLAG_PDONLY |
SIG_FLAG_APPLAYER))) {

/* No action when the signature doesn't require a stream */
if ((s->flags &
(SIG_FLAG_APPLAYER | SIG_FLAG_REQUIRE_PACKET | SIG_FLAG_REQUIRE_STREAM)) ==
(SIG_FLAG_APPLAYER | SIG_FLAG_REQUIRE_PACKET))
return;

pa->flags |= PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW;
SCLogDebug("packet %" PRIu64 " sid %u action %02x alert_flags %02x (set "
"PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW)",
Expand Down

0 comments on commit 7638a3c

Please sign in to comment.