diff options
author | 1996-09-12 06:36:57 +0000 | |
---|---|---|
committer | 1996-09-12 06:36:57 +0000 | |
commit | 7da28b72644b18ed94a6878aaba12c0062adfe02 (patch) | |
tree | dc14823d7cc2a420431fb7cf8a75dacb5b47d75a /sys/netinet/tcp_output.c | |
parent | TCP Persist handling; from 4.4BSD Lite2 (via NetBSD PR 2335) (diff) | |
download | wireguard-openbsd-7da28b72644b18ed94a6878aaba12c0062adfe02.tar.xz wireguard-openbsd-7da28b72644b18ed94a6878aaba12c0062adfe02.zip |
Close TCP receive window when we cannot receive data; suggested by Darren
Reed. Also make a conditional easier to read.
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r-- | sys/netinet/tcp_output.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index d4192defcd5..a95235a342c 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_output.c,v 1.4 1996/09/12 06:19:56 tholo Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.5 1996/09/12 06:36:57 tholo Exp $ */ /* $NetBSD: tcp_output.c,v 1.14 1996/02/13 23:43:53 christos Exp $ */ /* @@ -427,8 +427,8 @@ send: * window for use in delaying messages about window sizes. * If resending a FIN, be sure not to use a new sequence number. */ - if (flags & TH_FIN && tp->t_flags & TF_SENTFIN && - tp->snd_nxt == tp->snd_max) + if ((flags & TH_FIN) && (tp->t_flags & TF_SENTFIN) && + (tp->snd_nxt == tp->snd_max)) tp->snd_nxt--; /* * If we are doing retransmissions, then snd_nxt will @@ -463,6 +463,8 @@ send: win = (long)TCP_MAXWIN << tp->rcv_scale; if (win < (long)(tp->rcv_adv - tp->rcv_nxt)) win = (long)(tp->rcv_adv - tp->rcv_nxt); + if (flags & TH_RST) + win = 0; ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale)); if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt)); |