mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
client now survives going offline better
fix badness in usage() if neither socksport nor orrport is defined, quit obsolete connection_flush_buf() svn:r780
This commit is contained in:
parent
3c4b4c8cac
commit
1969c8a92f
8
README
8
README
@ -23,10 +23,10 @@ Do you want to run a tor server?
|
||||
resolution works. Make sure other people can reliably resolve the
|
||||
Address you chose.
|
||||
|
||||
Then run tor to generate keys. One of the generated files is your
|
||||
'fingerprint' file. Mail it to arma@mit.edu. Remember that you won't
|
||||
be able to authenticate to the other tor nodes until I've added you
|
||||
to the directory.
|
||||
Then run tor to generate keys. One of the files generated
|
||||
in your DataDirectory is your 'fingerprint' file. Mail it to
|
||||
arma@mit.edu. Remember that you won't be able to authenticate to the
|
||||
other tor nodes until I've added you to the directory.
|
||||
|
||||
Configuring tsocks:
|
||||
|
||||
|
11
doc/TODO
11
doc/TODO
@ -1,10 +1,7 @@
|
||||
mutiny suggests: if none of the ports is defined maybe it shouldn't start.
|
||||
aaron got a crash in tor_timegm in tzset on os x, with -l warn but not with -l debug.
|
||||
Oct 25 04:29:17.017 [warn] directory_initiate_command(): No running dirservers known. This is really bad.
|
||||
rename ACI to CircID
|
||||
rotate tls-level connections -- make new ones, expire old ones.
|
||||
dirserver shouldn't put you in running-routers list if you haven't
|
||||
uploading a descriptor recently
|
||||
uploaded a descriptor recently
|
||||
look at having smallcells and largecells
|
||||
separate trying to rebuild a circuit because you have none from trying to rebuild a
|
||||
circuit because the current one is stale
|
||||
@ -32,9 +29,9 @@ ARMA - arma claims
|
||||
Short-term:
|
||||
. integrate rep_ok functions, see what breaks
|
||||
- update tor faq
|
||||
. obey SocksBindAddress, ORBindAddress
|
||||
o obey SocksBindAddress, ORBindAddress
|
||||
- warn if we're running as root
|
||||
- make connection_flush_buf() more obviously obsolete
|
||||
o make connection_flush_buf() more obviously obsolete
|
||||
. let hup reread the config file, eg so we can get new exit
|
||||
policies without restarting
|
||||
- use times(2) rather than gettimeofday to measure how long it
|
||||
@ -78,7 +75,7 @@ Short-term:
|
||||
- make sure exiting from the not-last hop works
|
||||
- logic to find last *open* hop, not last hop, in cpath
|
||||
- choose exit nodes by exit policies
|
||||
- Remember address and port when resolving.
|
||||
- Remember address and port when beginning.
|
||||
- Extend by nickname/hostname/something, not by IP.
|
||||
|
||||
On-going
|
||||
|
@ -213,7 +213,7 @@ void print_usage(void) {
|
||||
"-e <policy>\t\tExit policy\n"
|
||||
"-l <level>\t\tLog level\n"
|
||||
"-m <max>\t\tMax number of connections\n"
|
||||
"-s <IP>\t\t\tAddress to bind to for Socks\n"
|
||||
"-s <IP>\t\t\tPort to bind to for Socks\n"
|
||||
);
|
||||
/* split things up to be ANSI compliant */
|
||||
printf("-n <nick>\t\tNickname of router\n"
|
||||
@ -353,6 +353,11 @@ int getconfig(int argc, char **argv, or_options_t *options) {
|
||||
result = -1;
|
||||
}
|
||||
|
||||
if(options->SocksPort == 0 && options->ORPort == 0) {
|
||||
log(LOG_WARN,"SocksPort and ORPort are both undefined? Quitting.");
|
||||
result = -1;
|
||||
}
|
||||
|
||||
if(options->DirPort < 0) {
|
||||
log(LOG_WARN,"DirPort option can't be negative.");
|
||||
result = -1;
|
||||
|
@ -429,10 +429,6 @@ int connection_outbuf_too_full(connection_t *conn) {
|
||||
return (conn->outbuf_flushlen > 10*CELL_PAYLOAD_SIZE);
|
||||
}
|
||||
|
||||
int connection_flush_buf(connection_t *conn) {
|
||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen);
|
||||
}
|
||||
|
||||
/* return -1 if you want to break the conn, else return 0 */
|
||||
int connection_handle_write(connection_t *conn) {
|
||||
|
||||
|
@ -578,7 +578,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
||||
|
||||
if(replylen) { /* we already have a reply in mind */
|
||||
connection_write_to_buf(reply, replylen, conn);
|
||||
return connection_flush_buf(conn); /* try to flush it */
|
||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
||||
}
|
||||
if(conn->socks_version == 4) {
|
||||
memset(buf,0,SOCKS4_NETWORK_LEN);
|
||||
@ -587,7 +587,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
||||
buf[1] = (success ? SOCKS4_GRANTED : SOCKS4_REJECT);
|
||||
/* leave version, destport, destip zero */
|
||||
connection_write_to_buf(buf, SOCKS4_NETWORK_LEN, conn);
|
||||
return connection_flush_buf(conn); /* try to flush it */
|
||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
||||
}
|
||||
if(conn->socks_version == 5) {
|
||||
buf[0] = 5; /* version 5 */
|
||||
@ -598,7 +598,7 @@ static int connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
|
||||
buf[3] = 1; /* ipv4 addr */
|
||||
memset(buf+4,0,6); /* XXX set external addr/port to 0, see what breaks */
|
||||
connection_write_to_buf(buf,10,conn);
|
||||
return connection_flush_buf(conn); /* try to flush it */
|
||||
return flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen); /* try to flush it */
|
||||
}
|
||||
return 0; /* if socks_version isn't 4 or 5, don't send anything */
|
||||
}
|
||||
|
@ -21,25 +21,16 @@ static int directorylen=0;
|
||||
void directory_initiate_command(routerinfo_t *router, int command) {
|
||||
connection_t *conn;
|
||||
|
||||
if(!router) { /* i guess they didn't have one in mind for me to use */
|
||||
log_fn(LOG_WARN,"No running dirservers known. This is really bad.");
|
||||
/* XXX never again will a directory fetch work. Should we exit here, or what? */
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0 /* there's no problem with parallel get/posts now. whichever 'get' ends
|
||||
last is the directory. */
|
||||
if(connection_get_by_type(CONN_TYPE_DIR)) { /* there's already a dir conn running */
|
||||
log_fn(LOG_DEBUG,"Canceling connect, dir conn already active.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(command == DIR_CONN_STATE_CONNECTING_FETCH)
|
||||
if (command == DIR_CONN_STATE_CONNECTING_FETCH)
|
||||
log_fn(LOG_DEBUG,"initiating directory fetch");
|
||||
else
|
||||
log_fn(LOG_DEBUG,"initiating directory upload");
|
||||
|
||||
if (!router) { /* i guess they didn't have one in mind for me to use */
|
||||
log_fn(LOG_WARN,"No running dirservers known. Not trying.");
|
||||
return;
|
||||
}
|
||||
|
||||
conn = connection_new(CONN_TYPE_DIR);
|
||||
|
||||
/* set up conn so it's got all the data we need to remember */
|
||||
@ -47,13 +38,8 @@ void directory_initiate_command(routerinfo_t *router, int command) {
|
||||
conn->port = router->dir_port;
|
||||
conn->address = tor_strdup(router->address);
|
||||
conn->nickname = tor_strdup(router->nickname);
|
||||
if (router->identity_pkey)
|
||||
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
|
||||
else {
|
||||
log_fn(LOG_WARN, "No signing key known for dirserver %s; signature won't be checked", conn->address);
|
||||
conn->identity_pkey = NULL;
|
||||
/* XXX is there really any situation where router doesn't have an identity_pkey? */
|
||||
}
|
||||
assert(router->identity_pkey);
|
||||
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
|
||||
|
||||
if(connection_add(conn) < 0) { /* no space, forget it */
|
||||
connection_free(conn);
|
||||
|
@ -560,7 +560,6 @@ int connection_find_on_inbuf(char *string, int len, connection_t *conn);
|
||||
|
||||
int connection_wants_to_flush(connection_t *conn);
|
||||
int connection_outbuf_too_full(connection_t *conn);
|
||||
int connection_flush_buf(connection_t *conn);
|
||||
int connection_handle_write(connection_t *conn);
|
||||
void connection_write_to_buf(const char *string, int len, connection_t *conn);
|
||||
|
||||
|
@ -55,7 +55,7 @@ void router_retry_connections(void) {
|
||||
routerinfo_t *router_pick_directory_server(void) {
|
||||
/* pick the first running router with a positive dir_port */
|
||||
int i;
|
||||
routerinfo_t *router;
|
||||
routerinfo_t *router, *dirserver=NULL;
|
||||
|
||||
if(!directory)
|
||||
return NULL;
|
||||
@ -66,7 +66,18 @@ routerinfo_t *router_pick_directory_server(void) {
|
||||
return router;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
log_fn(LOG_WARN,"No dirservers are up. Giving them all another chance.");
|
||||
/* no running dir servers found? go through and mark them all as up,
|
||||
* and we'll cycle through the list again. */
|
||||
for(i=0;i<directory->n_routers;i++) {
|
||||
router = directory->routers[i];
|
||||
if(router->dir_port > 0) {
|
||||
router->is_running = 1;
|
||||
dirserver = router;
|
||||
}
|
||||
}
|
||||
|
||||
return dirserver;
|
||||
}
|
||||
|
||||
void router_upload_desc_to_dirservers(void) {
|
||||
|
@ -449,7 +449,7 @@ test_util() {
|
||||
test_eq(0L, tv_udiff(&start, &end));
|
||||
|
||||
/* The test values here are confirmed to be correct on a platform
|
||||
* with a working timgm. */
|
||||
* with a working timegm. */
|
||||
a_time.tm_year = 2003-1900;
|
||||
a_time.tm_mon = 7;
|
||||
a_time.tm_mday = 30;
|
||||
|
Loading…
Reference in New Issue
Block a user