Discussion:
[Dnsmasq-discuss] Non-monotonic serial number in log-queries=extra
Dominik DL6ER
2018-06-14 16:22:06 UTC
Permalink
Dear Simon,

I use "--log-queries=extra". I noticed that when sending queries over
TCP, that the serial number (daemon->log_id) of the queries jump by 100,
e.g.

Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 query[A] google.de from
10.8.0.2
Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 forwarded google.de to
127.0.0.1
Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 reply google.de is
172.217.22.99
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 query[A] google.de
from 10.8.0.2
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 forwarded google.de
to 127.0.0.1
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 reply google.de is
172.217.22.99

The first query was sent over TCP, the second over UDP.

This is caused by this part in the code run after forking TCP workers:

/* The child can use up to TCP_MAX_QUERIES ids, so skip that many. */
daemon->log_id += TCP_MAX_QUERIES;

Would it be possible to have the TCP workers use the same counter?
I'm thinking about sharing the log_id integer using shmget().

Best regards
Dominik
Simon Kelley
2018-06-15 21:24:48 UTC
Permalink
I guess it would, subject to lots of concurrency worries about atomic
updates, etc. The question is, why would you bother? The existing code
achieves the aim, which is that the logged id on all lines associated
with a query is the same, and it's different from the logged id of any
other query.

Cheers,

Simon.
Post by Dominik DL6ER
Dear Simon,
I use "--log-queries=extra". I noticed that when sending queries over
TCP, that the serial number (daemon->log_id) of the queries jump by 100,
e.g.
Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 query[A] google.de from
10.8.0.2
Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 forwarded google.de to
127.0.0.1
Jun 14 17:38:40 dnsmasq[30831]: 4 10.8.0.2/36989 reply google.de is
172.217.22.99
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 query[A] google.de
from 10.8.0.2
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 forwarded google.de
to 127.0.0.1
Jun 14 17:38:43 dnsmasq[30637]: 104 10.8.0.2/42334 reply google.de is
172.217.22.99
The first query was sent over TCP, the second over UDP.
/* The child can use up to TCP_MAX_QUERIES ids, so skip that many. */
daemon->log_id += TCP_MAX_QUERIES;
Would it be possible to have the TCP workers use the same counter?
I'm thinking about sharing the log_id integer using shmget().
Best regards
Dominik
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...