CHANGES revision 267654
118962Ssos#	@(#)CHANGES	5.1 (Berkeley) 5/11/93
278627Sobrien# $FreeBSD: releng/9.3/usr.sbin/timed/timed/CHANGES 72646 2001-02-18 10:44:00Z asmodai $
318962Ssos
418962SsosThis new version is almost identical to the timed and timedc code
518962Ssosthat has been shipped for years by a workstation vendor.
618962Ssos
718962SsosAmong the many changes:
818962Ssos
918962Ssosimprove `timedc msite` to accept a list of hostnames.
1018962Ssos
1118962Ssoschange slave-masters to answer the packets generated by `timedc msite`
1218962Ssos    with the name of the real master, not their own.  This makes it
1318962Ssos    possible to "chase the chain" of slave servers to the ultimate
1418962Ssos    master.
1518962Ssos
1697748Sschweikhmuch improve the log caused by `timedc trace on`:
1718962Ssos    -made `timed -t` work.
1818962Ssos    -suppression of repeated entries, which both slowed down the daemon
1918962Ssos	(sometimes catastrophically) and tended to make disks fill up
2018962Ssos	even more quickly.
2118962Ssos    -better time stamps on log entries
2218962Ssos    -more messages
2318962Ssos    -dump information about slaves, master, and so on each time
2418962Ssos	a message asking the log be turned on is received, and
2518962Ssos	when the log is turned off.
2618962Ssos    -fewer CPU cycles
2718962Ssos
2818962Ssosuse a hash table to keep track of slaves, instead of the stupid linear
2918962Ssos    list.  This becomes handy with hundreds of slaves, instead of
3087248Smarkm    the original design limit of "a room with a few VAX's."
3187248Smarkm
3287248Smarkmseparate the main protocol timer from that used to look for other networks
3376224Sobrien    to master.
3476224Sobrien
3587248Smarkmtime stamp packets received by the daemon, so that time corrections
3687248Smarkm    are not made (even more) inaccurate by waiting in the internal,
3725984Sjdp    timed queue while the daemon is processing other messages.
3825984Sjdp
3918962Ssosmade -n and -i work with subnets not named in /etc/networks
4022499Sjoerg
4122499Sjoergcompute the median of the measured clocks, instead of the average
4218962Ssos    of "good" times.
4359342Sobrien
4459342Sobrienvastly improve the accuracy of the clock difference measure by 
4555377Swes    `timedc clockdiff`.
4687248Smarkm
4718962Ssosuse adjtime() when possible, and directly set the clock only when
4859342Sobrien    necessary.
4959342Sobrien
5059342Sobrienwhen the requested adjustment is small, perform only part of it, to
5159342Sobrien    damp oscillations and improve the long term accuracy of the
5259342Sobrien    adjustments.
5359342Sobrien
5459342Sobrienfix uncounted core-dumps on machines that do not allow dereferencing 0
5562313Sgreen    in both the daemon and timedc.
5662313Sgreen
5762313Sgreenfix "master loop detection".
5859342Sobrien
5959342Sobrienfix several cases in which multi-homed masters could get into shouting 
6022499Sjoerg    matches, consuming all available network bandwidth and CPU cycles
6118962Ssos    (which ever runs out first), and convincing all bystanders to stop
6218962Ssos    advancing their own clocks.
6318962Ssos
6459342Sobrienrefuse to behave badly when other machines do.  Instead of arguing forever,
6559342Sobrien    go off and sulk when other machines refuse to play by the rules.
6622499Sjoerg
67231812Seadlerincrease the maximum number of clients.
6818962Ssos
6959342Sobrienadd "-F host,host2,..." to "freerun" or "trust" only some hosts.  This
7018962Ssos    is handy both when only some machines should be trusted to let
7135364Seivind    root use the `date` command to change time in the network.
7259342Sobrien
7372093Sasmodai    It is also handy when one machine has some other way of adjusting
7435364Seivind    its clock, whether NTP or a direct radio or atomic connection.
7559342Sobrien    "-F localhost" causes `timed` to "trust" only itself.
7659342Sobrien
7759342Sobrien    It is also handy to build a hierarchy of timed masters crossing
7859342Sobrien    networks.  The TSP protocol has no provision of "goodness of clock",
7959342Sobrien    no natural way to completely heal network paritions.  Judicious
8059342Sobrien    use of -F or -G can cause each gateway to trust only itself and
8135364Seivind    machines closer to a central machine with a radio or atomic clock.
8255377Swes
8355377Swesadd #ifdef code that supports NIS "netgroups" of trusted hosts, which
8455377Swes    can be easier to administer than -F.
8555377Swes
8618962Ssosadd #ifdef code to compute an aged total adjustment.  This can be used
87231812Seadler    in systems that can make long term changes in their system clock
8818962Ssos    frequency, e.g. "timetrim" in the Silicon Graphics kernel.
8918962Ssos
9059342Sobrien
9172093SasmodaiProblems observed by others that are unresolved include:
9218962Ssos
9359342SobrienPractically any users can send to the master TSP messages and this
9418962Ssos	way corrupt the reliability of the system.  Authentication
9518962Ssos	of messages should be provided.  Unfortunately, that would
9618962Ssos	require changing the protocol with all of the implied
9718962Ssos	compatiblity problems.  Fortunately, the new -F and -G args
9818962Ssos	can be used to cause the daemon to ignore time changes from
9918962Ssos	untrusted machines.
10055377Swes
10155377SwesMAN.	The limit of 1013 on the number of slaves hosts should be doc'ed.
10255377Swes
10355377Swes	It should be dynamically allocated with no limit.  On a
10455377Swes	large network, one host could possibly master over many
10555377Swes	more than 30 hosts.   Given the timers in the code and
10655377Swes	effectively in the protocol, and the time required by each
10755377Swes	master to talk to each slave, it is not practical to have
10835364Seivind	more than 200-300 slaves.  The master cannot keep up because
10959342Sobrien	the slave-chatting is single-threaded.  when the master
11059342Sobrien	gets behind, slaves start demanding elections.  To
11155377Swes	significantly increase the number of slaves would require
11255377Swes	multi-treading things, and given that a network with more
11355377Swes	than 300 directly addressable machines has worse problems
11435364Seivind	than keep the time of day right, not worth worrying about.
11518962Ssos
11618962SsosUGLY,CODE. timedc/cmds.c has a lots of repeated code in it.
11725984Sjdp
11818962Ssos****    The first thing is that each command is set up as if it
11959342Sobrien	were an individual program taking argc and argv.  A more
12028620Sjoerg	conventional calling style should be used.  I don't think
12122499Sjoerg	any of the routines take more than a couple arguments.
12218962Ssos
12318962SsosUGLY.	fxn definition syntax does't follow convention:
12425984Sjdp	has type on same line.
12526837Scharnier
12622499Sjoerg****	It needs to be fixed at least enough that tags
12718962Ssos	will work on it.  An entire cleanup might be nice later, but
12818962Ssos	is noncritical.
12918962Ssos
13018962SsosLOBBY(mildly),CODE:	Would be very convenient if date(1) took a
13126837Scharnier	+-<number> argument to set the time relatively.  With
13222499Sjoerg	the advent of timed it is now reasonable to synchronize
13318962Ssos	with WWV, which is nearly impossible to do "by hand"
13435364Seivind	with just an absolute date, and scripts are too slow.
13559342Sobrien	format could be +-nn...nn.ss, where the '.' is required
13659342Sobrien	to remove ambiguity.
13759342Sobrien
13859342Sobrien****	If you want to do it go ahead.  It sounds useful.  As far as
13959342Sobrien	syntax goes, the normal format for the date should work just
14059342Sobrien	fine for this.  If the date is preceded by a plus or minus,
14159342Sobrien	the change is relative, otherwise it is absolute.
14259342Sobrien
14359342Sobrien
14418962SsosVernon Schryver.
14518962Ssosvjs@sgi.com
14618962Ssos