Opened 13 years ago

Last modified 8 years ago

#516 closed defect (Fixed)

read-history/write-history show non-relayed traffic too

Reported by: arma Owned by:
Priority: Low Milestone: 0.2.0.x-final
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: arma, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


In connection_buckets_decrement(), we report to rep_hist_note_bytes_read/written
whether the traffic was relayed traffic or our own traffic. If the user sets
RelayBandwidthRate and the relayed traffic constantly hits that level, then
any numbers higher than that in the read-history/write-history lines will be
due to locally initiated traffic.

The easy fix would be to only count bytes that were sent on relayed connections --
so locally initiated directory connections, and all circuits on connections that
recently carried traffic for an origin circuit, would be ignored:

Index: connection.c
--- connection.c (revision 11723)
+++ connection.c (working copy)
@@ -1546,12 +1546,12 @@

if (!connection_is_rate_limited(conn))

return; /* local IPs are free */

  • if (num_read > 0)
  • rep_hist_note_bytes_read(num_read, now);
  • if (num_written > 0)
  • rep_hist_note_bytes_written(num_written, now);

+ if (connection_counts_as_relayed_traffic(conn, now)) {
+ if (num_read > 0)
+ rep_hist_note_bytes_read(num_read, now);
+ if (num_written > 0)
+ rep_hist_note_bytes_written(num_written, now);

  • if (connection_counts_as_relayed_traffic(conn, now)) {

global_relayed_read_bucket -= num_read;
global_relayed_write_bucket -= num_written;


Then I realized that this has the mirror-image problem: if the server
has uniform enough usage around its BandwidthRate, then just as we
were looking at spikes before and knowing they came from non-relayed
traffic, now we look at dips and conclude the same thing.


[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (5)

comment:1 Changed 13 years ago by nickm

What if we reported our history as MIN(observed-usage, bandwidth-rate) ? Would that do what you want?

comment:2 Changed 13 years ago by arma

It does seem better.

Let's do that, and if we come up with something even better later, we can
think about that then.

comment:3 Changed 13 years ago by nickm

Roger later said:

01:12 < arma> it's still niggling the back of my mind though
01:12 < arma> i assume we want to do 900 * BandwidthRate
01:12 < arma> and if a period shows exactly that number, we know there was some

nontrivial client activity in that period.

01:13 < arma> since it would never be precisely at that value otherwise
01:14 < arma> another option would be to disable the bandwidth-history lines if

socksport (or equivalent) is open.

comment:4 Changed 13 years ago by nickm

flyspray2trac: bug closed.
Fixed in r11833.

comment:5 Changed 8 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.