Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
Show First 20 Lines • Show All 2,557 Lines • ▼ Show 20 Lines | if (SEQ_LEQ(th->th_ack, tp->snd_una)) { | ||||
* 1) Old acks | * 1) Old acks | ||||
* 2) Acks with SACK but without any new SACK | * 2) Acks with SACK but without any new SACK | ||||
* information in them. These could result from | * information in them. These could result from | ||||
* any anomaly in the network like a switch | * any anomaly in the network like a switch | ||||
* duplicating packets or a possible DoS attack. | * duplicating packets or a possible DoS attack. | ||||
*/ | */ | ||||
if (th->th_ack != tp->snd_una || | if (th->th_ack != tp->snd_una || | ||||
((tp->t_flags & TF_SACK_PERMIT) && | ((tp->t_flags & TF_SACK_PERMIT) && | ||||
(to.to_flags & TOF_SACK) && | ((to.to_flags & TOF_SACK) || | ||||
(!TAILQ_EMPTY(&tp->snd_holes))) && | |||||
!sack_changed)) | !sack_changed)) | ||||
break; | break; | ||||
else if (!tcp_timer_active(tp, TT_REXMT)) | else if (!tcp_timer_active(tp, TT_REXMT)) | ||||
tp->t_dupacks = 0; | tp->t_dupacks = 0; | ||||
else if (++tp->t_dupacks > tcprexmtthresh || | else if (++tp->t_dupacks > tcprexmtthresh || | ||||
IN_FASTRECOVERY(tp->t_flags)) { | IN_FASTRECOVERY(tp->t_flags)) { | ||||
cc_ack_received(tp, th, nsegs, | cc_ack_received(tp, th, nsegs, | ||||
CC_DUPACK); | CC_DUPACK); | ||||
if (V_tcp_do_prr && | if (V_tcp_do_prr && | ||||
IN_FASTRECOVERY(tp->t_flags)) { | IN_FASTRECOVERY(tp->t_flags)) { | ||||
tcp_do_prr_ack(tp, th, &to); | tcp_do_prr_ack(tp, th, &to); | ||||
} else if ((tp->t_flags & TF_SACK_PERMIT) && | } else if ((tp->t_flags & TF_SACK_PERMIT) && | ||||
(to.to_flags & TOF_SACK) && | ((to.to_flags & TOF_SACK) || | ||||
(!TAILQ_EMPTY(&tp->snd_holes))) && | |||||
IN_FASTRECOVERY(tp->t_flags)) { | IN_FASTRECOVERY(tp->t_flags)) { | ||||
int awnd; | int awnd; | ||||
/* | /* | ||||
* Compute the amount of data in flight first. | * Compute the amount of data in flight first. | ||||
* We can inject new data into the pipe iff | * We can inject new data into the pipe iff | ||||
* we have less than 1/2 the original window's | * we have less than 1/2 the original window's | ||||
* worth of data in flight. | * worth of data in flight. | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | enter_recovery: | ||||
tcp_timer_activate(tp, TT_REXMT, 0); | tcp_timer_activate(tp, TT_REXMT, 0); | ||||
tp->t_rtttime = 0; | tp->t_rtttime = 0; | ||||
if (V_tcp_do_prr) { | if (V_tcp_do_prr) { | ||||
/* | /* | ||||
* snd_ssthresh is already updated by | * snd_ssthresh is already updated by | ||||
* cc_cong_signal. | * cc_cong_signal. | ||||
*/ | */ | ||||
if ((tp->t_flags & TF_SACK_PERMIT) && | if ((tp->t_flags & TF_SACK_PERMIT) && | ||||
(to.to_flags & TOF_SACK)) { | ((to.to_flags & TOF_SACK) || | ||||
(!TAILQ_EMPTY(&tp->snd_holes)))) { | |||||
tp->sackhint.prr_delivered = | tp->sackhint.prr_delivered = | ||||
tp->sackhint.sacked_bytes; | tp->sackhint.sacked_bytes; | ||||
} else { | } else { | ||||
tp->sackhint.prr_delivered = | tp->sackhint.prr_delivered = | ||||
imin(tp->snd_max - tp->snd_una, | imin(tp->snd_max - tp->snd_una, | ||||
imin(INT_MAX / 65536, | imin(INT_MAX / 65536, | ||||
tp->t_dupacks) * maxseg); | tp->t_dupacks) * maxseg); | ||||
} | } | ||||
tp->sackhint.recover_fs = max(1, | tp->sackhint.recover_fs = max(1, | ||||
tp->snd_nxt - tp->snd_una); | tp->snd_nxt - tp->snd_una); | ||||
} | } | ||||
if ((tp->t_flags & TF_SACK_PERMIT) && | if ((tp->t_flags & TF_SACK_PERMIT) && | ||||
(to.to_flags & TOF_SACK)) { | ((to.to_flags & TOF_SACK) || | ||||
(!TAILQ_EMPTY(&tp->snd_holes)))) { | |||||
TCPSTAT_INC( | TCPSTAT_INC( | ||||
tcps_sack_recovery_episode); | tcps_sack_recovery_episode); | ||||
tp->snd_recover = tp->snd_nxt; | tp->snd_recover = tp->snd_nxt; | ||||
tp->snd_cwnd = maxseg; | tp->snd_cwnd = maxseg; | ||||
(void) tcp_output(tp); | (void) tcp_output(tp); | ||||
if (SEQ_GT(th->th_ack, tp->snd_una)) | if (SEQ_GT(th->th_ack, tp->snd_una)) | ||||
goto resume_partialack; | goto resume_partialack; | ||||
goto drop; | goto drop; | ||||
▲ Show 20 Lines • Show All 1,398 Lines • Show Last 20 Lines |