Loading src/or/circuit.c +1 −1 Original line number Diff line number Diff line Loading @@ -748,7 +748,7 @@ int circuit_establish_circuit(void) { if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* not currently connected */ circ->n_addr = firsthop->addr; circ->n_port = firsthop->or_port; if(options.OnionRouter) { /* we would be connected if he were up. but he's not. */ if(options.ORPort) { /* we would be connected if he were up. and he's not. */ log_fn(LOG_INFO,"Route's firsthop isn't connected."); circuit_close(circ); return -1; Loading src/or/config.c +4 −17 Original line number Diff line number Diff line Loading @@ -182,7 +182,6 @@ static void config_assign(or_options_t *options, struct config_line *list) { config_compare(list, "ORPort", CONFIG_TYPE_INT, &options->ORPort) || config_compare(list, "ORBindAddress", CONFIG_TYPE_STRING, &options->ORBindAddress) || config_compare(list, "OnionRouter", CONFIG_TYPE_BOOL, &options->OnionRouter) || config_compare(list, "PidFile", CONFIG_TYPE_STRING, &options->PidFile) || config_compare(list, "PathlenCoinWeight",CONFIG_TYPE_DOUBLE, &options->PathlenCoinWeight) || Loading Loading @@ -283,7 +282,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { static int backup_argc; char *previous_pidfile = NULL; int previous_runasdaemon = 0; int previous_onionrouter = -1; if(first_load) { /* first time we're called. save commandline args */ backup_argv = argv; Loading @@ -296,7 +294,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { /* record some previous values, so we can fail if they change */ previous_pidfile = tor_strdup(options->PidFile); previous_runasdaemon = options->RunAsDaemon; previous_onionrouter = options->OnionRouter; free_options(options); } init_options(options); Loading Loading @@ -349,11 +346,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { log_fn(LOG_WARN,"During reload, change from RunAsDaemon=1 to =0 not allowed. Failing."); return -1; } if(previous_onionrouter >= 0 && previous_onionrouter != options->OnionRouter) { log_fn(LOG_WARN,"During reload, OnionRouter changed from %d to %d. Failing.", previous_onionrouter, options->OnionRouter); return -1; } if(options->LogLevel) { if(!strcmp(options->LogLevel,"err")) Loading @@ -380,18 +372,13 @@ int getconfig(int argc, char **argv, or_options_t *options) { result = -1; } if(options->OnionRouter && options->ORPort == 0) { log(LOG_WARN,"If OnionRouter is set, then ORPort must be positive."); result = -1; } if(options->OnionRouter && options->DataDirectory == NULL) { log(LOG_WARN,"DataDirectory option required for OnionRouter, but not found."); if(options->ORPort && options->DataDirectory == NULL) { log(LOG_WARN,"DataDirectory option required if ORPort is set, but not found."); result = -1; } if(options->OnionRouter && options->Nickname == NULL) { log_fn(LOG_WARN,"Nickname required for OnionRouter, but not found."); if(options->ORPort && options->Nickname == NULL) { log_fn(LOG_WARN,"Nickname required if ORPort is set, but not found."); result = -1; } Loading src/or/connection_or.c +2 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ static int connection_tls_finish_handshake(connection_t *conn) { connection_watch_events(conn, POLLIN); log_fn(LOG_DEBUG,"tls handshake done. verifying."); if (! tor_tls_peer_has_cert(conn->tls)) { /* It's an OP. */ if (options.OnionRouter) { /* I'm an OR; good. */ if (options.ORPort) { /* I'm an OR; good. */ conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP; return 0; } else { /* Neither side sent a certificate: ouch. */ Loading Loading @@ -236,7 +236,7 @@ static int connection_tls_finish_handshake(connection_t *conn) { nickname, conn->nickname); return -1; } if (!options.OnionRouter) { /* If I'm an OP... */ if (!options.ORPort) { /* If I'm an OP... */ conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP; circuit_n_conn_open(conn); /* send the pending creates, if any. */ } Loading src/or/directory.c +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ int connection_dir_process_inbuf(connection_t *conn) { } else { log_fn(LOG_INFO,"updated routers."); } if(options.OnionRouter) { /* connect to them all */ if(options.ORPort) { /* connect to them all */ router_retry_connections(); } return -1; Loading src/or/main.c +6 −6 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ static void run_connection_housekeeping(int i, time_t now) { return; if(now >= conn->timestamp_lastwritten + options.KeepalivePeriod) { if((!options.OnionRouter && !circuit_get_by_conn(conn)) || if((!options.ORPort && !circuit_get_by_conn(conn)) || (!connection_state_is_open(conn))) { /* we're an onion proxy, with no circuits; or our handshake has expired. kill it. */ log_fn(LOG_INFO,"Expiring connection to %d (%s:%d).", Loading Loading @@ -322,7 +322,7 @@ static void run_scheduled_events(time_t now) { * our descriptor (if any). */ if(time_to_fetch_directory < now) { /* it's time to fetch a new directory and/or post our descriptor */ if(options.OnionRouter) { if(options.ORPort) { router_rebuild_descriptor(); router_upload_desc_to_dirservers(); } Loading Loading @@ -485,7 +485,7 @@ static int init_keys(void) crypto_pk_env_t *prkey; /* OP's don't need keys. Just initialize the TLS context.*/ if (!options.OnionRouter) { if (!options.ORPort) { assert(!options.DirPort); if (tor_tls_context_new(NULL, 0, NULL)<0) { log_fn(LOG_ERR, "Error creating TLS context for OP."); Loading Loading @@ -652,7 +652,7 @@ static int do_main_loop(void) { return -1; } if(options.OnionRouter) { if(options.ORPort) { cpu_init(); /* launch cpuworkers. Need to do this *after* we've read the onion key. */ router_upload_desc_to_dirservers(); /* upload our descriptor to all dirservers */ } Loading @@ -674,7 +674,7 @@ static int do_main_loop(void) { please_dumpstats = 0; } if(please_reset) { log_fn(LOG_INFO,"Hupped. Reloading config."); log_fn(LOG_WARN,"Received sighup. Reloading config."); /* first, reload config variables, in case they've changed */ if (init_from_config(0, NULL) < 0) { /* no need to provide argc/v, they've been cached inside init_from_config */ Loading Loading @@ -828,7 +828,7 @@ int tor_main(int argc, char *argv[]) { if (init_from_config(argc,argv) < 0) return -1; if(options.OnionRouter) { /* only spawn dns handlers if we're a router */ if(options.ORPort) { /* only spawn dns handlers if we're a router */ dns_init(); /* initialize the dns resolve tree, and spawn workers */ } if(options.SocksPort) { Loading Loading
src/or/circuit.c +1 −1 Original line number Diff line number Diff line Loading @@ -748,7 +748,7 @@ int circuit_establish_circuit(void) { if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* not currently connected */ circ->n_addr = firsthop->addr; circ->n_port = firsthop->or_port; if(options.OnionRouter) { /* we would be connected if he were up. but he's not. */ if(options.ORPort) { /* we would be connected if he were up. and he's not. */ log_fn(LOG_INFO,"Route's firsthop isn't connected."); circuit_close(circ); return -1; Loading
src/or/config.c +4 −17 Original line number Diff line number Diff line Loading @@ -182,7 +182,6 @@ static void config_assign(or_options_t *options, struct config_line *list) { config_compare(list, "ORPort", CONFIG_TYPE_INT, &options->ORPort) || config_compare(list, "ORBindAddress", CONFIG_TYPE_STRING, &options->ORBindAddress) || config_compare(list, "OnionRouter", CONFIG_TYPE_BOOL, &options->OnionRouter) || config_compare(list, "PidFile", CONFIG_TYPE_STRING, &options->PidFile) || config_compare(list, "PathlenCoinWeight",CONFIG_TYPE_DOUBLE, &options->PathlenCoinWeight) || Loading Loading @@ -283,7 +282,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { static int backup_argc; char *previous_pidfile = NULL; int previous_runasdaemon = 0; int previous_onionrouter = -1; if(first_load) { /* first time we're called. save commandline args */ backup_argv = argv; Loading @@ -296,7 +294,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { /* record some previous values, so we can fail if they change */ previous_pidfile = tor_strdup(options->PidFile); previous_runasdaemon = options->RunAsDaemon; previous_onionrouter = options->OnionRouter; free_options(options); } init_options(options); Loading Loading @@ -349,11 +346,6 @@ int getconfig(int argc, char **argv, or_options_t *options) { log_fn(LOG_WARN,"During reload, change from RunAsDaemon=1 to =0 not allowed. Failing."); return -1; } if(previous_onionrouter >= 0 && previous_onionrouter != options->OnionRouter) { log_fn(LOG_WARN,"During reload, OnionRouter changed from %d to %d. Failing.", previous_onionrouter, options->OnionRouter); return -1; } if(options->LogLevel) { if(!strcmp(options->LogLevel,"err")) Loading @@ -380,18 +372,13 @@ int getconfig(int argc, char **argv, or_options_t *options) { result = -1; } if(options->OnionRouter && options->ORPort == 0) { log(LOG_WARN,"If OnionRouter is set, then ORPort must be positive."); result = -1; } if(options->OnionRouter && options->DataDirectory == NULL) { log(LOG_WARN,"DataDirectory option required for OnionRouter, but not found."); if(options->ORPort && options->DataDirectory == NULL) { log(LOG_WARN,"DataDirectory option required if ORPort is set, but not found."); result = -1; } if(options->OnionRouter && options->Nickname == NULL) { log_fn(LOG_WARN,"Nickname required for OnionRouter, but not found."); if(options->ORPort && options->Nickname == NULL) { log_fn(LOG_WARN,"Nickname required if ORPort is set, but not found."); result = -1; } Loading
src/or/connection_or.c +2 −2 Original line number Diff line number Diff line Loading @@ -186,7 +186,7 @@ static int connection_tls_finish_handshake(connection_t *conn) { connection_watch_events(conn, POLLIN); log_fn(LOG_DEBUG,"tls handshake done. verifying."); if (! tor_tls_peer_has_cert(conn->tls)) { /* It's an OP. */ if (options.OnionRouter) { /* I'm an OR; good. */ if (options.ORPort) { /* I'm an OR; good. */ conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP; return 0; } else { /* Neither side sent a certificate: ouch. */ Loading Loading @@ -236,7 +236,7 @@ static int connection_tls_finish_handshake(connection_t *conn) { nickname, conn->nickname); return -1; } if (!options.OnionRouter) { /* If I'm an OP... */ if (!options.ORPort) { /* If I'm an OP... */ conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP; circuit_n_conn_open(conn); /* send the pending creates, if any. */ } Loading
src/or/directory.c +1 −1 Original line number Diff line number Diff line Loading @@ -125,7 +125,7 @@ int connection_dir_process_inbuf(connection_t *conn) { } else { log_fn(LOG_INFO,"updated routers."); } if(options.OnionRouter) { /* connect to them all */ if(options.ORPort) { /* connect to them all */ router_retry_connections(); } return -1; Loading
src/or/main.c +6 −6 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ static void run_connection_housekeeping(int i, time_t now) { return; if(now >= conn->timestamp_lastwritten + options.KeepalivePeriod) { if((!options.OnionRouter && !circuit_get_by_conn(conn)) || if((!options.ORPort && !circuit_get_by_conn(conn)) || (!connection_state_is_open(conn))) { /* we're an onion proxy, with no circuits; or our handshake has expired. kill it. */ log_fn(LOG_INFO,"Expiring connection to %d (%s:%d).", Loading Loading @@ -322,7 +322,7 @@ static void run_scheduled_events(time_t now) { * our descriptor (if any). */ if(time_to_fetch_directory < now) { /* it's time to fetch a new directory and/or post our descriptor */ if(options.OnionRouter) { if(options.ORPort) { router_rebuild_descriptor(); router_upload_desc_to_dirservers(); } Loading Loading @@ -485,7 +485,7 @@ static int init_keys(void) crypto_pk_env_t *prkey; /* OP's don't need keys. Just initialize the TLS context.*/ if (!options.OnionRouter) { if (!options.ORPort) { assert(!options.DirPort); if (tor_tls_context_new(NULL, 0, NULL)<0) { log_fn(LOG_ERR, "Error creating TLS context for OP."); Loading Loading @@ -652,7 +652,7 @@ static int do_main_loop(void) { return -1; } if(options.OnionRouter) { if(options.ORPort) { cpu_init(); /* launch cpuworkers. Need to do this *after* we've read the onion key. */ router_upload_desc_to_dirservers(); /* upload our descriptor to all dirservers */ } Loading @@ -674,7 +674,7 @@ static int do_main_loop(void) { please_dumpstats = 0; } if(please_reset) { log_fn(LOG_INFO,"Hupped. Reloading config."); log_fn(LOG_WARN,"Received sighup. Reloading config."); /* first, reload config variables, in case they've changed */ if (init_from_config(0, NULL) < 0) { /* no need to provide argc/v, they've been cached inside init_from_config */ Loading Loading @@ -828,7 +828,7 @@ int tor_main(int argc, char *argv[]) { if (init_from_config(argc,argv) < 0) return -1; if(options.OnionRouter) { /* only spawn dns handlers if we're a router */ if(options.ORPort) { /* only spawn dns handlers if we're a router */ dns_init(); /* initialize the dns resolve tree, and spawn workers */ } if(options.SocksPort) { Loading