- /* Make sure after data segment processing ACK is sent */
- new_tc0->flags |= TCP_CONN_SNDACK;
-
- /* Update rtt with the syn-ack sample */
- tcp_update_rtt (new_tc0, vnet_buffer (b0)->tcp.ack_number);
- TCP_EVT_DBG (TCP_EVT_SYNACK_RCVD, new_tc0);
- }
- /* SYN: Simultaneous open. Change state to SYN-RCVD and send SYN-ACK */
- else
- {
- new_tc0->state = TCP_STATE_SYN_RCVD;
-
- /* Notify app that we have connection */
- if (session_stream_connect_notify (&new_tc0->connection, 0))
- {
- tcp_connection_cleanup (new_tc0);
- tcp_send_reset_w_pkt (tc0, b0, is_ip4);
- TCP_EVT_DBG (TCP_EVT_RST_SENT, tc0);
- goto drop;
- }
-
- tc0->rtt_ts = 0;
- tcp_init_snd_vars (tc0);
- tcp_make_synack (new_tc0, b0);
- next0 = tcp_next_output (is_ip4);
-
- goto drop;
- }
-
- /* Read data, if any */
- if (PREDICT_FALSE (vnet_buffer (b0)->tcp.data_len))
- {
- clib_warning ("rcvd data in syn-sent");
- error0 = tcp_segment_rcv (new_tc0, b0, &next0);
- if (error0 == TCP_ERROR_ACK_OK)
- error0 = TCP_ERROR_SYN_ACKS_RCVD;
- tcp_maybe_inc_counter (syn_sent, error0, 1);
- }
- else
- {
- tcp_make_ack (new_tc0, b0);
- next0 = tcp_next_output (new_tc0->c_is_ip4);
- }
-
- drop:
-
- b0->error = error0 ? node->errors[error0] : 0;
- if (PREDICT_FALSE
- ((b0->flags & VLIB_BUFFER_IS_TRACED) && tcp0 != 0))
- {
- t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
- clib_memcpy (&t0->tcp_header, tcp0, sizeof (t0->tcp_header));
- clib_memcpy (&t0->tcp_connection, tc0,
- sizeof (t0->tcp_connection));
- }
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
- n_left_to_next, bi0, next0);
- }
-
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
- }
-
- errors = session_manager_flush_enqueue_events (TRANSPORT_PROTO_TCP,
- my_thread_index);
- tcp_inc_counter (syn_sent, TCP_ERROR_EVENT_FIFO_FULL, errors);
- return from_frame->n_vectors;
-}
-
-static uword
-tcp4_syn_sent (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)