mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
ACK/NAK INTRODUCE1 requests. (We do no useful processing on them yet)
svn:r1597
This commit is contained in:
@@ -449,6 +449,7 @@ int connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
|
||||
case RELAY_COMMAND_ESTABLISH_RENDEZVOUS:
|
||||
case RELAY_COMMAND_INTRODUCE1:
|
||||
case RELAY_COMMAND_INTRODUCE2:
|
||||
case RELAY_COMMAND_INTRODUCE_ACK:
|
||||
case RELAY_COMMAND_RENDEZVOUS1:
|
||||
case RELAY_COMMAND_RENDEZVOUS2:
|
||||
case RELAY_COMMAND_INTRO_ESTABLISHED:
|
||||
|
||||
+6
-4
@@ -247,11 +247,12 @@
|
||||
#define RELAY_COMMAND_ESTABLISH_RENDEZVOUS 33
|
||||
#define RELAY_COMMAND_INTRODUCE1 34
|
||||
#define RELAY_COMMAND_INTRODUCE2 35
|
||||
#define RELAY_COMMAND_RENDEZVOUS1 36
|
||||
#define RELAY_COMMAND_RENDEZVOUS2 37
|
||||
#define RELAY_COMMAND_INTRODUCE_ACK 36
|
||||
#define RELAY_COMMAND_RENDEZVOUS1 37
|
||||
#define RELAY_COMMAND_RENDEZVOUS2 38
|
||||
/* DOCDOC Spec these next two. */
|
||||
#define RELAY_COMMAND_INTRO_ESTABLISHED 38
|
||||
#define RELAY_COMMAND_RENDEZVOUS_ESTABLISHED 39
|
||||
#define RELAY_COMMAND_INTRO_ESTABLISHED 39
|
||||
#define RELAY_COMMAND_RENDEZVOUS_ESTABLISHED 40
|
||||
|
||||
#define _MIN_END_STREAM_REASON 1
|
||||
#define END_STREAM_REASON_MISC 1
|
||||
@@ -1057,6 +1058,7 @@ void rep_hist_dump_stats(time_t now, int severity);
|
||||
|
||||
void rend_client_introcirc_is_open(circuit_t *circ);
|
||||
void rend_client_rendcirc_is_open(circuit_t *circ);
|
||||
int rend_client_introduction_acked(circuit_t *circ, const char *request, int request_len);
|
||||
int rend_client_rendezvous_acked(circuit_t *circ, const char *request, int request_len);
|
||||
int rend_client_receive_rendezvous(circuit_t *circ, const char *request, int request_len);
|
||||
void rend_client_desc_fetched(char *query, int success);
|
||||
|
||||
@@ -137,6 +137,22 @@ rend_client_rendcirc_is_open(circuit_t *circ)
|
||||
connection_ap_attach_pending();
|
||||
}
|
||||
|
||||
/* Called when get an ACK or a NAK for a REND_INTRODUCE1 cell.
|
||||
*/
|
||||
int
|
||||
rend_client_introduction_acked(circuit_t *introcirc,
|
||||
const char *request, int request_len)
|
||||
{
|
||||
if (request_len == 0) {
|
||||
/* It's an ACK; the introduction point relayed our introduction request. */
|
||||
/* XXXX writeme */
|
||||
} else {
|
||||
/* It's a NAK; the introduction point didn't relay our request. */
|
||||
/* XXXX writeme */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called when we receive a RENDEZVOUS_ESTABLISHED cell; changes the state of
|
||||
* the circuit to C_REND_READY.
|
||||
*/
|
||||
|
||||
@@ -291,6 +291,9 @@ void rend_process_relay_cell(circuit_t *circ, int command, int length,
|
||||
case RELAY_COMMAND_INTRODUCE2:
|
||||
r = rend_service_introduce(circ,payload,length);
|
||||
break;
|
||||
case RELAY_COMMAND_INTRODUCE_ACK:
|
||||
r = rend_client_introduction_acked(circ,payload,length);
|
||||
break;
|
||||
case RELAY_COMMAND_RENDEZVOUS1:
|
||||
r = rend_mid_rendezvous(circ,payload,length);
|
||||
break;
|
||||
|
||||
+15
-1
@@ -112,6 +112,7 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
|
||||
{
|
||||
circuit_t *intro_circ;
|
||||
char serviceid[REND_SERVICE_ID_LEN+1];
|
||||
char nak_body[1];
|
||||
|
||||
if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
|
||||
log_fn(LOG_WARN, "Rejecting INTRODUCE1 on non-OR or non-edge circuit %d",
|
||||
@@ -153,10 +154,23 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
|
||||
log_fn(LOG_WARN, "Unable to send INTRODUCE2 cell to OP.");
|
||||
goto err;
|
||||
}
|
||||
/* And sent an ack down the cirecuit. Empty body->succeeded. */
|
||||
if (connection_edge_send_command(NULL,circ,RELAY_COMMAND_INTRODUCE_ACK,
|
||||
NULL,0,NULL)) {
|
||||
log_fn(LOG_WARN, "Unable to send INTRODUCE_ACK cell to OP.");
|
||||
circuit_mark_for_close(circ);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
circuit_mark_for_close(circ); /* Is this right? */
|
||||
/* Send the client an ACK */
|
||||
nak_body[0] = 1;
|
||||
if (connection_edge_send_command(NULL,circ,RELAY_COMMAND_INTRODUCE_ACK,
|
||||
nak_body, 1, NULL)) {
|
||||
log_fn(LOG_WARN, "Unable to send NAK to OP");
|
||||
circuit_mark_for_close(circ); /* Is this right? */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user