Commit Graph

35636 Commits

Author SHA1 Message Date
Alex Xu (Hello71)
42dfcd0ae3 core/or: Lift slow call out of loop, #33977 2020-05-05 15:07:42 -04:00
David Goulet
2e519fbfb0 changes: File for #33789
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-05-05 14:24:04 -04:00
David Goulet
a25f167072 config: New file resolve_addr.{c|h}
Move a series of function from config.c into that new file which is related to
address resolving.

Part of #33789

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-05-05 14:24:04 -04:00
David Goulet
445df9e7b5 relay: New file relay_resolve_addr.{c|h}
This commit moves router_pick_published_address() and the related helper
functions into the new file.

The log_addr_has_changed() function has been made public in router.h so we can
use it in relay_resolve_addr.c.

This is a refactoring as part of Sponsor 55. Only code movement at this
commit.

Part of #33789

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-05-05 14:24:04 -04:00
Nick Mathewson
f96b6ccee1 Merge branch 'maint-0.4.3' 2020-05-04 10:25:53 -04:00
Nick Mathewson
bbfc498e21 Merge branch 'maint-0.4.1' into maint-0.4.2 2020-05-04 10:25:52 -04:00
Nick Mathewson
e61867416e Merge branch 'maint-0.4.2' into maint-0.4.3 2020-05-04 10:25:52 -04:00
Nick Mathewson
711385c47f Merge branch 'bug34077_043' into maint-0.4.3 2020-05-04 10:25:45 -04:00
Nick Mathewson
a02e866642 Merge branch 'bug34077_041' into maint-0.4.1 2020-05-04 10:14:38 -04:00
Nick Mathewson
b1c383e3e6 Fix a GCC 10.0.1 compilation error.
Do not try to stuff "HS_DESC_DECODE_GENERIC_ERROR" (-1) into a
socks5_reply_status_t (enum).  It doesn't actually make sense, and
isn't one of our documented extensions.

