System: ntp version 3.4 Patch #: 1 Priority: Updated distribution directory. Add LIBS macro to Makefile directives which link ntp, ntpdc, ntpd and test programs. Add symbolic version identifier to Makefile install targets for proper directory name. Shorten timeout interval and clean up timeout message. Don't zero the drift compensation or compliance values when a step adjustment of the clock occurs. Use symbolic definition of CLOCK_FACTOR rather than constant. sys.refid could have garbage left if the peer we're synchronized to is lost. Diddle syslog messages a bit. Handle case of udp/ntp not being defined in /etc/services. Compute default value for tickadj if the change-kernel-tickadj flag is set, but no tickadj directive is present in the configuration file. Delete unused variables. Display interface address in numeric form for local address, rather than symbolically. For multiple host queries, the name of the host is emitted prior to the data for that host. Repeat-By: Fix: From rn, say "| patch -p -N -d DIR", where DIR is your ntp source directory. Outside of rn, say "cd DIR; patch -p -N #define PATCHLEVEL 1 Index: Makefile Prereq: 3.4 *** Makefile.old Mon Mar 20 00:15:06 1989 --- Makefile Mon Mar 20 00:15:07 1989 *************** *** 1,6 **** ! # $Header: /usr/users/louie/ntp/RCS/Makefile,v 3.4 89/03/17 18:36:37 louie Exp $ # # $Log: Makefile,v $ # Revision 3.4 89/03/17 18:36:37 louie # Latest test release. # --- 1,13 ---- ! # $Header: /usr/users/louie/ntp/RCS/Makefile,v 3.4.1.1 89/03/20 00:01:24 louie Exp Locker: louie $ # # $Log: Makefile,v $ + # Revision 3.4.1.1 89/03/20 00:01:24 louie + # patch1: Add LIBS macro to Makefile directives which link ntp, ntpdc, ntpd and + # patch1: test programs. + # patch1: + # patch1: Add symbolic version identifier to Makefile install targets for + # patch1: proper directory name. + # # Revision 3.4 89/03/17 18:36:37 louie # Latest test release. # *************** *** 33,38 **** --- 40,48 ---- BINDIR=/usr/local/etc LINKDIR=/etc LIBS= + + VERS=3.4 + #CC=gcc -g -W -Wall CC=gcc -g -W *************** *** 97,116 **** @./ntest ntp: ntp.o ntpsubs.o ! ${CC} ${LDFLAGS} -o ntp ntp.o ntpsubs.o ntpd: ${NTPDOBJ} ${CC} ${LDFLAGS} -o ntpd ntpd.o ntpsubs.o ntp_adjust.o ntp_proto.o \ ! ntp_sock.o ntpdc: ntpdc.o ! ${CC} ${LDFLAGS} -o ntpdc ntpdc.o ntest: test.o ntpsubs.o ! ${CC} ${LDFLAGS} -o ntest test.o ntpsubs.o sock_test: ntp_sock.c ! ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c ${OBJS}: ntp.h Makefile --- 107,126 ---- @./ntest ntp: ntp.o ntpsubs.o ! ${CC} ${LDFLAGS} -o ntp ntp.o ntpsubs.o ${LIBS} ntpd: ${NTPDOBJ} ${CC} ${LDFLAGS} -o ntpd ntpd.o ntpsubs.o ntp_adjust.o ntp_proto.o \ ! ntp_sock.o ${LIBS} ntpdc: ntpdc.o ! ${CC} ${LDFLAGS} -o ntpdc ntpdc.o ${LIBS} ntest: test.o ntpsubs.o ! ${CC} ${LDFLAGS} -o ntest test.o ntpsubs.o ${LIBS} sock_test: ntp_sock.c ! ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c ${LIBS} ${OBJS}: ntp.h Makefile *************** *** 150,159 **** lint -bac ${DEFINES} ${NTPDSRC} dist: ntp.tar.Z ! mv ntp.tar.Z /usr/ftp/pub/ntp.3.2/ntp.tar.Z test-dist: ntp.tar.Z ! mv ntp.tar.Z /usr/ftp/pub/ntp.3.2/ntp-test.tar.Z ntp.tar.Z: ${DIST} ident ${DIST} | grep Header | \ --- 160,169 ---- lint -bac ${DEFINES} ${NTPDSRC} dist: ntp.tar.Z ! mv ntp.tar.Z /usr/ftp/pub/ntp.${VERS}/ntp.tar.Z test-dist: ntp.tar.Z ! mv ntp.tar.Z /usr/ftp/pub/ntp.${VERS}/ntp-test.tar.Z ntp.tar.Z: ${DIST} ident ${DIST} | grep Header | \ Index: ntp.c Prereq: 3.4 *** ntp.c.old Mon Mar 20 00:15:10 1989 --- ntp.c Mon Mar 20 00:15:11 1989 *************** *** 1,9 **** #ifndef lint ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp.c,v 3.4 89/03/17 18:36:54 louie Exp $"; #endif lint /* * $Log: ntp.c,v $ * Revision 3.4 89/03/17 18:36:54 louie * Latest test release. * --- 1,12 ---- #ifndef lint ! static char *rcsid = "$Header: /usr/users/louie/ntp/RCS/ntp.c,v 3.4.1.1 89/03/20 00:02:32 louie Exp Locker: louie $"; #endif lint /* * $Log: ntp.c,v $ + * Revision 3.4.1.1 89/03/20 00:02:32 louie + * patch1: Shorten timeout interval and clean up timeout message. + * * Revision 3.4 89/03/17 18:36:54 louie * Latest test release. * *************** *** 93,99 **** }; #define RETRY_COUNT 2 /* number of times we want to retry */ ! #define TIME_OUT 60 /* time to wait for reply, in secs */ struct sockaddr_in sin = {AF_INET}; --- 96,102 ---- }; #define RETRY_COUNT 2 /* number of times we want to retry */ ! #define TIME_OUT 10 /* time to wait for reply, in secs */ struct sockaddr_in sin = {AF_INET}; *************** *** 202,212 **** exit(1); } if (n == 0) { ! fprintf(stderr,"\n\t* Timeout *\n"); if (--retry) --host; else { ! fprintf(stderr,"\nHost %s is not responding\n", argv[host]); retry = RETRY_COUNT; } --- 205,215 ---- exit(1); } if (n == 0) { ! fprintf(stderr,"*Timeout*\n"); if (--retry) --host; else { ! fprintf(stderr,"Host %s is not responding\n", argv[host]); retry = RETRY_COUNT; } Index: ntp.h Prereq: 3.4 *** ntp.h.old Mon Mar 20 00:15:14 1989 --- ntp.h Mon Mar 20 00:15:15 1989 *************** *** 1,7 **** ! /* $Header: /usr/users/louie/ntp/RCS/ntp.h,v 3.4 89/03/17 18:37:00 louie Exp $ */ /* * $Log: ntp.h,v $ * Revision 3.4 89/03/17 18:37:00 louie * Latest test release. * --- 1,10 ---- ! /* $Header: /usr/users/louie/ntp/RCS/ntp.h,v 3.4.1.1 89/03/20 00:02:53 louie Exp Locker: louie $ */ /* * $Log: ntp.h,v $ + * Revision 3.4.1.1 89/03/20 00:02:53 louie + * 1 + * * Revision 3.4 89/03/17 18:37:00 louie * Latest test release. * *************** *** 150,156 **** #define CLOCK_FREQ 10 /* frequency shift */ #define CLOCK_TRACK 8 #define CLOCK_COMP 4 ! #define CLOCK_FACTOR 18 /* 18?? */ /* * Structure definitions for NTP fixed point values --- 153,159 ---- #define CLOCK_FREQ 10 /* frequency shift */ #define CLOCK_TRACK 8 #define CLOCK_COMP 4 ! #define CLOCK_FACTOR 18 /* * Structure definitions for NTP fixed point values Index: ntp_adjust.c Prereq: 3.4 *** ntp_adjust.c.old Mon Mar 20 00:15:18 1989 --- ntp_adjust.c Mon Mar 20 00:15:19 1989 *************** *** 1,5 **** #ifndef lint ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntp_adjust.c,v 3.4 89/03/17 18:37:03 louie Exp $"; #endif /* --- 1,5 ---- #ifndef lint ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntp_adjust.c,v 3.4.1.1 89/03/20 00:09:06 louie Exp Locker: louie $"; #endif /* *************** *** 7,12 **** --- 7,17 ---- * 5. of the NTP specification. * * $Log: ntp_adjust.c,v $ + * Revision 3.4.1.1 89/03/20 00:09:06 louie + * patch1: Don't zero the drift compensation or compliance values when a step + * patch1: adjustment of the clock occurs. Use symbolic definition of + * patch1: CLOCK_FACTOR rather than constant. + * * Revision 3.4 89/03/17 18:37:03 louie * Latest test release. * *************** *** 147,160 **** return(-1); } clock_adjust = 0.0; - /* - * I reset the drift_comp here since things were screwed - * up very bad if the clock reset and you can't be sure - * if the drift_comp was meaningful. Also mark us restarting - * the recurance and reset the update timer. - */ - drift_comp = 0.0; - compliance = 0.0; firstpass = 1; update_timer = 0; return (1); /* indicate that step adjustment was done */ --- 152,157 ---- *************** *** 172,178 **** firstpass = 0; else if (update_timer > 0) { ai = abs(compliance); ! ai = (double)(1< 0) { ai = abs(compliance); ! ai = (double)(1<s_port); init_ntp(conf); init_kern_vars(); init_logical_clock(); --- 243,258 ---- servp = getservbyname("ntp", "udp"); if (servp == NULL) { ! syslog(LOG_CRIT, "udp/ntp: service unknown, using default %d", ! NTP_PORT); ! (void) create_sockets(htons(NTP_PORT)); ! } else ! (void) create_sockets(servp->s_port); + peer_list.head = peer_list.tail = NULL; peer_list.members = 0; init_ntp(conf); init_kern_vars(); init_logical_clock(); *************** *** 295,302 **** #endif selfds++; - syslog(LOG_INFO, "%d sockets open", nintf); - (void) setitimer(ITIMER_REAL, itp, (struct itimerval *) 0); for (;;) { /* go into a finite but hopefully very long --- 304,309 ---- *************** *** 889,894 **** --- 896,911 ---- dotickadj); } #endif + /* + * If desired value of tickadj is not specified in the configuration + * file, compute a "reasonable" value here, based on the assumption + * that we don't have to slew more than 2ms every 4 seconds. + * + * TODO: the 500 needs to be parameterized. + */ + if (tickadj == 0 && kern_hz) + tickadj = 500/kern_hz; + if (dotickadj && tickadj && (tickadj != kern_tickadj)) { close(kmem); if ((kmem = open(memory, O_RDWR)) >= 0) { Index: ntpdc.c Prereq: 3.4 *** ntpdc.c.old Mon Mar 20 00:15:35 1989 --- ntpdc.c Mon Mar 20 00:15:35 1989 *************** *** 1,9 **** #ifndef lint ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntpdc.c,v 3.4 89/03/17 18:37:16 louie Exp $"; #endif /* * $Log: ntpdc.c,v $ * Revision 3.4 89/03/17 18:37:16 louie * Latest test release. * --- 1,15 ---- #ifndef lint ! static char *RCSid = "$Header: /usr/users/louie/ntp/RCS/ntpdc.c,v 3.4.1.1 89/03/20 00:13:41 louie Exp Locker: louie $"; #endif /* * $Log: ntpdc.c,v $ + * Revision 3.4.1.1 89/03/20 00:13:41 louie + * patch1: Delete unused variables. Display interface address in numeric form + * patch1: for local address, rather than symbolically. For multiple host + * patch1: queries, the name of the host is emitted prior to the data for that + * patch1: host. + * * Revision 3.4 89/03/17 18:37:16 louie * Latest test release. * *************** *** 84,90 **** int argc; char *argv[]; { - int count = 0; char *p; int on = 48*1024; --- 90,95 ---- *************** *** 116,121 **** --- 121,128 ---- } argc--, argv++; } + if (argc > 1) + printf("--- %s ---\n", *argv); while (argc > 0) { /* * Get a new socket each time - this will cause us to ignore *************** *** 134,140 **** query(*argv); answer(); close(s); ! argv++, argc--; } } --- 141,149 ---- query(*argv); answer(); close(s); ! argv++; ! if (argc-- > 1) ! printf("--- %s ---\n", *argv); } } *************** *** 264,270 **** double offset[PEER_SHIFT], delay[PEER_SHIFT], dsp,del,off; char c; char *cvthname(); - static int count = 0; sin.sin_addr.s_addr = n->net_address; for (i = 0; i < PEER_SHIFT; i++) { --- 273,278 ---- *************** *** 283,289 **** printf("%c%-15.15s ", c, cvthname(&sin)); sin.sin_addr.s_addr = n->my_address; printf("%-16.16s %2d %4d %03o %8.1f %8.1f %8.1f\n", ! sin.sin_addr.s_addr ? cvthname(&sin) : "wildcard", n->stratum, (int)ntohl((u_long)n->timer), ntohs(n->reach) & SHIFT_MASK, del, off, dsp); } --- 291,297 ---- printf("%c%-15.15s ", c, cvthname(&sin)); sin.sin_addr.s_addr = n->my_address; printf("%-16.16s %2d %4d %03o %8.1f %8.1f %8.1f\n", ! sin.sin_addr.s_addr ? inet_ntoa(sin.sin_addr) : "wildcard", n->stratum, (int)ntohl((u_long)n->timer), ntohs(n->reach) & SHIFT_MASK, del, off, dsp); } Index: stat.pl Prereq: 3.4 *** stat.pl.old Mon Mar 20 00:15:39 1989 --- stat.pl Mon Mar 20 00:15:40 1989 *************** *** 15,23 **** # # The -S option will "save" the intermedite data files, which are normally # deleted. - - # Extract drift value from the hourly stat: syslog message. # # Mar 7 18:46:58 trantor ntpd[20838]: adjust: SLEW 192.41.177.92 st 2 # off -0.015756 drft 0.000000 cmpl 0.000000 --- 15,26 ---- # # The -S option will "save" the intermedite data files, which are normally # deleted. + # + # Louis A. Mamakos + # with many thanks to Larry Wall for `perl', a wonderful tool for hacking + # up things like this so easily. + # # # Mar 7 18:46:58 trantor ntpd[20838]: adjust: SLEW 192.41.177.92 st 2 # off -0.015756 drft 0.000000 cmpl 0.000000 *************** *** 25,30 **** --- 28,35 ---- # was 130.126.174.40 stratum 1 # # + $scriptfile = $0; + $month{'Jan'} = 0; $month{'Feb'} = 1; $month{'Mar'} = 2; $month{'Apr'} = 3; $month{'May'} = 4; $month{'Jun'} = 5; $month{'Jul'} = 6; $month{'Aug'} = 7; $month{'Sep'} = 8; $month{'Oct'} = 9; $month{'Nov'} = 10; $month{'Dec'} = 11; *************** *** 34,39 **** --- 39,45 ---- die "Can't open compliance file\n" unless open(COMP, ">stats.comp"); die "Can't open clock file\n" unless open(CLK, ">stats.clk"); + $# = '%.6g'; $plottype = "postscript"; $recs = 0; $start = 0; *************** *** 40,47 **** $clocks = 1; $clk{'UNSYNCED'} = 0; ! do Getopt('ti'); if ($opt_t) { $plottype = $opt_t; } --- 46,57 ---- $clocks = 1; $clk{'UNSYNCED'} = 0; ! do Getopt('tiSo'); + if ($opt_h) { + die "Usage: $scriptfile [-o outputfile] [-i interval] [-t termtype] [-S] < logmessages\n"; + } + if ($opt_t) { $plottype = $opt_t; } *************** *** 107,113 **** } } ! $last = int($t + 0.99999); printf "%d records spanning %4.2f hours.\n", $recs, $t; close OFF; --- 117,127 ---- } } ! if ($t = int($t)) { ! $last = int($t) + 1; ! } else { ! $last = int($t); ! } printf "%d records spanning %4.2f hours.\n", $recs, $t; close OFF; *************** *** 131,143 **** # print TMP "set samples ",$recs,"\n"; print TMP "set term $plottype\n"; - print TMP 'set output "stats.plot"'; print TMP "\n"; if ($interval > $last) { ! print "Interval truncated to available data ($last)\n"; $interval = $last; } ! $start = 0; $end = $interval; while (($start < $last)) { --- 145,167 ---- # print TMP "set samples ",$recs,"\n"; print TMP "set term $plottype\n"; + if ($opt_o) { + printf TMP 'set output "%s"', $opt_o; print TMP "\n"; + } else { + print TMP 'set output "stats.plot"'; print TMP "\n"; + } + if ($interval > $last) { ! if ($interval != 99999999) { ! print "Interval truncated to available data ($last)\n"; ! } $interval = $last; } ! # ! # Plot multiple sets of plots, each set of which covers the specified number ! # of hours. ! # $start = 0; $end = $interval; while (($start < $last)) { *************** *** 167,173 **** unlink "stats.clk"; } ! ;# $Header: /usr/users/louie/ntp/RCS/stat.pl,v 3.4 89/03/17 18:37:30 louie Exp $ ;# Process single-character switches with switch clustering. Pass one argument ;# which is a string containing all switches that take an argument. For each --- 191,197 ---- unlink "stats.clk"; } ! ;# $Header: /usr/users/louie/ntp/RCS/stat.pl,v 3.4.1.1 89/03/20 00:14:56 louie Exp Locker: louie $ ;# Process single-character switches with switch clustering. Pass one argument ;# which is a string containing all switches that take an argument. For each .