summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-03-30 12:35:39 +0000
committerjhb <jhb@FreeBSD.org>2011-03-30 12:35:39 +0000
commita6471e4578aeb4329a033f27eb8c474d8bb8029e (patch)
treebcf2ecaa99bd89c96b3cec9c7400617fe38d2f19 /sys/netinet
parent87f996dde86a4280391d93cfd51bf4d75e9907ed (diff)
downloadFreeBSD-src-a6471e4578aeb4329a033f27eb8c474d8bb8029e.zip
FreeBSD-src-a6471e4578aeb4329a033f27eb8c474d8bb8029e.tar.gz
Clamp the initial advertised receive window when responding to a SYN/ACK
to the maximum allowed window. Growing the window too large would cause an underflow in the calculations in tcp_output() to decide if a window update should be sent which would prevent the persist timer from being started if data was pending and the other end of the connection advertised an initial window size of 0. PR: kern/154006 Submitted by: Stefan `Sec` Zehl sec 42 org Reviewed by: bz MFC after: 1 week
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 25cb76b..44ee416 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1756,7 +1756,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
tp->rcv_scale = tp->request_r_scale;
}
- tp->rcv_adv += tp->rcv_wnd;
+ tp->rcv_adv += imin(tp->rcv_wnd,
+ TCP_MAXWIN << tp->rcv_scale);
tp->snd_una++; /* SYN is acked */
/*
* If there's data, delay ACK; if there's also a FIN
OpenPOWER on IntegriCloud