⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 176

📁 Unix/Linux 网络时间协议版本3 Network Time Protocol Version 3 (NTP) distribution for Unix systems
💻
字号:
Forwarded: Thu, 19 Feb 1998 02:06:53 -0500Forwarded: "mills@udel.edu "Replied: Thu, 19 Feb 1998 02:05:18 -0500Replied: "Bruce Bartram 303-497-6217 <bwb@etl.noaa.gov> "Received: from mail.eecis.udel.edu by whimsy.udel.edu id aa25684;          17 Feb 1998 10:16 ESTReceived: from mickey by netsrv (SMI-8.6/SMI-SVR4)	id IAA09303; Tue, 17 Feb 1998 08:16:17 -0700Received: by mickey (SMI-8.6/SMI-SVR4)	id IAA13843; Tue, 17 Feb 1998 08:16:26 -0700Date: Tue, 17 Feb 1998 08:16:26 -0700From: Bruce Bartram 303-497-6217 <bwb@etl.noaa.gov>Message-Id: <199802171516.IAA13843@mickey>To: stenn@whimsy.udel.eduSubject: proposed patch to xntp3-5.9xHowdy,I earlier sent this to Dave Mills, and I've attached his reply.I notice that the propsed patch didn't appear in xntp3-5.92, soI'm sending it in to you for consideration in case it fellinto the crack.  The issue has come up again in a discussionon the side of the newsgroup related to the "local ATOM" thread.The patch is UNTESTED.  I haven't tried to simulate the conditionsthat cause this error.  I've only heard of a couple of troublesthat might be related in the newsgroup.  Stephen L Moshier<moshier@mediaone.net> sent me a demonstration of this strangebehavior in a test setup with local prefer and outside sourcesat the same stratum.  He didn't send me output showing the patchmade things better.The patch is very small and I believe the effect is very limited.The problem:In normal operation, the xntpd control loop drives the host'sclock to reduce system variable "sys_clock_offset" towards zerobut making adjtime() (or kernel PLL) calls.When the ntp.conf has "server 127.127.1.0 prefer" and this is thesync peer, the xntpd is locked out of making host time changes,because it is presumed that some external protocol is controllingthe host's clock, so global variable "sys_clock_offset" can't bedriven towards zero.In most cases with local prefer, I think sys_clock_offset should beidentically 0, but it can become non-zero if the host clock isjerked at interrupt time (hypothecial, but a case like this wasthe original report that lead me to consider this trouble) or ifanother peer is the sync peer, an offset is driving the loop filter,and this peer then looses the selection back to the local refclock.If either of these happen, the sys_clock_offset can become non-zeroand it won't ever change.The daemon continues to run at an offset to the local host clock.The solution:Since clearing a system variable takes very little time, my proposedpatch simply whacks sys_clock_offset to zero every second in thentp_loopfilter.c section that notices that the sync peer is local prefer.This clear could occur only when the local prefer becomes sync peer,but that wouldn't fix the trouble jerking external disiplines.  Onlyregular clearing will fix the jerky case.Things the patch may break:I think that "fudge 127.127.1.0 time1 <offset>" might be able tocreate an intentional sys_clock_offset.  This patch would zap it back.A compile option could skip the clear in this special case.ntp.4:ntp.4 doesn't seem to have this variable at all.  I don't think thistrouble can happen there.  This also supports making the patch mainstream.Bruce Bartram     bbartram@etl.noaa.gov    just another chimehead----- possible patch to ntp_loopfilter.c 3-5.91   UNTESTED -----   I think it also applies to 3-5.9x, or more*** xntpd/ntp_loopfilter.c	Tue Nov 11 15:59:45 1997--- xntpd/ntp_loopfilter.c.proposed	Tue Nov 11 16:04:49 1997****************** 87,92 ****--- 87,93 ----  int fdpps = -1;			/* pps file descriptor */  int pps_enable;			/* pps disabled by default */  char cutout;			/* override for max capture range */+ extern	l_fp sys_clock_offset;	/* correction for current system time */    /*   * Imported from the ntp_proto module****************** 586,591 ****--- 587,599 ----  	if (sys_peer) {  		if (sys_peer->refclktype == REFCLK_LOCALCLOCK &&  		    sys_peer->flags & FLAG_PREFER)+                        /* I think that sys_clock_offset might be jammed+                         * to exactly zero now.  It might have had a+                         * small residual before things switched to the+                         * local refclock prefer at lower stratum, or a+                         * glitch might have happened during interrupts+                         * when the external control jumped the time */+ 	                L_CLR(&sys_clock_offset);  			return;   	}  	L_CLR(&offset);----- email exchange with Dave Mills -----To: mills@udel.edu, stenn@whimsy.udel.eduSubject: NTP 3-5.91 patch proposedHowdy,I've been trying to help Wernke zur Borg <wzb@anitesystems.de>with a newbie's set of questions (at least I think he is new toNTP) on how to set up a "local refclock prefer" configuration witha custom driver that reads some hardware timecode box.  I don'tknow what version of xntp he is using on his Solaris 2.5 system.He has sent me an email that shows:   sce250{stc}: ntptrace   localhost: stratum 4, offset 31.882483, synch distance 0.01021   127.127.1.0:    *Timeout*while ntpq shows the local refclock sitting at offset 0.   remote      refid    st t when poll reach   delay   offset    disp=====================================================================*LOCAL(0)   LOCAL(0)     3 l   10   64  377     0.00    0.000   10.01I can't think of any reason this could be possible withoutcrazy sys_clock_offset, possibly due to his alternate protocoljumping the system time by about that amount.I think that the patch below should be considered to absolutelyforce the offset to zero when the local refclock prefer is thesync peer.  The patch is two lines grep'ped from ntp_unixclock.cdealing with sys_clock_offset and a bunch of comments as to whythe offset might need to be cleared.  The source was xntp3-5.91.I took a quick look at ntp-4.0.70a source, and I don't even findwhere the offset is added to the time in get_systime.c, so I feelvery lost.  I'm not much of a programmer and it takes me a whileto absorb enough to find my way.  Sorry I'm not smart enough tosee my way to helping with the new version.If you think the patch might be the correct way to handle thistrouble, please email me and I'll forward the patch to him.  I'mreluctant to send a patch without your advice.Thanks for all the great efforts and wonderful code !Bruce Bartram    bbartram@etl.noaa.gov     just another chimehead----- possible patch to ntp_loopfilter.c 3-5.91   UNTESTED -----[SNIP duplicate copy of patch]----- Dave Mills' response, and followupsDate:     Tue, 11 Nov 1997 20:27:13 ESTFrom: Dave Mills <mills@huey.udel.edu>To: Bruce Bartram 303-497-6217 <bwb@etl.noaa.gov>cc: mills@udel.edu, stenn@whimsy.udel.eduSubject:  Re:  NTP 3-5.91 patch proposedBruce,You did some good thinking there; however, NTP v3 is not on hold whilewe shake the bugs from NTP v4. The new version has been cleansed ofyears of accumulated dust and dirt and ntp_unixclock.c has gone tothe dumpster. The sys_clock_offset thing was a bad idea from thebeginning (not mine, fortunately) and has also gone the dump.DaveTo: mills@huey.udel.eduSubject: RE: NTP 3-5.91 patch proposalHowdy,Thanks for the quick reply.  I've sent the proposed patch to Wernkeand hope it helps him.[SNIP quoted section]I've have an alternate idea on how to use system_clock_offset.  It mightbe a useful "trick" if an ntp daemon was going to run without privledgeon a host with a smooth, but undisiplined clock, such as a firewall router.Instead of doing the adjtime()s, they would be simulated and things wouldwork so long as the host's time was smooth.Such a trick could also be useful for testing a daemon on a host.In a normalling operating daemon, I think all the filtering detailsshould be simple and I suspect sys_clock_offset can get combined intothe filtering details, ignored or dropped.Bruce Bartram    bbartram@etl.noaa.gov    just another chimeheadDate:     Wed, 12 Nov 1997 22:22:46 ESTFrom: Dave Mills <mills@huey.udel.edu>To: Bruce Bartram 303-497-6217 <bwb@etl.noaa.gov>cc: mills@huey.udel.eduSubject:  Re:  NTP 3-5.91 patch proposalBruce,Your suggestion occured to a few folks awhile back and was the motivationfor the variable in the first place. Howeveer, it resulted in a ratherlarge cruft of dangerous code which I eventually threw out.Dave

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -