aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/relay_find_addr.h
AgeCommit message (Collapse)Author
2021-03-12Run "make autostyle" in advance of new series.Nick Mathewson
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-02-23relay: Avoid a directory early fetchDavid Goulet
The directory_fetches_from_authorities() is used to know if a client or relay should fetch data from an authority early in the boot process. We had a condition in that function that made a relay trigger that fetch if it didn't know its address (so we can learn it). However, when this is called, the address discovery has not been done yet so it would always return true for a relay. Furthermore, it would always trigger a log notice that the IPv4 couldn't be found which was inevitable because the address discovery process has not been done yet (done when building our first descriptor). It is also important to point out that starting in 0.4.5.1-alpha, asking an authority for an address is done during address discovery time using a one-hop circuit thus independent from the relay deciding to fetch or not documents from an authority. Small fix also is to reverse the "IPv(4|6)Only" flag in the notice so that if we can't find IPv6 it would output to use IPv4Only. Fixes #40300 Signed-off-by: David Goulet <dgoulet@torproject.org>
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-07-20relay: Use flags in relay_find_addr_to_publish()David Goulet
Instead of a boolean saying "cache_only" add the concept of flags so we add semantic through out the code and allow ourselves to have more options in the future. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20relay: Handle dir address suggestion with new interfaceDavid Goulet
We now use relay_address_new_suggestion() when a suggested address is received from a directory. Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20relay: Remove router_pick_published_address()David Goulet
Unused at this commit. Closes #40025 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20test: Move unit tests to new find address interfaceDavid Goulet
Remove use of router_pick_published_address() and use relay_find_addr_to_publish instead. Related to #40025 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20relay: Deciding to fetch from authority, use new find address APIDavid Goulet
Use the new relay_has_address_set() interface when deciding if we need to fetch directory information from an authority as a relay. If no IPv4 address is found, we'll proceed with a fetch so we can learn our address in the HTTP header or NETINFO cell that a trusted authority will send us back. Related to #40025 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20addr: New function to find address to publishDavid Goulet
In order for a relay to find which address to publish in its descriptor, router_pick_published_address() is used. However, that function only supports AF_INET and uses the directory server suggested address discovery mechanism. This new function uses a new interface so that the caller can request an address family and get the tor_addr_t object. Furthermore, it drops the use of directory servers address discovery (tor#33244) and instead uses the new suggested cache that is populated at the moment from data in the NETINFO cell coming from the directory authorities. At this commit, function is unused. Related to #40025 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-08addr: Validate identity key when getting a suggestionDavid Goulet
We do look at the address but with this we also look if the identity digest of the relay suggesting us an address is a trusted source. Related to #40022 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-07addr: New function relay_address_new_suggestion()David Goulet
This behaves like router_new_address_suggestion() but differs in couple of ways: 1. It takes a tor_addr_t instead of an address string and supports both AF_INET and AF_INET6. 2. It does _not_ use the last_guessed_ip local cache and instead only relies on the last resolved address cache in resolve_addr.c It is not used at this commit. This function is made to process a suggested address found in a NETINFO cell exactly like router_new_address_suggestion() does with the address a directory suggests us. Related to #40022 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-05-05relay: Rename relay_resolve_addr.{c|h} fileDavid Goulet
New name is more accurate semantically. Closes #33789 Signed-off-by: David Goulet <dgoulet@torproject.org>