resolv: How to use rhook

Gary Johnson garyjohn@spocom.com
Mon Apr 15 17:52:00 GMT 2013


I would like to use the _rev.rhook to instrument the resolver for
the purpose of determining the status of individual name servers.

I defined USE_HOOKS when glibc was built and set _rev.rhook in my
code to the address of a function with the appropriate signature.
However, when I call getaddrinfo(), my rhook function is not called
and upon return from getaddrinfo(), _rev.hook has been set to 0.
This seems to be because getaddrinfo() always indirectly executes
__res_vinit() which sets rhook to 0.

I'm using GNU C Library version 2.14.1.  I didn't notice any
significant difference in the hook code in the source for version
2.17.

How is this hook intended to be used?

Regards,
Gary



More information about the Libc-help mailing list