diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-12 23:33:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-12 23:33:47 +0000 |
commit | a5bfe845096b13f676c57cfbebb9409bacbfa124 (patch) | |
tree | 6e3a13d210c91af6b5eb5874ddb7642b95465341 | |
parent | f4ff5a75c141b671432cd1b9a9a0e102ca872562 (diff) | |
download | tor-a5bfe845096b13f676c57cfbebb9409bacbfa124.tar tor-a5bfe845096b13f676c57cfbebb9409bacbfa124.tar.gz |
ACK/NAK INTRODUCE1 requests. (We do no useful processing on them yet)
svn:r1597
-rw-r--r-- | src/or/connection_edge.c | 1 | ||||
-rw-r--r-- | src/or/or.h | 10 | ||||
-rw-r--r-- | src/or/rendclient.c | 16 | ||||
-rw-r--r-- | src/or/rendcommon.c | 3 | ||||
-rw-r--r-- | src/or/rendmid.c | 16 |
5 files changed, 41 insertions, 5 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index f5db25d0d..c5d95be70 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -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: diff --git a/src/or/or.h b/src/or/or.h index 0ddbef0b4..dfc52a2d6 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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); diff --git a/src/or/rendclient.c b/src/or/rendclient.c index aa32ead26..18edb0e18 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -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. */ diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 91ec38b96..7ace58775 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -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; diff --git a/src/or/rendmid.c b/src/or/rendmid.c index 4ab87cbaa..80e7818f9 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -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; } |