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

[tor-commits] [tor/main] Protover flag handling for congestion control negotiation



commit 1b1c26108050ebf8d739b6c6ce68925cf022ea3c
Author: Mike Perry <mikeperry-git@xxxxxxxxxxxxxx>
Date:   Thu Nov 4 00:47:19 2021 +0000

    Protover flag handling for congestion control negotiation
---
 src/core/or/or.h       |  7 +++----
 src/core/or/protover.c |  6 ++----
 src/core/or/protover.h |  5 +++++
 src/core/or/versions.c | 11 ++++-------
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/core/or/or.h b/src/core/or/or.h
index 22846872a0..885c0e8b11 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -732,10 +732,9 @@ typedef struct protover_summary_flags_t {
    * negotiate hs circuit setup padding. Requires Padding=2. */
   unsigned int supports_hs_setup_padding : 1;
 
-  /** True iff this router supports ntor3 _and_ supports negotiating
-   * additional circuit parameters via the handshake used in ntor3.
-   */
-  unsigned int supports_ntor3_and_param_negotiation : 1;
+  /** True iff this router supports congestion control.
+   * Requires both FlowCtrl=2 *and* Relay=4 */
+  unsigned int supports_congestion_control : 1;
 } protover_summary_flags_t;
 
 typedef struct routerinfo_t routerinfo_t;
diff --git a/src/core/or/protover.c b/src/core/or/protover.c
index 8405a720fb..ff986b62e2 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -430,13 +430,11 @@ protover_get_supported_protocols(void)
    * XXX: WARNING!
    */
 
-  /* TODO-324: Add a new Relay=* and a new FlowCtrl=* version to indicate
-   * support for Ntorv3 and prop324.  Make sure they get into the spec. */
   return
     "Cons=1-2 "
     "Desc=1-2 "
     "DirCache=2 "
-    "FlowCtrl=1 "
+    "FlowCtrl=1-2 "
     "HSDir=2 "
     "HSIntro=4-5 "
     "HSRend=1-2 "
@@ -448,7 +446,7 @@ protover_get_supported_protocols(void)
 #endif
     "Microdesc=1-2 "
     "Padding=2 "
-    "Relay=1-3";
+    "Relay=1-4";
 }
 
 /*
diff --git a/src/core/or/protover.h b/src/core/or/protover.h
index ae258d74a5..410a67a9f7 100644
--- a/src/core/or/protover.h
+++ b/src/core/or/protover.h
@@ -35,6 +35,8 @@ struct smartlist_t;
 /** The protover version number where relays can consider IPv6 connections
  *  canonical */
 #define PROTOVER_RELAY_CANONICAL_IPV6 3
+/** The protover version number where relays can accept ntorv3 */
+#define PROTOVER_RELAY_NTOR_V3 4
 
 /** The protover version number that signifies HSv3 intro point support */
 #define PROTOVER_HS_INTRO_V3 4
@@ -51,6 +53,9 @@ struct smartlist_t;
 /** The protover that signals support for HS circuit setup padding machines */
 #define PROTOVER_HS_SETUP_PADDING 2
 
+/** The protover that signals support for congestion control */
+#define PROTOVER_FLOWCTRL_CC 2
+
 /** List of recognized subprotocols. */
 /// C_RUST_COUPLED: src/rust/protover/ffi.rs `translate_to_rust`
 /// C_RUST_COUPLED: src/rust/protover/protover.rs `Proto`
diff --git a/src/core/or/versions.c b/src/core/or/versions.c
index 052351120e..9913b3ee31 100644
--- a/src/core/or/versions.c
+++ b/src/core/or/versions.c
@@ -482,14 +482,11 @@ memoize_protover_summary(protover_summary_flags_t *out,
     protocol_list_supports_protocol(protocols, PRT_PADDING,
                                     PROTOVER_HS_SETUP_PADDING);
 
-  /* TODO-324: Set these flags based on real values.
-  out->supports_ntor3_and_param_negotiation =
-    protocol_list_supports_protocol(protocols, PRT_RELAY,
-                                    XXXX)
-    &&
+  out->supports_congestion_control =
     protocol_list_supports_protocol(protocols, PRT_FLOWCTRL,
-                                    XXXX);
-  */
+                                    PROTOVER_FLOWCTRL_CC) &&
+    protocol_list_supports_protocol(protocols, PRT_RELAY,
+                                    PROTOVER_RELAY_NTOR_V3);
 
   protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
   cached = strmap_set(protover_summary_map, protocols, new_cached);



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