int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx,
TcpStream *stream, TcpSegment *seg, Packet *p, uint32_t pkt_seq, uint8_t *pkt_data, uint16_t pkt_datalen)
{
- /* insert segment into list. Note: doesn't handle the data */
#ifdef DEBUG
SCLogDebug("pre insert");
PrintList(stream->seg_list);
#endif
+ /* insert segment into list. Note: doesn't handle the data */
int r = DoInsertSegment (stream, seg, p);
+ if (r < 0) {
+ StatsIncr(tv, ra_ctx->counter_tcp_reass_list_fail);
+ StreamTcpSegmentReturntoPool(seg);
+ SCReturnInt(-1);
+ }
#ifdef DEBUG
SCLogDebug("post insert");
/* no overlap, straight data insert */
int res = InsertSegmentDataCustom(stream, seg, pkt_data, pkt_datalen);
if (res < 0) {
+ StatsIncr(tv, ra_ctx->counter_tcp_reass_data_normal_fail);
StreamTcpRemoveSegmentFromStream(stream, seg);
StreamTcpSegmentReturntoPool(seg);
SCReturnInt(-1);
/* now let's consider the data in the overlap case */
int res = DoHandleData(tv, ra_ctx, stream, seg, p);
if (res < 0) {
+ StatsIncr(tv, ra_ctx->counter_tcp_reass_data_overlap_fail);
StreamTcpRemoveSegmentFromStream(stream, seg);
StreamTcpSegmentReturntoPool(seg);
SCReturnInt(-1);
}
-
- } else if (r < 0) {
- StreamTcpSegmentReturntoPool(seg);
- SCReturnInt(-1);
}
SCReturnInt(0);
uint16_t counter_tcp_reass_overlap;
/** count overlaps with different data */
uint16_t counter_tcp_reass_overlap_diff_data;
+
+ uint16_t counter_tcp_reass_data_normal_fail;
+ uint16_t counter_tcp_reass_data_overlap_fail;
+ uint16_t counter_tcp_reass_list_fail;
} TcpReassemblyThreadCtx;
#define OS_POLICY_DEFAULT OS_POLICY_BSD
stt->ra_ctx->counter_tcp_reass_overlap = StatsRegisterCounter("tcp.overlap", tv);
stt->ra_ctx->counter_tcp_reass_overlap_diff_data = StatsRegisterCounter("tcp.overlap_diff_data", tv);
+ stt->ra_ctx->counter_tcp_reass_data_normal_fail = StatsRegisterCounter("tcp.insert_data_normal_fail", tv);
+ stt->ra_ctx->counter_tcp_reass_data_overlap_fail = StatsRegisterCounter("tcp.insert_data_overlap_fail", tv);
+ stt->ra_ctx->counter_tcp_reass_list_fail = StatsRegisterCounter("tcp.insert_list_fail", tv);
+
+
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);