/* Karn's rule, part 1. Don't use retransmitted segments to estimate
* RTT because they're ambiguous. */
if (tcp_in_cong_recovery (tc) || tc->sack_sb.sacked_bytes)
- goto done;
+ {
+ if (tcp_in_recovery (tc))
+ return 0;
+ goto done;
+ }
if (tc->rtt_ts && seq_geq (ack, tc->rtt_seq))
{
tc->rtt_ts = 0;
/* If we got here something must've been ACKed so make sure boff is 0,
- * even if mrrt is not valid since we update the rto lower */
+ * even if mrtt is not valid since we update the rto lower */
tc->rto_boff = 0;
tcp_update_rto (tc);
int i, j;
sb->last_sacked_bytes = 0;
- sb->snd_una_adv = 0;
- old_sacked_bytes = sb->sacked_bytes;
sb->last_bytes_delivered = 0;
+ sb->snd_una_adv = 0;
if (!tcp_opts_sack (&tc->rcv_opts)
&& sb->head == TCP_INVALID_SACK_HOLE_INDEX)
return;
+ old_sacked_bytes = sb->sacked_bytes;
+
/* Remove invalid blocks */
blk = tc->rcv_opts.sacks;
while (blk < vec_end (tc->rcv_opts.sacks))
* Legitimate ACK. 1) See if we can exit recovery
*/
/* XXX limit this only to first partial ack? */
- tcp_retransmit_timer_update (tc);
+ if (seq_lt (tc->snd_una, tc->snd_congestion))
+ tcp_retransmit_timer_force_update (tc);
+ else
+ tcp_retransmit_timer_update (tc);
if (seq_geq (tc->snd_una, tc->snd_congestion))
{
{
tc->cc_algo->rcv_ack (tc);
tc->tsecr_last_ack = tc->rcv_opts.tsecr;
+ transport_add_tx_event (&tc->connection);
return;
}
/* When we entered recovery, we reset snd_nxt to snd_una. Seems peer
* still has the data so accept the ack */
if (tcp_in_recovery (tc)
- && seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_congestion)
- && seq_geq (vnet_buffer (b)->tcp.ack_number, tc->snd_una))
+ && seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_congestion))
{
- tc->snd_una_max = tc->snd_nxt = vnet_buffer (b)->tcp.ack_number;
+ tc->snd_nxt = vnet_buffer (b)->tcp.ack_number;
+ if (seq_gt (tc->snd_nxt, tc->snd_una_max))
+ tc->snd_una_max = tc->snd_nxt;
goto process_ack;
}
if (tcp_opts_wscale (&new_tc0->rcv_opts))
new_tc0->snd_wscale = new_tc0->rcv_opts.wscale;
- /* RFC1323: SYN and SYN-ACK wnd not scaled */
- new_tc0->snd_wnd = clib_net_to_host_u16 (tcp0->window);
+ new_tc0->snd_wnd = clib_net_to_host_u16 (tcp0->window)
+ << new_tc0->snd_wscale;
new_tc0->snd_wl1 = seq0;
new_tc0->snd_wl2 = ack0;
case TCP_STATE_SYN_RCVD:
/* Send FIN-ACK notify app and enter CLOSE-WAIT */
tcp_connection_timers_reset (tc0);
- tcp_retransmit_timer_set (tc0);
tcp_make_fin (tc0, b0);
tc0->snd_nxt += 1;
tc0->snd_una_max = tc0->snd_nxt;
+ tcp_retransmit_timer_set (tc0);
next0 = tcp_next_output (tc0->c_is_ip4);
stream_session_disconnect_notify (&tc0->connection);
tc0->state = TCP_STATE_CLOSE_WAIT;
/* ACK for for a SYN-ACK -> tcp-rcv-process. */
_(SYN_RCVD, TCP_FLAG_ACK, TCP_INPUT_NEXT_RCV_PROCESS, TCP_ERROR_NONE);
_(SYN_RCVD, TCP_FLAG_RST, TCP_INPUT_NEXT_RCV_PROCESS, TCP_ERROR_NONE);
+ _(SYN_RCVD, TCP_FLAG_RST | TCP_FLAG_ACK, TCP_INPUT_NEXT_RCV_PROCESS,
+ TCP_ERROR_NONE);
_(SYN_RCVD, TCP_FLAG_SYN, TCP_INPUT_NEXT_RCV_PROCESS, TCP_ERROR_NONE);
+ _(SYN_RCVD, TCP_FLAG_FIN | TCP_FLAG_ACK, TCP_INPUT_NEXT_RCV_PROCESS,
+ TCP_ERROR_NONE);
/* SYN-ACK for a SYN */
_(SYN_SENT, TCP_FLAG_SYN | TCP_FLAG_ACK, TCP_INPUT_NEXT_SYN_SENT,
TCP_ERROR_NONE);