diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-13 10:10:25 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-13 10:10:25 -0400 |
commit | 59133051f9040717f2f87aa5c2b051eadce2ebdf (patch) | |
tree | 54331997ef3a303f6a00aac377f6d90bfce91703 /src | |
parent | c84ce716dce09eb26f26e3303efa2c0a04a870b7 (diff) | |
download | tor-59133051f9040717f2f87aa5c2b051eadce2ebdf.tar.gz tor-59133051f9040717f2f87aa5c2b051eadce2ebdf.zip |
Update channel_matches_target_addr_for_extend test to current API
Diffstat (limited to 'src')
-rw-r--r-- | src/core/or/channel.c | 9 | ||||
-rw-r--r-- | src/core/or/channel.h | 5 | ||||
-rw-r--r-- | src/test/test_channel.c | 12 |
3 files changed, 11 insertions, 15 deletions
diff --git a/src/core/or/channel.c b/src/core/or/channel.c index e21f5a12ce..20ccf41306 100644 --- a/src/core/or/channel.c +++ b/src/core/or/channel.c @@ -83,13 +83,6 @@ #include "core/or/cell_queue_st.h" -/* Static function prototypes */ - -static bool channel_matches_target_addr_for_extend( - channel_t *chan, - const tor_addr_t *target_ipv4_addr, - const tor_addr_t *target_ipv6_addr); - /* Global lists of channels */ /* All channel_t instances */ @@ -3317,7 +3310,7 @@ channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info) * This function calls into the lower layer and asks if this channel thinks * it matches the target addresses for circuit extension purposes. */ -static bool +STATIC bool channel_matches_target_addr_for_extend(channel_t *chan, const tor_addr_t *target_ipv4_addr, const tor_addr_t *target_ipv6_addr) diff --git a/src/core/or/channel.h b/src/core/or/channel.h index 79e5fea9c5..5fe1fb9cc4 100644 --- a/src/core/or/channel.h +++ b/src/core/or/channel.h @@ -562,7 +562,10 @@ void channel_listener_dumpstats(int severity); #ifdef CHANNEL_FILE_PRIVATE STATIC void channel_add_to_digest_map(channel_t *chan); - +STATIC bool channel_matches_target_addr_for_extend( + channel_t *chan, + const tor_addr_t *target_ipv4_addr, + const tor_addr_t *target_ipv6_addr); #endif /* defined(CHANNEL_FILE_PRIVATE) */ /* Channel operations for subclasses and internal use only */ diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 53ca8d9bba..2b723b4a8d 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1549,8 +1549,8 @@ test_channel_listener(void *arg) orcon->real_addr = addr; \ STMT_END; -#define TEST_MATCHES_ADDR(chan, addr, rv, exp) STMT_BEGIN \ - rv = channel_matches_target_addr_for_extend(chan, &addr); \ +#define TEST_MATCHES_ADDR(chan, addr4, addr6, rv, exp) STMT_BEGIN \ + rv = channel_matches_target_addr_for_extend(chan, addr4, addr6); \ tt_int_op(rv, OP_EQ, exp); \ STMT_END; @@ -1571,18 +1571,18 @@ test_channel_matches_target_addr_for_extend(void *arg) /* Test for IPv4 addresses. */ addr.family = AF_INET; TEST_SETUP_MATCHES_ADDR(orcon, addr, "1.2.3.4", rv); - TEST_MATCHES_ADDR(chan, addr, rv, 1); + TEST_MATCHES_ADDR(chan, &addr, NULL, rv, 1); tor_inet_pton(addr.family, "2.5.3.4", &addr.addr); - TEST_MATCHES_ADDR(chan, addr, rv, 0); + TEST_MATCHES_ADDR(chan, &addr, NULL, rv, 0); /* Test for IPv6 addresses. */ addr.family = AF_INET6; TEST_SETUP_MATCHES_ADDR(orcon, addr, "3:4:7:1:9:8:09:10", rv); - TEST_MATCHES_ADDR(chan, addr, rv, 1); + TEST_MATCHES_ADDR(chan, NULL, &addr, rv, 1); tor_inet_pton(addr.family, "::", &addr.addr); - TEST_MATCHES_ADDR(chan, addr, rv, 0); + TEST_MATCHES_ADDR(chan, NULL, &addr, rv, 0); done: circuitmux_clear_policy(chan->cmux); |