Commit Graph

16604 Commits

Author SHA1 Message Date
Andrea Shepard f445aae2e3 Update unmeasured bandwidth clipping unit test per NickM's bugfix for the Unmeasured=1 issue 2013-02-19 11:06:24 -05:00
Nick Mathewson 6170bc5a93 Refactor storing of measured_bw versus Unmeasured=1.
This patch moves the measured_bw field and the has_measured_bw field
into vote_routerstatus_t, since only votes have 'Measured=XX' set on
their weight line.

I also added a new bw_is_unmeasured flag to routerstatus_t to
represent the Unmeasured=1 flag on a w line.  Previously, I was using
has_measured_bw for this, which was quite incorrect: has_measured_bw
means that the measured_bw field is set, and it's probably a mistake
to have it serve double duty as meaning that 'baandwidth' represents a
measured value.

While making this change,I also found a harmless but stupid bug in
dirserv_read_measured_bandwidths: It assumes that it's getting a
smartlist of routerstatus_t, when really it's getting a smartlist of
vote_routerstatus_t.  C's struct layout rules mean that we could never
actually get an error because of that, but it's still quite incorrect.
I fixed that, and in the process needed to add two more sorting and
searching helpers.

Finally, I made the Unmeasured=1 flag get parsed.  We don't use it for
anything yet, but someday we might.

This isn't complete yet -- the new 2286 unit test doesn't build.
2013-02-19 11:06:24 -05:00
Andrea Shepard 4c45b3d845 Add unit test for unmeasured bandwidth clipping in consensus 2013-02-19 11:06:24 -05:00
Andrea Shepard f4d5ca9b5e Refactor v3_networkstatus test to allow reuse of test for measuredbw 2013-02-19 11:06:24 -05:00
Nick Mathewson 869826581d Note some annoyinc copy-and-paste code 2013-02-19 11:06:23 -05:00
Nick Mathewson e73bbea262 Tweak consensus method 17 based on arma's comments
Instead of capping whenever a router has fewer than 3 measurements,
we cap whenever a router has fewer than 3 measurements *AND* there
are at least 3 authorities publishing measured bandwidths.

We also generate bandwidth lines with a new "Unmeasured=1" flag,
meaning that we didn't have enough observations for a node to use
measured bandwidth values in the authority's input, whether we capped
it or not.
2013-02-19 11:05:15 -05:00
Nick Mathewson 1cd6744338 New consensus method: clip the maximum votable unmeasured bw
If we're deciding on a node's bandwidth based on "Bandwidth="
declarations, clip it to "20" or to the maxunmeasuredbw parameter,
if it's voted on.

This adds a new consensus method.

This is "part A" of bug 2286
2013-02-05 00:46:32 -05:00
Nick Mathewson 2dcad03eba Merge remote-tracking branch 'public/bug8151' 2013-02-05 00:33:04 -05:00
Roger Dingledine 2c73fe5f5e bump to 0.2.4.10-alpha-dev 2013-02-04 18:20:13 -05:00
Roger Dingledine 54f9a402c5 bump to 0.2.4.10-alpha tor-0.2.4.10-alpha 2013-02-04 17:11:00 -05:00
Roger Dingledine 03bdb4d5ce fold in changes for 0.2.4.10-alpha 2013-02-04 17:06:01 -05:00
Nick Mathewson cd4ad45ba3 Include a flag-thresholds line in each vote to describe flag cutoffs
Implements ticket 8151.
2013-02-04 13:44:05 -05:00
Nick Mathewson 12f2d986f3 Merge branch 'authdir_quick_fix' 2013-02-04 12:34:14 -05:00
Nick Mathewson b1cb9ebb1c Merge branch 'bug8146_etc' 2013-02-04 12:34:09 -05:00
Nick Mathewson 2e9cd4b724 Quick fix on 5956 for authorities
Authorities don't set is_possible_guard on node_t, so they were
never deciding that they could build enough paths.  This is a quick
and dirty fix.

Bug not in any released version of Tor
2013-02-04 12:25:43 -05:00
Nick Mathewson 898f2d7c27 Merge branch 'bug8153' 2013-02-04 11:54:38 -05:00
Nick Mathewson b64dc35b5c Reinstate some fixes/tweaks from 6e4a4002
These seem to have gotten conflicted out of existence while mike was
working on path bias stuff.

Thanks to sysrqb for collecting these in a handy patch.
2013-02-04 11:51:39 -05:00
Nick Mathewson 7cde094fd5 Fix a warning when building with --disable-curve25519
It appears that the code for 7291 gave an unused-value warning when
built with --disable-curve25519.
2013-02-04 11:34:23 -05:00
Nick Mathewson 5ea9a90d68 Fix compilation with --disable-curve25519 option
The fix is to move the two functions to format/parse base64
curve25519 public keys into a new "crypto_format.c" file.  I could
have put them in crypto.c, but that's a big file worth splitting
anyway.

Fixes bug 8153; bugfix on 0.2.4.8-alpha where I did the fix for 7869.
2013-02-04 11:32:55 -05:00
Nick Mathewson 4eff8b6530 When we mark a node as a sybil, mark it down and reset its uptime to 0
This prevents bug 8147, where such nodes would accrue points towards
Guard, Fast, HSDir, and so on.

