[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10316: Fix some eventdns dns server bugs, and add a new eventdns fu (in tor/trunk: . src/or)
Author: nickm
Date: 2007-05-24 16:31:27 -0400 (Thu, 24 May 2007)
New Revision: 10316
Modified:
tor/trunk/
tor/trunk/src/or/eventdns.c
tor/trunk/src/or/eventdns.h
Log:
r12941@catbus: nickm | 2007-05-24 16:25:00 -0400
Fix some eventdns dns server bugs, and add a new eventdns function to get the address of whoever requested this lookup.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r12941] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c 2007-05-24 18:12:52 UTC (rev 10315)
+++ tor/trunk/src/or/eventdns.c 2007-05-24 20:31:27 UTC (rev 10316)
@@ -1708,7 +1708,7 @@
if (server_request_free(req))
return 0;
- if (req->port->pending_replies)
+ if (port->pending_replies)
server_port_flush(port);
return 0;
@@ -1797,7 +1797,8 @@
}
(void) event_del(&port->event);
CLEAR(&port->event);
- // XXXX actually free the port? -NM
+ // XXXX020 actually free the port? -NM
+ // XXXX yes, and fix up evdns_close_server_port to dtrt. -NM
}
// exported function
@@ -1809,6 +1810,17 @@
return 0;
}
+// exported function
+int
+evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, struct sockaddr *sa, socklen_t addr_len)
+{
+ struct server_request *req = TO_SERVER_REQUEST(_req);
+ if (addr_len < req->addrlen)
+ return -1;
+ memcpy(sa, &(req->addr), req->addrlen);
+ return req->addrlen;
+}
+
#undef APPEND16
#undef APPEND32
Modified: tor/trunk/src/or/eventdns.h
===================================================================
--- tor/trunk/src/or/eventdns.h 2007-05-24 18:12:52 UTC (rev 10315)
+++ tor/trunk/src/or/eventdns.h 2007-05-24 20:31:27 UTC (rev 10316)
@@ -323,6 +323,9 @@
int evdns_server_request_add_ptr_reply(struct evdns_server_request *req, struct in_addr *in, const char *inaddr_name, const char *hostname, int ttl);
int evdns_server_request_add_cname_reply(struct evdns_server_request *req, const char *name, const char *cname, int ttl);
+struct sockaddr;
+int evdns_server_request_get_requesting_addr(struct evdns_server_request *req, struct sockaddr *sa, socklen_t addr_len);
+
int evdns_server_request_respond(struct evdns_server_request *req, int err);
int evdns_server_request_drop(struct evdns_server_request *req);