[ntp:questions] ntpdate, sntp and libraries

Danny Mayer mayer at ntp.isc.org
Sat Feb 7 04:01:28 UTC 2009


[I changed the subject line to reflect the discussion]
Martin Burnicki wrote:
>
> The problem with ntpdate is that code which is used in several programs of
> the NTP package (ntpd, ntpdate, ntptimeset, ...) has been *copied* from one
> program to another instead of putting it into a commonly used source file,
> e.g. in libntp. Over the years changes have been applied to the code in
> ntpd, but those changes have not made their way into the other programs of
> the package.

We are agreed on this and we should be pushing more code into libntp.
Having said that libntp also needs to be cleaned up.

> Recently sntp has been written from scratch. So this a pretty new code base.
> However, AFAIK this did not compile e.g. under Windows, and in the mean
> time the author/maintainer has disappeared.

Are you talking about the gsoc-sntp code you mention next?
> 
> Now gsoc-sntp is there, and I don't see how this could be built e.g. under
> Windows. What I see is that a number of functions which are available in
> ntpd and can be used both under Unix and windows have again been
> duplicated/rewritten in gsoc-sntp. So there is one more code base which
> needs to be ported and maintained. Great.

We can get it working under Windows.

> BTW, the same basic problem is with the ISC libraries, which also seem to
> have been copied e.g. from ISC's bind. Nowadays there a different versions
> of the same source code modules both in libisc/ and ports/winnt/libisc,
> e.g. interfaceiter.c, isc_strerror.c, and net.c.

Those are different code and that is deliberate. You should look at how
we designed the directory structure in BIND9 to best deal with the
various operating system requirements. The Windows directory structure
is different on ntp because I didn't want to change it fit the BIND9
structure into it.

> 
> IMHO this is also quite error prone. E.g. There are 5 (!) instances of the
> isc_interfaceiter_create() function in the code base, 3 below libisc/, and
> 2 below ports/winnt/libisc/.

Yes, there are different versions of isc_interface_create() and friends
but each is due to different requirements of the operating systems to
get a list of interfaces. You will find that although it looks like
separate files, the Unix versions incorporate functions that are common
to all of them. Again by design. There is only one version under
ports/winnt/libisc/. Where are you seeing more?

I hope this clarifies things.

Danny



More information about the questions mailing list