diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-16 14:36:54 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-17 11:42:49 -0400 |
commit | 7b3bd45cfe400deb2420afa0018c642402cc4f94 (patch) | |
tree | 8b3b46311ff19d3f62c177773d58660adb365f73 /src/test/test_connection.c | |
parent | 44da9206701a2b157474f94ccf64996dce192924 (diff) | |
download | tor-7b3bd45cfe400deb2420afa0018c642402cc4f94.tar.gz tor-7b3bd45cfe400deb2420afa0018c642402cc4f94.zip |
or_connection_t: replace real_addr with canonical_orport.
Instead of replacing connection_t.{addr,port} with a canonical
orport, and tracking the truth in real_addr, we now leave
connection_t.addr alone, and put the canonical address in
canonical_orport.
Closes #40042
Closes #33898
Diffstat (limited to 'src/test/test_connection.c')
-rw-r--r-- | src/test/test_connection.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/test/test_connection.c b/src/test/test_connection.c index e9be04656b..954aeb82e3 100644 --- a/src/test/test_connection.c +++ b/src/test/test_connection.c @@ -911,7 +911,8 @@ test_failed_orconn_tracker(void *arg) /* Prepare the OR connection that will be used in this test */ or_connection_t or_conn; - tt_int_op(AF_INET,OP_EQ, tor_addr_parse(&or_conn.real_addr, "18.0.0.1")); + tt_int_op(AF_INET,OP_EQ, tor_addr_parse(&or_conn.canonical_orport.addr, + "18.0.0.1")); tt_int_op(AF_INET,OP_EQ, tor_addr_parse(&or_conn.base_.addr, "18.0.0.1")); or_conn.base_.port = 1; memset(or_conn.identity_digest, 'c', sizeof(or_conn.identity_digest)); @@ -1048,17 +1049,20 @@ test_conn_describe(void *arg) tt_str_op(connection_describe(conn), OP_EQ, "OR connection (open) with [ffff:3333:1111::2]:8080 " "ID=0000000700000000000000000000000000000000"); - // Add a 'real address' that is the same as the one we have. - tor_addr_parse(&TO_OR_CONN(conn)->real_addr, "[ffff:3333:1111::2]"); + // Add a 'canonical address' that is the same as the one we have. + tor_addr_parse(&TO_OR_CONN(conn)->canonical_orport.addr, + "[ffff:3333:1111::2]"); + TO_OR_CONN(conn)->canonical_orport.port = 8080; tt_str_op(connection_describe(conn), OP_EQ, "OR connection (open) with [ffff:3333:1111::2]:8080 " "ID=0000000700000000000000000000000000000000"); - // Add a different 'real address' - tor_addr_parse(&TO_OR_CONN(conn)->real_addr, "[ffff:3333:1111::8]"); + // Add a different 'canonical address' + tor_addr_parse(&TO_OR_CONN(conn)->canonical_orport.addr, + "[ffff:3333:1111::8]"); tt_str_op(connection_describe(conn), OP_EQ, - "OR connection (open) with [ffff:3333:1111::8]:8080 " + "OR connection (open) with [ffff:3333:1111::2]:8080 " "ID=0000000700000000000000000000000000000000 " - "canonical_addr=[ffff:3333:1111::2]"); + "canonical_addr=[ffff:3333:1111::8]:8080"); // Clear identity_digest so that free_minimal won't complain. memset(TO_OR_CONN(conn)->identity_digest, 0, DIGEST_LEN); |