mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Rename ipv{4,6}_only to bind_ipv{4,6}_only
This is to avoid confusion with the ipv{4,6}_traffic flags.
This commit is contained in:
parent
4bec25c3cd
commit
111321ed16
@ -4542,7 +4542,7 @@ parse_port_config(smartlist_t *out,
|
|||||||
cfg->port = mainport;
|
cfg->port = mainport;
|
||||||
tor_addr_make_unspec(&cfg->addr); /* Server ports default to 0.0.0.0 */
|
tor_addr_make_unspec(&cfg->addr); /* Server ports default to 0.0.0.0 */
|
||||||
cfg->no_listen = 1;
|
cfg->no_listen = 1;
|
||||||
cfg->ipv4_only = 1;
|
cfg->bind_ipv4_only = 1;
|
||||||
smartlist_add(out, cfg);
|
smartlist_add(out, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4604,7 +4604,7 @@ parse_port_config(smartlist_t *out,
|
|||||||
uint16_t ptmp=0;
|
uint16_t ptmp=0;
|
||||||
int ok;
|
int ok;
|
||||||
int no_listen = 0, no_advertise = 0, all_addrs = 0,
|
int no_listen = 0, no_advertise = 0, all_addrs = 0,
|
||||||
ipv4_only = 0, ipv6_only = 0,
|
bind_ipv4_only = 0, bind_ipv6_only = 0,
|
||||||
ipv4_traffic = 1, ipv6_traffic = 0;
|
ipv4_traffic = 1, ipv6_traffic = 0;
|
||||||
|
|
||||||
smartlist_split_string(elts, ports->value, NULL,
|
smartlist_split_string(elts, ports->value, NULL,
|
||||||
@ -4670,9 +4670,9 @@ parse_port_config(smartlist_t *out,
|
|||||||
all_addrs = 1;
|
all_addrs = 1;
|
||||||
#endif
|
#endif
|
||||||
} else if (!strcasecmp(elt, "IPv4Only")) {
|
} else if (!strcasecmp(elt, "IPv4Only")) {
|
||||||
ipv4_only = 1;
|
bind_ipv4_only = 1;
|
||||||
} else if (!strcasecmp(elt, "IPv6Only")) {
|
} else if (!strcasecmp(elt, "IPv6Only")) {
|
||||||
ipv6_only = 1;
|
bind_ipv6_only = 1;
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_CONFIG, "Unrecognized %sPort option '%s'",
|
log_warn(LD_CONFIG, "Unrecognized %sPort option '%s'",
|
||||||
portname, escaped(elt));
|
portname, escaped(elt));
|
||||||
@ -4685,18 +4685,18 @@ parse_port_config(smartlist_t *out,
|
|||||||
portname, escaped(ports->value));
|
portname, escaped(ports->value));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (ipv4_only && ipv6_only) {
|
if (bind_ipv4_only && bind_ipv6_only) {
|
||||||
log_warn(LD_CONFIG, "Tried to set both IPv4Only and IPv6Only "
|
log_warn(LD_CONFIG, "Tried to set both IPv4Only and IPv6Only "
|
||||||
"on %sPort line '%s'",
|
"on %sPort line '%s'",
|
||||||
portname, escaped(ports->value));
|
portname, escaped(ports->value));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (ipv4_only && tor_addr_family(&addr) == AF_INET6) {
|
if (bind_ipv4_only && tor_addr_family(&addr) == AF_INET6) {
|
||||||
log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv6",
|
log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv6",
|
||||||
portname);
|
portname);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (ipv6_only && tor_addr_family(&addr) == AF_INET) {
|
if (bind_ipv6_only && tor_addr_family(&addr) == AF_INET) {
|
||||||
log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv4",
|
log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv4",
|
||||||
portname);
|
portname);
|
||||||
goto err;
|
goto err;
|
||||||
@ -4782,8 +4782,8 @@ parse_port_config(smartlist_t *out,
|
|||||||
cfg->no_advertise = no_advertise;
|
cfg->no_advertise = no_advertise;
|
||||||
cfg->no_listen = no_listen;
|
cfg->no_listen = no_listen;
|
||||||
cfg->all_addrs = all_addrs;
|
cfg->all_addrs = all_addrs;
|
||||||
cfg->ipv4_only = ipv4_only;
|
cfg->bind_ipv4_only = bind_ipv4_only;
|
||||||
cfg->ipv6_only = ipv6_only;
|
cfg->bind_ipv6_only = bind_ipv6_only;
|
||||||
cfg->ipv4_traffic = ipv4_traffic;
|
cfg->ipv4_traffic = ipv4_traffic;
|
||||||
cfg->ipv6_traffic = ipv6_traffic;
|
cfg->ipv6_traffic = ipv6_traffic;
|
||||||
|
|
||||||
@ -5019,7 +5019,7 @@ check_server_ports(const smartlist_t *ports,
|
|||||||
if (! port->no_advertise) {
|
if (! port->no_advertise) {
|
||||||
++n_orport_advertised;
|
++n_orport_advertised;
|
||||||
if (tor_addr_family(&port->addr) == AF_INET ||
|
if (tor_addr_family(&port->addr) == AF_INET ||
|
||||||
(tor_addr_family(&port->addr) == AF_UNSPEC && !port->ipv6_only))
|
(tor_addr_family(&port->addr) == AF_UNSPEC && !port->bind_ipv6_only))
|
||||||
++n_orport_advertised_ipv4;
|
++n_orport_advertised_ipv4;
|
||||||
}
|
}
|
||||||
if (! port->no_listen)
|
if (! port->no_listen)
|
||||||
@ -5149,8 +5149,8 @@ get_first_advertised_port_by_type_af(int listener_type, int address_family)
|
|||||||
(tor_addr_family(&cfg->addr) == address_family ||
|
(tor_addr_family(&cfg->addr) == address_family ||
|
||||||
tor_addr_family(&cfg->addr) == AF_UNSPEC)) {
|
tor_addr_family(&cfg->addr) == AF_UNSPEC)) {
|
||||||
if (tor_addr_family(&cfg->addr) != AF_UNSPEC ||
|
if (tor_addr_family(&cfg->addr) != AF_UNSPEC ||
|
||||||
(address_family == AF_INET && !cfg->ipv6_only) ||
|
(address_family == AF_INET && !cfg->bind_ipv6_only) ||
|
||||||
(address_family == AF_INET6 && !cfg->ipv4_only)) {
|
(address_family == AF_INET6 && !cfg->bind_ipv4_only)) {
|
||||||
return cfg->port;
|
return cfg->port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3058,8 +3058,8 @@ typedef struct port_cfg_t {
|
|||||||
unsigned int no_advertise : 1;
|
unsigned int no_advertise : 1;
|
||||||
unsigned int no_listen : 1;
|
unsigned int no_listen : 1;
|
||||||
unsigned int all_addrs : 1;
|
unsigned int all_addrs : 1;
|
||||||
unsigned int ipv4_only : 1;
|
unsigned int bind_ipv4_only : 1;
|
||||||
unsigned int ipv6_only : 1;
|
unsigned int bind_ipv6_only : 1;
|
||||||
unsigned int ipv4_traffic : 1;
|
unsigned int ipv4_traffic : 1;
|
||||||
unsigned int ipv6_traffic : 1;
|
unsigned int ipv6_traffic : 1;
|
||||||
|
|
||||||
|
@ -1561,7 +1561,7 @@ router_rebuild_descriptor(int force)
|
|||||||
SMARTLIST_FOREACH_BEGIN(get_configured_ports(), const port_cfg_t *, p) {
|
SMARTLIST_FOREACH_BEGIN(get_configured_ports(), const port_cfg_t *, p) {
|
||||||
if (p->type == CONN_TYPE_OR_LISTENER &&
|
if (p->type == CONN_TYPE_OR_LISTENER &&
|
||||||
! p->no_advertise &&
|
! p->no_advertise &&
|
||||||
! p->ipv4_only &&
|
! p->bind_ipv4_only &&
|
||||||
tor_addr_family(&p->addr) == AF_INET6) {
|
tor_addr_family(&p->addr) == AF_INET6) {
|
||||||
if (! tor_addr_is_internal(&p->addr, 0)) {
|
if (! tor_addr_is_internal(&p->addr, 0)) {
|
||||||
ipv6_orport = p;
|
ipv6_orport = p;
|
||||||
|
Loading…
Reference in New Issue
Block a user