[dns-operations] dnscap -s

David Dagon dagon at cc.gatech.edu
Mon Jul 23 00:43:01 UTC 2007


On Sun, Jul 22, 2007 at 05:29:24PM +0000, Paul Vixie wrote:

> so there's something terribly gutshot in your
> /usr/include/arpa/nameser.h file and i'd love to see what centos 4.4
> has come up with that breaks this otherwise portable code which
> tries to use an otherwise portable, and common, interface.

Most linux distros drop the const qualifier from their NS_GET32 macro
in (gnu libc) nameser.h.  So you can redefine the macro (see the patch
below.)  But if one does this, another linux-specific error is
encountered:

   undefined reference to `__ns_initparse'

etc. etc.

It turns out libresolv.so on libc6 does not export the four needed
symbols: ns_initparse, ns_parserr, ns_sprintrr, fp_nquery.  But these
symbols are in libresolv.a:

linux$  nm -a /usr/lib/libresolv.a \
        | egrep "ns_initparse|ns_parserr|ns_sprintrr|fp_nquery"

There's some indication that these needed symbols are not exported on
purpose:

  http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/3f620ea1c4cedabc/

(Here's the same link: http://tinyurl.com/3bxuqk )

The attached patch shows one way to work around this by:

  1) The dnscap.c file is modified (after the include of #include
<arpa/nameser.h>) to essentially:

   #ifdef __GNUC__
   #undef NS_GET32
   #define NSGET32 ....etc.

... define NS_GET32 with the const qualifier

  2) Add a note to the makefile to uncomment the line:

     #PORTLIBS= /usr/lib/libresolv.a

to build on linux.

  3) Adds some notes to the README.linux about how to build all of
this with debian-derived distro dpkg (which is also fun to say).


-- 
David Dagon              /"\                          "When cryptography
dagon at cc.gatech.edu      \ /  ASCII RIBBON CAMPAIGN    is outlawed, bayl
Ph.D. Student             X     AGAINST HTML MAIL      bhgynjf jvyy unir
Georgia Inst. of Tech.   / \                           cevinpl."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dnscap_20070718~cvs_linux_patch.diff
Type: text/x-diff
Size: 3300 bytes
Desc: not available
URL: <https://lists.dns-oarc.net/pipermail/dns-operations/attachments/20070722/6542c36c/attachment.diff>


More information about the dns-operations mailing list