summaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2021-02-24Merge branch 'tor-gitlab/mr/321' into maint-0.4.5David Goulet
2021-02-23Merge branch 'tor-gitlab/mr/326' into maint-0.4.5David Goulet
2021-02-23Remove mallinfo() from codebaseDavid Goulet
Now deprecated in libc >= 2.33 Closes #40309 Signed-off-by: David Goulet <dgoulet@torproject.org>
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-12Merge branch 'tor-gitlab/mr/304' into maint-0.4.5David Goulet
2021-02-12test: Fix duplicate ORPort testDavid Goulet
The comment of that specific unit test wanted 4 ORPorts but for some reasons we tested for 3 which before the previous commit related to #40289, test would pass but it was in fact wrong. Now the code is correct and 4 was in fact correct expected number of ports. Related to #40289 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-12Merge branch 'tor-gitlab/mr/303' into maint-0.4.5David Goulet
2021-02-12Merge remote-tracking branch 'tor-gitlab/mr/294' into maint-0.4.5George Kadianakis
2021-02-10relay: Allow RFC1918 addresses for non public relaysDavid Goulet
In other words, if PublishServerDescriptor is set to 0 and AssumeReachable to 1, then allow a relay to hold a RFC1918 address. Reasons for this are documented in #40208 Fixes #40208 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08conn: Properly close MetricsPort socket on EOFDavid Goulet
Handle the EOF situation for a metrics connection. Furthermore, if we failed to fetch the data from the inbuf properly, mark the socket as closed because the caller, connection_process_inbuf(), assumes that we did so on error. Fixes #40257 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08Remove DirCache=1 from list of supported versions.Nick Mathewson
Closes #40221
2021-02-05Merge branch 'maint-0.4.4' into maint-0.4.5Alexander Færøy
2021-02-05Fix Windows build.Alexander Færøy
While trying to resolve our CI issues, the Windows build broke with an unused function error: src/test/test_switch_id.c:37:1: error: ‘unprivileged_port_range_start’ defined but not used [-Werror=unused-function] We solve this by moving the `#if !defined(_WIN32)` test above the `unprivileged_port_range_start()` function defintion such that it is included in its body. This is an unreviewed commit. See: tor#40275
2021-02-05Merge branch 'maint-0.4.4' into maint-0.4.5Alexander Færøy
2021-02-05Merge branch 'tor-gitlab/mr/292_squashed' into maint-0.4.4Alexander Færøy
2021-02-05Only check for bindable ports if we are unsure if it will fail.Alexander Færøy
We currently assume that the only way for Tor to listen on ports in the privileged port range (1 to 1023), on Linux, is if we are granted the NET_BIND_SERVICE capability. Today on Linux, it's possible to specify the beginning of the unprivileged port range using a sysctl configuration option. Docker (and thus the CI service Tor uses) recently changed this sysctl value to 0, which causes our tests to fail as they assume that we should NOT be able to bind to a privileged port *without* the NET_BIND_SERVICE capability. In this patch, we read the value of the sysctl value via the /proc/sys/ filesystem iff it's present, otherwise we assume the default unprivileged port range begins at port 1024. See: tor#40275
2021-02-03Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-02-03Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-02-03node: Move reentry set to use a digestmap_tDavid Goulet
Any lookup now will be certain and not probabilistic as the bloomfilter. Closes #40269 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01node: Move reentry set to use a digestmap_tDavid Goulet
Any lookup now will be certain and not probabilistic as the bloomfilter. Closes #40269 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29Merge branch 'tor-gitlab/mr/285' into ticket2667_044_01David Goulet
2021-01-29Merge branch 'tor-gitlab/mr/284' into ticket2667_043_01David Goulet
2021-01-29test: Add test for exits blocking reentry to the networkGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29test: Add test for exits blocking reentry to the networkGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-28Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-01-28Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/50' into maint-0.3.5David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/256' into maint-0.4.4David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/255' into maint-0.4.3David Goulet
2021-01-28Merge branch 'tor-gitlab/mr/254' into maint-0.3.5David Goulet
2021-01-28Merge branch 'maint-0.4.3' into maint-0.4.4David Goulet
2021-01-28Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2021-01-28Merge remote-tracking branch 'tor-gitlab/mr/186' into maint-0.3.5David Goulet
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-21log more during consensus voting processRoger Dingledine
Give more visibility to directory authority operators during the consensus voting process. Closes ticket 40245.
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 remote-tracking branch 'tor-gitlab/mr/163' into maint-0.4.3Nick Mathewson
2021-01-19Merge remote-tracking branch 'tor-gitlab/mr/143' into maint-0.3.5Nick Mathewson
2021-01-12Merge branch 'ticket40237_044_01' into ticket40237_045_01David Goulet
2021-01-12Merge branch 'ticket40237_043_01' into ticket40237_044_01David Goulet
2021-01-12tests: Fix unit tests after merge of #40237David Goulet
2021-01-12Merge branch 'ticket40237_035_01' into ticket40237_043_01David Goulet
2021-01-12hs-v3: Require reasonably live consensusDavid Goulet
Some days before this commit, the network experienced a DDoS on the directory authorities that prevented them to generate a consensus for more than 5 hours straight. That in turn entirely disabled onion service v3, client and service side, due to the subsystem requiring a live consensus to function properly. We know require a reasonably live consensus which means that the HSv3 subsystem will to its job for using the best consensus tor can find. If the entire network is using an old consensus, than this should be alright. If the service happens to use a live consensus while a client is not, it should still work because the client will use the current SRV it sees which might be the previous SRV for the service for which it still publish descriptors for. If the service is using an old one and somehow can't get a new one while clients are on a new one, then reachability issues might arise. However, this is a situation we already have at the moment since the service will simply not work if it doesn't have a live consensus while a client has one. Fixes #40237 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-21test: Fix memleak in test/load_stats_fileDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
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-11-19Merge branch 'maint-0.4.4' into maint-0.4.5Alexander Færøy
2020-11-19Merge branch 'maint-0.4.3' into maint-0.4.4Alexander Færøy
2020-11-19Merge remote-tracking branch 'tor-gitlab/mr/196' into maint-0.4.3Alexander Færøy
2020-11-16Merge branch 'maint-0.4.4' into masterNick Mathewson