mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Propagate yes/no/maybe a little farther forward.
svn:r1096
This commit is contained in:
parent
d081d1d061
commit
bd14023afd
@ -222,7 +222,7 @@ circuit_t *circuit_get_newest(connection_t *conn, int must_be_open) {
|
|||||||
exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port);
|
exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port);
|
||||||
else /* not open */
|
else /* not open */
|
||||||
exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
|
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 */
|
/* can't exit from this router */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ int circuit_stream_is_being_handled(connection_t *conn) {
|
|||||||
for(circ=global_circuitlist;circ;circ = circ->next) {
|
for(circ=global_circuitlist;circ;circ = circ->next) {
|
||||||
if(circ->cpath && circ->state != CIRCUIT_STATE_OPEN) {
|
if(circ->cpath && circ->state != CIRCUIT_STATE_OPEN) {
|
||||||
exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
|
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)
|
if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -861,7 +861,7 @@ static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
|
|||||||
void connection_exit_connect(connection_t *conn) {
|
void connection_exit_connect(connection_t *conn) {
|
||||||
unsigned char connected_payload[4];
|
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);
|
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)
|
if(connection_edge_end(conn, END_STREAM_REASON_EXITPOLICY, NULL) < 0)
|
||||||
log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");
|
log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");
|
||||||
|
@ -269,12 +269,12 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
|||||||
continue; /* Skip everything but APs in CIRCUIT_WAIT */
|
continue; /* Skip everything but APs in CIRCUIT_WAIT */
|
||||||
switch (connection_ap_can_use_exit(carray[j], dir->routers[i]))
|
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.",
|
log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
|
||||||
dir->routers[i]->nickname, i);
|
dir->routers[i]->nickname, i);
|
||||||
break; /* would be rejected; try next connection */
|
break; /* would be rejected; try next connection */
|
||||||
case 0:
|
case ADDR_POLICY_ACCEPTED:
|
||||||
case 1:
|
case ADDR_POLICY_UNKNOWN:
|
||||||
++n_supported[i];
|
++n_supported[i];
|
||||||
log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
|
log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
|
||||||
dir->routers[i]->nickname, i, n_supported[i]);
|
dir->routers[i]->nickname, i, n_supported[i]);
|
||||||
|
@ -295,7 +295,7 @@ int router_compare_to_my_exit_policy(connection_t *conn) {
|
|||||||
way we can't get a 'maybe' below. */
|
way we can't get a 'maybe' below. */
|
||||||
|
|
||||||
return router_compare_addr_to_exit_policy(conn->addr, conn->port,
|
return router_compare_addr_to_exit_policy(conn->addr, conn->port,
|
||||||
desc_routerinfo->exit_policy) == ADDR_POLICY_ACCEPTED;
|
desc_routerinfo->exit_policy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user