mailing list of musl libc
 help / color / mirror / code / Atom feed
From: 王志强 <00107082@163.com>
To: musl@lists.openwall.com
Subject: [musl] on aarch64, dns A/AAAA queries has high probability of having same dns transaction ID, causing 5s delay
Date: Tue, 5 Jan 2021 21:44:32 +0800 (CST)	[thread overview]
Message-ID: <8884803.698a.176d2cac33c.Coremail.00107082@163.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

Hi guys,
    I am having lots of dns 5s delay on a arm/aarch64 platform, after tcpdump capturing dns packages, I found that the delay always happened when A/AAAA queries  happened to have same dns transaction id. 



network/res_mkquery.c
...
    /* Make a reasonably unpredictable id */
    clock_gettime(CLOCK_REALTIME, &ts);
    id = ts.tv_nsec + ts.tv_nsec/65536UL & 0xffff;
    q[0] = id/256;
    q[1] = id;
...


time/clock_gettime.c
...
    r = __syscall(SYS_clock_gettime, clk, ts);
    if (r == -ENOSYS) {
        if (clk == CLOCK_REALTIME) {
            __syscall(SYS_gettimeofday, ts, 0);
            ts->tv_nsec = (int)ts->tv_nsec * 1000;
            return 0;
        }
        r = -EINVAL;
    }
    return __syscall_ret(r);
....


On aarch64, gettimeofday yields current time with low accuracy, the smallest unit is 1e-6, (I think)
Could we add some trick to make sure that the parallel A/AAAA queries got different  id?


Thanks
David

[-- Attachment #2: Type: text/html, Size: 2006 bytes --]

             reply	other threads:[~2021-01-05 13:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 13:44 王志强 [this message]
2021-01-07  1:38 ` [musl] " 王志强

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8884803.698a.176d2cac33c.Coremail.00107082@163.com \
    --to=00107082@163.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).