Update our ntpd to the long awaited 4.2.0 version.

This bring us several things:
- updated drivers
- IPv6 support at last
- ntp-genkeys is replaced by ntp-keygen
- ntptrace is now a script (courtesy of John Hay)
- lots of renamed files from .htm to .html (while I prefer .html, I
  find the change a bit gratuitous)
- still no manpages :(

Please test and report.

Commit very much helped by: GNU arch (http://gnuarch.org/)
This commit is contained in:
Ollivier Robert 2004-07-20 15:44:32 +00:00
parent 95d51a965d
commit 6cb84f0c29
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132458
14 changed files with 248 additions and 290 deletions

View file

@ -1,8 +1,8 @@
# Makefile for ntpd.
# $FreeBSD$
SUBDIR= libntp libparse ntpd ntpdc ntpq ntpdate ntptrace \
ntptimeset ntptime ntp-genkeys
SUBDIR= arlib libntp libparse ntpd ntpdc ntpq ntpdate ntptrace \
ntptime ntp-keygen sntp
.if !defined(NOMAN)
SUBDIR+= doc

View file

@ -0,0 +1,12 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../contrib/ntp/arlib
LIB= ares
SRCS= arlib.c
CFLAGS+= -DPACKAGE=\"arlib\" -I${.CURDIR}/../../../contrib/ntp/arlib \
-DNS_ADDR_LIST=nsaddr_list -DVERSION=\"1.0\"
.include <bsd.lib.mk>

View file

@ -2,17 +2,12 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* $FreeBSD$ */
#define ULONG_CONST(a) a ## UL
/* Is adjtime() accurate? */
/* #undef ADJTIME_IS_ACCURATE */
/* CHU audio/decoder? */
/* #undef AUDIO_CHU */
/* Autokey? */
#define AUTOKEY
/* Declare char *sys_errlist array */
/* #undef CHAR_SYS_ERRLIST */
@ -50,7 +45,7 @@
/* #undef CLOCK_DCF7000 */
/* Dumb generic hh:mm:ss local clock? */
#define CLOCK_DUMBCLOCK 1
#define CLOCK_DUMBCLOCK 1
/* Forum Graphic GPS datating station driver? */
/* #undef CLOCK_FG */
@ -160,7 +155,7 @@
/* TrueTime 560 IRIG-B decoder? */
/* #undef CLOCK_TT560 */
/* Ultralink M320 WWVB receiver */
/* Ultralink M320 WWVB receiver? */
/* #undef CLOCK_ULINK */
/* USNO modem service */
@ -286,9 +281,6 @@
/* What is the fallback value for HZ? */
#define DEFAULT_HZ 100
/* Use DES? */
/* #undef DES */
/* synch TODR hourly? */
/* #undef DOSYNCTODR */
@ -302,7 +294,7 @@
#define HAVE_ARPA_NAMESER_H 1
/* Do we have audio support? */
/* #undef HAVE_AUDIO */
#define HAVE_AUDIO 1
/* Define to 1 if you have the <bstring.h> header file. */
/* #undef HAVE_BSTRING_H */
@ -310,6 +302,9 @@
/* Do we have the CIOGETEV ioctl (SunOS, Linux)? */
/* #undef HAVE_CIOGETEV */
/* [Use], [/dev/clockctl?] */
/* #undef HAVE_CLOCKCTL */
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
@ -322,6 +317,12 @@
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the `EVP_md2' function. */
/* #undef HAVE_EVP_MD2 */
/* Define to 1 if you have the `EVP_mdc2' function. */
/* #undef HAVE_EVP_MDC2 */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
@ -352,11 +353,14 @@
/* Define to 1 if you have the <ieeefp.h> header file. */
#define HAVE_IEEEFP_H 1
/* ISC: Use iflist_sysctl? */
#define HAVE_IFLIST_SYSCTL 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isfinite' function. */
/* #undef HAVE_ISFINITE */
#define HAVE_ISFINITE 1
/* Define to 1 if you have the `kvm_open' function. */
#define HAVE_KVM_OPEN 1
@ -370,6 +374,9 @@
/* Do we have the curses library? */
/* #undef HAVE_LIBCURSES */
/* Do we have the edit library? */
/* #undef HAVE_LIBEDIT */
/* Define to 1 if you have the `elf' library (-lelf). */
/* #undef HAVE_LIBELF */
@ -382,6 +389,12 @@
/* Define to 1 if you have the `ld' library (-lld). */
/* #undef HAVE_LIBLD */
/* Define to 1 if you have the `md' library (-lmd). */
#define HAVE_LIBMD 1
/* Define to 1 if you have the `md5' library (-lmd5). */
/* #undef HAVE_LIBMD5 */
/* Define to 1 if you have the `mld' library (-lmld). */
/* #undef HAVE_LIBMLD */
@ -412,6 +425,12 @@
/* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1
/* Define to 1 if you have the `MD5Init' function. */
#define HAVE_MD5INIT 1
/* Define to 1 if you have the <md5.h> header file. */
#define HAVE_MD5_H 1
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
@ -434,7 +453,7 @@
#define HAVE_MKTIME 1
/* Define to 1 if you have the `mlockall' function. */
/* #undef HAVE_MLOCKALL */
#define HAVE_MLOCKALL 1
/* Define to 1 if you have the `mrand48' function. */
#define HAVE_MRAND48 1
@ -460,8 +479,11 @@
/* Define to 1 if you have the <netinfo/ni.h> header file. */
/* #undef HAVE_NETINFO_NI_H */
/* Define to 1 if you have the <net/if6.h> header file. */
/* #undef HAVE_NET_IF6_H */
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* #undef HAVE_NET_IF_H */
/* Define to 1 if you have the `nice' function. */
#define HAVE_NICE 1
@ -535,6 +557,9 @@
/* Define to 1 if you have the `setpriority' function. */
#define HAVE_SETPRIORITY 1
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
@ -568,6 +593,9 @@
/* Define to 1 if you have the `srand48' function. */
#define HAVE_SRAND48 1
/* Does struct sockaddr_storage have ss_family? */
#define HAVE_SS_FAMILY_IN_SS 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
@ -625,6 +653,9 @@
/* Define to 1 if you have the <sys/clkdefs.h> header file. */
/* #undef HAVE_SYS_CLKDEFS_H */
/* Define to 1 if you have the <sys/clockctl.h> header file. */
/* #undef HAVE_SYS_CLOCKCTL_H */
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
@ -634,6 +665,9 @@
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/lock.h> header file. */
/* #undef HAVE_SYS_LOCK_H */
@ -667,6 +701,9 @@
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/shm.h> header file. */
#define HAVE_SYS_SHM_H 1
/* Define to 1 if you have the <sys/signal.h> header file. */
#define HAVE_SYS_SIGNAL_H 1
@ -694,6 +731,9 @@
/* Define to 1 if you have the <sys/syssgi.h> header file. */
/* #undef HAVE_SYS_SYSSGI_H */
/* Define to 1 if you have the <sys/systune.h> header file. */
/* #undef HAVE_SYS_SYSTUNE_H */
/* Define to 1 if you have the <sys/termios.h> header file. */
#define HAVE_SYS_TERMIOS_H 1
@ -754,6 +794,12 @@
/* Do we have the TIO serial stuff? */
/* #undef HAVE_TIO_SERIAL_STUFF */
/* Does u_int64_t exist */
#define HAVE_TYPE_U_INT64_T 1
/* Does u_int8_t exist */
#define HAVE_TYPE_U_INT8_T 1
/* Define to 1 if you have the `umask' function. */
#define HAVE_UMASK 1
@ -790,6 +836,33 @@
/* Define to 1 if you have the `__ntp_gettime' function. */
/* #undef HAVE___NTP_GETTIME */
/* Does struct sockaddr_storage have __ss_family? */
/* #undef HAVE___SS_FAMILY_IN_SS */
/* Should we use the IRIG sawtooth filter? */
/* #undef IRIG_SUCKS */
/* ISC: have struct if_laddrconf? */
/* #undef ISC_PLATFORM_HAVEIF_LADDRCONF */
/* ISC: have struct if_laddrreq? */
/* #undef ISC_PLATFORM_HAVEIF_LADDRREQ */
/* ISC: Have struct in6_pktinfo? */
#define ISC_PLATFORM_HAVEIN6PKTINFO
/* ISC: Have IPv6? */
#define ISC_PLATFORM_HAVEIPV6
/* ISC: struct sockaddr as sa_len? */
#define ISC_PLATFORM_HAVESALEN
/* ISC: Need in6addr_any? */
/* #undef ISC_PLATFORM_NEEDIN6ADDRANY */
/* ISC: provide inet_ntop() */
/* #undef ISC_PLATFORM_NEEDNTOP */
/* Does the kernel have an FLL bug? */
/* #undef KERNEL_FLL_BUG */
@ -808,6 +881,9 @@
/* What is the name of TICK in the kernel? */
#define K_TICK_NAME "_tick"
/* Should we align with the NIST lockclock scheme? */
/* #undef LOCKCLOCK */
/* Does the kernel support multicasting IP? */
#define MCAST 1
@ -845,7 +921,7 @@
#define NO_PARENB_IGNPAR 1
/* Default location of crypto key info */
#define NTP_KEYSDIR "/usr/local/etc"
#define NTP_KEYSDIR "/etc/ntp"
/* Do we have ntp_{adj,get}time in libc? */
#define NTP_SYSCALLS_LIBC 1
@ -857,7 +933,7 @@
#define ONCORE_SHMEM_STATUS 1
/* Use OpenSSL? */
/* #undef OPENSSL */
#define OPENSSL
/* Should we open the broadcast socket? */
#define OPEN_BCAST_SOCKET 1
@ -901,9 +977,6 @@
/* Define if compiler has function prototypes */
#define PROTOTYPES 1
/* Public key? */
/* #undef PUBKEY */
/* Does qsort expect to work on "void *" stuff? */
#define QSORT_USES_VOID_P 1
@ -919,17 +992,14 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Use RSAREF? */
/* #undef RSAREF */
/* Do we want the SCO clock hacks? */
/* #undef SCO5_CLOCK */
/* The size of an `int', as computed by sizeof. */
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__)
#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__)
#define SIZEOF_LONG 8
#else
#define SIZEOF_LONG 4
@ -944,6 +1014,9 @@
/* Slew always? */
/* #undef SLEWALWAYS */
/* *s*printf() functions are char* */
/* #undef SPRINTF_CHAR */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
@ -958,12 +1031,15 @@
#define STR_SYSTEM "alpha-undermydesk-freebsd"
#elif defined(__sparc64__)
#define STR_SYSTEM "sparc64-undermydesk-freebsd"
#elif defined(__amd64__)
#define STR_SYSTEM "amd64-undermydesk-freebsd"
#elif defined(__ia64__)
#define STR_SYSTEM "ia64-undermydesk-freebsd"
#else
#define STR_SYSTEM "i386-undermydesk-freebsd"
#endif
/* Buggy syscall() (Solaris2.4)? */
/* #undef SYSCALL_BUG */
@ -994,6 +1070,9 @@
/* use UDP Wildcard Delivery? */
#define UDP_WILDCARD_DELIVERY 1
/* How do we create unsigned long constants? */
#define ULONG_CONST(a) a ## UL
/* Must we have a CTTY for fsetown? */
#define USE_FSETOWNCTTY 1
@ -1004,11 +1083,22 @@
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
#define VERSION "4.1.1b"
#define VERSION "4.2.0"
/* ISC: Want IPv6? */
#define WANT_IPV6
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
#if defined(__sparc64__)
#define WORDS_BIGENDIAN 1
#endif
/* Handle ss_family */
#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
# define ss_family __ss_family
# define ss_len __ss_len
#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
/* Define to 1 if on AIX 3.
System headers sometimes define this.
@ -1056,3 +1146,6 @@
/* Does the compiler like "volatile"? */
/* #undef volatile */
/* XXX EAI_NODATA is deprecated but still used in 4.2.0, work around that */
#define EAI_NODATA EAI_NONAME

View file

@ -4,26 +4,27 @@ MAINTAINER= sheldonh
FILESDIR= ${SHAREDIR}/doc/ntp
FILES= accopt.htm assoc.htm audio.htm authopt.htm biblio.htm build.htm \
clockopt.htm \
config.htm confopt.htm copyright.htm debug.htm driver1.htm \
driver10.htm driver11.htm driver12.htm driver16.htm driver18.htm \
driver19.htm driver2.htm driver20.htm driver22.htm driver23.htm \
driver24.htm driver26.htm driver27.htm driver28.htm driver29.htm \
driver3.htm driver30.htm driver32.htm driver33.htm driver34.htm \
driver35.htm driver36.htm driver37.htm \
driver4.htm driver5.htm driver6.htm driver7.htm driver8.htm \
driver9.htm exec.htm extern.htm gadget.htm hints.htm \
howto.htm htmlprimer.htm index.htm kern.htm kernpps.htm \
ldisc.htm measure.htm miscopt.htm monopt.htm mx4200data.htm \
notes.htm ntpd.htm ntpdate.htm ntpdc.htm ntpq.htm ntptime.htm \
ntptrace.htm parsedata.htm parsenew.htm patches.htm porting.htm \
pps.htm prefer.htm qth.htm quick.htm rdebug.htm refclock.htm \
release.htm tickadj.htm
FILES= accopt.html assoc.html audio.html authopt.html build.html \
clockopt.html \
config.html confopt.html copyright.html debug.html driver1.html \
driver10.html driver11.html driver12.html driver16.html driver18.html \
driver19.html driver2.html driver20.html driver22.html driver23.html \
driver24.html driver26.html driver27.html driver28.html driver29.html \
driver3.html driver30.html driver32.html driver33.html driver34.html \
driver35.html driver36.html driver37.html \
driver4.html driver5.html driver6.html driver7.html driver8.html \
driver9.html extern.html hints.html \
howto.html index.html kern.html \
ldisc.html measure.html miscopt.html monopt.html mx4200data.html \
notes.html ntpd.html ntpdate.html ntpdc.html ntpq.html ntptime.html \
ntptrace.html parsedata.html parsenew.html patches.html porting.html \
pps.html prefer.html quick.html rdebug.html refclock.html \
release.html tickadj.html
MAN= ntp.conf.5 ntp.keys.5
MAN+= ntp-genkeys.8 ntpd.8 ntpdate.8 ntpdc.8 ntpq.8 ntptime.8 ntptrace.8
MAN+= ntpd.8 ntpdate.8 ntpdc.8 ntpq.8 ntptime.8 ntptrace.8
.PATH: ${.CURDIR}/../../../contrib/ntp/html
.PATH: ${.CURDIR}/../../../contrib/ntp/html \
${.CURDIR}/../../../contrib/ntp/html/drivers
.include <bsd.prog.mk>

View file

@ -1,208 +0,0 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 2, 2001
.Dt NTP_GENKEYS 8
.Os
.Sh NAME
.Nm ntp-genkeys
.Nd generate public and private keys
.Sh SYNOPSIS
.Nm
.Op Fl dfhlnt
.Op Fl c Ar conffile
.Op Fl g Ar target
.Op Fl k Ar keyfile
.Sh DESCRIPTION
The
.Nm
utility generates random keys used by either or both the
NTPv3/NTPv4 symmetric key or the NTPv4 public key (Autokey)
cryptographic authentication schemes.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl c Ar conffile
Location of
.Xr ntp.conf 5
file.
.It Fl d
enable debug messages (can be used multiple times)
.It Fl f
force installation of generated keys.
.It Fl g target
Generate file or files indicated by the characters in the
.Ar target
string:
.Bl -tag -width X
.It Li d
Generate D-H parameter file.
.It Li m
Generate MD5 key file.
.It Li r
Generate RSA keys.
.El
.It Fl h
Build keys here (current directory).
Implies
.Fl l .
.It Fl k Ar keyfile
Location of key file.
.It Fl l
Do not make the symlinks.
.It Fl n
Do not actually do anything, just say what would be done.
.It Fl t
Trash the (old) files at the end of symlink.
.El
.Pp
By default the program
generates the
.Xr ntp.keys 5
file containing 16 random symmetric
keys.
In addition, if the
rsaref20
package is configured
for the software build, the program generates cryptographic values
used by the Autokey scheme.
These values are incorporated as a set
of three files,
.Pa ntpkey
containing the RSA private key,
.Pa ntpkey_ Ns Ar host
containing the RSA public key, where
.Ar host
is the DNS name of the generating machine, and
.Pa ntpkey_dh
containing the parameters for the Diffie-Hellman
key-agreement algorithm.
All files and are in printable ASCII
format.
A timestamp in NTP seconds is appended to each.
Since the
algorithms are seeded by the system clock, each run of this program
produces a different file and file name.
.Pp
The
.Xr ntp.keys 5
file contains 16 MD5 keys.
Each key
consists of 16 characters randomized over the ASCII 95-character
printing subset.
The file is read by the daemon at the location
specified by the
.Ic keys
configuration file command and made
visible only to root.
An additional key consisting of an easily
remembered password should be added by hand for use with the
.Xr ntpq 8
and
.Xr ntpdc 8
programs.
The file must be
distributed by secure means to other servers and clients sharing
the same security compartment.
While the key identifiers for MD5
and DES keys must be in the range 1-65534, inclusive, the
.Nm
utility uses only the identifiers from 1 to
16.
The key identifier for each association is specified as the key
argument in the
.Ic server
or
.Ic peer
configuration file command.
.Pp
The
.Pa ntpkey
file contains the RSA private key.
It is
read by the daemon at the location specified by the
.Ar privatekey
argument of the
.Ic crypto
configuration
file command and made visible only to root.
This file is useful
only to the machine that generated it and never shared with any
other daemon or application program.
.Pp
The
.Pa ntpkey_ Ns Ar host
file contains the RSA public
key, where
.Ar host
is the DNS name of the host that
generated it.
The file is read by the daemon at the location
specified by the
.Ar publickey
argument to the
.Ic server
or
.Ic peer
configuration file command.
This file can be
widely distributed and stored without using secure means, since the
data are public values.
.Pp
The
.Pa ntp_dh
file contains two Diffie-Hellman parameters:
the prime modulus and the generator.
The file is read by the daemon
at the location specified by the
.Ar dhparams
argument of the
.Ic crypto
configuration file command.
The file can be
distributed by insecure means to other servers and clients sharing
the same key agreement compartment, since the data are public
values.
.Pp
The file formats begin with two lines, the first containing the
generating system DNS name and the second the datestamp.
Lines
beginning with
.Ql #
are considered comments and ignored by
the daemon.
In the
.Xr ntp.keys 5
file, the next 16 lines
contain the MD5 keys in order.
If necessary, this file can be
further customized by an ordinary text editor.
The format is
described in the following section.
In the
.Pa ntpkey
and
.Pa ntpkey_ Ns Ar host
files, the next line contains the
modulus length in bits followed by the key as a PEM encoded string.
In the
.Pa ntpkey_dh
file, the next line contains the prime
length in bytes followed by the prime as a PEM encoded string, and
the next and final line contains the generator length in bytes
followed by the generator as a PEM encoded string.
.Pp
Note: See the file
.Pa ./source/rsaref.h
in the
rsaref20
package for explanation of return values, if
necessary.
.Sh SEE ALSO
.Xr ntp.keys 5 ,
.Xr ntpdc 8 ,
.Xr ntpq 8
.Sh BUGS
It can take quite a while to generate the RSA public/private key
pair and Diffie-Hellman parameters, from a few seconds on a modern
workstation to several minutes on older machines.

View file

@ -1,13 +1,14 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../contrib/ntp/libntp
.PATH: ${.CURDIR}/../../../contrib/ntp/libntp \
${.CURDIR}/../../../contrib/ntp/libisc
LIB= ntp
INTERNALLIB= true
SRCS= a_md5encrypt.c adjtime.c atoint.c atolfp.c \
atouint.c audio.c authencrypt.c authkeys.c \
authparity.c authreadkeys.c authusekey.c binio.c \
NTP_SRCS= a_md5encrypt.c adjtime.c atoint.c atolfp.c \
atouint.c audio.c authkeys.c \
authreadkeys.c authusekey.c binio.c \
buftvtots.c caljulian.c calleapwhen.c caltontp.c \
calyearstart.c clocktime.c clocktypes.c decodenetnum.c \
dofptoa.c dolfptoa.c emalloc.c findconfig.c \
@ -16,12 +17,18 @@ SRCS= a_md5encrypt.c adjtime.c atoint.c atolfp.c \
ieee754io.c inttoa.c iosignal.c lib_strbuf.c \
machines.c md5c.c memmove.c mfp_mul.c \
mfptoa.c mfptoms.c modetoa.c mstolfp.c \
msutotsf.c msyslog.c netof.c numtoa.c \
numtohost.c octtoint.c prettydate.c ranny.c \
recvbuff.c refnumtoa.c statestr.c syssignal.c \
systime.c tsftomsu.c tstotv.c tvtoa.c \
tvtots.c uglydate.c uinttoa.c utvtoa.c \
ymd2yd.c
msutotsf.c msyslog.c netof.c ntp_rfc2553.c \
numtoa.c numtohost.c octtoint.c prettydate.c \
ranny.c recvbuff.c refnumtoa.c socktoa.c \
socktohost.c strstr.c systime_s.c statestr.c \
syssignal.c systime.c tsftomsu.c tstotv.c \
tvtoa.c tvtots.c uglydate.c uinttoa.c \
utvtoa.c ymd2yd.c
ISC_SRCS= assertions.c error.c inet_ntop.c interfaceiter.c \
isc_strerror.c lib.c mem.c msgcat.c net.c
SRCS= ${NTP_SRCS} ${ISC_SRCS}
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../

View file

@ -3,13 +3,13 @@
.PATH: ${.CURDIR}/../../../contrib/ntp/util \
${.CURDIR}/../../../contrib/ntp/ntpd
PROG= ntp-genkeys
PROG= ntp-keygen
NOMAN= yes
SRCS= ntp-genkeys.c ntp_config.c
SRCS= ntp-keygen.c
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP}
LDADD= ${LIBNTP}
DPADD= ${LIBNTP} ${LIBMD} ${LIBCRYPTO}
LDADD= ${LIBNTP} -lmd -lcrypto
.include <bsd.prog.mk>

