mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Tarun Johar  <tjohar@totalphase.com>
To: musl@lists.openwall.com
Cc: "Tarun Johar " <tjohar@totalphase.com>
Subject: DNS resolver patch
Date: Wed, 5 Dec 2018 21:31:55 -0800 (PST)	[thread overview]
Message-ID: <1934405743.3003283.1544074315707.JavaMail.zimbra@totalphase.com> (raw)
In-Reply-To: <882247050.3003099.1544074074084.JavaMail.zimbra@totalphase.com>

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

Hi Team, 

The VirtualBox --natdnsresolver does not support IPv6 AAAA address queries. It returns "NotImp" (code 4) for such queries. 

The MUSL library (https://www.musl-libc.org/) resolver does not recognize this code and retries the query until the timeout. This causes DNS lookups to take several seconds after which they are eventually successful. 

The GLIBC resolver works properly with the same configuration, suggesting that a fix should be made to MUSL to handle the "NotImp" response code. 

The root cause is this section of code in musl/src/network/res_msend.c:149 
/* Only accept positive or negative responses; 
* retry immediately on server failure, and ignore 
* all other codes such as refusal. */ 
switch (answers[next][3] & 15) { 
case 0: 
case 3: 
break; 
case 2: 
if (servfail_retry && servfail_retry--) 
sendto(fd, queries[i], 
qlens[i], MSG_NOSIGNAL, 
(void *)&ns[j], sl); 
default: 
continue; 
} 

If "case 4" is added after "case 3" and before "break", the NotImp code is treated as a positive or negative response and the name resolution loop completes immediately. 

Can the patch for this be included in MUSL 1.1.21 ? 

Thanks, 
Tarun 

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

       reply	other threads:[~2018-12-06  5:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <882247050.3003099.1544074074084.JavaMail.zimbra@totalphase.com>
2018-12-06  5:31 ` Tarun Johar [this message]
2018-12-06 14:13   ` Rich Felker
2018-12-06 15:23     ` Natanael Copa
2018-12-06 14:53   ` Florian Weimer
2018-12-06 15:48     ` Natanael Copa
2018-12-06 18:18       ` Florian Weimer
2018-12-06 18:38         ` A. Wilcox
2018-12-06 19:46           ` Laurent Bercot
2018-12-25  2:06             ` Rich Felker
2018-12-27 19:18               ` Florian Weimer
2018-12-28 17:21                 ` Rich Felker
2019-05-30  8:50                   ` Florian Weimer
2019-05-30 13:54                     ` Rich Felker
2018-12-06 20:36           ` Florian Weimer
2018-12-06 21:01             ` Rich Felker
2018-12-06 18:50       ` Tarun Johar
2018-12-06 19:36         ` Tarun Johar

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=1934405743.3003283.1544074315707.JavaMail.zimbra@totalphase.com \
    --to=tjohar@totalphase.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).