Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5373 closed defect (fixed)

"socksport 2000 testingtornetwork 1" results in socksport 9050

Reported by: arma Owned by:
Priority: High Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


If you run Tor client with these two options, it ignores your requested socksport.

This is an important bug because it is preventing our Tor network simulators from running the 0.2.3 branch. (Whee.)

Child Tickets

Change History (8)

comment:1 Changed 8 years ago by arma

Here's the XXX from config.c that's very related:

  if (newoptions->TestingTorNetwork) {
    /* XXXX this is a bit of a kludge.  perhaps there's a better way to do
     * this?  We could, for example, make the parsing algorithm do two passes
     * over the configuration.  If it finds any "suite" options like
     * TestingTorNetwork, it could change the defaults before its second pass.
     * Not urgent so long as this seems to work, but at any sign of trouble,
     * let's clean it up.  -NM */

comment:2 Changed 8 years ago by arma

It works as expected if you set socksport 2000 in your torrc. It's only if you say it on the command line that it gets ignored.

Perhaps we are not re-integrating the commandline args when reparsing the options after resetting the defaults to be testing_tor_network_defaults[] ?

comment:3 Changed 8 years ago by nickm

Probably, it has something to do with the changes in how we parse the *Port options, and in how we do multilevel config.

Weirdly, on the commandline, I can reproduce this bug.. but when I do so, I don't get the warning about using testingtornetwork with a standard set of dirservers.

comment:4 Changed 8 years ago by arma

Recommended workaround for now, option one:

Put testingtornetwork and socksport in your torrc file, not on the commandline.

Recommended workaround, option two:

Make a torrc.1 with testingtornetwork, dirservers, all the static stuff, and a torrc.2 with the socksport. Then run tor as "tor --defaults-torrc torrc.1 -f torrc.2"

comment:5 Changed 8 years ago by arma

This patch fixes it for me:

diff --git a/src/or/config.c b/src/or/config.c
index 3a7bf65..0c699b0 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4660,6 +4660,13 @@ options_init_from_string(const char *cf_defaults, const 
       if (i==0)
         newdefaultoptions = options_dup(&options_format, newoptions);
+    /* Assign command-line variables a second time too */
+    retval = config_assign(&options_format, newoptions,
+                           global_cmdline_options, 0, 0, msg);
+    if (retval < 0) {
+      err = SETOPT_ERR_PARSE;
+      goto err;
+    }
   /* Validate newoptions */

comment:6 Changed 8 years ago by arma

Resolution: fixed
Status: newclosed

I pushed a fix to master in 12594f27db.

comment:7 Changed 8 years ago by nickm

Keywords: tor-client added

comment:8 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.