summaryrefslogtreecommitdiff
path: root/src/feature
AgeCommit message (Collapse)Author
2018-09-21Put dirlist_free_all back in routerlist_free_all for unit testsNick Mathewson
2018-09-20Merge remote-tracking branch 'dgoulet/ticket27410_035_01'Nick Mathewson
2018-09-20Merge remote-tracking branch 'dgoulet/ticket27410_032_01'Nick Mathewson
2018-09-20Merge branch 'bug23512-v4-029-fixes'Nick Mathewson
2018-09-20Merge branch 'bug23512-v4-029-fixes'Nick Mathewson
2018-09-20Split most of dirserv.c into several new modulesNick Mathewson
In dirauth: * bwauth.c reads and uses bandwidth files * guardfraction.c reads and uses the guardfraction file * reachability.c tests relay reachability * recommend_pkg.c handles the recommended-packages lines. * recv_descs.c handles fingerprint files and processing incoming routerinfos that relays upload to us * voteflag.c computes flag thresholds and sets those thresholds on routerstatuses when computing votes In control: * fmt_serverstatus.c generates the ancient "v1 server status" format that controllers expect. In nodelist: * routerstatus_fmt.c formats routerstatus entries for a consensus, a vote, or for the controller.
2018-09-19Split routerlist.c into 4 separate modulesNick Mathewson
There are now separate modules for: * the list of router descriptors * the list of authorities and fallbacks * managing authority certificates * selecting random nodes
2018-09-19test: hs-v3 desc has arrived unit testDavid Goulet
That unit test makes sure we don't have pending SOCK request if the descriptor turns out to be unusable. Part of #27410. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-19hs-v3: Close all SOCKS request on descriptor failureDavid Goulet
Client side, when a descriptor is finally fetched and stored in the cache, we then go over all pending SOCKS request for that descriptor. If it turns out that the intro points are unusable, we close the first SOCKS request but not the others for the same .onion. This commit makes it that we'll close all SOCKS requests so we don't let hanging the other ones. It also fixes another bug which is having a SOCKS connection in RENDDESC_WAIT state but with a descriptor in the cache. At some point, tor will expire the intro failure cache which will make that descriptor usable again. When retrying all SOCKS connection (retry_all_socks_conn_waiting_for_desc()), we won't end up in the code path where we have already the descriptor for a pending request causing a BUG(). Bottom line is that we should never have pending requests (waiting for a descriptor) with that descriptor in the cache (even if unusable). Fixees #27410. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-18Merge branch 'bug23512-v4-033' into bug23512-v4-masterMike Perry
2018-09-14Merge branch 'maint-0.3.4'Nick Mathewson
2018-09-14hs-v2: Demote log warning to info when we don't have a consensusDavid Goulet
Fixes #27040 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-14Merge remote-tracking branch 'tor-github/pr/329'Nick Mathewson
2018-09-14Merge branch 'ticket27247'Nick Mathewson
2018-09-14Re-order includes to expose intptr_t to tor_api_internal.hNick Mathewson
2018-09-13Fix a shadowed-global warning in geoip.cNick Mathewson
Bugfix on 5ab2110eb6b4ae9082430081cb2800018cf0dcd6; bug not in any released Tor.
2018-09-13Merge branch 'bug27224_take2_squashed'Nick Mathewson
2018-09-13Avoid calling node_get_all_orports() from node_is_a_configured_bridge()rl1987
All node_get_all_orports() does is allocate and return a smartlist with at most two tor_addr_port_t members that match ORPort's of node configuration. This is harmful for memory efficiency, as it allocates the same stuff every time it is called. However, node_is_a_configured_bridge() does not need to call it, as it already has all the information to check if there is configured bridge for a given node. The new code is arranged in a way that hopefully makes each succeeding linear search through bridge_list less likely.
2018-09-13Control port call to emit a CIRC_BW event for a single circuit.Mike Perry
This commit only moves code. No functionality has been changed.
2018-09-13Merge remote-tracking branch 'onionk/strcmpstart1'Nick Mathewson
2018-09-12Merge remote-tracking branch 'tor-github/pr/280'Nick Mathewson
2018-09-12Merge remote-tracking branch 'dgoulet/ticket27545_035_01'Nick Mathewson
2018-09-12nodelist: fix docs for networkstatus_read_cached_consensus_implcypherpunks
Fix on c12d2cb2dcfe52aadf528a70433b468327472eaf.
2018-09-12nodelist: use strcmpstart() instead of strncmp()cypherpunks
in rend_parse_v2_service_descriptor. Fix on c58675ca728f12b42f65e5b8964ae695c2e0ec2d
2018-09-12Merge remote-tracking branch 'tor-github/pr/298'Nick Mathewson
2018-09-11Merge remote-tracking branch 'tor-github/pr/315'Nick Mathewson
2018-09-11hs-v3: Shuffle the list of authorized clientsSuphanat Chunhapanya
This commit makes it that the authorized clients in the descriptor are in random order instead of ordered by how they were read on disk. Fixes #27545 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-10Defer reporting directory bootstrap progressTaylor Yu
Existing cached directory information can cause misleadingly high bootstrap percentages. To improve user experience, defer reporting of directory information progress until at least one connection has succeeded to a relay or bridge. Closes ticket 27169.
2018-09-10Track bootstrap phase independently of progressTaylor Yu
Track bootstrap phase (enumerated by bootstrap_status_t) independently from the bootstrap progress (which can represent intermediate progress). This allows control_event_bootstrap_problem() to avoid doing a linear search through the bootstrap progress space to find the current bootstrap phase.
2018-09-10Refactor control_event_bootstrap_core() moreTaylor Yu
Eliminate a few conditional expressions in control_event_bootstrap_core() by overwriting the status parameter.
2018-09-10Refactor control_event_bootstrap() somewhatTaylor Yu
Move the mostly-invariant part of control_event_boostrap() into a helper control_event_bootstrap_core(). The helper doesn't modify any state beyond doing logging and control port notifications.
2018-09-10Deindent much of control_event_bootstrapTaylor Yu
2018-09-10Make control_event_bootstrap() return voidTaylor Yu
Simplify control_event_bootstrap() by making it return void again. It is currently a fairly complicated function, and it's made more complicated by returning an int to signal whether it logged at NOTICE or INFO. The callers conditionally log messages at level NOTICE based on this return value. Change the callers to unconditionally log their verbose human-readable messages at level INFO to keep NOTICE logs less cluttered. This partially reverts the changes of #14950.
2018-09-10Address coverity warnings (CID 1439133/1439132).George Kadianakis
>>>> CID 1439133: Null pointer dereferences (REVERSE_INULL) >>>> Null-checking "fields" suggests that it may be null, but it >>>> has already been dereferenced on all paths leading to the check. >>>> CID 1439132: Null pointer dereferences (REVERSE_INULL) >>>> Null-checking "fields" suggests that it may be null, but it >>>> has already been dereferenced on all paths leading to the check.
2018-09-07Do not store cached_dir_t for consensus in RAM if not a dircache.Nick Mathewson
There are three reasons we use a cached_dir_t to hold a consensus: 1. to serve that consensus to a client 2. to apply a consensus diff to an existing consensus 3. to send the consensus to a controller. But case 1 is dircache-only. Case 2 and case 3 both fall back to networkstatus_read_cached_consensus(). So there's no reason for us to store this as a client. Avoiding this saves about 23% of our RAM usage, according to our experiments last month. This is, semantically, a partial revert of e5c608e535ef9a4c4fe951a2. Fixes bug 27247; bugfix on 0.3.0.1-alpha.
2018-09-07Use networkstatus_read_cached_consensus() for GETINFONick Mathewson
We already had fallback code for "dir/status-vote/current/consensus" to read from disk if we didn't have a cached_dir_t available. But there's a function in networkstatus_t that does it for us, so let's do that.
2018-09-07Merge remote-tracking branch 'dgoulet/ticket20700_035_03'Nick Mathewson
2018-09-07HSv3: Don't assert when reading bad client-side privkeys.George Kadianakis
2018-09-07HSv3: Add subcredential in client auth KDF on the client-side.George Kadianakis
2018-09-07HSv3: Add subcredential in client auth KDF on the service-side.George Kadianakis
Also update some client auth test vectors that broke...
2018-09-07hs-v3: Make hs_desc_build_fake_authorized_client() return an objectDavid Goulet
Return a newly allocated fake client authorization object instead of taking the object as a parameter. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Improve v3 client authorization loggingDavid Goulet
Part of #20700. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Log client auth load activities client sideSuphanat Chunhapanya
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Log client auth load activities service sideSuphanat Chunhapanya
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Rename client_pk to client_auth_pkSuphanat Chunhapanya
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Rename client_sk to client_auth_skSuphanat Chunhapanya
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07test: HS v3 client auth is config equal functionSuphanat Chunhapanya
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Republish descriptors if client auth changesSuphanat Chunhapanya
When reloading tor, check if our the configured client authorization have changed from what we previously had. If so, republish the updated descriptor. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Make all descriptor content free functions publicSuphanat Chunhapanya
Series of functions that we now need in hs_service.c. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-09-07hs-v3: Re-enable the decoding in the encoding functionSuphanat Chunhapanya
Previously, the validation by decoding a created descriptor was disabled because the interface had to be entirely changed and not implemented at the time. This commit re-enabled it because it is now implemented. Signed-off-by: David Goulet <dgoulet@torproject.org>