aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-29 08:04:41 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:18 -0500
commit1d52ac4d3f67a6e3fac3602f87d00c14060068ab (patch)
tree6c46116e71af72e049d0f278a85ea09567b6d3ac /src/common
parent89f5f149df984bab00de9868a9305b611c4aa17e (diff)
downloadtor-1d52ac4d3f67a6e3fac3602f87d00c14060068ab.tar.gz
tor-1d52ac4d3f67a6e3fac3602f87d00c14060068ab.zip
Lay down some infrastructure for bridges in the New Guard Order.
This includes: * making bridge_info_t exposed but opaque * allowing guards where we don't know an identity * making it possible to learn the identity of a guard * creating a guard that lacks a node_t * remembering a guard's address and port. * Looking up a guard by address and port. * Only enforcing the rule that we need a live consensus to update the "listed" status for guards when we are not using bridges.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c8
-rw-r--r--src/common/address.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c
index 773e688554..1bb0c077d1 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -2121,3 +2121,11 @@ tor_addr_port_new(const tor_addr_t *addr, uint16_t port)
return ap;
}
+/** Return true iff <a>a</b> and <b>b</b> are the same address and port */
+int
+tor_addr_port_eq(const tor_addr_port_t *a,
+ const tor_addr_port_t *b)
+{
+ return tor_addr_eq(&a->addr, &b->addr) && a->port == b->port;
+}
+
diff --git a/src/common/address.h b/src/common/address.h
index 51db42c315..41daf012e6 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -342,6 +342,8 @@ get_interface_address_list(int severity, int include_internal)
}
tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port);
+int tor_addr_port_eq(const tor_addr_port_t *a,
+ const tor_addr_port_t *b);
#ifdef ADDRESS_PRIVATE
MOCK_DECL(smartlist_t *,get_interface_addresses_raw,(int severity,