summaryrefslogtreecommitdiffstats
path: root/sys/netinet/cc
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2011-02-01 13:32:27 +0000
committerlstewart <lstewart@FreeBSD.org>2011-02-01 13:32:27 +0000
commit8d21b8a169673629dd4d42ca14c9bf19531dbbd2 (patch)
treeb4ea1238e9f79be6e4219505fd50eb54d5093fe7 /sys/netinet/cc
parentae0c590545466a1eddcb72adf32869f46d8dc51f (diff)
downloadFreeBSD-src-8d21b8a169673629dd4d42ca14c9bf19531dbbd2.zip
FreeBSD-src-8d21b8a169673629dd4d42ca14c9bf19531dbbd2.tar.gz
Algorithm modules can define their own private congestion signal types in the
top 8 bits of the 32 bit signal bit field space for internal use. These private signals should not be leaked outside of a module. Given that many algorithm modules use the NewReno hook functions to simplify their implementation, the obvious place such a leak would show up is in the NewReno cong_signal hook function. - Show the full number of significant bits in the signal type definitions in <netinet/cc.h>. - Add a bitmask to simplify figuring out if a given signal is in the private or public bit range. - Add a sanity check in newreno_cong_signal() to ensure private signals are not being leaked into the hook function. Sponsored by: FreeBSD Foundation Discussed with: David Hayes <dahayes at swin edu au> MFC after: 1 week X-MFC with: r215166
Diffstat (limited to 'sys/netinet/cc')
-rw-r--r--sys/netinet/cc/cc_newreno.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c
index c095540..f26553d 100644
--- a/sys/netinet/cc/cc_newreno.c
+++ b/sys/netinet/cc/cc_newreno.c
@@ -182,6 +182,10 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
{
u_int win;
+ /* Catch algos which mistakenly leak private signal types. */
+ KASSERT((type & CC_SIGPRIVMASK) == 0,
+ ("%s: congestion signal type 0x%08x is private\n", __func__, type));
+
win = max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) *
CCV(ccv, t_maxseg);
OpenPOWER on IntegriCloud