aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay
AgeCommit message (Collapse)Author
2020-11-17Merge branch 'ticket40071_045_01_squashed' into masterNick Mathewson
2020-11-17relay: Launch dummy circuit only when descriptor build failsDavid Goulet
First, this commit moves the launch_dummy_circuit_as_needed() function into relay_find_addr.c and renames it to relay_addr_learn_from_dirauth(). This is an attempt to centralize anything relate with address discovery in the right module. Second, when building a descriptor and we fail to discover our address, immediately launch a dummy circuit to an authority in an attempt to learn our descriptor. It is still only done every 20 minutes even though the descriptor build is done every minute. We ought to avoid load on the authority and if we can't learn in the first place our address from them, chances are more things are wrong. Related to #40071 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-17relay: Look at our cache when looking for an IP changeDavid Goulet
Regularly, tor looks if its IP has changed. It does the entire auto discovery process again. However, it is possible that it does not find anything. Instead of thinking the IP changed to an unknown address, look at our cache and see if that value has changed. The reason for this is because if tor gets its address as a suggestion from a directory authority, it is because the auto discovery failed and thus that address should be consider for the IP change check. Related to #40071 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-13port: Don't ignore ports of a different familyDavid Goulet
Commit c3a0f757964de0e8a24911d72abff5df20bb323c added this feature for ORPort that we ignore any port that is not the family of our default address when parsing the port. So if port_parse_config() was called with an IPv4 default address, all IPv6 address would be ignored. That makes sense for ORPort since we call twice port_parse_config() for 0.0.0.0 and [::] but for the rest of the ports, it is not good since a perfectly valid configuration can be: SocksPort 9050 SocksPort [::1]:9050 Any non-ORPort only binds by default to an IPv4 except the ORPort that binds to both IPv4 and IPv6 by default. The fix here is to always parse all ports within port_parse_config() and then, specifically for ORPort, remove the duplicates or superseding ones. The warning is only emitted when a port supersedes another. A unit tests is added to make sure SocksPort of different family always exists together. Fixes #40183 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-12Remove orconn_ext_or_id_map and related functionsNeel Chauhan
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)
2020-11-03Introduce v3_stats_t structure and some of its methods.George Kadianakis
2020-10-27Avoid asserts with flagNeel Chauhan
2020-10-20Merge remote-tracking branch 'tor-gitlab/mr/148' into masterGeorge Kadianakis
2020-10-07Merge branch 'maint-0.4.4' into masterGeorge Kadianakis
2020-10-01fix typosRoger Dingledine
no actual changes
2020-09-22Fix warnings when using two unusual options together.Nick Mathewson
The option `--enable-all-bugs-are-fatal` when used with `--disable-module-relay` caused GCC to warn about functions that it thought should be labeled noreturn. I've tried a couple of approaches, but disabling the warning on these functions seems to be the best approach. Fixed #40129; bugfix on 0.4.4.1-alpha.
2020-09-18Add flag for whether an OR conn "counts" for bootstrap trackingNick Mathewson
We set this flag if we've launched the connection in order to satisfy an origin circuit, or when we decide the connection _would_ satisfy an origin circuit. These are the only or_connections we want to consider for bootstrapping: other or_connections are opened because of client EXTEND requests, and they may succeed or fail because of the clients' confusion or misconfiguration. Closes #25061.
2020-09-17Use the correct SIGNED_KEY_TYPE value for signing->link certsNick Mathewson
Our code was using [01] as for the key type of signed->link certs, which was incorrect. The value should be [03], to indicate that the value as the SHA256 of an x.509 cert. Fortunately, nothing cares about this value, so there shouldn't be compatibility issues. Fixes bug 40124; bugfix on 0.2.7.2-alpha.
2020-09-17Fix wide linesNick Mathewson
2020-09-17Rename tor_cert_create to tor_cert_create_ed25519Nick Mathewson
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ tor_cert_create tor_cert_create_ed25519 It was generated with --no-verify, so it probably breaks some commit hooks. The commiter should be sure to fix them up in a subsequent commit.
2020-08-25Merge branch 'mr/113'George Kadianakis
2020-08-25Validate address more carefully when checking self-reachabilityNick Mathewson
Previously, we would treat *any* incoming circuit on a non-local channel as meaning that our ORPort was reachable. With this patch, we make sure that the address that the peer _says_ we have is the same as the one we're trying to advertise right now. Closes 20165. Bugfix on 4f5192b2803c706 in 0.1.0.1-rc, when reachability self-tests were first introduced.
2020-08-14Revise trac.torproject.org urls to refer to gitlab replacements.Nick Mathewson
Closes #40101.
2020-08-12Merge branch 'maint-0.4.4'George Kadianakis
2020-08-12Merge remote-tracking branch 'tor-gitlab/mr/107' into maint-0.4.4George Kadianakis
2020-08-11Merge branch 'mr/105'George Kadianakis
2020-08-11Only log port self-testing message when we are _starting_ to test.Nick Mathewson
(Unlike approaches in earlier versions of Tor, this one logs if and only if we are launching a test, and we haven't said that we're testing this port.) Fixes bug 40068; bug not in any released version. Closes #40068.
2020-08-05Merge remote-tracking branch 'tor-gitlab/mr/88'George Kadianakis
2020-08-04Merge remote-tracking branch 'tor-gitlab/mr/100'Nick Mathewson
2020-08-04Merge branch 'bug40083_035' into bug40083_042Nick Mathewson
Fixes conflicts due to code movement.
2020-08-03Minor style improvements. #30045Daniel Pinto
2020-08-03Merge branch 'maint-0.4.4'George Kadianakis
2020-08-03Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.4.4George Kadianakis
2020-08-01Add --format argument to --key-expiration option. #30045Daniel Pinto
2020-07-30Handle ORPort auto when logging about removed orports.Nick Mathewson
Closes #40075
2020-07-30Write unittest for #40065.George Kadianakis
Make the unit test pass by including an explicit IPv6 port and an implicit IPv4 port. See comments for more details.
2020-07-30Fix segfault and logic error in remove_duplicate_orports()Nick Mathewson
This function tried to modify an array in place, but did it in a pretty confusing and complicated way. I've revised it to follow a much more straightforward approach. Fixes bug #40065.
2020-07-30Use write_str_if_not_equal() for onion servicesNeel Chauhan
2020-07-30Introduce write_str_if_not_equal()Neel Chauhan
2020-07-24relay: Publish IPv4 descriptor on guessed IPv6 reachability failureDavid Goulet
On an IPv6 reachability failure test, if the address was configured, don't publish the descriptor and log warn. If the address was auto discovered, still publish the descriptor. Closes #33247. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-24relay: Turn find address "method_used" into enumDavid Goulet
Enum allows us to easily compare what is being returned but also better semantic to the code. Related #33247 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-23Merge branch 'remove-padding-fix-7869-v2'Nick Mathewson
2020-07-23Remove padding from ntor-onion-key #7869Daniel Pinto
2020-07-22relay: Support IPv6 when checking if our address changedDavid Goulet
Now support IPv4 _and_ IPv6. This also cleans up nicely the function that was moving IPv4 addresses from uint32_t to tor_addr_t. Fixes #40058 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-22Treat all extorport connections with un-set addresses as remoteNick Mathewson
Without this fix, if an PT forgets to send a USERADDR command, that results in a connection getting treated as local for the purposes of rate-limiting. If the PT _does_ use USERADDR, we still believe it. Closes ticket 33747.
2020-07-21Rename check_server_ports to check_and_prune_server_portsDavid Goulet
This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ check_server_ports check_and_prune_server_ports
2020-07-21relay: Change router_can_extend_over_ipv6() to look at configured portDavid Goulet
In routerconf_find_ipv6_or_ap(), we check if the returned ORPort is internal but not for listening. This means that IPv6 [::] is considered internal. Thus, we can't use it, we have to look directly at the configured address and port and if they are valid, we do consider that we have a valid IPv6 ORPort and that we can thus extend in IPv6. Related #33246 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-21relay: Remove possible ORPorts duplicate from parsed listDavid Goulet
Now that tor automatically binds to IPv4 _and_ IPv6, in order to avoid breaking configurations, we sanitize the parsed lists for duplicate ORPorts. It is possible to happen because we still allow this configuration; ORPort 9888 ORPort [4242::1]:9888 Meaning that the first ORPort value will bind to 0.0.0.0:9888 _and_ [::]:9888 which would lead to an error when attempting to bind on [4242::1]:9888. However, that configuration is accepted today and thus we must not break it. To remedy, we now sanitize the parsed list and prioritize an ORPort that has an explicit address over the global one. A warning is emitted if such configuration pattern is found. This is only for the ORPort. Related to #33246 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-21relay: Automatically Enable an IPv6 ORPortDavid Goulet
This commit makes it that if the ORPort is set with a single port, it will bind to both global listen IPv4 and IPv6 addresses. To pin an "ORPort <PORT>" to be IPv4 or IPv6, the IPv4Only/IPv6Only flags are honored thus this will _only_ bind on IPv6 for that port value: ORPort 9050 IPv6Only Results in: [::]:9050 ORPort 9051 IPv4Only Results in: [0.0.0.0]:9051 Attempting to configure an explicit IPv4 address with IPv6Only flag is an error and vice versa. Closes #33246 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-21Rename router_get_advertised_*() functions.Nick Mathewson
These now (or_port and dir_port) now have "find" names, since they look at the portcfg first, then at the actual ports from the listeners. This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ router_get_advertised_or_port routerconf_find_or_port \ router_get_advertised_ipv6_or_ap routerconf_find_ipv6_or_ap \ router_has_advertised_ipv6_orport routerconf_has_ipv6_orport \ router_get_advertised_dir_port routerconf_find_dir_port
2020-07-21Combine router_get_advertised_or_port{,by_af_}() functionsNick Mathewson
2020-07-21Rename get_primary_dir_port()Nick Mathewson
Also, remove get_primary_or_port() -- nothing used it.
2020-07-21Rename get_first_advertised_{addr,port}_by_type_af().Nick Mathewson
Rationale: these don't actually give the first advertised address/port, but instead give us the first such port that we are _configured_ to advertise. Putting them in a portconf_ namespace therefore makes sense. Similarly, there are no other functions that get the first configured advertised addr/port, so the "by_type_af()" part is needless. This is an automated commit, generated by this command: ./scripts/maint/rename_c_identifier.py \ get_first_advertised_addr_by_type_af portconf_get_first_advertised_addr \ get_first_advertised_port_by_type_af portconf_get_first_advertised_port
2020-07-21Merge remote-tracking branch 'tor-gitlab/mr/70'Nick Mathewson