View file

@ -28,8 +28,8 @@ SRCS= cmd_args.c map_vme.c ntp_config.c \
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBPARSE} ${LIBNTP} ${LIBM}
LDADD= ${LIBPARSE} ${LIBNTP} -lm
DPADD= ${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBCRYPTO} ${LIBMD}
LDADD= ${LIBPARSE} ${LIBNTP} -lm -lcrypto -lmd
CLEANFILES+= .version version.c

View file

@ -8,8 +8,8 @@ SRCS= ntpdate.c version.c
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP}
LDADD= ${LIBNTP}
DPADD= ${LIBNTP} ${LIBMD}
LDADD= ${LIBNTP} -lmd
CLEANFILES+= .version version.c

View file

@ -8,8 +8,8 @@ SRCS= ntpdc.c ntpdc_ops.c version.c
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP} ${LIBREADLINE} ${LIBTERMCAP}
LDADD= ${LIBNTP} -lreadline -ltermcap
DPADD= ${LIBNTP} ${LIBREADLINE} ${LIBTERMCAP} ${LIBMD}
LDADD= ${LIBNTP} -lreadline -ltermcap -lmd
CLEANFILES+= .version version.c

View file

@ -10,8 +10,8 @@ SRCS= ntpq.c ntpq_ops.c version.c
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP} ${LIBREADLINE} ${LIBTERMCAP}
LDADD= ${LIBNTP} -lreadline -ltermcap
DPADD= ${LIBNTP} ${LIBREADLINE} ${LIBTERMCAP} ${LIBMD}
LDADD= ${LIBNTP} -lreadline -ltermcap -lmd
CLEANFILES+= .version version.c

