session: use listener_handle instead of listener_index
[vpp.git] / src / vnet / tcp / tcp_input.c
index 1420e32..6c78af0 100644 (file)
@@ -390,8 +390,9 @@ tcp_segment_validate (tcp_worker_ctx_t * wrk, tcp_connection_t * tc0,
   /* 4th: check the SYN bit (in window) */
   if (PREDICT_FALSE (tcp_syn (th0)))
     {
+      /* As per RFC5961 send challenge ack instead of reset */
+      tcp_program_ack (wrk, tc0);
       *error0 = TCP_ERROR_SPURIOUS_SYN;
-      tcp_send_reset (tc0);
       goto error;
     }
 
@@ -1335,6 +1336,8 @@ tcp_do_fastretransmits (tcp_worker_ctx_t * wrk)
   for (i = 0; i < vec_len (ongoing_fast_rxt); i++)
     {
       tc = tcp_connection_get (ongoing_fast_rxt[i], thread_index);
+      if (!tc)
+       continue;
       if (!tcp_in_fastrecovery (tc))
        {
          tc->flags &= ~TCP_CONN_FRXT_PENDING;
@@ -1548,8 +1551,6 @@ partial_ack:
   else
     {
       tcp_fastrecovery_first_on (tc);
-      /* Reuse last bytes delivered to track total bytes acked */
-      tc->sack_sb.last_bytes_delivered += tc->bytes_acked;
       if (tc->snd_rxt_bytes > tc->bytes_acked)
        tc->snd_rxt_bytes -= tc->bytes_acked;
       else
@@ -2526,9 +2527,9 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
           * allocate session send reset */
          if (session_stream_connect_notify (&new_tc0->connection, 0))
            {
-             clib_warning ("connect notify fail");
              tcp_send_reset_w_pkt (new_tc0, b0, my_thread_index, is_ip4);
              tcp_connection_cleanup (new_tc0);
+             error0 = TCP_ERROR_CREATE_SESSION_FAIL;
              goto drop;
            }
 
@@ -2550,6 +2551,7 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
              tcp_connection_cleanup (new_tc0);
              tcp_send_reset_w_pkt (tc0, b0, my_thread_index, is_ip4);
              TCP_EVT_DBG (TCP_EVT_RST_SENT, tc0);
+             error0 = TCP_ERROR_CREATE_SESSION_FAIL;
              goto drop;
            }
 
@@ -3188,7 +3190,7 @@ tcp46_listen_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
       child0->rto = TCP_RTO_MIN;
 
       if (session_stream_accept (&child0->connection, lc0->c_s_index,
-                                0 /* notify */ ))
+                                lc0->c_thread_index, 0 /* notify */ ))
        {
          tcp_connection_cleanup (child0);
          error0 = TCP_ERROR_CREATE_SESSION_FAIL;