if (ssn->queue != NULL && StreamTcp3whsFindSyn(ssn, &search, &tail, false) != NULL)
return 0;
- if (ssn->queue_len == stream_config.max_syn_queued) {
+ if (ssn->queue_len > 0 && ssn->queue_len == stream_config.max_syn_queued) {
+ DEBUG_VALIDATE_BUG_ON(ssn->queue == NULL);
SCLogDebug("%" PRIu64 ": ssn %p: =~ SYN queue limit reached, rotate", p->pcap_cnt, ssn);
StreamTcpSetEvent(p, STREAM_3WHS_SYN_FLOOD);
*q = search;
/* put in list */
- if (tail)
+ if (tail) {
tail->next = q;
- if (ssn->queue == NULL)
+ } else {
+ DEBUG_VALIDATE_BUG_ON(ssn->queue != NULL);
ssn->queue = q;
+ }
ssn->queue_len++;
SCLogDebug("%" PRIu64 ": ssn %p: =~ SYN with SEQ %u added (queue_len %u)", p->pcap_cnt, ssn,
q->seq, ssn->queue_len);