Merge remote-tracking branch 'origin/maint-0.2.6' into release-0.2.6

This commit is contained in:
Nick Mathewson 2015-03-09 13:36:39 -04:00
commit 0cbef8be88
16 changed files with 74 additions and 12 deletions

View File

@ -73,7 +73,7 @@ test-network: all
test-stem: $(TESTING_TOR_BINARY) test-stem: $(TESTING_TOR_BINARY)
@if test -d "$$STEM_SOURCE_DIR"; then \ @if test -d "$$STEM_SOURCE_DIR"; then \
"$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL; \ $(PYTHON) "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL; \
else \ else \
echo '$$STEM_SOURCE_DIR was not set.'; echo; \ echo '$$STEM_SOURCE_DIR was not set.'; echo; \
echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \ echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \

3
changes/15188 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (testing):
- Avoid a side-effect in a tor_assert() in the unit tests. Fixes bug
15188; bugfix on 0.1.2.3-alpha. Patch from Tom van der Woerdt.

4
changes/bug15033 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (tests):
- When running the zero-length-keys check, do not use the default
torrc file. Fixes bug 15033; bugfix on 0.2.6.3-alpha. Reported
by "reezer".

4
changes/bug15037 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (testing):
- When running the new 'make test-stem' target, use the configured
python binary. Fixes bug 15037; bugfix on 0.2.6.3-alpha. Patch
from "cypherpunks".

4
changes/bug15064 Normal file
View File

@ -0,0 +1,4 @@
o Major bugfixes (FreeBSD IPFW transparent proxy):
- Fix address detection with FreeBSD transparent proxies,
when "TransProxyType ipfw" is in use.
Fixes bug 15064; bugfix on 0.2.5.4-alpha.

10
changes/bug15083 Normal file
View File

@ -0,0 +1,10 @@
o Major bugfixes (relay, stability, possible security):
- Fix a bug that could lead to a relay crashing with an assertion
failure if a buffer of exactly the wrong layout was passed
to buf_pullup() at exactly the wrong time. Fixes bug 15083;
bugfix on 0.2.0.10-alpha. Patch from 'cypherpunks'.
- Do not assert if the 'data' pointer on a buffer is advanced to the very
end of the buffer; log a BUG message instead. Only assert if it is
past that point. Fixes bug 15083; bugfix on 0.2.0.10-alpha.

4
changes/bug15088 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes (Linux seccomp2 sandbox):
- Upon receiving sighup, do not crash during attempts to call
wait4. Fixes bug 15088; bugfix on 0.2.5.1-alpha. Patch from
"sanic".

3
changes/bug15151 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (compilation):
- Fix a compilation warning on FreeBSD. Fixes bug 15151; bugfix on
0.2.6.2-alpha.

4
changes/feature15006 Normal file
View File

@ -0,0 +1,4 @@
o Minor features (controller):
- Messages about problems in the bootstrap process now include
information about the server we were trying to connect to when we
noticed the problem. Closes ticket 15006.

5
changes/ticket14128 Normal file
View File

@ -0,0 +1,5 @@
o Minor features (controller):
- New "GETINFO bw-event-cache" to get information about recent bandwidth
events. Closes ticket 14128. Useful for controllers to get recent
bandwidth history after the fix for 13988.

View File

