wait_queue_time = wait_time.tv_sec * 1000000 + wait_time.tv_usec;
if (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 (timeval_smaller(&c->recv_tv, worker->env.now_tv)) {
- /* count and drop queries that were sitting in the socket queue too long */
+ if(wait_queue_time >
+ (long long)(worker->env.cfg->sock_queue_timeout * 1000000)) {
+ /* count and drop queries that were sitting in the socket queue too long */
worker->stats.num_queries_timed_out++;
return 0;
}
if(worker->dtenv.log_client_query_messages) {
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);
- 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
/* Check deny/refuse ACLs */
struct sockaddr_storage *qsock,
struct sockaddr_storage *rsock,
enum comm_point_type cptype,
- sldns_buffer *qmsg)
+ sldns_buffer *qmsg,
+ struct timeval* tstamp)
{
struct dt_msg dm;
struct timeval qtime;
- gettimeofday(&qtime, NULL);
+ if(tstamp)
+ memcpy(&qtime, tstamp, sizeof(qtime));
+ else gettimeofday(&qtime, NULL);
/* type */
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__CLIENT_QUERY);
* @param rsock: local (service) address/port.
* @param cptype: comm_udp or comm_tcp.
* @param qmsg: query message.
+ * @param tstamp: timestamp or NULL if none provided.
*/
void
dt_msg_send_client_query(struct dt_env *env,
struct sockaddr_storage *qsock,
struct sockaddr_storage *rsock,
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.
+16 May 2023: Wouter
+ - Fix #888: [FR] Use kernel timestamps for dnstap.
+
11 May 2023: Wouter
- Fix warning in windows compile, in set_recvtimestamp.