mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
config: Move warn_nonlocal_ext_orports() to relay
Part of 32213.
This commit is contained in:
parent
23faa03ffc
commit
8036954bf5
@ -5632,27 +5632,6 @@ warn_nonlocal_client_ports(const smartlist_t *ports,
|
|||||||
} SMARTLIST_FOREACH_END(port);
|
} SMARTLIST_FOREACH_END(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Warn for every Extended ORPort port in <b>ports</b> that is on a
|
|
||||||
* publicly routable address. */
|
|
||||||
static void
|
|
||||||
warn_nonlocal_ext_orports(const smartlist_t *ports, const char *portname)
|
|
||||||
{
|
|
||||||
SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) {
|
|
||||||
if (port->type != CONN_TYPE_EXT_OR_LISTENER)
|
|
||||||
continue;
|
|
||||||
if (port->is_unix_addr)
|
|
||||||
continue;
|
|
||||||
/* XXX maybe warn even if address is RFC1918? */
|
|
||||||
if (!tor_addr_is_internal(&port->addr, 1)) {
|
|
||||||
log_warn(LD_CONFIG, "You specified a public address '%s' for %sPort. "
|
|
||||||
"This is not advised; this address is supposed to only be "
|
|
||||||
"exposed on localhost so that your pluggable transport "
|
|
||||||
"proxies can connect to it.",
|
|
||||||
fmt_addrport(&port->addr, port->port), portname);
|
|
||||||
}
|
|
||||||
} SMARTLIST_FOREACH_END(port);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Given a list of port_cfg_t in <b>ports</b>, warn if any controller port
|
/** Given a list of port_cfg_t in <b>ports</b>, warn if any controller port
|
||||||
* there is listening on any non-loopback address. If <b>forbid_nonlocal</b>
|
* there is listening on any non-loopback address. If <b>forbid_nonlocal</b>
|
||||||
* is true, then emit a stronger warning and remove the port from the list.
|
* is true, then emit a stronger warning and remove the port from the list.
|
||||||
|
@ -111,6 +111,27 @@ get_effective_bwburst(const or_options_t *options)
|
|||||||
return (uint32_t)bw;
|
return (uint32_t)bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Warn for every Extended ORPort port in <b>ports</b> that is on a
|
||||||
|
* publicly routable address. */
|
||||||
|
void
|
||||||
|
warn_nonlocal_ext_orports(const smartlist_t *ports, const char *portname)
|
||||||
|
{
|
||||||
|
SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) {
|
||||||
|
if (port->type != CONN_TYPE_EXT_OR_LISTENER)
|
||||||
|
continue;
|
||||||
|
if (port->is_unix_addr)
|
||||||
|
continue;
|
||||||
|
/* XXX maybe warn even if address is RFC1918? */
|
||||||
|
if (!tor_addr_is_internal(&port->addr, 1)) {
|
||||||
|
log_warn(LD_CONFIG, "You specified a public address '%s' for %sPort. "
|
||||||
|
"This is not advised; this address is supposed to only be "
|
||||||
|
"exposed on localhost so that your pluggable transport "
|
||||||
|
"proxies can connect to it.",
|
||||||
|
fmt_addrport(&port->addr, port->port), portname);
|
||||||
|
}
|
||||||
|
} SMARTLIST_FOREACH_END(port);
|
||||||
|
}
|
||||||
|
|
||||||
/** Given a list of <b>port_cfg_t</b> in <b>ports</b>, check them for internal
|
/** Given a list of <b>port_cfg_t</b> in <b>ports</b>, check them for internal
|
||||||
* consistency and warn as appropriate. On Unix-based OSes, set
|
* consistency and warn as appropriate. On Unix-based OSes, set
|
||||||
* *<b>n_low_ports_out</b> to the number of sub-1024 ports we will be
|
* *<b>n_low_ports_out</b> to the number of sub-1024 ports we will be
|
||||||
|
@ -24,6 +24,9 @@ void relay_config_free_all(void);
|
|||||||
uint32_t get_effective_bwrate(const or_options_t *options);
|
uint32_t get_effective_bwrate(const or_options_t *options);
|
||||||
uint32_t get_effective_bwburst(const or_options_t *options);
|
uint32_t get_effective_bwburst(const or_options_t *options);
|
||||||
|
|
||||||
|
void warn_nonlocal_ext_orports(const smartlist_t *ports,
|
||||||
|
const char *portname);
|
||||||
|
|
||||||
int parse_ports_relay(or_options_t *options,
|
int parse_ports_relay(or_options_t *options,
|
||||||
char **msg,
|
char **msg,
|
||||||
smartlist_t *ports_out,
|
smartlist_t *ports_out,
|
||||||
|
Loading…
Reference in New Issue
Block a user