#include "config.h"
#endif
+#include <sstream>
+
#include "tcp_reassembly_segments.h"
#include "log/messages.h"
return true;
}
+void TcpReassemblySegments::print_stream_state(TcpStreamTracker* talker)
+{
+ if ( !PacketTracer::is_active() )
+ return;
+
+ std::stringstream ss;
+
+ ss << "Stream State:";
+ ss << " seglist_base_seq: " << seglist_base_seq;
+ ss << ", rcv_next: " << tracker->get_rcv_nxt();
+ ss << ", r_win_base: " << talker->r_win_base;
+ if(head)
+ ss << ", head: " << head->start_seq();
+ if(cur_sseg)
+ ss << ", cur_sseg: " << cur_sseg->start_seq();
+ if(cur_rseg)
+ ss << ", cur_rseg: " << cur_rseg->start_seq();
+ ss << "\n";
+ PacketTracer::log("%s", ss.str().c_str());
+}
+
void TcpReassemblySegments::queue_reassembly_segment(TcpSegmentDescriptor& tsd)
{
if ( seg_count == 0 )
{
// FIXIT-M - only alert once per threshold exceeded event
tel.set_tcp_event(EVENT_MAX_QUEUED_BYTES_EXCEEDED);
+ listener->seglist.print_stream_state(tsd.get_talker());
listener->normalizer.log_drop_reason(tsd, inline_mode, "stream",
"stream_tcp: Flow exceeded the configured max byte threshold (" + std::to_string(tcp_config->max_queued_bytes) +
"). You may want to adjust the 'max_bytes' parameter in the NAP policy"
{
// FIXIT-M - only alert once per threshold exceeded event
tel.set_tcp_event(EVENT_MAX_QUEUED_SEGS_EXCEEDED);
+ listener->seglist.print_stream_state(tsd.get_talker());
listener->normalizer.log_drop_reason(tsd, inline_mode, "stream",
"stream_tcp: Flow exceeded the configured max segment threshold (" + std::to_string(tcp_config->max_queued_segs) +
"). You may want to adjust the 'max_segments' parameter in the NAP policy"
// the packet...Insert a packet, or handle state change SYN, FIN, RST, etc.
if ( Stream::expired_flow(flow, p) )
{
+ if ( PacketTracer::is_active() and p and p->ptrs.tcph )
+ PacketTracer::log("Stream TCP session expired with session flags 0x%x, flow state %hhu, and seq %u\n",
+ flow->get_session_flags(), static_cast<uint8_t>(flow->flow_state), p->ptrs.tcph->seq());
/* Session is timed out, if also reset then restart, otherwise clear */
if ( flow->get_session_flags() & SSNFLAG_RESET )
clear_session(true, true, true, p);