Request for comment for async resolution of DNS names

Jeremy Allison jra at samba.org
Fri Feb 10 18:56:36 UTC 2017


On Fri, Feb 10, 2017 at 11:30:10AM +0100, Stefan Metzmacher wrote:
> Hi Matthieu,
> 
> > On 02/09/2017 12:33 AM, Volker Lendecke wrote:
> >> On Wed, Feb 08, 2017 at 11:10:11AM -0800, Matthieu Patou wrote:
> >> <snip>
> >> Can you restructure the code to only call getaddrinfo and nothing else
> >> in the threaded job.
> > Please find attached an updated version of the patch, it should do very
> > minimal things in the thread function.
> > It seems to work for me both when I have additional records in the SRV
> > response and when I haven't, valgrind didn't seems to complain and net
> > joins seems to work.
> > I need more tests but so
> > 
> > There was an alternative solution (that I have saved somewhere) where I
> > cheat with the struct dns_rr_srv structure to pass the struct addrinfo
> > back to the main thread by using the pointer to struct sockaddr_storage
> > to store the point to struct addrinfo.
> > But Jeremy was not very keen on it, so instead here is the variant where
> > there is a separate state structure for the resolve_one_name function.
> 
> It seems we already have getaddrinfo_send/recv can't we just use them?
> There're currently based on fncall_send/recv and are also available
> in older releases.

+1 on that. Matthieu, should be easy to change your code to
use getaddrinfo_send()/getaddrinfo_recv(). They're in
source3/lib/util_sock.c and they're even tested :-), although
not currently used in mainline code.

See:

source3/torture/torture.c:run_getaddrinfo_send()

for sample code.



More information about the samba-technical mailing list