aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay
AgeCommit message (Collapse)Author
2021-04-13relay: Move "overload-general" from extra-info to server descriptor.Alexander Færøy
Fixes #40364 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-17Merge branch 'mr/334'George Kadianakis
2021-03-17Implement straightforward overload general metrics.George Kadianakis
- OOM metric - onionskin overload metric - DNS timeout metric
2021-03-17Implement backbone of overload statistics.George Kadianakis
- Implement overload statistics structure. - Implement function that keeps track of overload statistics. - Implement function that writes overload statistics to descriptor. - Unittest for the whole logic.
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-24Merge branch 'maint-0.4.5'David Goulet
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>
2021-02-23Merge branch 'ticket40282_046_01_squashed'Nick Mathewson
2021-02-22Merge branch 'maint-0.4.5'Nick Mathewson
2021-02-22Merge remote-tracking branch 'tor-gitlab/mr/316' into maint-0.4.5Nick Mathewson
2021-02-22Merge branch 'maint-0.4.5'Alexander Færøy
2021-02-22relay: Move log notice after suggested address lookupDavid Goulet
When trying to find our address to publish, we would log notice if we couldn't find it from the cache but then we would look at the suggested cache (which contains the address from the authorities) in which we might actually have the address. Thus that log notice was misplaced. Move it down after the suggested address cache lookup. Closes #40300 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22relay: Only authorities publish a DirPortDavid Goulet
Relay will always publish 0 as DirPort value in their descriptor from now on except authorities. Related to #40282 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22relay: Remove dirport reachability self testDavid Goulet
Regular relays are about to get their DirPort removed so that reachability test is not useful anymore Authorities will still use the DirPort but because network reentry towards their DirPort is now denied network wide, this test is not useful anymore and so it should simply be considered reachable at all time. Part of #40282 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19hs-v2: Removal of service and relay supportDavid Goulet
This is unfortunately massive but both functionalities were extremely intertwined and it would have required us to actually change the HSv2 code in order to be able to split this into multiple commits. After this commit, there are still artefacts of v2 in the code but there is no more support for service, intro point and HSDir. The v2 support for rendezvous circuit is still available since that code is the same for the v3 and we will leave it in so if a client is able to rendezvous on v2 then it can still transfer traffic. Once the entire network has moved away from v2, we can remove v2 rendezvous point support. Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-17relay: No longer test dirport reachability for authoritiesRoger Dingledine
Now that exit relays don't allow exit connections to directory authority DirPorts, the follow-up step is to make directory authorities stop doing DirPort reachability checks. Fixes #40287 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-12Merge branch 'maint-0.4.5'David Goulet
2021-02-12Merge branch 'tor-gitlab/mr/304' into maint-0.4.5David Goulet
2021-02-12config: Do not compare for duplicate ORPorts with different addressesDavid Goulet
We were just looking at the family which is not correct because it is possible to have two explicit ORPort for the same family but different addresses. One example is: ORPort 127.0.0.1:9001 NoAdvertise ORPort 1.2.3.4:9001 NoListen Thus, this patch now ignores ports that have different addresses iff they are both explicits. That is, if we have this example, also two different addresses: ORPort 9001 ORPort 127.0.0.1:9001 NoAdvertise The first one is implicit and second one is explicit and thus we have to consider them for removal which in this case would remove the "ORPort 9001" in favor of the second port. Fixes #40289 Signe-off-by: David Goulet <dgoulet@torproject.org>
2021-02-12Merge branch 'maint-0.4.5'David Goulet
2021-02-12Merge branch 'tor-gitlab/mr/302' into maint-0.4.5David Goulet
2021-02-12Merge branch 'maint-0.4.5'Alexander Færøy
2021-02-12Merge remote-tracking branch 'tor-gitlab/mr/293' into maint-0.4.5Alexander Færøy
2021-02-10relay: Don't look at omit flag when building descriptorDavid Goulet
That comes from 685c4866acf8489c58aca41ec01aa5a53e39220a which added that check correctly except for when we build a descriptor. We already omit the IPv6 address, if we need to, when we encode the descriptor but we need to keep the actual discovered address in the descriptor so we can notice future IP changes and be able to assess that we are not publishable as long as we don't specifically set the omit flag. This lead to also having tor noticing that our IP changed from <nothing> (no IPv6 in the descriptor) to a discovered one which would trigger every minute. Fixes #40279, #40288 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08Merge branch 'maint-0.4.5'Nick Mathewson
2021-02-08relay: Look at the omit IPv6 flag when publishingDavid Goulet
In two instances we must look at this flag: 1. When we build the descriptor so the IPv6 is NOT added to the descriptor in case we judge that we need to omit the address but still publish. 2. When we are deciding if the descriptor is publishable. This flags tells us that the IPv6 was not found reachable but we should still publish. Fixes #40279 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08relay: Fix Coverity warning for unchecked returned valueDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-27Merge branch 'maint-0.4.5'Nick Mathewson
2021-01-27relay: Log if we can't find an address for configured ORPortDavid Goulet
Everytime we try to discover an address we want to publish, emit a log notice if we are unable to find it even though an ORPort was configured for it. Because the function can be called quite often, we rate limit that notice to every hour so it gets annoying just enough so the operator fixes that. Related to #40254 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-27relay: Don't trigger an address discovery without an ORPortDavid Goulet
We would before do an address discovery and then a lookup in the cache if not found which is now simplified by calling relay_find_addr_to_publish() directly which does all those combined. Furthermore, by doing so, we won't trigger an address discovery every minute if we have no ORPort configured for the family. Fixes #40254 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-27relay: Simplify IPv6 discovery when building descriptorDavid Goulet
Now that relay_find_addr_to_publish() checks if we actually have an ORPort, we can simplify the descriptor building phase for IPv6. This also avoid triggering an IPv6 discovery if the IPv4 can't be found in the first place. Related to #40254 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-27relay: Skip address discovery if no ORPort is foundDavid Goulet
In other words, if we don't have an ORPort configured for a specific family (IPv4/v6), we don't bother doing address discovery. Related to #40254 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-19Merge branch 'maint-0.4.5'Nick Mathewson
2021-01-19relay: Keep all ORPorts that are on different portsDavid Goulet
We used to actually discard ORPorts that were the same port and same family but they could have different address. Instead, we need to keep all different ORPorts so we can bind a listener on each of them. We will publish only one of these in our descriptor though. Related to #40246 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-19Merge branch 'maint-0.4.5'Nick Mathewson
2021-01-14relay: Don't BUG() if we can't find authority descriptorDavid Goulet
We can end up trying to find our address from an authority while we don't have yet its descriptor. In this case, don't BUG() and just come back later. Closes #40231 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-14relay: Don't flag that we published if descriptor build failsDavid Goulet
In case building the descriptor would fail, we could still flag that we did in fact publish the descriptors leading to no more attempt at publishing it which in turn makes the relay silent for some hours and not try to rebuild the descriptor later. This has been spotted with #40231 because the operator used a localhost address for the ORPort and "AssumeReachable 1" leading to this code path where the descriptor failed to build but all conditions to "can I publish" were met. Related to #40231 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-10fix typos and whitespaceRoger Dingledine
2020-12-21Merge branch 'mr_240_squashed'Nick Mathewson
2020-12-21Fix timestamp parser in new load_stats_file.Karsten Loesing
The previous parser only considered stats files _starting_ with the timestamp tag, not stats files having the timestamp tag in a later position. While this applies to all current stats files, a future stats file might look differently. Better to fix the function now than be surprised in another 9 years from now. This commit also adds a test case for such future stats, and it fixes stats file paths in newly added unit tests.
2020-12-21relay: Report the entire content of a stats fileDavid Goulet
It turns out that 9 years ago, we stopped appending data into stats file and rather overwrite everytime we have new stats (see commit a6a127c833eace1100aca7ab8ad118862bb8a8b9) The load_stats_file() function was still thinking that we could have the same line many times in the file which turns out to be false since 9 years ago. However, that did not cause problem until IPv6 connection stats came along which introduced a new line in conn-stats: "ipv6-conn-bi-direct ...". Before, that file contained a single line starting with the tag "conn-bi-direct". That very tag appears also in the IPv6 tag (see above) so the load_stats_file() function would consider that the IPv6 line as the last tag to be appeneded to the file and fail to report the line above (for IPv4). It would actually truncate the IPv6 line and report it (removing the "ipv6-" part). In other words, "conn-bi-direct" was not reported and instead "ipv6-conn-bi-direct" was used without the "ipv6-" part. This commit refactors the entire function so that now it looks for a "timestamp tag" to validate and then if everything is fine, returns the entire content of the file. The refactor simplifies the function, adds logging in case of failures and modernize it in terms of coding standard. Unit tests are also added that makes sure the loaded content matches the entire file if timestamp validation passes. Fixes #40226 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-18Merge remote-tracking branch 'tor-gitlab/mr/207'Alexander Færøy
2020-12-09Merge branch 'mr_224_squashed'Nick Mathewson
2020-12-09Announce URL to bridge status page when starting Tor as a bridge relay.Alexander Færøy
This patch makes Tor announce the relay specific bridge status page URL when Tor is starting up before bootstrap occours. See: tor#30477
2020-12-08Merge branch 'maint-0.4.5'David Goulet
2020-12-08relay: Avoid log reachability test for bandwidth test circuitDavid Goulet
Fixes #40205 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-17Merge branch 'maint-0.4.5' into masterNick Mathewson
2020-11-17Merge branch 'tor-gitlab/mr/182' into masterDavid Goulet
2020-11-17config: Really ignore non ORPorts when removing duplicatesDavid Goulet
The function in charge of removing duplicate ORPorts from our configured ports was skipping all non ORPorts port but only for the outer loop thus resulting in comparing an ORPort with a non-ORPort which lead to problems. For example, tor configured with the following would fail: ORPort auto DirPort auto Both end up being the same configuration except that one is a OR listener and one is a Dir listener. Thus because of the missing check in the inner loop, they looked exactly the same and thus one is removed. Fixes #40195 Signed-off-by: David Goulet <dgoulet@torproject.org>