From c9c35747c0d20cff54561c0b8fe15813c7a8e0ff Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Fri, 15 May 2015 10:25:14 +0200 Subject: ripe-atlas-fw: imported version 4570 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- libevent-2.0.20-stable/evdns.c | 22 +++++++++++++++++++--- libevent-2.0.20-stable/evutil.c | 6 ++++++ libevent-2.0.20-stable/include/event2/util.h | 3 +++ 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'libevent-2.0.20-stable') diff --git a/libevent-2.0.20-stable/evdns.c b/libevent-2.0.20-stable/evdns.c index 8beee70..cf38418 100644 --- a/libevent-2.0.20-stable/evdns.c +++ b/libevent-2.0.20-stable/evdns.c @@ -4054,6 +4054,13 @@ evdns_base_parse_hosts_line(struct evdns_base *base, char *line) memcpy(he->hostname, hostname, namelen+1); he->addrlen = socklen; +#if 0 + fprintf(stderr, "evdns_base_parse_hosts_line: base %p, he %p\n", + base, he); + fprintf(stderr, + "evdns_base_parse_hosts_line: tqh_first %p, tqh_last %p\n", + base->hostsdb.tqh_first, base->hostsdb.tqh_last); +#endif TAILQ_INSERT_TAIL(&base->hostsdb, he, next); if (hash) @@ -4073,6 +4080,15 @@ evdns_base_load_hosts_impl(struct evdns_base *base, const char *hosts_fname) ASSERT_LOCKED(base); + { + struct hosts_entry *victim; + while ((victim = TAILQ_FIRST(&base->hostsdb))) { + TAILQ_REMOVE(&base->hostsdb, victim, next); + mm_free(victim); + } + } + + if (hosts_fname == NULL || (err = evutil_read_file(hosts_fname, &str, &len, 0)) < 0) { char tmp[64]; @@ -4167,7 +4183,7 @@ evdns_err_to_getaddrinfo_err(int e1) else if (e1 == DNS_ERR_NOTEXIST) return EVUTIL_EAI_NONAME; else - return EVUTIL_EAI_FAIL; + return EVUTIL_EAI_FAIL_1; } /* Return the more informative of two getaddrinfo errors. */ @@ -4529,7 +4545,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base, log(EVDNS_LOG_WARN, "Call to getaddrinfo_async with no " "evdns_base configured."); - cb(EVUTIL_EAI_FAIL, NULL, arg); /* ??? better error? */ + cb(EVUTIL_EAI_FAIL_2, NULL, arg); /* ??? better error? */ return NULL; } } @@ -4630,7 +4646,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base, return data; } else { mm_free(data); - cb(EVUTIL_EAI_FAIL, NULL, arg); + cb(EVUTIL_EAI_FAIL_3, NULL, arg); return NULL; } } diff --git a/libevent-2.0.20-stable/evutil.c b/libevent-2.0.20-stable/evutil.c index e17e5b8..b07319a 100644 --- a/libevent-2.0.20-stable/evutil.c +++ b/libevent-2.0.20-stable/evutil.c @@ -1443,6 +1443,12 @@ evutil_gai_strerror(int err) return "invalid value for ai_flags"; case EVUTIL_EAI_FAIL: return "non-recoverable failure in name resolution"; + case EVUTIL_EAI_FAIL_1: + return "non-recoverable failure in name resolution (1)"; + case EVUTIL_EAI_FAIL_2: + return "non-recoverable failure in name resolution (2)"; + case EVUTIL_EAI_FAIL_3: + return "non-recoverable failure in name resolution (3)"; case EVUTIL_EAI_FAMILY: return "ai_family not supported"; case EVUTIL_EAI_MEMORY: diff --git a/libevent-2.0.20-stable/include/event2/util.h b/libevent-2.0.20-stable/include/event2/util.h index 4b7e8b4..adc3ce5 100644 --- a/libevent-2.0.20-stable/include/event2/util.h +++ b/libevent-2.0.20-stable/include/event2/util.h @@ -548,6 +548,9 @@ struct evutil_addrinfo { #else #define EVUTIL_EAI_FAIL -904 #endif +#define EVUTIL_EAI_FAIL_1 -921 +#define EVUTIL_EAI_FAIL_2 -922 +#define EVUTIL_EAI_FAIL_3 -923 #ifdef EAI_FAMILY #define EVUTIL_EAI_FAMILY EAI_FAMILY #else -- cgit v1.2.3