Commit a141430e authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

Rename log() to tor_log() for logging

This is meant to avoid conflict with the built-in log() function in
math.h.  It resolves ticket 7599.  First reported by dhill.

This was generated with the following perl script:

 #!/usr/bin/perl -w -i -p

 s/\blog\(LOG_(ERR|WARN|NOTICE|INFO|DEBUG)\s*,\s*/log_\L$1\(/g;

 s/\blog\(/tor_log\(/g;
parent abb5519d
......@@ -1270,14 +1270,14 @@ get_interface_addresses_raw(int severity)
/* This interface, AFAICT, only supports AF_INET addresses */
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
log(severity, LD_NET, "socket failed: %s", strerror(errno));
tor_log(severity, LD_NET, "socket failed: %s", strerror(errno));
goto done;
}
/* Guess how much space we need. */
ifc.ifc_len = sz = 15*1024;
ifc.ifc_ifcu.ifcu_req = tor_malloc(sz);
if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
log(severity, LD_NET, "ioctl failed: %s", strerror(errno));
tor_log(severity, LD_NET, "ioctl failed: %s", strerror(errno));
close(fd);
goto done;
}
......
......@@ -76,19 +76,19 @@ libevent_logging_callback(int severity, const char *msg)
}
switch (severity) {
case _EVENT_LOG_DEBUG:
log(LOG_DEBUG, LD_NOCB|LD_NET, "Message from libevent: %s", buf);
log_debug(LD_NOCB|LD_NET, "Message from libevent: %s", buf);
break;
case _EVENT_LOG_MSG:
log(LOG_INFO, LD_NOCB|LD_NET, "Message from libevent: %s", buf);
log_info(LD_NOCB|LD_NET, "Message from libevent: %s", buf);
break;
case _EVENT_LOG_WARN:
log(LOG_WARN, LD_NOCB|LD_GENERAL, "Warning from libevent: %s", buf);
log_warn(LD_NOCB|LD_GENERAL, "Warning from libevent: %s", buf);
break;
case _EVENT_LOG_ERR:
log(LOG_ERR, LD_NOCB|LD_GENERAL, "Error from libevent: %s", buf);
log_err(LD_NOCB|LD_GENERAL, "Error from libevent: %s", buf);
break;
default:
log(LOG_WARN, LD_NOCB|LD_GENERAL, "Message [%d] from libevent: %s",
log_warn(LD_NOCB|LD_GENERAL, "Message [%d] from libevent: %s",
severity, buf);
break;
}
......@@ -261,13 +261,13 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
#if defined(HAVE_EVENT_GET_VERSION) && defined(HAVE_EVENT_GET_METHOD)
/* Making this a NOTICE for now so we can link bugs to a libevent versions
* or methods better. */
log(LOG_INFO, LD_GENERAL,
log_info(LD_GENERAL,
"Initialized libevent version %s using method %s. Good.",
event_get_version(), tor_libevent_get_method());
#else
log(LOG_NOTICE, LD_GENERAL,
log_notice(LD_GENERAL,
"Initialized old libevent (version 1.0b or earlier).");
log(LOG_WARN, LD_GENERAL,
log_warn(LD_GENERAL,
"You have a *VERY* old version of libevent. It is likely to be buggy; "
"please build Tor with a more recent version.");
#endif
......@@ -440,7 +440,7 @@ tor_check_libevent_header_compatibility(void)
verybad = compat1 != compat2;
log(verybad ? LOG_WARN : LOG_NOTICE,
tor_log(verybad ? LOG_WARN : LOG_NOTICE,
LD_GENERAL, "We were compiled with headers from version %s "
"of Libevent, but we're using a Libevent library that says it's "
"version %s.", HEADER_VERSION, event_get_version());
......
......@@ -151,10 +151,10 @@ crypto_log_errors(int severity, const char *doing)
if (!lib) lib = "(null)";
if (!func) func = "(null)";
if (doing) {
log(severity, LD_CRYPTO, "crypto error while %s: %s (in %s:%s)",
tor_log(severity, LD_CRYPTO, "crypto error while %s: %s (in %s:%s)",
doing, msg, lib, func);
} else {
log(severity, LD_CRYPTO, "crypto error: %s (in %s:%s)", msg, lib, func);
tor_log(severity, LD_CRYPTO, "crypto error: %s (in %s:%s)", msg, lib, func);
}
}
}
......@@ -168,10 +168,10 @@ log_engine(const char *fn, ENGINE *e)
const char *name, *id;
name = ENGINE_get_name(e);
id = ENGINE_get_id(e);
log(LOG_NOTICE, LD_CRYPTO, "Using OpenSSL engine %s [%s] for %s",
log_notice(LD_CRYPTO, "Using OpenSSL engine %s [%s] for %s",
name?name:"?", id?id:"?", fn);
} else {
log(LOG_INFO, LD_CRYPTO, "Using default implementation for %s", fn);
log_info(LD_CRYPTO, "Using default implementation for %s", fn);
}
}
#endif
......
......@@ -321,7 +321,7 @@ tor_process_monitor_poll_cb(evutil_socket_t unused1, short unused2,
its_dead_jim = its_dead_jim && (errno == ESRCH);
#endif
log(its_dead_jim ? LOG_NOTICE : LOG_INFO,
tor_log(its_dead_jim ? LOG_NOTICE : LOG_INFO,
procmon->log_domain, "Monitored process "PID_T_FORMAT" is %s.",
procmon->pid,
its_dead_jim ? "dead" : "still alive");
......
......@@ -153,7 +153,7 @@ void set_log_time_granularity(int granularity_msec);
void tor_log(int severity, log_domain_mask_t domain, const char *format, ...)
CHECK_PRINTF(3,4);
#define log tor_log /* hack it so we don't conflict with log() as much */
#define log tor_log /* hack it so we don't conflict with tor_log() as much */
#if defined(__GNUC__) || defined(RUNNING_DOXYGEN)
extern int log_global_min_severity_;
......
......@@ -334,11 +334,11 @@ tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
if (!lib) lib = "(null)";
if (!func) func = "(null)";
if (doing) {
log(severity, domain, "TLS error while %s%s%s: %s (in %s:%s:%s)",
tor_log(severity, domain, "TLS error while %s%s%s: %s (in %s:%s:%s)",
doing, addr?" with ":"", addr?addr:"",
msg, lib, func, state);
} else {
log(severity, domain, "TLS error%s%s: %s (in %s:%s:%s)",
tor_log(severity, domain, "TLS error%s%s: %s (in %s:%s:%s)",
addr?" with ":"", addr?addr:"",
msg, lib, func, state);
}
......@@ -427,12 +427,12 @@ tor_tls_get_error(tor_tls_t *tls, int r, int extra,
if (extra&CATCH_SYSCALL)
return TOR_TLS_SYSCALL_;
if (r == 0) {
log(severity, LD_NET, "TLS error: unexpected close while %s (%s)",
tor_log(severity, LD_NET, "TLS error: unexpected close while %s (%s)",
doing, SSL_state_string_long(tls->ssl));
tor_error = TOR_TLS_ERROR_IO;
} else {
int e = tor_socket_errno(tls->socket);
log(severity, LD_NET,
tor_log(severity, LD_NET,
"TLS error: <syscall error while %s> (errno=%d: %s; state=%s)",
doing, e, tor_socket_strerror(e),
SSL_state_string_long(tls->ssl));
......@@ -443,7 +443,7 @@ tor_tls_get_error(tor_tls_t *tls, int r, int extra,
case SSL_ERROR_ZERO_RETURN:
if (extra&CATCH_ZERO)
return TOR_TLS_ZERORETURN_;
log(severity, LD_NET, "TLS connection closed while %s in state %s",
tor_log(severity, LD_NET, "TLS connection closed while %s in state %s",
doing, SSL_state_string_long(tls->ssl));
tls_log_errors(tls, severity, domain, doing);
return TOR_TLS_CLOSE;
......@@ -1224,7 +1224,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime,
authcert = tor_tls_create_certificate(rsa_auth, identity, nickname, nn2,
key_lifetime);
if (!cert || !idcert || !authcert) {
log(LOG_WARN, LD_CRYPTO, "Error creating certificate");
log_warn(LD_CRYPTO, "Error creating certificate");
goto error;
}
}
......@@ -2272,7 +2272,7 @@ tor_tls_shutdown(tor_tls_t *tls)
*/
if (tls->state == TOR_TLS_ST_GOTCLOSE ||
tls->state == TOR_TLS_ST_SENTCLOSE) {
log(LOG_WARN, LD_NET,
log_warn(LD_NET,
"TLS returned \"half-closed\" value while already half-closed");
return TOR_TLS_ERROR_MISC;
}
......@@ -2322,7 +2322,7 @@ log_cert_lifetime(int severity, const X509 *cert, const char *problem)
struct tm tm;
if (problem)
log(severity, LD_GENERAL,
tor_log(severity, LD_GENERAL,
"Certificate %s. Either their clock is set wrong, or your clock "
"is wrong.",
problem);
......@@ -2347,7 +2347,7 @@ log_cert_lifetime(int severity, const X509 *cert, const char *problem)
strftime(mytime, 32, "%b %d %H:%M:%S %Y UTC", tor_gmtime_r(&now, &tm));
log(severity, LD_GENERAL,
tor_log(severity, LD_GENERAL,
"(certificate lifetime runs from %s through %s. Your time is %s.)",
s1,s2,mytime);
......@@ -2568,7 +2568,7 @@ check_no_tls_errors_(const char *fname, int line)
{
if (ERR_peek_error() == 0)
return;
log(LOG_WARN, LD_CRYPTO, "Unhandled OpenSSL errors found at %s:%d: ",
log_warn(LD_CRYPTO, "Unhandled OpenSSL errors found at %s:%d: ",
tor_fix_source_file(fname), line);
tls_log_errors(NULL, LOG_WARN, LD_NET, NULL);
}
......
......@@ -324,12 +324,12 @@ tor_log_mallinfo(int severity)
/**
* Returns the natural logarithm of d base 2. We define this wrapper here so
* as to make it easier not to conflict with Tor's log() macro.
* as to make it easier not to conflict with Tor's tor_log() macro.
*/
double
tor_mathlog(double d)
{
return log(d);
return tor_log(d);
}
/** Return the long integer closest to <b>d</b>. We define this wrapper
......
......@@ -534,7 +534,7 @@ nameserver_probe_failed(struct nameserver *const ns) {
ns->failed_times++;
if (add_timeout_event(ns, (struct timeval *) timeout) < 0) {
log(EVDNS_LOG_WARN,
tor_log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
debug_ntop((struct sockaddr *)&ns->address));
/* ???? Do more? */
......@@ -550,19 +550,19 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
/* then don't do anything */
if (!ns->state) return;
log(EVDNS_LOG_WARN, "Nameserver %s has failed: %s",
tor_log(EVDNS_LOG_WARN, "Nameserver %s has failed: %s",
debug_ntop((struct sockaddr *)&ns->address), msg);
global_good_nameservers--;
assert(global_good_nameservers >= 0);
if (global_good_nameservers == 0) {
log(EVDNS_LOG_WARN, "All nameservers have failed");
tor_log(EVDNS_LOG_WARN, "All nameservers have failed");
}
ns->state = 0;
ns->failed_times = 1;
if (add_timeout_event(ns, (struct timeval *) &global_nameserver_timeouts[0]) < 0) {
log(EVDNS_LOG_WARN,
tor_log(EVDNS_LOG_WARN,
"Error from libevent when adding timer event for %s",
debug_ntop((struct sockaddr *)&ns->address));
/* ???? Do more? */
......@@ -593,7 +593,7 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
static void
nameserver_up(struct nameserver *const ns) {
if (ns->state) return;
log(EVDNS_LOG_WARN, "Nameserver %s is back up",
tor_log(EVDNS_LOG_WARN, "Nameserver %s is back up",
debug_ntop((struct sockaddr *)&ns->address));
del_timeout_event(ns);
ns->state = 1;
......@@ -624,7 +624,7 @@ request_finished(struct evdns_request *const req, struct evdns_request **head) {
}
}
log(EVDNS_LOG_DEBUG, "Removing timeout for request %lx",
tor_log(EVDNS_LOG_DEBUG, "Removing timeout for request %lx",
(unsigned long) req);
del_timeout_event(req);
......@@ -776,7 +776,7 @@ reply_handle(struct evdns_request *const req, u16 flags, u32 ttl, struct reply *
* confusing." Treat this as a timeout, not a failure.
*/
/*XXXX refactor the parts of */
log(EVDNS_LOG_DEBUG, "Got a SERVERFAILED from nameserver %s; "
tor_log(EVDNS_LOG_DEBUG, "Got a SERVERFAILED from nameserver %s; "
"will allow the request to time out.",
debug_ntop((struct sockaddr *)&req->ns->address));
break;
......@@ -1268,7 +1268,7 @@ nameserver_read(struct nameserver *ns) {
}
/* XXX Match port too? */
if (!sockaddr_eq(sa, (struct sockaddr*)&ns->address, 0)) {
log(EVDNS_LOG_WARN,
tor_log(EVDNS_LOG_WARN,
"Address mismatch on received DNS packet. Address was %s",
debug_ntop(sa));
return;
......@@ -1294,7 +1294,7 @@ server_port_read(struct evdns_server_port *s) {
if (r < 0) {
int err = last_error(s->socket);
if (error_is_eagain(err)) return;
log(EVDNS_LOG_WARN, "Error %s (%d) while reading request.",
tor_log(EVDNS_LOG_WARN, "Error %s (%d) while reading request.",
tor_socket_strerror(err), err);
return;
}
......@@ -1314,7 +1314,7 @@ server_port_flush(struct evdns_server_port *port)
int err = last_error(port->socket);
if (error_is_eagain(err))
return;
log(EVDNS_LOG_WARN, "Error %s (%d) while writing response to port; dropping", tor_socket_strerror(err), err);
tor_log(EVDNS_LOG_WARN, "Error %s (%d) while writing response to port; dropping", tor_socket_strerror(err), err);
}
if (server_request_free(req)) {
/* we released the last reference to req->port. */
......@@ -1331,7 +1331,7 @@ server_port_flush(struct evdns_server_port *port)
event_set(&port->event, port->socket, EV_READ | EV_PERSIST,
server_port_ready_callback, port);
if (event_add(&port->event, NULL) < 0) {
log(EVDNS_LOG_WARN, "Error from libevent when adding event for DNS server.");
tor_log(EVDNS_LOG_WARN, "Error from libevent when adding event for DNS server.");
/* ???? Do more? */
}
}
......@@ -1349,7 +1349,7 @@ nameserver_write_waiting(struct nameserver *ns, char waiting) {
event_set(&ns->event, ns->socket, EV_READ | (waiting ? EV_WRITE : 0) | EV_PERSIST,
nameserver_ready_callback, ns);
if (event_add(&ns->event, NULL) < 0) {
log(EVDNS_LOG_WARN, "Error from libevent when adding event for %s",
tor_log(EVDNS_LOG_WARN, "Error from libevent when adding event for %s",
debug_ntop((struct sockaddr *)&ns->address));
/* ???? Do more? */
}
......@@ -1859,7 +1859,7 @@ evdns_server_request_respond(struct evdns_server_request *_req, int err)
event_set(&port->event, port->socket, (port->closing?0:EV_READ) | EV_WRITE | EV_PERSIST, server_port_ready_callback, port);
if (event_add(&port->event, NULL) < 0) {
log(EVDNS_LOG_WARN, "Error from libevent when adding event for DNS server");
tor_log(EVDNS_LOG_WARN, "Error from libevent when adding event for DNS server");
}
}
......@@ -1995,7 +1995,7 @@ evdns_request_timeout_callback(int fd, short events, void *arg) {
(void) fd;
(void) events;
log(EVDNS_LOG_DEBUG, "Request %lx timed out", (unsigned long) arg);
tor_log(EVDNS_LOG_DEBUG, "Request %lx timed out", (unsigned long) arg);
req->ns->timedout++;
if (req->ns->timedout > global_max_nameserver_timeout) {
......@@ -2074,11 +2074,11 @@ evdns_request_transmit(struct evdns_request *req) {
* and make us retransmit the request anyway. */
default:
/* transmitted; we need to check for timeout. */
log(EVDNS_LOG_DEBUG,
tor_log(EVDNS_LOG_DEBUG,
"Setting timeout for request %lx", (unsigned long) req);
if (add_timeout_event(req, &global_timeout) < 0) {
log(EVDNS_LOG_WARN,
tor_log(EVDNS_LOG_WARN,
"Error from libevent when adding timer for request %lx",
(unsigned long) req);
/* ???? Do more? */
......@@ -2126,7 +2126,7 @@ nameserver_send_probe(struct nameserver *const ns) {
addr = mm_malloc(sizeof(struct sockaddr_storage));
memcpy(addr, &ns->address, sizeof(struct sockaddr_storage));
log(EVDNS_LOG_DEBUG, "Sending probe to %s", debug_ntop((struct sockaddr *)&ns->address));
tor_log(EVDNS_LOG_DEBUG, "Sending probe to %s", debug_ntop((struct sockaddr *)&ns->address));
req = request_new(TYPE_A, "www.google.com", DNS_QUERY_NO_SEARCH, nameserver_probe_callback, addr);
if (!req) {
......@@ -2282,14 +2282,14 @@ _evdns_nameserver_add_impl(const struct sockaddr *address,
if (server) {
do {
if (sockaddr_eq(address, (struct sockaddr *)&server->address, 1)) {
log(EVDNS_LOG_DEBUG, "Duplicate nameserver.");
tor_log(EVDNS_LOG_DEBUG, "Duplicate nameserver.");
return 3;
}
server = server->next;
} while (server != started_at);
}
if (addrlen > (int)sizeof(ns->address)) {
log(EVDNS_LOG_DEBUG, "Addrlen %d too long.", (int)addrlen);
tor_log(EVDNS_LOG_DEBUG, "Addrlen %d too long.", (int)addrlen);
return 2;
}
......@@ -2315,14 +2315,14 @@ _evdns_nameserver_add_impl(const struct sockaddr *address,
!sockaddr_is_loopback((struct sockaddr*)&global_bind_address)) {
if (bind(ns->socket, (struct sockaddr *)&global_bind_address,
global_bind_addrlen) < 0) {
log(EVDNS_LOG_DEBUG, "Couldn't bind to outgoing address.");
tor_log(EVDNS_LOG_DEBUG, "Couldn't bind to outgoing address.");
err = 2;
goto out2;
}
}
if (connect(ns->socket, address, addrlen) != 0) {
log(EVDNS_LOG_DEBUG, "Couldn't open socket to nameserver.");
tor_log(EVDNS_LOG_DEBUG, "Couldn't open socket to nameserver.");
err = 2;
goto out2;
}
......@@ -2331,12 +2331,12 @@ _evdns_nameserver_add_impl(const struct sockaddr *address,
ns->state = 1;
event_set(&ns->event, ns->socket, EV_READ | EV_PERSIST, nameserver_ready_callback, ns);
if (event_add(&ns->event, NULL) < 0) {
log(EVDNS_LOG_DEBUG, "Couldn't add event for nameserver.");
tor_log(EVDNS_LOG_DEBUG, "Couldn't add event for nameserver.");
err = 2;
goto out2;
}
log(EVDNS_LOG_DEBUG, "Added nameserver %s", debug_ntop(address));
tor_log(EVDNS_LOG_DEBUG, "Added nameserver %s", debug_ntop(address));
/* insert this nameserver into the list of them */
if (!server_head) {
......@@ -2360,7 +2360,7 @@ out2:
out1:
CLEAR(ns);
mm_free(ns);
log(EVDNS_LOG_WARN, "Unable to add nameserver %s: error %d", debug_ntop(address), err);
tor_log(EVDNS_LOG_WARN, "Unable to add nameserver %s: error %d", debug_ntop(address), err);
return err;
}
......@@ -2393,18 +2393,18 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
* ipv4
*/
log(EVDNS_LOG_DEBUG, "Trying to add nameserver <%s>", ip_as_string);
tor_log(EVDNS_LOG_DEBUG, "Trying to add nameserver <%s>", ip_as_string);
cp = strchr(ip_as_string, ':');
if (*ip_as_string == '[') {
size_t len;
if (!(cp = strchr(ip_as_string, ']'))) {
log(EVDNS_LOG_DEBUG, "Nameserver missing closing ]");
tor_log(EVDNS_LOG_DEBUG, "Nameserver missing closing ]");
return 4;
}
len = cp-(ip_as_string + 1);
if (len > sizeof(buf)-1) {
log(EVDNS_LOG_DEBUG, "[Nameserver] does not fit in buffer.");
tor_log(EVDNS_LOG_DEBUG, "[Nameserver] does not fit in buffer.");
return 4;
}
memcpy(buf, ip_as_string+1, len);
......@@ -2422,7 +2422,7 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
} else if (cp) {
is_ipv6 = 0;
if (cp - ip_as_string > (int)sizeof(buf)-1) {
log(EVDNS_LOG_DEBUG, "Nameserver does not fit in buffer.");
tor_log(EVDNS_LOG_DEBUG, "Nameserver does not fit in buffer.");
return 4;
}
memcpy(buf, ip_as_string, cp-ip_as_string);
......@@ -2440,7 +2440,7 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
} else {
port = strtoint(port_part);
if (port <= 0 || port > 65535) {
log(EVDNS_LOG_DEBUG, "Nameserver port <%s> out of range",
tor_log(EVDNS_LOG_DEBUG, "Nameserver port <%s> out of range",
port_part);
return 4;
}
......@@ -2457,7 +2457,7 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(port);
if (1 != tor_inet_pton(AF_INET6, addr_part, &sin6.sin6_addr)) {
log(EVDNS_LOG_DEBUG, "inet_pton(%s) failed", addr_part);
tor_log(EVDNS_LOG_DEBUG, "inet_pton(%s) failed", addr_part);
return 4;
}
return _evdns_nameserver_add_impl((struct sockaddr*)&sin6,
......@@ -2471,7 +2471,7 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
if (!inet_aton(addr_part, &sin.sin_addr)) {
log(EVDNS_LOG_DEBUG, "inet_pton(%s) failed", addr_part);
tor_log(EVDNS_LOG_DEBUG, "inet_pton(%s) failed", addr_part);
return 4;
}
return _evdns_nameserver_add_impl((struct sockaddr*)&sin,
......@@ -2594,7 +2594,7 @@ request_submit(struct evdns_request *const req) {
/* exported function */
int evdns_resolve_ipv4(const char *name, int flags,
evdns_callback_type callback, void *ptr) {
log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name);
tor_log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name);
if (flags & DNS_QUERY_NO_SEARCH) {
struct evdns_request *const req =
request_new(TYPE_A, name, flags, callback, ptr);
......@@ -2610,7 +2610,7 @@ int evdns_resolve_ipv4(const char *name, int flags,
/* exported function */
int evdns_resolve_ipv6(const char *name, int flags,
evdns_callback_type callback, void *ptr) {
log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name);
tor_log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name);
if (flags & DNS_QUERY_NO_SEARCH) {
struct evdns_request *const req =
request_new(TYPE_AAAA, name, flags, callback, ptr);
......@@ -2634,7 +2634,7 @@ int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_ty
(int)(u8)((a>>8 )&0xff),
(int)(u8)((a>>16)&0xff),
(int)(u8)((a>>24)&0xff));
log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
tor_log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
req = request_new(TYPE_PTR, buf, flags, callback, ptr);
if (!req) return 1;
request_submit(req);
......@@ -2658,7 +2658,7 @@ int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callb
}
assert(cp + strlen("ip6.arpa") < buf+sizeof(buf));
memcpy(cp, "ip6.arpa", strlen("ip6.arpa")+1);
log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
tor_log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf);
req = request_new(TYPE_PTR, buf, flags, callback, ptr);
if (!req) return 1;
request_submit(req);
......@@ -2874,7 +2874,7 @@ search_try_next(struct evdns_request *const req) {
if (string_num_dots(req->search_origname) < req->search_state->ndots) {
/* yep, we need to try it raw */
struct evdns_request *const newreq = request_new(req->request_type, req->search_origname, req->search_flags, req->user_callback, req->user_pointer);
log(EVDNS_LOG_DEBUG, "Search: trying raw query %s", req->search_origname);
tor_log(EVDNS_LOG_DEBUG, "Search: trying raw query %s", req->search_origname);
if (newreq) {
request_submit(newreq);
return 0;
......@@ -2885,7 +2885,7 @@ search_try_next(struct evdns_request *const req) {
new_name = search_make_new(req->search_state, req->search_index, req->search_origname);
if (!new_name) return 1;
log(EVDNS_LOG_DEBUG, "Search: now trying %s (%d)", new_name, req->search_index);
tor_log(EVDNS_LOG_DEBUG, "Search: now trying %s (%d)", new_name, req->search_index);
newreq = request_new(req->request_type, new_name, req->search_flags, req->user_callback, req->user_pointer);
mm_free(new_name);
if (!newreq) return 1;
......@@ -2955,7 +2955,7 @@ evdns_set_option(const char *option, const char *val, int flags)
const int ndots = strtoint(val);
if (ndots == -1) return -1;
if (!(flags & DNS_OPTION_SEARCH)) return 0;
log(EVDNS_LOG_DEBUG, "Setting ndots to %d", ndots);
tor_log(EVDNS_LOG_DEBUG, "Setting ndots to %d", ndots);
if (!global_search_state) global_search_state = search_state_new();
if (!global_search_state) return -1;
global_search_state->ndots = ndots;
......@@ -2963,20 +2963,20 @@ evdns_set_option(const char *option, const char *val, int flags)
const int timeout = strtoint(val);
if (timeout == -1) return -1;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting timeout to %d", timeout);
tor_log(EVDNS_LOG_DEBUG, "Setting timeout to %d", timeout);
global_timeout.tv_sec = timeout;
} else if (!strncmp(option, "max-timeouts:", 12)) {
const int maxtimeout = strtoint_clipped(val, 1, 255);
if (maxtimeout == -1) return -1;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting maximum allowed timeouts to %d",
tor_log(EVDNS_LOG_DEBUG, "Setting maximum allowed timeouts to %d",
maxtimeout);
global_max_nameserver_timeout = maxtimeout;
} else if (!strncmp(option, "max-inflight:", 13)) {
const int maxinflight = strtoint_clipped(val, 1, 65000);
if (maxinflight == -1) return -1;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting maximum inflight requests to %d",
tor_log(EVDNS_LOG_DEBUG, "Setting maximum inflight requests to %d",
maxinflight);
global_max_requests_inflight = maxinflight;
} else if (!strncmp(option, "attempts:", 9)) {
......@@ -2984,12 +2984,12 @@ evdns_set_option(const char *option, const char *val, int flags)
if (retries == -1) return -1;
if (retries > 255) retries = 255;
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting retries to %d", retries);
tor_log(EVDNS_LOG_DEBUG, "Setting retries to %d", retries);
global_max_retransmits = retries;
} else if (!strncmp(option, "randomize-case:", 15)) {
int randcase = strtoint(val);
if (!(flags & DNS_OPTION_MISC)) return 0;
log(EVDNS_LOG_DEBUG, "Setting randomize_case to %d", randcase);
tor_log(EVDNS_LOG_DEBUG, "Setting randomize_case to %d", randcase);
global_randomize_case = randcase;
}
return 0;
......@@ -3047,7 +3047,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
char *start;
int err = 0;
log(EVDNS_LOG_DEBUG, "Parsing resolv.conf file %s", filename);
tor_log(EVDNS_LOG_DEBUG, "Parsing resolv.conf file %s", filename);
fd = tor_open_cloexec(filename, O_RDONLY, 0);
if (fd < 0) {
......@@ -3146,13 +3146,13 @@ load_nameservers_with_getnetworkparams(void)
GetNetworkParams_fn_t fn;
if (!(handle = load_windows_system_library(TEXT("iphlpapi.dll")))) {
log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
tor_log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
/* right now status = 0, doesn't that mean "good" - mikec */
status = -1;
goto done;
}
if (!(fn = (GetNetworkParams_fn_t) GetProcAddress(handle, TEXT("GetNetworkParams")))) {
log(EVDNS_LOG_WARN, "Could not get address of function.");
tor_log(EVDNS_LOG_WARN, "Could not get address of function.");
/* same as above */
status = -1;
goto done;
......@@ -3173,7 +3173,7 @@ load_nameservers_with_getnetworkparams(void)
fixed = buf;
r = fn(fixed, &size);
if (r != ERROR_SUCCESS) {
log(EVDNS_LOG_DEBUG, "fn() failed.");
tor_log(EVDNS_LOG_DEBUG, "fn() failed.");
status = -1;
goto done;
}
......@@ -3185,12 +3185,12 @@ load_nameservers_with_getnetworkparams(void)
while (ns) {
r = evdns_nameserver_ip_add_line(ns->IpAddress.String);
if (r) {
log(EVDNS_LOG_DEBUG,"Could not add nameserver %s to list, "
tor_log(EVDNS_LOG_DEBUG,"Could not add nameserver %s to list, "
"error: %d; status: %d",
(ns->IpAddress.String),(int)GetLastError(), r);
status = r;
} else {
log(EVDNS_LOG_DEBUG,"Successfully added %s as nameserver",ns->IpAddress.String);
tor_log(EVDNS_LOG_DEBUG,"Successfully added %s as nameserver",ns->IpAddress.String);
added_any++;
}
......@@ -3198,7 +3198,7 @@ load_nameservers_with_getnetworkparams(void)
}
if (!added_any) {
log(EVDNS_LOG_DEBUG, "No nameservers added.");
tor_log(EVDNS_LOG_DEBUG, "No nameservers added.");
if (status == 0)
status = -1;
} else {
......@@ -3254,10 +3254,10 @@ load_nameservers_from_registry(void)