mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-23 16:20:26 -05:00
- Fix #888: [FR] Use kernel timestamps for dnstap.
This commit is contained in:
parent
1fb78afc29
commit
2a2598dbf2
4 changed files with 16 additions and 7 deletions
|
|
@ -1305,8 +1305,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||||
wait_queue_time = wait_time.tv_sec * 1000000 + wait_time.tv_usec;
|
wait_queue_time = wait_time.tv_sec * 1000000 + wait_time.tv_usec;
|
||||||
if (worker->stats.max_query_time_us < wait_queue_time)
|
if (worker->stats.max_query_time_us < wait_queue_time)
|
||||||
worker->stats.max_query_time_us = wait_queue_time;
|
worker->stats.max_query_time_us = wait_queue_time;
|
||||||
c->recv_tv.tv_sec += worker->env.cfg->sock_queue_timeout;
|
if(wait_queue_time >
|
||||||
if (timeval_smaller(&c->recv_tv, worker->env.now_tv)) {
|
(long long)(worker->env.cfg->sock_queue_timeout * 1000000)) {
|
||||||
/* count and drop queries that were sitting in the socket queue too long */
|
/* count and drop queries that were sitting in the socket queue too long */
|
||||||
worker->stats.num_queries_timed_out++;
|
worker->stats.num_queries_timed_out++;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1364,7 +1364,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||||
if(worker->dtenv.log_client_query_messages) {
|
if(worker->dtenv.log_client_query_messages) {
|
||||||
log_addr(VERB_ALGO, "request from client", &repinfo->client_addr, repinfo->client_addrlen);
|
log_addr(VERB_ALGO, "request from client", &repinfo->client_addr, repinfo->client_addrlen);
|
||||||
log_addr(VERB_ALGO, "to local addr", (void*)repinfo->c->socket->addr->ai_addr, repinfo->c->socket->addr->ai_addrlen);
|
log_addr(VERB_ALGO, "to local addr", (void*)repinfo->c->socket->addr->ai_addr, repinfo->c->socket->addr->ai_addrlen);
|
||||||
dt_msg_send_client_query(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr->ai_addr, c->type, c->buffer);
|
dt_msg_send_client_query(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr->ai_addr, c->type, c->buffer,
|
||||||
|
((worker->env.cfg->sock_queue_timeout && timeval_isset(&c->recv_tv))?&c->recv_tv:NULL));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Check deny/refuse ACLs */
|
/* Check deny/refuse ACLs */
|
||||||
|
|
|
||||||
|
|
@ -388,12 +388,15 @@ dt_msg_send_client_query(struct dt_env *env,
|
||||||
struct sockaddr_storage *qsock,
|
struct sockaddr_storage *qsock,
|
||||||
struct sockaddr_storage *rsock,
|
struct sockaddr_storage *rsock,
|
||||||
enum comm_point_type cptype,
|
enum comm_point_type cptype,
|
||||||
sldns_buffer *qmsg)
|
sldns_buffer *qmsg,
|
||||||
|
struct timeval* tstamp)
|
||||||
{
|
{
|
||||||
struct dt_msg dm;
|
struct dt_msg dm;
|
||||||
struct timeval qtime;
|
struct timeval qtime;
|
||||||
|
|
||||||
gettimeofday(&qtime, NULL);
|
if(tstamp)
|
||||||
|
memcpy(&qtime, tstamp, sizeof(qtime));
|
||||||
|
else gettimeofday(&qtime, NULL);
|
||||||
|
|
||||||
/* type */
|
/* type */
|
||||||
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__CLIENT_QUERY);
|
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__CLIENT_QUERY);
|
||||||
|
|
|
||||||
|
|
@ -126,13 +126,15 @@ dt_delete(struct dt_env *env);
|
||||||
* @param rsock: local (service) address/port.
|
* @param rsock: local (service) address/port.
|
||||||
* @param cptype: comm_udp or comm_tcp.
|
* @param cptype: comm_udp or comm_tcp.
|
||||||
* @param qmsg: query message.
|
* @param qmsg: query message.
|
||||||
|
* @param tstamp: timestamp or NULL if none provided.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dt_msg_send_client_query(struct dt_env *env,
|
dt_msg_send_client_query(struct dt_env *env,
|
||||||
struct sockaddr_storage *qsock,
|
struct sockaddr_storage *qsock,
|
||||||
struct sockaddr_storage *rsock,
|
struct sockaddr_storage *rsock,
|
||||||
enum comm_point_type cptype,
|
enum comm_point_type cptype,
|
||||||
struct sldns_buffer *qmsg);
|
struct sldns_buffer *qmsg,
|
||||||
|
struct timeval* tstamp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and send a new dnstap "Message" event of type CLIENT_RESPONSE.
|
* Create and send a new dnstap "Message" event of type CLIENT_RESPONSE.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
16 May 2023: Wouter
|
||||||
|
- Fix #888: [FR] Use kernel timestamps for dnstap.
|
||||||
|
|
||||||
11 May 2023: Wouter
|
11 May 2023: Wouter
|
||||||
- Fix warning in windows compile, in set_recvtimestamp.
|
- Fix warning in windows compile, in set_recvtimestamp.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue