aboutsummaryrefslogtreecommitdiff
path: root/src/or/routers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-11-16 05:33:45 +0000
committerNick Mathewson <nickm@torproject.org>2003-11-16 05:33:45 +0000
commit8a17d9e5d37dba660f35affc070cdf23bb22b1bd (patch)
treef3562cb72cf8233979fd36f19c032e98724c3bd5 /src/or/routers.c
parenta8eaa79e031ee04d44d9ed919ed77c7a2e0acba2 (diff)
downloadtor-8a17d9e5d37dba660f35affc070cdf23bb22b1bd.tar
tor-8a17d9e5d37dba660f35affc070cdf23bb22b1bd.tar.gz
Finish implementing the rest of the exitpolicy stuff, except for automatically starting circuit builds.
svn:r813
Diffstat (limited to 'src/or/routers.c')
-rw-r--r--src/or/routers.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index 248a07d93..be6eef1d7 100644
--- a/src/or/routers.c
+++ b/src/or/routers.c
@@ -1061,6 +1061,16 @@ policy_read_failed:
return -1;
}
+/* Addr is 0 for "IP unknown".
+ *
+ * Returns -1 for 'rejected', 0 for accepted, 1 for 'maybe' (since IP is
+ * unknown.
+ */
+int router_supports_exit_address(uint32_t addr, uint16_t port,
+ routerinfo_t *router)
+{
+ return router_compare_addr_to_exit_policy(addr, port, router->exit_policy);
+}
/* Addr is 0 for "IP unknown".
*
@@ -1075,8 +1085,6 @@ int router_compare_addr_to_exit_policy(uint32_t addr, uint16_t port,
struct in_addr in;
struct exit_policy_t *tmpe;
- assert(desc_routerinfo);
-
for(tmpe=policy; tmpe; tmpe=tmpe->next) {
log_fn(LOG_DEBUG,"Considering exit policy %s", tmpe->string);
if (!addr) {
@@ -1117,8 +1125,6 @@ int router_compare_addr_to_exit_policy(uint32_t addr, uint16_t port,
* Else return -1.
*/
int router_compare_to_exit_policy(connection_t *conn) {
- struct exit_policy_t *tmpe;
-
assert(desc_routerinfo);
if (router_compare_addr_to_exit_policy(conn->addr, conn->port,