summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-08-09Refactor the core of choosing by weights into a functionNick Mathewson
This eliminates duplicated code, and lets us test a hairy piece of functionality.
2012-08-09Refactor smartlist_choose_node_by_bandwidth to be less horrible.Nick Mathewson
With this patch, I dump the old kludge of using magic negative numbers to indicate unknown bandwidths. I also compute each node's weighted bandwidth exactly once, rather than computing it once in a loop to compute the total weighted bandwidth and a second time in a loop to find which one we picked.
2012-08-09Use a smarter fix for bug 1203.Nick Mathewson
Previously, we had incremented rand_bw so that when we later tested "tmp >= rand_bw", we wouldn't have an off-by-one error. But instead, it makes more sense to leave rand_bw alone and test "tmp > rand_bw". Note that this is still safe. To take the example from the bug1203 writeup: Suppose that we have 3 nodes with bandwidth 1. So the bandwidth array is { 1, 1, 1 }, and the total bandwidth is 3. We choose rand_bw == 0, 1, or 2. With the first iteration of the loop, tmp is now 1; with the second, tmp is 2; with the third, tmp is 3. Now that our check is tmp > rand_bw, we will set i in the first iteration of the loop iff rand_bw == 0; in the second iteration of the loop iff rand_bw == 1, and in the third iff rand_bw == 2. That's what we want. Incidentally, this change makes the bug 6538 fix more ironclad: once rand_bw is set to UINT64_MAX, tmp > rand_bw is obviously false regardless of the value of tmp.
2012-08-09Remove remaining timing-dependency in choosing nodes by bandwidthNick Mathewson
The old approach, because of its "tmp >= rand_bw && !i_has_been_chosen" check, would run through the second part of the loop slightly slower than the first part. Now, we remove i_has_been_chosen, and instead set rand_bw = UINT64_MAX, so that every instance of the loop will do exactly the same amount of work regardless of the initial value of rand_bw. Fix for bug 6538.
2012-08-09Change smartlist_choose_node_by_bandwidth to avoid doubleNick Mathewson
This should make our preferred solution to #6538 easier to implement, avoid a bunch of potential nastiness with excessive int-vs-double math, and generally make the code there a little less scary. "But wait!" you say. "Is it really safe to do this? Won't the results come out differently?" Yes, but not much. We now round every weighted bandwidth to the nearest byte before computing on it. This will make every node that had a fractional part of its weighted bandwidth before either slighty more likely or slightly less likely. Further, the rand_bw value was only ever set with integer precision, so it can't accurately sample routers with tiny fractional bandwidth values anyway. Finally, doing repeated double-vs-uint64 comparisons is just plain sad; it will involve an implicit cast to double, which is never a fun thing.
2012-08-09Merge remote-tracking branch 'public/bug6252_again' into maint-0.2.3Nick Mathewson
2012-08-03Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3Nick Mathewson
Conflicts: src/or/routerlist.c
2012-08-03Mitigate a side-channel leak of which relays Tor chooses for a circuitRobert Ransom
Tor's and OpenSSL's current design guarantee that there are other leaks, but this one is likely to be more easily exploitable, and is easy to fix.
2012-08-03Remove bogus comment claiming that an assertion is triggerable by consensusRobert Ransom
2012-08-03Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3Nick Mathewson
2012-08-03Avoid possible segfault when handling networkstatus vote with bad flavorNick Mathewson
Fix for 6530; fix on 0.2.2.6-alpha.
2012-07-31Avoid hard (impossible?)-to-trigger double-free in dns_resolve()Nick Mathewson
Fixes 6480; fix on 0.2.0.1-alpha; based on pseudonymous patch.
2012-07-31Merge branch 'bug6490_v2' into maint-0.2.3Nick Mathewson
2012-07-31Warn when accounting is used in a way likely to link hidden servicesNick Mathewson
Fix for 6490.
2012-07-31trivial grammar fixRoger Dingledine
2012-07-23Merge remote-tracking branch 'asn/bug6274_take3' into maint-0.2.3Nick Mathewson
2012-07-18Better handling of server managed proxies when Tor is not a relay.George Kadianakis
2012-07-18Detect bug 6252 (unexpected sendme cell)Roger Dingledine
I only check on circuits, not streams, since bloating your stream window past the initial circuit window can't help you much. Also, I compare to CIRCWINDOW_START_MAX so we don't have surprising races if we lower CIRCWINDOW_START for an experiment.
2012-07-18Merge branch 'smartlist_shorten' into maint-0.2.3Nick Mathewson
2012-07-18Tweaks to 6400 changes file and docs as suggested by armaNick Mathewson
2012-07-17Improve message on spurious SOCKSListenAddressNick Mathewson
2012-07-17Fix the remaining instances of nexted SMARTLIST_FOREACHNick Mathewson
2012-07-17Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/ENDNick Mathewson
The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when you have a nice short loop body, but using it for long bodies makes your preprocessor tell the compiler that all the code is on the same line. That causes grief, since compiler warnings and debugger lines will all refer to that one line. So, here's a new style rule: SMARTLIST_FOREACH blocks need to be short.
2012-07-17Allow TestingTorNetwork when alternate dir and bridge authorities are set.Linus Nordberg
Allow TestingTorNetwork when AlternateDirAuthority and AlternateBridgeAuthority is set even if DirServer is not.
2012-07-16Refer to the correct variable in a loop when parsing entry guard stateNick Mathewson
Fixes bug 6397 and coverity issue 709599. Bugfix on 0.2.3.17-beta.
2012-07-16Coverity 709056: Check return value on fputs in tor-gencertNick Mathewson
2012-07-06Merge branch 'maint-0.2.2' into maint-0.2.3Roger Dingledine
2012-07-06Revert to the May 2012 geoip dbRoger Dingledine
The June 2012 db marks too many relays as country "A1". Addresses bug 6334.
2012-07-06Merge remote-tracking branch 'nickm/bug6271_part_a' into maint-0.2.3Roger Dingledine
2012-07-06Fix port range in parse_port_range().George Kadianakis
2012-07-06Fix a bug handling SENDME cells on nonexistent streams.Nick Mathewson
This could result in bizarre window values. Report and patch contributed pseudymously. Fixes part of bug 6271. This bug was introduced before the first Tor release, in svn commit r152. (bug 6271, part a.)
2012-07-05On windows, ENOBUFS starts with WSA. #6296. Fix on 0.2.18-rcNick Mathewson
2012-07-01Revert "Detect bug 6252 (unexpected sendme cell)"Roger Dingledine
This reverts commit c32ec9c425e9539bcc8ede95612e2d331c2cc2dd. It turns out the two sides of the circuit don't actually stay in sync, so it is perfectly normal for the circuit window on the exit relay to grow to 2000+. We should fix that bug and then reconsider this patch.
2012-07-01Detect bug 6252 (unexpected sendme cell)Roger Dingledine
I only check on circuits, not streams, since bloating your stream window past the initial circuit window can't help you much. Also, I compare to CIRCWINDOW_START_MAX so we don't have surprising races if we lower CIRCWINDOW_START for an experiment.
2012-06-28bump version to 0.2.3.18-rc-devNick Mathewson
2012-06-28bump to 0.2.3.18-rctor-0.2.3.18-rcRoger Dingledine
2012-06-28add a blurb for 0.2.3.18-rc, other minor cleanupsRoger Dingledine
2012-06-28fix grammar in commentRoger Dingledine
2012-06-28Merge remote-tracking branch 'public/bug6244_part2' into maint-0.2.3Nick Mathewson
2012-06-28Downgrade 'Got a certificate, but we already have it' log message from ↵Andrea Shepard
warning to info, except when we're a dirauth (fixes bug 5238)
2012-06-27Fix GETINFO address-mappings/... with wildcarded addresses.Nick Mathewson
2012-06-27Allow wildcarded mapaddress targets in controller MAPADDRESS commandNick Mathewson
2012-06-26Merge remote-tracking branch 'public/bug6227' into maint-0.2.3Nick Mathewson
2012-06-26Fix a warning when using glibc's strcspn with clang.Nick Mathewson
With glibc 2.15 and clang 3.0, I get warnings from where we use the strcpsn implementation in the header as strcspn(string, "="). This is apparently because clang sees that part of the strcspn macro expands to "="[2], and doesn't realize that that part of the macro is only evaluated when "="[1] != 0.
2012-06-26Add a unit test for environment_variable_names_equalNick Mathewson
I need this because I'm about to frob that function to stop using strcspn() in order to get rid of a clang warning.
2012-06-26Fix a compilation warning with clang 3.0Nick Mathewson
In b1ad1a1d0266a20bb we introduced an implicit (but safe) long-to-int shortening that clang didn't like. Warning not in any released version of Tor.
2012-06-26Downgrade message about md cache cleaning from notice to infoNick Mathewson
Fix for #6238
2012-06-25Bump the test util/threads timeout up to 150 secNick Mathewson
This should make some debian build systems happier. Also, increase the select() timeout to a more reasonable 100 msec.
2012-06-25Don't do DNS lookups when parsing corrupted managed proxy messages.George Kadianakis
The functions parse_{s,c}method_line() were using tor_addr_port_lookup() which is capable of doing DNS lookups. DNS lookups should not be necessary when parsing {C,S}METHOD lines.
2012-06-25Merge remote-tracking branch 'public/bug6225' into maint-0.2.3Nick Mathewson