[or-cvs] Add "pass" target for RedirectExit, to make it easier to br...

Nick Mathewson nickm at seul.org
Tue Oct 19 17:46:10 UTC 2004


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

Modified Files:
	config.c connection_edge.c or.h 
Log Message:
Add "pass" target for RedirectExit, to make it easier to break out of a sequence of rules

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- config.c	17 Oct 2004 04:44:02 -0000	1.181
+++ config.c	19 Oct 2004 17:46:06 -0000	1.182
@@ -1106,10 +1106,15 @@
     log_fn(LOG_WARN, "Error parsing source address in RedirectExit line");
     goto err;
   }
-  if (parse_addr_port(smartlist_get(elements,1),NULL,&r->addr_dest,
-                      &r->port_dest)) {
-    log_fn(LOG_WARN, "Error parseing dest address in RedirectExit line");
-    goto err;
+  if (0==strcasecmp(smartlist_get(elements,1), "pass")) {
+    r->is_redirect = 0;
+  } else {
+    if (parse_addr_port(smartlist_get(elements,1),NULL,&r->addr_dest,
+                             &r->port_dest)) {
+      log_fn(LOG_WARN, "Error parseing dest address in RedirectExit line");
+      goto err;
+    }
+    r->is_redirect = 1;
   }
 
   goto done;

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -d -r1.217 -r1.218
--- connection_edge.c	17 Oct 2004 21:51:20 -0000	1.217
+++ connection_edge.c	19 Oct 2004 17:46:06 -0000	1.218
@@ -901,11 +901,13 @@
       if ((addr&r->mask)==(r->addr&r->mask) &&
           (r->port_min <= port) && (port <= r->port_max)) {
         struct in_addr in;
-        addr = r->addr_dest;
-        port = r->port_dest;
-        in.s_addr = htonl(addr);
-        log_fn(LOG_DEBUG, "Redirecting connection from %s:%d to %s:%d",
-               conn->address, conn->port, inet_ntoa(in), port);
+        if (r->is_redirect) {
+          addr = r->addr_dest;
+          port = r->port_dest;
+          in.s_addr = htonl(addr);
+          log_fn(LOG_DEBUG, "Redirecting connection from %s:%d to %s:%d",
+                 conn->address, conn->port, inet_ntoa(in), port);
+        }
         break;
       }
     });

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.439
retrieving revision 1.440
diff -u -d -r1.439 -r1.440
--- or.h	16 Oct 2004 22:56:46 -0000	1.439
+++ or.h	19 Oct 2004 17:46:06 -0000	1.440
@@ -824,6 +824,7 @@
   uint16_t port_min;
   uint16_t port_max;
 
+  int is_redirect;
   uint32_t addr_dest;
   uint16_t port_dest;
 } exit_redirect_t;



More information about the tor-commits mailing list