]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix some error-checking logic and a misleading error message
authorKris Katterjohn <katterjohn@gmail.com>
Fri, 25 Jan 2019 21:52:40 +0000 (15:52 -0600)
committerKris Katterjohn <katterjohn@gmail.com>
Mon, 25 Feb 2019 22:03:42 +0000 (16:03 -0600)
When IPv4Only (IPv6Only) was used but the address could not be
interpreted as a IPv4 (IPv6) address, the error message referred
to the wrong IP version.

This also fixes up the error-checking logic so it's more precise
about what's being checked.

Fixes bug 13221; bugfix on 0.2.3.9-alpha

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
changes/bug13221 [new file with mode: 0644]
src/or/config.c

diff --git a/changes/bug13221 b/changes/bug13221
new file mode 100644 (file)
index 0000000..13935a1
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (logging):
+    - Correct a misleading error message when IPv4Only or IPv6Only
+      is used but the resolved address can not be interpreted as an
+      address of the specified IP version.  Fixes bug 13221; bugfix
+      on 0.2.3.9-alpha.  Patch from Kris Katterjohn.
index 810f1e9a7a145e95569cb714559765199df3f178..e0d1794bdf82aeef73e8a60d0f52525b0f21fb20 100644 (file)
@@ -6650,13 +6650,13 @@ parse_port_config(smartlist_t *out,
                  portname, escaped(ports->value));
         goto err;
       }
-      if (bind_ipv4_only && tor_addr_family(&addr) == AF_INET6) {
-        log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv6",
+      if (bind_ipv4_only && tor_addr_family(&addr) != AF_INET) {
+        log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv4",
                  portname);
         goto err;
       }
-      if (bind_ipv6_only && tor_addr_family(&addr) == AF_INET) {
-        log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv4",
+      if (bind_ipv6_only && tor_addr_family(&addr) != AF_INET6) {
+        log_warn(LD_CONFIG, "Could not interpret %sPort address as IPv6",
                  portname);
         goto err;
       }