config: Remove {Control,DNS,Dir,Socks,Trans,NATD,OR}ListenAddress option

Deprecated in 0.2.9.2-alpha, this commits changes it as OBSOLETE() and cleans
up the code associated with it.

Partially fixes #22060

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2017-04-25 14:28:38 -04:00 committed by Nick Mathewson
parent 039e2a24da
commit 7f95ef6e66
8 changed files with 132 additions and 463 deletions

View File

@ -19,3 +19,6 @@
rendered obsolete. Code has been removed and feature no longer exists.
- TLSECGroup was deprecated in 0.2.9.2-alpha and now has been rendered
obsolete. Code has been removed and feature no longer exists.
- {Control,DNS,Dir,Socks,Trans,NATD,OR}ListenAddress was deprecated in
0.2.9.2-alpha and now has been rendered obsolete. Code has been removed
and feature no longer exists.

View File

@ -341,14 +341,6 @@ GENERAL OPTIONS
Unix domain sockets only: Do not insist that the directory
that holds the socket be read-restricted.
[[ControlListenAddress]] **ControlListenAddress** __IP__[:__PORT__]::
Bind the controller listener to this address. If you specify a port, bind
to this port rather than the one specified in ControlPort. We strongly
recommend that you leave this alone unless you know what you're doing,
since giving attackers access to your control listener is really
dangerous. This directive can be specified multiple
times to bind to multiple addresses/ports. (Default: 127.0.0.1)
[[ControlSocket]] **ControlSocket** __Path__::
Like ControlPort, but listens on a Unix domain socket, rather than a TCP
socket. '0' disables ControlSocket (Unix and Unix-like systems only.)
@ -1163,16 +1155,6 @@ The following options are useful only for clients (that is, if
line is used, and all earlier flags are ignored. No error is issued for
conflicting flags.
[[SocksListenAddress]] **SocksListenAddress** __IP__[:__PORT__]::
Bind to this address to listen for connections from Socks-speaking
applications. (Default: 127.0.0.1) You can also specify a port (e.g.
192.168.0.1:9100). This directive can be specified multiple times to bind
to multiple addresses/ports. (DEPRECATED: As of 0.2.3.x-alpha, you can
now use multiple SocksPort entries, and provide addresses for SocksPort
entries, so SocksListenAddress no longer has a purpose. For backward
compatibility, SocksListenAddress is only allowed when SocksPort is just
a port number.)
[[SocksPolicy]] **SocksPolicy** __policy__,__policy__,__...__::
Set an entrance policy for this server, to limit who can connect to the
SocksPort and DNSPort ports. The policies have the same form as exit
@ -1312,17 +1294,7 @@ The following options are useful only for clients (that is, if
TransPort requires OS support for transparent proxies, such as BSDs' pf or
Linux's IPTables. If you're planning to use Tor as a transparent proxy for
a network, you'll want to examine and change VirtualAddrNetwork from the
default setting. You'll also want to set the TransListenAddress option for
the network you'd like to proxy. (Default: 0)
[[TransListenAddress]] **TransListenAddress** __IP__[:__PORT__]::
Bind to this address to listen for transparent proxy connections. (Default:
127.0.0.1). This is useful for exporting a transparent proxy server to an
entire network. (DEPRECATED: As of 0.2.3.x-alpha, you can
now use multiple TransPort entries, and provide addresses for TransPort
entries, so TransListenAddress no longer has a purpose. For backward
compatibility, TransListenAddress is only allowed when TransPort is just
a port number.)
default setting. (Default: 0)
[[TransProxyType]] **TransProxyType** **default**|**TPROXY**|**ipfw**|**pf-divert**::
TransProxyType may only be enabled when there is transparent proxy listener
@ -1330,9 +1302,7 @@ The following options are useful only for clients (that is, if
+
Set this to "TPROXY" if you wish to be able to use the TPROXY Linux module
to transparently proxy connections that are configured using the TransPort
option. This setting lets the listener on the TransPort accept connections
for all addresses, even when the TransListenAddress is configured for an
internal address. Detailed information on how to configure the TPROXY
option. Detailed information on how to configure the TPROXY
feature can be found in the Linux kernel source tree in the file
Documentation/networking/tproxy.txt. +
+
@ -1360,13 +1330,6 @@ The following options are useful only for clients (that is, if
+
This option is only for people who cannot use TransPort. (Default: 0)
[[NATDListenAddress]] **NATDListenAddress** __IP__[:__PORT__]::
Bind to this address to listen for NATD connections. (DEPRECATED: As of
0.2.3.x-alpha, you can now use multiple NATDPort entries, and provide
addresses for NATDPort entries, so NATDListenAddress no longer has a
purpose. For backward compatibility, NATDListenAddress is only allowed
when NATDPort is just a port number.)
[[AutomapHostsOnResolve]] **AutomapHostsOnResolve** **0**|**1**::
When this option is enabled, and we get a request to resolve an address
that ends with one of the suffixes in **AutomapHostsSuffixes**, we map an
@ -1387,13 +1350,6 @@ The following options are useful only for clients (that is, if
addresses/ports. See SocksPort for an explanation of isolation
flags. (Default: 0)
[[DNSListenAddress]] **DNSListenAddress** __IP__[:__PORT__]::
Bind to this address to listen for DNS connections. (DEPRECATED: As of
0.2.3.x-alpha, you can now use multiple DNSPort entries, and provide
addresses for DNSPort entries, so DNSListenAddress no longer has a
purpose. For backward compatibility, DNSListenAddress is only allowed
when DNSPort is just a port number.)
[[ClientDNSRejectInternalAddresses]] **ClientDNSRejectInternalAddresses** **0**|**1**::
If true, Tor does not believe any anonymously retrieved DNS answer that
tells it that an address resolves to an internal address (like 127.0.0.1 or
@ -1798,15 +1754,6 @@ is non-zero):
For obvious reasons, NoAdvertise and NoListen are mutually exclusive, and
IPv4Only and IPv6Only are mutually exclusive.
[[ORListenAddress]] **ORListenAddress** __IP__[:__PORT__]::
Bind to this IP address to listen for connections from Tor clients and
servers. If you specify a port, bind to this port rather than the one
specified in ORPort. (Default: 0.0.0.0) This directive can be specified
multiple times to bind to multiple addresses/ports. +
+
This option is deprecated; you can get the same behavior with ORPort now
that it supports NoAdvertise and explicit addresses.
[[PortForwarding]] **PortForwarding** **0**|**1**::
Attempt to automatically forward the DirPort and ORPort on a NAT router
connecting this Tor server to the Internet. If set, Tor will try both
@ -2076,15 +2023,6 @@ details.)
+
The same flags are supported here as are supported by ORPort.
[[DirListenAddress]] **DirListenAddress** __IP__[:__PORT__]::
Bind the directory service to this address. If you specify a port, bind to
this port rather than the one specified in DirPort. (Default: 0.0.0.0)
This directive can be specified multiple times to bind to multiple
addresses/ports. +
+
This option is deprecated; you can get the same behavior with DirPort now
that it supports NoAdvertise and explicit addresses.
[[DirPolicy]] **DirPolicy** __policy__,__policy__,__...__::
Set an entrance policy for this server, to limit who can connect to the
directory ports. The policies have the same form as exit policies above,

View File

@ -261,7 +261,7 @@ static config_var_t option_vars_[] = {
V(ConstrainedSockets, BOOL, "0"),
V(ConstrainedSockSize, MEMUNIT, "8192"),
V(ContactInfo, STRING, NULL),
V(ControlListenAddress, LINELIST, NULL),
OBSOLETE("ControlListenAddress"),
VPORT(ControlPort),
V(ControlPortFileGroupReadable,BOOL, "0"),
V(ControlPortWriteToFile, FILENAME, NULL),
@ -278,7 +278,7 @@ static config_var_t option_vars_[] = {
V(DisableNetwork, BOOL, "0"),
V(DirAllowPrivateAddresses, BOOL, "0"),
V(TestingAuthDirTimeToLearnReachability, INTERVAL, "30 minutes"),
V(DirListenAddress, LINELIST, NULL),
OBSOLETE("DirListenAddress"),
V(DirPolicy, LINELIST, NULL),
VPORT(DirPort),
V(DirPortFrontPage, FILENAME, NULL),
@ -292,7 +292,7 @@ static config_var_t option_vars_[] = {
OBSOLETE("DisableV2DirectoryInfo_"),
OBSOLETE("DynamicDHGroups"),
VPORT(DNSPort),
V(DNSListenAddress, LINELIST, NULL),
OBSOLETE("DNSListenAddress"),
V(DownloadExtraInfo, BOOL, "0"),
V(TestingEnableConnBwEvent, BOOL, "0"),
V(TestingEnableCellStatsEvent, BOOL, "0"),
@ -398,7 +398,7 @@ static config_var_t option_vars_[] = {
V(MyFamily, STRING, NULL),
V(NewCircuitPeriod, INTERVAL, "30 seconds"),
OBSOLETE("NamingAuthoritativeDirectory"),
V(NATDListenAddress, LINELIST, NULL),
OBSOLETE("NATDListenAddress"),
VPORT(NATDPort),
V(Nickname, STRING, NULL),
V(PredictedPortsRelevanceTime, INTERVAL, "1 hour"),
@ -408,7 +408,7 @@ static config_var_t option_vars_[] = {
V(NumDirectoryGuards, UINT, "0"),
V(NumEntryGuards, UINT, "0"),
V(OfflineMasterKey, BOOL, "0"),
V(ORListenAddress, LINELIST, NULL),
OBSOLETE("ORListenAddress"),
VPORT(ORPort),
V(OutboundBindAddress, LINELIST, NULL),
V(OutboundBindAddressOR, LINELIST, NULL),
@ -481,7 +481,7 @@ static config_var_t option_vars_[] = {
V(SchedulerHighWaterMark__, MEMUNIT, "101 MB"),
V(SchedulerMaxFlushCells__, UINT, "1000"),
V(ShutdownWaitLength, INTERVAL, "30 seconds"),
V(SocksListenAddress, LINELIST, NULL),
OBSOLETE("SocksListenAddress"),
V(SocksPolicy, LINELIST, NULL),
VPORT(SocksPort),
V(SocksTimeout, INTERVAL, "2 minutes"),
@ -497,7 +497,7 @@ static config_var_t option_vars_[] = {
OBSOLETE("TLSECGroup"),
V(TrackHostExits, CSV, NULL),
V(TrackHostExitsExpire, INTERVAL, "30 minutes"),
V(TransListenAddress, LINELIST, NULL),
OBSOLETE("TransListenAddress"),
VPORT(TransPort),
V(TransProxyType, STRING, "default"),
OBSOLETE("TunnelDirConns"),
@ -664,15 +664,6 @@ static const config_deprecation_t option_deprecation_notes_[] = {
"a wide variety of application-level attacks." },
{ "ClientDNSRejectInternalAddresses", "Turning this on makes your client "
"easier to fingerprint, and may open you to esoteric attacks." },
{ "ControlListenAddress", "Use ControlPort instead." },
{ "DirListenAddress", "Use DirPort instead, possibly with the "
"NoAdvertise sub-option" },
{ "DNSListenAddress", "Use DNSPort instead." },
{ "SocksListenAddress", "Use SocksPort instead." },
{ "TransListenAddress", "Use TransPort instead." },
{ "NATDListenAddress", "Use NATDPort instead." },
{ "ORListenAddress", "Use ORPort instead, possibly with the "
"NoAdvertise sub-option" },
/* End of options deprecated since 0.2.9.2-alpha. */
{ NULL, NULL }
@ -3070,14 +3061,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
if (strcasecmp(options->TransProxyType, "default") &&
!options->TransPort_set) {
REJECT("Cannot use TransProxyType without any valid TransPort or "
"TransListenAddress.");
REJECT("Cannot use TransProxyType without any valid TransPort.");
}
}
#else
if (options->TransPort_set)
REJECT("TransPort and TransListenAddress are disabled "
"in this build.");
REJECT("TransPort is disabled in this build.");
#endif
if (options->TokenBucketRefillInterval <= 0
@ -6369,14 +6358,9 @@ warn_client_dns_cache(const char *option, int disabling)
/**
* Parse port configuration for a single port type.
*
* Read entries of the "FooPort" type from the list <b>ports</b>, and
* entries of the "FooListenAddress" type from the list
* <b>listenaddrs</b>. Two syntaxes are supported: a legacy syntax
* where FooPort is at most a single entry containing a port number and
* where FooListenAddress has any number of address:port combinations;
* and a new syntax where there are no FooListenAddress entries and
* where FooPort can have any number of entries of the format
* "[Address:][Port] IsolationOptions".
* Read entries of the "FooPort" type from the list <b>ports</b>. Syntax is
* that FooPort can have any number of entries of the format
* "[Address:][Port] IsolationOptions".
*
* In log messages, describe the port type as <b>portname</b>.
*
@ -6390,9 +6374,6 @@ warn_client_dns_cache(const char *option, int disabling)
* ports are not on a local address. If CL_PORT_FORBID_NONLOCAL is set,
* this is a control port with no password set: don't even allow it.
*
* Unless CL_PORT_ALLOW_EXTRA_LISTENADDR is set in <b>flags</b>, warn
* if FooListenAddress is set but FooPort is 0.
*
* If CL_PORT_SERVER_OPTIONS is set in <b>flags</b>, do not allow stream
* isolation options in the FooPort entries; instead allow the
* server-port option set.
@ -6407,7 +6388,6 @@ warn_client_dns_cache(const char *option, int disabling)
STATIC int
parse_port_config(smartlist_t *out,
const config_line_t *ports,
const config_line_t *listenaddrs,
const char *portname,
int listener_type,
const char *defaultaddr,
@ -6424,90 +6404,12 @@ parse_port_config(smartlist_t *out,
const unsigned forbid_nonlocal = flags & CL_PORT_FORBID_NONLOCAL;
const unsigned default_to_group_writable =
flags & CL_PORT_DFLT_GROUP_WRITABLE;
const unsigned allow_spurious_listenaddr =
flags & CL_PORT_ALLOW_EXTRA_LISTENADDR;
const unsigned takes_hostnames = flags & CL_PORT_TAKES_HOSTNAMES;
const unsigned is_unix_socket = flags & CL_PORT_IS_UNIXSOCKET;
int got_zero_port=0, got_nonzero_port=0;
char *unix_socket_path = NULL;
/* FooListenAddress is deprecated; let's make it work like it used to work,
* though. */
if (listenaddrs) {
int mainport = defaultport;
if (ports && ports->next) {
log_warn(LD_CONFIG, "%sListenAddress can't be used when there are "
"multiple %sPort lines", portname, portname);
return -1;
} else if (ports) {
if (!strcmp(ports->value, "auto")) {
mainport = CFG_AUTO_PORT;
} else {
int ok;
mainport = (int)tor_parse_long(ports->value, 10, 0, 65535, &ok, NULL);
if (!ok) {
log_warn(LD_CONFIG, "%sListenAddress can only be used with a single "
"%sPort with value \"auto\" or 1-65535 and no options set.",
portname, portname);
return -1;
}
}
}
if (mainport == 0) {
if (allow_spurious_listenaddr)
return 1; /*DOCDOC*/
log_warn(LD_CONFIG, "%sPort must be defined if %sListenAddress is used",
portname, portname);
return -1;
}
if (use_server_options && out) {
/* Add a no_listen port. */
port_cfg_t *cfg = port_cfg_new(0);
cfg->type = listener_type;
cfg->port = mainport;
tor_addr_make_unspec(&cfg->addr); /* Server ports default to 0.0.0.0 */
cfg->server_cfg.no_listen = 1;
cfg->server_cfg.bind_ipv4_only = 1;
/* cfg->entry_cfg defaults are already set by port_cfg_new */
smartlist_add(out, cfg);
}
for (; listenaddrs; listenaddrs = listenaddrs->next) {
tor_addr_t addr;
uint16_t port = 0;
if (tor_addr_port_lookup(listenaddrs->value, &addr, &port) < 0) {
log_warn(LD_CONFIG, "Unable to parse %sListenAddress '%s'",
portname, listenaddrs->value);
return -1;
}
if (out) {
port_cfg_t *cfg = port_cfg_new(0);
cfg->type = listener_type;
cfg->port = port ? port : mainport;
tor_addr_copy(&cfg->addr, &addr);
cfg->entry_cfg.session_group = SESSION_GROUP_UNSET;
cfg->entry_cfg.isolation_flags = ISO_DEFAULT;
cfg->server_cfg.no_advertise = 1;
smartlist_add(out, cfg);
}
}
if (warn_nonlocal && out) {
if (is_control)
warn_nonlocal_controller_ports(out, forbid_nonlocal);
else if (is_ext_orport)
warn_nonlocal_ext_orports(out, portname);
else
warn_nonlocal_client_ports(out, portname, listener_type);
}
return 0;
} /* end if (listenaddrs) */
/* No ListenAddress lines. If there's no FooPort, then maybe make a default
* one. */
/* If there's no FooPort, then maybe make a default one. */
if (! ports) {
if (defaultport && defaultaddr && out) {
port_cfg_t *cfg = port_cfg_new(is_unix_socket ? strlen(defaultaddr) : 0);
@ -6978,36 +6880,35 @@ parse_ports(or_options_t *options, int validate_only,
const unsigned gw_flag = options->SocksSocketsGroupWritable ?
CL_PORT_DFLT_GROUP_WRITABLE : 0;
if (parse_port_config(ports,
options->SocksPort_lines, options->SocksListenAddress,
options->SocksPort_lines,
"Socks", CONN_TYPE_AP_LISTENER,
"127.0.0.1", 9050,
CL_PORT_WARN_NONLOCAL|CL_PORT_ALLOW_EXTRA_LISTENADDR|
CL_PORT_TAKES_HOSTNAMES|gw_flag) < 0) {
*msg = tor_strdup("Invalid SocksPort/SocksListenAddress configuration");
CL_PORT_WARN_NONLOCAL|CL_PORT_TAKES_HOSTNAMES|gw_flag) < 0) {
*msg = tor_strdup("Invalid SocksPort configuration");
goto err;
}
if (parse_port_config(ports,
options->DNSPort_lines, options->DNSListenAddress,
options->DNSPort_lines,
"DNS", CONN_TYPE_AP_DNS_LISTENER,
"127.0.0.1", 0,
CL_PORT_WARN_NONLOCAL|CL_PORT_TAKES_HOSTNAMES) < 0) {
*msg = tor_strdup("Invalid DNSPort/DNSListenAddress configuration");
*msg = tor_strdup("Invalid DNSPort configuration");
goto err;
}
if (parse_port_config(ports,
options->TransPort_lines, options->TransListenAddress,
options->TransPort_lines,
"Trans", CONN_TYPE_AP_TRANS_LISTENER,
"127.0.0.1", 0,
CL_PORT_WARN_NONLOCAL) < 0) {
*msg = tor_strdup("Invalid TransPort/TransListenAddress configuration");
*msg = tor_strdup("Invalid TransPort configuration");
goto err;
}
if (parse_port_config(ports,
options->NATDPort_lines, options->NATDListenAddress,
options->NATDPort_lines,
"NATD", CONN_TYPE_AP_NATD_LISTENER,
"127.0.0.1", 0,
CL_PORT_WARN_NONLOCAL) < 0) {
*msg = tor_strdup("Invalid NatdPort/NatdListenAddress configuration");
*msg = tor_strdup("Invalid NatdPort configuration");
goto err;
}
{
@ -7023,16 +6924,14 @@ parse_ports(or_options_t *options, int validate_only,
if (parse_port_config(ports,
options->ControlPort_lines,
options->ControlListenAddress,
"Control", CONN_TYPE_CONTROL_LISTENER,
"127.0.0.1", 0,
control_port_flags) < 0) {
*msg = tor_strdup("Invalid ControlPort/ControlListenAddress "
"configuration");
*msg = tor_strdup("Invalid ControlPort configuration");
goto err;
}
if (parse_port_config(ports, options->ControlSocket, NULL,
if (parse_port_config(ports, options->ControlSocket,
"ControlSocket",
CONN_TYPE_CONTROL_LISTENER, NULL, 0,
control_port_flags | CL_PORT_IS_UNIXSOCKET) < 0) {
@ -7042,15 +6941,15 @@ parse_ports(or_options_t *options, int validate_only,
}
if (! options->ClientOnly) {
if (parse_port_config(ports,
options->ORPort_lines, options->ORListenAddress,
options->ORPort_lines,
"OR", CONN_TYPE_OR_LISTENER,
"0.0.0.0", 0,
CL_PORT_SERVER_OPTIONS) < 0) {
*msg = tor_strdup("Invalid ORPort/ORListenAddress configuration");
*msg = tor_strdup("Invalid ORPort configuration");
goto err;
}
if (parse_port_config(ports,
options->ExtORPort_lines, NULL,
options->ExtORPort_lines,
"ExtOR", CONN_TYPE_EXT_OR_LISTENER,
"127.0.0.1", 0,
CL_PORT_SERVER_OPTIONS|CL_PORT_WARN_NONLOCAL) < 0) {
@ -7058,11 +6957,11 @@ parse_ports(or_options_t *options, int validate_only,
goto err;
}
if (parse_port_config(ports,
options->DirPort_lines, options->DirListenAddress,
options->DirPort_lines,
"Dir", CONN_TYPE_DIR_LISTENER,
"0.0.0.0", 0,
CL_PORT_SERVER_OPTIONS) < 0) {
*msg = tor_strdup("Invalid DirPort/DirListenAddress configuration");
*msg = tor_strdup("Invalid DirPort configuration");
goto err;
}
}

View File

@ -157,7 +157,7 @@ smartlist_t *get_options_for_server_transport(const char *transport);
#define CL_PORT_NO_STREAM_OPTIONS (1u<<0)
#define CL_PORT_WARN_NONLOCAL (1u<<1)
#define CL_PORT_ALLOW_EXTRA_LISTENADDR (1u<<2)
/* Was CL_PORT_ALLOW_EXTRA_LISTENADDR (1u<<2) */
#define CL_PORT_SERVER_OPTIONS (1u<<3)
#define CL_PORT_FORBID_NONLOCAL (1u<<4)
#define CL_PORT_TAKES_HOSTNAMES (1u<<5)
@ -193,7 +193,6 @@ STATIC int have_enough_mem_for_dircache(const or_options_t *options,
size_t total_mem, char **msg);
STATIC int parse_port_config(smartlist_t *out,
const config_line_t *ports,
const config_line_t *listenaddrs,
const char *portname,
int listener_type,
const char *defaultaddr,

View File

@ -3605,21 +3605,6 @@ typedef struct {
* configured ports. */
config_line_t *SocksPolicy; /**< Lists of socks policy components */
config_line_t *DirPolicy; /**< Lists of dir policy components */
/** Addresses to bind for listening for SOCKS connections. */
config_line_t *SocksListenAddress;
/** Addresses to bind for listening for transparent pf/netfilter
* connections. */
config_line_t *TransListenAddress;
/** Addresses to bind for listening for transparent natd connections */
config_line_t *NATDListenAddress;
/** Addresses to bind for listening for SOCKS connections. */
config_line_t *DNSListenAddress;
/** Addresses to bind for listening for OR connections. */
config_line_t *ORListenAddress;
/** Addresses to bind for listening for directory connections. */
config_line_t *DirListenAddress;
/** Addresses to bind for listening for control connections. */
config_line_t *ControlListenAddress;
/** Local address to bind outbound sockets */
config_line_t *OutboundBindAddress;
/** Local address to bind outbound relay sockets */

View File

@ -1647,8 +1647,7 @@ MOCK_IMPL(int,
server_mode,(const or_options_t *options))
{
if (options->ClientOnly) return 0;
/* XXXX I believe we can kill off ORListenAddress here.*/
return (options->ORPort_set || options->ORListenAddress);
return (options->ORPort_set);
}
/** Return true iff we are trying to be a non-bridge server.

View File

@ -3863,144 +3863,6 @@ mock_config_line(const char *key, const char *val)
return config_line;
}
static void
test_config_parse_port_config__listenaddress(void *data)
{
(void)data;
int ret;
config_line_t *config_listen_address = NULL, *config_listen_address2 = NULL,
*config_listen_address3 = NULL;
config_line_t *config_port1 = NULL, *config_port2 = NULL,
*config_port3 = NULL, *config_port4 = NULL, *config_port5 = NULL;
smartlist_t *slout = NULL;
port_cfg_t *port_cfg = NULL;
// Test basic invocation with no arguments
ret = parse_port_config(NULL, NULL, NULL, NULL, 0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
// Setup some test data
config_listen_address = mock_config_line("DNSListenAddress", "127.0.0.1");
config_listen_address2 = mock_config_line("DNSListenAddress", "x$$$:::345");
config_listen_address3 = mock_config_line("DNSListenAddress",
"127.0.0.1:1442");
config_port1 = mock_config_line("DNSPort", "42");
config_port2 = mock_config_line("DNSPort", "43");
config_port1->next = config_port2;
config_port3 = mock_config_line("DNSPort", "auto");
config_port4 = mock_config_line("DNSPort", "55542");
config_port5 = mock_config_line("DNSPort", "666777");
// Test failure when we have a ListenAddress line and several
// Port lines for the same portname
ret = parse_port_config(NULL, config_port1, config_listen_address, "DNS", 0,
NULL, 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test case when we have a listen address, no default port and allow
// spurious listen address lines
ret = parse_port_config(NULL, NULL, config_listen_address, "DNS", 0, NULL,
0, CL_PORT_ALLOW_EXTRA_LISTENADDR);
tt_int_op(ret, OP_EQ, 1);
// Test case when we have a listen address, no default port but doesn't
// allow spurious listen address lines
ret = parse_port_config(NULL, NULL, config_listen_address, "DNS", 0, NULL,
0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test case when we have a listen address, and a port that points to auto,
// should use the AUTO port
slout = smartlist_new();
ret = parse_port_config(slout, config_port3, config_listen_address, "DNS",
0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
tt_int_op(port_cfg->port, OP_EQ, CFG_AUTO_PORT);
// Test when we have a listen address and a custom port
ret = parse_port_config(slout, config_port4, config_listen_address, "DNS",
0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 2);
port_cfg = (port_cfg_t *)smartlist_get(slout, 1);
tt_int_op(port_cfg->port, OP_EQ, 55542);
// Test when we have a listen address and an invalid custom port
ret = parse_port_config(slout, config_port5, config_listen_address, "DNS",
0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test we get a server port configuration when asked for it
ret = parse_port_config(slout, NULL, config_listen_address, "DNS", 0, NULL,
123, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 4);
port_cfg = (port_cfg_t *)smartlist_get(slout, 2);
tt_int_op(port_cfg->port, OP_EQ, 123);
tt_int_op(port_cfg->server_cfg.no_listen, OP_EQ, 1);
tt_int_op(port_cfg->server_cfg.bind_ipv4_only, OP_EQ, 1);
// Test an invalid ListenAddress configuration
ret = parse_port_config(NULL, NULL, config_listen_address2, "DNS", 0, NULL,
222, 0);
tt_int_op(ret, OP_EQ, -1);
// Test default to the port in the listen address if available
ret = parse_port_config(slout, config_port2, config_listen_address3, "DNS",
0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 5);
port_cfg = (port_cfg_t *)smartlist_get(slout, 4);
tt_int_op(port_cfg->port, OP_EQ, 1442);
// Test we work correctly without an out, but with a listen address
// and a port
ret = parse_port_config(NULL, config_port2, config_listen_address, "DNS",
0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
// Test warning nonlocal control
ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
CONN_TYPE_CONTROL_LISTENER, NULL, 0,
CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
// Test warning nonlocal ext or listener
ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
CONN_TYPE_EXT_OR_LISTENER, NULL, 0,
CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
// Test warning nonlocal other
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, config_port2, config_listen_address, "DNS",
0, NULL, 0, CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
// Test warning nonlocal control without an out
ret = parse_port_config(NULL, config_port2, config_listen_address, "DNS",
CONN_TYPE_CONTROL_LISTENER, NULL, 0,
CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
done:
config_free_lines(config_listen_address);
config_free_lines(config_listen_address2);
config_free_lines(config_listen_address3);
config_free_lines(config_port1);
/* 2 was linked from 1. */
config_free_lines(config_port3);
config_free_lines(config_port4);
config_free_lines(config_port5);
if (slout)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_free(slout);
}
static void
test_config_parse_port_config__ports__no_ports_given(void *data)
{
@ -4012,40 +3874,40 @@ test_config_parse_port_config__ports__no_ports_given(void *data)
slout = smartlist_new();
// Test no defaultport, no defaultaddress and no out
ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, NULL, 0, 0);
ret = parse_port_config(NULL, NULL, "DNS", 0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
// Test with defaultport, no defaultaddress and no out
ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, NULL, 42, 0);
ret = parse_port_config(NULL, NULL, "DNS", 0, NULL, 42, 0);
tt_int_op(ret, OP_EQ, 0);
// Test no defaultport, with defaultaddress and no out
ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
ret = parse_port_config(NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
tt_int_op(ret, OP_EQ, 0);
// Test with defaultport, with defaultaddress and no out
ret = parse_port_config(NULL, NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
ret = parse_port_config(NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
tt_int_op(ret, OP_EQ, 0);
// Test no defaultport, no defaultaddress and with out
ret = parse_port_config(slout, NULL, NULL, "DNS", 0, NULL, 0, 0);
ret = parse_port_config(slout, NULL, "DNS", 0, NULL, 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 0);
// Test with defaultport, no defaultaddress and with out
ret = parse_port_config(slout, NULL, NULL, "DNS", 0, NULL, 42, 0);
ret = parse_port_config(slout, NULL, "DNS", 0, NULL, 42, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 0);
// Test no defaultport, with defaultaddress and with out
ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "127.0.0.2", 0, 0);
ret = parse_port_config(slout, NULL, "DNS", 0, "127.0.0.2", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 0);
// Test with defaultport, with defaultaddress and out, adds a new port cfg
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "127.0.0.2", 42, 0);
ret = parse_port_config(slout, NULL, "DNS", 0, "127.0.0.2", 42, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
port_cfg = (port_cfg_t *)smartlist_get(slout, 0);
@ -4056,7 +3918,7 @@ test_config_parse_port_config__ports__no_ports_given(void *data)
// for a unix address
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, NULL, NULL, "DNS", 0, "/foo/bar/unixdomain",
ret = parse_port_config(slout, NULL, "DNS", 0, "/foo/bar/unixdomain",
42, CL_PORT_IS_UNIXSOCKET);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4085,28 +3947,28 @@ test_config_parse_port_config__ports__ports_given(void *data)
// Test error when encounters an invalid Port specification
config_port_invalid = mock_config_line("DNSPort", "");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0, NULL,
0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test error when encounters an empty unix domain specification
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort", "unix:");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0, NULL,
0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test error when encounters a unix domain specification but the listener
// doesn't support domain sockets
config_port_valid = mock_config_line("DNSPort", "unix:/tmp/foo/bar");
ret = parse_port_config(NULL, config_port_valid, NULL, "DNS",
ret = parse_port_config(NULL, config_port_valid, "DNS",
CONN_TYPE_AP_DNS_LISTENER, NULL, 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test valid unix domain
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0, 0);
#ifdef _WIN32
tt_int_op(ret, OP_EQ, -1);
@ -4131,7 +3993,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
"unix:/tmp/foo/bar NoIPv4Traffic "
"NoIPv6Traffic "
"NoOnionTraffic");
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
ret = parse_port_config(NULL, config_port_invalid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, -1);
@ -4140,7 +4002,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort",
"127.0.0.1:80 NoDNSRequest");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS",
ret = parse_port_config(NULL, config_port_invalid, "DNS",
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, -1);
@ -4153,7 +4015,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_valid = mock_config_line("DNSPort", "127.0.0.1:80 "
"NoIPv6Traffic "
"NoIPv4Traffic NoOnionTraffic");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS",
ret = parse_port_config(slout, config_port_valid, "DNS",
CONN_TYPE_AP_DNS_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, 0);
@ -4169,7 +4031,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_invalid = mock_config_line("SOCKSPort",
"NoIPv6Traffic "
"unix:/tmp/foo/bar NoIPv4Traffic");
ret = parse_port_config(NULL, config_port_invalid, NULL, "SOCKS",
ret = parse_port_config(NULL, config_port_invalid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, -1);
@ -4182,7 +4044,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
"NoIPv6Traffic "
"NoDNSRequest NoIPv4Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
#ifdef _WIN32
@ -4204,7 +4066,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar\" "
"NoIPv6Traffic "
"NoDNSRequest NoIPv4Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
#ifdef _WIN32
@ -4226,7 +4088,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_valid = mock_config_line("SOCKSPort", "unix:\"/tmp/foo/ bar "
"NoIPv6Traffic "
"NoDNSRequest NoIPv4Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, -1);
@ -4238,7 +4100,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_valid = mock_config_line("SOCKSPort", "unix:\"\" "
"NoIPv6Traffic "
"NoDNSRequest NoIPv4Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, -1);
@ -4249,7 +4111,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
"OnionTrafficOnly");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
#ifdef _WIN32
@ -4270,7 +4132,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
"NoIPv4Traffic IPv6Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
#ifdef _WIN32
@ -4289,7 +4151,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/foo/bar "
"IPv4Traffic IPv6Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, NULL, 0,
CL_PORT_TAKES_HOSTNAMES);
#ifdef _WIN32
@ -4305,28 +4167,28 @@ test_config_parse_port_config__ports__ports_given(void *data)
// Test failure if we specify world writable for an IP Port
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort", "42 WorldWritable");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test failure if we specify group writable for an IP Port
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort", "42 GroupWritable");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test failure if we specify group writable for an IP Port
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort", "42 RelaxDirModeCheck");
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test success with only a port (this will fail without a default address)
config_free_lines(config_port_valid); config_port_valid = NULL;
config_port_valid = mock_config_line("DNSPort", "42");
ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
@ -4335,7 +4197,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IsolateDestPort");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4348,7 +4210,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 NoIsolateDestPorts");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4361,7 +4223,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IsolateDestAddr");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4374,7 +4236,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IsolateSOCKSAuth");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4387,7 +4249,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IsolateClientProtocol");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4400,7 +4262,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IsolateClientAddr");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4411,7 +4273,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
// Test success with ignored unknown options
config_free_lines(config_port_valid); config_port_valid = NULL;
config_port_valid = mock_config_line("DNSPort", "42 ThisOptionDoesntExist");
ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
@ -4420,7 +4282,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 NoIsolateSOCKSAuth");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.3", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4433,7 +4295,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_valid = mock_config_line("SOCKSPort",
"42 IPv6Traffic PreferIPv6");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, "127.0.0.42", 0,
CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, 0);
@ -4446,7 +4308,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 CacheIPv4DNS");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4459,7 +4321,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 CacheIPv6DNS");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4472,7 +4334,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 NoCacheIPv4DNS");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4485,7 +4347,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 CacheDNS");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, CL_PORT_TAKES_HOSTNAMES);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4498,7 +4360,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 UseIPv4Cache");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4511,7 +4373,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 UseIPv6Cache");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4524,7 +4386,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 UseDNSCache");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4537,7 +4399,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 NoPreferIPv6Automap");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4549,7 +4411,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 PreferSOCKSNoAuth");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4564,14 +4426,14 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_port_invalid = mock_config_line("DNSPort", "0");
config_port_valid = mock_config_line("DNSPort", "42");
config_port_invalid->next = config_port_valid;
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.42", 0, 0);
tt_int_op(ret, OP_EQ, -1);
// Test success with warn non-local control
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, config_port_valid, NULL, "Control",
ret = parse_port_config(slout, config_port_valid, "Control",
CONN_TYPE_CONTROL_LISTENER, "127.0.0.42", 0,
CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
@ -4579,7 +4441,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
// Test success with warn non-local listener
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, config_port_valid, NULL, "ExtOR",
ret = parse_port_config(slout, config_port_valid, "ExtOR",
CONN_TYPE_EXT_OR_LISTENER, "127.0.0.42", 0,
CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
@ -4587,12 +4449,12 @@ test_config_parse_port_config__ports__ports_given(void *data)
// Test success with warn non-local other
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.42", 0, CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
// Test success with warn non-local other without out
ret = parse_port_config(NULL, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_valid, "DNS", 0,
"127.0.0.42", 0, CL_PORT_WARN_NONLOCAL);
tt_int_op(ret, OP_EQ, 0);
@ -4603,7 +4465,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 IPv4Traffic "
"IPv6Traffic");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.44", 0,
CL_PORT_TAKES_HOSTNAMES |
CL_PORT_NO_STREAM_OPTIONS);
@ -4618,7 +4480,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=invalid");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4630,7 +4492,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=123");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.44", 0, 0);
tt_int_op(ret, OP_EQ, -1);
@ -4640,7 +4502,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "42 SessionGroup=123 "
"SessionGroup=321");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4649,7 +4511,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "42 SessionGroup=1111122");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.44", 0, CL_PORT_NO_STREAM_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4661,7 +4523,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "0");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.45", 0, CL_PORT_IS_UNIXSOCKET);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 0);
@ -4671,7 +4533,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "something");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.45", 0, CL_PORT_IS_UNIXSOCKET);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4684,7 +4546,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "auto");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.46", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4698,7 +4560,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "127.0.0.122:auto");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.46", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4711,7 +4573,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
config_free_lines(config_port_invalid); config_port_invalid = NULL;
config_port_invalid = mock_config_line("DNSPort", "invalidstuff!!:auto");
MOCK(tor_addr_lookup, mock_tor_addr_lookup__fail_on_bad_addrs);
ret = parse_port_config(NULL, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(NULL, config_port_invalid, "DNS", 0,
"127.0.0.46", 0, 0);
UNMOCK(tor_addr_lookup);
tt_int_op(ret, OP_EQ, -1);
@ -4721,7 +4583,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "127.0.0.123:656");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0,
"127.0.0.46", 0, 0);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4735,7 +4597,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "something wrong");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.46", 0, 0);
tt_int_op(ret, OP_EQ, -1);
@ -4744,7 +4606,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "127.0.1.0:123:auto");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0,
"127.0.0.46", 0, 0);
tt_int_op(ret, OP_EQ, -1);
@ -4754,7 +4616,7 @@ test_config_parse_port_config__ports__ports_given(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("SOCKSPort", "unix:/tmp/somewhere");
ret = parse_port_config(slout, config_port_valid, NULL, "SOCKS",
ret = parse_port_config(slout, config_port_valid, "SOCKS",
CONN_TYPE_AP_LISTENER, "127.0.0.46", 0,
CL_PORT_DFLT_GROUP_WRITABLE);
#ifdef _WIN32
@ -4789,7 +4651,7 @@ test_config_parse_port_config__ports__server_options(void *data)
config_free_lines(config_port_valid); config_port_valid = NULL;
config_port_valid = mock_config_line("DNSPort",
"127.0.0.124:656 NoAdvertise");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4802,7 +4664,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 NoListen");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4816,7 +4678,7 @@ test_config_parse_port_config__ports__server_options(void *data)
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "127.0.0.124:656 NoListen "
"NoAdvertise");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
0, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4825,7 +4687,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 IPv4Only");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4838,7 +4700,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "[::1]:656 IPv6Only");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4852,7 +4714,7 @@ test_config_parse_port_config__ports__server_options(void *data)
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "127.0.0.124:656 IPv6Only "
"IPv4Only");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
0, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4861,7 +4723,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_valid = mock_config_line("DNSPort", "127.0.0.124:656 unknown");
ret = parse_port_config(slout, config_port_valid, NULL, "DNS", 0, NULL, 0,
ret = parse_port_config(slout, config_port_valid, "DNS", 0, NULL, 0,
CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, 0);
tt_int_op(smartlist_len(slout), OP_EQ, 1);
@ -4872,7 +4734,7 @@ test_config_parse_port_config__ports__server_options(void *data)
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort",
"127.0.0.124:656 IPv6Only");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
0, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4881,7 +4743,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("DNSPort", "[::1]:656 IPv4Only");
ret = parse_port_config(slout, config_port_invalid, NULL, "DNS", 0, NULL,
ret = parse_port_config(slout, config_port_invalid, "DNS", 0, NULL,
0, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4890,7 +4752,7 @@ test_config_parse_port_config__ports__server_options(void *data)
SMARTLIST_FOREACH(slout,port_cfg_t *,pf,port_cfg_free(pf));
smartlist_clear(slout);
config_port_invalid = mock_config_line("ORPort", "unix:\"\"");
ret = parse_port_config(slout, config_port_invalid, NULL, "ORPort", 0, NULL,
ret = parse_port_config(slout, config_port_invalid, "ORPort", 0, NULL,
0, CL_PORT_SERVER_OPTIONS);
tt_int_op(ret, OP_EQ, -1);
@ -4951,7 +4813,6 @@ struct testcase_t config_tests[] = {
CONFIG_TEST(fix_my_family, 0),
CONFIG_TEST(directory_fetch, 0),
CONFIG_TEST(port_cfg_line_extract_addrport, 0),
CONFIG_TEST(parse_port_config__listenaddress, 0),
CONFIG_TEST(parse_port_config__ports__no_ports_given, 0),
CONFIG_TEST(parse_port_config__ports__server_options, 0),
CONFIG_TEST(parse_port_config__ports__ports_given, 0),

View File

@ -402,7 +402,7 @@ test_options_validate__uname_for_server(void *ignored)
(void)ignored;
char *msg;
options_test_data_t *tdata = get_options_test_data(
"ORListenAddress 127.0.0.1:5555");
"ORPort 127.0.0.1:5555");
setup_capture_of_logs(LOG_WARN);
MOCK(get_uname, fixed_get_uname);
@ -536,7 +536,7 @@ test_options_validate__contactinfo(void *ignored)
int ret;
char *msg;
options_test_data_t *tdata = get_options_test_data(
"ORListenAddress 127.0.0.1:5555\nORPort 955");
"ORPort 127.0.0.1:5555");
setup_capture_of_logs(LOG_DEBUG);
tdata->opt->ContactInfo = NULL;
@ -549,7 +549,7 @@ test_options_validate__contactinfo(void *ignored)
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data("ORListenAddress 127.0.0.1:5555\nORPort 955\n"
tdata = get_options_test_data("ORPort 127.0.0.1:5555\n"
"ContactInfo hella@example.org");
mock_clean_saved_logs();
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
@ -957,8 +957,7 @@ test_options_validate__relay_with_hidden_services(void *ignored)
char *msg;
setup_capture_of_logs(LOG_DEBUG);
options_test_data_t *tdata = get_options_test_data(
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"HiddenServiceDir "
"/Library/Tor/var/lib/tor/hidden_service/\n"
"HiddenServicePort 80 127.0.0.1:8080\n"
@ -1028,7 +1027,7 @@ test_options_validate__transproxy(void *ignored)
#else
tt_int_op(tdata->opt->TransProxyType_parsed, OP_EQ, TPT_PF_DIVERT);
tt_str_op(msg, OP_EQ, "Cannot use TransProxyType without "
"any valid TransPort or TransListenAddress.");
"any valid TransPort.");
#endif
tor_free(msg);
@ -1043,7 +1042,7 @@ test_options_validate__transproxy(void *ignored)
#else
tt_int_op(tdata->opt->TransProxyType_parsed, OP_EQ, TPT_TPROXY);
tt_str_op(msg, OP_EQ, "Cannot use TransProxyType without any valid "
"TransPort or TransListenAddress.");
"TransPort.");
#endif
tor_free(msg);
@ -1059,7 +1058,7 @@ test_options_validate__transproxy(void *ignored)
#else
tt_int_op(tdata->opt->TransProxyType_parsed, OP_EQ, TPT_IPFW);
tt_str_op(msg, OP_EQ, "Cannot use TransProxyType without any valid "
"TransPort or TransListenAddress.");
"TransPort.");
#endif
tor_free(msg);
@ -1117,8 +1116,7 @@ test_options_validate__transproxy(void *ignored)
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ, "TransPort and TransListenAddress are disabled in "
"this build.");
tt_str_op(msg, OP_EQ, "TransPort is disabled in this build.");
tor_free(msg);
#endif
@ -1694,8 +1692,7 @@ test_options_validate__reachable_addresses(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data("ReachableAddresses *:82\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"MaxClientCircuitsPending 1\n"
"ConnLimit 1\n"
"SchedulerHighWaterMark__ 42\n"
@ -1708,8 +1705,7 @@ test_options_validate__reachable_addresses(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data("ReachableORAddresses *:82\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"MaxClientCircuitsPending 1\n"
"ConnLimit 1\n"
"SchedulerHighWaterMark__ 42\n"
@ -1722,8 +1718,7 @@ test_options_validate__reachable_addresses(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data("ReachableDirAddresses *:82\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"MaxClientCircuitsPending 1\n"
"ConnLimit 1\n"
"SchedulerHighWaterMark__ 42\n"
@ -1736,8 +1731,7 @@ test_options_validate__reachable_addresses(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data("ClientUseIPv4 0\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"MaxClientCircuitsPending 1\n"
"ConnLimit 1\n"
"SchedulerHighWaterMark__ 42\n"
@ -1837,8 +1831,7 @@ test_options_validate__use_bridges(void *ignored)
options_test_data_t *tdata = get_options_test_data(
"UseBridges 1\n"
"ClientUseIPv4 1\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"MaxClientCircuitsPending 1\n"
"ConnLimit 1\n"
"SchedulerHighWaterMark__ 42\n"
@ -2398,8 +2391,7 @@ test_options_validate__bandwidth(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 1\n"
);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
@ -2410,8 +2402,7 @@ test_options_validate__bandwidth(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76800\n"
"MaxAdvertisedBandwidth 30000\n"
);
@ -2423,8 +2414,7 @@ test_options_validate__bandwidth(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76800\n"
"RelayBandwidthRate 1\n"
"MaxAdvertisedBandwidth 38400\n"
@ -2437,8 +2427,7 @@ test_options_validate__bandwidth(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76800\n"
"BandwidthBurst 76800\n"
"RelayBandwidthRate 76800\n"
@ -2876,8 +2865,7 @@ test_options_validate__accounting(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(
TEST_OPTIONS_DEFAULT_VALUES
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76800\n"
"BandwidthBurst 76800\n"
"MaxAdvertisedBandwidth 38400\n"
@ -3511,8 +3499,7 @@ test_options_validate__families(void *ignored)
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"MyFamily home\n"
"BridgeRelay 1\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 51300\n"
"BandwidthBurst 51300\n"
"MaxAdvertisedBandwidth 25700\n"
@ -3741,8 +3728,7 @@ test_options_validate__transport(void *ignored)
free_options_test_data(tdata);
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ServerTransportPlugin foo exec bar\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76900\n"
"BandwidthBurst 76900\n"
"MaxAdvertisedBandwidth 38500\n"
@ -3784,8 +3770,7 @@ test_options_validate__transport(void *ignored)
tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
"ServerTransportListenAddr foo 127.0.0.42:55\n"
"ServerTransportPlugin foo exec bar\n"
"ORListenAddress 127.0.0.1:5555\n"
"ORPort 955\n"
"ORPort 127.0.0.1:5555\n"
"BandwidthRate 76900\n"
"BandwidthBurst 76900\n"
"MaxAdvertisedBandwidth 38500\n"