]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid spurious local-port warnings
authorNick Mathewson <nickm@torproject.org>
Wed, 2 Jan 2013 15:37:03 +0000 (10:37 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 2 Jan 2013 15:37:03 +0000 (10:37 -0500)
Our old warn_nonlocal_client_ports() would give a bogus warning for
every nonlocal port every time it parsed any ports at all.  So if it
parsed a nonlocal socksport, it would complain that it had a nonlocal
socksport...and then turn around and complain about the nonlocal
socksport again, calling it a nonlocal transport or nonlocal dnsport,
if it had any of those.

Fixes bug 7836; bugfix on 0.2.3.3-alpha.

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

diff --git a/changes/bug7836 b/changes/bug7836
new file mode 100644 (file)
index 0000000..730d807
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Avoid spurious warnings when configuring multiple client ports of
+      which only some are nonlocal. Previously, we had claimed that some
+      were nonlocal when in fact they weren't. Fixes bug 7836; bugfix on
+      0.2.3.3-alpha.
index 2947d1cf17d6856ae45f64eb4f24a9b7128b2a9c..60866218c50bcc956537ea6dedf35e8bbdfd8068 100644 (file)
@@ -4633,12 +4633,15 @@ port_cfg_free(port_cfg_t *port)
   tor_free(port);
 }
 
-/** Warn for every port in <b>ports</b> that is on a publicly routable
- * address. */
+/** Warn for every port in <b>ports</b> of type <b>listener_type</b> that is
+ * on a publicly routable address. */
 static void
-warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname)
+warn_nonlocal_client_ports(const smartlist_t *ports, const char *portname,
+                           int listener_type)
 {
   SMARTLIST_FOREACH_BEGIN(ports, const port_cfg_t *, port) {
+    if (port->type != listener_type)
+      continue;
     if (port->is_unix_addr) {
       /* Unix sockets aren't accessible over a network. */
     } else if (!tor_addr_is_internal(&port->addr, 1)) {
@@ -4835,7 +4838,7 @@ parse_port_config(smartlist_t *out,
       if (is_control)
         warn_nonlocal_controller_ports(out, forbid_nonlocal);
       else
-        warn_nonlocal_client_ports(out, portname);
+        warn_nonlocal_client_ports(out, portname, listener_type);
     }
     return 0;
   } /* end if (listenaddrs) */
@@ -5101,7 +5104,7 @@ parse_port_config(smartlist_t *out,
     if (is_control)
       warn_nonlocal_controller_ports(out, forbid_nonlocal);
     else
-      warn_nonlocal_client_ports(out, portname);
+      warn_nonlocal_client_ports(out, portname, listener_type);
   }
 
   if (got_zero_port && got_nonzero_port) {