X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ftcp%2Ftcp_input.c;h=4f31d21c3c11a25ea94961cd2dff8822d954ee4c;hb=70f879d2852dfc042ad0911a4a6e4a1714c0eb83;hp=164a1b3431fe6c5035f333af0bd80771dcf7782e;hpb=6939d5efdf6541936076dce8c0a436b10e809bee;p=vpp.git diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 164a1b3431f..4f31d21c3c1 100755 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -327,17 +327,15 @@ tcp_rcv_rst (tcp_worker_ctx_t * wrk, tcp_connection_t * tc) tcp_connection_set_state (tc, TCP_STATE_CLOSED); break; case TCP_STATE_SYN_SENT: - tcp_program_reset_ntf (wrk, tc); - tcp_connection_set_state (tc, TCP_STATE_CLOSED); + /* Do not program ntf because the connection is half-open */ + tcp_handle_rst (tc); break; case TCP_STATE_ESTABLISHED: tcp_connection_timers_reset (tc); - /* Set the cleanup timer, in case the session layer/app don't - * cleanly close the connection */ - tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, tcp_cfg.closewait_time); tcp_cong_recovery_off (tc); tcp_program_reset_ntf (wrk, tc); tcp_connection_set_state (tc, TCP_STATE_CLOSED); + tcp_program_cleanup (wrk, tc); break; case TCP_STATE_CLOSE_WAIT: case TCP_STATE_FIN_WAIT_1: @@ -345,12 +343,12 @@ tcp_rcv_rst (tcp_worker_ctx_t * wrk, tcp_connection_t * tc) case TCP_STATE_CLOSING: case TCP_STATE_LAST_ACK: tcp_connection_timers_reset (tc); - tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, tcp_cfg.closewait_time); tcp_cong_recovery_off (tc); tcp_program_reset_ntf (wrk, tc); /* Make sure we mark the session as closed. In some states we may * be still trying to send data */ tcp_connection_set_state (tc, TCP_STATE_CLOSED); + tcp_program_cleanup (wrk, tc); break; case TCP_STATE_CLOSED: case TCP_STATE_TIME_WAIT: @@ -1096,9 +1094,7 @@ tcp_rcv_sacks (tcp_connection_t * tc, u32 ack) { if (seq_lt (blk->start, blk->end) && seq_gt (blk->start, tc->snd_una) - && seq_gt (blk->start, ack) - && seq_lt (blk->start, tc->snd_nxt) - && seq_leq (blk->end, tc->snd_nxt)) + && seq_gt (blk->start, ack) && seq_leq (blk->end, tc->snd_nxt)) { blk++; continue; @@ -1316,7 +1312,9 @@ tcp_update_snd_wnd (tcp_connection_t * tc, u32 seq, u32 ack, u32 snd_wnd) } else { - tcp_persist_timer_reset (tc); + if (PREDICT_FALSE (tcp_timer_is_active (tc, TCP_TIMER_PERSIST))) + tcp_persist_timer_reset (tc); + if (PREDICT_FALSE (!tcp_in_recovery (tc) && tc->rto_boff > 0)) { tc->rto_boff = 0; @@ -2079,7 +2077,8 @@ tcp_segment_rcv (tcp_worker_ctx_t * wrk, tcp_connection_t * tc, * retransmissions since we may not have any data to send */ if (seq_leq (vnet_buffer (b)->tcp.seq_end, tc->rcv_nxt)) { - tcp_program_ack (tc); + tcp_program_dupack (tc); + tc->errors.below_data_wnd++; error = TCP_ERROR_SEGMENT_OLD; goto done; } @@ -2945,7 +2944,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node, /* Make sure the segment is exactly right */ if (tc0->rcv_nxt != vnet_buffer (b0)->tcp.seq_number || is_fin0) { - tcp_rcv_rst (wrk, tc0); + tcp_send_reset_w_pkt (tc0, b0, thread_index, is_ip4); error0 = TCP_ERROR_SEGMENT_INVALID; goto drop; } @@ -2958,7 +2957,8 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node, */ if (tcp_rcv_ack_no_cc (tc0, b0, &error0)) { - tcp_rcv_rst (wrk, tc0); + tcp_send_reset_w_pkt (tc0, b0, thread_index, is_ip4); + error0 = TCP_ERROR_SEGMENT_INVALID; goto drop; } @@ -2985,7 +2985,9 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (session_stream_accept_notify (&tc0->connection)) { error0 = TCP_ERROR_MSG_QUEUE_FULL; - tcp_rcv_rst (wrk, tc0); + tcp_send_reset (tc0); + session_transport_delete_notify (&tc0->connection); + tcp_connection_cleanup (tc0); goto drop; } error0 = TCP_ERROR_ACK_OK; @@ -3028,9 +3030,8 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (tc0->flags & TCP_CONN_FINRCVD) { tcp_connection_set_state (tc0, TCP_STATE_CLOSED); - tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, - tcp_cfg.cleanup_time); session_transport_closed_notify (&tc0->connection); + tcp_program_cleanup (wrk, tc0); goto drop; } @@ -3111,7 +3112,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node, * we can't ensure that we have no packets already enqueued * to output. Rely instead on the waitclose timer */ tcp_connection_timers_reset (tc0); - tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, tcp_cfg.cleanup_time); + tcp_program_cleanup (tcp_get_worker (tc0->c_thread_index), tc0); goto drop; @@ -3702,14 +3703,10 @@ tcp_input_dispatch_buffer (tcp_main_t * tm, tcp_connection_t * tc, if (PREDICT_FALSE (error != TCP_ERROR_NONE)) { - /* Overload tcp flags to store state */ - tcp_state_t state = tc->state; - vnet_buffer (b)->tcp.flags = tc->state; - b->error = error_node->errors[error]; if (error == TCP_ERROR_DISPATCH) clib_warning ("tcp conn %u disp error state %U flags %U", - tc->c_c_index, format_tcp_state, state, + tc->c_c_index, format_tcp_state, tc->state, format_tcp_flags, (int) flags); } }