Question about res_init()

Guus Sliepen guus at tinc-vpn.org
Tue Sep 8 15:40:55 CEST 2015


On Tue, Sep 08, 2015 at 02:57:04PM +0200, borg at uu3.net wrote:

> I have some doubts about this commit:
> 09d60499af3acef2ba9bd7be15e8d1c44249f8d5
> Always call res_init() before getaddrinfo().
> 
> Im not sure if this is really a good idea to call
> res_init() so often. In UNIX, resolv.conf does NOT really
> change.. and if it changes ever.. its not a problem to restart
> affected processes.

Resolv.conf does change when you are roaming. For some people,
especially if they have both WiFi and flat rate 3G/4G/etc and traveling,
that can happen many times a day.

> Does anyone think about any ill-effects res_init() can do
> when called often? Leaks?

I did run tests calling res_init() in a tight loop on several platforms,
there are no memory leaks and the call is relatively cheap.
Getaddrinfo() is not called that often in tinc, so the impact is
negligable.

-- 
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.tinc-vpn.org/pipermail/tinc-devel/attachments/20150908/c7d08059/attachment.sig>


More information about the tinc-devel mailing list