Squashed commit of the following:
commit
aae5c979ba07cd80103d0a5c05acbefca4840bfe
Author: Steven Baigal (sbaigal) <sbaigal@cisco.com>
Date: Thu Jul 18 15:30:44 2019 -0400
stream_tcp: add API for switching no_ack mode
add assert to make sure the session is tcp
void SetPacketHeaderFoo(const snort::Packet* p);
void GetPacketHeaderFoo(DAQ_PktHdr_t* pkth, uint32_t dir);
void SwapPacketHeaderFoo();
+ void set_no_ack(bool b) { no_ack = b; }
+ bool no_ack_mode_enabled() { return no_ack; }
virtual void update_perf_base_state(char) { }
virtual void clear_session(
TcpStreamConfig* config = nullptr;
TcpEventLogger tel;
+private:
+ bool no_ack = false;
+
protected:
TcpStreamSession(snort::Flow*);
virtual void set_os_policy() = 0;
return p->flow->session->set_packet_action_to_hold(p);
}
+void Stream::set_no_ack_mode(Flow* flow, bool on_off)
+{
+ assert(flow and flow->session and flow->pkt_type == PktType::TCP);
+
+ TcpStreamSession* tcp_session = (TcpStreamSession*)flow->session;
+ tcp_session->set_no_ack(on_off);
+}
+
#ifdef UNIT_TEST
TEST_CASE("Stream API", "[stream_api][stream]")
static uint8_t get_tcp_options_len(Flow*, bool to_server);
static bool set_packet_action_to_hold(Packet*);
+ static void set_no_ack_mode(Flow*, bool);
private:
static void set_ip_protocol(Flow*);
// FIXIT-H need to do something here to handle check for need to swap trackers??
if ( !config )
+ {
config = get_tcp_cfg(flow->ssn_server);
+ set_no_ack(config->no_ack);
+ }
if( !tcp_init )
set_os_policy( );
bool TcpStateEstablished::data_seg_sent(TcpSegmentDescriptor& tsd, TcpStreamTracker& trk)
{
trk.update_tracker_ack_sent(tsd);
- if ( trk.session->config->no_ack )
+ if ( trk.session->no_ack_mode_enabled() )
trk.update_tracker_no_ack_recv(tsd);
return true;
}
{
trk.update_tracker_ack_recv(tsd);
trk.session->handle_data_segment(tsd);
- if ( trk.session->config->no_ack )
+ if ( trk.session->no_ack_mode_enabled() )
trk.update_tracker_no_ack_sent(tsd);
return true;
}