]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add relay cell format field to circuits
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2025 17:24:44 +0000 (13:24 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 5 May 2025 17:07:04 +0000 (13:07 -0400)
For client circuits, it is a per-hop field;
for OR circuits, it is a per-circuit field.

src/core/mainloop/cpuworker.c
src/core/or/crypt_path.c
src/core/or/crypt_path_st.h
src/core/or/or_circuit_st.h
src/feature/hs/hs_circuit.c

index 602ebda22821f658ff1624af9e9626635ecf27f7..9f8a88b6de505f4b55cdf95019118c9ffb8c2174 100644 (file)
@@ -451,6 +451,9 @@ cpuworker_onion_handshake_replyfn(void *work_)
     }
   }
 
+  // TODO CGO: Initialize this from a real handshake.
+  circ->relay_cell_format = RELAY_CELL_FORMAT_V0;
+
   if (onionskin_answer(circ,
                        &rpl.created_cell,
                        (const char*)rpl.keys, sizeof(rpl.keys),
index 7673bc306f1be6f9bffebee8e3a017bac2427952..f12bd964e3d20fafa4efa5fe60bc5a8ee9d9fc2e 100644 (file)
@@ -71,6 +71,9 @@ cpath_append_hop(crypt_path_t **head_ptr, extend_info_t *choice)
   hop->package_window = circuit_initial_package_window();
   hop->deliver_window = CIRCWINDOW_START;
 
+  // TODO CGO: Initialize this from a real decision.
+  hop->relay_cell_format = RELAY_CELL_FORMAT_V0;
+
   return 0;
 }
 
index fc6391f2f8a86cd8e1913b892ab2dddb1ded5d82..5f023e9f4fa1746c0c8704b89b618f56a2c7788d 100644 (file)
@@ -87,6 +87,9 @@ struct crypt_path_t {
   /** Congestion control info */
   struct congestion_control_t *ccontrol;
 
+  /** Format to use when exchanging relay cells with this relay. */
+  relay_cell_fmt_t relay_cell_format;
+
   /*********************** Private members ****************************/
 
   /** Private member: Cryptographic state used for encrypting and
index 28e357338ad6c7bf966dab3bd4478645aa2eaa64..0497d2058f68d7b7d9e585d14bad704f90b755ac 100644 (file)
@@ -106,6 +106,10 @@ struct or_circuit_t {
   /** RELAY_BEGIN and RELAY_RESOLVE cell bucket controlling how much can go on
    * this circuit. Only used if this is the end of a circuit on an exit node.*/
   token_bucket_ctr_t stream_limiter;
+
+  /** Format to use when exchanging relay cells with the client
+   * who built this circuit. */
+  relay_cell_fmt_t relay_cell_format;
 };
 
 #endif /* !defined(OR_CIRCUIT_ST_H) */
index 43b563b48a4e933ff38c1fc4cba68b8586956105..306550f99cd3de6d72c8045ff92663077c95f4ca 100644 (file)
@@ -110,6 +110,9 @@ create_rend_cpath(const uint8_t *ntor_key_seed, size_t seed_len,
   cpath = tor_malloc_zero(sizeof(crypt_path_t));
   cpath->magic = CRYPT_PATH_MAGIC;
 
+  // TODO CGO: Pick relay cell format based on capabilities.
+  cpath->relay_cell_format = RELAY_CELL_FORMAT_V0;
+
   if (cpath_init_circuit_crypto(cpath, (char*)keys, sizeof(keys),
                                 is_service_side, 1) < 0) {
     tor_free(cpath);