aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/policies.c
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2018-07-31 08:41:21 -0400
committerteor <teor@torproject.org>2019-04-24 17:28:34 +1000
commit26183476575abf0f8daccc2f4ca8be4ba0e2a5de (patch)
tree0ceef75dd9ca28d08122b9bc5abbb14f6e26b3e6 /src/core/or/policies.c
parentda268e3b508fb5f9ab3b930deded331c387f7243 (diff)
downloadtor-26183476575abf0f8daccc2f4ca8be4ba0e2a5de.tar.gz
tor-26183476575abf0f8daccc2f4ca8be4ba0e2a5de.zip
Use fascist_firewall_choose_address_ls() in hs_get_extend_info_from_lspecs()
Diffstat (limited to 'src/core/or/policies.c')
-rw-r--r--src/core/or/policies.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/core/or/policies.c b/src/core/or/policies.c
index 26a053821a..b58a5c9cb6 100644
--- a/src/core/or/policies.c
+++ b/src/core/or/policies.c
@@ -1017,17 +1017,26 @@ fascist_firewall_choose_address_rs(const routerstatus_t *rs,
}
/** Like fascist_firewall_choose_address_base(), but takes in a smartlist
- * <b>lspecs</b> consisting of one or more link specifiers.
+ * <b>lspecs</b> consisting of one or more link specifiers. We assume
+ * fw_connection is FIREWALL_OR_CONNECTION as link specifiers cannot
+ * contain DirPorts.
*/
void
fascist_firewall_choose_address_ls(const smartlist_t *lspecs,
- int pref_only, tor_addr_port_t* ap,
- int direct_conn)
+ int pref_only, tor_addr_port_t* ap)
{
int have_v4 = 0, have_v6 = 0;
uint16_t port_v4 = 0, port_v6 = 0;
tor_addr_t addr_v4, addr_v6;
+ tor_assert(ap);
+
+ tor_addr_make_null(&ap->addr, AF_UNSPEC);
+ ap->port = 0;
+
+ tor_addr_make_null(&addr_v4, AF_INET);
+ tor_addr_make_null(&addr_v6, AF_INET6);
+
SMARTLIST_FOREACH_BEGIN(lspecs, const link_specifier_t *, ls) {
switch (link_specifier_get_ls_type(ls)) {
case LS_IPV4:
@@ -1041,7 +1050,7 @@ fascist_firewall_choose_address_ls(const smartlist_t *lspecs,
case LS_IPV6:
/* Skip if we already seen a v6, or deliberately skip it if we're not a
* direct connection. */
- if (have_v6 || !direct_conn) continue;
+ if (have_v6) continue;
tor_addr_from_ipv6_bytes(&addr_v6,
(const char *) link_specifier_getconstarray_un_ipv6_addr(ls));
port_v6 = link_specifier_get_un_ipv6_port(ls);
@@ -1053,11 +1062,6 @@ fascist_firewall_choose_address_ls(const smartlist_t *lspecs,
}
} SMARTLIST_FOREACH_END(ls);
- tor_assert(ap);
-
- tor_addr_make_null(&ap->addr, AF_UNSPEC);
- ap->port = 0;
-
/* Here, don't check for DirPorts as link specifiers are only used for
* ORPorts. */
const or_options_t *options = get_options();