Browse Source

re-enable reachability testing stuff.
also, consider your ORPort reachable after you've processed a
create cell from any non-local address.


svn:r3763

Roger Dingledine 20 years ago
parent
commit
229761465c
3 changed files with 14 additions and 12 deletions
  1. 7 0
      src/or/circuitbuild.c
  2. 3 8
      src/or/circuituse.c
  3. 4 4
      src/or/router.c

+ 7 - 0
src/or/circuitbuild.c

@@ -731,6 +731,13 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
   connection_or_write_cell_to_buf(&cell, circ->p_conn);
   log_fn(LOG_DEBUG,"Finished sending 'created' cell.");
 
+  if (!is_local_IP(circ->p_conn->addr)) {
+    /* record that we could process create cells; presumably this means
+       that create cells can reach us too. */
+    log_fn(LOG_NOTICE,"Your ORPort is reachable from the outside. Excellent.");
+    router_orport_found_reachable();
+  }
+
   return 0;
 }
 

+ 3 - 8
src/or/circuituse.c

@@ -544,14 +544,9 @@ circuit_expire_old_circuits(void)
 /** A testing circuit has completed. Take whatever stats we want. */
 static void
 circuit_testing_opened(circuit_t *circ) {
-
   /* For now, we only use testing circuits to see if our ORPort is
-     reachable. So, if this circuit ends at us, remember that. */
-  routerinfo_t *exit = router_get_by_digest(circ->build_state->chosen_exit_digest);
-  if (exit && router_is_me(exit)) {
-    log_fn(LOG_NOTICE,"Your ORPort is reachable from the outside. Excellent.");
-    router_orport_found_reachable();
-  }
+     reachable. But we remember reachability in onionskin_answer(),
+     so there's no need to record anything here. Just close the circ. */
   circuit_mark_for_close(circ);
 }
 
@@ -563,7 +558,7 @@ circuit_testing_failed(circuit_t *circ, int at_last_hop) {
   if (!at_last_hop)
     circuit_launch_by_identity(CIRCUIT_PURPOSE_TESTING, me->identity_digest, 0, 0, 1);
   else
-    log_fn(LOG_NOTICE,"The testing circuit has failed. Guess you're not reachable yet.");
+    log_fn(LOG_INFO,"Our testing circuit (to see if your ORPort is reachable) has failed. I'll try again later.");
 }
 
 /** The circuit <b>circ</b> has just become open. Take the next

+ 4 - 4
src/or/router.c

@@ -374,9 +374,9 @@ int init_keys(void) {
  */
 
 /** Whether we can reach our ORPort from the outside. */
-static int can_reach_or_port = 1;
+static int can_reach_or_port = 0;
 /** Whether we can reach our DirPort from the outside. */
-static int can_reach_dir_port = 1;
+static int can_reach_dir_port = 0;
 
 void consider_testing_reachability(void) {
   routerinfo_t *me = router_get_my_routerinfo();
@@ -407,8 +407,8 @@ void router_dirport_found_reachable(void) {
 /** Our router has just moved to a new IP. Reset stats. */
 void server_has_changed_ip(void) {
   stats_n_seconds_working = 0;
-//  can_reach_or_port = 0;
-//  can_reach_dir_port = 0;
+  can_reach_or_port = 0;
+  can_reach_dir_port = 0;
   mark_my_descriptor_dirty();
 }