System: ntp version 3.4
Patch #: 8
Priority: 

From:

Description:
Update suggested tickadj values in the README file.

The syslog message for peer selection had to be moved to account for the

anti-peer flapping code just installed.

Minor cosmetic changes and removed dead debug code from ntpd.c


Repeat-By:

Fix:	Either ftp the new /pub/ntp.3.4/ntp-test.tar.Z file, or apply
	this patch.

	From rn, say "| patch -p -N -d DIR", where DIR is your ntp source
	directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		make depend
		make
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	If you are missing previous patches they can be obtained from me:

	Louis A. Mamakos
	louie@trantor.umd.edu


	You can also get the patches via anonymous FTP from
	trantor.umd.edu.  

Index: patchlevel.h
Prereq: 7
1c1
< #define PATCHLEVEL 7
---
> #define PATCHLEVEL 8

Index: README
*** README.old	Sat Apr  8 10:38:13 1989
--- README	Sat Apr  8 10:38:14 1989
***************
*** 1,4 ****
! README for UNIX NTP release $Date: 89/03/29 13:04:47 $ $Revision: 3.4.1.3 $
  
  
  
--- 1,4 ----
! README for UNIX NTP release $Date: 89/04/08 10:35:44 $ $Revision: 3.4.1.4 $
  
  
  
***************
*** 30,41 ****
  	3) Change the Makefile definitions to suit your environment.
  	4) make
  	5) make install
! 	6) adb or remake kernel and change "tickadj" from 40 to 5
  		Recommended values for tickadj on various machines:
  
  		VAX:	5
! 		Sun3:	??
! 		Sun4:	10
  
  		This step is optional; new algorithms will allow you to
  		get by (with reduced accuracy) with the system supplied
--- 30,41 ----
  	3) Change the Makefile definitions to suit your environment.
  	4) make
  	5) make install
! 	6) adb or remake kernel and change "tickadj"
  		Recommended values for tickadj on various machines:
  
  		VAX:	5
! 		Sun3:	10
! 		Sun4:	5
  
  		This step is optional; new algorithms will allow you to
  		get by (with reduced accuracy) with the system supplied
***************
*** 48,53 ****
--- 48,63 ----
  	7) Fire up ntpd in /etc/rc.local
  
  History:
+ 4/8/89
+ 	Changes to the ntp_proto.c module to supress peer switching when the
+ 	dispersion between the newly selected peer and the currently selected
+ 	peer is "small."  A new configuration option, NOSWAP, has been added
+ 	for use on Ultrix systems which can lock the ntpd process in memory;
+ 	very desirable for diskless workstations.  peer.reach is now not
+ 	cleared in the clear() procedure.  The stat.pl perl script can now
+ 	handle syslog records which span a month boundary correctly.  We're
+ 	getting real close to a "blessed" version now.
+ 
  3/29/89
  	A few fixes, clean up of unused #defines in ntp.h.  The receive()
  	procedure is now table driven per the 26 March 1989 draft of the

Index: ntp_proto.c
*** ntp_proto.c.old	Sat Apr  8 10:38:22 1989
--- ntp_proto.c	Sat Apr  8 10:38:25 1989
***************
*** 1,5 ****
  #ifndef	lint
! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntp_proto.c,v $ $Revision: 3.4.1.6 $ $Date: 89/04/07 19:07:10 $";
  #endif
  
  /*
--- 1,5 ----
  #ifndef	lint
! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntp_proto.c,v $ $Revision: 3.4.1.7 $ $Date: 89/04/08 10:36:53 $";
  #endif
  
  /*
***************
*** 11,16 ****
--- 11,20 ----
  
  /*
   * $Log:	ntp_proto.c,v $
+  * Revision 3.4.1.7  89/04/08  10:36:53  louie
+  * The syslog message for peer selection had to be moved to account for the
+  * anti-peer flapping code just installed.
+  * 
   * Revision 3.4.1.6  89/04/07  19:07:10  louie
   * Don't clear peer.reach register in the clear() procedure.  Code to prevent
   * flapping between two peers with very similar dispersions.
***************
*** 985,1005 ****
  	if (debug > 3)
  		printf("select_clock: step6 %d candidates\n", candidates);
  #endif
- 	/* 
- 	 * ok.  We've finally select our best bet for a clock to synchronize to.
- 	 */
- 	if (sys.peer != sel_lst[0].peer) {
- 		if (sys.peer != NULL)
- 			syslog(LOG_INFO, "clock: select peer %s stratum %d was %s stratum %d",
- 			       ntoa(sel_lst[0].peer->src.sin_addr),
- 			       sel_lst[0].peer->stratum,
- 			       ntoa(sys.peer->src.sin_addr), sys.peer->stratum);
- 		else
- 			syslog(LOG_INFO, "clock: select peer %s stratum %d was UNSYNCED",
- 			       ntoa(sel_lst[0].peer->src.sin_addr),
- 			       sel_lst[0].peer->stratum);
- 	}
- 
  	if (sys.peer != NULL && sys.peer != sel_lst[0].peer) {
  		/* 
  		 * Potential peer is different that current one; don't switch
--- 989,994 ----
***************
*** 1032,1037 ****
--- 1021,1042 ----
  		       ntoa(sel_lst[0].peer->src.sin_addr),
  		       sel_lst[0].peer->stratum);
  #endif
+ 
+ 	/* 
+ 	 *  We've finally selected our best bet for a clock to synchronize to.
+ 	 */
+ 	if (sys.peer != sel_lst[0].peer) {
+ 		if (sys.peer != NULL)
+ 			syslog(LOG_INFO, "clock: select peer %s stratum %d was %s stratum %d",
+ 			       ntoa(sel_lst[0].peer->src.sin_addr),
+ 			       sel_lst[0].peer->stratum,
+ 			       ntoa(sys.peer->src.sin_addr), sys.peer->stratum);
+ 		else
+ 			syslog(LOG_INFO, "clock: select peer %s stratum %d was UNSYNCED",
+ 			       ntoa(sel_lst[0].peer->src.sin_addr),
+ 			       sel_lst[0].peer->stratum);
+ 	}
+ 
  
  	/* finally, set new peer */
  	sys.peer = sel_lst[0].peer;

Index: ntpdc.c
*** ntpdc.c.old	Sat Apr  8 10:38:32 1989
--- ntpdc.c	Sat Apr  8 10:38:33 1989
***************
*** 1,9 ****
  #ifndef	lint
! static char *RCSid = "$Source: /usr/users/louie/ntp/RCS/ntpdc.c,v $ $Revision: 3.4.1.4 $ $Date: 89/03/29 12:41:56 $";
  #endif
  
  /*
   * $Log:	ntpdc.c,v $
   * Revision 3.4.1.4  89/03/29  12:41:56  louie
   * Check for success sending query before trying to listen for answers.  Will 
   * catch case of no server running and an ICMP port unreachable being returned.
--- 1,12 ----
  #ifndef	lint
! static char *RCSid = "$Source: /usr/users/louie/ntp/RCS/ntpdc.c,v $ $Revision: 3.4.1.5 $ $Date: 89/04/08 10:38:06 $";
  #endif
  
  /*
   * $Log:	ntpdc.c,v $
+  * Revision 3.4.1.5  89/04/08  10:38:06  louie
+  * Minor cosmetic changes and removed dead debug code from ntpd.c
+  * 
   * Revision 3.4.1.4  89/03/29  12:41:56  louie
   * Check for success sending query before trying to listen for answers.  Will 
   * catch case of no server running and an ICMP port unreachable being returned.
***************
*** 210,216 ****
  
  		if (first) {
  			first = 0;
! 			replies = (1L <<msg->npkts) - 1;
  			if (!vflag) {
  				printf("   (rem)  Address   (lcl)      Strat Poll Reach    Delay   Offset    Disp\n");
  				printf("==========================================================================\n");
--- 213,219 ----
  
  		if (first) {
  			first = 0;
! 			replies = (1L << msg->npkts) - 1;
  			if (!vflag) {
  				printf("   (rem)  Address   (lcl)      Strat Poll Reach    Delay   Offset    Disp\n");
  				printf("==========================================================================\n");
***************
*** 217,227 ****
  			}
  		}
  		replies &= ~(1L << msg->seq);
- #if	0
- 		printf("Got response: ver %d, %d entries of %d (%d of %d responses) %lx\n",
- 		       msg->version, msg->count, msg->peers,
- 		       msg->seq+1, msg->npkts, replies);
- #endif
  		n = (struct clockinfo *)&msg[1];
  		for (count = msg->count; count > 0; count--) {
  			if(vflag)
--- 220,225 ----
***************
*** 295,301 ****
  		delay[i] = (double) ((long) (ntohl(n->info_filter.delay[i])/1000.0));
  		offset[i] = (double) ((long) (ntohl(n->info_filter.offset[i])/1000.0));
  	}
! 	dsp = ((long) ntohl(n->estdisp));	/* leave in milliseconds */
  	del = (long) ntohl(n->estdelay);	/* leave in milliseconds */
  	off = (long) ntohl(n->estoffset);	/* leave in milliseconds */
  	c = ' ';
--- 293,299 ----
  		delay[i] = (double) ((long) (ntohl(n->info_filter.delay[i])/1000.0));
  		offset[i] = (double) ((long) (ntohl(n->info_filter.offset[i])/1000.0));
  	}
! 	dsp = (long) ntohl(n->estdisp);		/* leave in milliseconds */
  	del = (long) ntohl(n->estdelay);	/* leave in milliseconds */
  	off = (long) ntohl(n->estoffset);	/* leave in milliseconds */
  	c = ' ';
***************
*** 377,385 ****
  	register char *p;
  	extern char *inet_ntoa();
  
- #ifdef	debug
- 	printf("cvthname(%s)\n", inet_ntoa(f->sin_addr));
- #endif
  	if (f->sin_family != AF_INET) {
  		printf("Malformed from address\n");
  		return ("???");
--- 375,380 ----
***************
*** 390,402 ****
  	else
  		return (inet_ntoa(f->sin_addr));
  
! 	if (hp == 0) {
! #ifdef	debug
! 		printf("Host name for your address (%s) unknown\n",
! 			inet_ntoa(f->sin_addr));
! #endif
  		return (inet_ntoa(f->sin_addr));
! 	}
  	if ((p = index(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0)
  		*p = '\0';
  	return (hp->h_name);
--- 385,393 ----
  	else
  		return (inet_ntoa(f->sin_addr));
  
! 	if (hp == 0)
  		return (inet_ntoa(f->sin_addr));
! 
  	if ((p = index(hp->h_name, '.')) && strcmp(p + 1, LocalDomain) == 0)
  		*p = '\0';
  	return (hp->h_name);
