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

[tor-commits] [tor/master] hs-v3: Rename validation function in hs_intropoint.c



commit 622c2c7884fd656b5140245c4695a5a145dc04fd
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Aug 20 10:59:04 2019 -0400

    hs-v3: Rename validation function in hs_intropoint.c
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/feature/hs/hs_intropoint.c |  8 ++++----
 src/feature/hs/hs_intropoint.h |  6 +++---
 src/test/test_hs_dos.c         | 14 +++++++-------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/feature/hs/hs_intropoint.c b/src/feature/hs/hs_intropoint.c
index fb2ac52e5..90a7f2894 100644
--- a/src/feature/hs/hs_intropoint.c
+++ b/src/feature/hs/hs_intropoint.c
@@ -186,8 +186,8 @@ hs_intro_send_intro_established_cell,(or_circuit_t *circ))
  * bound check and can be used. Else return false. See proposal 305 for
  * details and reasons about this validation. */
 STATIC bool
-validate_cell_dos_extension_parameters(uint64_t intro2_rate_per_sec,
-                                       uint64_t intro2_burst_per_sec)
+cell_dos_extension_parameters_are_valid(uint64_t intro2_rate_per_sec,
+                                        uint64_t intro2_burst_per_sec)
 {
   bool ret = false;
 
@@ -296,8 +296,8 @@ handle_establish_intro_cell_dos_extension(
   }
 
   /* If invalid, we disable the defense on the circuit. */
-  if (!validate_cell_dos_extension_parameters(intro2_rate_per_sec,
-                                              intro2_burst_per_sec)) {
+  if (!cell_dos_extension_parameters_are_valid(intro2_rate_per_sec,
+                                               intro2_burst_per_sec)) {
     circ->introduce2_dos_defense_enabled = 0;
     log_info(LD_REND, "Disabling INTRO2 DoS defenses on circuit id %u",
              circ->p_circ_id);
diff --git a/src/feature/hs/hs_intropoint.h b/src/feature/hs/hs_intropoint.h
index 1bebcacd8..94ebf021e 100644
--- a/src/feature/hs/hs_intropoint.h
+++ b/src/feature/hs/hs_intropoint.h
@@ -57,9 +57,9 @@ STATIC int handle_introduce1(or_circuit_t *client_circ,
                              const uint8_t *request, size_t request_len);
 STATIC int validate_introduce1_parsed_cell(const trn_cell_introduce1_t *cell);
 STATIC int circuit_is_suitable_for_introduce1(const or_circuit_t *circ);
-STATIC bool validate_cell_dos_extension_parameters(
-                                        uint64_t intro2_rate_per_sec,
-                                        uint64_t intro2_burst_per_sec);
+STATIC bool cell_dos_extension_parameters_are_valid(
+                                          uint64_t intro2_rate_per_sec,
+                                          uint64_t intro2_burst_per_sec);
 
 #endif /* defined(HS_INTROPOINT_PRIVATE) */
 
diff --git a/src/test/test_hs_dos.c b/src/test/test_hs_dos.c
index 03c755acb..f68639e24 100644
--- a/src/test/test_hs_dos.c
+++ b/src/test/test_hs_dos.c
@@ -135,23 +135,23 @@ test_validate_dos_extension_params(void *arg)
   (void) arg;
 
   /* Validate the default values. */
-  ret = validate_cell_dos_extension_parameters(
-                                    get_intro2_rate_consensus_param(NULL),
-                                    get_intro2_burst_consensus_param(NULL));
+  ret = cell_dos_extension_parameters_are_valid(
+                                      get_intro2_rate_consensus_param(NULL),
+                                      get_intro2_burst_consensus_param(NULL));
   tt_assert(ret);
 
   /* Valid custom rate/burst. */
-  ret = validate_cell_dos_extension_parameters(17, 42);
+  ret = cell_dos_extension_parameters_are_valid(17, 42);
   tt_assert(ret);
   ret = cell_dos_extension_parameters_are_valid(INT32_MAX, INT32_MAX);
   tt_assert(ret);
 
   /* Invalid rate. */
-  ret = validate_cell_dos_extension_parameters(UINT64_MAX, 42);
+  ret = cell_dos_extension_parameters_are_valid(UINT64_MAX, 42);
   tt_assert(!ret);
 
   /* Invalid burst. */
-  ret = validate_cell_dos_extension_parameters(42, UINT64_MAX);
+  ret = cell_dos_extension_parameters_are_valid(42, UINT64_MAX);
   tt_assert(!ret);
 
   /* Value of 0 is valid (but should disable defenses) */
@@ -159,7 +159,7 @@ test_validate_dos_extension_params(void *arg)
   tt_assert(ret);
 
   /* Can't have burst smaller than rate. */
-  ret = validate_cell_dos_extension_parameters(42, 40);
+  ret = cell_dos_extension_parameters_are_valid(42, 40);
   tt_assert(!ret);
 
  done:



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