summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2013-01-22 09:44:21 +0000
committerlstewart <lstewart@FreeBSD.org>2013-01-22 09:44:21 +0000
commit9e1a6406b6d39e18a87054ef6c5f7ec9c5d53222 (patch)
treeceed091e99ae86861a0c1d1b5858098df6fde96e
parent24e0e32487d9cabe009c9de04b444a113660b8ac (diff)
downloadFreeBSD-src-9e1a6406b6d39e18a87054ef6c5f7ec9c5d53222.zip
FreeBSD-src-9e1a6406b6d39e18a87054ef6c5f7ec9c5d53222.tar.gz
Simplify and fix a bug in cc_ack_received()'s "are we congestion window limited"
logic (refer to [1] for associated discussion). snd_cwnd and snd_wnd are unsigned long and on 64 bit hosts, min() will truncate them to 32 bits and could therefore potentially corrupt the result (although under normal operation, neither variable should legitmately exceed 32 bits). [1] http://lists.freebsd.org/pipermail/freebsd-net/2013-January/034297.html Submitted by: jhb MFC after: 1 week
-rw-r--r--sys/netinet/tcp_input.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 846887d2..e37de24 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -285,7 +285,7 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type)
INP_WLOCK_ASSERT(tp->t_inpcb);
tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th);
- if (tp->snd_cwnd == min(tp->snd_cwnd, tp->snd_wnd))
+ if (tp->snd_cwnd <= tp->snd_wnd)
tp->ccv->flags |= CCF_CWND_LIMITED;
else
tp->ccv->flags &= ~CCF_CWND_LIMITED;
OpenPOWER on IntegriCloud