mirror of https://github.com/getdnsapi/getdns.git
Rename SYSTEM_DAEMON in LOG_UPSTREAM_STATS
This commit is contained in:
parent
55acf6662c
commit
8235250fb6
|
@ -103,9 +103,7 @@ static struct const_info consts_info[] = {
|
|||
{ 1202, "GETDNS_TRANSPORT_TLS", GETDNS_TRANSPORT_TLS_TEXT },
|
||||
{ 1300, "GETDNS_AUTHENTICATION_NONE", GETDNS_AUTHENTICATION_NONE_TEXT },
|
||||
{ 1301, "GETDNS_AUTHENTICATION_REQUIRED", GETDNS_AUTHENTICATION_REQUIRED_TEXT },
|
||||
{ 4096, "GETDNS_SYSTEM_DAEMON", GETDNS_SYSTEM_DAEMON_TEXT },
|
||||
{ 8192, "GETDNS_SYSTEM_STUB", GETDNS_SYSTEM_STUB_TEXT },
|
||||
{ 16384, "GETDNS_SYSTEM_MDNS", GETDNS_SYSTEM_MDNS_TEXT },
|
||||
{ 4096, "GETDNS_LOG_UPSTREAM_STATS", GETDNS_LOG_UPSTREAM_STATS_TEXT },
|
||||
};
|
||||
|
||||
static int const_info_cmp(const void *a, const void *b)
|
||||
|
@ -191,6 +189,7 @@ static struct const_name_info consts_name_info[] = {
|
|||
{ "GETDNS_LOG_ERR", 3 },
|
||||
{ "GETDNS_LOG_INFO", 6 },
|
||||
{ "GETDNS_LOG_NOTICE", 5 },
|
||||
{ "GETDNS_LOG_UPSTREAM_STATS", 4096 },
|
||||
{ "GETDNS_LOG_WARNING", 4 },
|
||||
{ "GETDNS_NAMESPACE_DNS", 500 },
|
||||
{ "GETDNS_NAMESPACE_LOCALNAMES", 501 },
|
||||
|
@ -331,9 +330,6 @@ static struct const_name_info consts_name_info[] = {
|
|||
{ "GETDNS_RRTYPE_UNSPEC", 103 },
|
||||
{ "GETDNS_RRTYPE_URI", 256 },
|
||||
{ "GETDNS_RRTYPE_WKS", 11 },
|
||||
{ "GETDNS_SYSTEM_DAEMON", 4096 },
|
||||
{ "GETDNS_SYSTEM_MDNS", 16384 },
|
||||
{ "GETDNS_SYSTEM_STUB", 8192 },
|
||||
{ "GETDNS_TRANSPORT_TCP", 1201 },
|
||||
{ "GETDNS_TRANSPORT_TCP_ONLY", 542 },
|
||||
{ "GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN", 543 },
|
||||
|
|
|
@ -747,19 +747,19 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
|
|||
/* Keep track of the best auth state this upstream has had*/
|
||||
if (upstream->tls_auth_state > upstream->best_tls_auth_state)
|
||||
upstream->best_tls_auth_state = upstream->tls_auth_state;
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Conn closed : Transport=%s - Resp=%d,Timeouts=%d,Auth=%s,Keepalive(ms)=%d\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||
(int)upstream->responses_received, (int)upstream->responses_timeouts,
|
||||
_getdns_auth_str(upstream->tls_auth_state), (int)upstream->keepalive_timeout);
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Upstream stats: Transport=%s - Resp=%d,Timeouts=%d,Best_auth=%s\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||
(int)upstream->total_responses, (int)upstream->total_timeouts,
|
||||
_getdns_auth_str(upstream->best_tls_auth_state));
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Upstream stats: Transport=%s - Conns=%d,Conn_fails=%d,Conn_shutdowns=%d,Backoffs=%d\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"),
|
||||
|
@ -788,7 +788,7 @@ _getdns_upstream_shutdown(getdns_upstream *upstream)
|
|||
upstream->conn_shutdowns = 0;
|
||||
upstream->conn_backoffs++;
|
||||
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : !Backing off this upstream - Will retry as new upstream at %s",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
asctime(gmtime(&upstream->conn_retry_time)));
|
||||
|
|
|
@ -524,15 +524,10 @@ typedef enum getdns_loglevel_type {
|
|||
#define GETDNS_LOG_INFO_TEXT "Informational message"
|
||||
#define GETDNS_LOG_DEBUG_TEXT "Debug-level message"
|
||||
|
||||
#define GETDNS_SYSTEM_DAEMON 4096
|
||||
#define GETDNS_SYSTEM_STUB 8192
|
||||
#define GETDNS_SYSTEM_MDNS 16384
|
||||
#define GETDNS_LOG_UPSTREAM_STATS 4096
|
||||
#define GETDNS_LOG_UPSTREAM_STATS_TEXT "Log messages about upstream statistics"
|
||||
|
||||
#define GETDNS_SYSTEM_DAEMON_TEXT "Log messages regarding the daemon system"
|
||||
#define GETDNS_SYSTEM_STUB_TEXT "Log messages regarding the stub system"
|
||||
#define GETDNS_SYSTEM_MDNS_TEXT "Log messages regarding the mdns system"
|
||||
|
||||
typedef void (*getdns_logfunc_type) (void *userarg, uint64_t system,
|
||||
typedef void (*getdns_logfunc_type) (void *userarg, uint64_t log_systems,
|
||||
getdns_loglevel_type, const char *, va_list ap);
|
||||
|
||||
/**
|
||||
|
|
18
src/stub.c
18
src/stub.c
|
@ -608,7 +608,7 @@ stub_timeout_cb(void *userarg)
|
|||
#endif
|
||||
netreq->upstream->udp_timeouts++;
|
||||
if (netreq->upstream->udp_timeouts % 100 == 0)
|
||||
_getdns_upstream_log(netreq->upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
||||
STUB_DEBUG_DAEMON, netreq->upstream->addr_str,
|
||||
(int)netreq->upstream->udp_responses, (int)netreq->upstream->udp_timeouts);
|
||||
|
@ -908,7 +908,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||
X509_verify_cert_error_string(err));
|
||||
#endif
|
||||
if (!preverify_ok && !upstream->tls_fallback_ok)
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Verify failed : Transport=TLS - *Failure* - (%d) \"%s\"\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str, err,
|
||||
X509_verify_cert_error_string(err));
|
||||
|
@ -944,7 +944,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||
DEBUG_STUB("%s %-35s: FD: %d, WARNING: Proceeding even though pinset validation failed!\n",
|
||||
STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd);
|
||||
else
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Conn failed : Transport=TLS - *Failure* - Pinset validation failure\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str);
|
||||
} else {
|
||||
|
@ -957,7 +957,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
|
|||
preverify_ok = 1;
|
||||
DEBUG_STUB("%s %-35s: FD: %d, Allowing self-signed (%d) cert since pins match\n",
|
||||
STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd, err);
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Verify passed : Transport=TLS - Allowing self-signed cert since pins match\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str);
|
||||
}
|
||||
|
@ -1472,7 +1472,7 @@ stub_udp_read_cb(void *userarg)
|
|||
upstream->udp_responses++;
|
||||
if (upstream->udp_responses == 1 ||
|
||||
upstream->udp_responses % 100 == 0)
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
(int)upstream->udp_responses, (int)upstream->udp_timeouts);
|
||||
|
@ -1729,7 +1729,7 @@ upstream_write_cb(void *userarg)
|
|||
case STUB_NO_AUTH:
|
||||
/* Cleaning up after connection or auth check failure. Need to fallback. */
|
||||
stub_cleanup(netreq);
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Conn closed : Transport=%s - *Failure*\n",
|
||||
STUB_DEBUG_DAEMON, upstream->addr_str,
|
||||
(upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"));
|
||||
|
@ -1884,7 +1884,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra
|
|||
if (upstreams->upstreams[i].conn_state == GETDNS_CONN_BACKOFF &&
|
||||
upstreams->upstreams[i].conn_retry_time < now) {
|
||||
upstreams->upstreams[i].conn_state = GETDNS_CONN_CLOSED;
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Re-instating upstream\n",
|
||||
STUB_DEBUG_DAEMON, upstreams->upstreams[i].addr_str);
|
||||
}
|
||||
|
@ -2017,7 +2017,7 @@ upstream_connect(getdns_upstream *upstream, getdns_transport_list_t transport,
|
|||
upstream->tls_hs_state = GETDNS_HS_WRITE;
|
||||
}
|
||||
upstream->conn_state = GETDNS_CONN_SETUP;
|
||||
_getdns_upstream_log(upstream, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s %-40s : Conn init : Transport=%s - Profile=%s\n", STUB_DEBUG_DAEMON,
|
||||
upstream->addr_str, transport == GETDNS_TRANSPORT_TLS ? "TLS":"TCP",
|
||||
dnsreq->context->tls_auth_min == GETDNS_AUTHENTICATION_NONE ? "Opportunistic":"Strict");
|
||||
|
@ -2086,7 +2086,7 @@ upstream_find_for_netreq(getdns_network_req *netreq)
|
|||
}
|
||||
/* Handle better, will give generic error*/
|
||||
DEBUG_STUB("%s %-35s: MSG: %p No valid upstream! \n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq);
|
||||
_getdns_context_log(netreq->owner->context, GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG,
|
||||
_getdns_context_log(netreq->owner->context, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG,
|
||||
"%s *FAILURE* no valid transports or upstreams available!\n",
|
||||
STUB_DEBUG_DAEMON);
|
||||
return -1;
|
||||
|
|
|
@ -1678,7 +1678,7 @@ main(int argc, char **argv)
|
|||
clear_listen_list_on_arg = 1;
|
||||
|
||||
(void) getdns_context_set_logfunc(context, NULL,
|
||||
GETDNS_SYSTEM_DAEMON, GETDNS_LOG_DEBUG, stubby_log);
|
||||
GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, stubby_log);
|
||||
}
|
||||
if ((r = parse_args(argc, argv)))
|
||||
goto done_destroy_context;
|
||||
|
|
Loading…
Reference in New Issue