Skip to content

Commit

Permalink
Merge branch 'maint-0.4.5' into maint-0.4.6
Browse files Browse the repository at this point in the history
Signed-off-by: David Goulet <[email protected]>
  • Loading branch information
dgoulet-tor committed Nov 3, 2021
2 parents 621f8ac + ea5eebf commit 83f8fe0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changes/ticket40494
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
o Minor bugfixes (relay):
- Reject IPv6-only DirPorts. Our reachability self-test forces DirPorts to
be IPv4, but our configuration parser allowed them to be IPv6-only,
which led to an assertion failure. Fixes bug 40494; bugfix on
0.4.5.1-alpha.
3 changes: 2 additions & 1 deletion doc/man/tor.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,8 @@ details.)
more than once, but only one advertised DirPort is supported: all
but one DirPort must have the **NoAdvertise** flag set. (Default: 0) +
+
The same flags are supported here as are supported by ORPort.
The same flags are supported here as are supported by ORPort. This port can
only be IPv4.
+
As of Tor 0.4.6.1-alpha, non-authoritative relays (see
AuthoritativeDirectory) will not publish the DirPort but will still listen
Expand Down
13 changes: 12 additions & 1 deletion src/feature/relay/relay_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ check_and_prune_server_ports(smartlist_t *ports,
int n_orport_listeners = 0;
int n_dirport_advertised = 0;
int n_dirport_listeners = 0;
int n_dirport_listeners_v4 = 0;
int n_low_port = 0;
int r = 0;

Expand All @@ -362,8 +363,12 @@ check_and_prune_server_ports(smartlist_t *ports,
if (port->type == CONN_TYPE_DIR_LISTENER) {
if (! port->server_cfg.no_advertise)
++n_dirport_advertised;
if (! port->server_cfg.no_listen)
if (! port->server_cfg.no_listen) {
++n_dirport_listeners;
if (port_binds_ipv4(port)) {
++n_dirport_listeners_v4;
}
}
} else if (port->type == CONN_TYPE_OR_LISTENER) {
if (! port->server_cfg.no_advertise) {
++n_orport_advertised;
Expand Down Expand Up @@ -408,6 +413,12 @@ check_and_prune_server_ports(smartlist_t *ports,
"address. Tor needs to listen on an IPv4 address too.");
r = -1;
}
if (n_dirport_advertised && n_dirport_listeners_v4 == 0) {
log_warn(LD_CONFIG, "We are listening on a non-IPv4 DirPort. This is not "
"allowed. Consider either setting an IPv4 address or "
"simply removing it because it is not used anymore.");
r = -1;
}

if (n_low_port && options->AccountingMax &&
(!have_capability_support() || options->KeepBindCapabilities == 0)) {
Expand Down

0 comments on commit 83f8fe0

Please sign in to comment.