linux - Determining which nameserver performed a resolution -


I am setting two nameservers in constr and then res_search I am using a URI to find the IP address

What is the determination of two nameservers? I know that I can set a trace in res_search and capture stdout but it will not be possible in my situation. What is the address of Normarwar in the result?

There is no way that I know to know which name server calls the results of the call Seeing res_search () returned the result. This information is only in the top-level UDP packet header and now the packet has not been unexpected by libresolv .

However, code> libresolv appears that it is possible to do this by entering a "reaction hook" with the resistor:

  Res_send_setrhook ()  

or

  _res.rhook = & amp; Funcptr;  

The first parameter given for the hook callback will be such a struct sockaddr * which sends the feedback. The code below works on Macod X 10.5.6:

  #include & lt; Stdlib.h & gt; # Include & lt; Stdio.h & gt; # Include & lt; Resolv.h & gt; #include & lt; Netinet / in.h> Res_sendhookact hook (const struct sockaddr * ns, const u_char * query, int querylen, u_char * ans, int anssiz, int * resplen) {fprintf (stderr, "reply to% s \ n", inet_ntoa (((struct sockaddr_in *) Ns) -> sin_addr); Return resignhead; } Main () {res_init (); _res.rhook = Hook; Res_search (...); }  

BTW It is possible to ask a server what it is called:

  dig @server hostname.bind ch txt  

which will return the hostname of a TXT record server (unless the functionality exists in the DNS server software and is not disabled).

It can be useful to identify which server is serving you with a special "DNS Anycast Cloud" service at this time.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -