diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 48db73d7ce..0ac47fba61 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -1708,7 +1708,7 @@ evdns_server_request_respond(struct evdns_server_request *_req, int err) 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 @@ server_port_free(struct evdns_server_port *port) } (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 @@ evdns_server_request_drop(struct evdns_server_request *_req) 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 diff --git a/src/or/eventdns.h b/src/or/eventdns.h index 4275031543..058b4d1b77 100644 --- a/src/or/eventdns.h +++ b/src/or/eventdns.h @@ -323,6 +323,9 @@ int evdns_server_request_add_aaaa_reply(struct evdns_server_request *req, const 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);