diff options
| author | David Greenman <dg@FreeBSD.org> | 1996-02-04 12:46:20 +0000 |
|---|---|---|
| committer | David Greenman <dg@FreeBSD.org> | 1996-02-04 12:46:20 +0000 |
| commit | 630150f702c9cfa662e976d1ec03608574d2a67e (patch) | |
| tree | 126aa9d82e63fb75b6b5b8306fe4597895f070bb /sys/netinet | |
| parent | 30a7cd52520fa1550be179b9265258c1d0daa842 (diff) | |
Notes
Diffstat (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/tcp_input.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index b149eebf4883..5dda11d30d88 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94 - * $Id: tcp_input.c,v 1.25.4.1 1995/07/23 05:12:13 davidg Exp $ + * $Id: tcp_input.c,v 1.25.4.2 1995/08/24 05:52:06 davidg Exp $ */ #ifndef TUBA_INCLUDE @@ -692,7 +692,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; @@ -766,15 +772,7 @@ findpcb: tp->irs = ti->ti_seq; tcp_rcvseqinit(tp); - if (tiflags & TH_ACK && SEQ_GT(ti->ti_ack, tp->iss)) { - tcpstat.tcps_connects++; - soisconnected(so); - /* Do window scaling on this connection? */ - 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; - } + if (tiflags & TH_ACK) { /* * Our SYN was acked. If segment contains CC.ECHO * option, check it to make sure this segment really @@ -789,6 +787,14 @@ findpcb: else goto dropwithreset; } + tcpstat.tcps_connects++; + soisconnected(so); + /* Do window scaling on this connection? */ + 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; + } /* Segment is acceptable, update cache if undefined. */ if (taop->tao_ccsent == 0) taop->tao_ccsent = to.to_ccecho; @@ -1268,13 +1274,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: |
