[or-cvs] Propagate yes/no/maybe a little farther forward.

Nick Mathewson nickm at seul.org
Tue Feb 17 08:29:24 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv18097/src/or

Modified Files:
	circuit.c connection_edge.c onion.c router.c 
Log Message:
Propagate yes/no/maybe a little farther forward.

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- circuit.c	30 Jan 2004 19:31:39 -0000	1.133
+++ circuit.c	17 Feb 2004 08:29:21 -0000	1.134
@@ -222,7 +222,7 @@
         exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port);
       else /* not open */
         exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
-      if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) < 0) {
+      if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) == ADDR_POLICY_REJECTED) {
         /* can't exit from this router */
         continue;
       }
@@ -305,7 +305,7 @@
   for(circ=global_circuitlist;circ;circ = circ->next) {
     if(circ->cpath && circ->state != CIRCUIT_STATE_OPEN) {
       exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
-      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) >= 0)
+      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) != ADDR_POLICY_REJECTED)
         if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
           return 1;
     }

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- connection_edge.c	20 Jan 2004 18:17:43 -0000	1.89
+++ connection_edge.c	17 Feb 2004 08:29:21 -0000	1.90
@@ -861,7 +861,7 @@
 void connection_exit_connect(connection_t *conn) {
   unsigned char connected_payload[4];
 
-  if(router_compare_to_my_exit_policy(conn) < 0) {
+  if(router_compare_to_my_exit_policy(conn) == ADDR_POLICY_REJECTED) {
     log_fn(LOG_INFO,"%s:%d failed exit policy. Closing.", conn->address, conn->port);
     if(connection_edge_end(conn, END_STREAM_REASON_EXITPOLICY, NULL) < 0)
       log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- onion.c	17 Feb 2004 07:45:44 -0000	1.123
+++ onion.c	17 Feb 2004 08:29:21 -0000	1.124
@@ -269,12 +269,12 @@
         continue; /* Skip everything but APs in CIRCUIT_WAIT */
       switch (connection_ap_can_use_exit(carray[j], dir->routers[i]))
         {
-        case -1:
+        case ADDR_POLICY_REJECTED:
           log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
                  dir->routers[i]->nickname, i);
           break; /* would be rejected; try next connection */
-        case 0:
-        case 1:
+        case ADDR_POLICY_ACCEPTED:
+        case ADDR_POLICY_UNKNOWN:
           ++n_supported[i];
           log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
                  dir->routers[i]->nickname, i, n_supported[i]);

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- router.c	17 Feb 2004 07:56:33 -0000	1.9
+++ router.c	17 Feb 2004 08:29:22 -0000	1.10
@@ -295,7 +295,7 @@
                          way we can't get a 'maybe' below. */
 
   return router_compare_addr_to_exit_policy(conn->addr, conn->port, 
-                   desc_routerinfo->exit_policy) == ADDR_POLICY_ACCEPTED;
+                   desc_routerinfo->exit_policy);
     
 }
 



More information about the tor-commits mailing list