
commit bd45f7c6685f887ead3432104cea156cbcc3e3a6 Merge: a3d4196 a60ef72 Author: Nick Mathewson <nickm@torproject.org> Date: Tue Aug 23 09:22:04 2016 -0400 Merge branch 'bug13953_squashed' changes/bug13953 | 3 ++ src/or/config.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++----- src/or/config.h | 6 +++ src/or/router.c | 81 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 196 insertions(+), 10 deletions(-) diff --cc src/or/config.c index 941393a,2fd97de..6fb3614 --- a/src/or/config.c +++ b/src/or/config.c @@@ -7063,15 -7021,15 +7078,15 @@@ get_first_listener_addrport_string(int int get_first_advertised_port_by_type_af(int listener_type, int address_family) { + if (address_family == AF_UNSPEC) + return 0; - if (!configured_ports) - return 0; - SMARTLIST_FOREACH_BEGIN(configured_ports, const port_cfg_t *, cfg) { ++ + const smartlist_t *conf_ports = get_configured_ports(); + SMARTLIST_FOREACH_BEGIN(conf_ports, const port_cfg_t *, cfg) { if (cfg->type == listener_type && - !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->server_cfg.bind_ipv6_only) || - (address_family == AF_INET6 && !cfg->server_cfg.bind_ipv4_only)) { + !cfg->server_cfg.no_advertise) { + if ((address_family == AF_INET && port_binds_ipv4(cfg)) || + (address_family == AF_INET6 && port_binds_ipv6(cfg))) { return cfg->port; } }