[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] change 0.0.8 extend cell format so it"s compatible with 0.0.7



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuitbuild.c 
Log Message:
change 0.0.8 extend cell format so it's compatible with 0.0.7


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- circuitbuild.c	21 Jul 2004 09:35:24 -0000	1.16
+++ circuitbuild.c	22 Jul 2004 03:47:20 -0000	1.17
@@ -401,15 +401,10 @@
 
     *(uint32_t*)payload = htonl(hop->addr);
     *(uint16_t*)(payload+4) = htons(hop->port);
-    if (strncmp(router->platform, "Tor 0.0.7", 9)) {
-      /* Before 0.0.8, we didn't support the long payload format. */
-      memcpy(payload+2+4, hop->identity_digest, DIGEST_LEN);
-      onionskin = payload+2+4+DIGEST_LEN;
-      payload_len = 2+4+DIGEST_LEN+ONIONSKIN_CHALLENGE_LEN;
-    } else {
-      onionskin = payload+2+4;
-      payload_len = 2+4+ONIONSKIN_CHALLENGE_LEN;
-    }
+
+    onionskin = payload+2+4;
+    memcpy(payload+2+4+ONIONSKIN_CHALLENGE_LEN, hop->identity_digest, DIGEST_LEN);
+    payload_len = 2+4+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN;
 
     if(onion_skin_create(router->onion_pkey, &(hop->handshake_state), onionskin) < 0) {
       log_fn(LOG_WARN,"onion_skin_create failed.");
@@ -450,7 +445,7 @@
     /* Once this format is no longer supported, nobody will use
      * connection_*_get_by_addr_port. */
     old_format = 1;
-  } else if (rh.length == 4+2+DIGEST_LEN+ONIONSKIN_CHALLENGE_LEN) {
+  } else if (rh.length == 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) {
     old_format = 0;
   } else {
     log_fn(LOG_WARN, "Wrong length on extend cell. Closing circuit.");
@@ -464,9 +459,9 @@
     n_conn = connection_twin_get_by_addr_port(circ->n_addr,circ->n_port);
     onionskin = cell->payload+RELAY_HEADER_SIZE+4+2;
   } else {
-    id_digest = cell->payload+RELAY_HEADER_SIZE+4+2;
+    onionskin = cell->payload+RELAY_HEADER_SIZE+4+2;
+    id_digest = cell->payload+RELAY_HEADER_SIZE+4+2+ONIONSKIN_CHALLENGE_LEN;
     n_conn = connection_get_by_identity_digest(id_digest, CONN_TYPE_OR);
-    onionskin = cell->payload+RELAY_HEADER_SIZE+4+2+DIGEST_LEN;
   }
 
   if(!n_conn) { /* we should try to open a connection */