Send consistent SEG.WIN when using timewait codepath for TCP.
When sending TCP segments from the timewait code path, a stored value of the last sent window is used. Use the same code for computing this in the timewait code path as in the main code path used in tcp_output() to avoiv inconsistencies. Reviewed by: rrs@ MFC after: 1 month Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D16503
This commit is contained in:
parent
22e56aea3f
commit
e2662978b8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336937
@ -230,6 +230,7 @@ tcp_twstart(struct tcpcb *tp)
|
|||||||
struct tcptw twlocal, *tw;
|
struct tcptw twlocal, *tw;
|
||||||
struct inpcb *inp = tp->t_inpcb;
|
struct inpcb *inp = tp->t_inpcb;
|
||||||
struct socket *so;
|
struct socket *so;
|
||||||
|
uint32_t recwin;
|
||||||
bool acknow, local;
|
bool acknow, local;
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6;
|
bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6;
|
||||||
@ -292,10 +293,16 @@ tcp_twstart(struct tcpcb *tp)
|
|||||||
/*
|
/*
|
||||||
* Recover last window size sent.
|
* Recover last window size sent.
|
||||||
*/
|
*/
|
||||||
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt))
|
so = inp->inp_socket;
|
||||||
tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale;
|
recwin = lmin(lmax(sbspace(&so->so_rcv), 0),
|
||||||
else
|
(long)TCP_MAXWIN << tp->rcv_scale);
|
||||||
tw->last_win = 0;
|
if (recwin < (so->so_rcv.sb_hiwat / 4) &&
|
||||||
|
recwin < tp->t_maxseg)
|
||||||
|
recwin = 0;
|
||||||
|
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
|
||||||
|
recwin < (tp->rcv_adv - tp->rcv_nxt))
|
||||||
|
recwin = (tp->rcv_adv - tp->rcv_nxt);
|
||||||
|
tw->last_win = htons((u_short)(recwin >> tp->rcv_scale));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set t_recent if timestamps are used on the connection.
|
* Set t_recent if timestamps are used on the connection.
|
||||||
@ -332,7 +339,6 @@ tcp_twstart(struct tcpcb *tp)
|
|||||||
* and might not be needed here any longer.
|
* and might not be needed here any longer.
|
||||||
*/
|
*/
|
||||||
tcp_discardcb(tp);
|
tcp_discardcb(tp);
|
||||||
so = inp->inp_socket;
|
|
||||||
soisdisconnected(so);
|
soisdisconnected(so);
|
||||||
tw->tw_so_options = so->so_options;
|
tw->tw_so_options = so->so_options;
|
||||||
inp->inp_flags |= INP_TIMEWAIT;
|
inp->inp_flags |= INP_TIMEWAIT;
|
||||||
|
Loading…
Reference in New Issue
Block a user