diff options
author | lstewart <lstewart@FreeBSD.org> | 2013-01-22 09:44:21 +0000 |
---|---|---|
committer | lstewart <lstewart@FreeBSD.org> | 2013-01-22 09:44:21 +0000 |
commit | 9e1a6406b6d39e18a87054ef6c5f7ec9c5d53222 (patch) | |
tree | ceed091e99ae86861a0c1d1b5858098df6fde96e | |
parent | 24e0e32487d9cabe009c9de04b444a113660b8ac (diff) | |
download | FreeBSD-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.c | 2 |
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; |