svn commit: r347161 - stable/11/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Sun May 5 19:20:28 UTC 2019
Author: tuexen
Date: Sun May 5 19:20:27 2019
New Revision: 347161
URL: https://svnweb.freebsd.org/changeset/base/347161
Log:
MFC r336937:
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 avoid inconsistencies.
MFC r344148:
Fix a byte ordering issue for the advertised receiver window in ACK
segments sent in TIMEWAIT state, which I introduced in r336937.
Modified:
stable/11/sys/netinet/tcp_timewait.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/11/sys/netinet/tcp_timewait.c Sun May 5 17:10:12 2019 (r347160)
+++ stable/11/sys/netinet/tcp_timewait.c Sun May 5 19:20:27 2019 (r347161)
@@ -228,6 +228,7 @@ tcp_twstart(struct tcpcb *tp)
struct inpcb *inp = tp->t_inpcb;
int acknow;
struct socket *so;
+ uint32_t recwin;
#ifdef INET6
int isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6;
#endif
@@ -294,10 +295,16 @@ tcp_twstart(struct tcpcb *tp)
/*
* Recover last window size sent.
*/
- if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt))
- tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale;
- else
- tw->last_win = 0;
+ so = inp->inp_socket;
+ recwin = lmin(lmax(sbspace(&so->so_rcv), 0),
+ (long)TCP_MAXWIN << tp->rcv_scale);
+ 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 = (u_short)(recwin >> tp->rcv_scale);
/*
* Set t_recent if timestamps are used on the connection.
@@ -334,7 +341,6 @@ tcp_twstart(struct tcpcb *tp)
* and might not be needed here any longer.
*/
tcp_discardcb(tp);
- so = inp->inp_socket;
soisdisconnected(so);
tw->tw_cred = crhold(so->so_cred);
SOCK_LOCK(so);
More information about the svn-src-stable-11
mailing list