From f9de12b864cc2b2fd5c3327f9dccf16deeefb483 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sat, 27 Feb 2010 16:27:44 +0100 Subject: [PATCH 1/7] Ship the asciidoc-helper file in our tarballs Otherwise, the build process breaks when one of the .1.txt gets a new mtime. Suggested by weasel. --- ChangeLog | 3 +++ doc/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ab11ddb6d5..7ee0ebec96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ Changes in version 0.2.2.10-alpha - 2010-??-?? fixes bug 1255. - Disallow values larger than INT32_MAX for PerConnBWRate|Burst config option. Bugfix on 0.2.2.7-alpha. + - Ship the asciidoc-helper file in the tarball, so that people can + build from source if they want to, and touching the .1.txt files + doesn't break the build. Bugfix on 0.2.2.9-alpha. o Code simplifications and refactoring: - Fix some urls in the exit notice file and make it XHTML1.1 strict diff --git a/doc/Makefile.am b/doc/Makefile.am index 492dd3bd51..cccc94823d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -19,7 +19,7 @@ html_in = $(asciidoc_files:=.html.in) man_in = $(asciidoc_files:=.1.in) -EXTRA_DIST = HACKING \ +EXTRA_DIST = HACKING asciidoc-helper.sh \ $(html_in) $(man_in) $(asciidoc_files:=.1.txt) \ tor-osx-dmg-creation.txt tor-rpm-creation.txt \ tor-win32-mingw-creation.txt From 0cd1b499b46fa112e0d81e467a0d07f79e04bbdb Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sat, 27 Feb 2010 17:06:06 +0100 Subject: [PATCH 2/7] Simplify asciidoc-helper We don't need sed for our string manipulation, so let's get rid of it. Suggested by weasel. --- ChangeLog | 2 +- doc/Makefile.am | 4 ++-- doc/asciidoc-helper.sh | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ee0ebec96..4b291047a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,7 +30,7 @@ Changes in version 0.2.2.10-alpha - 2010-??-?? o Code simplifications and refactoring: - Fix some urls in the exit notice file and make it XHTML1.1 strict compliant. Based on a patch from Christian Kujau. - + - Don't use sed in asciidoc-helper anymore. Changes in version 0.2.2.9-alpha - 2010-02-22 o Directory authority changes: diff --git a/doc/Makefile.am b/doc/Makefile.am index cccc94823d..dbc44f0fbf 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -39,7 +39,7 @@ DIST_SUBDIRS = spec # Generate the html documentation from asciidoc, but don't do # machine-specific replacements yet $(html_in) : - $(top_srcdir)/doc/asciidoc-helper.sh html @ASCIIDOC@ @SED@ $(top_srcdir)/doc/$@ + $(top_srcdir)/doc/asciidoc-helper.sh html @ASCIIDOC@ $(top_srcdir)/doc/$@ tor.html.in : tor.1.txt torify.html.in : torify.1.txt @@ -49,7 +49,7 @@ tor-resolve.html.in : tor-resolve.1.txt # Generate the manpage from asciidoc, but don't do # machine-specific replacements yet $(man_in) : - $(top_srcdir)/doc/asciidoc-helper.sh man @A2X@ @SED@ $(top_srcdir)/doc/$@ + $(top_srcdir)/doc/asciidoc-helper.sh man @A2X@ $(top_srcdir)/doc/$@ tor.1.in : tor.1.txt torify.1.in : torify.1.txt diff --git a/doc/asciidoc-helper.sh b/doc/asciidoc-helper.sh index 90a003d496..25b438cd81 100755 --- a/doc/asciidoc-helper.sh +++ b/doc/asciidoc-helper.sh @@ -4,19 +4,19 @@ # See LICENSE for licensing information # Run this to generate .html.in or .1.in files from asciidoc files. # Arguments: -# html|man asciidocpath sedpath outputfile +# html|man asciidocpath outputfile set -e -if [ $# != 4 ]; then +if [ $# != 3 ]; then exit 1; fi -output=$4 -input=`echo $output | $3 -e 's/html\.in$/1\.txt/g' -e 's/1\.in$/1\.txt/g'` -base=`echo $output | $3 -e 's/\.html\.in$//g' -e 's/\.1\.in$//g'` +output=$3 if [ "$1" = "html" ]; then + input=${output%%.html.in}.1.txt + base=${output%%.html.in} if [ "$2" != none ]; then "$2" -d manpage -o $output $input; else @@ -29,6 +29,9 @@ if [ "$1" = "html" ]; then echo "=================================="; fi elif [ "$1" = "man" ]; then + input=${output%%.1.in}.1.txt + base=${output%%.1.in} + if test "$2" != none; then if $2 -f manpage $input; then mv $base.1 $output; From 4db5e7ae7698393552c34d2c28180bbefa87fd62 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Mon, 1 Mar 2010 03:17:48 +0100 Subject: [PATCH 3/7] Add configure switch to disable use of asciidoc Also break the build if that switch isn't used and asciidoc isn't available. --- ChangeLog | 6 ++++++ configure.in | 23 +++++++++++++++++++++++ doc/Makefile.am | 4 ++++ doc/asciidoc-helper.sh | 34 +++++++--------------------------- 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b291047a6..fa40572480 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,10 @@ Changes in version 0.2.2.10-alpha - 2010-??-?? circuits now only differ from fast ones in that they can use nodes not marked with the Fast flag. + o Minor features: + - Allow disabling building of the manpages. This speeds up the + build considerably. + o Minor bugfixes: - Fix a memleak in the EXTENDCIRCUIT logic. Spotted by coverity. Bugfix on 0.2.2.9-alpha. @@ -31,6 +35,8 @@ Changes in version 0.2.2.10-alpha - 2010-??-?? - Fix some urls in the exit notice file and make it XHTML1.1 strict compliant. Based on a patch from Christian Kujau. - Don't use sed in asciidoc-helper anymore. + - Make the build process fail if asciidoc cannot be found, and + building with asciidoc isn't disabled. Changes in version 0.2.2.9-alpha - 2010-02-22 o Directory authority changes: diff --git a/configure.in b/configure.in index e045c08b35..6e73a2aad8 100644 --- a/configure.in +++ b/configure.in @@ -49,6 +49,15 @@ AC_ARG_ENABLE(transparent, *) AC_MSG_ERROR(bad value for --enable-transparent) ;; esac], [transparent=true]) +AC_ARG_ENABLE(asciidoc, + AS_HELP_STRING(--disable-asciidoc, don't use asciidoc (disables building of manpages)), + [case "${enableval}" in + yes) asciidoc=true ;; + no) asciidoc=false ;; + *) AC_MSG_ERROR(bad value for --disable-asciidoc) ;; + esac], [asciidoc=true]) + + AC_ARG_ENABLE(threads, AS_HELP_STRING(--disable-threads, disable multi-threading support)) @@ -97,6 +106,20 @@ AC_CHECK_PROG([SED],[sed],[sed],[/bin/false]) dnl check for asciidoc and a2x AC_PATH_PROG([ASCIIDOC], [asciidoc], none) AC_PATH_PROG([A2X], [a2x], none) +AC_PATH_PROG([XSLTPROC], [xsltproc], none) +if test x$asciidoc = xtrue ; then + if test x$ASCIIDOC = xnone ; then + AC_MSG_ERROR("Couldn't find asciidoc. reconfigure with --disable-asciidoc to build without asciidoc.") + fi + if test x$A2X = xnone ; then + AC_MSG_ERROR("Couldn't find a2x. reconfigure with --disable-asciidoc to build without a2x.") + fi + if test x$XSLTPROC = xnone ; then + AC_MSG_ERROR("Couldn't find xsltproc. reconfigure with --disable-asciidoc to build without xsltproc.") + fi +fi + +AM_CONDITIONAL(USE_ASCIIDOC, test x$asciidoc = xtrue) AC_PATH_PROG([SHA1SUM], [sha1sum], none) AC_PATH_PROG([OPENSSL], [openssl], none) diff --git a/doc/Makefile.am b/doc/Makefile.am index dbc44f0fbf..e7edb0476b 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -13,7 +13,11 @@ # part of the source distribution, so that people without asciidoc can # just use the .1 and .html files. +if USE_ASCIIDOC asciidoc_files = tor tor-gencert tor-resolve torify +else +asciidoc_files = +endif html_in = $(asciidoc_files:=.html.in) diff --git a/doc/asciidoc-helper.sh b/doc/asciidoc-helper.sh index 25b438cd81..d24b31918c 100755 --- a/doc/asciidoc-helper.sh +++ b/doc/asciidoc-helper.sh @@ -17,41 +17,21 @@ output=$3 if [ "$1" = "html" ]; then input=${output%%.html.in}.1.txt base=${output%%.html.in} - if [ "$2" != none ]; then - "$2" -d manpage -o $output $input; - else - echo "=================================="; - echo; - echo "The manpage in html form for $base will "; - echo "NOT be available, because asciidoc doesn't appear to be "; - echo "installed!"; - echo; - echo "=================================="; - fi + "$2" -d manpage -o $output $input; elif [ "$1" = "man" ]; then input=${output%%.1.in}.1.txt base=${output%%.1.in} - if test "$2" != none; then - if $2 -f manpage $input; then - mv $base.1 $output; - else - echo "=================================="; - echo; - echo "a2x is installed, but some required docbook support files are"; - echo "missing. Please install docbook-xsl and docbook-xml (Debian)"; - echo "or similar."; - echo; - echo "=================================="; - fi; + if "$2" -f manpage $input; then + mv $base.1 $output; else echo "=================================="; echo; - echo "The manpage for $base will NOT be "; - echo "available, because a2x doesn't appear to be installed!"; + echo "a2x is installed, but some required docbook support files are"; + echo "missing. Please install docbook-xsl and docbook-xml (Debian)"; + echo "or similar."; echo; echo "=================================="; + exit 1; fi fi - -touch $output; \ From 404af59ed553e7c1f4cef6668b6832e0bd1a8956 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 2 Mar 2010 10:40:21 -0500 Subject: [PATCH 4/7] Backport fix for time-goes-forward test. Fix bug 1267 --- src/or/test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/or/test.c b/src/or/test.c index b451638c28..6b7066c385 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1294,6 +1294,7 @@ test_util(void) smartlist_free(sl); } + tor_gettimeofday(&start); /* now make sure time works. */ tor_gettimeofday(&end); /* We might've timewarped a little. */ From f3003d588fb379fae9a99568aa58d445ee7e2f0d Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Wed, 3 Mar 2010 23:56:23 -0500 Subject: [PATCH 5/7] Add proposal 170 "Configuration options regarding circuit building" --- doc/spec/proposals/000-index.txt | 2 + doc/spec/proposals/170-user-path-config.txt | 95 +++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 doc/spec/proposals/170-user-path-config.txt diff --git a/doc/spec/proposals/000-index.txt b/doc/spec/proposals/000-index.txt index 664c5654da..62327a1e61 100644 --- a/doc/spec/proposals/000-index.txt +++ b/doc/spec/proposals/000-index.txt @@ -90,6 +90,7 @@ Proposals by number: 167 Vote on network parameters in consensus [CLOSED] 168 Reduce default circuit window [OPEN] 169 Eliminate TLS renegotiation for the Tor connection handshake [DRAFT] +170 Configuration options regarding circuit building [DRAFT] Proposals by status: @@ -101,6 +102,7 @@ Proposals by status: 141 Download server descriptors on demand 144 Increase the diversity of circuits by detecting nodes belonging the same provider 169 Eliminate TLS renegotiation for the Tor connection handshake [for 0.2.2] + 170 Configuration options regarding circuit building NEEDS-REVISION: 131 Help users to verify they are using Tor OPEN: diff --git a/doc/spec/proposals/170-user-path-config.txt b/doc/spec/proposals/170-user-path-config.txt new file mode 100644 index 0000000000..fa74c76f73 --- /dev/null +++ b/doc/spec/proposals/170-user-path-config.txt @@ -0,0 +1,95 @@ +Title: Configuration options regarding circuit building +Filename: 170-user-path-config.txt +Author: Sebastian Hahn +Created: 01-March-2010 +Status: Draft + +Overview: + + This document outlines how Tor handles the user configuration + options to influence the circuit building process. + +Motivation: + + Tor's treatment of the configuration *Nodes options was surprising + to many users, and quite a few conspiracy theories have crept up. We + should update our specification and code to better describe and + communicate what is going during circuit building, and how we're + honoring configuration. So far, we've been tracking a bugreport + about this behaviour ( + https://bugs.torproject.org/flyspray/index.php?do=details&id=1090 ) + and Nick replied in a thread on or-talk ( + http://archives.seul.org/or/talk/Feb-2010/msg00117.html ). + + This proposal tries to document our intention for those configuration + options. + +Design: + + Five configuration options are available to users to influence Tor's + circuit building. EntryNodes and ExitNodes define a list of nodes + that are for the Entry/Exit position in all circuits. ExcludeNodes + is a list of nodes that are used for no circuit, and + ExcludeExitNodes is a list of nodes that aren't used as the last + hop. StrictNodes defines Tor's behaviour in case of a conflict, for + example when a node that is excluded is the only available + introduction point. Setting StrictNodes to 1 breaks Tor's + functionality in that case, and it will refuse to build such a + circuit. + + Neither Nick's email nor bug 1090 have clear suggestions how we + should behave in each case, so I tried to come up with something + that made sense to me. + +Security implications: + + Deviating from normal circuit building can break one's anonymity, so + the documentation of the above option should contain a warning to + make users aware of the pitfalls. + +Specification: + + It is proposed that the "User configuration" part of path-spec + (section 2.2.2) be replaced with this: + + Users can alter the default behavior for path selection with + configuration options. In case of conflicts (excluding and requiring + the same node) the "StrictNodes" option is used to determine + behaviour. If a nodes is both excluded and required via a + configuration option, the exclusion takes preference. + + - If "ExitNodes" is provided, then every request requires an exit + node on the ExitNodes list. If a request is supported by no nodes + on that list, and "StrictNodes" is false, then Tor treats that + request as if ExitNodes were not provided. + + - "EntryNodes" behaves analogously. + + - If "ExcludeNodes" is provided, then no circuit uses any of the + nodes listed. If a circuit requires an excluded node to be used, + and "StrictNodes" is false, then Tor uses the node in that + position while not using any other of the excluded nodes. + + - If "ExcludeExitNodes" is provided, then Tor will not use the nodes + listed for the exit position in a circuit. If a circuit requires + an excluded node to be used in the exit position and "StrictNodes" + is false, then Tor builds that circuit as if ExcludeExitNodes were + not provided. + + - If a user tries to connect to or resolve a hostname of the form + ..exit and the "AllowDotExit" configuration + option is set to 1, the request is rewritten to a request for + , and the request is only supported by the exit whose + nickname or fingerprint is . If "AllowDotExit" is set + to 0 (default), any request for .exit is denied. + + - When any of the *Nodes settings are changed, all circuits are + expired immediately, to prevent a situation where a previously + built circuit is used even though some of its nodes are now + excluded. + + +Compatibility: + + The old Strict*Nodes options are deprecated, and the StrictNodes + option is new. Tor users may need to update their configuration file. From 2b5e1d363640e34ec803044f0f8d086dfdd40a6b Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Wed, 3 Mar 2010 21:02:01 -0800 Subject: [PATCH 6/7] Woops, forgot the second warn. Also, differentiate the two log messages. --- src/or/routerlist.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 392588cef4..a67703ca4b 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1576,10 +1576,10 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, rule == WEIGHT_FOR_MID || rule == WEIGHT_FOR_DIR); - if (!sl || smartlist_len(sl) == 0) { + if (smartlist_len(sl) == 0) { log_info(LD_CIRC, - "Empty routerlist passed in to node selection for rule %d", - rule); + "Empty routerlist passed in to consensus weight node " + "selection for rule %d", rule); return NULL; } @@ -1783,9 +1783,9 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule, rule == WEIGHT_FOR_EXIT || rule == WEIGHT_FOR_GUARD); - if (!sl || smartlist_len(sl) == 0) { - log_warn(LD_CIRC, - "Empty routerlist passed in to node selection for rule %d", + if (smartlist_len(sl) == 0) { + log_info(LD_CIRC, + "Empty routerlist passed in to old node selection for rule %d", rule); return NULL; } From 3ff092391b065561da339dc05614beb4e586a4d8 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 4 Mar 2010 18:37:40 -0500 Subject: [PATCH 7/7] Apply Roger's bug 1269 fix. From http://archives.seul.org/tor/relays/Mar-2010/msg00006.html : As I understand it, the bug should show up on relays that don't set Address to an IP address (so they need to resolve their Address line or their hostname to guess their IP address), and their hostname or Address line fails to resolve -- at that point they'll pick a random 4 bytes out of memory and call that their address. At the same time, relays that *do* successfully resolve their address will ignore the result, and only come up with a useful address if their interface address happens to be a public IP address. --- ChangeLog | 4 ++++ src/or/config.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b64d582ba..d98b262821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ Changes in version 0.2.1.25 - 2010-??-?? - When freeing a cipher, zero it out completely. We only zeroed the first ptrsize bytes. Bugfix on tor-0.0.2pre8. Discovered and patched by ekir. Fixes bug 1254. + - Avoid a bug that set IPs incorrectly on relays that did't set + Address to an IP address, when that address fails to resolve. + Fixes bug 1269. + o Minor bugfixes: - Fix a dereference-then-NULL-check sequence when publishing descriptors. Bugfix on tor-0.2.1.5-alpha. Discovered by ekir, diff --git a/src/or/config.c b/src/or/config.c index c7c1e19bcb..26e42e7009 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2367,7 +2367,7 @@ resolve_my_address(int warn_severity, or_options_t *options, if (tor_inet_aton(hostname, &in) == 0) { /* then we have to resolve it */ explicit_ip = 0; - if(!tor_lookup_hostname(hostname, &addr)) { + if (tor_lookup_hostname(hostname, &addr)) { uint32_t interface_ip; if (explicit_hostname) {