(This can only happen on a nonfatal assertion that we haven't seen,
so it probably isn't happening in practice.)

Fixes another case of bug 34077; bugfix on 0.4.3.1-alpha.
2020-04-30 23:04:56 -04:00
Nick Mathewson
6aaee6133d Merge branch 'bug34077_042' into bug34077_043 2020-04-30 23:01:58 -04:00
Nick Mathewson
b4b1882da0 Merge branch 'bug34077_041' into bug34077_042 2020-04-30 22:59:08 -04:00
Nick Mathewson
d7e166bd95 Fix a GCC 10.0.1 compilation warning.
Fixes 34077 for 0.4.1; bugfix on 0.4.0.3-alpha. (Specifically, GCC
first gives this warning for 9eeff921ae)
2020-04-30 22:56:31 -04:00
teor
4a36dfebee circuitbuild: Allow relays to send IPv6 extend cells
Allow relays and bridges to send IPv4 or IPv6 extend cells.
But keep restricting clients to IPv4 extend cells, because sending IPv6
extend cells would be an obvious version distinguisher.

Part of 33222.
2020-04-30 23:27:48 +10:00
teor
4969dee102 relay: Update some self-test comments for IPv6
Part of 33222.
2020-04-30 23:27:38 +10:00
teor
aade9f31e7 relay: Log IPv4 and IPv6 ORPorts when testing reachability
When a relay starts testing reachability, log its IPv6 ORPort.
The existing code logs the IPv4 ORPort and DirPort.

The IPv4 ORPort is required. The other ports are only logged if they
are present.

Part of 33222.
2020-04-30 23:27:27 +10:00
teor
2a0e48385d relay: Launch IPv4 and IPv6 ORPort self-test circuits
When launching relay ORPort reachability self-tests, launch tests to the
IPv4 and IPv6 ORPorts (if available).

Part of 33222.
2020-04-30 23:27:13 +10:00
teor
01d940e71b relay: Refactor dirport self-test circuit launch
Remove some redundant variables, and improve some comments.

Explain that there are no advertised IPv6 DirPorts.

Part of 33222.
2020-04-30 23:26:58 +10:00
teor
a250dd6042 relay: Refactor reachability circuit launches
Split OR and Dir reachability circuits into their own functions.

Part of 33222.
2020-04-30 23:26:45 +10:00
teor
900994e46a relay: Remove unused DirPort self-test code
DIRIND_ANON_DIRPORT never uses our ORPort, so we don't need to set it in
the directory request.

Part of 33222.
2020-04-30 23:26:35 +10:00
teor
18174fb82f relay: Add an address family to self-test launches
Add an address family argument to the functions that launch relay ORPort
self-test circuits.

Part of 33222.
2020-04-30 23:26:31 +10:00
teor
6dc9930d3a
Merge branch 'pr1870_squashed' 2020-04-30 22:22:09 +10:00
Neel Chauhan
7bf257b129
Define and use TOR_ADDRPORT_BUF_LEN 2020-04-30 22:21:48 +10:00
teor
42e765efad relay: Minor selftest comment updates
Part of 33222.
2020-04-30 15:58:59 +10:00
teor
d1c52e585b relay: Wrap long lines
Part of 33222.
2020-04-30 15:58:59 +10:00
teor
c5ee3d7eb8 relay: Clarify reachability status check functions
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        check_whether_orport_reachable router_skip_orport_reachability_check \
        check_whether_dirport_reachable router_skip_dirport_reachability_check

It was generated with --no-verify, so it probably breaks some commit hooks.
The commiter should be sure to fix them up in a subsequent commit.

Part of 33222.
2020-04-30 15:58:37 +10:00
teor
a202f03c64 practracker: Accept some wrapped long lines
Part of 33222.
2020-04-30 15:15:53 +10:00
teor
c32a8243cb nodelist: Wrap long lines, and improve comments
Part of 33222.
2020-04-30 15:12:35 +10:00
teor
caab67d0c2 nodelist: Distinguish client and relay reachability
Change some function names to distinguish between:
* client first hop reachability (ReachableAddresses)
* relay port reachability self-tests

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        router_skip_or_reachability router_connect_assume_or_reachable \
        router_skip_dir_reachability router_connect_assume_dir_reachable

It was generated with --no-verify, so it probably breaks some commit hooks.
The commiter should be sure to fix them up in a subsequent commit.

Part of 33222.
2020-04-30 15:12:27 +10:00
teor
efcae919ae
practracker: Accept the connection buf refactor
Accept a few extra lines from the connection_buf_read_from_socket()
refactor.

Cleanup after 33131.
2020-04-30 13:55:26 +10:00
teor
3eca667ae4
relay: Fix a comment typo in the selftest.c header 2020-04-30 13:54:40 +10:00
Nick Mathewson
49800cf539 Merge remote-tracking branch 'tor-github/pr/1864/head' 2020-04-29 19:16:40 -04:00
teor
ed4420b4b8 practracker: Allow an extra line in tor_addr_parse_mask_ports()
We added a cast, and wrapped a line.
2020-04-30 06:54:42 +10:00
teor
15a4180a7e relay: Refactor can extend over IPv6 checks
Split "can extend over IPv6" and "has advertised IPv6 ORPort" into
separate functions. They currently have the same result, but this may
change in 33818 with ExtendAllowIPv6Addresses.

Part of 33817.
2020-04-30 06:54:42 +10:00
teor
066d2deb3d channel: Refactor matches target address function
Refactor channel_matches_target_addr_for_extend() to return a boolean
result.

Part of 33817.
2020-04-30 06:54:42 +10:00
teor
496ddd2877 relay: Refactor extend address validity function
Rename the function, and give it a boolean return value.

No behaviour change.

Part of 33817.
2020-04-30 06:54:42 +10:00
teor
cd7e2fc210 net: Make all address bytes functions take uint8_t *
Part of 33817.
2020-04-30 06:54:42 +10:00
teor
f62b051e87 Rename tor_addr_get_ipv6_bytes to tor_addr_copy_ipv6_bytes
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        tor_addr_get_ipv6_bytes tor_addr_copy_ipv6_bytes
2020-04-30 05:54:39 +10:00
teor
528a1fe985 changes: file for 33817 2020-04-29 22:43:09 +10:00
teor
bcec1ec071 relay: Refactor choosing extend IPs
Flatten the logic in circuit_choose_ip_ap_for_extend().

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
df5ea29775 relay: Add tests for choosing extend IPs
Part of 33817.
2020-04-29 22:43:09 +10:00
teor
9a6186c267 relay: Refactor circuit_open_connection_for_extend()
Refactor circuit_open_connection_for_extend(), splitting out the IP
address choice code into a new function.

Adds unit tests. No behaviour changes in tor.

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
cab05a84cd relay: Add IP version tests for circuit extends
Add IPv4-only and IPv6-only tests for
circuit_open_connection_for_extend().

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
c3e058dfac relay: Choose between IPv4 and IPv6 extends at random
When an EXTEND2 cell has an IPv4 and an IPv6 address, choose one of them
uniformly at random.

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
a0b12f3cd4 relay/circuitbuild: Refactor open connection for extend
Re-use the newly created extend_info to launch the connection in
circuit_open_connection_for_extend().

No behaviour change.

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
063505446f test/circuitbuild: Disable some tests when ALL_BUGS_ARE_FATAL
Some tests use IF_BUG_ONCE(), which is fatal when ALL_BUGS_ARE_FATAL,
after the fixes in 33917.

Also run "make autostyle" on these changes.

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
6c458d2d6e log/util_bug: Make IF_BUG_ONCE() support ALL_BUGS_ARE_FATAL
... and DISABLE_ASSERTS_IN_UNIT_TESTS.

Make all of tor's assertion macros support the ALL_BUGS_ARE_FATAL and
DISABLE_ASSERTS_IN_UNIT_TESTS debugging modes.

Implements these modes for IF_BUG_ONCE(). (It used to log a non-fatal
warning, regardless of the debugging mode.)

Fixes bug 33917; bugfix on 0.2.9.1-alpha.
2020-04-29 22:43:09 +10:00
teor
16f3f6a1af relay/circuitbuild: Re-use IPv6 connections for circuits
Search for existing connections using the remote IPv4 and IPv6
addresses.

Part of 33817.
2020-04-29 22:43:09 +10:00
teor
ec5f4f3c5a relay/circuitbuild: Report IPv6 addresses in a debug log
Part of 33817.
2020-04-29 22:43:09 +10:00
teor
f8f688b309 channel: Make channel_matches_target_addr_for_extend() static
It isn't used outside channel.c.

Part of 33817.
2020-04-29 22:43:09 +10:00