View file

@ -1,19 +1,10 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../../contrib/ntp/ntptrace
.PATH: ${.CURDIR}/../scripts
PROG= ntptrace
SCRIPTS= ntptrace
SCRIPTSNAME= ntptrace
NOMAN= yes
SRCS= ntptrace.c version.c
CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
DPADD= ${LIBNTP}
LDADD= ${LIBNTP}
CLEANFILES+= .version version.c
version.c:
sh -e ${.CURDIR}/../scripts/mkver ntptrace
.include <bsd.prog.mk>

View file

@ -6,7 +6,7 @@ PROG=${1-UNKNOWN}
ConfStr="$PROG"
ConfStr="$ConfStr 4.1.1b"
ConfStr="$ConfStr 4.2.0"
case "$CSET" in
'') ;;

View file

@ -0,0 +1,62 @@
#! /usr/local/bin/perl -w
#
# $FreeBSD$
# John Hay -- John.Hay@icomtek.csir.co.za / jhay@FreeBSD.org
use Socket;
use Getopt::Std;
use vars qw($opt_n);
$ntpq = "ntpq";
getopts('n');
$dodns = 1;
$dodns = 0 if (defined($opt_n));
$host = shift;
$host ||= "127.0.0.1";
for (;;) {
$stratum = 255;
$cmd = "$ntpq -n -c rv $host";
open(PH, $cmd . "|") || die "failed to start command $cmd: $!";
while (<PH>) {
$stratum = $1 if (/stratum=(\d+)/);
$peer = $1 if (/peer=(\d+)/);
# Very old servers report phase and not offset.
$offset = $1 if (/(?:offset|phase)=([^\s,]+)/);
$rootdelay = $1 if (/rootdelay=([^\s,]+)/);
$refid = $1 if (/refid=([^\s,]+)/);
}
close(PH) || die "$cmd failed";
last if ($stratum == 255);
$offset /= 1000;
$rootdelay /= 1000;
$dhost = $host;
# Only do lookups of IPv4 addresses. The standard lookup functions
# of perl only do IPv4 and I don't know if we should require extras.
if ($dodns && $host =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) {
$iaddr = inet_aton($host);
$name = (gethostbyaddr($iaddr, AF_INET))[0];
$dhost = $name if (defined($name));
}
printf("%s: stratum %d, offset %f, root distance %f",
$dhost, $stratum, $offset, $rootdelay);
printf(", refid '%s'", $refid) if ($stratum == 1);
printf("\n");
last if ($stratum == 0 || $stratum == 1 || $stratum == 16);
last if ($refid =~ /^127\.127\.\d{1,3}\.\d{1,3}$/);
$cmd = "$ntpq -n -c \"pstat $peer\" $host";
open(PH, $cmd . "|") || die "failed to start command $cmd: $!";
$thost = "";
while (<PH>) {
$thost = $1, last if (/srcadr=(\S+),/);
}
close(PH) || die "$cmd failed";
last if ($thost eq "");
$host = $thost;
}