Opened 3 years ago

Last modified 2 years ago

#18333 new defect

busybox nslookup and musl

Reported by: barbaracus@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: nslookup busybox musl Cc:


I found another issue with the musl build in trunk: the nslookup utility in busybox ignores the optional external server provided through the command line:

For example:

nslookup hostname

doesn't use the dns server at all and the resolution is done by the local resolver.

This issue occurs because the nslookup implementation in busybox fiddles with the internals of the libc resolver.

It works with uclibc, but doesn't with musl: infact, even though musl provides those internals, they are non-functional and they are there only to allow a clean compilation of "broken" programs (quoting from the musl code res_state.c: "This is completely unused, and exists purely to satisfy broken apps")

I tried to come up with a simple patch to busybox but I soon realized that I had to rewrite everything. OTOH the other nslookup utilities available through the feeds depended on many libraries and I'm very space constrained in my router.

I wrote therefore a very simple (and possibly not entirely correct) implementation of nslookup that uses the proper libresolv API to make and send DNS queries to a local or remote dns server. I tested it with glibc and musl.

If anybody is interested the code is here:

Of course a proper fix to busybox would be really welcome.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by zloop

regarding this issue there is some background on the busybox mailing list:

comment:2 Changed 3 years ago by barbaracus@…

I used an alternate nslookup instead of the one provided by busybox.

Unfortunately the package ddns-scripts relies heavily on the output of busybox's nslookup.

I worked with the package author to fix some of the issues I experienced, the major ones will be fixed, the others unfortunately won't anytime soon.

comment:3 Changed 2 years ago by adkorte

Since trunk is now build with musl by default, nslookup is basically broken when a server is specified. Worse, it will print the IP and name of the server but will silently ignore those values and use the values from the local resolver instead.

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.