libresolv with getaddrinfo

Joshua Rogers glibc@internot.info
Sat Mar 14 02:54:00 GMT 2015


On 14/03/15 05:43, Carlos O'Donell wrote:
>> > Would that be what res_init() is for?
> That function is intended to initialize the internals of the resolver.
> That isn't what you're interested in doing though. You want to alter
> the internals, and those internals might change. You have no option
> but to keep modifying your code and recompiling if the internals of _res
> change.
>  
I meant, run res_init() before we alter the internals.
Based on what you've said later on in this email, should I be doing
res_init(), then running  __res_vinit() manually?

> How are you overwriting _res? Are you following the same rules glibc
> follows internally to avoid reinitializing?

I'm simply doing this:

|inet_pton(AF_INET, ||"208.67.220.220"||, &server); |
 
|serverSock.sin_family = AF_INET;|
|s||erverSock.sin_port = htons(53);|
|serverSock.sin_addr = server;|
 
|_res.nscount = 1;|
|_res.nsaddr_list[0] = serverSock;

|


> Every call to every function may reinitialize _res if certain rules
> are not followed. Those rules are documented in __res_maybe_init() function.
Do you mean actually documented? Or just you can work it out by reading
the code. If the former, could you link me to the documentation?


Thanks,
-- 
-- Joshua Rogers <https://internot.info/>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-help/attachments/20150314/5c2bcc43/attachment.sig>


More information about the Libc-help mailing list