[ntp:hackers] gorilla wrangler with Unix chops soliticited

Dave Hart davehart at gmail.com
Sun May 31 07:52:52 UTC 2009


On Thu, May 28, 2009 at 3:56 PM, David Mills <mills at udel.edu> wrote:
>
> Bullshit. The overwhelming gorilla in the room is the asynchronous DNS,
> which would allow a much more flexible configuration process, as well as
> dynamic host discovery. This has been a sticky issue for several years
> with no resolution.

I have spent some time on the async DNS resolution issue and I have a
replacement for ntp_intres prototyped to the point I am able to remove
the old intres code from the build.  This exposes a deferred
resolution service to the ntpd mainline code which uses a callback
function pointer to provide the result.  This allows us to hold on to
the "peer" configuration item from the syntax tree while name
resolution proceeds, free()ing it at our convenience later.

The new async "getaddrinfo" interface is built on top of a crude
homemade RPC between ntpd and a blocking worker child, which is
implemented as a thread on Windows and a child process on Unix.  It
could also be adapted to use threads on capable Unix systems, but I
want to get the most-portable fork() and pipe()-based implementation
worked out first.

The concept is once the RPC mechanism is working on both Unix and
Windows, one can use it for another blocking service without having to
write separate code for Unix and Windows.  With a little care, it
should be easy to develop new uses for the blocking worker on either
and have the other platform just work.

I have a lot more experience developing for Windows than Unix, and a
very simple issue is currently stumping me.  I would appreciate a Unix
developer willing to help me get the fork/pipe code working, even if
by just answering boneheaded questions.  What I'm trying to do is
create a pair of pipes, then fork, and in the child, block reading a
request pipe awaiting the first hostname lookup.  The first child
read() of the request pipe is returning 0 (indicating EOF) when i'd
expect it to block until the first request is written to the parent
end.

Testing this via sudo on a system where I don't have root adds extra fun :)

The code is on pogo:~hart/ntp-dev-block for those with access.  Anyone
else who would like to help but does not have a pogo account, I'm
happy to share a tarball.  Nearly all of it is at either the top or
bottom of ntp_intres.c, with the bulk of the file #if 0'd out.

Cheers,
Dave Hart


More information about the hackers mailing list