Commit Graph

36240 Commits

Author SHA1 Message Date
David Goulet
502f3f5afe relay: Publish IPv4/IPv6 from resolved address cache
When a relay builds a new descriptor, use the new relay_find_addr_to_publish()
interface to find the address to publish per family.

This commit also make the check for address consistency to also work for a
configured IPv6 for which before it was IPv4 only.

Related to #40025

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20 14:54:13 -04:00
David Goulet
9f61a6bdc3 pt: Use new address discovery interface when creating extrainfo
In case the transport has no usable address configured (likely 0.0.0.0 or
[::]), attempt to find the IPv4 and on failure, fallback to the IPv6. If none
are found, a log error is emitted and the transport is skiped.

Related to #40025

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20 14:54:13 -04:00
David Goulet
b239f178a2 addr: New function to find address to publish
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-20 14:54:13 -04:00
David Goulet
c18e52af7c addr: Continue discovery if Address exits but not for wanted family
Commit b14b1f2b1d was a mistake.

In case an Address statement is missing for the wanted family but another one
exists for another family, simply continue the address discovery.

It is not a mistake to be missing an Address statement for a family because
the address could simply be discovered by the next methods. Not all address
family requires a specific Address statement.

However, we do bail if we couldn't find any valid address for the requested
family _and_ a resolve failed meaning we had a hostname but couldn't resolve
it. In that case, we can't know if that hostname would have been for v4 or v6
thus we can't continue the address discovery properly.

Couple unit tests case were removed to match this reality.

Related #40025

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-20 14:51:42 -04:00
Alexander Færøy
b18e274919 Merge branch 'tor-gitlab/mr/66' 2020-07-20 14:22:29 +00:00
Alexander Færøy
8638723d57 Merge branch 'tor-gitlab/mr/65' 2020-07-20 14:19:45 +00:00
Daniel Pinto
29307c0625 Add running glibc version to the log. #40047
Also adds the compiled and running glibc version when using the
--library-versions flag.
2020-07-17 18:45:57 +01:00
Nick Mathewson
0401993197 Add git-resquash.sh to repository
This differs from my old git-resquash.sh in that it uses the newer
`git rebase --keep-base` if available
2020-07-17 12:24:01 -04:00
Nick Mathewson
2225c3c369 Merge branch 'ticket40042_squashed' 2020-07-17 11:44:27 -04:00
Nick Mathewson
11f125ec78 Clean up documentation for connection_t.address 2020-07-17 11:42:49 -04:00
Nick Mathewson
f64cf09eb2 Document some channel_matches_extend_info issues that confused me. 2020-07-17 11:42:49 -04:00
Nick Mathewson
adec471595 Clean up documentation for connection_t.addr a bit more. 2020-07-17 11:42:49 -04:00
Nick Mathewson
7b3bd45cfe or_connection_t: replace real_addr with canonical_orport.
Instead of replacing connection_t.{addr,port} with a canonical
orport, and tracking the truth in real_addr, we now leave
connection_t.addr alone, and put the canonical address in
canonical_orport.

Closes #40042

Closes #33898
2020-07-17 11:42:49 -04:00
Nick Mathewson
44da920670 Add a tor_addr_port_copy() function. 2020-07-17 11:42:49 -04:00
Nick Mathewson
09601c3c4d Use gitlab-friendly URLs when formatting changelogs as HTML
Our old https://bugs.torproject.org/nnnn URLs only work for bugs
numbered before 40000.  Newer gitlab bugs need to have specific
projects mentioned.

This patch assumes that bugs are in tpo/core/tor by default, but
allows us to refer to several other projects by saying
e.g. "chutney#40002" if we want.
2020-07-17 09:31:32 -04:00
Nick Mathewson
ff68aeb492 When choosing an orport from an extendinfo, pick randomly.
(This is not fully general yet: we only pick randomly among
_supported_ addresses, and each extendinfo contains at most one IPv4
address and at most one IPv6 address, no matter what the extend cell
had.)

This change will help dual-stack relays do IPv6 reachability tests,
in theory, by having them sometimes do IPv4 connections and
sometimes do ipv6 connections.

Closes ticket 33220.
2020-07-17 09:15:08 -04:00
Nick Mathewson
5f969681a0 Combine text into existing "what does not need a changes file" section. 2020-07-16 14:54:17 -04:00
Nick Mathewson
85219d887d Merge remote-tracking branch 'tor-gitlab/mr/57' 2020-07-16 14:53:03 -04:00
David Goulet
b83c6ab737 Merge branch 'tor-gitlab/mr/56' 2020-07-16 14:15:25 -04:00
David Goulet
e66eba664a doc: Fix wrong path in include.am
Tracing.md moved to doc/tracing/ so fix the distcheck path in include.am. Also
add the new EventsCircuit.md file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-16 14:07:33 -04:00
David Goulet
ca1003b791 doc: Update our requirements for changes file
Closes tpo/core/team#3.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-16 13:34:52 -04:00
David Goulet
aa9561164a nodelist: Fix possible NULL deref
Found by coverity with CID 1465290. Fix unreleased code.

