summaryrefslogtreecommitdiff
path: root/src/or/bridges.c
AgeCommit message (Collapse)Author
2018-04-10Merge remote-tracking branch 'isis-github/bug25425_squashed2'Nick Mathewson
2018-04-09test: Add testing module and some unittests for bridges.c.Isis Lovecruft
This roughly doubles our test coverage of the bridges.c module. * ADD new testing module, .../src/test/test_bridges.c. * CHANGE a few function declarations from `static` to `STATIC`. * CHANGE one function in transports.c, transport_get_by_name(), to be mockable. * CLOSES #25425: https://bugs.torproject.org/25425
2018-03-03Merge branch 'ticket23814' into maint-0.3.3Nick Mathewson
2018-02-07Fix spelling mistakes corresponding to ticket #23650Deepesh Pathak
2018-01-31remove the max_failures argument from download_status_is_ready.Nick Mathewson
2018-01-25Remove the old ("deterministic") download schedule.Nick Mathewson
We haven't meant to use it since we introduced the random exponential schedule. Closes ticket 23814.
2018-01-11Merge remote-tracking branch 'ffmancera/github/bug24573'Nick Mathewson
2018-01-02Set IPv6 preferences for bridges even if there is no ri.Fernando Fernandez Mancera
Tor now sets IPv6 preferences on rewrite_node_address_for_bridge() even if there is only ri or rs. It always warns about them. Also Tor now sets the IPv6 address in rs as well as it sets the one in ri. Fixes #24572 on 9e9edf7 in 0.2.4.5-alpha. Fixes #24573 on c213f27 in 0.2.8.2-alpha. Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
2017-12-12Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-12Make sure bridges are definitely running before delaying directory fetchesteor
Retry directory downloads when we get our first bridge descriptor during bootstrap or while reconnecting to the network. Keep retrying every time we get a bridge descriptor, until we have a reachable bridge. Stop delaying bridge descriptor fetches when we have cached bridge descriptors. Instead, only delay bridge descriptor fetches when we have at least one reachable bridge. Fixes bug 24367; bugfix on 0.2.0.3-alpha.
2017-12-08Convert remaining function (mostly static) to new free styleNick Mathewson
2017-11-22Stop checking cached bridge descriptors for usable bridgesteor
Stop checking for bridge descriptors when we actually want to know if any bridges are usable. This avoids potential bootstrapping issues. Fixes bug 24367; bugfix on 0.2.0.3-alpha. Stop stalling when bridges are changed at runtime. Stop stalling when old bridge descriptors are cached, but they are not in use. Fixes bug 24367; bugfix on 23347 in 0.3.2.1-alpha.
2017-10-24Merge remote-tracking branch 'catalyst-oniongit/bug20532_031' into maint-0.3.2Nick Mathewson
2017-10-24Rewrite bridge addresses earlierTaylor Yu
Call rewrite_node_address_for_bridge() in launch_direct_bridge_descriptor_fetch() in case there's an existing node_t for it.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Make an assert into a BUG warning in the bridge codeteor
If future code asks if there are any running bridges, without checking if bridges are enabled, log a BUG warning rather than crashing. Fixes 23524 on 0.3.0.1-alpha
2017-09-15Explain where bridge download statuses are initialisedteor
And why we can't initialise them on config Comment-only change, follow-up to 23347.
2017-09-14Remove a download_status_reset() call that led to a crash -- see 23347Nick Mathewson
2017-09-12Add a missing bridge download status resetteor
17750 made unused download schedules automatically reset. But we should make that explicit.
2017-09-12Make clients wait to refresh bridges when they have a recent descriptorteor
But when clients are just starting, make them try each bridge a few times before giving up on it. These changes make the bridge download schedules more explicit: before 17750, they relied on undocumented behaviour and specific schedule entries. (And between 17750 and this fix, they were broken.) Fixes 23347, not in any released version of tor.
2017-09-12Refactor bridge download statuses to increment on attemptteor
We were always incrementing bridge download statuses on each attempt, but we were using the "increment on failure" functions to do it. And we never incremented them on failure. No behaviour change.
2017-09-12Make bridge clients download bridge descriptors immediatelyteor
The download schedule tells Tor to wait 15 minutes before downloading bridge descriptors. But 17750 made Tor ignore that and start immediately. Since we fixed 17750, Tor waits 15 minutes for bridge client bootstrap, like the schedule says. This fixes the download schedule to start immediately, and to try each bridge 3 times in the first 30 seconds. This should make bridge bootstraps more reliable. Fixes 23347.
2017-05-22Set guard state on bridge descriptor fetches.George Kadianakis
We used to not set the guard state in launch_direct_bridge_descriptor_fetch(). So when a bridge descriptor fetch failed, the guard subsystem would never learn about the fail (and hence the guard's reachability state would not be updated).
2017-04-21Make launch_direct_bridge_descriptor_fetch use dirreqs.Nick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-09Fix failing bridges+ipv6-min integration test.George Kadianakis
The bridges+ipv6-min integration test has a client with bridges: Bridge 127.0.0.1:5003 Bridge [::1]:5003 which got stuck in guard_selection_have_enough_dir_info_to_build_circuits() because it couldn't find the descriptor of both bridges. Specifically, the guard_has_descriptor() function could not find the node_t of the [::1] bridge, because the [::1] bridge had no identity digest assigned to it. After further examination, it seems that during fetching the descriptor for our bridges, we used the CERTS cell to fill the identity digest of 127.0.0.1:5003 properly. However, when we received a CERTS cell from [::1]:5003 we actually ignored its identity digest because the learned_router_identity() function was using get_configured_bridge_by_addr_port_digest() which was returning the 127.0.0.1 bridge instead of the [::1] bridge (because it prioritizes digest matching over addrport matching). The fix replaces get_configured_bridge_by_addr_port_digest() with the recent get_configured_bridge_by_exact_addr_port_digest() function. It also relaxes the constraints of the get_configured_bridge_by_exact_addr_port_digest() function by making it return bridges whose identity digest is not yet known. By using the _exact_() function, learned_router_identity() actually fills in the identity digest of the [::1] bridge, which then allows guard_has_descriptor() to find the right node_t and verify that the descriptor is there. FWIW, in the bridges+ipv6-min test both 127.0.0.1 and [::1] bridges correspond to the same node_t, which I guess makes sense given that it's actually the same underlying bridge.
2017-02-28Change approach to preventing duplicate guards.Nick Mathewson
Previously I'd made a bad assumption in the implementation of prop271 in 0.3.0.1-alpha: I'd assumed that there couldn't be two guards with the same identity. That's true for non-bridges, but in the bridge case, we allow two bridges to have the same ID if they have different addr:port combinations -- in order to have the same bridge ID running multiple PTs. Fortunately, this assumption wasn't deeply ingrained: we stop enforcing the "one guard per ID" rule in the bridge case, and instead enforce "one guard per <id,addr,port>". We also needed to tweak our implementation of get_bridge_info_for_guard, since it made the same incorrect assumption. Fixes bug 21027; bugfix on 0.3.0.1-alpha.
2017-01-18Remove UseDeprecatedGuardAlgorithm.Nick Mathewson
2017-01-18Remove the (no longer compiled) code for legacy guard selection.Nick Mathewson
Part of 20830.
2016-12-16Merge branch 'prop271_030_v1_squashed'Nick Mathewson
2016-12-16Wrap all of the legacy guard code, and its users, in #ifdefsNick Mathewson
This will make it easier to see what we remove down the line.
2016-12-16More progress on bridge implementation with prop271 guardsNick Mathewson
Here we handle most (all?) of the remaining tasks, and fix some bugs, in the prop271 bridge implementation. * We record bridge identities as we learn them. * We only call deprecated functions from bridges.c when the deprecated guard algorithm is in use. * We update any_bridge_descriptors_known() and num_bridges_usable() to work correctly with the new backend code. (Previously, they called into the guard selection logic. * We update bridge directory fetches to work with the new guard code. * We remove some erroneous assertions where we assumed that we'd never load a guard that wasn't for the current selection. Also, we fix a couple of typos.
2016-12-16Add some needed accessors/inspectors for bridge/guard convergenceNick Mathewson
2016-12-16Lay down some infrastructure for bridges in the New Guard Order.Nick Mathewson
This includes: * making bridge_info_t exposed but opaque * allowing guards where we don't know an identity * making it possible to learn the identity of a guard * creating a guard that lacks a node_t * remembering a guard's address and port. * Looking up a guard by address and port. * Only enforcing the rule that we need a live consensus to update the "listed" status for guards when we are not using bridges.
2016-11-30Use the new guard notification/selection APIs throughout TorNick Mathewson
This patch doesn't cover every case; omitted cases are marked with "XXXX prop271", as usual. It leaves both the old interface and the new interface for guard status notification, since they don't actually work in the same way: the new API wants to be told when a circuit has failed or succeeded, whereas the old API wants to know when a channel has failed or succeeded. I ran into some trouble with directory guard stuff, since when we pick the directory guard, we don't actually have a circuit to associate it with. I solved that by allowing guard states to be associated with directory connections, not just circuits.
2016-11-30Add accessors as needed to repair compilationNick Mathewson
The previous commit, in moving a bunch of functions to bridges.c, broke compilation because bridges.c required two entry points to entrynodes.c it didn't have.
2016-11-30Split bridge functions into a new module.Nick Mathewson
This patch is just: * Code movement * Adding headers here and there as needed * Adding a bridges_free_all() with a call to it. It breaks compilation, since the bridge code needed to make exactly 2 calls into entrynodes.c internals. I'll fix those in the next commit.