Newsgroups: comp.protocols.time.ntp
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!dg-rtp!bigben!bigben!philip
From: philip@beeblebrox.dle.dg.com (Philip Gladstone)
Subject: Bug in xntp version 1.3 in clock selection
X-Md4-Signature: b5f539e948a10cf2b83725a6c2fab488
Organization: Data General, Development Lab Europe
Distribution: comp
Date: 6 Jun 91 14:01:25
Message-ID: <PHILIP.91Jun6140125@beeblebrox.dle.dg.com>
Sender: usenet@dle.dg.com (Net News)
Lines: 85

I found a nasty bug this morning in the clock selection code in xntp
1.3. It turns out that the casting out of outlying clocks is just done
wrong. This results in incorrect clock selections. I enclose the
(trivial) patch.

Apply in the xntpd directory with 'patch < filename'

Good luck.

        Philip

---cut here
*** orig_ntp_proto.c	Thu Jun  6 12:14:15 1991
--- ntp_proto.c	Thu Jun  6 12:49:06 1991
***************
*** 1561,1566 ****
--- 1561,1568 ----
  					 */
  					for (i = 0; i < j; i++)
  					    d = (d>>1) + (d>>2);
+                                         
+                                         peer_badness[n] += d;
  				    }
  				    break;
  
***************
*** 1600,1605 ****
--- 1602,1609 ----
  					    else
  						d = (d>>1) + (d>>2);
  					}
+ 				
+                                         peer_badness[n] += d;
  				    }
  				    break;
  
***************
*** 1638,1643 ****
--- 1642,1649 ----
  					    else
  						d = (d>>1) + (d>>2);
  					}
+ 				
+                                         peer_badness[n] += d;
  				    }
  				    break;
  
***************
*** 1659,1664 ****
--- 1665,1672 ----
  					 */
  					for (i = 0; i < j; i++)
  					    d = (d>>1) + (d>>3) + (d>>4);
+ 				
+                                         peer_badness[n] += d;
  				    }
  				    break;
  
***************
*** 1680,1685 ****
--- 1688,1695 ----
  					 */
  					for (i = 0; i < j; i++)
  					    d = (d>>1) + (d>>3);
+ 				
+                                         peer_badness[n] += d;
  				    }
  				    break;
  
***************
*** 1692,1698 ****
  					sys_select_algorithm);
  				    exit(1);
  				}
- 				peer_badness[n] += d;
  			}
  
  			/*
--- 1702,1707 ----

--- end of patch
--
Philip Gladstone         Dev Lab Europe, Data General, Cambridge, UK

    I seem to be having this tremendous difficulty with my lifestyle.