Fixes #40049

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-16 13:23:03 -04:00
Alexander Færøy
62201b0f71 Merge remote-tracking branch 'tor-gitlab/mr/55' 2020-07-16 17:20:25 +00:00
Nick Mathewson
4b24b36289 Remove unneeded generate_ed_link_cert() in tests.
This fixes CID 1465291, which was a complaint that we never actually
checked the return value of this function.  It turns out that this
function was failing, and it didn't matter, because it wasn't
necessary for this test.
2020-07-16 12:59:51 -04:00
David Goulet
f6fc062119 Merge branch 'tor-gitlab/mr/54' 2020-07-16 12:55:26 -04:00
Nick Mathewson
f0204a3c34 Changes file for CONST_TO_*() functions.
Closes #40046.
2020-07-16 12:55:21 -04:00
Nick Mathewson
7ebfa607b2 Use CONST_TO_* macros in more places.
This is an automated commit made with a python script.

After running the automated script, I had to hand-revert the cases where it
made the conversion functions call themselves.

Additionally, I had to edit a variable declaration in control_bootstrap.c so
that the result of a const cast could be put in a const field.
2020-07-16 12:55:06 -04:00
Alexander Færøy
77b7cbb663 Use Debian for Gitlab CI.
See: tor#40048.
2020-07-16 16:48:03 +00:00
Nick Mathewson
b3eb409157 Define const variants for our channel_tls_t* casts. 2020-07-16 10:21:38 -04:00
Alexander Færøy
39b54bf1dd Merge branch 'tor-gitlab/merge-requests/53' 2020-07-16 14:19:18 +00:00
David Goulet
9c653e58b4 doc: Document circuit subsystem tracing events
Create a doc/tracing/ directory to contain a top level README.md which is the
previously named Tracing.md and add the EventsCircuit.md which describes the
circuit subsystem tracing events in depth.

Closes #40036

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-16 14:19:04 +00:00
Nick Mathewson
47a48e2f5a Define new CONST_TO_*_CONN() functions for const-to-const casts
These names are analogous to the CONST_TO_*_CIRC() functions we have
for circuits.

Part of #40046.
2020-07-16 10:08:15 -04:00
Nick Mathewson
b0d7b10088 Improve documentation for our TO_*_CONN() cast functions.
Preliminary work for #40046.
2020-07-16 09:57:52 -04:00
Nick Mathewson
10d8555e7d Add unit tests for connection_describe(). 2020-07-16 09:02:10 -04:00
Nick Mathewson
9b5567df4e Improvements to output format for OR connection descriptions.
Only log the 'real_addr' when it is set to something.

Only log the ID when it is set.

When scrubbing the address, don't include a canonical address.
(There should never be a canonical address for a connection with no
ID set.)
2020-07-16 09:02:10 -04:00
Nick Mathewson
ae8072e8ff Changes file for 40041.
Closes #40041.
2020-07-16 09:02:10 -04:00
Nick Mathewson
ab428ef60b Collapse channel_get_*_remote_addr() into a single function.
Since we can list the real address and the canonical one in a
human-readable format we don't need to pick.
2020-07-16 09:02:10 -04:00
Nick Mathewson
4f4785a8c1 Refactor channel description internals.
Now that we've clarified that these functions only need to describe
the peer in a human-readable way, we can have them delegate to
connection_describe_peer().
2020-07-16 09:02:10 -04:00
Nick Mathewson
f9aafcd64e channelpadding: don't call method pointer directly. 2020-07-16 09:02:10 -04:00
Nick Mathewson
db21e91f4b Remove "ADDR_ONLY" mode from channel_get_*_remote_descr.
This mode was only used in one place, and it caused a dangerous
mingling of functionality.  The method is supposed to _describe_ the
peer's address, not give its actual address.  We already had a
function to get the actual address.
2020-07-16 09:02:10 -04:00
Nick Mathewson
0ccdf05dc5 Minor refactoring on channel_get_remote_addr_if_possible()
* We no longer call this an optional method
* We document that it returns the real address, not a canonical one.
* We have it try harder if the real address hasn't been set yet.
2020-07-16 09:02:10 -04:00
Nick Mathewson
382387882c Update test_rebind.py to expect new format. 2020-07-16 09:02:10 -04:00
Nick Mathewson
9d2867c396 Use connection_describe() for log messages. 2020-07-16 09:02:10 -04:00
Nick Mathewson
aa33b88778 connection_describe_peer(): add nonzero ports to nonscrubbed addrs. 2020-07-16 09:02:10 -04:00
Daniel Pinto
ac2c4b1e4a Changes file for #25140 2020-07-15 22:01:08 +01:00
Daniel Pinto
3c70f26dc0 Fix small memory leak in config include tests
Tests that used options_init_from_string were not freeing calling
config_free_all().
2020-07-15 22:01:08 +01:00
Daniel Pinto
49dab42782 Add test for torrc %include functionality and seccomp sandbox
Tests %include with files and folders, modifying and reloading
the config file with sandbox enabled and reponse of SAVECONF and
getinfo config-can-saveconf control commmands.
2020-07-15 22:01:08 +01:00
Daniel Pinto
34fa2c4d0d Add support for patterns on %include #25140
Also adds generic tor_glob function to expand globs.
2020-07-15 22:01:08 +01:00
Nick Mathewson
8fbafd1402 Apply SafeLogging in connection_describe_peer(). 2020-07-15 15:52:02 -04:00
Nick Mathewson
ba7816db5f New functions to describe connections and peers.
These will let us refactor away a lot of code that currently uses
"addr" and "address" for logging purposes.
2020-07-15 15:51:53 -04:00