aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2011-11-28 12:15:58 +0100
committerNick Mathewson <nickm@torproject.org>2011-11-30 11:55:46 -0500
commit2376a6ade4c5258da5512885eba28e3e0461f2a8 (patch)
tree3d310f9a31e82ee76f69e52639bb4094d1b647fb /src/or/connection_or.c
parent529820f8baeaccc6efffde1d9b241eb9f11ce82f (diff)
downloadtor-2376a6ade4c5258da5512885eba28e3e0461f2a8.tar
tor-2376a6ade4c5258da5512885eba28e3e0461f2a8.tar.gz
Merge node_get_{prim,pref,pref_ipv6}_addr with their _orport counterparts.
This keeps the IP address and TCP for a given OR port together, reducing the risk of using an address for one address family with a port of another. Make node_get_addr() a wrapper function for compatibility.
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 24878bfb0..470f6d2a3 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -647,11 +647,11 @@ connection_or_init_conn_from_address(or_connection_t *conn,
tor_addr_copy(&conn->_base.addr, addr);
tor_addr_copy(&conn->real_addr, addr);
if (r) {
- tor_addr_t node_addr;
- node_get_pref_addr(r, &node_addr);
+ tor_addr_port_t node_ap;
+ node_get_pref_orport(r, &node_ap);
/* XXXX proposal 186 is making this more complex. For now, a conn
is canonical when it uses the _preferred_ address. */
- if (tor_addr_eq(&conn->_base.addr, &node_addr))
+ if (tor_addr_eq(&conn->_base.addr, &node_ap.addr))
conn->is_canonical = 1;
if (!started_here) {
/* Override the addr/port, so our log messages will make sense.
@@ -664,12 +664,12 @@ connection_or_init_conn_from_address(or_connection_t *conn,
* right IP address and port 56244, that wouldn't be as helpful. now we
* log the "right" port too, so we know if it's moria1 or moria2.
*/
- tor_addr_copy(&conn->_base.addr, &node_addr);
- conn->_base.port = node_get_pref_orport(r);
+ tor_addr_copy(&conn->_base.addr, &node_ap.addr);
+ conn->_base.port = node_ap.port;
}
conn->nickname = tor_strdup(node_get_nickname(r));
tor_free(conn->_base.address);
- conn->_base.address = tor_dup_addr(&node_addr);
+ conn->_base.address = tor_dup_addr(&node_ap.addr);
} else {
const char *n;
/* If we're an authoritative directory server, we may know a