[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11833: Resolve bug 516: Never report our bandwidth-history as over (in tor/trunk: . src/or)
Author: nickm
Date: 2007-10-10 11:07:19 -0400 (Wed, 10 Oct 2007)
New Revision: 11833
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/rephist.c
Log:
r15626@catbus: nickm | 2007-10-10 11:02:32 -0400
Resolve bug 516: Never report our bandwidth-history as over RelayBandwidthRate*NUM_SECS_BW_SUM_INTERVAL.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r15626] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-10-10 07:56:33 UTC (rev 11832)
+++ tor/trunk/ChangeLog 2007-10-10 15:07:19 UTC (rev 11833)
@@ -60,6 +60,11 @@
cache when canceling a pending resolve. Don't log unless stuff
is fishy. Resolves bug 463.
+ o Minor bugfixes (Security):
+ - Never report that we've used more bandwidth than we're willing to
+ relay: it leaks how much non-relay traffic we're using. Resolves bug
+ 516.
+
o Code simplifications and refactoring:
- Make a bunch of functions static. Remove some dead code.
- Pull out about a third of the really big routerlist.c; put it in a
Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c 2007-10-10 07:56:33 UTC (rev 11832)
+++ tor/trunk/src/or/rephist.c 2007-10-10 15:07:19 UTC (rev 11833)
@@ -1014,6 +1014,8 @@
{
char *cp = buf;
int i, n;
+ or_options_t *options = get_options();
+ uint64_t cutoff;
if (b->num_maxes_set <= b->next_max_idx) {
/* We haven't been through the circular array yet; time starts at i=0.*/
@@ -1024,6 +1026,15 @@
i = b->next_max_idx;
}
+ if (options->RelayBandwidthRate) {
+ /* We don't want to report that we used more bandwidth than the max we're
+ * willing to relay; otherwise everybody will know how much traffic
+ * we used ourself. */
+ cutoff = options->RelayBandwidthRate * NUM_SECS_BW_SUM_INTERVAL;
+ } else {
+ cutoff = UINT64_MAX;
+ }
+
for (n=0; n<b->num_maxes_set; ++n,++i) {
uint64_t total;
if (i >= NUM_TOTALS)
@@ -1031,6 +1042,9 @@
tor_assert(i < NUM_TOTALS);
/* Round the bandwidth used down to the nearest 1k. */
total = b->totals[i] & ~0x3ff;
+ if (total > cutoff)
+ total = cutoff;
+
if (n==(b->num_maxes_set-1))
tor_snprintf(cp, len-(cp-buf), U64_FORMAT, U64_PRINTF_ARG(total));
else