Ver código fonte

Merge branch 'maint-0.2.7'

Nick Mathewson 8 anos atrás
pai
commit
1321608786
2 arquivos alterados com 7 adições e 3 exclusões
  1. 4 0
      changes/bug16056
  2. 3 3
      src/or/policies.c

+ 4 - 0
changes/bug16056

@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay, IPv6):
+    - When displaying an IPv6 exit policy, include the mask bits correctly
+      even when the number is greater than 31. Fixes bug 16056; bugfix on
+      0.2.4.7-alpha. Patch from "gturner".

+ 3 - 3
src/or/policies.c

@@ -1530,9 +1530,9 @@ policy_write_item(char *buf, size_t buflen, addr_policy_t *policy,
   if (result < 0)
     return -1;
   written += strlen(buf);
-  /* If the maskbits is 32 we don't need to give it.  If the mask is 0,
-   * we already wrote "*". */
-  if (policy->maskbits < 32 && policy->maskbits > 0) {
+  /* If the maskbits is 32 (IPv4) or 128 (IPv6) we don't need to give it.  If
+     the mask is 0, we already wrote "*". */
+  if (policy->maskbits < (is_ip6?128:32) && policy->maskbits > 0) {
     if (tor_snprintf(buf+written, buflen-written, "/%d", policy->maskbits)<0)
       return -1;
     written += strlen(buf+written);