router: Authorities add their own IPv6 to trusted dir servers

Authorities currently add themselves to the trusted dir servers list,
but if they have an IPv6 ORPort, they leave it out.

This commit makes authorities add their own IPv6 ORPort to the trusted
dir servers list.

Closes ticket 32822.
This commit is contained in:
teor 2019-12-20 14:31:49 +10:00 committed by David Goulet
parent 538b25241e
commit 1f58b0ca26
3 changed files with 9 additions and 2 deletions

5
changes/ticket32822 Normal file
View File

@ -0,0 +1,5 @@
o Minor features (directory authorities, IPv6):
- Make authorities add their IPv6 ORPort (if any) to the trusted dir
servers list. Authorities currently add themselves to the trusted dir
servers list, but they only add their IPv4 address and ports to the list.
Closes ticket 32822.

View File

@ -294,7 +294,7 @@ dir_server_new(int is_authority,
ent->is_authority = is_authority; ent->is_authority = is_authority;
ent->type = type; ent->type = type;
ent->weight = weight; ent->weight = weight;
if (addrport_ipv6) { if (addrport_ipv6 && tor_addr_port_is_valid_ap(addrport_ipv6, 0)) {
if (tor_addr_family(&addrport_ipv6->addr) != AF_INET6) { if (tor_addr_family(&addrport_ipv6->addr) != AF_INET6) {
log_warn(LD_BUG, "Hey, I got a non-ipv6 addr as addrport_ipv6."); log_warn(LD_BUG, "Hey, I got a non-ipv6 addr as addrport_ipv6.");
tor_addr_make_unspec(&ent->ipv6_addr); tor_addr_make_unspec(&ent->ipv6_addr);

View File

@ -1148,10 +1148,12 @@ init_keys(void)
ds = router_get_trusteddirserver_by_digest(digest); ds = router_get_trusteddirserver_by_digest(digest);
if (!ds) { if (!ds) {
tor_addr_port_t ipv6_orport;
router_get_advertised_ipv6_or_ap(options, &ipv6_orport);
ds = trusted_dir_server_new(options->Nickname, NULL, ds = trusted_dir_server_new(options->Nickname, NULL,
router_get_advertised_dir_port(options, 0), router_get_advertised_dir_port(options, 0),
router_get_advertised_or_port(options), router_get_advertised_or_port(options),
NULL, &ipv6_orport,
digest, digest,
v3_digest, v3_digest,
type, 0.0); type, 0.0);