Bring SACK option handling in tcp_dooptions() in line with all other
options and ajust users accordingly.
This commit is contained in:
parent
00362cddbe
commit
fc30a25199
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167833
@ -1046,7 +1046,7 @@ tcp_input(struct mbuf *m, int off0)
|
||||
if (to.to_flags & TOF_MSS)
|
||||
tcp_mss(tp, to.to_mss);
|
||||
if (tp->sack_enable) {
|
||||
if (!(to.to_flags & TOF_SACK))
|
||||
if (!(to.to_flags & TOF_SACKPERM))
|
||||
tp->sack_enable = 0;
|
||||
else
|
||||
tp->t_flags |= TF_SACK_PERMIT;
|
||||
@ -1098,7 +1098,8 @@ tcp_input(struct mbuf *m, int off0)
|
||||
((!tcp_do_newreno && !tp->sack_enable &&
|
||||
tp->t_dupacks < tcprexmtthresh) ||
|
||||
((tcp_do_newreno || tp->sack_enable) &&
|
||||
!IN_FASTRECOVERY(tp) && to.to_nsacks == 0 &&
|
||||
!IN_FASTRECOVERY(tp) &&
|
||||
(to.to_flags & TOF_SACK) == 0 &&
|
||||
TAILQ_EMPTY(&tp->snd_holes)))) {
|
||||
KASSERT(headlocked, ("headlocked"));
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
@ -1848,7 +1849,8 @@ tcp_input(struct mbuf *m, int off0)
|
||||
goto dropafterack;
|
||||
}
|
||||
if (tp->sack_enable &&
|
||||
(to.to_nsacks > 0 || !TAILQ_EMPTY(&tp->snd_holes)))
|
||||
((to.to_flags & TOF_SACK) ||
|
||||
!TAILQ_EMPTY(&tp->snd_holes)))
|
||||
tcp_sack_doack(tp, &to, th->th_ack);
|
||||
if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
|
||||
if (tlen == 0 && tiwin == tp->snd_wnd) {
|
||||
@ -2657,11 +2659,12 @@ tcp_dooptions(struct tcpopt *to, u_char *cp, int cnt, int flags)
|
||||
continue;
|
||||
if (!tcp_do_sack)
|
||||
continue;
|
||||
to->to_flags |= TOF_SACK;
|
||||
to->to_flags |= TOF_SACKPERM;
|
||||
break;
|
||||
case TCPOPT_SACK:
|
||||
if (optlen <= 2 || (optlen - 2) % TCPOLEN_SACK != 0)
|
||||
continue;
|
||||
to->to_flags |= TOF_SACK;
|
||||
to->to_nsacks = (optlen - 2) / TCPOLEN_SACK;
|
||||
to->to_sacks = cp + 2;
|
||||
tcpstat.tcps_sack_rcv_blocks++;
|
||||
|
@ -1046,7 +1046,7 @@ tcp_input(struct mbuf *m, int off0)
|
||||
if (to.to_flags & TOF_MSS)
|
||||
tcp_mss(tp, to.to_mss);
|
||||
if (tp->sack_enable) {
|
||||
if (!(to.to_flags & TOF_SACK))
|
||||
if (!(to.to_flags & TOF_SACKPERM))
|
||||
tp->sack_enable = 0;
|
||||
else
|
||||
tp->t_flags |= TF_SACK_PERMIT;
|
||||
@ -1098,7 +1098,8 @@ tcp_input(struct mbuf *m, int off0)
|
||||
((!tcp_do_newreno && !tp->sack_enable &&
|
||||
tp->t_dupacks < tcprexmtthresh) ||
|
||||
((tcp_do_newreno || tp->sack_enable) &&
|
||||
!IN_FASTRECOVERY(tp) && to.to_nsacks == 0 &&
|
||||
!IN_FASTRECOVERY(tp) &&
|
||||
(to.to_flags & TOF_SACK) == 0 &&
|
||||
TAILQ_EMPTY(&tp->snd_holes)))) {
|
||||
KASSERT(headlocked, ("headlocked"));
|
||||
INP_INFO_WUNLOCK(&tcbinfo);
|
||||
@ -1848,7 +1849,8 @@ tcp_input(struct mbuf *m, int off0)
|
||||
goto dropafterack;
|
||||
}
|
||||
if (tp->sack_enable &&
|
||||
(to.to_nsacks > 0 || !TAILQ_EMPTY(&tp->snd_holes)))
|
||||
((to.to_flags & TOF_SACK) ||
|
||||
!TAILQ_EMPTY(&tp->snd_holes)))
|
||||
tcp_sack_doack(tp, &to, th->th_ack);
|
||||
if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
|
||||
if (tlen == 0 && tiwin == tp->snd_wnd) {
|
||||
@ -2657,11 +2659,12 @@ tcp_dooptions(struct tcpopt *to, u_char *cp, int cnt, int flags)
|
||||
continue;
|
||||
if (!tcp_do_sack)
|
||||
continue;
|
||||
to->to_flags |= TOF_SACK;
|
||||
to->to_flags |= TOF_SACKPERM;
|
||||
break;
|
||||
case TCPOPT_SACK:
|
||||
if (optlen <= 2 || (optlen - 2) % TCPOLEN_SACK != 0)
|
||||
continue;
|
||||
to->to_flags |= TOF_SACK;
|
||||
to->to_nsacks = (optlen - 2) / TCPOLEN_SACK;
|
||||
to->to_sacks = cp + 2;
|
||||
tcpstat.tcps_sack_rcv_blocks++;
|
||||
|
@ -371,6 +371,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack)
|
||||
int i, j, num_sack_blks;
|
||||
|
||||
INP_LOCK_ASSERT(tp->t_inpcb);
|
||||
KASSERT(to->to_flags & TOF_SACK, ("%s: SACK invalid", __func__));
|
||||
|
||||
num_sack_blks = 0;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user