farrokhi/dnsdiag

More accurate DNS query time

dnsbob opened this issue · 1 comments

Thanks for writing these scripts!
dnsping and dnseval look very useful, but I need to measure times in the 1 millisecond range and the times reported are one or two milliseconds greater than the times reported by 'dig' and verified with tcpdump. I found that the underlying call to 'dnspython' returns the query time, which is more accurate. I would recommend changing line 208 in dnsping.py from:
elapsed = (etime - stime) * 1000 # convert to milliseconds
To:
elapsed = answers.response.time * 1000 # convert to milliseconds

Likewise, change line 168 in dnseval.py from:
elapsed = (etime - stime) * 1000 # convert to milliseconds
To:
elapsed = answers.response.time * 1000 # convert to milliseconds

etime and stime are also used for other purposes in dnsping.py, but can be removed from dnsevel.py (lines 159 and 162)

Correct. Thanks for the contribution!