diff options
author | David Goulet <dgoulet@torproject.org> | 2019-05-09 12:55:52 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-05-20 08:56:34 -0400 |
commit | 590d97bc1065bdb93c70695c91de9c548ef802af (patch) | |
tree | fe954d3f1d016759d24101c5a4f4223359dd7b88 /src/or | |
parent | cbcc570ff4a8e03fc08bfd020d6b4c7365d4d137 (diff) | |
download | tor-590d97bc1065bdb93c70695c91de9c548ef802af.tar.gz tor-590d97bc1065bdb93c70695c91de9c548ef802af.zip |
hs: Define INTRODUCE_ACK status code in trunnel
Remove the hs_intro_ack_status_t enum and move the value into trunnel. Only
use these values from now on in the intro point code.
Interestingly enough, the client side also re-define these values in hs_cell.h
with the hs_cell_introd_ack_status_t enum. Next commit will fix that and force
to use the trunnel ABI.
Part of #30454
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/hs_intropoint.c | 16 | ||||
-rw-r--r-- | src/or/hs_intropoint.h | 7 |
2 files changed, 8 insertions, 15 deletions
diff --git a/src/or/hs_intropoint.c b/src/or/hs_intropoint.c index e0ab27bd36..472e4afe98 100644 --- a/src/or/hs_intropoint.c +++ b/src/or/hs_intropoint.c @@ -336,7 +336,7 @@ hs_intro_received_establish_intro(or_circuit_t *circ, const uint8_t *request, * Return 0 on success else a negative value on error which will close the * circuit. */ static int -send_introduce_ack_cell(or_circuit_t *circ, hs_intro_ack_status_t status) +send_introduce_ack_cell(or_circuit_t *circ, uint16_t status) { int ret = -1; uint8_t *encoded_cell = NULL; @@ -433,7 +433,7 @@ handle_introduce1(or_circuit_t *client_circ, const uint8_t *request, int ret = -1; or_circuit_t *service_circ; trn_cell_introduce1_t *parsed_cell; - hs_intro_ack_status_t status = HS_INTRO_ACK_STATUS_SUCCESS; + uint16_t status = TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS; tor_assert(client_circ); tor_assert(request); @@ -448,14 +448,14 @@ handle_introduce1(or_circuit_t *client_circ, const uint8_t *request, "Rejecting %s INTRODUCE1 cell. Responding with NACK.", cell_size == -1 ? "invalid" : "truncated"); /* Inform client that the INTRODUCE1 has a bad format. */ - status = HS_INTRO_ACK_STATUS_BAD_FORMAT; + status = TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT; goto send_ack; } /* Once parsed validate the cell format. */ if (validate_introduce1_parsed_cell(parsed_cell) < 0) { /* Inform client that the INTRODUCE1 has bad format. */ - status = HS_INTRO_ACK_STATUS_BAD_FORMAT; + status = TRUNNEL_HS_INTRO_ACK_STATUS_BAD_FORMAT; goto send_ack; } @@ -472,7 +472,7 @@ handle_introduce1(or_circuit_t *client_circ, const uint8_t *request, "Responding with NACK.", safe_str(b64_key), client_circ->p_circ_id); /* Inform the client that we don't know the requested service ID. */ - status = HS_INTRO_ACK_STATUS_UNKNOWN_ID; + status = TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID; goto send_ack; } } @@ -485,12 +485,12 @@ handle_introduce1(or_circuit_t *client_circ, const uint8_t *request, log_warn(LD_PROTOCOL, "Unable to send INTRODUCE2 cell to the service."); /* Inform the client that we can't relay the cell. Use the unknown ID * status code since it means that we do not know the service. */ - status = HS_INTRO_ACK_STATUS_UNKNOWN_ID; + status = TRUNNEL_HS_INTRO_ACK_STATUS_UNKNOWN_ID; goto send_ack; } /* Success! Send an INTRODUCE_ACK success status onto the client circuit. */ - status = HS_INTRO_ACK_STATUS_SUCCESS; + status = TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS; ret = 0; send_ack: @@ -501,7 +501,7 @@ handle_introduce1(or_circuit_t *client_circ, const uint8_t *request, /* Circuit has been closed on failure of transmission. */ goto done; } - if (status != HS_INTRO_ACK_STATUS_SUCCESS) { + if (status != TRUNNEL_HS_INTRO_ACK_STATUS_SUCCESS) { /* We just sent a NACK that is a non success status code so close the * circuit because it's not useful to keep it open. Remember, a client can * only send one INTRODUCE1 cell on a circuit. */ diff --git a/src/or/hs_intropoint.h b/src/or/hs_intropoint.h index 014f9339a6..1c2cc564ab 100644 --- a/src/or/hs_intropoint.h +++ b/src/or/hs_intropoint.h @@ -19,13 +19,6 @@ typedef enum { HS_INTRO_AUTH_KEY_TYPE_ED25519 = 0x02, } hs_intro_auth_key_type_t; -/* INTRODUCE_ACK status code. */ -typedef enum { - HS_INTRO_ACK_STATUS_SUCCESS = 0x0000, - HS_INTRO_ACK_STATUS_UNKNOWN_ID = 0x0001, - HS_INTRO_ACK_STATUS_BAD_FORMAT = 0x0002, -} hs_intro_ack_status_t; - /* Object containing introduction point common data between the service and * the client side. */ typedef struct hs_intropoint_t { |