|
@@ -5476,9 +5476,9 @@ static port_cfg_t *
|
|
|
port_cfg_new(void)
|
|
|
{
|
|
|
port_cfg_t *cfg = tor_malloc_zero(sizeof(port_cfg_t));
|
|
|
- cfg->ipv4_traffic = 1;
|
|
|
- cfg->cache_ipv4_answers = 1;
|
|
|
- cfg->prefer_ipv6_virtaddr = 1;
|
|
|
+ cfg->entry_cfg.ipv4_traffic = 1;
|
|
|
+ cfg->entry_cfg.cache_ipv4_answers = 1;
|
|
|
+ cfg->entry_cfg.prefer_ipv6_virtaddr = 1;
|
|
|
return cfg;
|
|
|
}
|
|
|
|
|
@@ -5685,10 +5685,10 @@ parse_port_config(smartlist_t *out,
|
|
|
cfg->type = listener_type;
|
|
|
cfg->port = mainport;
|
|
|
tor_addr_make_unspec(&cfg->addr); /* Server ports default to 0.0.0.0 */
|
|
|
- cfg->no_listen = 1;
|
|
|
- cfg->bind_ipv4_only = 1;
|
|
|
- cfg->ipv4_traffic = 1;
|
|
|
- cfg->prefer_ipv6_virtaddr = 1;
|
|
|
+ cfg->server_cfg.no_listen = 1;
|
|
|
+ cfg->server_cfg.bind_ipv4_only = 1;
|
|
|
+ cfg->entry_cfg.ipv4_traffic = 1;
|
|
|
+ cfg->entry_cfg.prefer_ipv6_virtaddr = 1;
|
|
|
smartlist_add(out, cfg);
|
|
|
}
|
|
|
|
|
@@ -5705,9 +5705,9 @@ parse_port_config(smartlist_t *out,
|
|
|
cfg->type = listener_type;
|
|
|
cfg->port = port ? port : mainport;
|
|
|
tor_addr_copy(&cfg->addr, &addr);
|
|
|
- cfg->session_group = SESSION_GROUP_UNSET;
|
|
|
- cfg->isolation_flags = ISO_DEFAULT;
|
|
|
- cfg->no_advertise = 1;
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
@@ -5731,8 +5731,8 @@ parse_port_config(smartlist_t *out,
|
|
|
cfg->type = listener_type;
|
|
|
cfg->port = defaultport;
|
|
|
tor_addr_parse(&cfg->addr, defaultaddr);
|
|
|
- cfg->session_group = SESSION_GROUP_UNSET;
|
|
|
- cfg->isolation_flags = ISO_DEFAULT;
|
|
|
+ cfg->entry_cfg.session_group = SESSION_GROUP_UNSET;
|
|
|
+ cfg->entry_cfg.isolation_flags = ISO_DEFAULT;
|
|
|
smartlist_add(out, cfg);
|
|
|
}
|
|
|
return 0;
|
|
@@ -5962,24 +5962,24 @@ parse_port_config(smartlist_t *out,
|
|
|
tor_addr_copy(&cfg->addr, &addr);
|
|
|
cfg->port = port;
|
|
|
cfg->type = listener_type;
|
|
|
- cfg->isolation_flags = isolation;
|
|
|
- cfg->session_group = sessiongroup;
|
|
|
- cfg->no_advertise = no_advertise;
|
|
|
- cfg->no_listen = no_listen;
|
|
|
- cfg->all_addrs = all_addrs;
|
|
|
- cfg->bind_ipv4_only = bind_ipv4_only;
|
|
|
- cfg->bind_ipv6_only = bind_ipv6_only;
|
|
|
- cfg->ipv4_traffic = ipv4_traffic;
|
|
|
- cfg->ipv6_traffic = ipv6_traffic;
|
|
|
- cfg->prefer_ipv6 = prefer_ipv6;
|
|
|
- cfg->cache_ipv4_answers = cache_ipv4;
|
|
|
- cfg->cache_ipv6_answers = cache_ipv6;
|
|
|
- cfg->use_cached_ipv4_answers = use_cached_ipv4;
|
|
|
- cfg->use_cached_ipv6_answers = use_cached_ipv6;
|
|
|
- cfg->prefer_ipv6_virtaddr = prefer_ipv6_automap;
|
|
|
- cfg->socks_prefer_no_auth = prefer_no_auth;
|
|
|
+ cfg->entry_cfg.isolation_flags = isolation;
|
|
|
+ cfg->entry_cfg.session_group = sessiongroup;
|
|
|
+ cfg->server_cfg.no_advertise = no_advertise;
|
|
|
+ cfg->server_cfg.no_listen = no_listen;
|
|
|
+ cfg->server_cfg.all_addrs = all_addrs;
|
|
|
+ cfg->server_cfg.bind_ipv4_only = bind_ipv4_only;
|
|
|
+ cfg->server_cfg.bind_ipv6_only = bind_ipv6_only;
|
|
|
+ cfg->entry_cfg.ipv4_traffic = ipv4_traffic;
|
|
|
+ cfg->entry_cfg.ipv6_traffic = ipv6_traffic;
|
|
|
+ cfg->entry_cfg.prefer_ipv6 = prefer_ipv6;
|
|
|
+ cfg->entry_cfg.cache_ipv4_answers = cache_ipv4;
|
|
|
+ cfg->entry_cfg.cache_ipv6_answers = cache_ipv6;
|
|
|
+ cfg->entry_cfg.use_cached_ipv4_answers = use_cached_ipv4;
|
|
|
+ cfg->entry_cfg.use_cached_ipv6_answers = use_cached_ipv6;
|
|
|
+ cfg->entry_cfg.prefer_ipv6_virtaddr = prefer_ipv6_automap;
|
|
|
+ cfg->entry_cfg.socks_prefer_no_auth = prefer_no_auth;
|
|
|
if (! (isolation & ISO_SOCKSAUTH))
|
|
|
- cfg->socks_prefer_no_auth = 1;
|
|
|
+ cfg->entry_cfg.socks_prefer_no_auth = 1;
|
|
|
|
|
|
smartlist_add(out, cfg);
|
|
|
}
|
|
@@ -6041,7 +6041,7 @@ count_real_listeners(const smartlist_t *ports, int listenertype)
|
|
|
{
|
|
|
int n = 0;
|
|
|
SMARTLIST_FOREACH_BEGIN(ports, port_cfg_t *, port) {
|
|
|
- if (port->no_listen || port->is_unix_addr)
|
|
|
+ if (port->server_cfg.no_listen || port->is_unix_addr)
|
|
|
continue;
|
|
|
if (port->type != listenertype)
|
|
|
continue;
|
|
@@ -6217,25 +6217,25 @@ check_server_ports(const smartlist_t *ports,
|
|
|
|
|
|
SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) {
|
|
|
if (port->type == CONN_TYPE_DIR_LISTENER) {
|
|
|
- if (! port->no_advertise)
|
|
|
+ if (! port->server_cfg.no_advertise)
|
|
|
++n_dirport_advertised;
|
|
|
- if (! port->no_listen)
|
|
|
+ if (! port->server_cfg.no_listen)
|
|
|
++n_dirport_listeners;
|
|
|
} else if (port->type == CONN_TYPE_OR_LISTENER) {
|
|
|
- if (! port->no_advertise) {
|
|
|
+ if (! port->server_cfg.no_advertise) {
|
|
|
++n_orport_advertised;
|
|
|
if (tor_addr_family(&port->addr) == AF_INET ||
|
|
|
(tor_addr_family(&port->addr) == AF_UNSPEC &&
|
|
|
- !port->bind_ipv6_only))
|
|
|
+ !port->server_cfg.bind_ipv6_only))
|
|
|
++n_orport_advertised_ipv4;
|
|
|
}
|
|
|
- if (! port->no_listen)
|
|
|
+ if (! port->server_cfg.no_listen)
|
|
|
++n_orport_listeners;
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
#ifndef _WIN32
|
|
|
- if (!port->no_listen && port->port < 1024)
|
|
|
+ if (!port->server_cfg.no_listen && port->port < 1024)
|
|
|
++n_low_port;
|
|
|
#endif
|
|
|
} SMARTLIST_FOREACH_END(port);
|
|
@@ -6313,7 +6313,7 @@ get_first_listener_addrport_string(int listener_type)
|
|
|
return NULL;
|
|
|
|
|
|
SMARTLIST_FOREACH_BEGIN(configured_ports, const port_cfg_t *, cfg) {
|
|
|
- if (cfg->no_listen)
|
|
|
+ if (cfg->server_cfg.no_listen)
|
|
|
continue;
|
|
|
|
|
|
if (cfg->type == listener_type &&
|
|
@@ -6360,12 +6360,12 @@ get_first_advertised_port_by_type_af(int listener_type, int address_family)
|
|
|
return 0;
|
|
|
SMARTLIST_FOREACH_BEGIN(configured_ports, const port_cfg_t *, cfg) {
|
|
|
if (cfg->type == listener_type &&
|
|
|
- !cfg->no_advertise &&
|
|
|
+ !cfg->server_cfg.no_advertise &&
|
|
|
(tor_addr_family(&cfg->addr) == address_family ||
|
|
|
tor_addr_family(&cfg->addr) == AF_UNSPEC)) {
|
|
|
if (tor_addr_family(&cfg->addr) != AF_UNSPEC ||
|
|
|
- (address_family == AF_INET && !cfg->bind_ipv6_only) ||
|
|
|
- (address_family == AF_INET6 && !cfg->bind_ipv4_only)) {
|
|
|
+ (address_family == AF_INET && !cfg->server_cfg.bind_ipv6_only) ||
|
|
|
+ (address_family == AF_INET6 && !cfg->server_cfg.bind_ipv4_only)) {
|
|
|
return cfg->port;
|
|
|
}
|
|
|
}
|