Fixes bug 8147.
2013-02-04 11:11:54 -05:00
Nick Mathewson 61995d3e2c Ignore tiny bandwidths entirely when computing thresholds
Another bug 8145 fix.
2013-02-04 10:47:08 -05:00
Nick Mathewson 317d16de04 Increase the minimum value for the Fast flag to 4096.
Fix for 8145.
2013-02-04 10:41:25 -05:00
Nick Mathewson 8be7f69f8d Refactor should-count-towards-thresholds test into new function 2013-02-04 10:22:45 -05:00
Nick Mathewson 40c13240c0 When computing performance thresholds, ignore omitted-as-sybil nodes.
Fixes bug 8146.
2013-02-04 10:19:26 -05:00
Nick Mathewson ddf2c36ab1 Whoops: evdns_log, not tor_log, in src/ext/eventdns.c 2013-02-04 10:07:02 -05:00
Nick Mathewson acb43c0735 Merge remote-tracking branch 'public/feature7706' 2013-02-01 17:24:08 -05:00
Nick Mathewson c93f66b103 Merge remote-tracking branch 'public/bug7708_023_v3_squashed' 2013-02-01 17:11:46 -05:00
Nick Mathewson 690ea9e8cf Clarify documentation of connection_finished_flushing 2013-02-01 17:10:15 -05:00
Nick Mathewson b442930789 Fix serious breakage in connection_handle_write_impl
When we first implemented TLS, we assumed in conneciton_handle_write
that a TOR_TLS_WANT_WRITE from flush_buf_tls meant that nothing had
been written. But when we moved our buffers to a ring buffer
implementation back in 0.1.0.5-rc (!), we broke that invariant: it's
possible that some bytes have been written but nothing.

That's bad.  It means that if we do a sequence of TLS writes that ends
with a WANTWRITE, we don't notice that we flushed any bytes, and we
don't (I think) decrement buckets.

Fixes bug 7708; bugfix on 0.1.0.5-rc
2013-02-01 17:10:15 -05:00
Nick Mathewson 4074ff440e Merge branch 'ticket8081_squashed' 2013-02-01 17:03:12 -05:00
Nick Mathewson 996db755c2 Fix a couple of warnings on the 8081 branch. 2013-02-01 17:03:00 -05:00
Mike Perry fed7f01377 Add EntryGuardPathUseBias to state file keyword list. 2013-02-01 17:01:26 -05:00
Mike Perry b3e57b760e Increment an informational counter for use failed state.
This informational counter is probably now redundant, but might as well keep
it consistent I guess.
2013-02-01 17:01:26 -05:00
Mike Perry da5817772d Rename and relocate the bw weight scale param getter.
It had nothing to do with circuit build times.
2013-02-01 17:01:22 -05:00
Mike Perry 6e4610de02 Fix a log typo found by sysrqb. 2013-02-01 17:01:22 -05:00
Mike Perry 95d272f5d8 Bounds-check path bias rate parameters.
The other remaining parameters don't really need range checks.
2013-02-01 17:01:22 -05:00
Mike Perry bce6714f99 Refactor code that rolls back the use state
Also document it better.

Mention this refactoring in the comments for the path state machine.
2013-02-01 17:01:16 -05:00
Mike Perry 3a63e5ef42 Refactor and rename pathbias rate evaluation. 2013-02-01 17:01:12 -05:00
Mike Perry dfcfb5d17d Refactor the scaling parameter fetching into a single function.
Also, deprecate the torrc options for the scaling values. It's unlikely anyone
but developers will ever tweak them, even if we provided a single ratio value.
2013-02-01 17:01:12 -05:00
Mike Perry 2b2c7f23f5 Mark entry guard state dirty everwhere the pathbias code touches it. 2013-02-01 17:01:12 -05:00
Mike Perry 6828a19670 Add a tristate to guard against unexpected circ purpose transitions 2013-02-01 17:01:12 -05:00
Mike Perry 173ed05d2f Clarify state transition and related pathbias comments 2013-02-01 17:01:12 -05:00
Nick Mathewson ec90ed4f6d Merge branch 'rename_log_7599' 2013-02-01 16:23:26 -05:00
Roger Dingledine fd49226385 Help us track bug 8093:
Improve the log message when "Bug/attack: unexpected sendme cell
from client" occurs.
2013-02-01 16:22:34 -05:00
Nick Mathewson 7301339e33 fix wide lines from tor_log rename 2013-02-01 16:19:02 -05:00
Nick Mathewson 1dd03fbc77 Fix a silly mistake in the tor_mathlog() documentation. Give it a unit test. 2013-02-01 16:09:16 -05:00
Nick Mathewson b034d07acd Remove old wrapper code and defines for keeping log() and log(3) apart
This is the non-automated portion of bug 7599.
2013-02-01 15:49:51 -05:00
Nick Mathewson a141430ec3 Rename log() to tor_log() for logging
This is meant to avoid conflict with the built-in log() function in
math.h.  It resolves ticket 7599.  First reported by dhill.

This was generated with the following perl script:

 #!/usr/bin/perl -w -i -p

 s/\blog\(LOG_(ERR|WARN|NOTICE|INFO|DEBUG)\s*,\s*/log_\L$1\(/g;

 s/\blog\(/tor_log\(/g;
2013-02-01 15:43:37 -05:00
Nick Mathewson abb5519d93 typo in crypto_curve25519.c comment, spotted by rransom 2013-01-31 13:53:29 -05:00
Nick Mathewson 294ce2ea87 whitespace fix 2013-01-31 13:26:25 -05:00