diff options
author | olah <olah@FreeBSD.org> | 1996-01-31 08:22:24 +0000 |
---|---|---|
committer | olah <olah@FreeBSD.org> | 1996-01-31 08:22:24 +0000 |
commit | 09077f7acffd079fef387895ba11eefbf08523d4 (patch) | |
tree | c41b7db57986da2accefebe7c5e6c92ccd773042 /sys/netinet/tcp_input.c | |
parent | 787baccd280b05b944c6ed4306b0c31f4fc2af30 (diff) | |
download | FreeBSD-src-09077f7acffd079fef387895ba11eefbf08523d4.zip FreeBSD-src-09077f7acffd079fef387895ba11eefbf08523d4.tar.gz |
Fix a bug related to the interworking of T/TCP and window scaling:
when a connection enters the ESTBLS state using T/TCP, then window
scaling wasn't properly handled. The fix is twofold.
1) When the 3WHS completes, make sure that we update our window
scaling state variables.
2) When setting the `virtual advertized window', then make sure
that we do not try to offer a window that is larger than the maximum
window without scaling (TCP_MAXWIN).
Reviewed by: davidg
Reported by: Jerry Chen <chen@Ipsilon.COM>
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index ca50f68..4fbe209 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 - * $Id: tcp_input.c,v 1.33 1995/11/14 20:34:37 phk Exp $ + * $Id: tcp_input.c,v 1.34 1995/12/14 09:53:47 phk Exp $ */ #ifndef TUBA_INCLUDE @@ -707,7 +707,13 @@ findpcb: tp->t_flags |= (TF_DELACK | TF_NEEDSYN); else tp->t_flags |= (TF_ACKNOW | TF_NEEDSYN); - tp->rcv_adv += tp->rcv_wnd; + + /* + * Limit the `virtual advertised window' to TCP_MAXWIN + * here. Even if we requested window scaling, it will + * become effective only later when our SYN is acked. + */ + tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN); tcpstat.tcps_connects++; soisconnected(so); tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT; @@ -1283,13 +1289,20 @@ trimthenstep6: */ if (tp->t_flags & TF_NEEDSYN) { /* - * T/TCP: Connection was half-synchronized, and our - * SYN has been ACK'd (so connection is now fully - * synchronized). Go to non-starred state and - * increment snd_una for ACK of SYN. + * T/TCP: Connection was half-synchronized, and our + * SYN has been ACK'd (so connection is now fully + * synchronized). Go to non-starred state, + * increment snd_una for ACK of SYN, and check if + * we can do window scaling. */ tp->t_flags &= ~TF_NEEDSYN; tp->snd_una++; + /* Do window scaling? */ + if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == + (TF_RCVD_SCALE|TF_REQ_SCALE)) { + tp->snd_scale = tp->requested_s_scale; + tp->rcv_scale = tp->request_r_scale; + } } process_ACK: |