[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r16622: {tor} ipv6: make server-side dns cache remember for each address a (in tor/trunk: . src/or)



Author: nickm
Date: 2008-08-22 12:24:47 -0400 (Fri, 22 Aug 2008)
New Revision: 16622

Modified:
   tor/trunk/
   tor/trunk/src/or/dns.c
Log:
 r17847@tombo:  nickm | 2008-08-22 12:08:56 -0400
 ipv6: make server-side dns cache remember for each address an ipv6 addr and an ipv4 addr.  This fix is just the struct side.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r17847] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2008-08-22 16:24:43 UTC (rev 16621)
+++ tor/trunk/src/or/dns.c	2008-08-22 16:24:47 UTC (rev 16622)
@@ -78,8 +78,10 @@
   uint32_t magic;
   char address[MAX_ADDRESSLEN]; /**< The hostname to be resolved. */
   union {
-    /*XXXX021 Make this use a tor_addr_t OP6 */
-    uint32_t addr;  /**< IPv4 addr for <b>address</b>. */
+    struct {
+      struct in6_addr addr6; /**< IPv6 addr for <b>address</b>. */
+      uint32_t addr;  /**< IPv4 addr for <b>address</b>. */
+    } a;
     char *hostname; /**< Hostname for <b>address</b> (if a reverse lookup) */
   } result;
   uint8_t state; /**< Is this cached entry pending/done/valid/failed? */
@@ -716,7 +718,7 @@
           tor_assert(is_resolve);
           *hostname_out = tor_strdup(resolve->result.hostname);
         } else {
-          tor_addr_from_ipv4h(&exitconn->_base.addr, resolve->result.addr);
+          tor_addr_from_ipv4h(&exitconn->_base.addr, resolve->result.a.addr);
         }
         return 1;
       case CACHE_STATE_CACHED_FAILED:
@@ -947,7 +949,7 @@
     }
   } else {
     tor_assert(!hostname);
-    resolve->result.addr = addr;
+    resolve->result.a.addr = addr;
   }
   resolve->ttl = ttl;
   assert_resolve_ok(resolve);
@@ -1589,7 +1591,7 @@
     if (resolve->is_reverse)
       tor_assert(!resolve->result.hostname);
     else
-      tor_assert(!resolve->result.addr);
+      tor_assert(!resolve->result.a.addr);
   }
 }