• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to Backtrace Functions?



Messages: 45

When getaddrinfo() is called, I'd like to be able to stop the request from completing before res_nquery is called, stemming from a "permissions" concern.

On DragonflyBSD, NetBSD and FreeBSD, the "name-service switch dispatcher" configured in /etc/nsswitch.conf is used to select which sources for hostname lookups to use and what order to use them.
"...is used to select which sources..." - is used by what to select which sources?

I've looked at https://www.freebsd.org/cgi/man.cgi?query=nsdispatch, and it looks like a better place to implement security related code than res_nquery, but the impression I have of the "name-service switch dispatcher routine" is that the decision to go through with dispatch has already been made sometime before that point.

Maybe a better question / line of thinking: when I call getaddrinfo(), how do I trace that call back, one step at a time, to res_nquery?



Messages: 45

If I put a ton of print statements in libc code, and then compile the FreeBSD kernel, will I be able to see those statements in the root console?


Well-Known Member

Thanks: 128
Messages: 294



Aspiring Daemon

Thanks: 115
Messages: 651

Dtrace is definitely good, but good old ltrace(1) is your friend here too. It gives you general idea what is being called.