From 6610fa5a270472c4b79cfc219343ab63b1db0c4e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 1 May 2012 17:07:50 -0400 Subject: [PATCH 1/5] dns-example.c can now take a resolv.conf file on the commandline --- sample/dns-example.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sample/dns-example.c b/sample/dns-example.c index f97a0c6b..f1390335 100644 --- a/sample/dns-example.c +++ b/sample/dns-example.c @@ -145,8 +145,9 @@ main(int c, char **v) { int reverse = 0, servertest = 0, use_getaddrinfo = 0; struct event_base *event_base = NULL; struct evdns_base *evdns_base = NULL; + const char *resolv_conf = NULL; if (c<2) { - fprintf(stderr, "syntax: %s [-x] [-v] hostname\n", v[0]); + fprintf(stderr, "syntax: %s [-x] [-v] [-c resolv.conf] hostname\n", v[0]); fprintf(stderr, "syntax: %s [-servertest]\n", v[0]); return 1; } @@ -160,7 +161,12 @@ main(int c, char **v) { use_getaddrinfo = 1; else if (!strcmp(v[idx], "-servertest")) servertest = 1; - else + else if (!strcmp(v[idx], "-c")) { + if (idx + 1 < c) + resolv_conf = v[++idx]; + else + fprintf(stderr, "-c needs an argument\n"); + } else fprintf(stderr, "Unknown option %s\n", v[idx]); ++idx; } @@ -197,11 +203,14 @@ main(int c, char **v) { if (idx < c) { int res; #ifdef WIN32 - res = evdns_base_config_windows_nameservers(evdns_base); -#else - res = evdns_base_resolv_conf_parse(evdns_base, DNS_OPTION_NAMESERVERS, - "/etc/resolv.conf"); + if (resolv_conf == NULL) + res = evdns_base_config_windows_nameservers(evdns_base); + else #endif + res = evdns_base_resolv_conf_parse(evdns_base, + DNS_OPTION_NAMESERVERS, + resolv_conf ? resolv_conf : "/etc/resolv.conf"); + if (res < 0) { fprintf(stderr, "Couldn't configure nameservers"); return 1; From d873d6787c80c4438dd139118ef89c5ce62a3c34 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 1 May 2012 19:52:49 -0400 Subject: [PATCH 2/5] Make some evdns.c debug logs more verbose --- evdns.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/evdns.c b/evdns.c index 5db46248..72e44673 100644 --- a/evdns.c +++ b/evdns.c @@ -2155,10 +2155,14 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) { if (req->tx_count >= req->base->global_max_retransmits) { /* this request has failed */ + log(EVDNS_LOG_DEBUG, "Giving up on request %p; tx_count==%d", + arg, req->tx_count); reply_schedule_callback(req, 0, DNS_ERR_TIMEOUT, NULL); request_finished(req, &REQ_HEAD(req->base, req->trans_id), 1); } else { /* retransmit it */ + log(EVDNS_LOG_DEBUG, "Retransmitting request %p; tx_count==%d", + arg, req->tx_count); (void) evtimer_del(&req->timeout_event); evdns_request_transmit(req); } @@ -2229,7 +2233,7 @@ evdns_request_transmit(struct request *req) { default: /* all ok */ log(EVDNS_LOG_DEBUG, - "Setting timeout for request %p", req); + "Setting timeout for request %p, sent to nameserver %p", req, req->ns); if (evtimer_add(&req->timeout_event, &req->base->global_timeout) < 0) { log(EVDNS_LOG_WARN, "Error from libevent when adding timer for request %p", @@ -2488,8 +2492,8 @@ _evdns_nameserver_add_impl(struct evdns_base *base, const struct sockaddr *addre goto out2; } - log(EVDNS_LOG_DEBUG, "Added nameserver %s", - evutil_format_sockaddr_port(address, addrbuf, sizeof(addrbuf))); + log(EVDNS_LOG_DEBUG, "Added nameserver %s as %p", + evutil_format_sockaddr_port(address, addrbuf, sizeof(addrbuf)), ns); /* insert this nameserver into the list of them */ if (!base->server_head) { From 3d9e52ac5661fda80d2967df22a22a4d92fd1cdf Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 1 May 2012 19:52:55 -0400 Subject: [PATCH 3/5] When retransmitting a timed-out DNS request, pick a fresh nameserver. Otherwise, requests initially sent to a failing nameserver would stay there indefinitely, even if other nameservers would work. Fix for sourceforge bug 3518439 --- evdns.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/evdns.c b/evdns.c index 72e44673..ed2dbdc5 100644 --- a/evdns.c +++ b/evdns.c @@ -2161,9 +2161,13 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) { request_finished(req, &REQ_HEAD(req->base, req->trans_id), 1); } else { /* retransmit it */ + struct nameserver *new_ns; log(EVDNS_LOG_DEBUG, "Retransmitting request %p; tx_count==%d", arg, req->tx_count); (void) evtimer_del(&req->timeout_event); + new_ns = nameserver_pick(base); + if (new_ns) + req->ns = new_ns; evdns_request_transmit(req); } EVDNS_UNLOCK(base); From 265e6779dd1b936298f50a8036e2fb565a785c83 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 2 May 2012 16:52:27 -0400 Subject: [PATCH 4/5] Fix evdns build with threads disabled The last evdns change apparently broke it, by using a "base" variable that we were only declaring with threads turned on. --- evdns.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/evdns.c b/evdns.c index ed2dbdc5..416137ba 100644 --- a/evdns.c +++ b/evdns.c @@ -2138,9 +2138,8 @@ evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, stru static void evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) { struct request *const req = (struct request *) arg; -#ifndef _EVENT_DISABLE_THREAD_SUPPORT struct evdns_base *base = req->base; -#endif + (void) fd; (void) events; From cecb111bcd9af40a14a456fb07e3be4059fd46f0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 2 May 2012 17:09:11 -0400 Subject: [PATCH 5/5] Start changelog for 2.0.19-stable --- ChangeLog | 33 ++++++++++++++++++++++++++++++++- README | 3 +++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c9619655..e6193657 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,35 @@ -Changes in version 2.0.19-stable (?? ??? 2012) +Changes in version 2.0.19-stable (0? May 2012) +BUGFIXES (CORE): + o Refactor event_persist_closure: raise and extract some common logic (bec22b4) + o If time has jumped so we'd reschedule a periodic event in the past, schedule it for the future instead (dfd808c) + o If a higher-priority event becomes active, don't continue running events of the current priority. (2bfda40) + +BUGFIXES (SSL): + o Fixed potential double-readcb execution with openssl bufferevents. (4e62cd1 Mark Ellzey) + +BUGFIXES (DNS): + o Cancel a probe request when the server is freed, and ignore cancelled probe callbacks (94d2336 Greg Hazel) + o Remove redundant DNS_ERR_CANCEL check, move comment (46b8060 Greg Hazel) + o When retransmitting a timed-out DNS request, pick a fresh nameserver. (3d9e52a) + +DOCUMENTATION FIXES: + o Fix a typo in the bufferevent documentation (98e9119) + o Add missing ) to changelog; spotted by rransom (4c7ee6b) + o Fix the website URL in the readme (f775521) + +COMPILATION FIXES: + o Fix a compilation error with MSVC 2005 due to use of mode_t (336dcae) + o Configure with gcc older than 2.95 (4a6fd43 Sebastian Hahn) + o Generate event-config.h with a single sed script (30b6f88 Zack Weinberg) + +FORWARD-COMPATIBILITY: + o Backport: provide EVENT_LOG_* names, and deprecate _EVENT_LOG_* (d1a03b2) + +TESTING/DEBUGGING SUPPORT: + o dns-example.c can now take a resolv.conf file on the commandline (6610fa5) + o Make some evdns.c debug logs more verbose (d873d67) + o Work-around a stupid gcov-breaking bug in OSX 10.6 (b3887cd) + Changes in version 2.0.18-stable (22 Mar 2012) diff --git a/README b/README index d8d991fa..1ebe6e12 100644 --- a/README +++ b/README @@ -108,6 +108,7 @@ fixing bugs: Greg Hazel Michael Herf Sebastian Hahn + Savg He Mark Heily Greg Hewgill Aaron Hopkins @@ -162,6 +163,7 @@ fixing bugs: Peter Rosin Maseeb Abdul Qadir Wang Qin + Alex S Hanna Schroeter Ralf Schmitt Mike Smellie @@ -185,4 +187,5 @@ fixing bugs: propanbutan mmadia + If we have forgotten your name, please contact us.