@ -176,6 +176,7 @@ static int filter_nopar_gen[] = {
#endif #endif
SCMP_SYS(stat), SCMP_SYS(stat),
SCMP_SYS(uname), SCMP_SYS(uname),
SCMP_SYS(wait4),
SCMP_SYS(write), SCMP_SYS(write),
SCMP_SYS(writev), SCMP_SYS(writev),
SCMP_SYS(exit_group), SCMP_SYS(exit_group),

View File

@ -232,7 +232,7 @@ buf_pullup(buf_t *buf, size_t bytes, int nulterminate)
size_t n = bytes - dest->datalen; size_t n = bytes - dest->datalen;
src = dest->next; src = dest->next;
tor_assert(src); tor_assert(src);
if (n > src->datalen) { if (n >= src->datalen) {
memcpy(CHUNK_WRITE_PTR(dest), src->data, src->datalen); memcpy(CHUNK_WRITE_PTR(dest), src->data, src->datalen);
dest->datalen += src->datalen; dest->datalen += src->datalen;
dest->next = src->next; dest->next = src->next;
@ -2436,7 +2436,14 @@ assert_buf_ok(buf_t *buf)
total += ch->datalen; total += ch->datalen;
tor_assert(ch->datalen <= ch->memlen); tor_assert(ch->datalen <= ch->memlen);
tor_assert(ch->data >= &ch->mem[0]); tor_assert(ch->data >= &ch->mem[0]);
tor_assert(ch->data < &ch->mem[0]+ch->memlen); tor_assert(ch->data <= &ch->mem[0]+ch->memlen);
if (ch->data == &ch->mem[0]+ch->memlen) {
static int warned = 0;
if (! warned) {
log_warn(LD_BUG, "Invariant violation in buf.c related to #15083");
warned = 1;
}
}
tor_assert(ch->data+ch->datalen <= &ch->mem[0] + ch->memlen); tor_assert(ch->data+ch->datalen <= &ch->mem[0] + ch->memlen);
if (!ch->next) if (!ch->next)
tor_assert(ch == buf->tail); tor_assert(ch == buf->tail);

View File

@ -1598,7 +1598,6 @@ destination_from_socket(entry_connection_t *conn, socks_request_t *req)
struct sockaddr_storage orig_dst; struct sockaddr_storage orig_dst;
socklen_t orig_dst_len = sizeof(orig_dst); socklen_t orig_dst_len = sizeof(orig_dst);
tor_addr_t addr; tor_addr_t addr;
int rv;
#ifdef TRANS_TRPOXY #ifdef TRANS_TRPOXY
if (options->TransProxyType_parsed == TPT_TPROXY) { if (options->TransProxyType_parsed == TPT_TPROXY) {
@ -1613,6 +1612,7 @@ destination_from_socket(entry_connection_t *conn, socks_request_t *req)
#endif #endif
#ifdef TRANS_NETFILTER #ifdef TRANS_NETFILTER
int rv = -1;
switch (ENTRY_TO_CONN(conn)->socket_family) { switch (ENTRY_TO_CONN(conn)->socket_family) {
#ifdef TRANS_NETFILTER_IPV4 #ifdef TRANS_NETFILTER_IPV4
case AF_INET: case AF_INET:
@ -1763,7 +1763,8 @@ connection_ap_get_original_destination(entry_connection_t *conn,
if (options->TransProxyType_parsed == TPT_PF_DIVERT) if (options->TransProxyType_parsed == TPT_PF_DIVERT)
return destination_from_socket(conn, req); return destination_from_socket(conn, req);
if (options->TransProxyType_parsed == TPT_DEFAULT) if (options->TransProxyType_parsed == TPT_DEFAULT ||
options->TransProxyType_parsed == TPT_IPFW)
return destination_from_pf(conn, req); return destination_from_pf(conn, req);
(void)conn; (void)conn;

View File

@ -5086,19 +5086,26 @@ MOCK_IMPL(void,
log_fn(severity, log_fn(severity,
LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; " LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
"count %d; recommendation %s)", "count %d; recommendation %s; host %s at %s:%d)",
status, summary, warn, status, summary, warn,
orconn_end_reason_to_control_string(reason), orconn_end_reason_to_control_string(reason),
bootstrap_problems, recommendation); bootstrap_problems, recommendation,
hex_str(or_conn->identity_digest, DIGEST_LEN),
or_conn->base_.address,
or_conn->base_.port);
connection_or_report_broken_states(severity, LD_HANDSHAKE); connection_or_report_broken_states(severity, LD_HANDSHAKE);
tor_snprintf(buf, sizeof(buf), tor_snprintf(buf, sizeof(buf),
"BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s " "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
"COUNT=%d RECOMMENDATION=%s", "COUNT=%d RECOMMENDATION=%s HOSTID=\"%s\" HOSTADDR=\"%s:%d\"",
bootstrap_percent, tag, summary, warn, bootstrap_percent, tag, summary, warn,
orconn_end_reason_to_control_string(reason), bootstrap_problems, orconn_end_reason_to_control_string(reason), bootstrap_problems,
recommendation); recommendation,
hex_str(or_conn->identity_digest, DIGEST_LEN),
or_conn->base_.address,
(int)or_conn->base_.port);
tor_snprintf(last_sent_bootstrap_message, tor_snprintf(last_sent_bootstrap_message,
sizeof(last_sent_bootstrap_message), sizeof(last_sent_bootstrap_message),
"WARN %s", buf); "WARN %s", buf);

View File

@ -165,18 +165,21 @@ static crypto_pk_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL};
crypto_pk_t * crypto_pk_t *
pk_generate(int idx) pk_generate(int idx)
{ {
int res;
#ifdef CACHE_GENERATED_KEYS #ifdef CACHE_GENERATED_KEYS
tor_assert(idx < N_PREGEN_KEYS); tor_assert(idx < N_PREGEN_KEYS);
if (! pregen_keys[idx]) { if (! pregen_keys[idx]) {
pregen_keys[idx] = crypto_pk_new(); pregen_keys[idx] = crypto_pk_new();
tor_assert(!crypto_pk_generate_key(pregen_keys[idx])); res = crypto_pk_generate_key(pregen_keys[idx]);
tor_assert(!res);
} }
return crypto_pk_dup_key(pregen_keys[idx]); return crypto_pk_dup_key(pregen_keys[idx]);
#else #else
crypto_pk_t *result; crypto_pk_t *result;
(void) idx; (void) idx;
result = crypto_pk_new(); result = crypto_pk_new();
tor_assert(!crypto_pk_generate_key(result)); res = crypto_pk_generate_key(result);
tor_assert(!res);
return result; return result;
#endif #endif
} }

View File

@ -36,9 +36,11 @@ if [ ! -d "$DATA_DIR" ]; then
fi fi
trap "rm -rf '$DATA_DIR'" 0 trap "rm -rf '$DATA_DIR'" 0
touch "$DATA_DIR"/empty_torrc
# DisableNetwork means that the ORPort won't actually be opened. # DisableNetwork means that the ORPort won't actually be opened.
# 'ExitRelay 0' suppresses a warning. # 'ExitRelay 0' suppresses a warning.
TOR="./src/or/tor --hush --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0" TOR="./src/or/tor --hush --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f $DATA_DIR/empty_torrc"
if [ -s "$DATA_DIR"/keys/secret_id_key ] && [ -s "$DATA_DIR"/keys/secret_onion_key ] && if [ -s "$DATA_DIR"/keys/secret_id_key ] && [ -s "$DATA_DIR"/keys/secret_onion_key ] &&
[ -s "$DATA_DIR"/keys/secret_onion_key_ntor ]; then [ -s "$DATA_DIR"/keys/secret_onion_key_ntor ]; then