diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-11-14 20:45:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-11-14 20:45:47 +0000 |
commit | a8eaa79e031ee04d44d9ed919ed77c7a2e0acba2 (patch) | |
tree | 5fc60ec64ad07b6b2ecc6ce4c44eae22e61e7398 /src/or/circuit.c | |
parent | 273da1d3c425464dffa525a853096d0dde93aafb (diff) | |
download | tor-a8eaa79e031ee04d44d9ed919ed77c7a2e0acba2.tar.gz tor-a8eaa79e031ee04d44d9ed919ed77c7a2e0acba2.zip |
Improved exit policy syntax; basic client-side DNS caching.
- Exit policies now support bitmasks (18.0.0.0/255.0.0.0) and bitcounts
18.0.0.0/8. Policies are parsed on startup, not when comparing to them.
- desired_path_len is now part of an opaque cpath_build_state_t structure.
- END_REASON_EXITPOLICY cells no longer include a port.
- RELAY_COMMAND_CONNECTED cells now include the IP address we've connected
to.
- connection_edge now has a client_dns cache to remember resolved addresses.
It gets populated by RELAY_COMMAND_CONNECTED cells and END_REASON_EXITPOLICY
cells. It gets used by connection_ap_handshake_send_begin. We don't
compare it to exit policies yet.
svn:r812
Diffstat (limited to 'src/or/circuit.c')
-rw-r--r-- | src/or/circuit.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 46f57f8978..c371bfce7b 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -81,10 +81,12 @@ circuit_t *circuit_new(circ_id_t p_circ_id, connection_t *p_conn) { } void circuit_free(circuit_t *circ) { + assert(circ); if (circ->n_crypto) crypto_free_cipher_env(circ->n_crypto); if (circ->p_crypto) crypto_free_cipher_env(circ->p_crypto); + tor_free(circ->build_state); circuit_free_cpath(circ->cpath); free(circ); } @@ -656,16 +658,15 @@ int circuit_establish_circuit(void) { circ = circuit_new(0, NULL); /* sets circ->p_circ_id and circ->p_conn */ circ->state = CIRCUIT_STATE_OR_WAIT; - circ->desired_cpath_len = onion_new_route_len(); + circ->build_state = onion_new_cpath_build_state(); - if (circ->desired_cpath_len < 0) { + if (! circ->build_state) { log_fn(LOG_INFO,"Generating cpath length failed."); circuit_close(circ); return -1; } - onion_extend_cpath(&circ->cpath, circ->desired_cpath_len, - &firsthop); + onion_extend_cpath(&circ->cpath, circ->build_state, &firsthop); if(!circ->cpath) { log_fn(LOG_INFO,"Generating first cpath hop failed."); circuit_close(circ); @@ -766,11 +767,11 @@ int circuit_send_next_onion_skin(circuit_t *circ) { assert(circ->cpath->state == CPATH_STATE_OPEN); assert(circ->state == CIRCUIT_STATE_BUILDING); log_fn(LOG_DEBUG,"starting to send subsequent skin."); - r = onion_extend_cpath(&circ->cpath, circ->desired_cpath_len, &router); + r = onion_extend_cpath(&circ->cpath, circ->build_state, &router); if (r==1) { /* done building the circuit. whew. */ circ->state = CIRCUIT_STATE_OPEN; - log_fn(LOG_INFO,"circuit built! (%d hops long)",circ->desired_cpath_len); + log_fn(LOG_INFO,"circuit built!"); /* Tell any AP connections that have been waiting for a new * circuit that one is ready. */ connection_ap_attach_pending(); |