Browse Source

logging patch from karsten, slightly modified to compile

svn:r11074
Roger Dingledine 17 years ago
parent
commit
330abbb6c6
5 changed files with 26 additions and 1 deletions
  1. 1 1
      src/or/connection_edge.c
  2. 4 0
      src/or/directory.c
  3. 4 0
      src/or/rendclient.c
  4. 6 0
      src/or/rendmid.c
  5. 11 0
      src/or/rendservice.c

+ 1 - 1
src/or/connection_edge.c

@@ -2297,7 +2297,7 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
 
   if (circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED) {
     origin_circuit_t *origin_circ = TO_ORIGIN_CIRCUIT(circ);
-    log_debug(LD_REND,"begin is for rendezvous. configuring stream.");
+    log_info(LD_REND,"begin is for rendezvous. configuring stream.");
     n_stream->_base.address = tor_strdup("(rendezvous)");
     n_stream->_base.state = EXIT_CONN_STATE_CONNECTING;
     strlcpy(n_stream->rend_query, origin_circ->rend_query,

+ 4 - 0
src/or/directory.c

@@ -1471,6 +1471,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
   }
 
   if (conn->_base.purpose == DIR_PURPOSE_UPLOAD_RENDDESC) {
+    log_info(LD_REND,"Uploaded rendezvous descriptor (status %d (%s))",
+             status_code, escaped(reason));
     switch (status_code) {
       case 200:
         log_info(LD_REND,
@@ -2002,6 +2004,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
     int versioned = !strcmpstart(url,"/tor/rendezvous1/");
     const char *query = url+strlen("/tor/rendezvous/")+(versioned?1:0);
 
+    log_info(LD_REND, "Handling rendezvous descriptor get");
     switch (rend_cache_lookup_desc(query, versioned?-1:0, &descp, &desc_len)) {
       case 1: /* valid */
         write_http_response_header(conn, desc_len, "application/octet-stream",
@@ -2142,6 +2145,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers,
   if (options->HSAuthoritativeDir &&
       !strcmpstart(url,"/tor/rendezvous/publish")) {
     /* rendezvous descriptor post */
+    log_info(LD_REND, "Handling rendezvous descriptor post.");
     if (rend_cache_store(body, body_len, 1) < 0) {
 //      char tmp[1024*2+1];
       log_fn(LOG_PROTOCOL_WARN, LD_DIRSERV,

+ 4 - 0
src/or/rendclient.c

@@ -144,6 +144,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
   payload_len = DIGEST_LEN + r;
   tor_assert(payload_len <= RELAY_PAYLOAD_SIZE); /* we overran something */
 
+  log_info(LD_REND, "Sending an INTRODUCE1 cell");
   if (relay_send_command_from_edge(0, TO_CIRCUIT(introcirc),
                                    RELAY_COMMAND_INTRODUCE1,
                                    payload, payload_len,
@@ -256,6 +257,7 @@ rend_client_refetch_renddesc(const char *query)
 {
   if (!get_options()->FetchHidServDescriptors)
     return;
+  log_info(LD_REND, "Fetching rendezvous descriptor for service %s", query);
   if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query)) {
     log_info(LD_REND,"Would fetch a new renddesc here (for %s), but one is "
              "already in progress.", escaped_safe_str(query));
@@ -383,6 +385,8 @@ rend_client_receive_rendezvous(origin_circuit_t *circ, const char *request,
     goto err;
   }
 
+  log_info(LD_REND,"Got RENDEZVOUS2 cell from hidden service.");
+
   /* first DH_KEY_LEN bytes are g^y from bob. Finish the dh handshake...*/
   tor_assert(circ->build_state);
   tor_assert(circ->build_state->pending_final_cpath);

+ 6 - 0
src/or/rendmid.c

@@ -132,6 +132,9 @@ rend_mid_introduce(or_circuit_t *circ, const char *request, size_t request_len)
   char serviceid[REND_SERVICE_ID_LEN+1];
   char nak_body[1];
 
+  log_info(LD_REND, "Received an INTRODUCE1 request on circuit %d",
+           circ->p_circ_id);
+
   if (circ->_base.purpose != CIRCUIT_PURPOSE_OR || circ->_base.n_conn) {
     log_warn(LD_PROTOCOL,
              "Rejecting INTRODUCE1 on non-OR or non-edge circuit %d.",
@@ -210,6 +213,9 @@ rend_mid_establish_rendezvous(or_circuit_t *circ, const char *request,
   char hexid[9];
   int reason = END_CIRC_REASON_TORPROTOCOL;
 
+  log_info(LD_REND, "Received an ESTABLISH_RENDEZVOUS request on circuit %d",
+           circ->p_circ_id);
+
   if (circ->_base.purpose != CIRCUIT_PURPOSE_OR || circ->_base.n_conn) {
     log_warn(LD_PROTOCOL,
              "Tried to establish rendezvous on non-OR or non-edge circuit.");

+ 11 - 0
src/or/rendservice.c

@@ -791,6 +791,7 @@ rend_service_intro_established(origin_circuit_t *circuit, const char *request,
                                size_t request_len)
 {
   rend_service_t *service;
+  char serviceid[REND_SERVICE_ID_LEN+1];
   (void) request;
   (void) request_len;
 
@@ -808,6 +809,12 @@ rend_service_intro_established(origin_circuit_t *circuit, const char *request,
   service->desc_is_dirty = time(NULL);
   circuit->_base.purpose = CIRCUIT_PURPOSE_S_INTRO;
 
+  base32_encode(serviceid, REND_SERVICE_ID_LEN + 1,
+                circuit->rend_pk_digest, 10);
+  log_info(LD_REND,
+           "Received INTRO_ESTABLISHED cell on circuit %d for service %s",
+           circuit->_base.n_circ_id, serviceid);
+
   return 0;
  err:
   circuit_mark_for_close(TO_CIRCUIT(circuit), END_CIRC_REASON_TORPROTOCOL);
@@ -934,6 +941,7 @@ upload_service_descriptor(rend_service_t *service, int version)
 {
   char *desc;
   size_t desc_len;
+  char serviceid[REND_SERVICE_ID_LEN+1];
 
   /* Update the descriptor. */
   rend_service_update_descriptor(service);
@@ -947,6 +955,9 @@ upload_service_descriptor(rend_service_t *service, int version)
   }
 
   /* Post it to the dirservers */
+  rend_get_service_id(service->private_key, serviceid);
+  log_info(LD_REND, "Sending publish request for hidden service %s",
+             serviceid);
   directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_RENDDESC,
                                ROUTER_PURPOSE_GENERAL,
                                HIDSERV_AUTHORITY, desc, desc_len, 0);