aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2022-11-28dns: Make TTLs fuzzy at exit relaysRasmus Dahlberg
This change mitigates DNS-based website oracles by making the time that a domain name is cached uncertain (+- 4 minutes of what's measurable). Resolves TROVE-2021-009. Fixes #40674
2022-11-28Clip DNS TTL values once in event callbackRasmus Dahlberg
This change ensures that other parts of the code base always operate on the same clipped TTL values, notably without being aware of clipping.
2022-10-26dirauth: Remove FaravaharDavid Goulet
Closes #40688 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-03hs: Double quote the metrics label valueDavid Goulet
Fixes #40552 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-19test: Remove HSv2 protover specific testDavid Goulet
HSv2 is not advertised as a supported protocol version anymore. This was introduced with the merge-forward of commit 72041c63064b461e which didn't fix the unit test. Fixes #40549 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-18Merge branch 'maint-0.3.5' into maint-0.4.5David Goulet
2022-01-18relay: Don't advertise HSv2 protocol versionDavid Goulet
We removed HSIntro=3 and HSDir=1 that are v2 specific. Since 0.3.5.17, we do not support introducing or being a directory for onion service v2. Closes #40509 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-05protover: Fix merge forward from 035David Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-29Fix 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-10-21Merge remote-tracking branch 'tor-gitlab/mr/338' into maint-0.4.5Alexander Færøy
2021-10-19test: Don't run HSv2 Chutney test networksDavid Goulet
Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19test: Fix unit tests after disabling version 2David Goulet
Some tests were removed because they were testing something not usable anymore. Some tests remains to make sure that things are indeed disabled. Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19test: Don't run HSv2 Chutney test networksDavid Goulet
Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19test: Fix unit tests after disabling version 2David Goulet
Some tests were removed because they were testing something not usable anymore. Some tests remains to make sure that things are indeed disabled. Part of #40476 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-09-13Only 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-08-16Always teardown capture of logs in CAPTURE().Alexander Færøy
This will hopefully solve an issue where our gmtime related tests are failing on 32-bit builds.
2021-08-16Disable message checking for some 32-bit tests about timegm failure.Nick Mathewson
Since we merged 40383, we don't expect these to give the same warning on every platform.
2021-08-11relay: Reduce streaming compression ratio from HIGH to LOWDavid Goulet
Fixes #40301 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-08-11relay: Reduce streaming compression ratio from HIGH to LOWDavid Goulet
Fixes #40301 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-07-06Merge remote-tracking branch 'tor-gitlab/mr/409' into maint-0.4.5George Kadianakis
2021-07-06Merge branch 'mr/395' into maint-0.4.5George Kadianakis
2021-07-06Use native timegm when available.Nick Mathewson
Continue having a tor_gmtime_impl() unit test so that we can detect any problems in our replacement function; add a new test function to make sure that gmtime<->timegm are a round-trip on now-ish times. This is a fix for bug #40383, wherein we ran into trouble because tor_timegm() does not believe that time_t should include a count of leap seconds, but FreeBSD's gmtime believes that it should. This disagreement meant that for a certain amount of time each day, instead of calculating the most recent midnight, our voting-schedule functions would calculate the second-most-recent midnight, and lead to an assertion failure. I am calling this a bugfix on 0.2.0.3-alpha when we first started calculating our voting schedule in this way.
2021-07-01Suppress a clang 12 warning about "suspicious concatenation".Nick Mathewson
My clang doesn't like it when we write code like this: char *list[] = { "abc", "def", "ghi" "jkl" } It wonders whether we meant to put a comma between "ghi" and "jkl" or not, and gives a warning. To suppress this warning (since in this case, we did mean to omit the comma), we just wrap the two strings in parentheses. Closes #40426; bugfix on 0.4.0.4-rc.
2021-06-25Enable deterministic RNG for address set tests.Alexander Færøy
This patch enables the deterministic RNG for address set tests, including the tests which uses address set indirectly via the nodelist API. This should prevent random test failures in the highly unlikely case of a false positive which was seen in tor#40419. See: tpo/core/tor#40419.
2021-05-25Merge branch 'maint-0.4.4' into maint-0.4.5Alexander Færøy
2021-05-25Merge branch 'maint-0.3.5' into maint-0.4.4Alexander Færøy
2021-05-25Remove the function `tor_tls_assert_renegotiation_unblocked`.Nick Mathewson
It was used nowhere outside its own unit tests, and it was causing compilation issues with recent OpenSSL 3.0.0 alphas. Closes ticket 40399.
2021-04-13Fix test naming, and fix tests on windows.Nick Mathewson
This is a bugfix against my fix for #40133, which has not yet appeared in 0.3.5.
2021-03-17Add a MinTimeToReportBandwidth option; make it 0 for testing networks.Nick Mathewson
This option changes the time for which a bandwidth measurement period must have been in progress before we include it when reporting our observed bandwidth in our descriptors. Without this option, we only consider a time period towards our maximum if it has been running for a full day. Obviously, that's unacceptable for testing networks, where we'd like to get results as soon as possible. For non-testing networks, I've put a (somewhat arbitrary) 2-hour minimum on the option, since there are traffic analysis concerns with immediate reporting here. Closes #40337.
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-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>