summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-08-05 20:08:19 +0000
committerNick Mathewson <nickm@torproject.org>2008-08-05 20:08:19 +0000
commit960a0f0a994ba23480e14ffe5179160194fd9616 (patch)
tree250494775699fda2f0f543a350b02e89c5a77a03 /src/or/router.c
parent750bb795ac1fcb5b76b6488690400c77fbff0a3f (diff)
downloadtor-960a0f0a994ba23480e14ffe5179160194fd9616.tar.gz
tor-960a0f0a994ba23480e14ffe5179160194fd9616.zip
r17641@31-33-44: nickm | 2008-08-05 16:07:53 -0400
Initial conversion of uint32_t addr to tor_addr_t addr in connection_t and related types. Most of the Tor wire formats using these new types are in, but the code to generate and use it is not. This is a big patch. Let me know what it breaks for you. svn:r16435
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/or/router.c b/src/or/router.c
index bd8cb8351e..842cb7b52a 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -736,6 +736,7 @@ consider_testing_reachability(int test_or, int test_dir)
{
routerinfo_t *me = router_get_my_routerinfo();
int orport_reachable = check_whether_orport_reachable();
+ tor_addr_t addr;
if (!me)
return;
@@ -750,12 +751,13 @@ consider_testing_reachability(int test_or, int test_dir)
me->address, me->or_port);
}
+ tor_addr_from_ipv4h(&addr, me->addr);
if (test_dir && !check_whether_dirport_reachable() &&
!connection_get_by_type_addr_port_purpose(
- CONN_TYPE_DIR, me->addr, me->dir_port,
+ CONN_TYPE_DIR, &addr, me->dir_port,
DIR_PURPOSE_FETCH_SERVERDESC)) {
/* ask myself, via tor, for my server descriptor. */
- directory_initiate_command(me->address, me->addr,
+ directory_initiate_command(me->address, &addr,
me->or_port, me->dir_port,
0, /* does not matter */
0, me->cache_info.identity_digest,
@@ -1111,10 +1113,10 @@ router_compare_to_my_exit_policy(edge_connection_t *conn)
/* make sure it's resolved to something. this way we can't get a
'maybe' below. */
- if (!conn->_base.addr)
+ if (tor_addr_is_null(&conn->_base.addr))
return -1;
- return compare_addr_to_addr_policy(conn->_base.addr, conn->_base.port,
+ return compare_tor_addr_to_addr_policy(&conn->_base.addr, conn->_base.port,
desc_routerinfo->exit_policy) != ADDR_POLICY_ACCEPTED;
}
@@ -1543,7 +1545,7 @@ router_new_address_suggestion(const char *suggestion,
/* Don't believe anybody who says our IP is, say, 127.0.0.1. */
return;
}
- if (addr == d_conn->_base.addr) {
+ if (tor_addr_eq_ipv4h(&d_conn->_base.addr, addr)) {
/* Don't believe anybody who says our IP is their IP. */
log_debug(LD_DIR, "A directory server told us our IP address is %s, "
"but he's just reporting his own IP address. Ignoring.",