[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Update channel_matches_target_addr_for_extend test to current API



commit 59133051f9040717f2f87aa5c2b051eadce2ebdf
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Jul 13 10:10:25 2020 -0400

    Update channel_matches_target_addr_for_extend test to current API
---
 src/core/or/channel.c   |  9 +--------
 src/core/or/channel.h   |  5 ++++-
 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 e21f5a12c..20ccf4130 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 79e5fea9c..5fe1fb9cc 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 53ca8d9bb..2b723b4a8 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);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits