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

[or-cvs] r10328: Fix more dnsport bugs: set state correctly, and actually cac (in tor/trunk: . src/or)



Author: nickm
Date: 2007-05-25 14:22:42 -0400 (Fri, 25 May 2007)
New Revision: 10328

Modified:
   tor/trunk/
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/dnsserv.c
Log:
 r12958@catbus:  nickm | 2007-05-25 14:19:29 -0400
 Fix more dnsport bugs: set state correctly, and actually cache the answers.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12958] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2007-05-25 18:22:39 UTC (rev 10327)
+++ tor/trunk/src/or/connection_edge.c	2007-05-25 18:22:42 UTC (rev 10328)
@@ -669,7 +669,7 @@
       return (rewrites > 0); /* done, no rewrite needed */
 
     cp = tor_strdup(escaped_safe_str(ent->new_address));
-    log_notice(LD_APP, "Addressmap: rewriting %s to %s",
+    log_info(LD_APP, "Addressmap: rewriting %s to %s",
              escaped_safe_str(address), cp);
     tor_free(cp);
     strlcpy(address, ent->new_address, maxlen);
@@ -1945,12 +1945,6 @@
   char buf[384];
   size_t replylen;
 
-  if (conn->dns_server_request) {
-    dnsserv_resolved(conn, answer_type, answer_len, answer, ttl);
-    conn->socks_request->has_finished = 1; /* DOCDOC */
-    return;
-  }
-
   if (ttl >= 0) {
     if (answer_type == RESOLVED_TYPE_IPV4 && answer_len == 4) {
       uint32_t a = ntohl(get_uint32(answer));
@@ -1966,6 +1960,12 @@
     }
   }
 
+  if (conn->dns_server_request) {
+    dnsserv_resolved(conn, answer_type, answer_len, answer, ttl);
+    conn->socks_request->has_finished = 1; /* DOCDOC */
+    return;
+  }
+
   if (conn->socks_request->socks_version == 4) {
     buf[0] = 0x00; /* version */
     if (answer_type == RESOLVED_TYPE_IPV4 && answer_len == 4) {

Modified: tor/trunk/src/or/dnsserv.c
===================================================================
--- tor/trunk/src/or/dnsserv.c	2007-05-25 18:22:39 UTC (rev 10327)
+++ tor/trunk/src/or/dnsserv.c	2007-05-25 18:22:42 UTC (rev 10328)
@@ -90,10 +90,10 @@
     return;
   }
 
-  /* XXXX020 Handle .onion and .exit. */
   /* XXXX020 Send a stream event to the controller. */
 
   conn = TO_EDGE_CONN(connection_new(CONN_TYPE_AP));
+  conn->_base.state = AP_CONN_STATE_RESOLVE_WAIT;
   if (q->type == EVDNS_TYPE_A)
     conn->socks_request->command = SOCKS_COMMAND_RESOLVE;
   else
@@ -104,8 +104,6 @@
 
   conn->dns_server_request = req;
 
-  /* XXXX need to set state ?? */
-
   log_info(LD_APP, "Passing request for %s to rewrite_and_attach.", q->name);
   connection_ap_handshake_rewrite_and_attach(conn, NULL, NULL);
   /* Now the connection is marked if it was bad. */