Files
suricata/doc/userguide/rules
Ofer Dagan 7627756360 detect/detection_filter: add unique_on option
Add optional unique_on {src_port|dst_port} to detection_filter for
exact distinct port counting within the seconds window.

Features:
- Runtime uses a single 64k-bit (8192 bytes) union bitmap per
  threshold entry with O(1) updates.
- Follows detection_filter semantics: alerting starts after the
  threshold (> count), not at it.
- On window expiry, the window is reset and the current packet's
  port is recorded as the first distinct of the new window.

Validation:
- unique_on requires a ported transport protocol; reject rules
  that are not tcp/udp/sctp or that use ip (protocol any).

Memory management:
- Bitmap memory is bounded by detect.thresholds.memcap.
- New counters: bitmap_memuse and bitmap_alloc_fail.

Tests:
- C unit tests for parsing, distinct counting, window reset, and
  allocation failure fallback.
- suricata-verify tests for distinct src/dst port counting.

Task #7928
2026-01-27 20:54:44 +00:00
..
2024-01-30 09:35:17 +01:00
2024-06-07 13:54:22 +02:00
2024-01-30 09:35:17 +01:00
2025-09-20 09:08:38 +02:00
2025-05-28 19:08:07 +02:00
2024-09-22 06:45:36 +02:00
2023-11-16 21:36:37 +01:00