Description of problem: ns_initparse(), ns_parserr() and friends have been in O'Reilly books and in glibc for many years. These functions make querying DNS (SRV records, in my case) very easy. Currently, I am forced to link directly with /usr/lib64/libresolv.a in glibc-devel package, because the functions are not exported. Request: export these as fully supported interfaces. They are highly useful, already in glibc, publicly documented books for many years, and mentioned in /usr/include/arpa/nameser.h. Version-Release number of selected component (if applicable): glibc-devel-2.8-3.x86_64 How reproducible: always Steps to Reproduce: 1. write application with ns_initparse() 2. attempt to link with "-lresolv", watch it fail 3. attempt to link with /usr/lib64/libresolv.a, watch it succeed Actual results: Link failure for functions in arpa/nameser.h. Expected results: Success using functions in arpa/nameser.h. Additional info: My key need is querying SRV records.
Provide (a pointer to) a complete example using those interfaces.
Created attachment 311401 [details] Example code used in server to look up DNS SRV records Here is the requested example code, which has been tested in its original form as found in open source coarse lock daemon: git://git.kernel.org/pub/scm/daemon/cld/cld.git The attachment has been massaged slightly to compile on its own. Linking requires directly referencing /usr/lib[64]/libresolv.a as mentioned.
Created attachment 311402 [details] BIND DNS zone used for testing This is a BIND zone file used with bind-9.5.0-32.rc1.fc9.x86_64 to test successful queries of DNS SRV records. It includes a single example which returns 3 SRV records in response.
Let me know if you need any more info. The alternative to this API is hand-decoding DNS RRs, which is a royal pain. You still must know the RFC-specified layout of each RR being decoded, but the ns* API makes client code more readable, and more maintainable.
Upstream has now most of the functions declared in <arpa/nameser.h>. Please test it when Jakub builds the next rawhide glibc.
Now in rawhide.