From: Dennis Ferguson To: ntp@TRANTOR.UMD.EDU Subject: Bug fix for ntpd's clock selection code Date: Sat, 25 Feb 89 00:19:36 EST There is a misplaced initialization in ntpd's clock selection procedure which causes the worst of the five-or-fewer candidates which make it to the final stage of the clock selection procedure ("falseticker detection") to always be selected. Worst, in this case, means the highest stratum candidate with the longest delay. I think this might repair Doug Kingston's problems. This is almost certainly why his clients tended to form into long chains of peers of increasing strata rather than peering with the best stratum server. Also, since the faulty code wasn't really doing falseticker detection and was always selecting the clock most likely to be out to lunch, I suspect a fair amount of peer jumping might also be caused by this in some situations. A patch to ntp_proto.c follows. In case it's not clear the variable of concern is weight, in select_clock(). Dennis *** /tmp/,RCSt1007392 Sat Feb 25 00:04:59 1989 --- ntp_proto.c Fri Feb 24 23:25:17 1989 *************** *** 741,747 **** } } while (candidates > 1) { ! double maxdispersion = 0.0, dispersion, weight = 1.0; short worst; #ifdef DEBUG if (debug > 3) --- 746,752 ---- } } while (candidates > 1) { ! double maxdispersion = 0.0, dispersion, weight; short worst; #ifdef DEBUG if (debug > 3) *************** *** 751,756 **** --- 756,762 ---- /* compute dispersion of candidate `i' relative to the rest of the candidates */ dispersion = 0.0; + weight = 1.0; for (j = 0; j < candidates; j++) { dtmp = sel_lst[j].peer->estoffset - sel_lst[i].peer->estoffset;