[or-cvs] ACK/NAK INTRODUCE1 requests. (We do no useful processing o...
Nick Mathewson
nickm at seul.org
Mon Apr 12 23:33:49 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv4222/src/or
Modified Files:
connection_edge.c or.h rendclient.c rendcommon.c rendmid.c
Log Message:
ACK/NAK INTRODUCE1 requests. (We do no useful processing on them yet)
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- connection_edge.c 9 Apr 2004 21:31:09 -0000 1.156
+++ connection_edge.c 12 Apr 2004 23:33:47 -0000 1.157
@@ -449,6 +449,7 @@
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:
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -d -r1.312 -r1.313
--- or.h 12 Apr 2004 22:47:12 -0000 1.312
+++ or.h 12 Apr 2004 23:33:47 -0000 1.313
@@ -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 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);
Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rendclient.c 8 Apr 2004 03:18:03 -0000 1.29
+++ rendclient.c 12 Apr 2004 23:33:47 -0000 1.30
@@ -137,6 +137,22 @@
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.
*/
Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rendcommon.c 12 Apr 2004 09:44:38 -0000 1.26
+++ rendcommon.c 12 Apr 2004 23:33:47 -0000 1.27
@@ -291,6 +291,9 @@
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;
Index: rendmid.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendmid.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- rendmid.c 12 Apr 2004 18:10:28 -0000 1.17
+++ rendmid.c 12 Apr 2004 23:33:47 -0000 1.18
@@ -112,6 +112,7 @@
{
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 @@
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;
}
More information about the tor-commits
mailing list