From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16109 invoked from network); 4 Dec 2022 04:03:16 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 4 Dec 2022 04:03:16 -0000 Received: (qmail 7575 invoked by uid 550); 4 Dec 2022 04:03:11 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7542 invoked from network); 4 Dec 2022 04:03:11 -0000 Date: Sun, 4 Dec 2022 00:02:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=macdermid.ca; s=key1; t=1670126579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=aZzz5GxD2qZTKri3Y2qB/9/6+ff9bYjQuYNA+lbOBOQ=; b=KFsf91ngUhWlT4HH3uFvjpOXbRZyaKnY+1MMnhZL3yIW/sfPXOBc2is7avNJAJMNrYwwH+ HMx4GWNGAVcYwg0JcVj44Xjum6ZbpgIjxd6OnANIf+sQuLp5Lex2qcHfmBpBtHMK/RQiTs TT8ZES96VHUnOa/SAoPQYu2zc7pCzkY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kenny MacDermid To: musl@lists.openwall.com Message-ID: <20221204040254.pfd3bqjztfw4vrue@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Migadu-Flow: FLOW_OUT Subject: [musl] lookup_name issue with search domains Hello, I'm seeing an issue in resolving hosts when any resolv.conf search domain returns a no-data response. In debugging I believe it's caused by the check in network/lookup_name.c, line 225: if (cnt) return cnt; The code is looping through the search domains trying each one. This works fine for some of my search domains because the DNS response will have reply code flags set to 3, which causes name_from_dns() to return 0. The issue arises when it queries my cloudflare hosted domain (which also uses dnssec). That query does not have the reply code flags set to 3. Instead it's set to 0. This results in name_from_dns() returning EAI_NODATA. Because of the above mentioned check, this value is directly returned and subsequent domains (and most importantly the domain without anything appended) are not tested. When I replaced the condition with `(cnt > 0)` it worked for me. I'm not sure that's the best solution, but I also can't see a reason to stop attempting to lookup the host because an unrelated host caused some error. To add some context, this was seen in a golang program running on a kind/Kubernetes cluster. In these clusters ndots is set to 5 so pretty much every name is first checked against the search list. When using the golang resolver with `GODEBUG=netdns=go` I do not see the same issue.