]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Sandbox: Don't preseed getaddrinfo(gethostname()) in client mode.
authorNick Mathewson <nickm@torproject.org>
Tue, 15 Mar 2016 15:19:59 +0000 (11:19 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 15 Mar 2016 15:19:59 +0000 (11:19 -0400)
If we're a server with no address configured, resolve_my_hostname
will need this.  But not otherwise.  And the preseeding itself can
consume a few seconds if like tails we have no resolvers.

Fixes bug 18548.

changes/bug18548 [new file with mode: 0644]
src/or/config.c
src/or/main.c

diff --git a/changes/bug18548 b/changes/bug18548
new file mode 100644 (file)
index 0000000..262d1d3
--- /dev/null
@@ -0,0 +1,12 @@
+  o Minor bugfixes (linux seccomp2 sandbox):
+    - Avoid a 10-second delay when starting as a client with Sandbox 1
+      enabled and no DNS resolvers configured.  This should help TAILS
+      start up faster. Fixes bug 18548; bugfix on 0.2.5.1-alpha.
+
+
+  o Minor features (linux seccomp2 sandbox):
+    - Detect and reject attempts to change our Address with Sandbox 1
+      enabled. Changing Address with Sandbox turned on would never
+      actually work, but previously it would fail in strange and
+      confusing ways.  Found while fixing 18548.
+
index 0e15f9bb077d44042a76b95c527edba4dd35283c..ed436f929f26529b7b7b0f451babfa047aca763a 100644 (file)
@@ -4267,6 +4267,7 @@ options_transition_allowed(const or_options_t *old,
       }                                                                 \
     } while (0)
 
+    SB_NOCHANGE_STR(Address);
     SB_NOCHANGE_STR(PidFile);
     SB_NOCHANGE_STR(ServerDNSResolvConfFile);
     SB_NOCHANGE_STR(DirPortFrontPage);
index 713816d9b78b456263f8c699b795b3a2173a8f4f..f37c23c9f5e060e16e3038a4b8db4dce06dd5bda 100644 (file)
@@ -3312,6 +3312,13 @@ do_dump_config(void)
 static void
 init_addrinfo(void)
 {
+  if (! server_mode(get_options()) ||
+      (get_options()->Address && strlen(get_options()->Address) > 0)) {
+    /* We don't need to seed our own hostname, because we won't be calling
+     * resolve_my_address on it.
+     */
+    return;
+  }
   char hname[256];
 
   // host name to sandbox