Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • aports aports
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
  • Issues 662
    • Issues 662
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 339
    • Merge requests 339
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpinealpine
  • aportsaports
  • Issues
  • #9017
Closed
Open
Issue created Jun 17, 2018 by algitbot@rootOwner

musl dns client stop further search domain when one search domain return something unexpected.

When making dns query with multiple search domain, alpine dns client would stop further search when on search domain return something unexpected.

  1. cat /etc/resolv.conf
    nameserver 10.254.0.100
    search default.svc.enn.cn svc.enn.cn enn.cn some.something.com
    options ndots:5

when make query of some common name, e.g. baidu.com, the dns client should query following names and eventually return a correct resolved ip addr:

  1. baidu.com.default.svc.enn.cn (The DNS 10.254.0.10 return NXDOMAIN)
  2. baidu.com.svc.enn.cn (The DNS 10.254.0.10 return NXDOMAIN)
  3. baidu.com.enn.cn (The DNS 10.254.0.10 return NXDOMAIN)
  4. baidu.com.some.something.com (Somehow dns server return code 0, or some error code)
  5. baidu.com (return correct answer.)

but with musl dns client, it would fail in step 4 when dns server return code 0 without answers(or return errors).
I think this is a musl bug after checking musl code. The cause is that name_from_dns would return error code, but name_from_dns_search would return whenever a error received from name_from_dns. It is more acceptable for musl to keep trying further domain when cnt is negative.
I tried following code change, and it seems fix it

diff —git a/src/network/lookup_name.c b/src/network/lookup_name.c
index 209c20f..abb7da5 100644
—- a/src/network/lookup_name.c
+ b/src/network/lookup_name.c
@@ –202,7 +202,7 @@ static int name_from_dns_search(struct address buf[static MAXADDRS], char canon[
memcpy(canon+l+1, p, z-p);
canon[z-p+1+l] = 0;
int cnt = name_from_dns(buf, canon, canon, family, &conf);

  • if (cnt) return cnt;
  • if (cnt >0 || cnt == EAI_AGAIN) return cnt;
    }
    }

I tried to contact musl authors, but on luck yet. Hope this is the right place to put the issue.

Thanks
David

(from redmine: issue id 9017, created on 2018-06-17, closed on 2018-07-18)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking