#[non_exhaustive]pub enum MemcapPolicy {
Ignore,
DropFlow,
DropPacket,
PassThrough,
}tracker only.Expand description
Tracker-wide memcap policy — what to do when the total
reassembly buffering across all flows trips the configured
memcap. Mirrors Suricata’s stream.reassembly.memcap-policy
vocabulary, collapsed to the four behaviors that make
sense for a passive analyzer.
Set on crate::FlowTrackerConfig::reassembly_memcap_policy;
the cap itself is
crate::FlowTrackerConfig::reassembly_memcap.
#[non_exhaustive] — additive forever.
New in 0.18.0 (issue #17 close).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ignore
Default. Count the violation and change nothing —
buffering continues past the cap. Matches Suricata’s
memcap-policy: ignore, which is likewise a reporting
mode rather than an enforcement one.
A single AnomalyKind::GlobalMemcapHit fires per tick
on the first violation; later violations in the same tick
coalesce into it.
This does not bound memory. Choose
DropPacket to actually enforce the
cap, or PassThrough /
DropFlow to reclaim what is already
buffered.
DropFlow
Stop reassembling the violating flow — both sides are
released (ReassemblyStop::Memcap) — while the flow stays
tracked until its transport end (so its later packets are not
mistaken for a new connection). Session parsers on the flow
stop reading both sides (two side stops with
EndReason::BufferOverflow), then close once (detail
"both sides stopped"). Released whether or not a side had a reassembler yet,
and whatever the reassembler’s
release does: the driver drops
it and keeps only its final counters. Use when you’d
rather lose one flow’s L7 than corrupt analysis on it.
Before 0.25 this ended the flow with
Ended { reason: BufferOverflow } and forgot it.
DropPacket
Refuse the segment that would push past the memcap,
keeping the flow and everything already buffered. The
reassembler stays usable; the refused bytes surface as a gap
(crate::SessionParser::on_gap) once later data arrives.
The decision is made before the segment is handed to the
reassembler — Reassembler::segment
cannot be undone — so it is conservative: a reassembler
that would have deduplicated the payload is still charged
its full length.
PassThrough
Stop reassembling the offending side only
(ReassemblyStop::Memcap) and release what it holds, but
keep the flow in the tracker. Flow accounting continues;
session parsers stop reading that side
(EndReason::BufferOverflow); the other side goes on.
Since 0.25 crate::FlowDriver drops the side’s reassembler
(keeping only its final counters), so the memory is freed
whatever Reassembler::release
does.
Implementations§
Trait Implementations§
Source§impl Clone for MemcapPolicy
impl Clone for MemcapPolicy
impl Copy for MemcapPolicy
Source§impl Debug for MemcapPolicy
impl Debug for MemcapPolicy
Source§impl Default for MemcapPolicy
impl Default for MemcapPolicy
Source§impl<'de> Deserialize<'de> for MemcapPolicy
Available on crate feature serde only.
impl<'de> Deserialize<'de> for MemcapPolicy
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for MemcapPolicy
Source§impl Hash for MemcapPolicy
impl Hash for MemcapPolicy
Source§impl PartialEq for MemcapPolicy
impl PartialEq for MemcapPolicy
Source§impl Serialize for MemcapPolicy
Available on crate feature serde only.
impl Serialize for MemcapPolicy
serde only.impl StructuralPartialEq for MemcapPolicy
Auto Trait Implementations§
impl Freeze for MemcapPolicy
impl RefUnwindSafe for MemcapPolicy
impl Send for MemcapPolicy
impl Sync for MemcapPolicy
impl Unpin for MemcapPolicy
impl UnsafeUnpin for MemcapPolicy
impl UnwindSafe for MemcapPolicy
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.