StatsIncr(tv, stt->counter_tcp_sessions);
StatsIncr(tv, stt->counter_tcp_midstream_pickups);
}
+
+ /* reverse packet and flow */
+ SCLogDebug("reversing flow and packet");
+ PacketSwap(p);
+ FlowSwap(p->flow);
+
/* set the state */
StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV);
SCLogDebug("ssn %p: =~ midstream picked ssn state is now "
SCLogDebug("ssn %p: SYN/ACK with SACK permitted, assuming "
"SACK permitted for both sides", ssn);
}
-
- /* packet thinks it is in the wrong direction, flip it */
- StreamTcpPacketSwitchDir(ssn, p);
+ return 0;
} else if (p->tcph->th_flags & TH_SYN) {
if (ssn == NULL) {
p->flags |= PKT_STREAM_NO_EVENTS;
}
- /* check if the packet is in right direction, when we missed the
- SYN packet and picked up midstream session. */
- if (ssn->flags & STREAMTCP_FLAG_MIDSTREAM_SYNACK)
- StreamTcpPacketSwitchDir(ssn, p);
-
if (StreamTcpPacketIsKeepAlive(ssn, p) == 1) {
goto skip;
}
return 0;
}
-/**
- * \brief Function to flip the direction When we missed the SYN packet,
- * SYN/ACK is considered as sent by server, but our engine flagged the
- * packet as from client for the host whose packet is received first in
- * the session.
- *
- * \param ssn TcpSession to whom this packet belongs
- * \param p Packet whose flag has to be changed
- */
-static inline void StreamTcpPacketSwitchDir(TcpSession *ssn, Packet *p)
-{
- SCLogDebug("ssn %p: switching pkt direction", ssn);
- PacketSwap(p);
-}
-
enum {
/* stream has no segments for forced reassembly, nor for detection */
STREAM_HAS_UNPROCESSED_SEGMENTS_NONE = 0,