Squashed commit of the following:
commit
e10265faf6232b58a32581033ca380a3e6d6b171
Author: Silviu Minut <sminut@cisco.com>
Date: Fri May 29 20:16:09 2020 -0400
stream_tcp: unconditionally release held packets that have timed out, regardless of flushing
{ CountType::SUM, "held_packets_dropped", "number of held packets dropped" },
{ CountType::SUM, "held_packets_passed", "number of held packets passed" },
{ CountType::SUM, "held_packet_timeouts", "number of held packets that timed out" },
+ { CountType::SUM, "held_packet_purges", "number of held packets that were purged without flushing" },
{ CountType::NOW, "cur_packets_held", "number of packets currently held" },
{ CountType::MAX, "max_packets_held", "maximum number of packets held simultaneously" },
{ CountType::SUM, "partial_flushes", "number of partial flushes initiated" },
PegCount held_packets_dropped;
PegCount held_packets_passed;
PegCount held_packet_timeouts;
+ PegCount held_packet_purges;
PegCount current_packets_held;
PegCount max_packets_held;
PegCount partial_flushes;
DetectionEngine de;
Packet* p = set_packet(flow, trs.packet_dir, trs.server_side);
- return perform_partial_flush(trs, p);
+ uint32_t result = perform_partial_flush(trs, p);
+
+ // If the held_packet hasn't been released by perform_partial_flush(),
+ // call finalize directly.
+ if ( trs.tracker->is_holding_packet() )
+ {
+ trs.tracker->finalize_held_packet(p);
+ tcpStats.held_packet_purges++;
+ }
+
+ return result;
}
// No error checking here, so the caller must ensure that p, p->flow and context
THREAD_LOCAL HeldPacketQueue* hpq = nullptr;
-static const HeldPacketQueue::iter_t null_iterator { };
+const std::list<HeldPacket>::iterator TcpStreamTracker::null_iterator { };
const char* tcp_state_names[] =
{
void finalize_held_packet(snort::Packet*);
void finalize_held_packet(snort::Flow*);
uint32_t perform_partial_flush();
+ bool is_holding_packet() const { return held_packet != null_iterator; }
// max_remove < 0 means time out all eligible packets.
// Return whether there are more packets that need to be released.
uint8_t tcp_options_len = 0;
bool mac_addr_valid = false;
bool fin_seq_set = false; // FIXIT-M should be obviated by tcp state
+
+ static const std::list<HeldPacket>::iterator null_iterator;
};
// <--- note -- the 'state' parameter must be a reference