trunnel: Centralize the INTRO1 extension type

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet
2022-06-29 12:00:41 -04:00
committed by Micah Elizabeth Scott
parent 4eb783e97b
commit 35227a7a15
3 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -457,7 +457,7 @@ build_introduce_cc_extension(trn_extension_t *extensions)
/* Build CC request extension. */
field = trn_extension_field_new();
trn_extension_field_set_field_type(field,
TRUNNEL_EXT_TYPE_CC_FIELD_REQUEST);
TRUNNEL_EXT_TYPE_CC_REQUEST);
/* No payload indicating a request to use congestion control. */
trn_extension_field_set_field_len(field, 0);
@@ -933,7 +933,7 @@ parse_introduce_cell_extension(const hs_service_t *service,
tor_assert(field);
switch (trn_extension_field_get_field_type(field)) {
case TRUNNEL_EXT_TYPE_CC_FIELD_REQUEST:
case TRUNNEL_EXT_TYPE_CC_REQUEST:
/* CC requests, enable it. */
data->rdv_data.cc_enabled = 1;
data->pv.protocols_known = 1;
+1
View File
@@ -19,6 +19,7 @@ struct link_specifier_st;
#define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_LEGACY1 1
#define TRUNNEL_HS_INTRO_AUTH_KEY_TYPE_ED25519 2
#define TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR 1
#define TRUNNEL_EXT_TYPE_CC_REQUEST 1
#define TRUNNEL_EXT_TYPE_POW 2
#define TRUNNEL_POW_NONCE_LEN 16
#define TRUNNEL_POW_SOLUTION_LEN 16
+2
View File
@@ -78,6 +78,8 @@ struct trn_cell_introduce_encrypted {
* INTRODUCE1 cell (encrypted section) extensions.
*/
/* Cell extenstion type Congestion Control Request. */
const TRUNNEL_EXT_TYPE_CC_REQUEST = 0x01;
/* Cell extension type PoW. */
const TRUNNEL_EXT_TYPE_POW = 0x02;