diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/buffers.c | 16 | ||||
-rw-r--r-- | src/or/circuitbuild.c | 4 | ||||
-rw-r--r-- | src/or/circuituse.c | 14 | ||||
-rw-r--r-- | src/or/config.c | 28 | ||||
-rw-r--r-- | src/or/connection.c | 18 | ||||
-rw-r--r-- | src/or/connection_edge.c | 26 | ||||
-rw-r--r-- | src/or/control.c | 14 | ||||
-rw-r--r-- | src/or/directory.c | 2 | ||||
-rw-r--r-- | src/or/dirserv.c | 6 | ||||
-rw-r--r-- | src/or/dirvote.c | 14 | ||||
-rw-r--r-- | src/or/dns.c | 4 | ||||
-rw-r--r-- | src/or/hibernate.c | 6 | ||||
-rw-r--r-- | src/or/main.c | 16 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 | ||||
-rw-r--r-- | src/or/ntmain.c | 2 | ||||
-rw-r--r-- | src/or/onion.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 32 | ||||
-rw-r--r-- | src/or/policies.c | 8 | ||||
-rw-r--r-- | src/or/relay.c | 8 | ||||
-rw-r--r-- | src/or/rendclient.c | 95 | ||||
-rw-r--r-- | src/or/rendservice.c | 6 | ||||
-rw-r--r-- | src/or/rephist.c | 4 | ||||
-rw-r--r-- | src/or/router.c | 4 | ||||
-rw-r--r-- | src/or/routerlist.c | 10 | ||||
-rw-r--r-- | src/or/routerparse.c | 10 | ||||
-rw-r--r-- | src/or/test.c | 16 |
26 files changed, 207 insertions, 160 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index cdab5490d0..ed39bc0f82 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -161,7 +161,7 @@ chunk_free(chunk_t *chunk) } /** Allocate a new chunk with a given allocation size, or get one from the - * freelist. Note that a chunk with allocation size A can actualy hold only + * freelist. Note that a chunk with allocation size A can actually hold only * CHUNK_SIZE_WITH_ALLOC(A) bytes in its mem field. */ static INLINE chunk_t * chunk_new_with_alloc_size(size_t alloc) @@ -787,7 +787,7 @@ flush_chunk(int s, buf_t *buf, chunk_t *chunk, size_t sz, * <b>chunk</b> of buffer <b>buf</b> onto socket <b>s</b>. (Tries to write * more if there is a forced pending write size.) On success, deduct the * bytes written from *<b>buf_flushlen</b>. Return the number of bytes - * written on success, and a TOR_TLS error code on failue or blocking. + * written on success, and a TOR_TLS error code on failure or blocking. */ static INLINE int flush_chunk_tls(tor_tls_t *tls, buf_t *buf, chunk_t *chunk, @@ -1108,7 +1108,7 @@ buf_find_pos_of_char(char ch, buf_pos_t *out) } /** Advance <b>pos</b> by a single character, if there are any more characters - * in the buffer. Returns 0 on sucess, -1 on failure. */ + * in the buffer. Returns 0 on success, -1 on failure. */ static INLINE int buf_pos_inc(buf_pos_t *pos) { @@ -1169,13 +1169,13 @@ buf_find_string_offset(const buf_t *buf, const char *s, size_t n) } /** There is a (possibly incomplete) http statement on <b>buf</b>, of the - * form "\%s\\r\\n\\r\\n\%s", headers, body. (body may contain nuls.) + * form "\%s\\r\\n\\r\\n\%s", headers, body. (body may contain NULs.) * If a) the headers include a Content-Length field and all bytes in * the body are present, or b) there's no Content-Length field and * all headers are present, then: * - * - strdup headers into <b>*headers_out</b>, and nul-terminate it. - * - memdup body into <b>*body_out</b>, and nul-terminate it. + * - strdup headers into <b>*headers_out</b>, and NUL-terminate it. + * - memdup body into <b>*body_out</b>, and NUL-terminate it. * - Then remove them from <b>buf</b>, and return 1. * * - If headers or body is NULL, discard that part of the buf. @@ -1259,14 +1259,14 @@ fetch_from_buf_http(buf_t *buf, if (headers_out) { *headers_out = tor_malloc(headerlen+1); fetch_from_buf(*headers_out, headerlen, buf); - (*headers_out)[headerlen] = 0; /* nul terminate it */ + (*headers_out)[headerlen] = 0; /* NUL terminate it */ } if (body_out) { tor_assert(body_used); *body_used = bodylen; *body_out = tor_malloc(bodylen+1); fetch_from_buf(*body_out, bodylen, buf); - (*body_out)[bodylen] = 0; /* nul terminate it */ + (*body_out)[bodylen] = 0; /* NUL terminate it */ } check(); return 1; diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index d62fae842a..a70594ba38 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1938,7 +1938,7 @@ entry_is_time_to_retry(entry_guard_t *e, time_t now) * right now. (Else return NULL.) In particular, it must be * - Listed as either up or never yet contacted; * - Present in the routerlist; - * - Listed as 'stable' or 'fast' by the current dirserver concensus, + * - Listed as 'stable' or 'fast' by the current dirserver consensus, * if demanded by <b>need_uptime</b> or <b>need_capacity</b>; * (This check is currently redundant with the Guard flag, but in * the future that might change. Best to leave it in for now.) @@ -2025,7 +2025,7 @@ log_entry_guards(int severity) /** Called when one or more guards that we would previously have used for some * purpose are no longer in use because a higher-priority guard has become - * useable again. */ + * usable again. */ static void control_event_guard_deferred(void) { diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 1dd15d6af9..92e0746369 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -298,13 +298,13 @@ circuit_expire_building(time_t now) if (victim->purpose >= CIRCUIT_PURPOSE_C_INTRODUCING && victim->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) { if (!victim->timestamp_dirty) - log_fn(LOG_DEBUG,"Considering %sopen purp %d to %s (circid %d)." + log_fn(LOG_DEBUG,"Considering %sopen purpose %d to %s (circid %d)." "(clean).", victim->state == CIRCUIT_STATE_OPEN ? "" : "non", victim->purpose, victim->build_state->chosen_exit_name, victim->n_circ_id); else - log_fn(LOG_DEBUG,"Considering %sopen purp %d to %s (circid %d). " + log_fn(LOG_DEBUG,"Considering %sopen purpose %d to %s (circid %d). " "%d secs since dirty.", victim->state == CIRCUIT_STATE_OPEN ? "" : "non", victim->purpose, victim->build_state->chosen_exit_name, @@ -512,7 +512,7 @@ circuit_predict_and_launch_new(void) flags |= CIRCLAUNCH_IS_INTERNAL; log_info(LD_CIRC, "Have %d clean circs (%d uptime-internal, %d internal), need" - " another hidserv circ.", + " another hidden service circ.", num, num_uptime_internal, num_internal); circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL, flags); return; @@ -642,7 +642,7 @@ circuit_expire_old_circuits(time_t now) if (circ->timestamp_dirty && circ->timestamp_dirty + get_options()->MaxCircuitDirtiness < now && !TO_ORIGIN_CIRCUIT(circ)->p_streams /* nothing attached */ ) { - log_debug(LD_CIRC, "Closing n_circ_id %d (dirty %d secs ago, purp %d)", + log_debug(LD_CIRC, "Closing n_circ_id %d (dirty %d secs ago, purpose %d)", circ->n_circ_id, (int)(now - circ->timestamp_dirty), circ->purpose); circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED); @@ -1035,7 +1035,7 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, if (!want_onehop && !router_have_minimum_dir_info()) { if (!connection_get_by_type(CONN_TYPE_DIR)) { int severity = LOG_NOTICE; - /* FFFF if this is a tunnelled directory fetch, don't yell + /* FFFF if this is a tunneled directory fetch, don't yell * as loudly. the user doesn't even know it's happening. */ if (options->UseBridges && bridges_known_but_down()) { log_fn(severity, LD_APP|LD_DIR, @@ -1108,7 +1108,7 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, extend_info = rend_client_get_random_intro(conn->rend_data); if (!extend_info) { log_info(LD_REND, - "No intro points for '%s': refetching service descriptor.", + "No intro points for '%s': re-fetching service descriptor.", safe_str(conn->rend_data->onion_address)); rend_client_refetch_v2_renddesc(conn->rend_data); conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT; @@ -1446,7 +1446,7 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn) rendcirc->_base.n_circ_id, conn_age); /* Mark rendezvous circuits as 'newly dirty' every time you use * them, since the process of rebuilding a rendezvous circ is so - * expensive. There is a tradeoffs between linkability and + * expensive. There is a tradeoff between linkability and * feasibility, at this point. */ rendcirc->_base.timestamp_dirty = time(NULL); diff --git a/src/or/config.c b/src/or/config.c index 70ad1b55cd..eaa875043e 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -25,7 +25,7 @@ typedef enum config_type_t { CONFIG_TYPE_MEMUNIT, /**< A number of bytes, with optional units*/ CONFIG_TYPE_DOUBLE, /**< A floating-point value */ CONFIG_TYPE_BOOL, /**< A boolean value, expressed as 0 or 1. */ - CONFIG_TYPE_ISOTIME, /**< An ISO-formated time relative to GMT. */ + CONFIG_TYPE_ISOTIME, /**< An ISO-formatted time relative to GMT. */ CONFIG_TYPE_CSV, /**< A list of strings, separated by commas and * optional whitespace. */ CONFIG_TYPE_LINELIST, /**< Uninterpreted config lines */ @@ -449,7 +449,7 @@ static config_var_description_t options_description[] = { "host:port (or host:80 if port is not set)." }, { "HTTPProxyAuthenticator", "A username:password pair to be used with " "HTTPProxy." }, - { "HTTPSProxy", "Force Tor to make all TLS (SSL) connectinos through this " + { "HTTPSProxy", "Force Tor to make all TLS (SSL) connections through this " "host:port (or host:80 if port is not set)." }, { "HTTPSProxyAuthenticator", "A username:password pair to be used with " "HTTPSProxy." }, @@ -1285,7 +1285,7 @@ options_act(or_options_t *old_options) finish_daemon(options->DataDirectory); } - /* Write our pid to the pid file. If we do not have write permissions we + /* Write our PID to the PID file. If we do not have write permissions we * will log a warning */ if (options->PidFile) write_pidfile(options->PidFile); @@ -1407,7 +1407,7 @@ options_act(or_options_t *old_options) } } - /* Load the webpage we're going to serve everytime someone asks for '/' on + /* Load the webpage we're going to serve every time someone asks for '/' on our DirPort. */ tor_free(global_dirfrontpagecontents); if (options->DirPortFrontPage) { @@ -1440,7 +1440,7 @@ expand_abbrev(config_format_t *fmt, const char *option, int command_line, if (! fmt->abbrevs) return option; for (i=0; fmt->abbrevs[i].abbreviated; ++i) { - /* Abbreviations are casei. */ + /* Abbreviations are case insensitive. */ if (!strcasecmp(option,fmt->abbrevs[i].abbreviated) && (command_line || !fmt->abbrevs[i].commandline_only)) { if (warn_obsolete && fmt->abbrevs[i].warn) { @@ -1501,7 +1501,7 @@ config_get_commandlines(int argc, char **argv, config_line_t **result) (*new)->key = tor_strdup(expand_abbrev(&options_format, s, 1, 1)); (*new)->value = tor_strdup(argv[i+1]); (*new)->next = NULL; - log(LOG_DEBUG, LD_CONFIG, "Commandline: parsed keyword '%s', value '%s'", + log(LOG_DEBUG, LD_CONFIG, "command line: parsed keyword '%s', value '%s'", (*new)->key, (*new)->value); new = &((*new)->next); @@ -1610,7 +1610,7 @@ config_find_option(config_format_t *fmt, const char *key) int i; size_t keylen = strlen(key); if (!keylen) - return NULL; /* if they say "--" on the commandline, it's not an option */ + return NULL; /* if they say "--" on the command line, it's not an option */ /* First, check for an exact (case-insensitive) match */ for (i=0; fmt->vars[i].name; ++i) { if (!strcasecmp(key, fmt->vars[i].name)) { @@ -1815,7 +1815,7 @@ config_assign_line(config_format_t *fmt, or_options_t *options, if (!clear_first) { if (var->type == CONFIG_TYPE_LINELIST || var->type == CONFIG_TYPE_LINELIST_S) { - /* We got an empty linelist from the torrc or commandline. + /* We got an empty linelist from the torrc or command line. As a special case, call this an error. Warn and ignore. */ log_warn(LD_CONFIG, "Linelist option '%s' has no value. Skipping.", c->key); @@ -1865,7 +1865,7 @@ option_get_canonical_name(const char *key) return var ? var->name : NULL; } -/** Return a canonicalized list of the options assigned for key. +/** Return a canonical list of the options assigned for key. */ config_line_t * option_get_assignment(or_options_t *options, const char *key) @@ -3059,7 +3059,7 @@ options_validate(or_options_t *old_options, or_options_t *options, if (!options->ContactInfo && !options->TestingTorNetwork) REJECT("Authoritative directory servers must set ContactInfo"); if (options->V1AuthoritativeDir && !options->RecommendedVersions) - REJECT("V1 auth dir servers must set RecommendedVersions."); + REJECT("V1 authoritative dir servers must set RecommendedVersions."); if (!options->RecommendedClientVersions) options->RecommendedClientVersions = config_lines_dup(options->RecommendedVersions); @@ -3069,7 +3069,7 @@ options_validate(or_options_t *old_options, or_options_t *options, if (options->VersioningAuthoritativeDir && (!options->RecommendedClientVersions || !options->RecommendedServerVersions)) - REJECT("Versioning auth dir servers must set Recommended*Versions."); + REJECT("Versioning authoritative dir servers must set Recommended*Versions."); if (options->UseEntryGuards) { log_info(LD_CONFIG, "Authoritative directory servers can't set " "UseEntryGuards. Disabling."); @@ -3675,7 +3675,7 @@ options_transition_allowed(or_options_t *old, or_options_t *new_val, } /** Return 1 if any change from <b>old_options</b> to <b>new_options</b> - * will require us to rotate the cpu and dns workers; else return 0. */ + * will require us to rotate the CPU and DNS workers; else return 0. */ static int options_transition_affects_workers(or_options_t *old_options, or_options_t *new_options) @@ -3932,7 +3932,7 @@ options_init_from_torrc(int argc, char **argv) char *command_arg = NULL; char *errmsg=NULL; - if (argv) { /* first time we're called. save commandline args */ + if (argv) { /* first time we're called. save command line args */ backup_argv = argv; backup_argc = argc; } else { /* we're reloading. need to clean up old options first. */ @@ -4147,7 +4147,7 @@ get_torrc_fname(void) return get_default_conf_file(); } -/** Adjust the address map mased on the MapAddress elements in the +/** Adjust the address map based on the MapAddress elements in the * configuration <b>options</b> */ static void diff --git a/src/or/connection.c b/src/or/connection.c index 17cfdcba82..66a62c549a 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -369,7 +369,7 @@ _connection_free(connection_t *conn) buf_free(conn->outbuf); } else { if (conn->socket_family == AF_UNIX) { - /* For now only control ports can be unix domain sockets + /* For now only control ports can be Unix domain sockets * and listeners at the same time */ tor_assert(conn->type == CONN_TYPE_CONTROL_LISTENER); @@ -474,7 +474,7 @@ connection_free(connection_t *conn) } /** Call _connection_free() on every connection in our array, and release all - * storage helpd by connection.c. This is used by cpuworkers and dnsworkers + * storage held by connection.c. This is used by cpuworkers and dnsworkers * when they fork, so they don't keep resources held open (especially * sockets). * @@ -740,7 +740,7 @@ connection_expire_held_open(void) * for the new structure. If no port is provided in <b>listenaddress</b> then * <b>listenport</b> is used. * - * If not NULL <b>readable_addrress</b> will contain a copy of the host part of + * If not NULL <b>readable_address</b> will contain a copy of the host part of * <b>listenaddress</b>. * * The listenaddr struct has to be freed by the caller. @@ -777,14 +777,14 @@ create_inet_sockaddr(const char *listenaddress, uint16_t listenport, #ifdef HAVE_SYS_UN_H /** Create an AF_UNIX listenaddr struct. - * <b>listenaddress</b> provides the path to the unix socket. + * <b>listenaddress</b> provides the path to the Unix socket. * * Eventually <b>listenaddress</b> will also optionally contain user, group, * and file permissions for the new socket. But not yet. XXX * Also, since we do not create the socket here the information doesn't help * here. * - * If not NULL <b>readable_addrress</b> will contain a copy of the path part of + * If not NULL <b>readable_address</b> will contain a copy of the path part of * <b>listenaddress</b>. * * The listenaddr struct has to be freed by the caller. @@ -912,7 +912,7 @@ connection_create_listener(struct sockaddr *listensockaddr, socklen_t socklen, } else if (listensockaddr->sa_family == AF_UNIX) { start_reading = 1; - /* For now only control ports can be unix domain sockets + /* For now only control ports can be Unix domain sockets * and listeners at the same time */ tor_assert(type == CONN_TYPE_CONTROL_LISTENER); @@ -1144,7 +1144,7 @@ connection_handle_listener_read(connection_t *conn, int new_type) newconn->address = tor_dup_addr(&addr); } else if (conn->socket_family == AF_UNIX) { - /* For now only control ports can be unix domain sockets + /* For now only control ports can be Unix domain sockets * and listeners at the same time */ tor_assert(conn->type == CONN_TYPE_CONTROL_LISTENER); @@ -1172,7 +1172,7 @@ connection_handle_listener_read(connection_t *conn, int new_type) } /** Initialize states for newly accepted connection <b>conn</b>. - * If conn is an OR, start the tls handshake. + * If conn is an OR, start the TLS handshake. * If conn is a transparent AP, get its original destination * and place it in circuit_wait. */ @@ -1803,7 +1803,7 @@ connection_bucket_init(void) } } -/** Refill a single <b>bucket</b> called <b>name</b> with bandwith rate +/** Refill a single <b>bucket</b> called <b>name</b> with bandwidth rate * <b>rate</b> and bandwidth burst <b>burst</b>, assuming that * <b>seconds_elapsed</b> seconds have passed since the last call. **/ diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index eff20bd139..6207ad3178 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -266,7 +266,7 @@ connection_edge_end(edge_connection_t *conn, uint8_t reason) return 0; } -/** An error has just occured on an operation on an edge connection +/** An error has just occurred on an operation on an edge connection * <b>conn</b>. Extract the errno; convert it to an end reason, and send an * appropriate relay end cell to the other end of the connection's circuit. **/ @@ -509,10 +509,10 @@ connection_ap_attach_pending(void) }); } -/** Tell any AP streams that are waiting for a onehop tunnel to +/** Tell any AP streams that are waiting for a one-hop tunnel to * <b>failed_digest</b> that they are going to fail. */ /* XXX022 We should get rid of this function, and instead attach - * onehop streams to circ->p_streams so they get marked in + * one-hop streams to circ->p_streams so they get marked in * circuit_mark_for_close like normal p_streams. */ void connection_ap_fail_onehop(const char *failed_digest, @@ -543,7 +543,7 @@ connection_ap_fail_onehop(const char *failed_digest, build_state->chosen_exit->port != edge_conn->socks_request->port) continue; } - log_info(LD_APP, "Closing onehop stream to '%s/%s' because the OR conn " + log_info(LD_APP, "Closing one-hop stream to '%s/%s' because the OR conn " "just failed.", edge_conn->chosen_exit_name, edge_conn->socks_request->address); connection_mark_unattached_ap(edge_conn, END_STREAM_REASON_TIMEOUT); @@ -631,12 +631,12 @@ connection_ap_detach_retriable(edge_connection_t *conn, origin_circuit_t *circ, * - A MapAddress command from the controller [permanent] * - An AddressMap directive in the torrc [permanent] * - When a TrackHostExits torrc directive is triggered [temporary] - * - When a dns resolve succeeds [temporary] - * - When a dns resolve fails [temporary] + * - When a DNS resolve succeeds [temporary] + * - When a DNS resolve fails [temporary] * * When an addressmap request is made but one is already registered, * the new one is replaced only if the currently registered one has - * no "new_address" (that is, it's in the process of dns resolve), + * no "new_address" (that is, it's in the process of DNS resolve), * or if the new one is permanent (expires==0 or 1). * * (We overload the 'expires' field, using "0" for mappings set via @@ -955,7 +955,7 @@ client_dns_incr_failures(const char *address) return ent->num_resolve_failures; } -/** If <b>address</b> is in the client dns addressmap, reset +/** If <b>address</b> is in the client DNS addressmap, reset * the number of resolve failures we have on record for it. * This is used when we fail a stream because it won't resolve: * otherwise future attempts on that address will only try once. @@ -1691,7 +1691,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn, } } else { conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT; - log_info(LD_REND, "Stale descriptor %s. Refetching.", + log_info(LD_REND, "Stale descriptor %s. Re-fetching.", safe_str(conn->rend_data->onion_address)); rend_client_refetch_v2_renddesc(conn->rend_data); } @@ -1707,7 +1707,7 @@ int get_pf_socket(void) { int pf; - /* This should be opened before dropping privs. */ + /* This should be opened before dropping privileges. */ if (pf_socket >= 0) return pf_socket; @@ -2729,7 +2729,7 @@ connection_exit_connect(edge_connection_t *edge_conn) connection_watch_events(conn, EV_WRITE | EV_READ); /* writable indicates finish; - * readable/error indicates broken link in windowsland. */ + * readable/error indicates broken link in windows-land. */ return; /* case 1: fall through */ } @@ -2915,14 +2915,14 @@ parse_extended_hostname(char *address) if (!s) return NORMAL_HOSTNAME; /* no dot, thus normal */ if (!strcmp(s+1,"exit")) { - *s = 0; /* nul-terminate it */ + *s = 0; /* NUL-terminate it */ return EXIT_HOSTNAME; /* .exit */ } if (strcmp(s+1,"onion")) return NORMAL_HOSTNAME; /* neither .exit nor .onion, thus normal */ /* so it is .onion */ - *s = 0; /* nul-terminate it */ + *s = 0; /* NUL-terminate it */ if (strlcpy(query, address, REND_SERVICE_ID_LEN_BASE32+1) >= REND_SERVICE_ID_LEN_BASE32+1) goto failed; diff --git a/src/or/control.c b/src/or/control.c index 3e69bbfd41..2052b967c7 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -502,7 +502,7 @@ send_control_done(control_connection_t *conn) * If <b>which</b> & SHORT_NAMES, the event contains short-format names: send * it to controllers that haven't enabled the VERBOSE_NAMES feature. If * <b>which</b> & LONG_NAMES, the event contains long-format names: send it - * to contollers that <em>have</em> enabled VERBOSE_NAMES. + * to controllers that <em>have</em> enabled VERBOSE_NAMES. * * The EXTENDED_FORMAT and NONEXTENDED_FORMAT flags behave similarly with * respect to the EXTENDED_EVENTS feature. */ @@ -755,7 +755,7 @@ handle_control_getconf(control_connection_t *conn, uint32_t body_len, or_options_t *options = get_options(); int i, len; - (void) body_len; /* body is nul-terminated; so we can ignore len. */ + (void) body_len; /* body is NUL-terminated; so we can ignore len. */ smartlist_split_string(questions, body, " ", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); SMARTLIST_FOREACH(questions, const char *, q, @@ -1205,7 +1205,7 @@ handle_control_signal(control_connection_t *conn, uint32_t len, } /** Called when we get a MAPADDRESS command; try to bind all listed addresses, - * and report success or failrue. */ + * and report success or failure. */ static int handle_control_mapaddress(control_connection_t *conn, uint32_t len, const char *body) @@ -1215,7 +1215,7 @@ handle_control_mapaddress(control_connection_t *conn, uint32_t len, smartlist_t *reply; char *r; size_t sz; - (void) len; /* body is nul-terminated, so it's safe to ignore the length. */ + (void) len; /* body is NUL-terminated, so it's safe to ignore the length. */ lines = smartlist_create(); elts = smartlist_create(); @@ -1941,7 +1941,7 @@ handle_control_getinfo(control_connection_t *conn, uint32_t len, smartlist_t *unrecognized = smartlist_create(); char *msg = NULL, *ans = NULL; int i; - (void) len; /* body is nul-terminated, so it's safe to ignore the length. */ + (void) len; /* body is NUL-terminated, so it's safe to ignore the length. */ smartlist_split_string(questions, body, " ", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); @@ -2152,7 +2152,7 @@ handle_control_setcircuitpurpose(control_connection_t *conn, origin_circuit_t *circ = NULL; uint8_t new_purpose; smartlist_t *args; - (void) len; /* body is nul-terminated, so it's safe to ignore the length. */ + (void) len; /* body is NUL-terminated, so it's safe to ignore the length. */ args = getargs_helper("SETCIRCUITPURPOSE", conn, body, 2, -1); if (!args) @@ -3433,7 +3433,7 @@ control_event_newconsensus(const networkstatus_t *consensus) } /** Called when a single local_routerstatus_t has changed: Sends an NS event - * to any countroller that cares. */ + * to any controller that cares. */ int control_event_networkstatus_changed_single(routerstatus_t *rs) { diff --git a/src/or/directory.c b/src/or/directory.c index ec31d77eb2..d86495dca5 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2873,7 +2873,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, "application/octet-stream", NULL, NULL, 0); note_request("/tor/rendezvous?/", desc_len); - /* need to send descp separately, because it may include nuls */ + /* need to send descp separately, because it may include NULs */ connection_write_to_buf(descp, desc_len, TO_CONN(conn)); /* report successful fetch to statistic */ if (options->HSAuthorityRecordStats) { diff --git a/src/or/dirserv.c b/src/or/dirserv.c index f586076448..76ac3978f8 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2753,7 +2753,7 @@ dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key, * message. * * XXXX rename this function. It's only called from the controller. - * XXXX in fact, refactor this function, mergeing as much as possible. + * XXXX in fact, refactor this function, merging as much as possible. */ int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, @@ -2970,7 +2970,7 @@ get_signed_descriptor_by_fp(const char *fp, int extrainfo, return NULL; } -/** Return true iff we have any of the docments (extrainfo or routerdesc) +/** Return true iff we have any of the documents (extrainfo or routerdesc) * specified by the fingerprints in <b>fps</b> and <b>spool_src</b>. Used to * decide whether to send a 404. */ int @@ -3016,7 +3016,7 @@ dirserv_estimate_data_size(smartlist_t *fps, int is_serverdescs, routerinfo_t *me = router_get_my_routerinfo(); result = (me?me->cache_info.signed_descriptor_len:2048) * n; if (compressed) - result /= 2; /* observed compressability is between 35 and 55%. */ + result /= 2; /* observed compressibility is between 35 and 55%. */ } else { result = 0; SMARTLIST_FOREACH(fps, const char *, digest, { diff --git a/src/or/dirvote.c b/src/or/dirvote.c index f0feca95a8..073c9e3aa6 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -341,7 +341,7 @@ _compare_vote_rs(const void **_a, const void **_b) /** Given a list of vote_routerstatus_t, all for the same router identity, * return whichever is most frequent, breaking ties in favor of more * recently published vote_routerstatus_t and in case of ties there, - * in favour of smaller descriptor digest. + * in favor of smaller descriptor digest. */ static vote_routerstatus_t * compute_routerstatus_consensus(smartlist_t *votes) @@ -459,7 +459,7 @@ consensus_method_is_supported(int method) } /** Helper: given <b>lst</b>, a list of version strings such that every - * version appears once for every versioning voter who recommends it, returna + * version appears once for every versioning voter who recommends it, return a * newly allocated string holding the resulting client-versions or * server-versions list. May change contents of <b>lst</b> */ static char * @@ -843,7 +843,7 @@ networkstatus_compute_consensus(smartlist_t *votes, rs = smartlist_get(v->routerstatus_list, index[v_sl_idx]); if (memcmp(rs->status.identity_digest, lowest_id, DIGEST_LEN)) continue; /* doesn't include this router. */ - /* At this point, we know that we're looking at a routersatus with + /* At this point, we know that we're looking at a routerstatus with * identity "lowest". */ ++index[v_sl_idx]; @@ -955,7 +955,7 @@ networkstatus_compute_consensus(smartlist_t *votes, * that descriptor. If everybody plays nice all the voters who * listed that descriptor will have the same summary. If not then * something is fishy and we'll use the most common one (breaking - * ties in favor of lexigraphically larger one (only because it + * ties in favor of lexicographically larger one (only because it * lets me reuse more existing code. * * The other case that can happen is that no authority that voted @@ -996,7 +996,7 @@ networkstatus_compute_consensus(smartlist_t *votes, char dd[HEX_DIGEST_LEN+1]; base16_encode(id, sizeof(dd), rs_out.identity_digest, DIGEST_LEN); base16_encode(dd, sizeof(dd), rs_out.descriptor_digest, DIGEST_LEN); - log_warn(LD_DIR, "The voters disgreed on the exit policy summary for" + log_warn(LD_DIR, "The voters disagreed on the exit policy summary for" " router %s with descriptor %s. This really shouldn't" " have happened.", id, dd); @@ -2101,7 +2101,7 @@ dirvote_add_signatures_to_pending_consensus( return r; } -/** Helper: we just got the <b>deteached_signatures_body</b> sent to us as +/** Helper: we just got the <b>detached_signatures_body</b> sent to us as * signatures on the currently pending consensus. Add them to the pending * consensus (if we have one); otherwise queue them until we have a * consensus. Return negative on failure, nonnegative on success. */ @@ -2117,7 +2117,7 @@ dirvote_add_signatures(const char *detached_signatures_body, detached_signatures_body, msg); } else { log_notice(LD_DIR, "Got a signature from %s. " - "Queueing it for the next consensus.", source); + "Queuing it for the next consensus.", source); if (!pending_consensus_signature_list) pending_consensus_signature_list = smartlist_create(); smartlist_add(pending_consensus_signature_list, diff --git a/src/or/dns.c b/src/or/dns.c index af056e8de3..fb3620c165 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -1109,7 +1109,7 @@ configure_nameservers(int force) socklen = tor_addr_to_sockaddr(&addr, 0, (struct sockaddr *)&ss, sizeof(ss)); if (socklen < 0) { - log_warn(LD_BUG, "Couldn't convert outboung bind address to sockaddr." + log_warn(LD_BUG, "Couldn't convert outbound bind address to sockaddr." " Ignoring."); } else { evdns_set_default_outgoing_bind_address((struct sockaddr *)&ss, @@ -1553,7 +1553,7 @@ dns_launch_correctness_checks(void) } } -/** Return true iff our DNS servers lie to us too much to be trustd. */ +/** Return true iff our DNS servers lie to us too much to be trusted. */ int dns_seems_to_be_broken(void) { diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 8f347a48cb..89f9aa701b 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -583,10 +583,10 @@ read_bandwidth_usage(void) return -1; /* Okay; it looks like the state file is more up-to-date than the - * bw_accounting file, or the bw_accounting file is nonexistant, + * bw_accounting file, or the bw_accounting file is nonexistent, * or the bw_accounting file is corrupt. */ - log_info(LD_ACCT, "Reading bandwdith accounting data from state file"); + log_info(LD_ACCT, "Reading bandwidth accounting data from state file"); n_bytes_read_in_interval = state->AccountingBytesReadInInterval; n_bytes_written_in_interval = state->AccountingBytesWrittenInInterval; n_seconds_active_in_interval = state->AccountingSecondsActive; @@ -651,7 +651,7 @@ hibernate_begin(hibernate_state_t new_state, time_t now) if (new_state == HIBERNATE_STATE_EXITING && hibernate_state != HIBERNATE_STATE_LIVE) { - log_notice(LD_GENERAL,"Sigint received %s; exiting now.", + log_notice(LD_GENERAL,"SIGINT received %s; exiting now.", hibernate_state == HIBERNATE_STATE_EXITING ? "a second time" : "while hibernating"); tor_cleanup(); diff --git a/src/or/main.c b/src/or/main.c index 9163b8c26b..b21c00c9c7 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -910,7 +910,7 @@ run_scheduled_events(time_t now) } } - /* 1e. Periodicaly, if we're a v3 authority, we check whether our cert is + /* 1e. Periodically, if we're a v3 authority, we check whether our cert is * close to expiring and warn the admin if it is. */ if (time_to_check_v3_certificate < now) { v3_authority_check_key_expiry(); @@ -1127,7 +1127,7 @@ static void second_elapsed_callback(int fd, short event, void *args) { /* XXXX This could be sensibly refactored into multiple callbacks, and we - * could use libevent's timers for this rather than checking the current + * could use Libevent's timers for this rather than checking the current * time against a bunch of timeouts every second. */ static struct timeval one_second; static time_t current_second = 0; @@ -1464,7 +1464,7 @@ do_main_loop(void) * 1. We handle a different set of signals than those allowed in catch. * 2. Platforms without signal() are unlikely to define SIGfoo. * 3. The control spec is defined to use fixed numeric signal values - * which just happen to match the unix values. + * which just happen to match the Unix values. */ void control_signal_act(int the_signal) @@ -1523,7 +1523,7 @@ signal_callback(int fd, short events, void *arg) break; #ifdef SIGPIPE case SIGPIPE: - log_debug(LD_GENERAL,"Caught sigpipe. Ignoring."); + log_debug(LD_GENERAL,"Caught SIGPIPE. Ignoring."); break; #endif case SIGUSR1: @@ -1626,7 +1626,7 @@ dumpstats(int severity) tor_tls_get_buffer_sizes(or_conn->tls, &rbuf_cap, &rbuf_len, &wbuf_cap, &wbuf_len); log(severity, LD_GENERAL, - "Conn %d: %d/%d bytes used on openssl read buffer; " + "Conn %d: %d/%d bytes used on OpenSSL read buffer; " "%d/%d bytes used on write buffer.", i, rbuf_len, rbuf_cap, wbuf_len, wbuf_cap); } @@ -1702,12 +1702,12 @@ exit_function(void) void handle_signals(int is_parent) { -#ifndef MS_WINDOWS /* do signal stuff only on unix */ +#ifndef MS_WINDOWS /* do signal stuff only on Unix */ int i; static int signals[] = { SIGINT, /* do a controlled slow shutdown */ SIGTERM, /* to terminate now */ - SIGPIPE, /* otherwise sigpipe kills us */ + SIGPIPE, /* otherwise SIGPIPE kills us */ SIGUSR1, /* dump stats */ SIGUSR2, /* go to loglevel debug */ SIGHUP, /* to reload config, retry conns, etc */ @@ -1887,7 +1887,7 @@ release_lockfile(void) * * Helps us find the real leaks with dmalloc and the like. Also valgrind * should then report 0 reachable in its leak report (in an ideal world -- - * in practice libevent, ssl, libc etc never quite free everything). */ + * in practice libevent, SSL, libc etc never quite free everything). */ void tor_free_all(int postfork) { diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 54ccb113ce..573197a53f 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -947,7 +947,7 @@ router_get_consensus_status_by_nickname(const char *nickname, }); if (any_unwarned) { log_warn(LD_CONFIG,"There are multiple matches for the nickname \"%s\"," - " but none is listed as named by the directory authorites. " + " but none is listed as named by the directory authorities. " "Choosing one arbitrarily.", nickname); } } else if (warn_if_unnamed && best && !best->name_lookup_warned) { diff --git a/src/or/ntmain.c b/src/or/ntmain.c index 2304be6526..4f96fbe5d7 100644 --- a/src/or/ntmain.c +++ b/src/or/ntmain.c @@ -299,7 +299,7 @@ nt_service_main(void) case CMD_LIST_FINGERPRINT: case CMD_HASH_PASSWORD: case CMD_VERIFY_CONFIG: - log_err(LD_CONFIG, "Unsupported command (--list-fingerint, " + log_err(LD_CONFIG, "Unsupported command (--list-fingerprint, " "--hash-password, or --verify-config) in NT service."); break; case CMD_RUN_UNITTESTS: diff --git a/src/or/onion.c b/src/or/onion.c index 9e8b43c23f..b49a86aba3 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -75,7 +75,7 @@ onion_pending_add(or_circuit_t *circ, char *onionskin) circ = ol_list->circ; onion_pending_remove(ol_list->circ); log_info(LD_CIRC, - "Circuit create request is too old; cancelling due to overload."); + "Circuit create request is too old; canceling due to overload."); circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_RESOURCELIMIT); } return 0; diff --git a/src/or/or.h b/src/or/or.h index c13ca0b50f..70f5e0d63b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -136,7 +136,7 @@ /** Maximum size, in bytes, for any directory object that we've downloaded. */ #define MAX_DIR_DL_SIZE MAX_BUF_SIZE -/** For http parsing: Maximum number of bytes we'll accept in the headers +/** For HTTP parsing: Maximum number of bytes we'll accept in the headers * of an HTTP request or response. */ #define MAX_HEADERS_SIZE 50000 /** Maximum size, in bytes, for any directory object that we're accepting @@ -263,7 +263,7 @@ typedef enum { #define _OR_CONN_STATE_MAX 8 #define _EXIT_CONN_STATE_MIN 1 -/** State for an exit connection: waiting for response from dns farm. */ +/** State for an exit connection: waiting for response from DNS farm. */ #define EXIT_CONN_STATE_RESOLVING 1 /** State for an exit connection: waiting for connect() to finish. */ #define EXIT_CONN_STATE_CONNECTING 2 @@ -937,7 +937,7 @@ typedef struct connection_t { * could write? */ time_t timestamp_created; /**< When was this connection_t created? */ - /* XXXX_IP6 make this ipv6-capable */ + /* XXXX_IP6 make this IPv6-capable */ int socket_family; /**< Address family of this connection's socket. Usually * AF_INET, but it can also be AF_UNIX, or in the future * AF_INET6 */ @@ -1087,7 +1087,7 @@ typedef struct edge_connection_t { * already retried several times. */ uint8_t num_socks_retries; - /** True iff this connection is for a dns request only. */ + /** True iff this connection is for a DNS request only. */ unsigned int is_dns_request:1; /** True iff this stream must attach to a one-hop circuit (e.g. for @@ -1140,7 +1140,7 @@ typedef struct dir_connection_t { /** If we're fetching descriptors, what router purpose shall we assign * to them? */ uint8_t router_purpose; - /** List of fingerprints for networkstatuses or desriptors to be spooled. */ + /** List of fingerprints for networkstatuses or descriptors to be spooled. */ smartlist_t *fingerprint_stack; /** A cached_dir_t object that we're currently spooling out */ struct cached_dir_t *cached_dir; @@ -1241,9 +1241,9 @@ typedef struct addr_policy_t { /** A cached_dir_t represents a cacheable directory object, along with its * compressed form. */ typedef struct cached_dir_t { - char *dir; /**< Contents of this object, nul-terminated. */ + char *dir; /**< Contents of this object, NUL-terminated. */ char *dir_z; /**< Compressed contents of this object. */ - size_t dir_len; /**< Length of <b>dir</b> (not counting its nul). */ + size_t dir_len; /**< Length of <b>dir</b> (not counting its NUL). */ size_t dir_z_len; /**< Length of <b>dir_z</b>. */ time_t published; /**< When was this object published. */ int refcnt; /**< Reference count for this cached_dir_t. */ @@ -1300,7 +1300,7 @@ typedef struct signed_descriptor_t { * necessarily NUL-terminated. If saved_location is SAVED_IN_CACHE, this * pointer is null. */ char *signed_descriptor_body; - /** Length of the annotations preceeding the server descriptor. */ + /** Length of the annotations preceding the server descriptor. */ size_t annotations_len; /** Length of the server descriptor. */ size_t signed_descriptor_len; @@ -1607,7 +1607,7 @@ typedef enum { * status consensus. */ typedef struct networkstatus_t { networkstatus_type_t type; /**< Vote, consensus, or opinion? */ - time_t published; /**< Vote only: Tiem when vote was written. */ + time_t published; /**< Vote only: Time when vote was written. */ time_t valid_after; /**< Time after which this vote or consensus applies. */ time_t fresh_until; /**< Time before which this is the most recent vote or * consensus. */ @@ -1622,7 +1622,7 @@ typedef struct networkstatus_t { /** How long does this vote/consensus claim that authorities take to * distribute their votes to one another? */ int vote_seconds; - /** How long does this vote/consensus claim that authorites take to + /** How long does this vote/consensus claim that authorities take to * distribute their consensus signatures to one another? */ int dist_seconds; @@ -1903,7 +1903,7 @@ typedef struct circuit_t { /** The circuit_id used in the next (forward) hop of this circuit. */ circid_t n_circ_id; - /** The hop to which we want to extend this ciruit. Should be NULL if + /** The hop to which we want to extend this circuit. Should be NULL if * the circuit has attached to a connection. */ extend_info_t *n_hop; @@ -2168,7 +2168,7 @@ typedef struct { config_line_t *DirPolicy; /**< Lists of dir policy components */ /** Addresses to bind for listening for SOCKS connections. */ config_line_t *SocksListenAddress; - /** Addresses to bind for listening for transparent pf/nefilter + /** Addresses to bind for listening for transparent pf/netfilter * connections. */ config_line_t *TransListenAddress; /** Addresses to bind for listening for transparent natd connections */ @@ -2447,7 +2447,7 @@ typedef struct { int ServerDNSAllowBrokenConfig; smartlist_t *ServerDNSTestAddresses; /**< A list of addresses that definitely - * should be resolveable. Used for + * should be resolvable. Used for * testing our DNS server. */ int EnforceDistinctSubnets; /**< If true, don't allow multiple routers in the * same network zone in the same circuit. */ @@ -2554,7 +2554,7 @@ typedef struct { typedef struct { uint32_t _magic; /** The time at which we next plan to write the state to the disk. Equal to - * TIME_MAX if there are no saveable changes, 0 if there are changes that + * TIME_MAX if there are no savable changes, 0 if there are changes that * should be saved right away. */ time_t next_write; @@ -2818,7 +2818,7 @@ void circuit_build_failed(origin_circuit_t *circ); #define CIRCLAUNCH_ONEHOP_TUNNEL (1<<0) /** Flag to set when a circuit needs to be built of high-uptime nodes */ #define CIRCLAUNCH_NEED_UPTIME (1<<1) -/** Flag to set when a circuit needs to be build of high-capcity nodes */ +/** Flag to set when a circuit needs to be build of high-capacity nodes */ #define CIRCLAUNCH_NEED_CAPACITY (1<<2) /** Flag to set when the last hop of a circuit doesn't need to be an * exit node. */ @@ -3827,7 +3827,7 @@ void clear_pending_onions(void); /********************************* policies.c ************************/ /* (length of "accept 255.255.255.255/255.255.255.255:65535-65535\n" plus a - * nul.) + * NUL.) */ #define POLICY_BUF_LEN 52 diff --git a/src/or/policies.c b/src/or/policies.c index 6bff4e4dad..cb914d11f6 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -40,7 +40,7 @@ typedef struct policy_summary_item_t { uint16_t prt_min; /**< Lowest port number to accept/reject. */ uint16_t prt_max; /**< Highest port number to accept/reject. */ uint64_t reject_count; /**< Number of IP-Addresses that are rejected to - this portrange. */ + this port range. */ int accepted:1; /** Has this port already been accepted */ } policy_summary_item_t; @@ -795,7 +795,7 @@ exit_policy_remove_redundancies(smartlist_t *dest) * (accept/reject), A is a subset of B, and there is no other entry of * different type in between those two that intersects with A. * - * Anybody want to doublecheck the logic here? XXX + * Anybody want to double-check the logic here? XXX */ for (i = 0; i < smartlist_len(dest)-1; ++i) { ap = smartlist_get(dest, i); @@ -1136,8 +1136,8 @@ policy_summary_add_item(smartlist_t *summary, addr_policy_t *p) } /** Create a string representing a summary for an exit policy. - * The summary will either be an "accept" plus a comma-seperated list of port - * ranges or a "reject" plus portranges, depending on which is shorter. + * The summary will either be an "accept" plus a comma-separated list of port + * ranges or a "reject" plus port-ranges, depending on which is shorter. * * If no exits are allowed at all then NULL is returned, if no ports * are blocked instead of "reject " we return "accept 1-65535" (this diff --git a/src/or/relay.c b/src/or/relay.c index 472d638c81..4319d77b43 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -7,7 +7,7 @@ /** * \file relay.c * \brief Handle relay cell encryption/decryption, plus packaging and - * receiving from circuits, plus queueing on circuits. + * receiving from circuits, plus queuing on circuits. **/ #include "or.h" @@ -783,7 +783,7 @@ connection_ap_process_end_not_open( "Edge got end (%s) before we're connected. Marking for close.", stream_end_reason_to_string(rh->length > 0 ? reason : -1)); circuit_log_path(LOG_INFO,LD_APP,circ); - /* need to test because of detach_retriable*/ + /* need to test because of detach_retryable*/ if (!conn->_base.marked_for_close) connection_mark_unattached_ap(conn, control_reason); return 0; @@ -1353,7 +1353,7 @@ connection_edge_consider_sending_sendme(edge_connection_t *conn) while (conn->deliver_window < STREAMWINDOW_START - STREAMWINDOW_INCREMENT) { log_debug(conn->cpath_layer?LD_APP:LD_EXIT, - "Outbuf %d, Queueing stream sendme.", + "Outbuf %d, Queuing stream sendme.", (int)conn->_base.outbuf_flushlen); conn->deliver_window += STREAMWINDOW_INCREMENT; if (connection_edge_send_command(conn, RELAY_COMMAND_SENDME, @@ -1467,7 +1467,7 @@ circuit_consider_sending_sendme(circuit_t *circ, crypt_path_t *layer_hint) // layer_hint ? "defined" : "null"); while ((layer_hint ? layer_hint->deliver_window : circ->deliver_window) < CIRCWINDOW_START - CIRCWINDOW_INCREMENT) { - log_debug(LD_CIRC,"Queueing circuit sendme."); + log_debug(LD_CIRC,"Queuing circuit sendme."); if (layer_hint) layer_hint->deliver_window += CIRCWINDOW_INCREMENT; else diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 3be67c9f83..fb50e8dc00 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -63,7 +63,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc, rend_cache_entry_t *entry; crypt_path_t *cpath; off_t dh_offset; - crypto_pk_env_t *intro_key = NULL; + crypto_pk_env_t *intro_key; /* either Bob's public key or an intro key. */ tor_assert(introcirc->_base.purpose == CIRCUIT_PURPOSE_C_INTRODUCING); tor_assert(rendcirc->_base.purpose == CIRCUIT_PURPOSE_C_REND_READY); @@ -80,19 +80,23 @@ rend_client_send_introduction(origin_circuit_t *introcirc, goto err; } - /* first 20 bytes of payload are the hash of the intro key */ - intro_key = NULL; - SMARTLIST_FOREACH(entry->parsed->intro_nodes, rend_intro_point_t *, - intro, { - if (!memcmp(introcirc->build_state->chosen_exit->identity_digest, - intro->extend_info->identity_digest, DIGEST_LEN)) { - intro_key = intro->intro_key; - break; + /* first 20 bytes of payload are the hash of bob's pk */ + if (entry->parsed->version == 0) { /* unversioned descriptor */ + intro_key = entry->parsed->pk; + } else { /* versioned descriptor */ + intro_key = NULL; + SMARTLIST_FOREACH(entry->parsed->intro_nodes, rend_intro_point_t *, + intro, { + if (!memcmp(introcirc->build_state->chosen_exit->identity_digest, + intro->extend_info->identity_digest, DIGEST_LEN)) { + intro_key = intro->intro_key; + break; + } + }); + if (!intro_key) { + log_warn(LD_BUG, "Internal error: could not find intro key."); + goto err; } - }); - if (!intro_key) { - log_warn(LD_BUG, "Internal error: could not find intro key."); - goto err; } if (crypto_pk_get_digest(intro_key, payload)<0) { log_warn(LD_BUG, "Internal error: couldn't hash public key."); @@ -447,6 +451,28 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query) return 1; } +/** If we are not currently fetching a rendezvous service descriptor + * for the service ID <b>query</b>, start a directory connection to fetch a + * new one. + */ +void +rend_client_refetch_renddesc(const char *query) +{ + if (!get_options()->FetchHidServDescriptors) + return; + log_info(LD_REND, "Fetching rendezvous descriptor for service %s", + escaped_safe_str(query)); + if (connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query, 0)) { + log_info(LD_REND,"Would fetch a new renddesc here (for %s), but one is " + "already in progress.", escaped_safe_str(query)); + } else { + /* not one already; initiate a dir rend desc lookup */ + directory_get_from_dirserver(DIR_PURPOSE_FETCH_RENDDESC, + ROUTER_PURPOSE_GENERAL, query, + PDS_RETRY_IF_NO_SERVERS); + } +} + /** Start a connection to a hidden service directory to fetch a v2 * rendezvous service descriptor for the base32-encoded service ID * <b>query</b>. @@ -498,8 +524,8 @@ rend_client_refetch_v2_renddesc(const rend_data_t *rend_query) log_info(LD_REND, "Could not pick one of the responsible hidden " "service directories to fetch descriptors, because " "we already tried them all unsuccessfully."); - /* Close pending connections. */ - rend_client_desc_trynow(rend_query->onion_address); + /* Close pending connections (unless a v0 request is still going on). */ + rend_client_desc_trynow(rend_query->onion_address, 2); return; } @@ -526,7 +552,12 @@ rend_client_remove_intro_point(extend_info_t *failed_intro, if (r==0) { log_info(LD_REND, "Unknown service %s. Re-fetching descriptor.", escaped_safe_str(rend_query->onion_address)); + /* Fetch both, v0 and v2 rend descriptors in parallel. Use whichever + * arrives first. Exception: When using client authorization, only + * fetch v2 descriptors.*/ rend_client_refetch_v2_renddesc(rend_query); + if (rend_query->auth_type == REND_NO_AUTH) + rend_client_refetch_renddesc(rend_query->onion_address); return 0; } @@ -544,12 +575,17 @@ rend_client_remove_intro_point(extend_info_t *failed_intro, log_info(LD_REND, "No more intro points remain for %s. Re-fetching descriptor.", escaped_safe_str(rend_query->onion_address)); + /* Fetch both, v0 and v2 rend descriptors in parallel. Use whichever + * arrives first. Exception: When using client authorization, only + * fetch v2 descriptors.*/ rend_client_refetch_v2_renddesc(rend_query); + if (rend_query->auth_type == REND_NO_AUTH) + rend_client_refetch_renddesc(rend_query->onion_address); /* move all pending streams back to renddesc_wait */ while ((conn = connection_get_by_type_state_rendquery(CONN_TYPE_AP, AP_CONN_STATE_CIRCUIT_WAIT, - rend_query->onion_address))) { + rend_query->onion_address, -1))) { conn->state = AP_CONN_STATE_RENDDESC_WAIT; } @@ -658,17 +694,22 @@ rend_client_receive_rendezvous(origin_circuit_t *circ, const char *request, return -1; } -/** Find all the apconns in state AP_CONN_STATE_RENDDESC_WAIT that are - * waiting on <b>query</b>. If there's a working cache entry here with at - * least one intro point, move them to the next state. */ +/** Find all the apconns in state AP_CONN_STATE_RENDDESC_WAIT that + * are waiting on query. If there's a working cache entry here + * with at least one intro point, move them to the next state. If + * <b>rend_version</b> is non-negative, fail connections that have + * requested <b>query</b> unless there are still descriptor fetch + * requests in progress for other descriptor versions than + * <b>rend_version</b>. + */ void -rend_client_desc_trynow(const char *query) +rend_client_desc_trynow(const char *query, int rend_version) { edge_connection_t *conn; rend_cache_entry_t *entry; time_t now = time(NULL); - smartlist_t *conns = get_connection_array(); + smartlist_t *conns = get_connection_array(); SMARTLIST_FOREACH(conns, connection_t *, _conn, { if (_conn->type != CONN_TYPE_AP || @@ -702,9 +743,15 @@ rend_client_desc_trynow(const char *query) connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH); } } else { /* 404, or fetch didn't get that far */ - log_notice(LD_REND,"Closing stream for '%s.onion': hidden service is " - "unavailable (try again later).", safe_str(query)); - connection_mark_unattached_ap(conn, END_STREAM_REASON_RESOLVEFAILED); + /* Unless there are requests for another descriptor version pending, + * close the connection. */ + if (rend_version >= 0 && + !connection_get_by_type_state_rendquery(CONN_TYPE_DIR, 0, query, + rend_version == 0 ? 2 : 0)) { + log_notice(LD_REND,"Closing stream for '%s.onion': hidden service is " + "unavailable (try again later).", safe_str(query)); + connection_mark_unattached_ap(conn, END_STREAM_REASON_RESOLVEFAILED); + } } }); } diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 8dc1290499..e8330094fb 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -45,7 +45,7 @@ typedef struct rend_service_t { * authorization is performed. */ smartlist_t *clients; /**< List of rend_authorized_client_t's of * clients that may access our service. Can be NULL - * if no client authorization is peformed. */ + * if no client authorization is performed. */ /* Other fields */ crypto_pk_env_t *private_key; /**< Permanent hidden-service key. */ char service_id[REND_SERVICE_ID_LEN_BASE32+1]; /**< Onion address without @@ -63,7 +63,7 @@ typedef struct rend_service_t { * up-to-date. */ time_t next_upload_time; /**< Scheduled next hidden service descriptor * upload time. */ - /** Map from digests of diffie-hellman values INTRODUCE2 to time_t of when + /** Map from digests of Diffie-Hellman values INTRODUCE2 to time_t of when * they were received; used to prevent replays. */ digestmap_t *accepted_intros; /** Time at which we last removed expired values from accepted_intros. */ @@ -1561,7 +1561,7 @@ directory_post_to_hs_dir(rend_service_descriptor_t *renddesc, if (!router_get_by_digest(hs_dir->identity_digest)) { log_info(LD_REND, "Not sending publish request for v2 descriptor to " "hidden service directory '%s'; we don't have its " - "router descriptor. Queueing for later upload.", + "router descriptor. Queuing for later upload.", hs_dir->nickname); failed_upload = -1; continue; diff --git a/src/or/rephist.c b/src/or/rephist.c index 7bacd3abb6..11e040c945 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -24,7 +24,7 @@ uint32_t rephist_total_num=0; /** If the total weighted run count of all runs for a router ever falls * below this amount, the router can be treated as having 0 MTBF. */ #define STABILITY_EPSILON 0.0001 -/** Value by which to discount all old intervals for MTBF purposses. This +/** Value by which to discount all old intervals for MTBF purposes. This * is compounded every STABILITY_INTERVAL. */ #define STABILITY_ALPHA 0.95 /** Interval at which to discount all old intervals for MTBF purposes. */ @@ -501,7 +501,7 @@ rep_hist_get_weighted_fractional_uptime(const char *id, time_t when) /** Return a number representing how long we've known about the router whose * digest is <b>id</b>. Return 0 if the router is unknown. * - * Be careful: this measure incresases monotonically as we know the router for + * Be careful: this measure increases monotonically as we know the router for * longer and longer, but it doesn't increase linearly. */ long diff --git a/src/or/router.c b/src/or/router.c index 6d6f8dad39..a1a56b0d01 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -28,7 +28,7 @@ static tor_mutex_t *key_lock=NULL; static time_t onionkey_set_at=0; /**< When was onionkey last changed? */ /** Current private onionskin decryption key: used to decode CREATE cells. */ static crypto_pk_env_t *onionkey=NULL; -/** Previous private onionskin decription key: used to decode CREATE cells +/** Previous private onionskin decryption key: used to decode CREATE cells * generated by clients that have an older version of our descriptor. */ static crypto_pk_env_t *lastonionkey=NULL; /** Private "identity key": used to sign directory info and TLS @@ -293,7 +293,7 @@ init_key_from_file(const char *fname, int generate, int severity) * directory authority, and make sure they match. If <b>legacy</b>, load a * legacy key/cert set for emergency key migration; otherwise load the regular * key/cert set. On success, store them into *<b>key_out</b> and - * *<b>cert_out</b> respectively, and return 0. On failrue, return -1. */ + * *<b>cert_out</b> respectively, and return 0. On failure, return -1. */ static int load_authority_keyset(int legacy, crypto_pk_env_t **key_out, authority_cert_t **cert_out) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index de38e354e0..ed7f2f7a11 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -911,10 +911,10 @@ router_pick_directory_server(authority_type_t type, int flags) return choice; } -/** Try to determine which fraction of v2 and v3 directory requsts aimed at +/** Try to determine which fraction of v2 and v3 directory requests aimed at * caches will be sent to us. Set *<b>v2_share_out</b> and * *<b>v3_share_out</b> to the fractions of v2 and v3 protocol shares we - * expect to see, respectively. Return 0 on success, negative on failue. */ + * expect to see, respectively. Return 0 on success, negative on failure. */ int router_get_my_share_of_directory_requests(double *v2_share_out, double *v3_share_out) @@ -3270,7 +3270,7 @@ routerlist_remove_old_routers(void) if (caches && networkstatus_v2_list) { /* If we care about v2 statuses, we'll retain at most as many as are listed any of the v2 statues. This will be at least the length of - the largest v2 networstatus, and in the worst case, this set will be + the largest v2 networkstatus, and in the worst case, this set will be equal to the sum of the lengths of all v2 consensuses. Take the worst case. */ @@ -4616,7 +4616,7 @@ router_differences_are_cosmetic(routerinfo_t *r1, routerinfo_t *r2) (r2->bandwidthcapacity < r1->bandwidthcapacity/2)) return 0; - /* Did the bandwithrate or bandwithburst change? */ + /* Did the bandwidthrate or bandwidthburst change? */ if ((r1->bandwidthrate != r2->bandwidthrate) || (r1->bandwidthburst != r2->bandwidthburst)) return 0; @@ -4979,7 +4979,7 @@ routerset_refresh_countries(routerset_t *target) * * Three kinds of elements are allowed in routersets: nicknames, IP address * patterns, and fingerprints. They may be surrounded by optional space, and - * mst be separated by commas. + * must be separated by commas. */ int routerset_parse(routerset_t *target, const char *s, const char *description) diff --git a/src/or/routerparse.c b/src/or/routerparse.c index c08a058a09..8021158e31 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -167,7 +167,7 @@ typedef struct token_rule_t { /** If true, we concatenate all arguments for this item into a single * string. */ int concat_args; - /** Requirments on object syntax for this item. */ + /** Requirements on object syntax for this item. */ obj_syntax os; /** Lowest number of times this item may appear in a document. */ int min_cnt; @@ -217,7 +217,7 @@ typedef struct token_rule_t { /* Argument multiplicity: exactly <b>n</b> arguments. */ #define EQ(n) n,n,0 -/** List of tokens allowable in router derscriptors */ +/** List of tokens allowable in router descriptors */ static token_rule_t routerdesc_token_table[] = { T0N("reject", K_REJECT, ARGS, NO_OBJ ), T0N("accept", K_ACCEPT, ARGS, NO_OBJ ), @@ -601,7 +601,7 @@ router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, * <b>versionlist</b> is newer than <b>myversion</b>. Else, return * VS_NEW_IN_SERIES if there is at least one member of <b>versionlist</b> in * the same series (major.minor.micro) as <b>myversion</b>, but no such member - * is newer than <b>myversion.</b>. Else, return VS_NEW if every memeber of + * is newer than <b>myversion.</b>. Else, return VS_NEW if every member of * <b>versionlist</b> is older than <b>myversion</b>. Else, return * VS_UNRECOMMENDED. * @@ -3166,7 +3166,7 @@ tokenize_string(memarea_t *area, } if ((flags & TS_NO_NEW_ANNOTATIONS)) { if (first_nonannotation != prev_len) { - log_warn(LD_DIR, "parse error: Unexpectd annotations."); + log_warn(LD_DIR, "parse error: Unexpected annotations."); return -1; } } @@ -3453,7 +3453,7 @@ tor_version_same_series(tor_version_t *a, tor_version_t *b) } /** Helper: Given pointers to two strings describing tor versions, return -1 - * if _a precedes _b, 1 if _b preceeds _a, and 0 if they are equivalent. + * if _a precedes _b, 1 if _b precedes _a, and 0 if they are equivalent. * Used to sort a list of versions. */ static int _compare_tor_version_str_ptr(const void **_a, const void **_b) diff --git a/src/or/test.c b/src/or/test.c index 6ce0aaeb47..d43eb8f225 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2492,7 +2492,7 @@ test_util_gzip(void) test_assert(buf3); test_streq(buf1,buf3); - /* Check whether we can uncompress concatenated, compresed strings. */ + /* Check whether we can uncompress concatenated, compressed strings. */ tor_free(buf3); buf2 = tor_realloc(buf2, len1*2); memcpy(buf2+len1, buf2, len1); @@ -2514,7 +2514,7 @@ test_util_gzip(void) test_assert(!tor_gzip_compress(&buf2, &len1, buf1, strlen(buf1)+1, ZLIB_METHOD)); tor_assert(len1>16); - /* when we allow an uncomplete string, we should succeed.*/ + /* when we allow an incomplete string, we should succeed.*/ tor_assert(!tor_gzip_uncompress(&buf3, &len2, buf2, len1-16, ZLIB_METHOD, 0, LOG_INFO)); buf3[len2]='\0'; @@ -3004,7 +3004,7 @@ test_dir_format(void) test_assert(!crypto_pk_get_fingerprint(pk2, fingerprint, 1)); strlcat(buf2, fingerprint, sizeof(buf2)); strlcat(buf2, "\nuptime 0\n" - /* XXX the "0" above is hardcoded, but even if we made it reflect + /* XXX the "0" above is hard-coded, but even if we made it reflect * uptime, that still wouldn't make it right, because the two * descriptors might be made on different seconds... hm. */ "bandwidth 1000 5000 10000\n" @@ -4616,25 +4616,25 @@ test_geoip(void) get_options()->BridgeRecordUsageByCountry = 1; /* Put 9 observations in AB... */ for (i=32; i < 40; ++i) - geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now); - geoip_note_client_seen(GEOIP_CLIENT_CONNECT, 225, now); + geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-7200); + geoip_note_client_seen(GEOIP_CLIENT_CONNECT, 225, now-7200); /* and 3 observations in XY, several times. */ for (j=0; j < 10; ++j) for (i=52; i < 55; ++i) geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-3600); /* and 17 observations in ZZ... */ for (i=110; i < 127; ++i) - geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now-7200); + geoip_note_client_seen(GEOIP_CLIENT_CONNECT, i, now); s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT); test_assert(s); test_streq("zz=24,ab=16,xy=8", s); tor_free(s); - /* Now clear out all the zz observations. */ + /* Now clear out all the AB observations. */ geoip_remove_old_clients(now-6000); s = geoip_get_client_history(now+5*24*60*60, GEOIP_CLIENT_CONNECT); test_assert(s); - test_streq("ab=16,xy=8", s); + test_streq("zz=24,xy=8", s); done: tor_free(s); |