aboutsummaryrefslogtreecommitdiff
path: root/src/or/nodelist.h
AgeCommit message (Collapse)Author
2018-04-22Rename node_has_descriptor() to node_has_any_descriptor()Nick Mathewson
Changing the name of this function should help keep us from misusing it when node_has_preferred_descriptor() would be more appropriate.
2018-04-22Check for "the right descriptor", not just "any descriptor".Nick Mathewson
This patch adds a new node_has_preferred_descriptor() function, and replaces most users of node_has_descriptor() with it. That's an important change, since as of d1874b433953f64 (our fix for #25213), we are willing to say that a node has _some_ descriptor, but not the _right_ descriptor for a particular use case. Part of a fix for 25691 and 25692.
2018-03-27test: Add unittest for the OR connection failure cacheGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-02-09Merge remote-tracking branch 'dgoulet/ticket24902_029_05'Nick Mathewson
2018-02-08test: Add unit tests for addressset.cDavid Goulet
This also adds one that tests the integration with the nodelist. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-02-08Add an address_set to the nodelist.Nick Mathewson
This set is rebuilt whenever a consensus arrives. In between consensuses, it is add-only.
2018-02-01Remove nodelist_recompute_all_hsdir_indices() as unused.Nick Mathewson
Closes 25108.
2017-11-12Make node_get_curve25519_onion_key() return a const ptrNick Mathewson
2017-11-12Merge branch 'bug23577_squashed'Nick Mathewson
2017-11-12Introduce node_get_curve25519_onion_key()Neel Chauhan
2017-11-09Merge branch 'ticket20895'Nick Mathewson
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-11Split the behavior of node_supports_ed25519_link_authentication().Nick Mathewson
Before, this function meant "can we connect to this node and authenticate it using its ed25519 key?" Now it can additionally mean, "when somebody else connects to this node, do we expect that they can authenticate using the node's ed25519 key"? This change lets us future-proof our link authentication a bit. Closes ticket 20895. No backport needed, since ed25519 link authentication support has not been in any LTS release yet, and existing releases with it should be obsolete before any releases without support for linkauth=3 are released.
2017-09-08Merge branch 'ed25519_lookup'Nick Mathewson
2017-09-08test: Add an HS v3 reachability unit testDavid Goulet
This is a large and important unit test for the hidden service version 3! It tests the service reachability for a client using different consensus timings and makes sure that the computed hashring is the same on both side so it is actually reachable. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-09-07prop224: Pick rendezvous point of protover HSRend=2David Goulet
Version 3 hidden service needs rendezvous point that have the protocol version HSRend >= 2 else the rendezvous cells are rejected. Fixes #23361 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-22Refactor node lookup APIs to take flagsNick Mathewson
Right now there's a single warn_if_unnamed flag for router_get_consensus_status_by_nickname() and node_get_by_nickname(), that is nearly always 1. I've turned it into an 'unsigned' bitfield, and inverted its sense. I've added the flags argument to node_get_by_hex_id() too, though it does nothing there right now. I've removed the router_get_consensus_status_by_nickname() function, since it was only used in once place. This patch changes the warning behavior of GETINFO ns/name/<name>, since all other name lookups from the controller currently warn. Later I'm going to add more flags, for ed25519 support.
2017-08-22Remove some support for nickname-based hexdigestsNick Mathewson
We once used $X=N to mean "A relay with RSA ID digest X with the Named flag and the nickname N." But authorities no longer assign the Named flag.
2017-08-19prop224: Recompute all HSDir indices when we enter overlap mode.George Kadianakis
When we enter overlap mode we start using the next hsdir index of relays. However, we only compute the next hsdir index of relays when we receive a consensus or their descriptor. This means that there is a window of time between entering the overlap period and fetching the consensus where relays have their next hsdir index uninitialized. This patch fixes this by recomputing all hsdir indices when we first enter the overlap period.
2017-08-19prop224: Only upload descriptor if we have good hash ring and SRV.George Kadianakis
Make sure we have a live consensus (for SRV) and enough descriptors (for hash ring). Also fix unittests that broke.
2017-08-09Add a hashtable mapping to nodes from ed25519 idsNick Mathewson
2017-07-05Merge remote-tracking branch 'asn/ticket22727_032_02'Nick Mathewson
2017-06-29Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-06-29Consider the exit family when applying guard restrictions.Nick Mathewson
When the new path selection logic went into place, I accidentally dropped the code that considered the _family_ of the exit node when deciding if the guard was usable, and we didn't catch that during code review. This patch makes the guard_restriction_t code consider the exit family as well, and adds some (hopefully redundant) checks for the case where we lack a node_t for a guard but we have a bridge_info_t for it. Fixes bug 22753; bugfix on 0.3.0.1-alpha. Tracked as TROVE-2016-006 and CVE-2017-0377.
2017-06-27nodelist: Add functions to check for HS v3 supportDavid Goulet
This introduces node_supports_v3_hsdir() and node_supports_ed25519_hs_intro() that checks the routerstatus_t of a node and if not present, checks the routerinfo_t. This is groundwork for proposal 224 service implementation in #20657. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-24remove unused node_get_published_on functionRoger Dingledine
in retrospect, we should have removed this with commit 1289474d as part of #11742, which was the last caller of it.
2017-03-15Run the copyright update script.Nick Mathewson
2016-12-08Merge branch 'feature15056_v1_squashed'Nick Mathewson
2016-12-08helper to test a node for matching an ed25519 ID.Nick Mathewson
2016-12-08Enforce Ed25519 identities (client-side)Nick Mathewson
This patch makes two absolutely critical changes: - If an ed25519 identity is not as expected when creating a channel, we call that channel unsuccessful and close it. - When a client creating a channel or an extend cell for a circuit, we only include the ed25519 identity if we believe that the node on the other side supports ed25519 link authentication (from #15055). Otherwise we will insist on nodes without the right link protocol authenticating themselves. - When deciding to extend to another relay, we only upgrade the extend to extend by ed25519 ID when we know the ed25519 ID _and_ we know that the other side can authenticate. This patch also tells directory servers, when probing nodes, to try to check their ed25519 identities too (if they can authenticate by ed25519 identity). Also, handle the case where we connect by RSA Id, and learn the ED25519 ID for the node in doing so.
2016-11-24Refactor circuit_predict_and_launch_newChelsea H. Komlo
2016-11-10Accessor functions to get a node's ID keys.Nick Mathewson
2016-02-27Update the copyright year.Nick Mathewson
2016-01-29Use fascist firewall and ClientUseIPv4 for bridge clientsteor (Tim Wilson-Brown)
Bridge clients ignore ClientUseIPv6, acting as if it is always 1. This preserves existing behaviour. Make ClientPreferIPv6OR/DirPort auto by default: * Bridge clients prefer IPv6 by default. * Other clients prefer IPv4 by default. This preserves existing behaviour.
2016-01-29Add ClientUseIPv4 and ClientPreferIPv6DirPort torrc optionsteor (Tim Wilson-Brown)
ClientUseIPv4 0 tells tor to avoid IPv4 client connections. ClientPreferIPv6DirPort 1 tells tor to prefer IPv6 directory connections. Refactor policy for IPv4/IPv6 preferences. Fix a bug where node->ipv6_preferred could become stale if ClientPreferIPv6ORPort was changed after the consensus was loaded. Update documentation, existing code, add unit tests.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-30Allow tor to build circuits using a consensus with no exitsteor
If the consensus has no exits (typical of a bootstrapping test network), allow tor to build circuits once enough descriptors have been downloaded. When there are no exits, we always have "enough" exit descriptors. (We treat the proportion of available exit descriptors as 100%.) This assists in bootstrapping a testing Tor network. Fixes bug 13718. Makes bug 13161's TestingDirAuthVoteExit non-essential. (But still useful for speeding up a bootstrap.)
2014-12-30Check if there are exits in the consensusteor
Add router_have_consensus_path() which reports whether the consensus has exit paths, internal paths, or whether it just doesn't know. Used by #13718 and #13814.
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-08-29Introduce full coverage tests for module routerset.c.dana koch
This is using the paradigm introduced for test_status.c.
2014-04-15Uplift status.c unit test coverage with new test cases and macros.dana koch
A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
2014-03-27Merge branch 'bug7164_diagnose_harder_v2'Nick Mathewson
2014-03-27More logs to try to diagnose bug 7164Nick Mathewson
This time, check in microdesc_cache_clean() to see what could be going wrong with an attempt to clean a microdesc that's held by a node.
2014-02-06fix longname returned in HS_DESC control eventsQingping Hou
According to control spec, longname should not contain any spaces and is consists only of identy_digest + nickname added two functions: * node_get_verbose_nickname_by_id() * node_describe_longname_by_id()
2013-03-11On END_REASON_EXITPOLICY, mark circuit as unusable for that address.Nick Mathewson
Also, don't call the exit node 'reject *' unless our decision to pick that node was based on a non-summarized version of that node's exit policy. rransom and arma came up with the ideas for this fix. Fix for 7582; the summary-related part is a bugfix on 0.2.3.2-alpha.
2013-01-16Update the copyright date to 201.Nick Mathewson
2013-01-03Enable the ntor handshake on the client side.Nick Mathewson
"works for me"
2012-10-12Convert all include-guard macros to avoid reserved identifiers.Nick Mathewson
In C, we technically aren't supposed to define our own things that start with an underscore. This is a purely machine-generated commit. First, I ran this script on all the headers in src/{common,or,test,tools/*}/*.h : ============================== use strict; my %macros = (); my %skipped = (); FILE: for my $fn (@ARGV) { my $f = $fn; if ($fn !~ /^\.\//) { $f = "./$fn"; } $skipped{$fn} = 0; open(F, $fn); while (<F>) { if (/^#ifndef ([A-Za-z0-9_]+)/) { $macros{$fn} = $1; next FILE; } } } print "#!/usr/bin/perl -w -i -p\n\n"; for my $fn (@ARGV) { if (! exists $macros{$fn}) { print "# No macro known for $fn!\n" if (!$skipped{$fn}); next; } if ($macros{$fn} !~ /_H_?$/) { print "# Weird macro for $fn...\n"; } my $goodmacro = uc $fn; $goodmacro =~ s#.*/##; $goodmacro =~ s#[\/\-\.]#_#g; print "s/(?<![A-Za-z0-9_])$macros{$fn}(?![A-Za-z0-9_])/TOR_${goodmacro}/g;\n" } ============================== It produced the following output, which I then re-ran on those same files: ============================== s/(?<![A-Za-z0-9_])_TOR_ADDRESS_H(?![A-Za-z0-9_])/TOR_ADDRESS_H/g; s/(?<![A-Za-z0-9_])_TOR_AES_H(?![A-Za-z0-9_])/TOR_AES_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_H(?![A-Za-z0-9_])/TOR_COMPAT_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_LIBEVENT_H(?![A-Za-z0-9_])/TOR_COMPAT_LIBEVENT_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTAINER_H(?![A-Za-z0-9_])/TOR_CONTAINER_H/g; s/(?<![A-Za-z0-9_])_TOR_CRYPTO_H(?![A-Za-z0-9_])/TOR_CRYPTO_H/g; s/(?<![A-Za-z0-9_])TOR_DI_OPS_H(?![A-Za-z0-9_])/TOR_DI_OPS_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMAREA_H(?![A-Za-z0-9_])/TOR_MEMAREA_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMPOOL_H(?![A-Za-z0-9_])/TOR_MEMPOOL_H/g; s/(?<![A-Za-z0-9_])TOR_PROCMON_H(?![A-Za-z0-9_])/TOR_PROCMON_H/g; s/(?<![A-Za-z0-9_])_TOR_TORGZIP_H(?![A-Za-z0-9_])/TOR_TORGZIP_H/g; s/(?<![A-Za-z0-9_])_TOR_TORINT_H(?![A-Za-z0-9_])/TOR_TORINT_H/g; s/(?<![A-Za-z0-9_])_TOR_LOG_H(?![A-Za-z0-9_])/TOR_TORLOG_H/g; s/(?<![A-Za-z0-9_])_TOR_TORTLS_H(?![A-Za-z0-9_])/TOR_TORTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_UTIL_H(?![A-Za-z0-9_])/TOR_UTIL_H/g; s/(?<![A-Za-z0-9_])_TOR_BUFFERS_H(?![A-Za-z0-9_])/TOR_BUFFERS_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_H(?![A-Za-z0-9_])/TOR_CHANNEL_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_TLS_H(?![A-Za-z0-9_])/TOR_CHANNELTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITBUILD_H(?![A-Za-z0-9_])/TOR_CIRCUITBUILD_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITLIST_H(?![A-Za-z0-9_])/TOR_CIRCUITLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITUSE_H(?![A-Za-z0-9_])/TOR_CIRCUITUSE_H/g; s/(?<![A-Za-z0-9_])_TOR_COMMAND_H(?![A-Za-z0-9_])/TOR_COMMAND_H/g; s/(?<![A-Za-z0-9_])_TOR_CONFIG_H(?![A-Za-z0-9_])/TOR_CONFIG_H/g; s/(?<![A-Za-z0-9_])TOR_CONFPARSE_H(?![A-Za-z0-9_])/TOR_CONFPARSE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_EDGE_H(?![A-Za-z0-9_])/TOR_CONNECTION_EDGE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_H(?![A-Za-z0-9_])/TOR_CONNECTION_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_OR_H(?![A-Za-z0-9_])/TOR_CONNECTION_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTROL_H(?![A-Za-z0-9_])/TOR_CONTROL_H/g; s/(?<![A-Za-z0-9_])_TOR_CPUWORKER_H(?![A-Za-z0-9_])/TOR_CPUWORKER_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRECTORY_H(?![A-Za-z0-9_])/TOR_DIRECTORY_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRSERV_H(?![A-Za-z0-9_])/TOR_DIRSERV_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRVOTE_H(?![A-Za-z0-9_])/TOR_DIRVOTE_H/g; s/(?<![A-Za-z0-9_])_TOR_DNS_H(?![A-Za-z0-9_])/TOR_DNS_H/g; s/(?<![A-Za-z0-9_])_TOR_DNSSERV_H(?![A-Za-z0-9_])/TOR_DNSSERV_H/g; s/(?<![A-Za-z0-9_])TOR_EVENTDNS_TOR_H(?![A-Za-z0-9_])/TOR_EVENTDNS_TOR_H/g; s/(?<![A-Za-z0-9_])_TOR_GEOIP_H(?![A-Za-z0-9_])/TOR_GEOIP_H/g; s/(?<![A-Za-z0-9_])_TOR_HIBERNATE_H(?![A-Za-z0-9_])/TOR_HIBERNATE_H/g; s/(?<![A-Za-z0-9_])_TOR_MAIN_H(?![A-Za-z0-9_])/TOR_MAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_MICRODESC_H(?![A-Za-z0-9_])/TOR_MICRODESC_H/g; s/(?<![A-Za-z0-9_])_TOR_NETWORKSTATUS_H(?![A-Za-z0-9_])/TOR_NETWORKSTATUS_H/g; s/(?<![A-Za-z0-9_])_TOR_NODELIST_H(?![A-Za-z0-9_])/TOR_NODELIST_H/g; s/(?<![A-Za-z0-9_])_TOR_NTMAIN_H(?![A-Za-z0-9_])/TOR_NTMAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_ONION_H(?![A-Za-z0-9_])/TOR_ONION_H/g; s/(?<![A-Za-z0-9_])_TOR_OR_H(?![A-Za-z0-9_])/TOR_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_POLICIES_H(?![A-Za-z0-9_])/TOR_POLICIES_H/g; s/(?<![A-Za-z0-9_])_TOR_REASONS_H(?![A-Za-z0-9_])/TOR_REASONS_H/g; s/(?<![A-Za-z0-9_])_TOR_RELAY_H(?![A-Za-z0-9_])/TOR_RELAY_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCLIENT_H(?![A-Za-z0-9_])/TOR_RENDCLIENT_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCOMMON_H(?![A-Za-z0-9_])/TOR_RENDCOMMON_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDMID_H(?![A-Za-z0-9_])/TOR_RENDMID_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDSERVICE_H(?![A-Za-z0-9_])/TOR_RENDSERVICE_H/g; s/(?<![A-Za-z0-9_])_TOR_REPHIST_H(?![A-Za-z0-9_])/TOR_REPHIST_H/g; s/(?<![A-Za-z0-9_])_TOR_REPLAYCACHE_H(?![A-Za-z0-9_])/TOR_REPLAYCACHE_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTER_H(?![A-Za-z0-9_])/TOR_ROUTER_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERLIST_H(?![A-Za-z0-9_])/TOR_ROUTERLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERPARSE_H(?![A-Za-z0-9_])/TOR_ROUTERPARSE_H/g; s/(?<![A-Za-z0-9_])TOR_ROUTERSET_H(?![A-Za-z0-9_])/TOR_ROUTERSET_H/g; s/(?<![A-Za-z0-9_])TOR_STATEFILE_H(?![A-Za-z0-9_])/TOR_STATEFILE_H/g; s/(?<![A-Za-z0-9_])_TOR_STATUS_H(?![A-Za-z0-9_])/TOR_STATUS_H/g; s/(?<![A-Za-z0-9_])TOR_TRANSPORTS_H(?![A-Za-z0-9_])/TOR_TRANSPORTS_H/g; s/(?<![A-Za-z0-9_])_TOR_TEST_H(?![A-Za-z0-9_])/TOR_TEST_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_NATPMP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_NATPMP_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_UPNP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_UPNP_H/g; ==============================
2012-09-14Move functions for seeing if we know enough nodes into nodelistNick Mathewson
2012-09-14Move many of the node_ functions from routerlist to nodelistNick Mathewson