diff options
Diffstat (limited to 'contrib')
266 files changed, 44394 insertions, 23421 deletions
diff --git a/contrib/ntp/COPYRIGHT b/contrib/ntp/COPYRIGHT index 1750418..72d07a8 100644 --- a/contrib/ntp/COPYRIGHT +++ b/contrib/ntp/COPYRIGHT @@ -2,162 +2,172 @@ This file is automatically generated from html/copyright.htm Copyright Notice - [INLINE] "Clone me," says Dolly sheepishly + [sheepb.jpg] "Clone me," says Dolly sheepishly _________________________________________________________________ The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this notice applies as if the text was explicitly included in the file. - -/*********************************************************************** - * * - * Copyright (c) David L. Mills 1992-2000 * - * * - * Permission to use, copy, modify, and distribute this software and * - * its documentation for any purpose and without fee is hereby * - * granted, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission * - * notice appear in supporting documentation, and that the name * - * University of Delaware not be used in advertising or publicity * - * pertaining to distribution of the software without specific, * - * written prior permission. The University of Delaware makes no * - * representations about the suitability this software for any * - * purpose. It is provided "as is" without express or implied * - * warranty. * - * * - *********************************************************************** - */ +*********************************************************************** +* * +* Copyright (c) David L. Mills 1992-2001 * +* * +* Permission to use, copy, modify, and distribute this software and * +* its documentation for any purpose and without fee is hereby * +* granted, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission * +* notice appear in supporting documentation, and that the name * +* University of Delaware not be used in advertising or publicity * +* pertaining to distribution of the software without specific, * +* written prior permission. The University of Delaware makes no * +* representations about the suitability this software for any * +* purpose. It is provided "as is" without express or implied * +* warranty. * +* * +*********************************************************************** The following individuals contributed in part to the Network Time Protocol Distribution Version 4 and are acknowledged as authors of this work. 1. [1]Mark Andrews <marka@syd.dms.csiro.au> Leitch atomic clock controller - 2. [2]Viraj Bais <vbais@mailman1.intel.com> and [3]Clayton Kirkwood + 2. [2]Bernd Altmeier <altmeier@atlsoft.de> hopf Elektronik serial + line and PCI-bus devices + 3. [3]Viraj Bais <vbais@mailman1.intel.com> and [4]Clayton Kirkwood <kirkwood@striderfm.intel.com> port to WindowsNT 3.5 - 3. [4]Michael Barone <michael,barone@lmco.com> GPSVME fixes - 4. [5]Karl Berry <karl@owl.HQ.ileaf.com> syslog to file option - 5. [6]Greg Brackley <greg.brackley@bigfoot.com> Major rework of WINNT + 4. [5]Michael Barone <michael,barone@lmco.com> GPSVME fixes + 5. [6]Karl Berry <karl@owl.HQ.ileaf.com> syslog to file option + 6. [7]Greg Brackley <greg.brackley@bigfoot.com> Major rework of WINNT port. Clean up recvbuf and iosignal code into separate modules. - 6. [7]Piete Brooks <Piete.Brooks@cl.cam.ac.uk> MSF clock driver, + 7. [8]Marc Brett <Marc.Brett@westgeo.com> Magnavox GPS clock driver + 8. [9]Piete Brooks <Piete.Brooks@cl.cam.ac.uk> MSF clock driver, Trimble PARSE support - 7. [8]Steve Clift <clift@ml.csiro.au> OMEGA clock driver - 8. [9]Casey Crellin <casey@csc.co.za> vxWorks (Tornado) port and help - with target configuration - 9. [10]Sven Dietrich <sven_dietrich@trimble.com> Palisade reference + 9. [10]Reg Clemens <reg@dwf.com> Oncore driver (Current maintainer) + 10. [11]Steve Clift <clift@ml.csiro.au> OMEGA clock driver + 11. [12]Casey Crellin <casey@csc.co.za> vxWorks (Tornado) port and + help with target configuration + 12. [13]Sven Dietrich <sven_dietrich@trimble.com> Palisade reference clock driver, NT adj. residuals, integrated Greg's Winnt port. - 10. [11]John A. Dundas III <dundas@salt.jpl.nasa.gov> Apple A/UX port - 11. [12]Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de> Linux + 13. [14]John A. Dundas III <dundas@salt.jpl.nasa.gov> Apple A/UX port + 14. [15]Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de> Linux port - 12. [13]Dennis Ferguson <dennis@mrbill.canet.ca> foundation code for + 15. [16]Dennis Ferguson <dennis@mrbill.canet.ca> foundation code for NTP Version 2 as specified in RFC-1119 - 13. [14]Glenn Hollinger <glenn@herald.usask.ca> GOES clock driver - 14. [15]Mike Iglesias <iglesias@uci.edu> DEC Alpha port - 15. [16]Jim Jagielski <jim@jagubox.gsfc.nasa.gov> A/UX port - 16. [17]Jeff Johnson <jbj@chatham.usdesign.com> massive prototyping + 16. [17]Glenn Hollinger <glenn@herald.usask.ca> GOES clock driver + 17. [18]Mike Iglesias <iglesias@uci.edu> DEC Alpha port + 18. [19]Jim Jagielski <jim@jagubox.gsfc.nasa.gov> A/UX port + 19. [20]Jeff Johnson <jbj@chatham.usdesign.com> massive prototyping overhaul - 17. [18]William L. Jones <jones@hermes.chpc.utexas.edu> RS/6000 AIX - modifications, HPUX modifications - 18. [19]Hans Lambermont <Hans.Lambermont@nl.origin-it.com> or - [20]<H.Lambermont@chello.nl> ntpsweep - 19. [21]Frank Kardel [22]<Frank.Kardel@informatik.uni-erlangen.de> + 20. [21]Hans Lambermont <Hans.Lambermont@nl.origin-it.com> or + [22]<H.Lambermont@chello.nl> ntpsweep + 21. [23]Poul-Henning Kamp <phk@FreeBSD.ORG> Oncore driver (Original + author) + 22. [24]Frank Kardel [25]<Frank.Kardel@informatik.uni-erlangen.de> PARSE <GENERIC> driver (14 reference clocks), STREAMS modules for PARSE, support scripts, syslog cleanup - 20. [23]Dave Katz <dkatz@cisco.com> RS/6000 AIX port - 21. [24]Craig Leres <leres@ee.lbl.gov> 4.4BSD port, ppsclock, - Maganavox GPS clock driver - 22. [25]George Lindholm <lindholm@ucs.ubc.ca> SunOS 5.1 port - 23. [26]Louis A. Mamakos <louie@ni.umd.edu> MD5-based authentication - 24. [27]Lars H. Mathiesen <thorinn@diku.dk> adaptation of foundation + 23. [26]William L. Jones <jones@hermes.chpc.utexas.edu> RS/6000 AIX + modifications, HPUX modifications + 24. [27]Dave Katz <dkatz@cisco.com> RS/6000 AIX port + 25. [28]Craig Leres <leres@ee.lbl.gov> 4.4BSD port, ppsclock, Magnavox + GPS clock driver + 26. [29]George Lindholm <lindholm@ucs.ubc.ca> SunOS 5.1 port + 27. [30]Louis A. Mamakos <louie@ni.umd.edu> MD5-based authentication + 28. [31]Lars H. Mathiesen <thorinn@diku.dk> adaptation of foundation code for Version 3 as specified in RFC-1305 - 25. [28]David L. Mills <mills@udel.edu> Version 4 foundation: clock + 29. [32]David L. Mills <mills@udel.edu> Version 4 foundation: clock discipline, authentication, precision kernel; clock drivers: Spectracom, Austron, Arbiter, Heath, ATOM, ACTS, KSI/Odetics; audio clock drivers: CHU, WWV/H, IRIG - 26. [29]Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de> VMS port - 27. [30]Jeffrey Mogul <mogul@pa.dec.com> ntptrace utility - 28. [31]Tom Moore <tmoore@fievel.daytonoh.ncr.com> i386 svr4 port - 29. [32]Derek Mulcahy <derek@toybox.demon.co.uk> and [33]Damon + 30. [33]Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de> VMS port + 31. [34]Jeffrey Mogul <mogul@pa.dec.com> ntptrace utility + 32. [35]Tom Moore <tmoore@fievel.daytonoh.ncr.com> i386 svr4 port + 33. [36]Kamal A Mostafa <kamal@whence.com> SCO OpenServer port + 34. [37]Derek Mulcahy <derek@toybox.demon.co.uk> and [38]Damon Hart-Davis <d@hd.org> ARCRON MSF clock driver - 30. [34]Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de> + 35. [39]Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de> monitoring/trap scripts, statistics file handling - 31. [35]Dirce Richards <dirce@zk3.dec.com> Digital UNIX V4.0 port - 32. [36]Wilfredo Sánchez <wsanchez@apple.com> added support for + 36. [40]Dirce Richards <dirce@zk3.dec.com> Digital UNIX V4.0 port + 37. [41]Wilfredo Sánchez <wsanchez@apple.com> added support for NetInfo - 33. [37]Nick Sayer <mrapple@quack.kfu.com> SunOS streams modules - 34. [38]Jack Sasportas <jack@innovativeinternet.com> Saved a Lot of + 38. [42]Nick Sayer <mrapple@quack.kfu.com> SunOS streams modules + 39. [43]Jack Sasportas <jack@innovativeinternet.com> Saved a Lot of space on the stuff in the html/pic/ subdirectory - 35. [39]Ray Schnitzler <schnitz@unipress.com> Unixware1 port - 36. [40]Michael Shields <shields@tembel.org> USNO clock driver - 37. [41]Jeff Steinman <jss@pebbles.jpl.nasa.gov> Datum PTS clock + 40. [44]Ray Schnitzler <schnitz@unipress.com> Unixware1 port + 41. [45]Michael Shields <shields@tembel.org> USNO clock driver + 42. [46]Jeff Steinman <jss@pebbles.jpl.nasa.gov> Datum PTS clock driver - 38. [42]Harlan Stenn <harlan@pfcs.com> GNU automake/autoconfigure + 43. [47]Harlan Stenn <harlan@pfcs.com> GNU automake/autoconfigure makeover, various other bits (see the ChangeLog) - 39. [43]Kenneth Stone <ken@sdd.hp.com> HP-UX port - 40. [44]Ajit Thyagarajan <ajit@ee.udel.edu>IP multicast/anycast + 44. [48]Kenneth Stone <ken@sdd.hp.com> HP-UX port + 45. [49]Ajit Thyagarajan <ajit@ee.udel.edu>IP multicast/anycast support - 41. [45]Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp>TRAK clock + 46. [50]Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp>TRAK clock driver - 42. [46]Paul A Vixie <vixie@vix.com> TrueTime GPS driver, generic + 47. [51]Paul A Vixie <vixie@vix.com> TrueTime GPS driver, generic TrueTime clock driver - 43. [47]Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> corrected and + 48. [52]Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> corrected and validated HTML documents according to the HTML DTD _________________________________________________________________ - [48][LINK] + [53]gif - [49]David L. Mills <mills@udel.edu> + [54]David L. Mills <mills@udel.edu> References 1. mailto:marka@syd.dms.csiro.au - 2. mailto:vbais@mailman1.intel.co - 3. mailto:kirkwood@striderfm.intel.com - 4. mailto:michael.barone@lmco.com - 5. mailto:karl@owl.HQ.ileaf.com - 6. mailto:greg.brackley@bigfoot.com - 7. mailto:Piete.Brooks@cl.cam.ac.uk - 8. mailto:clift@ml.csiro.au - 9. mailto:casey@csc.co.za - 10. mailto:Sven_Dietrich@trimble.COM - 11. mailto:dundas@salt.jpl.nasa.gov - 12. mailto:duwe@immd4.informatik.uni-erlangen.de - 13. mailto:dennis@mrbill.canet.ca - 14. mailto:glenn@herald.usask.ca - 15. mailto:iglesias@uci.edu - 16. mailto:jagubox.gsfc.nasa.gov - 17. mailto:jbj@chatham.usdesign.com - 18. mailto:jones@hermes.chpc.utexas.edu - 19. mailto:Hans.Lambermont@nl.origin-it.com - 20. mailto:H.Lambermont@chello.nl - 21. http://www4.informatik.uni-erlangen.de/~kardel - 22. mailto:Frank.Kardel@informatik.uni-erlangen.de - 23. mailto:dkatz@cisco.com - 24. mailto:leres@ee.lbl.gov - 25. mailto:lindholm@ucs.ubc.ca - 26. mailto:louie@ni.umd.edu - 27. mailto:thorinn@diku.dk - 28. mailto:mills@udel.edu - 29. mailto:moeller@gwdgv1.dnet.gwdg.de - 30. mailto:mogul@pa.dec.com - 31. mailto:tmoore@fievel.daytonoh.ncr.com - 32. mailto:derek@toybox.demon.co.uk - 33. mailto:d@hd.org - 34. mailto:Rainer.Pruy@informatik.uni-erlangen.de - 35. mailto:dirce@zk3.dec.com - 36. mailto:wsanchez@apple.com - 37. mailto:mrapple@quack.kfu.com - 38. mailto:jack@innovativeinternet.com - 39. mailto:schnitz@unipress.com - 40. mailto:shields@tembel.org - 41. mailto:pebbles.jpl.nasa.gov - 42. mailto:harlan@pfcs.com - 43. mailto:ken@sdd.hp.com - 44. mailto:ajit@ee.udel.edu - 45. mailto:tsuruoka@nc.fukuoka-u.ac.jp - 46. mailto:vixie@vix.com - 47. mailto:Ulrich.Windl@rz.uni-regensburg.de - 48. file://localhost/backroom/ntp4+/html/index.htm - 49. mailto:mills@udel.edu + 2. mailto:altmeier@atlsoft.de + 3. mailto:vbais@mailman1.intel.co + 4. mailto:kirkwood@striderfm.intel.com + 5. mailto:michael.barone@lmco.com + 6. mailto:karl@owl.HQ.ileaf.com + 7. mailto:greg.brackley@bigfoot.com + 8. mailto:Marc.Brett@westgeo.com + 9. mailto:Piete.Brooks@cl.cam.ac.uk + 10. mailto:reg@dwf.com + 11. mailto:clift@ml.csiro.au + 12. mailto:casey@csc.co.za + 13. mailto:Sven_Dietrich@trimble.COM + 14. mailto:dundas@salt.jpl.nasa.gov + 15. mailto:duwe@immd4.informatik.uni-erlangen.de + 16. mailto:dennis@mrbill.canet.ca + 17. mailto:glenn@herald.usask.ca + 18. mailto:iglesias@uci.edu + 19. mailto:jagubox.gsfc.nasa.gov + 20. mailto:jbj@chatham.usdesign.com + 21. mailto:Hans.Lambermont@nl.origin-it.com + 22. mailto:H.Lambermont@chello.nl + 23. mailto:phk@FreeBSD.ORG + 24. http://www4.informatik.uni-erlangen.de/~kardel + 25. mailto:Frank.Kardel@informatik.uni-erlangen.de + 26. mailto:jones@hermes.chpc.utexas.edu + 27. mailto:dkatz@cisco.com + 28. mailto:leres@ee.lbl.gov + 29. mailto:lindholm@ucs.ubc.ca + 30. mailto:louie@ni.umd.edu + 31. mailto:thorinn@diku.dk + 32. mailto:mills@udel.edu + 33. mailto:moeller@gwdgv1.dnet.gwdg.de + 34. mailto:mogul@pa.dec.com + 35. mailto:tmoore@fievel.daytonoh.ncr.com + 36. mailto:kamal@whence.com + 37. mailto:derek@toybox.demon.co.uk + 38. mailto:d@hd.org + 39. mailto:Rainer.Pruy@informatik.uni-erlangen.de + 40. mailto:dirce@zk3.dec.com + 41. mailto:wsanchez@apple.com + 42. mailto:mrapple@quack.kfu.com + 43. mailto:jack@innovativeinternet.com + 44. mailto:schnitz@unipress.com + 45. mailto:shields@tembel.org + 46. mailto:pebbles.jpl.nasa.gov + 47. mailto:harlan@pfcs.com + 48. mailto:ken@sdd.hp.com + 49. mailto:ajit@ee.udel.edu + 50. mailto:tsuruoka@nc.fukuoka-u.ac.jp + 51. mailto:vixie@vix.com + 52. mailto:Ulrich.Windl@rz.uni-regensburg.de + 53. file://localhost/backroom/ntp4/html/index.htm + 54. mailto:mills@udel.edu diff --git a/contrib/ntp/ChangeLog b/contrib/ntp/ChangeLog index 1c498a6..69b566e 100644 --- a/contrib/ntp/ChangeLog +++ b/contrib/ntp/ChangeLog @@ -1,3 +1,2800 @@ +2001-08-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.1.0 + +2001-07-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_oncore.c (oncore_start): Set pps_enable=1, just + like the atom driver does. + From: reg@dwf.com + + * ntpd/refclock_nmea.c (nmea_ppsapi): Set pps_enable=1, just like + the atom driver does. + From: Scott Allendorf <sca@newton.physics.uiowa.edu> + + * ntpd/ntp_config.c (getconfig): CONF_CLOCK_PANIC was using the + wrong config flag. + From: <justin_forrester@hp.com> + +2001-07-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99m-rc3 + +2001-07-06 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntp_update: COPYRIGHT needs a touch. + From: Mike Stump <mrs@kithrup.com> + +2001-07-04 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/config.htm: Major cleanup. + From: Martin Janzen <janzen@pixelmetrix.com> + + * configure.in (rt library check): Don't look for -lrt under + Linux. Under glibc-2.1.2 and -2.2.2 (at least), the POSIX- + compatibility real-time library does strange things with threads + as other processes and we're getting lots of complaints about it. + Reported by: Juha Sarlin <juha@c3l.com> + +2001-06-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver35.htm: Update email address. + +2001-06-25 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_oncore.c (oncore_msg_BaEaHa): Fix wrong offset for + rsm.bad_almanac + From: Reynir Siik <reynir@royal.net> + +2001-06-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99m-rc2 + +2001-06-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_config.c: + * include/ntp_config.h: includefile config keyword support + From: Dean Gibson <timekeeper@tcp-udp.net> + +2001-06-08 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99m-rc1b + + * ntpd/refclock_true.c (true_debug): Bump some buffer sizes to + reduce/eliminate chance of buffer overflow. Use snprintf() + instead of sprintf(). Do a better job of opening the debug file. + * ntpd/ntp_control.c (ctl_getitem): Count overflow packets as bad + and return a BADFMT. + * ntpd/ntp_config.c (save_resolve): call fdopen() with the correct + mode. + From: Bela Lubkin <belal@sco.com> + +2001-06-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/ntp.h (RES_ALLFLAGS): Add RES_DEMOBILIZE. + From: Dean Gibson <timekeeper@tcp-udp.net> + + * configure.in: 4.0.99m-rc1a + +2001-06-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_refclock.c (refclock_open): Add O_NOCTTY to the open() + flags when opening a serial port. + Reported by: joseph lang <tcnojl1@earthlink.net> + +2001-05-31 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/notes.htm: Typo fix. + From: John Stone <johns@ks.uiuc.edu> + + * configure.in: 4.0.99m-rc1 + + * html/monopt.htm: Typo fix. + * html/confopt.htm: Cruft removal. + From: John Stone <johns@ks.uiuc.edu> + +2001-05-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * README.cvs: More updates and cleanup. + + * ntpd/ntp_loopfilter.c (loop_config): + Check against STA_NANO instead of (NTP_API > 3) to catch kernels + that were rolled while the spec was evolving. + From: John.Hay@icomtek.csir.co.za + + * README.cvs: Note that we want to check out NTP into a clean + subdir. + Reported by jrd@cc.usu.edu (Joe Doupnik) + +2001-05-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k40 + + * include/ntp_refclock.h: Median Filter (SAMPLE - macro) - change + to use most recent MAXSTAGE entries when the filter overflows (ie + driver poking say once per second with poll > MAXSTAGE) rather + than blocking after MAXSTAGE entries (turf oldest rather than turf + most recent). + From: John Woolner <vk1et@tpg.com.au> + + * ntpd/refclock_true.c: + a. Don't cream pp->a_lastcode when we get a <cr><lf> pair + b. Fix up pp->leap handling to work correctly + c. clear CEVNT_BADTIME etc warnings when we get good clock + CEVNT_NOMINAL. + From: John Woolner <vk1et@tpg.com.au> + + * kernel/sys/pcl720.h: + Add support for the XL clock to refclock_true.c + From: Paul A Vixie <vixie@mfnx.net> + + * ntpd/ntp_loopfilter.c (local_clock): One more attempt at + "improving" the panic message. + +2001-05-26 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (ac_cv_func_ctty_for_f_setown): BSDI3 needs a ctty + for F_SETOWN, too. + From: Paul A Vixie <vixie@mfnx.net> + +2001-05-24 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/ntpd.htm: Typo. + From: John Stone <johns@ks.uiuc.edu> + +2001-05-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k39 + + * ntpd/ntp_loopfilter.c (local_clock): huffpuff cleanup/improvements. + (huffpuff): Cleanup/improvements. + (loop_config): huffpuff initialization cleanup/improvements. + From: Dave Mills, Terje, Mark, and John? + +2001-05-22 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/release.htm: + * html/ntpd.htm: + * html/miscopt.htm: + From: Dave Mills: Updates. + +2001-05-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k38 + + * ntpd/ntp_proto.c (clock_filter): Huff-n-Puff and Popcorn + improvements. + * ntpd/ntp_loopfilter.c (local_clock): Debug cleanup + From: Dave Mills. + + * include/ntp_syscall.h (ntp_gettime): Updated patch from Ulrich. + My original attempt was not backwards compatible. + +2001-05-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/ntp_syscall.h (ntp_gettime): Fill in the tai member. + From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> + + * configure.in: 4.0.99k37 + + * ntpd/ntp_proto.c (clock_filter): Lose "off", xtemp and ytemp, + and some obsoleted calculations. Set the peer->offset and + peer->delay from the filter stages. + + * ntpd/ntp_loopfilter.c: Comment/document improvements. + (local_clock): correct the offset by one-half the difference + between the sample delay and minimum delay. Lose "mu" from the + debug message. + From: Dave Mills. + +2001-05-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k36 + + * ntpd/ntp_loopfilter.c: Huff-n-puff cleanup + From: Dave Mills. + +2001-05-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k35 + + * ntpd/refclock_atom.c (atom_ppsapi): set pps_enable=1 if + enb_hardpps. + * ntpd/ntp_timer.c: huffpuff support. + (init_timer): huffpuff support. + (timer): huffpuff support. + * ntpd/ntp_proto.c (init_proto): Initialize pps_enable to 0, not 1. + * ntpd/ntp_loopfilter.c (CLOCK_HUFFPUFF): Added. + Add huff-n-puff filter variables. + (local_clock): Lose "pps sync enabled" log noise. + (huffpuff): Added. + (loop_config): LOOP_MINPOLL and LOOP_ALLAN were missing the + trailing break; add LOOP_HUFFPUFF. + * ntpd/ntp_config.c: tinker huffpuff added. + (getconfig): CONF_CLOCK_HUFFPUFF support. + * include/ntpd.h: huffpuff() declaration. + * include/ntp_config.h (CONF_CLOCK_HUFFPUFF): Added. + * include/ntp.h (HUFFPUFF): Added. + (LOOP_HUFFPUFF): Added. + From: Dave Mills. + +2001-05-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver20.htm: Reality check. + * ntpd/refclock_nmea.c: Comment cleanup + From: John Woolner <vk1et@tpg.com.au> + + * html/release.htm: Cleanup (at least). + * html/refclock.htm: Cleanup (at least). + * html/kern.htm: Cleanup (at least). + * html/index.htm: Cleanup (at least). + * html/extern.htm: Cleanup (at least). + * html/driver1.htm: Cleanup (at least). + * html/debug.htm: Cleanp (at least). + * html/accopt.htm: KoD documentation update. + From: Dave Mills. + + * configure.in: 4.0.99k34 + + * ntpd/ntp_util.c (record_loop_stats): values are now passed in. + * ntpd/ntp_loopfilter.c (local_clock): pass the values to + record_loop_stats(). + * include/ntpd.h: Pass the parameters in to record_loop_stats(). + With the discipline loop opened (disable ntp) the local clock + updates were not being sent to loopstats. That now is. + From: Dave Mills. + +2001-05-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k33 + + * ntpd/ntp_proto.c (receive): Validate the source port. Lose + NTPv1 support. + * ntpd/ntp_loopfilter.c (local_clock): Sanity check sys_poll + earlier instead of later. + From: Dave Mills. + + * ntpd/refclock_oncore.c (oncore_msg_any): We don't always have + GETTIMEOFDAY(). + +2001-05-09 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_shm.c (shm_poll): Apply JAN_1970 correction after + calling TVTOTS(), just like everybody else does. + From: David Malone <dwmalone@maths.tcd.ie> + + * ntpd/refclock_ulink.c: fixed 33x quality flag, added more + debugging stuff, updated 33x time code explanation. + From: s.l.smith (via j.c.lang). + +2001-05-08 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k32 + + * ntpd/ntp_loopfilter.c: rstclock now takes a 3rd argument, the + last offset. + (init_loopfilter): Use it. + (local_clock): Use it. Clean up the code. + (loop_config): Use it. + (rstclock): Implement it. Clean up the code. + From Dave Mills. + +2001-05-06 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k31 + + * ntpdc/ntpdc_ops.c (sysstats): That's 'bad packet format' + (instead of '... length'), and 'packets rejected' (instead of + 'limitation rejects'. + * ntpd/ntp_proto.c (receive): PUBKEY fixes. Move KoD stuff to + process_packet(). + (process_packet): Move KoD stuff here... + (peer_clear): Unspec the stratum, too. + (clock_filter): Don't update peer->epoch here. Fix the filter + test when checking the epoch. + (fast_xmit): Send back STRATUM_UNSPEC on a KoD packet. + (init_proto): Initialize sys_jitter. + + * ntpd/ntp_loopfilter.c: rstclock() takes 2 parameters now. + (init_loopfilter): Use it... + (local_clock): Ditto, and change the "mu" calculation. Improve + the jitter test in S_SYNC. Use peer->epoch (not current_time) to + update the last_time. Update debug info. + (rstclock): 2nd arg - the epoch to use. Use it. + (loop_config): update call to rstclock. + From: Dave Mills. + +2001-05-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * ports/winnt/ntpd/ntpd.dsp: Add cmd_args.c + From: Wink Saville <wink@saville.com> + +2001-04-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpq/ntpq.c (tstflags): 11 now. + From: John Cochran <jdc@fiawol.org> + + * ntpd/ntp_proto.c (receive): KoD updates. Improve the comments. + Lose the AM_PROCPKT restrictions test. + (peer_xmit): Check/report on no encryption key in packet. + (fast_xmit): Use peer_xmit's new packet length check code. + From Dave Mills. + +2001-04-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k30 + +2001-04-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpdc/ntpdc_ops.c: Added "kod", lost "demobilize". + * ntpd/ntp_config.c: Added "kod" keyword. Lose "demobilize" keyword. + * html/release.htm: Updated. + * html/accopt.htm: Updated. + From: Dave Mills. + + * ntpq/ntpq.c: Reorder and add some TEST flag bits. + * ntpd/ntp_proto.c (transmit): Also bail if access denied. + (receive): Lose RES_DEMOBILIZE and (some?) RES_DONTSERVE and + RES_LIMITIED stuff. Update Kiss-Of-Death (KoD) docs. + Call fast_xmit with new 3rd parameter (restrict_mask). + Before checking for an authentic packet, check the restrict_mask + for RES_{DONTSERVE,LIMITED,NOPEER}. + Check restrictions in AM_PROCPKT case. + (peer_clear): Don't lose the stratum if the peer->flags don't + indicate FLAG_REFCLOCK. + (fast_xmit): Take restrict mask as a new argument, and handle + KoD. Reorder some code. + From: Dave Mills. + +2001-04-26 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpdc/ntpdc_ops.c: restrict/unrestrict support for version and + demobilize. Implement demobilze. + * ntpd/ntp_proto.c (receive): Improve version testing, including + RES_DEMOBILIZE support. + (fast_xmit): Patches to kiss-of-death packet. + * ntpd/ntp_loopfilter.c (local_clock): S_SYNC case now also checks + abs(clock_offset) against CLOCK_PGATE*sys_jitter. + * ntpd/ntp_config.c: CONF_RES_DEMOBILIZE/demobilize support. + * include/ntp_config.h (CONF_RES_DEMOBILIZE): Added. + * include/ntp.h (RES_DEMOBILIZE): Added. + From Dave Mills. + +2001-04-25 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/accopt.htm: Document the "version" parameter + From Dave Mills. + + * ntpd/ntp_proto.c (fast_xmit): Implement DENY mode. + From Dave Mills. + + * ntpd/ntp_config.c: Add the "allan" tinker variable. + From: Juha Sarlin <juha@c3l.tyreso.se> + + * ntpd/refclock_hopfpci.c (hopfpci_start): Lose the "correct_any" + stuff - it's both obsolete and wrong. + + * ntpd/ntp_proto.c (receive): Keep track of packet versions. + Implement RES_LIMITED. + * include/ntp_config.h (CONF_RES_LIMITED): + * include/ntp.h (RES_LIMITED): Leave the bits in the original + order. + From Dave Mills. + + * util/timetrim.c: + * util/Makefile.am: + * ntpdc/ntpdc_ops.c: + * ntpd/refclock_nmea.c: + * libntp/snprintf.c: + * configure.in: + * configure: + * config.h.in: + * aclocal.m4: + * acconfig.h: + Lint cleanup from: Marc Brett <mbrett@rgs0.london.waii.com> + + * ntpd/ntp_config.c: Add "version" support. + (getconfig): version support. + * include/ntp_config.h (CONF_RES_VERSION): Added. + * include/ntp.h (RES_VERSION): Added. + From: Dave Mills. + + * include/ntp_machine.h (ifreq): WinNT cleanup + +2001-04-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k29 + + * html/miscopt.htm: Document the "allan" tinker variable. + * ntpd/ntp_proto.c (clock_filter): Update comments. Lose etemp; + we now use allan_xpt for this. + * ntpd/ntp_loopfilter.c: Added allan_xpt as a tinker variable. + Reorganize variables and improve comments. + (local_clock): Improve comments, use (new) allan_xpt instead of + CLOCK_ALLAN. Fix test in S_SYNC state. Update debug info. + (rstclock): No longer force allan_xpt to CVLOCK_ALLAN in S_FREQ, + S_SYNC, or default case. + (loop_config): Document dangerous tinker variables, and add + LOOP_ALLAN to the list. + * include/ntp_config.h (CONF_CLOCK_ALLAN): Added. + * include/ntp.h (LOOP_ALLAN): Added. + Allan intercept fixes from Dave Mills. + + * scripts/mkver.in: Use the C locale so the dates come out in a + consistent format. + From: ASANO Naoyuki <n_asano@imjp.co.jp> + + * build: Run "config.status" before the "make" because it probably + saves time and trouble. Probably... + + * flock-build: Try building sequentially. + +2001-04-22 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (ac_cv_make_tickadj): Fix it right... + + * util/ntp-genkeys.c: extern config_netinfo, too. + + * util/hist.c: + * ntptrace/ntptrace.c: + * ntpq/ntpq.c: + * ntpdc/ntpdc.c: + * ntpdate/ntptimeset.c: + * ntpdate/ntpdate.c: + * ntpd/refclock_parse.c: + * ntpd/refclock_msfees.c: + * ntpd/refclock_jupiter.c: + * ntpd/ntp_refclock.c: + * ntpd/ntp_io.c: + * libparse/clk_wharton.c: + * libparse/clk_varitext.c: + * libparse/clk_trimtaip.c: + * libparse/clk_schmid.c: + * libparse/clk_rcc8000.c: + * libparse/clk_rawdcf.c: + * libparse/clk_meinberg.c: + * libparse/clk_hopf6021.c: + * libparse/clk_dcf7000.c: + * libparse/clk_computime.c: + Lint. From: Simon Burge <simonb@wasabisystems.com> + +2001-04-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_nmea.c (nmea_receive): Fixes. + From: John Woolner <vk1et@tpg.com.au> + + * util/ntp-genkeys.c: Declare check_netinfo, don't define it. + From: Jack Bryans <jbryans@csulb.edu> + + * configure.in (RSASRCS): rsaref2 needs digit.h (I thought I fixed + this already). + + * configure.in (CFLAGS): Disable -Wconversion, enable + -Wmissing-prototypes, and allow for -Werror. + From: Simon Burge <simonb@wasabisystems.com> + + * util/ntp-genkeys.c (main): Reset the standard mask so the + symlinks are created with the standard mask. + + * configure.in: 4.0.99k28 + + * ntpd/ntpd.c (ntpdmain): Use mode_t for umask value. + + * util/ntp-genkeys.c: Create files with the right umask. + + * util/ntp-genkeys.c: config_file should be declared, not defined. + * ntpd/refclock_mx4200.c (mx4200_pps): debug cleanup. + * ntpd/refclock_hopfser.c: If we're not using it, provide the _bs. + * ntpd/refclock_heath.c (heath_receive): Add missing "break" + statements. + * ntpd/ntp_proto.c: Lose extra definition of mode_ntpdate. + * librsaref/Makefile.am (nodist_librsaref_a_SOURCES): Put RSASRCS + on the same line as rsaref.h to improve portability. + * libntp/msyslog.c: Lint cleanup. + From: Marc.Brett@westerngeco.com + + * util/ntp-genkeys.c: + * ntpdate/ntpdate.c: + * ntpd/ntp_config.c: Netinfo header reorder. + From: Jack Bryans <jbryans@csulb.edu> + + * configure.in: timespec can be found by looking in goofy places + under SunOS. + +2001-04-20 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_nmea.c: PPSAPI cleanup, default to RMC sentences, + handle milliseconds, multiple sentences, other good stuff. + From: John Woolner <vk1et@tpg.com.au>, Marc.Brett@westerngeco.com, + John.Hay@icomtek.csir.co.za + + * ntpd/ntp_proto.c (receive): In the AM_NEWBCL case, return in all + cases at the end. + * ntpd/ntp_peer.c (newpeer): Check cast_flags against MDF_BCLNT, + not against MDF_BCAST. + * ntpd/ntp_loopfilter.c (local_clock): Lose debug info. + * ntpd/ntp_crypto.c (crypto_recv): Bugfix. + From: Dave Mills. + + * configure.in: 4.0.99k27 + + * ntpd/ntp_loopfilter.c (local_clock): Check clock_panic > 0. + Check clock_max > 0. + * html/ntpd.htm: Cleanup. + * html/miscopt.htm: Cleanup. + * html/confopt.htm: Cleanup minpoll documentation. + From: Dave Mills. + +2001-04-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/cmd_args.c (getstartup): check_netinfo needs an extern + declaration. + Reported by: Jack Bryans <jbryans@csulb.edu> + + * configure.in (ac_cv_make_timetrim): Added. + * util/Makefile.am (bin_PROGRAMS): MAKE_TIMETRIM + Requested by: Jack Bryans <jbryans@csulb.edu> + + * configure.in: 4.0.99k26 + + * util/ntp-genkeys.c: + * ntpd/refclock_oncore.c: + * ntpd/ntp_peer.c: + * libntp/msyslog.c: + * libntp/audio.c: + Lint cleanup. + From: Simon Burge <simonb@wasabisystems.com> + + * ntpd/ntp_loopfilter.c (local_clock): debug message improvements + from Dave Mills. + + * libntp/emalloc.c (emalloc): Tell people we are exiting if we log + an out-of-memory condition. + + * util/ntp-genkeys.c (main): Don't allow '#' in a generated MD5 + key. Reported by: Dave Tyson <Dave.Tyson@liverpool.ac.uk> + +2001-04-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (clock_update): minpoll cleanup. + (clock_select): minpoll cleanup. + (clock_filter): Bugfixes from Mark Martinec <Mark.Martinec@ijs.si> + * ntpd/ntp_loopfilter.c (rstclock): minpoll cleanup. Debug cleanup. + * ntpd/ntp_config.c (getconfig): Initialize/bounds check minpoll + using NTP_MINDPOLL insted of sys_minpoll. + From: Dave Mills. + +2001-04-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * libntp/msyslog.c: + * ElectricFence/page.c (stringErrorReport): Follow Rainer's lead + and use strerror(). + + * ntpd/refclock_shm.c (shm_start): Always use strerror. + * libntp/msyslog.c (msyslog): Use strerror if present. + From: Rainer Orth <ro@TechFak.Uni-Bielefeld. + + * ntpd/ntp_config.c (getconfig): Read stratum fudge value into + long variable. + From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * libparse/parsesolaris.c (rdchar): Cast ~0 to unsigned long. + * libntp/buftvtots.c (buftvtots): Allow for 8-byte tv_sec, tv_usec + in struct timeval. + From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + +2001-04-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_config.c (getconfig): move "tinker" so it's generally + available. + +2001-04-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Look for getclock(). + + * ntpd/ntp_config.c (getconfig): Squawk if provided minpoll or + maxpoll values are out of range. + + * ntpd/ntp_proto.c (poll_update): Some operations can only be done + if we're compiling with some REFCLOCKs. + From Dave Mills. + + * configure.in (RSASRCS): Added. + * librsaref/Makefile.am (nodist_librsaref_a_SOURCES): Use RSASRCS. + + * configure.in: Limit the DECL_HSTRERROR_0 to aix4.3.*. RSN, we + could also limit it to xlc... + + * configure.in: 4.0.99k25 + + * html/leap.htm: Added. + * html/index.htm: Update. + * html/driver7.htm: Update. + * html/driver6.htm: Update. + * html/driver36.htm: Update. + * html/audio.htm: Update. + * html/y2k.htm: Removed. + From Dave Mills. + +2001-04-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * acconfig.h: Lose extra declarations of PACKAGE and VERSION. + + * acconfig.h: + * configure.in: + * include/l_stdlib.h: DECL_HSTRERROR_0 needed for xlc under AIX 4.3.2. + Reported by: Harald Barth <haba@pdc.kth.se> + + * ntpd/ntp_proto.c (proto_config): cal_enable (PROTO_CAL) is + invalid if no refclocks are present. + From: Frodo Looijaard <frodol@dds.nl> + + * README.cvs: On some systems, the -C option fails. + + * ntpd/refclock_nmea.c: + * ntpd/ntp_refclock.c: + * html/driver20.htm: + PPSAPI patches for NMEA driver. + From: John.Hay@icomtek.csir.co.za + + * README.rsa: Describe RSAEuro support, provide alternate rsa.c + patch. + * configure.in: Check for rsaeuro1, RSAOBJS, RSADIR respectively. + * html/build.htm: Hint at rsaeuro1 directory. + * include/global.h (BYTE): Define. + * librsaref/Makefile.am (nodist_librsaref_a_SOURCES): Removed rsaref2 + specific sources. + (librsaref_a_LIBADD): Add appropriate objects. + (librsaref_a_DEPENDENCIES): Work around automake limitation. + (stamp-rsaref): Use RSADIR. + * scripts/README: Document ntp-close. + * scripts/Makefile.am (EXTRA_DIST): Distribute it. + * Makefile.am (DISTCLEANFILES): Remove .warning. + * librsaref/Makefile.am (DISTCLEANFILES): Remove copied/touched + librsaref sources, stamp-rsaref. + * ntpdate/Makefile.am (DISTCLEANFILES): Remove version.c. + * ntpq/Makefile.am (DISTCLEANFILES): Likewise. + * parseutil/Makefile.am (DISTCLEANFILES): Remove $(EXTRA_PROGRAMS). + Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * ntpd/ntp_control.c: Header cleanup + +2001-04-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Properly align --help output. + Explain ElectricFence. + From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * ntpd/ntp_loopfilter.c (local_clock): Lose debugging statements. + * ntpd/ntp_proto.c (clock_filter): Rewrite. + From: Dave Mills + + * ntpd/ntp_control.c (ctl_getitem): msyslog() possible buffer + overflow exploit. + + * configure.in: 4.0.99k24 + + * html/pic/radio2.jpg: + * html/release.htm: + * html/refclock.htm: + * html/pps.htm: + * html/ntpd.htm: + * html/miscopt.htm: + * html/driver22.htm: + * html/confopt.htm: + Updated documentation from Dave Mills. + + * util/ntp-genkeys.c: sys_minpoll. + * ntpd/refclock_atom.c: Comment additions. + * ntpd/ntp_proto.c: mode_ntpdate and peer_ntpdate added. + (transmit): We want 3, not 2, consecutive polls. hpoll logic + cleanup. mode_ntpdate changes. + (receive): When setting up a newpeer, use our sys_minpoll, not the + peer->ppoll. + (clock_update): sys_minpoll changes. Reorder some case 1 code. + Don't exit in case 2. + (poll_update): hpoll cleanup. + (peer_clear): u_rand. Use u_rand to randomize the initial poll. + * ntpd/ntp_peer.c (newpeer): Bump peer_ntpdate if we're in + mode_ntpdate. + * ntpd/ntp_loopfilter.c: Initialize sys_poll and sys_minpoll to + NTP_MINDPOLL. + (local_clock): Clean up some debug/info messages. + (rstclock): Use sys_minpoll. + (loop_config): KERNEL_PLL sanity checks. LOOP_MINPOLL support. + * ntpd/ntp_crypto.c (crypto_recv): Turn off FLAG_AUTOKEY when we + turn off TEST10. + * ntpd/ntp_control.c (ctl_getitem): Buffer overflow check. Clean + up some loop logic. + * ntpd/ntp_config.c: Added "tinker" and "minpoll". Use + sys_minpoll now, instead of old manifest constant. + (save_resolve): Print keyid using decimal, not hex. From Lars-Owe + Ivarsson <larsowe@paradisaea.its.uu.se> + * include/ntpd.h: Added peer_ntpdate and sys_minpoll. + * include/ntp_config.h (CONF_CLOCK_MINPOLL): Added. + * include/ntp.h: keyid cleanup. LOOP_* cleanup. + From Dave Mills. + +2001-04-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (clock_filter): Swell stuff. + From: Mark Martinec <Mark.Martinec@ijs.si> + + * ports/winnt/ntpd/ntpd.dsp: + * ports/winnt/ntpd/hopf_PCI_io.c: + * ports/winnt/include/hopf_PCI_io.h: + * ports/winnt/include/config.h: + * ntpd/refclock_hopfser.c: + * ntpd/refclock_hopfpci.c: + * ntpd/refclock_conf.c: + * ntpd/ntp_control.c: + * ntpd/Makefile.am: + * libntp/clocktypes.c: + * include/ntp.h: + * include/hopf6039.h: + * include/Makefile.in: + * include/Makefile.am: + * html/pic/fg6039.jpg: + * html/refclock.htm: + * html/driver39.htm: + * html/driver38.htm: + * html/copyright.htm: + Updated Oncore dudes. + + * configure.in: + HOPF drivers and documentation. + From: Bernd Altmeier <altmeier@atlsoft.de> (with some light + hacking from Harlan to clean up indentation and lose the // comments) + + * ntpd/refclock_oncore.c: + * ntpd/refclock_conf.c: Make it go. + From: Reg Clemens <reg@dwf.com> + + * configure.in (openssl): Publish and default to RSAREF; hide + openssl, and only use it if explicitly requested (at least until + we work with it). + +2001-04-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/y2k.htm: + * html/tickadj.htm: + * html/release.htm: + * html/refclock.htm: + * html/quick.htm: + * html/pps.htm: + * html/ntptrace.htm: + * html/ntptime.htm: + * html/ntpq.htm: + * html/ntpdc.htm: + * html/ntpdate.htm: + * html/ntpd.htm: + * html/miscopt.htm: + * html/index.htm: + * html/genkeys.htm: + * html/exec.htm: + * html/driver7.htm: + * html/driver22.htm: + * html/copyright.htm: + * html/confopt.htm: + * html/build.htm: + * html/authopt.htm: + * html/assoc.htm: + Updates from Dave Mills. + +2001-04-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (OPENSSL): Just use -lcrypto. + Reported by Dave Mills. + +2001-03-31 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k20 + + * ntpd/refclock_heath.c: Add support for GC-1000 II. + From Dave Mills. + + * ntpd/ntp_proto.c (transmit): Check peer->unreach. + (peer_clear): peer->outdate is a f(BURST_INTERVAL1), not + NTP_MINPOLL. + * ntpd/ntp_loopfilter.c (local_clock): mode_ntpdate stuff. + * ntpd/ntp_crypto.c: OpenSSL/RSAREF support. + * ntpd/cmd_args.c: Use -q, not -z, for mode_ntpdate. + (getstartup): nofork on mode_ntpdate. Usage update. + * include/ntp_crypto.h: OpenSSL/RSAREF support. + From: Dave Mills. + + * configure.in (rsaref): Buglet. + +2001-03-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (clock_update): mode_ntpdate support. + * ntpd/ntp_loopfilter.c (local_clock): mode_ntpdate support. + * ntpd/cmd_args.c: Added -z (mode_ntpdate). + * include/ntpd.h: mode_ntpdate added. + * include/ntp_crypto.h: RSAREF/OPENSSL cleanup. + From: Dave Mills. + +2001-03-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * config.h.in: + * aclocal.m4: + * configure.in: Prepare for OpenSSL support + +2001-03-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * README.rsa: Note that RSAEURO will not work. + Reported by: pieter.delacourt@banksys.be + +2001-03-25 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/ntp_if.h: + * include/ntp_machine.h: + * include/ntp_unixtime.h: + * libntp/humandate.c: + * libntp/iosignal.c: + * libntp/mktime.c: + * libntp/prettydate.c: + * libntp/systime.c: + * libntp/tvtoa.c: + * libntp/uglydate.c: + * libntp/utvtoa.c: + * libparse/clk_computime.c: + * libparse/clk_dcf7000.c: + * libparse/clk_hopf6021.c: + * libparse/clk_meinberg.c: + * libparse/clk_rawdcf.c: + * libparse/clk_rcc8000.c: + * libparse/clk_schmid.c: + * libparse/clk_trimtaip.c: + * libparse/clk_trimtsip.c: + * libparse/clk_varitext.c: + * libparse/parse.c: + * libparse/parse_conf.c: + * ntpd/check_y2k.c: + * ntpd/ntp_config.c: + * ntpd/ntp_control.c: + * ntpd/ntp_intres.c: + * ntpd/ntp_io.c: + * ntpd/ntp_loopfilter.c: + * ntpd/ntp_monitor.c: + * ntpd/ntp_proto.c: + * ntpd/ntp_refclock.c: + * ntpd/ntp_request.c: + * ntpd/ntp_resolver.c: + * ntpd/ntp_timer.c: + * ntpd/ntp_util.c: + * ntpd/ntpd.c: + * ntpd/refclock_acts.c: + * ntpd/refclock_arbiter.c: + * ntpd/refclock_arc.c: + * ntpd/refclock_as2201.c: + * ntpd/refclock_atom.c: + * ntpd/refclock_bancomm.c: + * ntpd/refclock_chronolog.c: + * ntpd/refclock_chu.c: + * ntpd/refclock_datum.c: + * ntpd/refclock_dumbclock.c: + * ntpd/refclock_fg.c: + * ntpd/refclock_gpsvme.c: + * ntpd/refclock_heath.c: + * ntpd/refclock_hpgps.c: + * ntpd/refclock_irig.c: + * ntpd/refclock_jupiter.c: + * ntpd/refclock_leitch.c: + * ntpd/refclock_local.c: + * ntpd/refclock_msfees.c: + * ntpd/refclock_mx4200.c: + * ntpd/refclock_nmea.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_pcf.c: + * ntpd/refclock_pst.c: + * ntpd/refclock_shm.c: + * ntpd/refclock_tpro.c: + * ntpd/refclock_trak.c: + * ntpd/refclock_true.c: + * ntpd/refclock_ulink.c: + * ntpd/refclock_usno.c: + * ntpd/refclock_wwv.c: + * ntpd/refclock_wwvb.c: + * ntpdate/ntpdate.c: + * ntpdate/ntptime_config.c: + * ntpdate/ntptimeset.c: + * ntpdc/ntpdc.c: + * ntpdc/ntpdc_ops.c: + * ntpq/ntpq.c: + * ntpq/ntpq_ops.c: + * ntptrace/ntptrace.c: + * parseutil/testdcf.c: + * util/hist.c: + * util/ntp-genkeys.c: + * util/ntptime.c: + * util/precision.c: + * util/tickadj.c: + time.h and sys/time.h cleanup. + +2001-03-24 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: '99k19 + + * ntpd/refclock_atom.c (atom_ppsapi): PPS API RFC alignment patches. + From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> + + * util/ntptime.c: MNT options + From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> + + * ntpd/ntp_refclock.c (refclock_newpeer): Lose "extra" free(). + From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> + + * configure.in: 4.0.99k18 and auto* upgrade + +2001-03-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpdc/ntpdc_ops.c (printpeer): No more "valid". + * ntpd/ntp_request.c (peer_info): No more "valid". + * ntpd/ntp_refclock.c (refclock_transmit): valid/hpoll cleanup. + * ntpd/ntp_proto.c (transmit): valid/hpoll and peer->ttl cleanup. + peer->valid/oreach cleanup. + (receive): Call newpeer() with the pkt->ppoll, not + NTP_MINDPOLL (in several places). + In AM_NEWPASS, if we have a NULL peer, return. + (poll_update): Added xpoll definition, fixed oldpoll definition. + Algorithmic improvements. + * ntpd/ntp_peer.c (newpeer): Better minpoll/maxpoll + initialization. + (resetmanycast): That's a poll_update() on an MDF_ACAST, not a + poll_clear(). + * ntpd/ntp_crypto.c: include <fcntl.h>. + (crypto_recv): Leave the crypto_flags alone when wiggling the + peer-> stuff. + (crypto_cert): Make room for daddy. Do a real open() on the cert + file. Read the cert. Initial hack and slash. Better debug info. + * ntpd/ntp_control.c: CP_VALID now does "unreach". + (ctl_putpeer): Ditto. + * include/ntp_request.h: info_peer gets a placeholder for "valid". + * include/ntp_crypto.h (CRYPTO_FLAG_CERT): Comment update. + * include/ntp.h: Lose "valid" from struct peer. + From: Dave Mills. + +2001-03-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): hpoll calc logic cleanup. + (receive): New cert stuff. + (poll_update): Improvements. + (peer_clear): New cert stuff. + (peer_xmit): New cert stuff. + * ntpd/ntp_crypto.c: New cert stuff, documentation cleanup. Lose + extraneous poll_uopdate()s. + * ntpd/ntp_control.c: Deal with new cert stuff. + * ntpd/ntp_config.c (getconfig): Handle CONF_CRYPTO_CERT. + * include/ntp_crypto.h (CRYPTO_FLAG_CERT): Added. + (CRYPTO_CERT): Added. + (CRYPTO_CONF_CERT): Added. + Add declaration for struct value certif. + * include/ntp_control.h (CS_CERTIF): Added. + (CP_CERTIF): Added. + * include/ntp_config.h (CONF_CRYPTO_CERT): Added. + * include/ntp.h (TEST10,TEST11): New meaning. Add certif to + struct peer. + (FLAG_PROVEN): Added. + (MAX_EXT_LEN): Removed. + exten grew from 672/4 to 5000/4 for PUBKEY. + From: Dave Mills. + +2001-03-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): Documentation cleanup. + (receive): Watch for NULL peer->pubkey.ptr (TEST11). + (poll_update): peer->nextdate, not ->outdate. More cleanup around + the disabled PUBKEY chunk. + * ntpd/ntp_crypto.c (make_keylist): ltemp might be smaller than + sys_automax - check peer->kpoll, too. Other ltemp cleanup. + (crypto_recv): fstamp is a PUBKEY-only variable. + * include/ntp.h (NTP_AUTOMAX): 13, not 12. + From: Dave Mills. + +2001-03-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): hpoll cleanup. Call clock_select() + after calling poll_update, not before. + (receive): Call poll_update after crypto_recv if FLAG_SKEY. + (process_packet): Set peer->ppoll Later. + (poll_update): peer->hpoll sanity checking. Set peer->outdate, + not ->nextate, when burst > 0. MDF_ACAST cleanup. + (clock_select): Fix hpoll typo in call to poll_update(). + * ntpd/ntp_crypto.c (crypto_xmit): tstamp's value is a function of + PUBKEY. + * include/ntp.h (clear_to_zero): #define value is a function of + AUTOKEY. + From: Dave Mills. + +2001-02-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): Documentation/code update. + (poll_update): Sanity check peer->hpoll. Improve debug info. + (peer_clear): Improve debug info. Turn off FLAG_ASSOC in addition + to FLAG_AUTOKEY. + (clock_select): peer->status is CTL_PST_SEL_DISTSYSPEER, and don't + call poll_update(). Make each entry in the peer_list a + CTL_PST_SEL_SELCAND sooner, too. Rework similar logic later on. + Change debug level on some info. + (peer_xmit): Check peer->flags using FLAG_ASSOC, not + CRYPTO_FLAG_AUTO in a couple places. Don't call poll_update() if + sendlen > LEN_PKT_NOMAC. + * ntpd/ntp_loopfilter.c (local_clock): Improve debug info. + Sanity-check sys_poll sooner. + * ntpd/ntp_crypto.c: New artwork. + (COOKIE_LEN,AUTOKEY_LEN,VALUE_LEN): New. + (make_keylist): More debug info. Use FLAG_ASSOC, not + CRYPTO_FLAG_ASSOC. + (crypto_recv): More debug info. Clean up/improve sanity checks on + CRYPTO_ASSOC and CRYPTO_RESP packets, and in other places. + (crypto_xmit): Clean up/improve sanity checks on CRYPTO_ASSOC and + CRYPTO_RESP packets. Use FLAG_ASSOC, not CRYPTO_FLAG_ASSOC. More + debug info. + * include/ntp.h (NTP_CANLOCK): Lose it. + (clear_to_zero): is now "assoc". + (FLAG_ASSOC): Added. + From: Dave Mills + +2001-02-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpdate/ntpdate.h (NTP_MAXAGE): Added. + * ntpd/ntp_refclock.c (refclock_receive): Cleanup. + * ntpd/ntp_proto.c (transmit): Don't reset peer->ppoll in one case. + Update peer->hpoll based on CTL_PST_SEL_CORRECT, not FLAG_SYSPEER. + Don't update peer->ppoll based on MDF_[BM]CAST. + (peer_clear): ppoll is initialized to maxpoll. + (clock_select): call poll_update(peer->hpoll) earlier. + (peer_xmit): Call poll_update later. + * ntpd/ntp_peer.c (peer_config): Rework initial values of [hkp]poll. + * ntpd/ntp_loopfilter.c (CLOCK_PHI): Added. Deal with other + (allow_*) stuff. Treat Windows/NT the same as others regarding + panic steps. Deal with tinker stuff. + * ntpd/ntp_config.c: Tinker stuff. + * ntpd/cmd_args.c (getCmdOpts): -g now wiggles "allow_panic" + (renamed from "correct_any"). -x now wiggles "allow_step" + (renamed from "allow_step_backward"). + * include/ntpd.h: Add tinker variables. Rename/rework variables + associated with "permission to step" and "permission to make a + panic correction" + * include/ntp_config.h (CONFIG_TINKER): Added. + (CONF_CLOCK_MAX): Tinker keyword + (CONF_CLOCK_PANIC): Tinker keyword + (CONF_CLOCK_PHI): Tinker keyword + (CONF_CLOCK_MINSTEP): Tinker keyword + * include/ntp.h (NTP_MINCLOCK): Tinker and other cleanup. + From: Dave Mills + +2001-02-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): Don't peer_clear() and reset + minpoll unconditionally; make sure the peer is configured. + (poll_update): When updating peer->ppoll, check on BCAST and + MCAST, not ACAST + (peer_clear): PUBKEY cleanup. Zero out the peer structure + earlier. Initialization cleanup/fixes. + (peer_xmit): CRYPTO_FLAG_AUTO is in peer->flags now. + (key_expire): Debug output. + * ntpd/ntp_peer.c (unpeer): PUBKEY cleanup. + (newpeer): peer variable setup cleanup. + * ntpd/ntp_crypto.c (make_keylist): Keep CRYPTO_FLAG_AUTO in + peer->flags, not crypto_flags. + (crypto_xmit): Ditto. + (crypto_recv): Fix up RV_TSP logic (several places). + * include/ntp.h (clear_to_zero): Moved... + From: Dave Mills. + +2001-02-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (peer_xmit): Crypto-related fixes + From Dave Mills. + + * ntpd/ntp_crypto.c (crypto_recv): Allocate space for the trailing + NUL on the keystr. + +2001-01-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k17 + + * ntpd/refclock_local.c (STRATUM): 3 -> 5 + * ntpd/ntp_proto.c: sys_maxd -> sys_selerr, sys_epsil -> + sys_syserr. various cleanups and improvements. + From: Dave Mills. + +2001-01-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k16 + + * config.h.in: Regenerated - became empty somehow. + Reported by John.Hay@icomtek.csir.co.za + + * ntpd/ntp_proto.c (clock_select): Fix sdisp calculation. + From Dave Mills. + + * util/ntp-genkeys.c: + * ntpd/refclock_chu.c: + * ntpd/refclock_atom.c: + * ntpd/ntpd.c: + * ntpd/ntp_loopfilter.c: + * ntpd/ntp_io.c: + * ntpd/cmd_args.c: + * libntp/audio.c: + * include/l_stdlib.h: + * html/copyright.htm: + Lint fixes (Thanks bunches!) + From: Marc.Brett@westerngeco.com + +2001-01-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k15 + + * ntpd/ntp_proto.c (clock_select): Track error[] items sooner. + Typo grabbing the dtemp value and in the sdisp calculation. + From Dave Mills. + +2001-01-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k14 + + * ntpd/ntp_proto.c: Change description of sys_rootdelay and + sys_rootdispersion. + (process_packet): Fix p_del test (bad distance). + (process_packet): Fix bad synch distance test. + (process_packet): Fix call to clock_filter (p_disp) + (clock_update): Fix sys_rootdelay calculation. + (clock_filter): Initialize jit to f(sys_precision) + (clock_filter): Update jit using distance[i] instead of + SQUARE(). peer->jitter uses dtemp instead of SQUARE(). + (clock_filter): Updated CLOCK_SGATE checks. When printing debug + info, show jitter along with popcorn spike. + (clock_select): New sdisp calc. + (root_distance): New return value calc. + (peer_xmit): xpkt.rootdispersion value change. + * include/ntp.h (CLOCK_SGATE): Popcorn spike gate (Whoa, Molly!) + From Dave Mills. + +2001-01-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * config.sub (Repository): Updated. + * config.guess (Repository): Updated. + + * ntpd/ntp_loopfilter.c (local_clock): Just use sys_jitter in the + calculation for rootdispersion. + From Dave Mills. + +2001-01-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): Fix documentation. Set + peer->outdate and call poll_update in a new place. Sanity checks + in the MODE_BROADCAST case. + (clock_select): Track the old peer. Use the old peer in + subsequent checks, where appropriate. Clean up unpeer() logic. + From Dave Mills. + +2001-01-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_chu.c: Start using HAVE_AUDIO. + * ntpd/ntp_proto.c (clock_select): If about to discard an + ephemeral association, do it only if not the system peer. + From Dave Mills. + + * html/pic/wingdorothy.gif: + * html/pic/bustardfly.gif: + * html/pic/boom3a.gif: + * html/pic/tonea.gif: + * html/pic/stack1a.jpg: + * html/pic/pogoa.gif: + * html/pic/pogo8.gif: + * html/pic/pogo6.gif: + * html/pic/pogo5.gif: + * html/pic/pogo4.gif: + * html/pic/pogo3.gif: + * html/pic/pogo1.gif: + * html/pic/oz2.gif: + * html/pic/flatheads.gif: + * html/pic/boom4.gif: + * html/pic/boom3.gif: + * html/pic/appletree.gif: + * html/pic/alice51.gif: + * html/pic/alice44.gif: + * html/pic/alice35.gif: + * html/pic/alice31.gif: + * html/pic/alice15b.gif: + * html/pic/alice13.gif: + * html/pic/alice11.gif: + * html/release.htm: + * html/rdebug.htm: + * html/prefer.htm: + * html/porting.htm: + * html/ntptrace.htm: + * html/ntpq.htm: + * html/ntpdate.htm: + * html/monopt.htm: + * html/kernpps.htm: + * html/index.htm: + * html/hints.htm: + * html/gadget.htm: + * html/driver7.htm: + * html/copyright.htm: + * html/config.htm: + * html/build.htm: + * html/authopt.htm: + * html/assoc.htm: + * html/accopt.htm: + Cleanup from Dave Mills. + +2000-12-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k13 + + * ntpd/refclock_wwv.c (wwv_start): Call audio_init with DEVICE_AUDIO. + * ntpd/refclock_irig.c (irig_start): Call audio_init with DEVICE_AUDIO. + * ntpd/refclock_chu.c: Documentation cleanup. + (DEVICE_AUDIO): Added. + (fd_audio): Added. + (chu_start): Separate audio from serial device. + (chu_receive): Rewrite - get data from serial or audio device as + appropriate. + (chu_audio_receive): Renamed (from chu_receive) to allow both + audio and serial capability. + (chu_serial_receive): Ditto. + (chu_decode): Do the Right Thing based on audio/serial data. + * ntpd/ntp_refclock.c (refclock_open): Check for failure using <0 + instead of ==-1. + * libntp/audio.c: Header cleanup, and remove + HAVE_STRUCT_AUDIO_INFO_* related fields. + (audio_init): Func arg is device to attempt to open. + * include/audio.h (audio_init): Now takes a char * argument. + From Dave Mills. + + * configure.in (ntp_refclock): HAVE_AUDIO added. Remove + HAVE_STRUCT_AUDIO_INFO_* stuff; Dave rewrote the audio stuff. + +2000-12-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k12 + +2000-12-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/release.htm: + * html/patches.htm: + * html/measure.htm: + * html/confopt.htm: + * html/clockopt.htm: + * html/biblio.htm: + * html/authopt.htm: + * html/assoc.htm: + Updates from Dave Mills. + + * include/ntp_crypto.h: Make sure crypto_flags is visible. + From Dave Mills. + +2000-12-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (process_packet): pleap/pstratum. + (peer_xmit): Use CRYPTO_FLAG_AUTO. + * ntpd/ntp_crypto.c (make_keylist): Use CRYPTO_FLAG_AUTO. Only + sign host name and timestamps if the clock is synched. + * include/ntp_crypto.h (CRYPTO_FLAG_AUTO): Added. + From: Dave Mills + +2000-12-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (transmit): Call clock_select in a few new + places. BURST/IBURST cleanup. Don't turn off FLAG_BURST at the + EOburst. + (receive): Set peer->unreach = 0 before we call process_packet(). + (process_packet): ditto, before calling poll_update(). Lose some + debugging, MODE_BCLIENT/CLIENT cleanup. + (poll_update): Bump nextupdate on FLAG_REFCLOCK, not _REFCLOCK or + _IBURST. + (peer_clear): Don't set IBURST on MDF_BCLNT. + From: Dave Mills. + + * ntpdate/ntpdate.c (alarming): Appease ansi2knr. + +2000-12-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_control.c (ctl_putpeer): CP_TTL and CP_TTLMAX + MDF_ACAST and MDF_MCAST cleanup. + + * ntpd/refclock_wwv.c (wwv_start): ttlmax/ttl cleanup. + * ntpd/refclock_usno.c (usno_timeout): ttlmax/ttl cleanup. + * ntpd/refclock_parse.c (CLK_REALTYPE): ttlmax/ttl cleanup. + * ntpd/refclock_chu.c (chu_start): ttlmax/ttl cleanup. + * ntpd/refclock_acts.c (acts_timeout): ttlmax/ttl cleanup. + * ntpd/ntp_refclock.c (refclock_newpeer): Don't do the + any_interface -> loopback_interface trick. + * ntpd/ntp_proto.c (transmit): Broadcast/manycast cleanup. + * ntpd/ntp_peer.c: Cleanup. + * ntpd/ntp_io.c: Cleanup. + * ntpd/ntp_crypto.c (crypto_recv): AUTOKEY based on BCLNT, not MCAST2. + * include/ntpd.h: Declare findbcastinter(). + * include/ntp.h: struct peer's ttlmax is now max ttl/refclock + mode. ttl is now ttl for manycast mode. + (FLAG_MCAST): Reworked several FLAG_ bits. + From Dave Mills. + +2000-12-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpq/ntpq.c: CP_TTLMAX support. + * ntpd/ntp_proto.c (transmit): MDF_ACAST ttl fixes. + * ntpd/ntp_peer.c (resetmanycast): Reset ttl if MDF_ACAST. + (peer_config): Save max ttl in ttlmax. + * ntpd/ntp_control.c: ttlmax support. + * include/ntp_control.h (CP_TTLMAX): Added. + * include/ntp.h: Added ttlmax to struct peer. + Dave Mills. + +2000-12-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (receive): That any_interface is now an + rbufp->dstadr. + Various other doc and code cleanup. + * ntpd/ntp_peer.c (findmanycastpeer): Fixes + From Dave Mills + +2000-12-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_request.c (do_conf): call peer_config with + any_interface, not 0. + * ntpd/ntp_proto.c (transmit): Manycast cleanup + * ntpd/ntp_peer.c (findmanycastpeer): manycast cleanup + * ntpd/ntp_io.c (sendpkt): Only check ttl if we have a ttl + (findinterface): Cleanup + * ntpd/ntp_control.c: cleanup + * include/ntpd.h: Added resetmanycast. + * include/ntp_control.h (CP_TTL): disp -> ttl + * ntpq/ntpq.c: disp -> ttl + From Dave Mills + +2000-11-26 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k11 + + * ntpd/ntp_proto.c (transmit): + * ntpd/ntp_peer.c: + * ntpd/ntp_io.c: + * ntpd/ntp_control.c (ctl_putpeer): + * ntpd/ntp_config.c (getconfig): + * include/ntpd.h: mcast/ucast interface cleanup. + From: Dave Mills + + * include/ntp_request.h: Put data[] as MAXFILENAME+16. This will + fix the conf_peer requests again, but re-break compatibility with + old versions of the daemon. Sigh. + + * util/ntp-genkeys.c (cleanlinks): Don't do it if nosymlinks. + +2000-11-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_parse.c (rawdcf_init_1): make Linux happier with + some modem control stuff. + From: Wolfram Pienkoss <wp@bszh.de> (via Frank Kardel) + + * ntpd/refclock_pcf.c (pcf_poll): isdst fix + From: Andreas Voegele <andreas.voegele@gmx.de> + +2000-10-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k10 + + * ntpd/refclock_wwvb.c (wwvb_start): Cosmetic reorder. + * ntpd/refclock_atom.c (RANGEGATE): Cleanup. Add ASTAGE. + Add ppsparams to struct ppsunit. + (atom_start): Init peer->burst to ASTAGE. + (atom_shutdown): Multi-handle + (atom_pps): Multi-handle + (atom_pps): RANGEGATE cleanup + (atom_poll): Poll count cleanup. Error check cleanup. Burst cleanup. + * ntpd/ntp_refclock.c (refclock_transmit): Lose the pre-burst + check poll_update(). + (refclock_sample): Fix the jitter calc. + (refclock_receive): Pass the jitter to the clock_filter(). + + * ntpd/ntp_proto.c (clock_update): If we lose sync, reset the poll + to NTP_MINDPOLL. + (poll_update): Poll wiggles. Make sure peer->nextdate is timely. + (clock_select): If we lose sync, reset the poll to NTP_MINDPOLL. + * ntpd/ntp_loopfilter.c (local_clock): Show the asocid in debug + output. popcorn debug message changes. Clamp the poll interval + if the system peer has changed. PPS wiggle changes. + From Dave Mills. + +2000-10-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_pcf.c (pcf_start): + * html/driver35.htm: + The radio clock transmits 69 bits with a period of 2.5 + milliseconds per bit. Thus the driver now sets the default + calibration offset to 0.1725 (69 * 2.5 = 172.5). + Its now possible to disable the check of the radio clock's + synchronisation status bit. Several users requested this option. + From: Andreas Voegele <andreas.voegele@gmx.de> + + * html/refclock.htm: + * html/rdebug.htm: + * html/prefer.htm: + * html/pps.htm: + * html/ntpdc.htm: + * html/miscopt.htm: + * html/ldisc.htm: + * html/kern.htm: + * html/index.htm: + * html/exec.htm: + * html/driver22.htm: + * html/clockopt.htm: + Updates from Dave Mills + + * ntpd/ntp_intres.c (request): Sanity check the size of the response + +2000-10-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpq/ntpq_ops.c (dopeers): Dave didn't like the patch to show + the units on the times... + * ntpdc/ntpdc_ops.c (doset): SYS_FLAG_PPS cleanup + * ntpd/refclock_wwv.c (wwv_newchan): Update the peer refid if + we're talking to a stratum 0 source + * ntpd/refclock_trak.c: Needs PPS + * ntpd/refclock_oncore.c: Disable for now + * ntpd/refclock_mx4200.c: Needs PPSAPI, not PPS + Header cleanup. PPS interface cleanup. + Process sentences with a switch + Cleanup and sanity checks + * ntpd/refclock_datum.c: header cleanup, light body cleanup + * ntpd/refclock_conf.c: CLOCK_TRAK needs PPS + MX4200 needs PPSAPI, not PPS + Disable ONCORE for now + * ntpd/refclock_bancomm.c: Surgery + * ntpd/refclock_atom.c: Cleanup + (atom_control): added + (atom_ppsapi): added + * ntpd/ntp_request.c (setclr_flags): SYS_FLAG_PPS cleanup + * ntpd/ntp_refclock.c: stropts.h back in in TTYCLK and + HAVE_SYS_CLKDEFS_H + Get ntp_syscall if KERNEL_PLL + Define cal_enable + (refclock_receive): Cleanup + (refclock_control): sanity check procptr + * ntpd/ntp_proto.c (init_proto): pps_enable + (proto_config): Turn on/off PPS discipline + * ntpd/ntp_loopfilter.c: pps_enable + (local_clock): record_loop_stats() if !ntp_enable + (local_clock): Turn off PPS if it's not enabled + Other cleanup/fixes + * ntpd/ntp_config.c: pps and calibrate keywords. Initialize + pps_assert to 0, not 1 (swap assert/clear?) + * include/ntpd.h: We have pll_status if KERNEL_PLL + Added pps_enable and cal_enable + * include/ntp_request.h (SYS_FLAG_PPS): Renamed from + SYS_FLAG_AUTHENTICATE + * include/ntp.h (PROTO_PPS): Added + (PROTO_CAL): Added + From: Dave Mills + +2000-09-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/ntp_refclock.h (stropts.h, sys/clkdefs.h): Harmful and + useless file include's turned off. + * libntp/iosignal.c (netinet/in.h, sys/sockio.h): Duplicate file + include's turned off. + * ntpd/ntp_refclock.c (ntp_tty.h): File included. + (refclock_open, refclock_ioctl): Use `TTY' from ntp_tty.h. + * ntpd/refclock_atom.c: Grab a few headers regardless; if we don't + CLOCK_ATOM we provide a stub pps_sample() routine so the WHARTON + can be compiled/used. + * ntpq/ntpq_ops.c (dopeers, doopeers): Print the units for + each column header. + Tue Sep 12 16:25:51 2000 Philippe De Muyter <phdm@macqel.be> + + * ntpd/refclock_atom.c (atom_start): Lose "temp", because we now + initially either CAPTUREASSERT or CAPTURECLEAR. + (atom_pps): pps_info_t is our friend. Update comments to reflect + reality. DTRT with pps_info. Do some overflow checks. + From: Dave Mills. + +2000-09-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Much improved Solaris patch-level check for the + FLL bug test. + From: Marc.Brett@westgeo.com + +2000-09-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/Makefile.am (noinst_HEADERS): Added ntp_tty.h + Reported by Dave Mills + +2000-09-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntptrace/ntptrace.c: + * ntpdate/ntptimeset.c (receive): + * ntpdate/ntpdate.c (receive): + STRATUM cleanup + * ntpd/refclock_atom.c (atom_poll): Autostratum. Lose the leap. + * ntpd/ntp_proto.c: sys_prefer + (process_packet): stratum cleanup + (clock_select): Autostratum the ATOM + * ntpd/ntp_loopfilter.c: pps_update/pps_stratum wiggle. + * include/ntpd.h: Lose pps_update, gain sys_prefer + * include/ntp.h: STRATUM variable cleanup + From Dave Mills + +2000-09-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_oncore.c (oncore_get_timestamp): Print debug + messages being aware of HAVE_STRUCT_TIMESPEC. + + * ntpd/refclock_atom.c: Have pps_params tag along in the ppsunit + structure, where it really belongs. + (atom_pps): Use PPS_CAPTURE{ASSERT,CLEAR} + From: Dave Mills. + +2000-09-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (ac_cv_var_atom_ok): Cleanup ATOM/PPSAPI stuff... + + * scripts/ntp-close: Find "close" ntp servers. + From: Neal McBurnett <neal@bcn.boulder.co.us> + + * ntpd/refclock_conf.c: + * ntpd/refclock_oncore.c: Re-enabled oncore driver for HAVE_PPSAPI + case only. + +2000-09-12 Philippe De Muyter <phdm@macqel.be> + + * ntpd/refclock_parse.c (we400a_pollinfo): Useless variable removed. + [WHARTON slot]: Set NO_POLL, NO_INIT and NO_DATA; fix `fixed format' + and `offset' fields. + + * include/ntp_tty.h: New file + * libntp/icom.c: Use it. + + * ntp_update (UPDATE_OPTIONS): Use -d, too. Fix Pass 1 comment. + +2000-09-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_oncore.c: shmem_fname added. oncore_init_shmem() + updated. + (oncore_start): Comment cleanup + (oncore_read_config): Move call to oncore_shmem_init() + (oncore_init_shmem): Prototype change + (oncore_init_shmem): Don't exit on errors + (oncore_msg_any): timespec/timeval cleanup + (oncore_msg_Cj_id): shmem_fname changes + (oncore_msg_BaEaHa): saw_At bugfix + (oncore_get_timestamp): Added current_mode/current_params. Commented. + Added time_pps_getcap() calls. + From: Reg Clemens <reg@dwf.com> + + * ntpd/ntp_io.c (input_handler): Better recvfrom() error message + From: Dean Gibson <timekeeper@tcp-udp.net> + + * ntpdc/ntpdc.c (passwd): Get them working again. + From: Benjamin Greenwald <beng@lcs.mit.edu> + +2000-09-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_atom.c: + (atom_start): + * ntpd/ntp_refclock.c: Comment cleanup. PPS/PPSAPI cleanup + (refclock_open): PPS/PPSAPI cleanup + From: Dave Mills + + * ntpd/refclock_oncore.c: + * ntpd/refclock_mx4200.c: + HAVE_TIMESPEC -> HAVE_STRUCT_TIMESPEC + + * configure.in: ATOM requires struct timespec, not PPSAPI. Clean + up dependencies accordingly. + +2000-09-09 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (ac_cv_var_atom_ok): Improve ATOM configure message + PARSE requires ATOM. + + * ntpd/ntpd.c (set_process_priority): Clean up debug messages. + +2000-09-07 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: ac_cv_atom_ok, depends on HAVE_PPSAPI. + I notice the PARSE clocks require ATOM. Could be interesting... + +2000-09-06 Harlan Stenn <stenn@whimsy.udel.edu> + + * Makefile.in (distdir): Seems to be a bug in an automake library + somewhere... + +2000-09-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_loopfilter.c (loop_config): V3 API needs MOD_BITS when + initializing ntv.modes. Initialize ntv.{maxerror,esterror,status} + earlier. Clean up KERNEL_PLL code. + +2000-09-04 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpq/ntpq.c: report offset as "offset", not "phase". Lose + compliance. + * ntpd/refclock_local.c (local_poll): variance -> jitter + * ntpd/refclock_chu.c (chu_major): Lose variance. + * ntpd/ntp_util.c (hourly_stats): sys_error -> sys_jitter + (record_loop_stats): ditto + * ntpd/ntp_request.c (peer_info): variance -> jitter + * ntpd/ntp_refclock.c (refclock_sample): variance -> jitter + (refclock_receive): variance -> jitter + * ntpd/ntp_proto.c (process_packet): variance -> jitter + (clock_filter): variance -> jitter + (clock_select): variance -> jitter + (root_distance): variance -> jitter + * ntpd/ntp_peer.c (newpeer): variance -> jitter + * ntpd/ntp_loopfilter.c: Cleanup pll_nano selection bogon. + Centralize the kernel API data. + (local_clock): Lose sys_error. + (loop_config): Code cleanup. + * ntpd/ntp_control.c: Call offset "offset" and not "phase". Lose + CS_COMPLIANCE. Deal with variance/jitter rename. + * include/ntp_refclock.h: Rename variance to jitter in struct + refclockproc. + * include/ntp_control.h (CS_COMPLIANCE): Lose it. + * include/ntp.h: Rename variance to jitter in struct peer. + From: Dave Mills + +2000-09-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_atom.c: Use the new ppsunit. Cleanup and improve + documentation. + * ntpd/ntp_refclock.c (refclock_sample): Don't accumulate + variance. + From Dave Mills + +2000-08-31 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver22.htm: Update the docs. + * ntpd/refclock_atom.c (atom_start): Open the device if it hasn't + been opened already. + (pps_sample): Make it more visible. + From Dave Mills. + + * configure.in: 4.0.99k8 + + Revert to the older automake. + + * configure.in: The PPSAPI headers use "inline", so require a STDC + compiler. + + * ntpd/refclock_atom.c (atom_shutdown): Typo + From Dave Mills + + * configure.in: Convert to autoconf-2.49 + + * ntpd/refclock_atom.c: Header cleanup Comment cleanup. Lose the + TTYCLK stuff. Convert to PPSAPI. + * ntpd/ntp_refclock.c (refclock_newpeer): Move refclock_unpeer(). + From: Dave Mills + +2000-08-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure: Fix the autoconf problem... + +2000-08-20 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 99k7 + + * util/ntptime.c (main): Report TAI stuff + * ntpq/ntpq.c: CS_COMPLIANCE/CS_JITTER cleanup + * ntpd/ntp_loopfilter.c (local_clock): sys_error/sys_jitter cleanup. + kernel PPL cleanup. + * ntpd/ntp_crypto.c: Check NTP_API if we're doing KERNEL_PLL so we + can get the TAI stuff. + * ntpd/ntp_control.c: CS_COMPLIANCE now reports "error" instead of + "jitter". CS_JITTER now reports jitter. + * include/ntpd.h: Added sys_jitter + * include/ntp_control.h (CS_JITTER): Added + From: Dave Mills + + * ntpd/cmd_args.c (getCmdOpts): Crack -N at pre-scan, as we do the + priority wiggle before the final scan. + From: Tom Smith <smith@cag.lkg.dec.com> + We might do better to move the priority wiggle to after the final + scan. Especially if we want to permit command-line options to + have decent control over the priority. When we rewrite the config + file stuff we might go to a multi-scan to solve some of these + problems. + +2000-08-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: '99k6, and manually fix configure. + + * include/ntp_request.h (NTP_MAXHOSTNAME): 144 -> 32 + +2000-08-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): Don't call fclose if stream is NULL. + +2000-08-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver35.htm: + * ntpd/refclock_pcf.c: Updates and improvements + From: Andreas Voegele <andreas.voegele@gmx.de> + + * configure.in (ac_cv_struct_ntptimeval): Lose the TAI check - we + don't need it since we can check NTP_API. Re-hack the generated + configure script. + + * configure: Manual hack to the ntptimeval.time.tv_nsec stuff + because we're running an old autoconf. + +2000-08-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntptime.c: Use: HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC, it's + the standard name. + + * configure.in: Look for struct ntptimeval.tai in sys/timex.h + Cleanup struct tptimeval member tests. + + * util/ntp-genkeys.c: New command-line arguments + +2000-08-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): More small steps... + +2000-08-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_crypto.c (crypto_rsa): Now that we're using + NTP_KEYSDIR, make sure there is a '/ between the dir and the file. + + * util/ntp-genkeys.c (main): More small steps... + +2000-08-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): Another small step... + + * configure.in: 99k5 + + * include/ntp_request.h: Make data[] member of req_pkt 32 again. + Bump the version number... + + * ntpd/ntp_loopfilter.c (local_clock): Change 0. to 0 in a couple + of places. + From Dave Mills + +2000-08-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): Minimal progress... + +2000-08-06 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/check_y2k.c: Make debug definition match ntpd.h's declaration + + * ntpd/Makefile.am (check-local): Use test in favor of [ + +2000-08-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in (NTP_KEYSDIR): Typo + +2000-08-04 Harlan Stenn <stenn@whimsy.udel.edu> + + * ElectricFence/Makefile.am (check-local): use test instead of [ + + * configure.in: AC_REPLACE_FUNCS(strdup) + * libntp/strdup.c (strdup): Added. + * libntp/Makefile.am (EXTRA_libntp_a_SOURCES): Added strdup.c + + * util/Makefile.am (ntp_genkeys_DEPENDENCIES): Use $U on .o files + (ntp_genkeys_LDADD): ditto. + + * ntpd/ntp_crypto.c: Use NTP_KEYSDIR + + * util/ntp-genkeys.c (snifflink): Ignore ENOENT, too. + + * ntpd/ntp_proto.c (peer_xmit): Crypto cleanup + * ntpd/ntp_crypto.c: Cleanup + * ntpd/ntp_control.c: Join the club + * ntpd/ntp_config.c: Call crypto_config() instead; we got rid of + crypto_flags. + * include/ntp_crypto.h (CRYPTO_FLAG_ENAB): New crypto flags, rework + * include/ntp_control.h (CS_FLAGS): Wiggle in. + * include/ntp.h: Added crypto peer status to struct peer + From Dave Mills + +2000-08-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c: Initialize path_keysdir to NTP_KEYSDIR. + + * configure.in (NTP_KEYSDIR): Added + * acinclude.m4: Added AC_DEFINE_DIR macro + + * util/ntp-genkeys.c (main): Sanity checks on the file paths. + +2000-08-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (crypto_config): Only #ifdef PUBKEY + (PATH_MAX): Try harder... + +2000-08-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): Use snifflink() + (snifflink): Implement... + + * configure.in: Check for readlink() + +2000-07-31 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (main): Use strdup on the tokens returned + from ntp_config... + (crypto_config): Fix a typo... + (crypto_config): Even more... + (usage): Flesh it out. + + * include/ntp_config.h: + * ntpd/ntp_config.c: Move a whack of #defines to ntp_config.h so + ntp-genkeys.c can see them, too. + + * util/ntp-genkeys.c: Add stubs to work with ../ntpd/ntp_config.o, + start hooking things up. + (main): debugging + (crypto_config): better implementation + + + * ntpd/ntp_config.c (getconfig): + * ntpd/ntpd.c: Initialize "debug" here, not in ntp_config.c + + * util/Makefile.am (ntp_genkeys_LDADD): Added ../ntpd/ntp_config.o + * util/Makefile.am (ntp_genkeys_DEPENDENCIES): Added. + +2000-07-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99k4 + * util/ntp-genkeys.c: Start hacking for new functionality. + * include/Makefile.am (noinst_HEADERS): Added ntp_cmdargs.h and + ntp_config.h . + * ntpd/ntp_config.c: Grab ntp_cmdargs.h. Make some new globals + (ugh), move ntpd-specific variables and code to cmd_args.c . + * ntpd/cmd_args.c: Move command argument processing functions from + ntp_config.c to this file. + * ntpd/Makefile.am (ntpd_SOURCES): Added cmd_args.c + * include/ntpd.h: Move getstartup() to ntp_cmdargs.h + * include/ntp_cmdargs.h: New file + Begin the hacking fest to make it easier for ntp-genkeys to use + ntpd's config processing code. I really hope this is the lesser + of the evils... + +2000-07-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp-genkeys.c (usage): Added. + + * ntpd/ntp_crypto.c: Cleanup + * ntpd/ntp_proto.c (transmit): Add some parens. + (peer_xmit): Add ntohl when grabbing sndauto.seq for broadcast. + * ntpd/ntp_peer.c (findpeer): Cleanup + * ntpd/ntp_loopfilter.c (local_clock): Typo + From Dave Mills + + * include/ntp_config.h: Created + + * util/ntp-genkeys.c: Always build, but realize we may not have + RSAREF. Compile parts appropriately. + + * util/Makefile.am (bin_PROGRAMS): Always make ntp-genkeys + (ntp-genkeys_LDADD): Use $LIBRSAREF instead of the "real path" + * configure.in: Lose MAKE_NTP_GENKEYS + + * configure.in: + * util/ntp-genkeys.c: + * util/Makefile.am: + Renamed ntp_genkeys to ntp-genkeys. + +2000-07-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpdate/ntpdate.c (ntpdatemain): Cleanup error message. + + * ntpdate/ntpdate.c (ntpdatemain): Add missing authtrust() call + From: Jason Heiss <jheiss@cruzeiro.ugcs.caltech.edu> + + * ntpd/refclock_ulink.c (ulink_receive): + * ntpd/ntp_crypto.c: + * libntp/authparity.c: + Lint/noise cleanup + From: Marc Brett <mbrett@rgs0.london.waii.com> + + * ntpd/ntp_proto.c: Specifically track manycastserver and + survivors + From: Dave Mills + +2000-07-26 Sven Dietrich <sven_dietrich@trimble.com> + + * ntpd/ntpd.c: remove WINNT priority adjustment to the ports/winnt area + where it does not clutter up the main distribution. + +2000-07-24 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (receive): dstadr_sin needs higher visibility + From: Dave Mills + + * flock-build: Added baldwin + + * ntpd/ntp_request.c: + * ntpd/ntp_proto.c: + * ntpd/ntp_peer.c: + * ntpd/ntp_io.c: + * ntpd/ntp_intres.c: + * ntpd/ntp_crypto.c (make_keylist): + * ntpd/ntp_control.c: + * ntpd/ntp_config.c (CONF_MOD_IBURST, save_resolve): + * include/ntpd.h (findpeerbyassoc, newpeer, peer_config, *_interface): + * include/ntp_request.h (CONF_FLAG_IBURST): + * include/ntp_crypto.h (crypto_xmit, make_keylist): + * include/ntp.h (FLAG_IBURST): + * html/release.htm: + * html/confopt.htm: + * html/assoc.htm: + Add iburst option, fix broadcast/multicast and some types. + From: Dave Mills + +2000-07-20 Harlan Stenn <stenn@whimsy.udel.edu> + + * scripts/Makefile.am (bin_SCRIPTS): Install ntp-wait + + * configure.in: 4.0.99k + +2000-07-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_proto.c (peer_xmit): PUBKEY cleanup + +2000-07-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99j5 + + * html/ntpd.htm (HREF): Document other missing command-line options + + * html/ntpd.htm (HREF): Document + * html/confopt.htm (href): Undocument + * ntpd/ntp_config.c (getconfig): -N high for high-priority. + Lose the ntp.conf way of setting priority. + + * ntpd/ntp_crypto.c: PUBKEY/AUTOKEY cleanup + From Dave Mills + +2000-07-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/confopt.htm (href): Document it. + * ntpd/ntp_config.c (getconfig): CONFIG_PRIORITY support + * ntpd/ntpd.c (set_process_priority): Use it. + + * ntpd/ntp_crypto.c: Crypto key stuff + * ntpd/ntp_proto.c: pubkey -> pubkey.ptr + * ntpd/ntp_control.c (ctl_putpeer): fstamp -> pubkey.fstamp + * ntpd/ntp_peer.c: + * include/ntpd.h: + * include/ntp_types.h: + * include/ntp_request.h: + * include/ntp_crypto.h: + * include/ntp_control.h: + * include/ntp.h: Type cleanup + From: Dave Mills + +2000-07-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * ElectricFence/Makefile.am (check-local): Don't run the tests if + we didn't build the programs... + (check-local): Same, but watch the return codes... + + * ElectricFence/page.c: #include config.h if it's there. + Properly handle the sys_errlist declaration. + + * html/ntpq.htm: + * html/index.htm: + * html/debug.htm: + * html/authopt.htm: + Reality check. + From Dave Mills + +2000-07-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * Makefile.am (SUBDIRS): Added ElectricFence + * configure.in (AC_CONFIG_FILES): Added ElectricFence support + * ElectricFence: Imporpted. + +2000-07-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/ntp_genkeys.c (main): Cleanup + * ntpd/refclock_wwv.c (wwv_qrz): sqrt -> SQRT + * ntpd/refclock_chu.c (chu_rf): sqrt -> SQRT + * ntpd/ntpd.c (set_process_priority): Disable high-priority for now. + PUBKEY cleanup. + * ntpd/ntp_timer.c: sys_revoketime cleanup. + * ntpd/ntp_proto.c (receive): PUBKEY cleanup. Comment and code + cleanup. + (process_packet): Comment and code (PUBKEY) cleanup. + (peer_xmit): Comment and code cleanup. + (fast_xmit): Comment and code cleanup. + * ntpd/ntp_peer.c (expire_all): revoketime cleanup. PUBKEY cleanup. + * ntpd/ntp_crypto.c: Comment reorg. DH parameters are now + file-static instead of local to subroutines. + (make_keylist): peer->pcookie.key cleanup/fix + (crypto_recv): Subroutine documentation cleanup, other cleanup + (crypto_xmit): Cleanup/document. + (crypto_setup): Cleanup/document. + (crypto_agree): Cleanup/document. + (crypto_rsa): now static + (crypto_dh): now static. Comment cleanup. Code cleanup. + (crypto_tai): now static. Code and comment cleanup. + (crypto_config): Deal with CRYPTO_CONF_LEAP. + * ntpd/ntp_control.c (CS_DHPARAMS): Rename corresponding token to + "params". Remove CS_TAI from def_sys_var[]. + (ctl_putsys): CS_HOST, CS_DHPARAMSm CS_REVTIME, and CS_LEAPTIME + bugfix. CS_TAI cleanup. + * ntpd/ntp_config.c (CONF_CRYPTO_LEAP): Added + (getconfig): Added CONF_CRYPTO_LEAP support. + * include/ntp_syslog.h: Lose GIZMO stuff. + * include/ntp_crypto.h (CRYPTO_CONF_LEAP): Added + * include/ntp.h: struct autokey, cookie,value, and pkt changes for + signature field. Update the inline docs on pkt's exten field. + From: Dave Mills + + +2000-07-08 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_util.c (stats_config): If we read a bogus old_drift, + use 0 instead of failing. + +2000-07-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * README.cvs: Cleanup. + + * ntpd/refclock_datum.c (datum_pts_poll): index -> unit_index + * ntpd/ntp_resolver.c (findhostaddr): const cleanup + * libntp/recvbuff.c: + * libntp/msyslog.c: + * libntp/emalloc.c: + * libntp/authreadkeys.c: + Fix header order. + From: Simon Burge <simonb@netbsd.org> + + * ntpd/ntp_util.c (stats_config): Use HAVE_FINITE and HAVE_ISFINITE + * configure.in (ac_cv_struct_ntptimeval_timespec): isfinite() + checks for HP-UX11. + From: Albert Chin-A-Young <china@thewrittenword.com> + +2000-07-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * flock-build (LIST): Lose malarky, update some machine/OS descriptions + + * configure.in: 4.0.99j4 + + * ntpq/ntpq.c: Lose PUBKEY stuff - older ntpq's will complain when + they see the info in a packet. + * ntpd/ntp_proto.c (peer_xmit): TAI changes. + * ntpd/ntp_crypto.c: Fix host/network byteorder stuff. Follow + global->struct changes. TAI changes. Bugfixes. + * ntpd/ntp_control.c: Follow field reorder/rename. + * include/ntp_crypto.h: Move crypto stuff from separate globals + into structs. + * include/ntp_control.h (CS_HOST): Reorder/rename some fields + From: Dave Mills + +2000-06-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_peer.c (unpeer): Moved keystr cleanup inside ifdef PUBKEY + + * configure.in: 4.0.99j3 + + * html/release.htm: + * html/ntpq.htm: + * html/authopt.htm: + Updates from Dave Mills + + * ntpd/ntp_request.c (dns_a): Don't call crypto_public for now... + * ntpd/ntp_proto.c (receive): Follow the TEST wiggles + (peer_xmit): TAI support + * ntpd/ntp_crypto.c: TAI support + * ntpd/ntp_control.c: CS_VERSION and CS_TAI support + * include/ntp_crypto.h (CRYPTO_FLAG_TAI): Added. + * include/ntp_control.h (CS_VERSION): Added. + * include/ntp.h (TEST4,TEST5,TEST8,TEST9): Wiggle. + From: Dave Mills + + * ntpd/Makefile.am (ntpd_SOURCES): Lose refclock_ulink331.c + because the new refclock_ulink.c handles it. + +2000-06-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_config.c (getconfig): Sanity check the right variable + From: Dave Mills. + +2000-06-25 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99j2 + + * ntpd/ntp_proto.c: + * ntpd/ntp_peer.c: + * ntpd/ntp_crypto.c: + * include/ntp_crypto.h: + * include/ntp.h: + AUTOKEY/PUBKEY/DH/crypto changes + From: Dave Mills + +2000-06-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver34.htm: + * ntpd/refclock_ulink.c: + * ntpd/refclock_ulink331.c: (removed) + Updated for 320/330 series refclocks + From: joseph lang <tcnojl1@earthlink.net> + + * ntpd/refclock_oncore.c: Patches/improvements + * html/driver30.htm: New release + From: Reg Clemens <reg@orion.dwf.com> + +2000-06-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99j1 + + * ntpdc/ntpdc.c (getcmds): + * configure.in: + Readline support. + From: Aaron Sherman <ajs@narn.ajs.com> + + * ntpd/refclock_ulink331.c: Added. + Sent in by Doug Grosso <dgrosso@mint.net> + * ntpd/Makefile.am (ntpd_SOURCES): Added refclock_ulink331.c + + * libntp/snprintf.c: Added stdio.h + From: Marc Brett <mbrett@rgs0.london.waii.com> + + * include/ntp.h: struct autokey's siglen is u_int32. So is the + siglen in struct cookie. So is siglen and value length in struct + value. Add fstamp to struct peer. Resize the exten AUTOKEY field + in struct pkt. + * include/ntp_crypto.h: crypto_enable -> crypto_flags and a + variety of other cleanups. + * ntpd/ntp_config.c: crypto_enable -> crypto_flags, and some + key/fudge cleanup. + * ntpd/ntp_control.c: Much cleanup. + * ntpd/ntp_crypto.c: Many changes that Harlan is too tired to + properly document. + * ntpd/ntp_peer.c: crypto_enable -> crypto_flags + (peer_config): Hold off on crypto_public() until some resolver + issue is fixed. + * ntpd/ntp_proto.c (receive): Disable the reverse DNS lookup for now. + (process_packet): Don't record_raw_stats() for now. + crypto_enable was renamed to crypto_flags. + (peer_xmit): In MODE_ACTIVE or MODE_PASSIVE, only call + crypto_xmit() if the peer->cmmd is not CRYPTO_AUTO. Reset + peer->cmmd to 0 when we're thru. + Don't reset peer->cmmd to 0 until the end of MODE_CLIENT. + * ntpd/ntpd.c: Lose the call to crypto_init(). Instead, call + crypto_setup() later on if we have crypto_flags. + * util/ntp_genkeys.c: Lose GENLEN; use PRIMELEN/2 . + From Dave Mills. + + * ntpd/ntp_crypto.c (crypto_rsa): + (crypto_dh): + Do some debug logging if readlink() fails with something other + than EINVAL (file isn't a symlink). + +2000-06-04 James R. Van Zandt <jrv@vanzandt.mv.com> + + * html/miscopt.htm (trap): punctuation + + * html/ntpd.htm (-g): typo + + * html/miscopt.htm (logconfig): List the "clock" event class. + "allprefix" should be two words. + +2000-05-31 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_timer.c: Protect <unistd.h> + +2000-05-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/Makefile.am: Document what we expect from -lm + +2000-05-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99j + +2000-05-22 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/ntptime.htm: More fixes + From: Kazu TAKAMUNE <takamune@avrl.mei.co.jp> + +2000-05-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * build (KEYSUF): + * flock-build: + * configure.in: Lose the "md5" options from the --with-crypto + check; Dave hates it. + + * ntpd/ntp_util.c (stats_config): + * ntpd/ntp_loopfilter.c (loop_config): + * libntp/systime.c (adj_systime): + * include/ntp_proto.h (NTP_MAXFREQ): + Renamed MAX_FREQ to NTP_MAXFREQ + + * ntpd/ntpd.c (ntpdmain): + * ntpd/ntp_proto.c (receive): + (poll_update): + * ntpd/ntp_intres.c (addentry): + * ntpd/ntp_config.c (getconfig): + Lint cleanup + From: Marc Brett <mbrett@rgs0.london.waii.com> + + * include/ntp_stdlib.h: + * libntp/systime.c (adj_systime): + * ntpd/ntp_loopfilter.c (loop_config): + * ntpd/ntp_util.c (stats_config): + * ports/winnt/ntpd/nt_clockstuff.c (adj_systime): + MAXFREQ -> MAX_FREQ + * include/ntp_proto.h: Define MAX_FREQ + +2000-05-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/ntp_stdlib.h: + * libntp/systime.c (adj_systime): + * ntpd/ntp_loopfilter.c (loop_config): + * ntpd/ntp_util.c (stats_config): + * ports/winnt/ntpd/nt_clockstuff.c (adj_systime): + sys_maxfreq -> MAXFREQ + Per Dave Mills. + +2000-05-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * acinclude.m4: Typo... + +2000-05-13 Harlan Stenn <stenn@whimsy.udel.edu> + + * libntp/gpstolfp.c (GPSORIGIN): Try new ULONG_CONST macro + + * ntpdate/ntptimeset.c: + * ntpdate/ntpdate.h: + * ntpd/refclock_oncore.c (oncore_msg_En): + * ntpd/ntp_util.c (stats_config): + * ntpd/ntp_request.c: + * ntpd/ntp_intres.c (findhostaddr): + * ntpd/ntp_config.c (getconfig): + * libntp/systime.c (adj_systime): + * libntp/lib_strbuf.c: + * libntp/authparity.c: + * libntp/audio.c: + Header/lint cleanup + From/reported by: Simon Burge <simonb@netbsd.org> + + * ntpd/ntp_resolver.c (findhostaddr): Compiler noise cleanup + + * ntpd/ntp_intres.c: Compiler noise cleanup + + * html/ntptime.htm: Document reality check + From: Kazu TAKAMUNE <takamune@avrl.mei.co.jp> + +2000-05-12 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_intres.c (ntp_intres): Quiet some debug messages + Reported by: Brian Bergstrand <brianb@mac.com> + +2000-05-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * scripts/mkver.in (ConfStr): Use -r if we're using RSAREF, + otherwise use -a if we're using autokey, otherwise use no extra + suffix. + +2000-05-11 Sven Dietrich <sven_dietrich@trimble.com> + + * ports/winnt/include/config.h: New defines to support AUTOKEY + * ports/winnt/include/unistd.h: Added another dummy placeholder.h + * ports/winnt/ntpd/ntpd.dsp: Added ntp_crypt.c to makefile + * ports/winnt/ntpd/ntpd.c: service_main needs a local hostname[] + * html/hints/winnt.htm: Add remark about 4.0.99i not compiling. + These changes got WINNT running again. No idea if the keys stuff + works however. + +2000-05-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i9 + + * ntpd/ntp_crypto.c: tstamp and autokey cleanup + From: Dave Mills + + * ntpd/ntp_proto.c (clock_update): Only call expire_all() if + AUTOKEY + From many folks, including Reg Clemens <reg@dwf.com> + +2000-05-07 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i8 + + * flock-build: Use new --with-crypto choices + * build (KEYSUF): Deal with new --with-crypto + * configure.in: --with-crypto={md5,autokey,rsaref}; + lose --enable-autokey + +2000-05-06 Harlan Stenn <stenn@whimsy.udel.edu> + + * build (KEYSUF): Catch --disable-autokey first. + +2000-05-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * flock-build: If we don't use autokey, don't use rsaref either. + + * configure.in: 4.0.99i7 + + * build (KEYSUF): + * flock-build: + It's --disable-autokey now + + * configure.in: MD5 is not optional (but AUTOKEY is) + * include/ntp_stdlib.h: + * libntp/a_md5encrypt.c: + * libntp/authkeys.c: + (authhavekey): + (MD5auth_setkey): + (auth_delkeys): + (authencrypt): + (authdecrypt): + * libntp/authreadkeys.c: + (authreadkeys): + * ntpd/ntp_proto.c (init_proto): + * libntp/authusekey.c: + MD5 is required. + +2000-05-04 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i6 + + * ntpd/ntp_proto.c (transmit): Fix up the UNREACH code. + (receive): Lose some debug code. + (clock_update): expire_all() if LEAP_NOTINSYNC + crypto_xmit() a CRYPTO_AUTO if !FLAG_AUTOKEY instead of recauto.tstamp + crypto_xmit() a CRYPTO_PRIV (not CRYPTO_AUTO) based on pcookie.tstamp + crypto_xmit() a CRYPTO_AUTO (not CRYPTO_PRIV) based on FLAG_MCAST2 + and !FLAG_AUTOKEY + * ntpd/ntp_crypto.c (crypto_recv): Clean up debug output. + Don't AUTOKEY if FLAG_MCAST2 + From: Dave Mills + + * flock-build: Also make obe withouyt md5 (no AUTOKEY) + * build (BDIR): Handle -noautokey build directory suffix + * configure.in: Prepare for AUTOKEY in mkver.in + * scripts/mkver.in (ConfStr): Indicate in the version string if + we're not using AUTOKEY. + +2000-05-03 Harlan Stenn <stenn@whimsy.udel.edu> + + * scripts/ntp-wait.in: Fun things with backspaces + + * configure.in: 4.0.99i5 + + * ntptrace/ntptrace.c: Protect sys/ioctl.h; grab config.h + + * ntpd/ntp_proto.c (transmit): AUTOKEY and tstamp fixes. + (clock_update): Check oleap against LEAP_NOTINSYNC + (peer_clear): Free pubkey when we're done + Check peer's keynumber against the seq in MODE_BROADCAST. + Reorder tstamp changes. + * ntpd/ntp_crypto.c (crypto_recv): Check the packet if we get a + CRYPTO_RESP and reorder the update of tstamp. + (crypto_recv): Don't expire the peer until we're thru with it. + * include/ntp.h: AUTOKEY and pkeyid changes + From Dave Mills + + * ntpdate/ntpdate.c: Protect sys/ioctl.h + +2000-05-01 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i4 + + * include/ntp.h: + * include/ntp_crypto.h: + * include/ntpd.h: + * ntpd/ntp_crypto.c: + * ntpd/ntp_proto.c: + * ntpd/ntpd.c: + * util/ntp_genkeys.c: + Dave Mills closed some potential vulnerabilities in the key protocol. + +2000-04-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i3 + + * ntpd/ntp_proto.c: Just check tstamp, forget about sndauto.seq + * ntpd/ntp_crypto.c (crypto_recv): Lose inappropriate ntohl() + conversion on tstamp. + AUTOKEY if tstamp>0, not != + Stash tstamp before we check pcookie.key (several places) + * ntpd/ntp_control.c (ctl_putpeer): In CP_INITSEQ, check + recauto.key, not keylist. + From: Dave Mills + +2000-04-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i2 + + * ntpq/ntpq.c: PUBKEY stuff + * ntpd/ntp_proto.c (clock_select): nreach, and better survivor pick. + * ntpd/ntp_peer.c (newpeer): Better nextdate choice. + * ntpd/ntp_control.c (ctl_putsys): Buglet in CS_HOSTNAM code. + From Dave Mills. + +2000-04-24 Harlan Stenn <stenn@whimsy.udel.edu> + + * build (IAM): Show hostname if we trip a buildkey check. + +2000-04-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * build: deal with optional 1st argument (SIG), which must match + the contents of .buildkey + + * flock-build: Generalize, implement SIG and .buildkey, and drive + list from LIST, which the user can override. + +2000-04-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i1 + Dave updated some docs, implemented the kpoll variable, and + wiggled a host/network byte order thing in the crypto key code. + +2000-04-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_wwvb.c (wwvb_receive): Grab any character (instead + of just a space) before the DSTchar. + From: Dave Mills + +2000-04-11 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99i + + Dave made some documentation updates. + +2000-04-08 Harlan Stenn <stenn@whimsy.udel.edu> + + * flock-build: Add malarky. By default, --enable-parse-clocks. + Start 2 builds, one with and the other without rsaref. + + * configure.in: 4.0.99h6 + Dave improved the crypto stuff some more. + +2000-04-05 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_acts.c (acts_receive): Do a better job with year + conversions and leap-year checks. The PTB stuff caught this. + Reported by: Daniel.Aeby@eam.admin.ch + +2000-04-02 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_atom.c (atom_pps): Bugfix + From: Philippe Charnier <charnier@xp11.frmug.org> + +2000-03-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * libparse/clk_wharton.c (cvt_wharton_400a): Do not return + CVT_NONE when receiving the early warning bit set. + From: Philippe De Muyter <phdm@macqel.be> + + * configure.in: 4.0.99h5 + Dave made more changes to the auth key stuff. + +2000-03-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99h4 + Dave made a bunch of changes/fixes to the auth key stuff. + +2000-03-22 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_resolver.c: Typos. + +2000-03-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99h3 + + * ntpd/ntp_intres.c: Use LOG_INFO instead of LOG_DEBUG. + * ntpd/ntp_resolver.c: Ditto. + +2000-03-20 Harlan Stenn <stenn@whimsy.udel.edu> + + * util/Makefile.am (ntp_genkeys_LDADD): Might need snprintf (-lntp) + + * librsaref/Makefile.am (stamp-rsaref): nodist_HEADERS are not + supoprted yet. Hack around it. + + * ntpd/ntp_resolver.c (findhostaddr): hstrerror isn't always available. + + * configure.in: Look for hstrerror. + + * util/ntp_genkeys.c (main): Use snprintf, not sprintf. + + * ntpd/ntp_crypto.c: Use gethostname, not uname + * util/ntp_genkeys.c: Ditto + From: Dave Mills + +2000-03-19 Harlan Stenn <harlan@pfcs.com> + + * ntpd/ntp_proto.c (receive): Rename ntp_res_send() to + ntp_res_name() and adjust the number of arguments. + * ntpd/ntp_resolver.c (ntp_res_name): Ditto + * include/ntpd.h: Ditto + + * ntpd/ntp_resolver.c: Add de_done to the dns_entry structure. + +2000-03-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99h2 + + * libparse/Makefile.am (info_trimble.c): Use $(srcdir)/foo.sed + instead of foo.sed . + + * librsaref/Makefile.am (stamp-rsaref): Copy each file to the build + directory, not to the source directory. This sucks; it wastes + space (but it's more portable). + + * configure.in (ac_busted_vpath_in_make): Add FreeBSD. I bet all + systems that use pmake will need this. + (ac_busted_vpath_in_make): Remove FreeBSD - I found a workaround. + + * Makefile.am: General cleanup + + * configure.in: 4.0.99h1 + + * ntpd/ntp_resolver.c: Lose unneeded header. + +2000-03-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * libntp/snprintf.c: #include <config.h> + + * libntp/Makefile.am (EXTRA_libntp_a_SOURCES): Use it correctly... + +2000-03-16 Harlan Stenn <stenn@whimsy.udel.edu> + + * libntp/Makefile.am (EXTRA_DIST): Added snprintf.c + + * configure.in: Look for (and provide if it's missing) snprintf() + + * ntpd/ntp_request.c (dns_a): Call crypto_public with the resolved + name and the peer pointer. + (dns_a): crypto_public() is only available if PUBKEY is #defined. + + * ntpd/ntp_crypto.c (crypto_public): sprintf is Evil. Use snprintf. + (crypto_setup): Ditto + (crypto_read): Ditto + + * ntpd/ntp_resolver.c (ntp_res_send): Lose some debugging noise. + + * ntpd/ntp_config.c (getconfig): Lose testing code. + + * ntpd/ntp_request.c (dns_a): Fix buglet in hostname length check. + +2000-03-16 Harlan Stenn <harlan@pfcs.com> + + * ntpd/ntp_request.c (dns_a): Start cracking the returned information. + +2000-03-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_resolver.c (ntp_res): Authenticate the keyid. + + * ntpd/ntp_crypto.c (crypto_line): Fix definition + (crypto_read): Ditto. + + * ntpd/ntp_config.c (getconfig): Move req_keyid generation here. + + * librsaref/Makefile.am (BUILT_SOURCES): Cleanup more nodist_ stuff. + +2000-03-14 Harlan Stenn <stenn@whimsy.udel.edu> + + * build (RSASUF): If we have rsaref2/ and are building + --without-rsaref, note it as a build-directory suffix. + + * configure.in: 4.0.99h + Crypto merge + + * librsaref/Makefile.am (nodist_librsaref_a_SOURCES): Added nodist_ + +2000-02-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Lose the changequote calls and fix the quoting. + Reported by: Akim Demaille <akim@epita.fr> + + * ntpd/ntp_request.c: Log various error conditions. + +2000-02-27 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99g + + * ntpd/ntpd.c: Only log EINTR if debug > 2. + +2000-02-25 Harlan Stenn <stenn@whimsy.udel.edu> + + * scripts/mkver.in (ConfStr): Use `-r' when configured with crypto. + + * ntpd/refclock_wwvb.c (wwvb_receive): Undo the previous chagne. + +2000-02-24 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_wwvb.c (wwvb_receive): LENWWVB0 can return 6 or 7 + fields. + From: Michael Sinatra <msinatra@uclink4.berkeley.edu> + with a cleanup from Ulrich. + + * scripts/mkver.in (ConfStr): Make RSAREF appear as part of the + version. + +2000-02-21 Sven Dietrich <sven_dietrich@trimble.com> + + * ports/winnt/include/config.h: Enable MD5 and RANDOM by default + * ports/winnt/libntp/SetSystemTime.c: Fix warning and const declaration + From: Carl Byington <carl@five-ten-sg.com> + +2000-02-21 Harlan Stenn <stenn@whimsy.udel.edu> + + * Makefile.am (SUBDIRS): Make librsaref right after includes so we + can copy any needed header files over. + + * libntp/Makefile.am (INCLUDES): Also look in librsaref for des.h + * ntpd/Makefile.am (INCLUDES): Ditto + * util/Makefile.am (INCLUDES): Ditto + + * librsaref/Makefile.am (librsaref_a_SOURCES): Use the des.h from + the rsaref2 distribution. + + * include/Makefile.am (noinst_HEADERS): No, we don't want des.h + +2000-02-20 Harlan Stenn <stenn@whimsy.udel.edu> + + * include/Makefile.am (noinst_HEADERS): Add des.h + +2000-02-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/ntp_config.c (do_resolve_internal): Try Real Hard to + generate a full random key. + From: Carl Byington <carl@five-ten-sg.com> + + * include/ntp.h: Now we know we have either mrand48() or random(). + * configure.in: If we have mrand48, use it. Otherwise, use (and + provide if necessary) random(). + * libntp/Makefile.am (EXTRA_DIST): random.c + * libntp/random.c: Added. + +2000-02-18 Harlan Stenn <stenn@whimsy.udel.edu> + + * librsaref/Makefile.am (stamp-rsaref): Typo + + * configure.in (ac_cv_func_ctty_for_f_setown): Yes for OpenBSD + (ac_cv_var_ntp_syscalls): Fix quoting of description + From: Jonathan Rozes <jrozes@vinton.com> + + * librsaref/Makefile.am: Fix stamp-rsaref dependency order. + + * configure.in: 4.0.99f + +2000-02-17 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_mx4200.c: Remove the DOP-weighted position + averaging code and revert to a simple mean average. The weighted + average consistently produced a *worse* result. Go figure. + * html/mx4200data.htm: Cleanup, reflect current reality. + * html/driver9.htm: Cleanup, reflect current reality. + * html/copyright.htm: Cleanup, and credit where credit is due. + From: Marc.Brett@westgeo.com + + * ntpd/refclock_oncore.c: Cleanup/fixes + * html/driver30.htm: Cleanup + * html/Oncore-SHMEM.htm: Cleanup + From: Reg Clemens <reg@dwf.com> + +2000-02-16 Sven Dietrich <sven_dietrich@trimble.com> + + * winnt/scripts/mkver.bat: Frederick Czajka [w2k@austin.rr.com] + winnt/ntpq/ntpq.dsp: modified mkver.bat to eliminate the + winnt/ntpd/ntpd.dsp: need to have Perl installed and the + winnt/ntpdc/ntpdc.dsp: PERL environment variable to be set. + winnt/ntpdate/ntpdate.dsp: + winnt/ntptrace/ntptrace.dsp: Thanks, Frederick! + + * ntpd/refclock_nmea.c: Correctly interpret the quality indicator. + +2000-02-15 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_nmea.c: Correctly interpret the quality indicator. + Deal with the time supplied in centiseconds. GPGCA/GPGGA cleanup. + From: Andrew Hood <ajhood@fl.net.au> + + * libparse/Makefile.am (K_CFLAGS): Use instead. Add NEED_NTP_BOPS. + +2000-02-10 Harlan Stenn <stenn@whimsy.udel.edu> + + * scripts/ntp-wait.in: Intensify, including some suggestions from + Ulrich. + + * configure.in: 4.0.99e + + * scripts/ntp-wait.in: Lose cruft, sleep after each try. + + * scripts/ntp-restart: It's ntpd now. Also, call ntp-wait. + + * configure.in (AC_CONFIG_*): New scripts that use PATH_PERL + + * scripts/Makefile.am (noinst_SCRIPTS): Added ntp-wait + (noinst_SCRIPTS): Added all of the scripts that now use PATH_PERL + + * configure.in: Get the path to perl + (AC_CONFIG_*): Added scripts/ntp-wait + + * ntptrace/ntptrace.c (DoTrace): If the server's srcadr is 0.0.0.0 + then we haven't synced yet. Note and punt. + Reported by: Bdale Garbee <bdale@gag.com>,http://bugs.debian.org/56551 + +2000-02-09 Harlan Stenn <stenn@whimsy.udel.edu> + + * ports/winnt/include/config.h: Typo (CLOCK_PALISADE comment) + From: Carl Byington <carl@five-ten-sg.com> + + * configure.in: Disable kernel_fll_bug for Generic_105181-17 under + Solaris-2.6 + From: Juergen Georgi <georgi@belwue.de> + +2000-02-07 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99d + + * html/Oncore-SHMEM.htm: New document + * html/driver30.htm: Cleanup and improvements + From: Reg Clemens <reg@dwf.com> + +2000-01-30 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/refclock_oncore.c: Patches/improvements + From: Reg Clemens <reg@dwf.com> + +2000-01-29 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: 4.0.99c + +2000-01-28 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Autoconf update... + + * ntpdate/ntpdate.c (ntpdatemain): Typo + From: Jack Bryans <jbryans@csulb.edu> + + * Makefile.am (EXTRA_DIST): Add flock-build. Probably UDel specific... + +2000-01-23 Harlan Stenn <stenn@whimsy.udel.edu> + + * ntpd/check_y2k.c (main): Reformat for ansi2knr + + * configure.in (AC_OUTPUT): Revert to obsolete form until automake + catches up. + +2000-01-22 Harlan Stenn <stenn@whimsy.udel.edu> + + * configure.in: Use AC_CHECK_TYPES((s_char)) instead of + AC_CHECK_TYPE. + (ac_cv_var_kernel_fll_bug): Generic_106541-08 is apparently OK, too. + + * scripts/Makefile.am (EXTRA_DIST): Need to explicitly distribute + mkver.in and ntpver.in now, apparently. + * configure.in: Search for the various audio_info members so the + printing in audio_show is less of a circus. This required an + autoconf upgrade. Major sigh. + + * libntp/audio.c (audio_show): Clean up (more) properly. + +2000-01-21 Sven Dietrich <sven_dietrich@trimble.com> + + * Add pointer to html/hints/winnt.htm to INSTALL file + * Fix NT makefiles to accomodate at least one weird + version of Visual C that can't handle the LFs without + the DOS CR also. + +2000-01-20 Sven Dietrich <sven_dietrich@trimble.com> + + * Update Copyright in Palisade driver to 2000 + * Fix Palisade MIN & MAX POLL to optimal values + +2000-01-19 Harlan Stenn <stenn@whimsy.udel.edu> + + * html/driver7.htm: Patches from Dave Mills + * html/driver36.htm: Patches from Dave Mills + + * html/copyright.htm: Added Kamal Mostafa + 2000-01-19 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.99b @@ -6,7 +2803,7 @@ * ntpd/refclock_chu.c: NCHAN is used with generic ICOM. - * ntpd/refclock_wwv.c: Use new auido stuff + * ntpd/refclock_wwv.c: Use new audio stuff * ntpd/refclock_irig.c: Use new audio stuff * ntpd/refclock_chu.c: Use new audio stuff * ntpd/ntp_proto.c: Clean up @@ -46,7 +2843,7 @@ 2000-01-13 Harlan Stenn <stenn@whimsy.udel.edu> * scripts/ntpsweep: New version - From: Hans Lambermont <Hans.Lambermont@nl.origin-it.com> + From: Hans Lambermont <Hans.Lambermont@nl.origin-it.com> * ntpd/refclock_fg.c: New version * html/driver37.htm: New version @@ -63,7 +2860,7 @@ * html/driver36.htm: Cleanup * html/monopt.htm: Ditto From: Dave Mills <mills@udel.edu> - + * ntpd/ntp_intres.c (ntp_intres): Put "NTP_INTRES running" at a higher debug level @@ -82,23 +2879,23 @@ 2000-01-08 Harlan Stenn <stenn@whimsy.udel.edu> - * configure.in: <netinet/ip.h> cannot be detected... - * ntpd/ntp_io.h: ...but every OS has it - * ntpd/refclock_oncore.c: Lint removal - * ntpq/ntpq_ops.c: Lint removal - * ntpq/refclock_chu.c: chu_major() is not an audio routine (?), lint - * libntp/icom.c: AIX doesn't have <sys/termios.h> + * configure.in: <netinet/ip.h> cannot be detected... + * ntpd/ntp_io.h: ...but every OS has it + * ntpd/refclock_oncore.c: Lint removal + * ntpq/ntpq_ops.c: Lint removal + * ntpq/refclock_chu.c: chu_major() is not an audio routine (?), lint + * libntp/icom.c: AIX doesn't have <sys/termios.h> From: Marc.Brett@westgeo.com * ntpd/refclock_chu.c: NetBSD needs sys/ioctl.h - (chu_debug): NetBSED-specific debug output. + (chu_debug): NetBSD-specific debug output. From: Frederick Bruckman <fb@enteract.com> 2000-01-06 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.98m I skipped `l' - it looks like a `1'. - + * html/driver7.htm: Doc update * html/driver36.htm: Ditto * html/audio.htm: Ditto @@ -163,13 +2960,13 @@ * ntpd/refclock_oncore.c (MAP_FAILED): Some systems do not #define this. - * ntpd/refclock_wwv.c: - * ntpd/refclock_chu.c: - * libntp/icom.c: - * libntp/Makefile.am: - * include/icom.h: - * html/driver7.htm: - * html/driver36.htm: + * ntpd/refclock_wwv.c: + * ntpd/refclock_chu.c: + * libntp/icom.c: + * libntp/Makefile.am: + * include/icom.h: + * html/driver7.htm: + * html/driver36.htm: Support for ICOM. The WWV/H driver, by the way, is getting truly awesome. The CHU autotune function works okay as it is. I'd like to find somebody else to test the audio drivers just to make sure @@ -205,7 +3002,7 @@ (oncore_read_config): Add the isascii() checks; older versions of Unix don't guarantee correct behavior of is*() without it. - * ntpd/refclock_oncore.c: Add proof-of-concept support for + * ntpd/refclock_oncore.c: Add proof-of-concept support for delivering receiver data stream to other processes through a memory-mapped file. From: Poul-Henning Kamp <phk@FreeBSD.org> @@ -241,41 +3038,41 @@ * scripts/ntpsweep: Nifty utility From: Hans.Lambermont@nl.origin-it.com - * ntpd/refclock_fg.c: - * ntpd/refclock_conf.c: - * ntpd/ntp_control.c: - * ntpd/Makefile.am: - * libntp/clocktypes.c: - * include/ntp.h: - * html/refclock.htm: - * html/driver37.htm: - * configure.in: - * acconfig.h: + * ntpd/refclock_fg.c: + * ntpd/refclock_conf.c: + * ntpd/ntp_control.c: + * ntpd/Makefile.am: + * libntp/clocktypes.c: + * include/ntp.h: + * html/refclock.htm: + * html/driver37.htm: + * configure.in: + * acconfig.h: Forum Graphic GPS clock support From: Dmitry Smirnov <das@online.nsk.su> - + * configure.in: Default to compile the IRIG, CHU and WWV/H drivers and compile the CHU driver for audio, not modem. Requested by Dave Mills. - * html/audio.htm: - * html/driver36.htm: - * html/qth.htm: + * html/audio.htm: + * html/driver36.htm: + * html/qth.htm: Dave wrote these to go along with the changes I checked in yesterday. - + 1999-12-28 Harlan Stenn <stenn@whimsy.udel.edu> - * ntpd/refclock_wwv.c: - * ntpd/refclock_conf.c: - * ntpd/refclock_chu.c: - * ntpd/ntp_refclock.c: - * ntpd/ntp_loopfilter.c: - * html/refclock.htm: - * html/pps.htm: - * html/index.htm: - * html/driver7.htm: - * html/driver6.htm: - * html/copyright.htm: + * ntpd/refclock_wwv.c: + * ntpd/refclock_conf.c: + * ntpd/refclock_chu.c: + * ntpd/ntp_refclock.c: + * ntpd/ntp_loopfilter.c: + * html/refclock.htm: + * html/pps.htm: + * html/index.htm: + * html/driver7.htm: + * html/driver6.htm: + * html/copyright.htm: I indulged an old agenda to polish up some programs originally written for a DSP evaluation board. The result is a really hot @@ -324,7 +3121,7 @@ * libntp/syssignal.c: Small cleanup to Marc's patch. - * ntpd/ntp_refclock.c: + * ntpd/ntp_refclock.c: * ntpd/refclock_atom.c: Header cleanup * html/driver30.htm: Cleanup and improvements. From: Reg Clemens <reg@dwf.com> @@ -345,7 +3142,7 @@ AFFECT OTHER SYSTEMS! * scripts/ntp-status: Added. From: Marc.Brett@westgeo.com - + * ntpdate/ntpdate.c: Deal with multiple addresses. From: Jeffrey C Honig <jch@bsdi.com> @@ -391,7 +3188,7 @@ * ntpd/refclock_wwv.c: Cleanup and fixes * ntpd/refclock_conf.c: WWV declaration cleanup. From: Dave Mills <mills@udel.edu> - + 1999-12-07 Harlan Stenn <stenn@whimsy.udel.edu> * libparse/clk_rawdcf.c (cvt_rawdcf): Buglet. @@ -401,10 +3198,10 @@ * ntpd/Makefile.am (ntpd_SOURCES): Added refclock_wwv.c - * ntpd/refclock_wwvb.c: - * ntpd/refclock_wwv.c: - * ntpd/refclock_conf.c: - * ntpd/refclock_chu.c: + * ntpd/refclock_wwvb.c: + * ntpd/refclock_wwv.c: + * ntpd/refclock_conf.c: + * ntpd/refclock_chu.c: * libntp/clocktypes.c: * include/ntp.h: Dave cleaned some things up Dave cleaned some things up (WWVB -> SPECTRACOM, CHU -> CHU_AUDIO, @@ -422,7 +3219,7 @@ * ntpq/ntpq_ops.c: Make `ntpq -pn' independent of DNS, ad advertised. From: Kamal A Mostafa <kamal@whence.com> - + * ntpd/refclock_mx4200.c (mx4200_start): make missing 3rd parameter a 0. @@ -430,7 +3227,7 @@ * ntpd/ntp_refclock.c (refclock_open): "flags" processing cleanup (refclock_open): PPS device initialization cleanup - * include/ntp_refclock.h (LDISC_CHU): + * include/ntp_refclock.h (LDISC_CHU): (LDISC_PPS): Clean up comments From: Dave Mills <mills@udel.edu> @@ -447,7 +3244,7 @@ 1999-12-03 Sven Dietrich <sven_dietrich@trimble.com> * libntp/systime.c: Removed adjtime hack for WINNT - * ports/winnt/ntpd/nt_clockstuff.c: Winnt double precision adjtime + * ports/winnt/ntpd/nt_clockstuff.c: Winnt double precision adjtime * ports/winnt/inlcude/clockstuff.h: Remove no longer needed externs 1999-12-02 Harlan Stenn <stenn@whimsy.udel.edu> @@ -467,7 +3264,7 @@ Update. Should be rewritten to take advantage of the new -g switch and perhaps a loop to wait until ntpd hits a reasonable "state". - + * html/hints/solaris-dosynctodr.html: New information From: "John W. Sopko Jr." <sopko@cs.unc.edu> @@ -499,48 +3296,48 @@ ``--input-directory'') defaults to ``/var/log/ntp''. From: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> - * html/driver8.htm: - * libparse/clk_computime.c: - * libparse/clk_dcf7000.c: - * libparse/clk_hopf6021.c: - * libparse/clk_meinberg.c: - * libparse/clk_rawdcf.c: - * libparse/clk_rcc8000.c: - * libparse/clk_schmid.c: - * libparse/clk_trimtaip.c: - * libparse/clk_trimtsip.c: - * libparse/data_mbg.c: - * libparse/kclk_computime.c: - * libparse/kclk_dcf7000.c: - * libparse/kclk_hopf6021.c: - * libparse/kclk_meinberg.c: - * libparse/kclk_rawdcf.c: - * libparse/kclk_rcc8000.c: - * libparse/kclk_schmid.c: - * libparse/kclk_trimtaip.c: - * libparse/kclk_trimtsip.c: - * libparse/kparse.c: - * libparse/kparse_conf.c: - * libparse/parse.c: - * libparse/parse_conf.c: - * libparse/parsesolaris.c: - * libparse/parsestreams.c: - * ntpd/refclock_parse.c: + * html/driver8.htm: + * libparse/clk_computime.c: + * libparse/clk_dcf7000.c: + * libparse/clk_hopf6021.c: + * libparse/clk_meinberg.c: + * libparse/clk_rawdcf.c: + * libparse/clk_rcc8000.c: + * libparse/clk_schmid.c: + * libparse/clk_trimtaip.c: + * libparse/clk_trimtsip.c: + * libparse/data_mbg.c: + * libparse/kclk_computime.c: + * libparse/kclk_dcf7000.c: + * libparse/kclk_hopf6021.c: + * libparse/kclk_meinberg.c: + * libparse/kclk_rawdcf.c: + * libparse/kclk_rcc8000.c: + * libparse/kclk_schmid.c: + * libparse/kclk_trimtaip.c: + * libparse/kclk_trimtsip.c: + * libparse/kparse.c: + * libparse/kparse_conf.c: + * libparse/parse.c: + * libparse/parse_conf.c: + * libparse/parsesolaris.c: + * libparse/parsestreams.c: + * ntpd/refclock_parse.c: Mods and updates From: Frank Kardel <kardel@acm.org> - + * acconfig.h: PCF refclock - * configure.in: - * html/driver35.htm: - * html/refclock.htm: - * include/ntp.h: - * libntp/clocktypes.c: - * ntpd/Makefile.am: - * ntpd/ntp_control.c: - * ntpd/refclock_conf.c: - * ntpd/refclock_pcf.c: + * configure.in: + * html/driver35.htm: + * html/refclock.htm: + * include/ntp.h: + * libntp/clocktypes.c: + * ntpd/Makefile.am: + * ntpd/ntp_control.c: + * ntpd/refclock_conf.c: + * ntpd/refclock_pcf.c: From: Andreas Voegele <andreas.voegele@gmx.de> - + * acconfig.h: DECL_STIME_1 * configure.in (iCFLAGS): Use -std1 for alpha*-dec-osf* if we are @@ -557,7 +3354,7 @@ * ntptrace/ntptrace.c: Ditto * ntpd/ntp_proto.c: Ditto * ntpd/refclock_palisade.c: Ditto - From: Jonathan Stone <jonathan@dsg.stanford.edu> + From: Jonathan Stone <jonathan@dsg.stanford.edu> 1999-11-18 Sven Dietrich <sven_dietrich@trimble.com> * Win NT port updates @@ -606,16 +3403,16 @@ are both defined. From: Jeffrey C Honig <jch@bsdi.com> - + * ntpd/ntp_refclock.c: sys/sio.h and SCO5_CLOCK cleanup - From: Kamal A Mostafa <kamal@whence.com> + From: Kamal A Mostafa <kamal@whence.com> * ntpd/ntp_loopfilter.c: Let -g do a "correct any" for the first time adjustment. From: Dave Mills <mills@udel.edu> * configure.in: sys/sio.h needs to be checked independently. - Reported by: Kamal A Mostafa <kamal@whence.com> + Reported by: Kamal A Mostafa <kamal@whence.com> 1999-11-11 Harlan Stenn <stenn@whimsy.udel.edu> @@ -623,11 +3420,11 @@ * configure.in: DECL_PLOCK_0 and DECL_STIME_0 are for dec-osf5*, too * ntpd/ntpd.c: DEC OSF cleanup (editorial comments by HMS) - From: Tom Smith <smith@cag.lkg.dec.com> - + From: Tom Smith <smith@cag.lkg.dec.com> + * ntpd/ntp_refclock.c: MAXUNIT bugfix From: Marc.Brett@westgeo.com - + * ntpd/ntp_refclock.c: * ntpd/ntpd.c: * ntpd/refclock_arc.c: @@ -641,10 +3438,10 @@ * include/ntp_stdlib.h: * libntp/systime.c: * ntpd/ntp_proto.c: - Replaced the 'sco5_oldclock' variable with 'systime_10ms_ticks'. + Replaced the 'sco5_oldclock' variable with 'systime_10ms_ticks'. Cleared libntp/systime.c and include/ntp_stdlib.h of references - to SCO5_CLOCK and RELIANTUNIX_CLOCK (moved to ntpd/ntp_proto.c). - From: Kamal A Mostafa <kamal@whence.com> + to SCO5_CLOCK and RELIANTUNIX_CLOCK (moved to ntpd/ntp_proto.c). + From: Kamal A Mostafa <kamal@whence.com> * configure.in: alpha-dec-osf4* -> alpha*-dec-osf4*|alpha*-dec-osf5* From: Tom Smith <smith@cag.lkg.dec.com> @@ -677,7 +3474,7 @@ * ntpd/refclock_atom.c: fdpps is only there for PPS or PPSAPI. AIOCTIMESTAMP is gone now. From: Kamal A Mostafa <kamal@whence.com> - + * configure.in (HAVE_MLOCKALL): Deal with dec-osf5 realities * ntpd/refclock_ulink.c (ulink_poll): Fix cast. * libntp/machines.c (ntp_set_tod): Use a long* for the argument to @@ -721,7 +3518,7 @@ * ntpd/ntp_intres.c: Lose #include "ntp_select.h" * libntp/iosignal.c: Lose #include "ntp_select.h" * include/ntpd.h: #include "ntp_select.h" for declaration of activefds - Reported by: Christian Krackowizer <kra1@technodat.co.at> + Reported by: Christian Krackowizer <kra1@technodat.co.at> 1999-11-01 Harlan Stenn <stenn@whimsy.udel.edu> @@ -731,10 +3528,10 @@ * libntp/recvbuff.c: Fix free buffer count From: Jeffrey C Honig <jch@bsdi.com> - * html/pps.htm: - * html/howto.htm: - * html/confopt.htm: - * html/clockopt.htm: + * html/pps.htm: + * html/howto.htm: + * html/confopt.htm: + * html/clockopt.htm: * html/uthopt.htm: Updates. From: Dave Mills <mills@udel.edu> @@ -755,7 +3552,7 @@ * ntpd/ntp_loopfilter.c: Cleanup and fixes * libntp/gpstolfp.c: Lose the UL qualifiers - old compilers hate them From: Dave Mills <mills@udel.edu> - + 1999-10-31 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: TIOCSPPS cleanup @@ -775,7 +3572,7 @@ * include/ntp.h: noselect patch From: Kamal A Mostafa <kamal@whence.com> - * configure.in: + * configure.in: * acconfig.h: TTYCLK_AIOCTIMESTAMP Stuff for Kamal @@ -789,14 +3586,14 @@ * ntpd/refclock_oncore.c: Rename instance.state to instance.o_state - * refclock_oncore.c: - * refclock_mx4200.c: - * refclock_chu.c: - * refclock_atom.c: - * ntp_refclock.c: - * ntp_peer.c: - * ntp_loopfilter.c: - * include/ntp_refclock.h: + * refclock_oncore.c: + * refclock_mx4200.c: + * refclock_chu.c: + * refclock_atom.c: + * ntp_refclock.c: + * ntp_peer.c: + * ntp_loopfilter.c: + * include/ntp_refclock.h: Various cleanup and fixes From: Dave Mills <mills@udel.edu> @@ -815,85 +3612,85 @@ From: John Hay <jhay@mikom.csir.co.za> - * libntp/msyslog.c: - * libntp/gpstolfp.c: + * libntp/msyslog.c: + * libntp/gpstolfp.c: Lint cleanup From: Jonathan Stone <jonathan@dsg.stanford.edu> * parseutil/dcfd.c: abs() -> l_abs(), time.h (AIX 4.3.2 patches) From: Dana Kaempen <decay@flash.net> - * ntpd/refclock_oncore.c: - * ntpd/refclock_atom.c: - * ntpd/ntp_refclock.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_atom.c: + * ntpd/ntp_refclock.c: PPS cleanup From: John.Hay@mikom.csir.co.za - - * util/ntptime.c: - * ntpdate/ntptimeset.c: - * ntpdate/ntpdate.c: - * ntpd/refclock_trak.c: - * ntpd/refclock_oncore.c: - * ntpd/refclock_mx4200.c: - * ntpd/refclock_msfees.c: - * ntpd/refclock_atom.c: - * ntpd/ntp_control.c: - * ntpd/ntp_config.c: - * configure.in: - * configure: + + * util/ntptime.c: + * ntpdate/ntptimeset.c: + * ntpdate/ntpdate.c: + * ntpd/refclock_trak.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_mx4200.c: + * ntpd/refclock_msfees.c: + * ntpd/refclock_atom.c: + * ntpd/ntp_control.c: + * ntpd/ntp_config.c: + * configure.in: + * configure: PPS, Solaris 7, cleanup patches From: Marc.Brett@westgeo.com - * ports/winnt/ntptrace/ntptrace.dsp: - * ports/winnt/ntpq/ntpq.dsp: - * ports/winnt/ntpdc/ntpdc.dsp: - * ports/winnt/ntpdate/ntpdate.dsp: - * ports/winnt/ntpd/refclock_trimbledc.c: - * ports/winnt/ntpd/ntpd.dsp: - * ports/winnt/ntpd/ntp_iocompletionport.c: - * ports/winnt/ntpd/nt_clockstuff.c: - * ports/winnt/libntp/util_clockstuff.c: - * ports/winnt/libntp/libntp.dsp: - * ports/winnt/libntp/SetSystemTime.c: - * ports/winnt/instsrv/instsrv.c: - * ports/winnt/include/sys/ioctl.h: - * ports/winnt/include/termios.h: - * ports/winnt/include/config.h: - * ports/winnt/include/clockstuff.h: - * ports/winnt/ntp.dsw: - * ntpd/refclock_shm.c: - * ntpd/refclock_palisade.c: - * ntpd/ntpd.c: - * ntpd/ntp_timer.c: - * ntpd/ntp_refclock.c: - * libntp/systime.c: - * libntp/machines.c: + * ports/winnt/ntptrace/ntptrace.dsp: + * ports/winnt/ntpq/ntpq.dsp: + * ports/winnt/ntpdc/ntpdc.dsp: + * ports/winnt/ntpdate/ntpdate.dsp: + * ports/winnt/ntpd/refclock_trimbledc.c: + * ports/winnt/ntpd/ntpd.dsp: + * ports/winnt/ntpd/ntp_iocompletionport.c: + * ports/winnt/ntpd/nt_clockstuff.c: + * ports/winnt/libntp/util_clockstuff.c: + * ports/winnt/libntp/libntp.dsp: + * ports/winnt/libntp/SetSystemTime.c: + * ports/winnt/instsrv/instsrv.c: + * ports/winnt/include/sys/ioctl.h: + * ports/winnt/include/termios.h: + * ports/winnt/include/config.h: + * ports/winnt/include/clockstuff.h: + * ports/winnt/ntp.dsw: + * ntpd/refclock_shm.c: + * ntpd/refclock_palisade.c: + * ntpd/ntpd.c: + * ntpd/ntp_timer.c: + * ntpd/ntp_refclock.c: + * libntp/systime.c: + * libntp/machines.c: NT patches From: Sven Dietrich <Sven_Dietrich@trimble.com> 1999-10-15 Harlan Stenn <stenn@whimsy.udel.edu> - * ntpd/refclock_wwvb.c: - * ntpd/refclock_usno.c: - * ntpd/refclock_ulink.c: - * ntpd/refclock_tpro.c: - * ntpd/refclock_pst.c: - * ntpd/refclock_parse.c: - * ntpd/refclock_palisade.c: - * ntpd/refclock_oncore.c: - * ntpd/refclock_mx4200.c: - * ntpd/refclock_msfees.c: - * ntpd/refclock_jupiter.c: - * ntpd/refclock_irig.c: - * ntpd/refclock_heath.c: - * ntpd/refclock_chu.c: - * ntpd/refclock_atom.c: - * ntpd/refclock_as2201.c: - * ntpd/refclock_arc.c: - * ntpd/refclock_arbiter.c: - * ntpd/refclock_acts.c: - * ntpd/ntp_refclock.c: - * include/ntp_refclock.h: + * ntpd/refclock_wwvb.c: + * ntpd/refclock_usno.c: + * ntpd/refclock_ulink.c: + * ntpd/refclock_tpro.c: + * ntpd/refclock_pst.c: + * ntpd/refclock_parse.c: + * ntpd/refclock_palisade.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_mx4200.c: + * ntpd/refclock_msfees.c: + * ntpd/refclock_jupiter.c: + * ntpd/refclock_irig.c: + * ntpd/refclock_heath.c: + * ntpd/refclock_chu.c: + * ntpd/refclock_atom.c: + * ntpd/refclock_as2201.c: + * ntpd/refclock_arc.c: + * ntpd/refclock_arbiter.c: + * ntpd/refclock_acts.c: + * ntpd/ntp_refclock.c: + * include/ntp_refclock.h: Bunches of fixes. From: Dave Mills <mills@udel.edu> @@ -901,7 +3698,7 @@ * html/driver16.htm: New version * ntpd/refclock_bancomm.c: New version - From: "Cliff, Gary" <gary.cliff@cdott.com> + From: "Cliff, Gary" <gary.cliff@cdott.com> "Ramasivan, Ganesh" <ganesh.ramasivan@cdott.com> * ntpd/refclock_ulink.c (ulink_receive): Cleanup @@ -928,9 +3725,9 @@ 1999-10-09 Harlan Stenn <stenn@whimsy.udel.edu> - * ntpd/refclock_oncore.c: - * ntpd/refclock_atom.c: - * ntpd/ntp_refclock.c: + * ntpd/refclock_oncore.c: + * ntpd/refclock_atom.c: + * ntpd/ntp_refclock.c: PPS API code updated to the current spec From: Dave Mills @@ -945,12 +3742,12 @@ 1999-09-19 Harlan Stenn <stenn@whimsy.udel.edu> * ntpd/refclock_ulink.c: Typos in C++ comment - Reported by: Thomas.Tornblom@Sun.SE + Reported by: Thomas.Tornblom@Sun.SE * configure.in: 4.0.98a * ntpd/ntp_config.c (getconfig): Fix typo. - From: "David E. Myers" <dem@skyline.rtp.nc.us> + From: "David E. Myers" <dem@skyline.rtp.nc.us> From: David Godfrey <dave@delta.demon.co.uk> From: Geoffrey Sisson <geoff@nominet.org.uk> @@ -984,7 +3781,7 @@ * util/tickadj.c Use HAVE_KVM_OPEN conditional around kvm.h include. - + From: Wilfredo Sanchez <wsanchez@apple.com> 1999-09-15 Harlan Stenn <stenn@whimsy.udel.edu> @@ -1001,12 +3798,12 @@ * ntpd/refclock_conf.c: * ntpd/refclock_ulink.c: Ultralink driver - From: Dave Strout <dstrout@linuxfoundary.com> + From: Dave Strout <dstrout@linuxfoundary.com> 1999-09-14 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: ReliantUNIX patches - From: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> + From: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> * ntpd/refclock_atom.c: PPS cleanup * ntpd/ntp_refclock.c (refclock_ioctl): PPS cleanup @@ -1105,7 +3902,7 @@ * ntpd/refclock_parse.c: Permit RTS to power a DCF77. From: Carsten Paeth <calle@calle.in-berlin.de> - * ntpd/refclock_oncore.c (oncore_start): This makes the Oncore run + * ntpd/refclock_oncore.c (oncore_start): This makes the Oncore run on systems without hardpps(). From: Poul-Henning Kamp <phk@freebsd.org> @@ -1139,8 +3936,8 @@ 1999-08-23 Harlan Stenn <stenn@whimsy.udel.edu> * ntpd/refclock_nmea.c: Patches for: - Trimble OEM Ace-II receiver. Low cost PCB with single - voltage input, external active antenna and two serial + Trimble OEM Ace-II receiver. Low cost PCB with single + voltage input, external active antenna and two serial ports with either NMEA and ITAPs output. Programmable to be tuned for 'time' accuracy in fixed station config. From: Nick Hibma <nick.hibma@jrc.it> @@ -1167,10 +3964,10 @@ * ntpd/ntpd.c: * ports/winnt/libntp/nt_clockstuff.c: From: Sven Dietrich <Sven_Dietrich@trimble.com> - + * README.cvs: Updated. - * configure.in: + * configure.in: * include/ntp_machine.h: * libntp/mexit.c: * ntpd/ntp_config.c: @@ -1195,7 +3992,7 @@ * ntpdate/ntptimeset.c: ntptimeset patches. From: Jeffrey Hutzelman <jhutz@cmu.edu> - + * ntpd/refclock_parse.c (local_input): ts.l_ui -> ts.fp.l_ui 1999-08-11 Harlan Stenn <stenn@whimsy.udel.edu> @@ -1213,8 +4010,8 @@ * ntpdate/ntpdate.c (sys/resource.h) : Include that file only #if HAVE_RESOURCE_H. From: Philippe De Muyter <phdm@macqel.be> - - * ntptrace/ntptrace.c (input_handler): Make it a "normal" function + + * ntptrace/ntptrace.c (input_handler): Make it a "normal" function definition. Reported by: GIANNI_CATANIA@hp-italy-om6.om.hp.com @@ -1227,7 +4024,7 @@ * configure.in: 4.0.96 * parseutil/dcfd.c (main): Replace SA_ONSTACK and SV_ONSTACK with - HAVE_SIGACTION and HAVE_SIGVEC, respectively. HP-UX provides both + HAVE_SIGACTION and HAVE_SIGVEC, respectively. HP-UX provides both of the former but only one of the latter... 1999-08-08 Harlan Stenn <stenn@whimsy.udel.edu> @@ -1281,9 +4078,9 @@ 1999-07-27 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.95 - + * ports/winnt: New release - From: Sven Dietrich <Sven_Dietrich@trimble.com> + From: Sven Dietrich <Sven_Dietrich@trimble.com> 1999-07-26 Harlan Stenn <stenn@whimsy.udel.edu> @@ -1337,11 +4134,11 @@ * ntpd/ntp_timer.c: * ntpd/ntpd.c: Compile/lint cleanup From: Allen Smith <easmith@beatrice.rutgers.edu> - + 1999-07-21 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.94a - + * configure.in (ac_cv_make_ntptime): Add tv_nsec check. * include/Makefile.am (noinst_HEADERS): Forgot ntp_syscall.h @@ -1358,7 +4155,7 @@ 1999-07-20 Harlan Stenn <stenn@whimsy.udel.edu> - * acconfig.h: + * acconfig.h: * util/ntptime.c: FreeBSD nano patches From: Per Hedeland <per@erix.ericsson.se> and Allen Smith <easmith@beatrice.rutgers.edu> @@ -1508,7 +4305,7 @@ Mon May 31 18:49:49 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * ntpd/refclock_parse.c (gps16x_poll): Likewise. * ntpd/ntp_filegen.c (filegen_open): Use long format, cast arg to - match. + match. * ntpd/refclock_parse.c (list_err): Use long format to match arg. (parse_statistics): Likewise. @@ -1581,7 +4378,7 @@ Tue May 25 18:00:49 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> Patch: - + * include/l_stdlib.h: Fixed syscall() declaration. * configure.in: Updated test to match. @@ -1611,7 +4408,7 @@ Tue May 25 18:00:49 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * include/ntp_refclock.h: Protect it from multiple inclusion. * include/ntp_fp.h: Likewise. * include/ntp.h: Likewise. - + * include/ntpd.h: Include ntp_refclock.h for MAXDIAL declaration. * libntp/authkeys.c: Include ntpd.h for current_time declaration. @@ -1620,7 +4417,7 @@ Tue May 25 18:00:49 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * include/ntp_stdlib.h: Declare variables exported by libntp. * include/ntpd.h: Likewise for ntpd. - + * libntp/authkeys.c (key_hash, authnokey, authfreekeys, cache_flags): Made static. * libntp/systime.c (tvu_maxslew, tsf_maxslew, sys_clock_offset, @@ -1629,12 +4426,12 @@ Tue May 25 18:00:49 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * ntpd/ntp_loopfilter.c (clock_offset, clock_panic): Likewise. (pll_nano): Likewise. Removed duplicate definition. * ntpd/ntp_peer.c (peer_free, current_association_ID, - assocpeer_calls, init_peer_starttime): Likewise. + assocpeer_calls, init_peer_starttime): Likewise. * ntpd/ntp_proto.c (sys_offset, sys_authdly): Likewise. * ntpd/ntp_request.c (numrequests, numresppkts, errorcounter): - Likewise. + Likewise. * ntpd/ntp_restrict.c (res_calls, res_found, res_not_found, - res_timereset, res_limited_refcnt): Likewise. + res_timereset, res_limited_refcnt): Likewise. * ntpd/ntpd.c (was_alarmed, worker_thread): Likewise. * ntpq/ntpq_ops.c: Moved declaration of external variable from @@ -1753,7 +4550,7 @@ Sat May 15 18:53:47 1999 Harlan Stenn <stenn@whimsy.udel.edu> Fri May 14 23:58:35 1999 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.92h2 - + * configure.in (ac_cv_make_ntptime): Not under Linux. Yes, it works for some people. We're tired of the complaints from the others. @@ -1769,11 +4566,11 @@ Wed May 12 23:02:22 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * libntp/authkeys.c (auth_delkeys): Don't remove autokey keys, leave info on KEY_TRUSTED flag alone. Include ntp.h for NTP_MAXKEY definition. - + Thu May 13 02:19:02 1999 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.92h1 - + * configure.in: patch for ReliantUNIX From: Andrej Borsenkow <borsenkow.msk@sni.de> @@ -1877,7 +4674,7 @@ Sat Apr 24 01:00:53 1999 Harlan Stenn <stenn@whimsy.udel.edu> * html/accopt.htm, html/assoc.htm, html/authopt.htm, html/biblio.htm, html/build.htm, html/clockopt.htm, - html/confopt.htm, html/copyright.htm, html/debug.htm, + html/confopt.htm, html/copyright.htm, html/debug.htm, html/exec.htm, html/extern.htm, html/hints.htm, html/index.htm, html/kern.htm, html/miscopt.htm, html/monopt.htm, html/notes.htm, html/ntpd.htm, html/ntpdate.htm, html/ntpdc.htm, html/ntpq.htm, @@ -1907,7 +4704,7 @@ Sat Apr 24 01:00:53 1999 Harlan Stenn <stenn@whimsy.udel.edu> * ntpdc/ntpdc_ops.c: (kerninfo) Report in seconds regardless of kernel precision. Report kernel flags as text. From: Poul-Henning Kamp <phk@critter.freebsd.dk> - + Sun Apr 18 14:26:51 1999 Harlan Stenn <stenn@whimsy.udel.edu> * configure.in: 4.0.92g diff --git a/contrib/ntp/INSTALL b/contrib/ntp/INSTALL index 0c73fef..7483e00 100644 --- a/contrib/ntp/INSTALL +++ b/contrib/ntp/INSTALL @@ -3,7 +3,7 @@ Basic Installation These are generic *nix installation instructions. - For Windows/NT, please see ports/winnt. + For Windows/NT, please see ports/winnt and html/hints/winnt.htm. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses diff --git a/contrib/ntp/Makefile.am b/contrib/ntp/Makefile.am index 53a7760..ddf9956 100644 --- a/contrib/ntp/Makefile.am +++ b/contrib/ntp/Makefile.am @@ -1,13 +1,13 @@ -#AUTOMAKE_OPTIONS = foreign dist-tarZ #distdir=$(PACKAGE)$(VERSION) #AUTOMAKE_OPTIONS = util/ansi2knr foreign dist-tarZ no-dependencies -AUTOMAKE_OPTIONS = util/ansi2knr foreign dist-tarZ +AUTOMAKE_OPTIONS = util/ansi2knr foreign SUBDIRS = \ scripts \ include \ + ElectricFence \ + librsaref \ libntp \ libparse \ - librsaref \ ntpd \ ntpdate \ ntpdc \ @@ -19,39 +19,48 @@ SUBDIRS = \ kernel \ util -EXTRA_DIST = ChangeLog COPYRIGHT NEWS README.cvs README.des README.hackers TODO WHERE-TO-START acconfig.h config.guess config.h.in config.sub excludes install-sh dot.emacs build NOTES.y2kfixes readme.y2kfixes results.y2kfixes +EXTRA_DIST = \ + COPYRIGHT \ + ChangeLog \ + NEWS \ + NOTES.y2kfixes \ + README.cvs \ + README.des \ + README.hackers \ + README.rsa \ + TODO \ + WHERE-TO-START \ + acconfig.h \ + build \ + config.guess \ + config.h.in \ + config.sub \ + dot.emacs \ + excludes \ + flock-build \ + install-sh \ + ntp_update \ + readme.y2kfixes \ + results.y2kfixes \ + conf \ + html \ + ports + +DISTCLEANFILES = .warning + #ETAGS_ARGS = $(srcdir)/Makefile.am $(srcdir)/configure.in ETAGS_ARGS = Makefile.am configure.in acconfig.h -# DIST_CPDIRS = conf html scripts -# DIST_MKDIRS = adjtime clockstuff kernel libparse ppsclock -#DIST_HOOK_DIRS = conf html patches ports scripts # HMS: make ports be the last directory... -DIST_HOOK_DIRS = conf html scripts ports +# DIST_HOOK_DIRS = conf html scripts ports BUILT_SOURCES = $(srcdir)/COPYRIGHT $(srcdir)/COPYRIGHT: html/copyright.htm ( echo "This file is automatically generated from html/copyright.htm" ; lynx -dump $(srcdir)/html/copyright.htm ) > $(srcdir)/COPYRIGHT.new && mv $(srcdir)/COPYRIGHT.new $(srcdir)/COPYRIGHT -# local-dist: dist-tarZ - dist-hook: - -for i in $(DIST_HOOK_DIRS); do \ - mkdir $(distdir)/$$i ; \ - cp -rp $(srcdir)/$$i $(distdir) ; \ - done ; \ - find $(distdir) -type d -name CVS -exec rm -rf '{}' \; ; \ - # find $(distdir)/html -name '*.htm' -exec dos2unix {} {} \; ; \ - # cp -rp $(srcdir)/include/winnt $(distdir)/include - -dist-export: distdir - rm $(distdir)/libntp/authdes.c - cp $(distdir)/libntp/authdes.c.export $(distdir)/libntp/authdes.c - chmod -R a+r $(distdir) - mv $(distdir) $(distdir)-export - $(TAR) chozf $(distdir)-export.tar.gz $(distdir)-export - rm -rf $(distdir)-export + @find $(distdir) -type d -name CVS -print | xargs rm -rf Makefile: .warning diff --git a/contrib/ntp/Makefile.in b/contrib/ntp/Makefile.in index fbb8f2f..2a7f938 100644 --- a/contrib/ntp/Makefile.in +++ b/contrib/ntp/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,30 +91,41 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ -#AUTOMAKE_OPTIONS = foreign dist-tarZ #distdir=$(PACKAGE)$(VERSION) #AUTOMAKE_OPTIONS = util/ansi2knr foreign dist-tarZ no-dependencies -AUTOMAKE_OPTIONS = util/ansi2knr foreign dist-tarZ +AUTOMAKE_OPTIONS = util/ansi2knr foreign SUBDIRS = \ scripts \ include \ + ElectricFence \ + librsaref \ libntp \ libparse \ - librsaref \ ntpd \ ntpdate \ ntpdc \ @@ -122,46 +138,70 @@ SUBDIRS = \ util -EXTRA_DIST = ChangeLog COPYRIGHT NEWS README.cvs README.des README.hackers TODO WHERE-TO-START acconfig.h config.guess config.h.in config.sub excludes install-sh dot.emacs build NOTES.y2kfixes readme.y2kfixes results.y2kfixes +EXTRA_DIST = \ + COPYRIGHT \ + ChangeLog \ + NEWS \ + NOTES.y2kfixes \ + README.cvs \ + README.des \ + README.hackers \ + README.rsa \ + TODO \ + WHERE-TO-START \ + acconfig.h \ + build \ + config.guess \ + config.h.in \ + config.sub \ + dot.emacs \ + excludes \ + flock-build \ + install-sh \ + ntp_update \ + readme.y2kfixes \ + results.y2kfixes \ + conf \ + html \ + ports + + +DISTCLEANFILES = .warning + #ETAGS_ARGS = $(srcdir)/Makefile.am $(srcdir)/configure.in ETAGS_ARGS = Makefile.am configure.in acconfig.h -# DIST_CPDIRS = conf html scripts -# DIST_MKDIRS = adjtime clockstuff kernel libparse ppsclock -#DIST_HOOK_DIRS = conf html patches ports scripts # HMS: make ports be the last directory... -DIST_HOOK_DIRS = conf html scripts ports +# DIST_HOOK_DIRS = conf html scripts ports BUILT_SOURCES = $(srcdir)/COPYRIGHT CVO = `$(srcdir)/config.guess` BHOST = `(hostname || uname -n)` +EXEEXT = +OBJEXT = o subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = README ./stamp-h.in ChangeLog INSTALL Makefile.am \ -Makefile.in NEWS TODO acconfig.h aclocal.m4 config.guess config.h.in \ -config.sub configure configure.in depcomp install-sh missing \ -mkinstalldirs - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = README ./stamp-h.in ChangeLog INSTALL Makefile.am \ +Makefile.in NEWS TODO acconfig.h acinclude.m4 aclocal.m4 config.guess \ +config.h.in config.sub configure configure.in depcomp install-sh \ +missing mkinstalldirs + +DIST_SUBDIRS = $(SUBDIRS) +all: $(BUILT_SOURCES) config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -$(ACLOCAL_M4): configure.in +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +$(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -192,26 +232,18 @@ $(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in -mostlyclean-hdr: - -clean-hdr: - distclean-hdr: -rm -f config.h -maintainer-clean-hdr: - # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +install-info-recursive uninstall-info-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ @@ -235,11 +267,16 @@ mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - if test "$$subdir" = "."; then dot_seen=yes; else :; fi; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ @@ -265,7 +302,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -285,19 +322,60 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) +top_distdir = . +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) +GZIP_ENV = --best +distdir: $(DISTFILES) + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/scripts + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="${top_distdir}" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. @@ -321,90 +399,32 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) dist \ && $(MAKE) $(AM_MAKEFLAGS) distclean \ && rm -f $(distdir).tar.gz \ - && test `find . -type f -print | wc -l` -eq 0 - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) -dist-tarZ: distdir - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) - $(AMTAR) chof - $(distdir) | compress -c > $(distdir).tar.Z - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) -dist-all: distdir - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz - $(AMTAR) chof - $(distdir) | compress -c > $(distdir).tar.Z + && (test `find . -type f -print | wc -l` -eq 0 \ + || (echo "Error: files left after distclean" 1>&2; \ + exit 1) ) -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) -distdir: $(DISTFILES) - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - mkdir $(distdir) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' check-am: all-am check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -all-recursive-am: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive +all-am: Makefile config.h -install-exec-am: -install-exec: install-exec-recursive +installdirs: installdirs-recursive +installdirs-am: -install-data-am: +install: install-recursive +install-exec: install-exec-recursive install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile config.h -all-redirect: all-recursive-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: installdirs-recursive -installdirs-am: +installcheck: installcheck-recursive + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -413,68 +433,72 @@ clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-recursive - -clean-am: clean-hdr clean-tags clean-generic mostlyclean-am - clean: clean-recursive -distclean-am: distclean-hdr distclean-tags distclean-generic clean-am +clean-am: clean-generic mostlyclean-am + +dist-all: dist distclean: distclean-recursive -rm -f config.status -maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: + +dvi-am: + +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f config.status -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -install-recursive uninstall-recursive install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs-am installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +.PHONY: all all-am all-recursive check check-am check-recursive clean \ + clean-generic clean-recursive dist dist-all distcheck distclean \ + distclean-generic distclean-hdr distclean-recursive \ + distclean-tags distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-recursive \ + install-man install-recursive install-strip installcheck \ + installcheck-am installcheck-recursive installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-info-recursive \ + uninstall-recursive $(srcdir)/COPYRIGHT: html/copyright.htm ( echo "This file is automatically generated from html/copyright.htm" ; lynx -dump $(srcdir)/html/copyright.htm ) > $(srcdir)/COPYRIGHT.new && mv $(srcdir)/COPYRIGHT.new $(srcdir)/COPYRIGHT -# local-dist: dist-tarZ - dist-hook: - -for i in $(DIST_HOOK_DIRS); do \ - mkdir $(distdir)/$$i ; \ - cp -rp $(srcdir)/$$i $(distdir) ; \ - done ; \ - find $(distdir) -type d -name CVS -exec rm -rf '{}' \; ; \ - # find $(distdir)/html -name '*.htm' -exec dos2unix {} {} \; ; \ - # cp -rp $(srcdir)/include/winnt $(distdir)/include - -dist-export: distdir - rm $(distdir)/libntp/authdes.c - cp $(distdir)/libntp/authdes.c.export $(distdir)/libntp/authdes.c - chmod -R a+r $(distdir) - mv $(distdir) $(distdir)-export - $(TAR) chozf $(distdir)-export.tar.gz $(distdir)-export - rm -rf $(distdir)-export + @find $(distdir) -type d -name CVS -print | xargs rm -rf Makefile: .warning diff --git a/contrib/ntp/NEWS b/contrib/ntp/NEWS index 4cafb97..e8bfb76 100644 --- a/contrib/ntp/NEWS +++ b/contrib/ntp/NEWS @@ -1,8 +1,23 @@ +* Huff-n-Puff filter +* Preparation for OpenSSL support +* Resolver changes/improvements are not backward compatible with mode 7 + requests (which are implementation-specific anyway) +* leap second stuff +* manycast should work now +* ntp-genkeys does new good things. +* scripts/ntp-close +* PPS cleanup and improvements +* readline support for ntpdc +* Crypto/authentication rewrite +* WINNT builds with MD5 by default +* WINNT no longer requires Perl for building with Visual C++ 6.0 * algorithmic improvements, bugfixes * Solaris dosynctodr info update * html/pic/* is *lots* smaller -* New drivers: Forum Graphic GPS, WWV/H +* New/updated drivers: Forum Graphic GPS, WWV/H, Heath GC-100 II, HOPF + serial and PCI, ONCORE, ulink331 * Rewrite of the audio drivers +(4.0.99) * Driver updates: CHU, DCF, GPS/VME, Oncore, PCF, Ulink, WWVB, burst If you use the ONCORE driver with a HARDPPS kernel module, you *must* have a properly specified: diff --git a/contrib/ntp/README b/contrib/ntp/README index a5916d8..ce51605 100644 --- a/contrib/ntp/README +++ b/contrib/ntp/README @@ -1,4 +1,7 @@ -The ntp Distribution Base Directory + +Send patches and bug reports to <bugs@ntp.org> . + + The ntp Distribution Base Directory This directory and its subdirectories contain the Network Time Protocol Version 4 (NTP) distribution for Unix and Windows/NT systems. This release diff --git a/contrib/ntp/README.cvs b/contrib/ntp/README.cvs index b9f352a..041b84a 100644 --- a/contrib/ntp/README.cvs +++ b/contrib/ntp/README.cvs @@ -1,24 +1,52 @@ To get the NTP distribution via anonymous CVS: - cvs -d :pserver:anoncvs@www.ntp.org:/cvs/ntp login + % cvs -d :pserver:anoncvs@www.ntp.org:/cvs/ntp login the password is: anoncvs - cvs -d :pserver:anoncvs@www.ntp.org:/cvs/ntp co ntp + % rm -rf ntp + % cvs -d :pserver:anoncvs@www.ntp.org:/cvs/ntp co ntp after which the "ntp_update" script in the top-level of the tree should keep things in synch and properly timestamped. +PLEASE NOTE: + + When obtaining the NTP distribution directly via CVS instead of + using "ntp_update", the files are installed in an arbitrary + order. + + When you run "make", this may cause some of the generated files + to be reconstructed. + + If you do not have the right verison of automake and autoconf, + these files will be regenerated incorrectly. + + In this case, you can "fix" your distribution by running: + + ntp_update -C + + which will force any local changes to your NTP files to be + discarded and replaced with the versions in the repository. + + If "ntp_update -C" does not work just remove the "broken" + files (probably Makefile.in files) and re-run ntp_udate. + There are some mailing lists for the NTP CVS distribution. For more -information, send a message to <majordomo@ntp.org> with the "lists" in -the body of the message. +information, send a message to <majordomo@ntp.org> with the word "lists" +in the body of the message. -If you get NTP via CVS, you will need to build the release using GNU make +If you get NTP via CVS, you MAY need to build the release using GNU make and gcc. You can then "make dist" to build a release tarball that does not require GNU make or gcc. -The reason GNU make and gcc are required is because the repository version -of NTP does not have the make dependencies built-in. These dependencies -are created dynamically, and this dynamic process requires GNU make and gcc. +The reason GNU make and gcc may be required is because the repository +version of NTP does not have the make dependencies built-in. These +dependencies are created dynamically, and this dynamic process may +require GNU make and gcc. + +I'm told that the version of automake we are now using does not require +GNU make or gcc for the dependency tracking, but I haven't tested this +yet. diff --git a/contrib/ntp/README.des b/contrib/ntp/README.des index 8fa0ff8..88f0aea 100644 --- a/contrib/ntp/README.des +++ b/contrib/ntp/README.des @@ -6,14 +6,9 @@ If you want DES support in ntp: If you *need* DES support: - first see if you can simply "want" DES support instead -- Get RSAREF or RSAEURO (or a reasonable facsimile thereof) -- - Unpack it in the top-level source directory of the NTP distribution - in a directory named rsaref2 - (You should see directories like ports, rsaref2, scripts) +- Follow the instructions in README.rsa -When you run configure, the Right Thing will happen. - -Be advised that the RSA DES code is not quite as portable os one might +Be advised that the RSA DES code is not quite as portable as one might wish for. In particular, DES under NTP will only work between machines of the same "endianness". diff --git a/contrib/ntp/README.rsa b/contrib/ntp/README.rsa new file mode 100644 index 0000000..3568dbb --- /dev/null +++ b/contrib/ntp/README.rsa @@ -0,0 +1,105 @@ +If you want to use the RSA stuff for crypto keys: + +- Get RSAREF or RSAEURO. +- - Unpack it in the top-level source directory of the NTP distribution + in a directory named rsaref2 or rsaeuro1, respectively + (You should see directories like ports, rsaref2, scripts) + +Make sure rsa.c has the security patch applied - a copy of it is at the +end of this file. + +When you run configure, the Right Thing will happen. + +Be advised that the RSA DES code is not quite as portable os one might +wish for. In particular, DES under NTP will only work between machines +of the same "endianness". + +Dave would prefer that new/alternative encryption schemes follow the +RSA API. + + +--- rsa.c.orig Fri Mar 25 14:01:48 1994 ++++ rsaref2/source/rsa.c Mon Dec 13 13:10:28 1999 +@@ -33,6 +33,9 @@ + unsigned char byte, pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen; + ++ if (publicKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (publicKey->bits + 7) / 8; + if (inputLen + 11 > modulusLen) + return (RE_LEN); +@@ -78,6 +81,9 @@ + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen, pkcsBlockLen; + ++ if (publicKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (publicKey->bits + 7) / 8; + if (inputLen > modulusLen) + return (RE_LEN); +@@ -128,6 +134,9 @@ + int status; + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen; ++ ++ if (privateKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); + + modulusLen = (privateKey->bits + 7) / 8; + if (inputLen + 11 > modulusLen) +@@ -168,6 +177,9 @@ + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen, pkcsBlockLen; + ++ if (privateKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (privateKey->bits + 7) / 8; + if (inputLen > modulusLen) + return (RE_LEN); + +--- rsa.c.orig Sat Sep 28 22:59:40 1996 ++++ rsaeuro1/source/rsa.c Sat Jul 8 00:33:13 2000 +@@ -51,6 +51,9 @@ R_RANDOM_STRUCT *randomStruct; /* rando + unsigned char byte, pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen; + ++ if (publicKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (publicKey->bits + 7) / 8; + + if(inputLen + 11 > modulusLen) +@@ -101,6 +104,9 @@ R_RSA_PUBLIC_KEY *publicKey; /* RSA p + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen, pkcsBlockLen; + ++ if (publicKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (publicKey->bits + 7) / 8; + + if(inputLen > modulusLen) +@@ -154,6 +160,9 @@ R_RSA_PRIVATE_KEY *privateKey; /* RSA p + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen; + ++ if (privateKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (privateKey->bits + 7) / 8; + + if(inputLen + 11 > modulusLen) +@@ -193,6 +202,9 @@ R_RSA_PRIVATE_KEY *privateKey; /* RSA p + unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN]; + unsigned int i, modulusLen, pkcsBlockLen; + ++ if (privateKey->bits > MAX_RSA_MODULUS_BITS) ++ return (RE_LEN); ++ + modulusLen = (privateKey->bits + 7) / 8; + + if(inputLen > modulusLen) diff --git a/contrib/ntp/TODO b/contrib/ntp/TODO index e57a2c4..833d469 100644 --- a/contrib/ntp/TODO +++ b/contrib/ntp/TODO @@ -1,6 +1,8 @@ *** IF YOU CAN HELP FIX ANY OF THESE THINGS, PLEASE DO! *** +010402: Look harder at -lm and -lelf - they are needed less and less... + 970711: Look Real Hard at changing the key stuff from u_long to u_int32. 970711: Make sure it's safe to convert proto_config's 2nd argument from diff --git a/contrib/ntp/acconfig.h b/contrib/ntp/acconfig.h index a46ca67..dfb0582 100644 --- a/contrib/ntp/acconfig.h +++ b/contrib/ntp/acconfig.h @@ -1,9 +1,3 @@ -/* Package */ -#undef PACKAGE - -/* Version */ -#undef VERSION - /* debugging code */ #undef DEBUG @@ -76,6 +70,12 @@ /* HOPF 6021 clock */ #undef CLOCK_HOPF6021 +/* HOPF PCI clock device */ +#undef CLOCK_HOPF_PCI + +/* HOPF serial clock device*/ +#undef CLOCK_HOPF_SERIAL + /* HP 58503A GPS receiver */ #undef CLOCK_HPGPS @@ -374,9 +374,6 @@ /* Define if you have the TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, and ASYNC_PPS_CD_NEG ioctls (linux) */ #undef HAVE_TIO_SERIAL_STUFF -/* Define if you use struct timespec rather than struct timeval (time in ns rather than us) */ -#undef HAVE_TIMESPEC - /* Define if you have the interface in the Draft RFC */ #undef HAVE_PPSAPI @@ -402,6 +399,9 @@ /* cfset[io]speed()? */ #undef DECL_CFSETISPEED_0 +/* hstrerror()? */ +#undef DECL_HSTRERROR_0 + /* ioctl()? */ #undef DECL_IOCTL_0 @@ -472,3 +472,8 @@ /* toupper()? */ #undef DECL_TOUPPER_0 + +/* strerror()? */ +#undef DECL_STRERROR_0 + +#undef ULONG_CONST diff --git a/contrib/ntp/acinclude.m4 b/contrib/ntp/acinclude.m4 new file mode 100644 index 0000000..82ade38 --- /dev/null +++ b/contrib/ntp/acinclude.m4 @@ -0,0 +1,36 @@ +AC_DEFUN(hs_ULONG_CONST, +[ AC_EGREP_CPP(Circus, + [#define ACAT(a,b)a ## b +ACAT(Cir,cus) +], AC_DEFINE([ULONG_CONST(a)], [a ## UL]), + AC_EGREP_CPP(Reiser, +[#define RCAT(a,b)a/**/b +RCAT(Rei,ser) +], AC_DEFINE([ULONG_CONST(a)], [a/**/L]), + AC_MSG_ERROR([How do we create an unsigned long constant?])))]) +dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +dnl +dnl This macro defines (with AC_DEFINE) VARNAME to the expansion of the DIR +dnl variable, taking care of fixing up ${prefix} and such. +dnl +dnl Note that the 3 argument form is only supported with autoconf 2.13 and +dnl later (i.e. only where AC_DEFINE supports 3 arguments). +dnl +dnl Examples: +dnl +dnl AC_DEFINE_DIR(DATADIR, datadir) +dnl AC_DEFINE_DIR(PROG_PATH, bindir, [Location of installed binaries]) +dnl +dnl @version $Id: acinclude.m4,v 1.3 2000/08/04 03:26:22 stenn Exp $ +dnl @author Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +AC_DEFUN(AC_DEFINE_DIR, [ + ac_expanded=`( + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + eval echo \""[$]$2"\" + )` + ifelse($3, , + AC_DEFINE_UNQUOTED($1, "$ac_expanded"), + AC_DEFINE_UNQUOTED($1, "$ac_expanded", $3)) +]) diff --git a/contrib/ntp/aclocal.m4 b/contrib/ntp/aclocal.m4 index 981fd72..01752eb 100644 --- a/contrib/ntp/aclocal.m4 +++ b/contrib/ntp/aclocal.m4 @@ -1,65 +1,139 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4a - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. +# aclocal.m4 generated automatically by aclocal 1.4e + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +AC_DEFUN(hs_ULONG_CONST, +[ AC_EGREP_CPP(Circus, + [#define ACAT(a,b)a ## b +ACAT(Cir,cus) +], AC_DEFINE([ULONG_CONST(a)], [a ## UL]), + AC_EGREP_CPP(Reiser, +[#define RCAT(a,b)a/**/b +RCAT(Rei,ser) +], AC_DEFINE([ULONG_CONST(a)], [a/**/L]), + AC_MSG_ERROR([How do we create an unsigned long constant?])))]) +dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +dnl +dnl This macro defines (with AC_DEFINE) VARNAME to the expansion of the DIR +dnl variable, taking care of fixing up ${prefix} and such. +dnl +dnl Note that the 3 argument form is only supported with autoconf 2.13 and +dnl later (i.e. only where AC_DEFINE supports 3 arguments). +dnl +dnl Examples: +dnl +dnl AC_DEFINE_DIR(DATADIR, datadir) +dnl AC_DEFINE_DIR(PROG_PATH, bindir, [Location of installed binaries]) +dnl +dnl @version $Id: acinclude.m4,v 1.3 2000/08/04 03:26:22 stenn Exp $ +dnl @author Alexandre Oliva <oliva@lsd.ic.unicamp.br> + +AC_DEFUN(AC_DEFINE_DIR, [ + ac_expanded=`( + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + eval echo \""[$]$2"\" + )` + ifelse($3, , + AC_DEFINE_UNQUOTED($1, "$ac_expanded"), + AC_DEFINE_UNQUOTED($1, "$ac_expanded", $3)) +]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<<am_indx=1 -for am_file in <<$1>>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) +# serial 3 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +AC_PREREQ([2.12]) + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_CONFIG_HEADER([$1]) + AC_OUTPUT_COMMANDS( + ifelse(patsubst([$1], [[^ ]], []), + [], + [test -z "$CONFIG_HEADERS" || echo timestamp >dnl + patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), + [am_indx=1 + for am_file in $1; do + case " $CONFIG_HEADERS " in + *" $am_file "*) + echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` + done]) +]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. -# serial 1 +# serial 5 -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -dnl We require 2.13 because we rely on SHELL being computed by configure. + +# We require 2.13 because we rely on SHELL being computed by configure. AC_PREREQ([2.13]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" && + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. +# The purpose of this macro is to provide the user with a means to +# check macros which are provided without letting her know how the +# information is coded. +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) +# ---------------------------------------------- +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) fi + +# Define the identity of the package. +PACKAGE=$1 +AC_SUBST(PACKAGE)dnl +VERSION=$2 +AC_SUBST(VERSION)dnl ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +ifdef([m4_pattern_allow], + [m4_pattern_allow([^AM_(C|CPP|CXX|OBJC|F|R|GCJ)FLAGS])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake) @@ -67,40 +141,49 @@ AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_MISSING_INSTALL_SH -dnl We need awk for the "check" target. The system "awk" is bad on -dnl some platforms. -AC_REQUIRE([AC_PROG_AWK]) -AC_REQUIRE([AC_PROG_MAKE_SET]) -AC_REQUIRE([AM_DEP_TRACK]) -AC_REQUIRE([AM_SET_DEPDIR]) -ifdef([AC_PROVIDE_AC_PROG_CC], [AM_DEPENDENCIES(CC)], [ - define([AC_PROG_CC], defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])]) -ifdef([AC_PROVIDE_AC_PROG_CXX], [AM_DEPENDENCIES(CXX)], [ - define([AC_PROG_CXX], defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])]) +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl +AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_PROVIDE_IFELSE([AC_PROG_][CC], + [AM_DEPENDENCIES(CC)], + [define([AC_PROG_][CC], + defn([AC_PROG_][CC])[AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [AM_DEPENDENCIES(CXX)], + [define([AC_PROG_][CXX], + defn([AC_PROG_][CXX])[AM_DEPENDENCIES(CXX)])])dnl ]) # # Check to make sure that the build environment is sane. # -AC_DEFUN(AM_SANITY_CHECK, +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a @@ -110,7 +193,7 @@ if ( alias in your environment]) fi - test "[$]2" = conftestfile + test "$[2]" = conftest.file ) then # Ok. @@ -122,72 +205,183 @@ fi rm -f conftest* AC_MSG_RESULT(yes)]) -dnl AM_MISSING_PROG(NAME, PROGRAM) -AC_DEFUN(AM_MISSING_PROG, [ -AC_REQUIRE([AM_MISSING_HAS_RUN]) + +# serial 2 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) -dnl Like AM_MISSING_PROG, but only looks for install-sh. -dnl AM_MISSING_INSTALL_SH() -AC_DEFUN(AM_MISSING_INSTALL_SH, [ -AC_REQUIRE([AM_MISSING_HAS_RUN]) + +# AM_MISSING_INSTALL_SH +# --------------------- +# Like AM_MISSING_PROG, but only looks for install-sh. +AC_DEFUN([AM_MISSING_INSTALL_SH], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) if test -z "$install_sh"; then - install_sh="$ac_aux_dir/install-sh" - test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh" - test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh" - dnl FIXME: an evil hack: we remove the SHELL invocation from - dnl install_sh because automake adds it back in. Sigh. - install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`" + for install_sh in "$ac_aux_dir/install-sh" \ + "$ac_aux_dir/install.sh" \ + "${am_missing_run}${ac_auxdir}/install-sh"; + do + test -f "$install_sh" && break + done + # FIXME: an evil hack: we remove the SHELL invocation from + # install_sh because automake adds it back in. Sigh. + install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'` fi AC_SUBST(install_sh)]) -dnl AM_MISSING_HAS_RUN. -dnl Define MISSING if not defined so far and test if it supports --run. -dnl If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], [ -test x"${MISSING+set}" = xset || \ - MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing" -dnl Use eval to expand $SHELL + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[test x"${MISSING+set}" = xset || + MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing" +# Use eval to expand $SHELL if eval "$MISSING --run :"; then am_missing_run="$MISSING --run " else am_missing_run= - AC_MSG_WARN([\`missing' script is too old or missing]) + am_backtick='`' + AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) fi ]) -dnl See how the compiler implements dependency checking. -dnl Usage: -dnl AM_DEPENDENCIES(NAME) -dnl NAME is "CC", "CXX" or "OBJC". +# AM_AUX_DIR_EXPAND + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to ${srcdir}/foo. In other projects, it is set to `.'. +# Of course, Automake must honor this variable whenever it call a tool +# from the auxiliary directory. The problem is that $srcdir (hence +# $ac_aux_dir) can be either an absolute path or a path relative to +# $top_srcdir or absolute, this depends on how configure is run. This +# is pretty anoying since it makes $ac_aux_dir quite unusable in +# subdirectories: on the top source directory, any form will work +# fine, but in subdirectories relative pat needs to be adapted. +# - calling $top_srcidr/$ac_aux_dir/missing would success if $srcdir is +# relative, but fail if $srcdir is absolute +# - conversly, calling $ax_aux_dir/missing would fail if $srcdir is +# absolute, and success on relative paths. +# +# Consequently, we define and use $am_aux_dir, the "always absolute" +# version of $ac_aux_dir. -dnl We try a few techniques and use that to set a single cache variable. +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` +]) -AC_DEFUN(AM_DEPENDENCIES,[ -AC_REQUIRE([AM_SET_DEPDIR]) -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS]) -ifelse([$1],CC,[ -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_CPP]) +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross=compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so if we ever +# need to use a non standard strip, we just have to make sure we use +# install-sh with the STRIPPROG variable set. +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_MISSING_INSTALL_SH]) +dnl Don't test for $cross_compiling = yes, it might be `maybe'... +# We'd like to do this but we can't because it will unconditionally +# require config.guess. One way would be if autoconf had the capability +# to let us compile in this code only when config.guess was already +# a possibility. +#if test "$cross_compiling" != no; then +# # since we are cross-compiling, we need to check for a suitable `strip' +# AM_PROG_STRIP +# if test -z "$STRIP"; then +# AC_MSG_WARN([strip missing, install-strip will not strip binaries]) +# fi +#fi + +# If $STRIP is defined (either by the user, or by AM_PROG_STRIP), +# instruct install-strip to use install-sh and the given $STRIP program. +# Otherwise, just use ${INSTALL}: the idea is to use the vendor install +# as much as possible, because it's faster. +if test -z "$STRIP"; then + # The top level make will set INSTALL_PROGRAM=$(INSTALL_STRIP_PROGRAM) + # and the double dolard below is there to make sure that ${INSTALL} + # is substitued in the sub-makes, not at the top-level; this is + # needed if ${INSTALL} is a relative path (ajusted in each subdirectory + # by config.status). + INSTALL_STRIP_PROGRAM='$${INSTALL} -s' + INSTALL_STRIP_PROGRAM_ENV='' +else + _am_dirpart="`echo $install_sh | sed -e 's,//*[[^/]]*$,,'`" + INSTALL_STRIP_PROGRAM="\${SHELL} \`CDPATH=: && cd $_am_dirpart && pwd\`/install-sh -c -s" + INSTALL_STRIP_PROGRAM_ENV="STRIPPROG='\$(STRIP)'" +fi +AC_SUBST([STRIP]) +AC_SUBST([INSTALL_STRIP_PROGRAM]) +AC_SUBST([INSTALL_STRIP_PROGRAM_ENV])]) + +#AC_DEFUN([AM_PROG_STRIP], +#[# Check for `strip', unless the installer +# has set the STRIP environment variable. +# Note: don't explicitly check for -z "$STRIP" here because +# that will cause problems if AC_CANONICAL_* is AC_REQUIREd after +# this macro, and anyway it doesn't have an effect anyway. +#AC_CHECK_TOOL([STRIP],[strip]) +#]) + +# serial 3 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + +# AM_DEPENDENCIES(NAME) +# --------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX" or "OBJC". +# We try a few techniques and use that to set a single cache variable. +AC_DEFUN([AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +ifelse([$1], CC, + [AC_REQUIRE([AC_PROG_][CC])dnl +AC_REQUIRE([AC_PROG_][CPP]) depcc="$CC" -depcpp="$CPP"],[$1],CXX,[ -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +depcpp="$CPP"], + [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl +AC_REQUIRE([AC_PROG_][CXXCPP]) depcc="$CXX" -depcpp="$CXXCPP"],[$1],OBJC,[ -am_cv_OBJC_dependencies_compiler_type=gcc],[ -AC_REQUIRE([AC_PROG_][$1]) -depcc="$[$1]" +depcpp="$CXXCPP"], + [$1], OBJC, [am_cv_OBJC_dependencies_compiler_type=gcc], + [AC_REQUIRE([AC_PROG_][$1])dnl +depcc="$$1" depcpp=""]) -AC_MSG_CHECKING([dependency style of $depcc]) -AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[ -if test -z "$AMDEP"; then - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - am_cv_[$1]_dependencies_compiler_type=none - for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do +AC_REQUIRE([AM_MAKE_INCLUDE]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir confdir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" confdir + cd confdir + + am_cv_$1_dependencies_compiler_type=none + for depmode in `sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < "./depcomp"`; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + case "$depmode" in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll @@ -200,40 +394,51 @@ if test -z "$AMDEP"; then ;; none) break ;; esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. if depmode="$depmode" \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL $am_depcomp $depcc -c conftest.c 2>/dev/null && + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1; then - am_cv_[$1]_dependencies_compiler_type="$depmode" + am_cv_$1_dependencies_compiler_type="$depmode" break fi done - rm -f conftest.* + cd .. + rm -rf confdir else - am_cv_[$1]_dependencies_compiler_type=none + am_cv_$1_dependencies_compiler_type=none fi ]) -AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type) -[$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type" -AC_SUBST([$1]DEPMODE) +$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" +AC_SUBST([$1DEPMODE]) ]) -dnl Choose a directory name for dependency files. -dnl This macro is AC_REQUIREd in AM_DEPENDENCIES -AC_DEFUN(AM_SET_DEPDIR,[ -if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then DEPDIR=.deps + # We redirect because .deps might already exist and be populated. + # In this situation we don't want to see an error. + rmdir .deps > /dev/null 2>&1 else DEPDIR=_deps fi AC_SUBST(DEPDIR) ]) -AC_DEFUN(AM_DEP_TRACK,[ -AC_ARG_ENABLE(dependency-tracking, + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" = xno; then @@ -257,16 +462,16 @@ subst(AMDEPBACKSLASH) popdef([subst]) ]) -dnl Generate code to set up dependency tracking. -dnl This macro should only be invoked once -- use via AC_REQUIRE. -dnl Usage: -dnl AM_OUTPUT_DEPENDENCY_COMMANDS +# Generate code to set up dependency tracking. +# This macro should only be invoked once -- use via AC_REQUIRE. +# Usage: +# AM_OUTPUT_DEPENDENCY_COMMANDS -dnl -dnl This code is only required when automatic dependency tracking -dnl is enabled. FIXME. This creates each `.P' file that we will -dnl need in order to bootstrap the dependency handling code. -AC_DEFUN(AM_OUTPUT_DEPENDENCY_COMMANDS,[ +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ AC_OUTPUT_COMMANDS([ test x"$AMDEP" != x"" || for mf in $CONFIG_FILES; do @@ -308,10 +513,35 @@ done ], [AMDEP="$AMDEP" ac_aux_dir="$ac_aux_dir"])]) +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +# BSD make uses .include +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +_am_include='#' +for am_inc in include .include; do + echo "$am_inc confinc" > confmf + if test "`$am_make -f confmf 2> /dev/null`" = "done"; then + _am_include=$am_inc + break + fi +done +AC_SUBST(_am_include) +AC_MSG_RESULT($_am_include) +rm -f confinc confmf +]) + # serial 1 -AC_DEFUN(AM_C_PROTOTYPES, +AC_DEFUN([AM_C_PROTOTYPES], [AC_REQUIRE([AM_PROG_CC_STDC]) AC_REQUIRE([AC_PROG_CPP]) AC_MSG_CHECKING([for function prototypes]) @@ -322,10 +552,10 @@ if test "$am_cv_prog_cc_stdc" != no; then else AC_MSG_RESULT(no) U=_ ANSI2KNR=./ansi2knr - # Ensure some checks needed by ansi2knr itself. - AC_HEADER_STDC - AC_CHECK_HEADERS(string.h) fi +# Ensure some checks needed by ansi2knr itself. +AC_HEADER_STDC +AC_CHECK_HEADERS(string.h) AC_SUBST(U)dnl AC_SUBST(ANSI2KNR)dnl ]) @@ -348,7 +578,7 @@ AC_SUBST(ANSI2KNR)dnl # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac -AC_DEFUN(AM_PROG_CC_STDC, +AC_DEFUN([AM_PROG_CC_STDC], [AC_REQUIRE([AC_PROG_CC]) AC_BEFORE([$0], [AC_C_INLINE]) AC_BEFORE([$0], [AC_C_CONST]) @@ -358,7 +588,7 @@ dnl like #elif. dnl FIXME: can't do this because then AC_AIX won't work due to a dnl circular dependency. dnl AC_BEFORE([$0], [AC_PROG_CPP]) -AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C]) AC_CACHE_VAL(am_cv_prog_cc_stdc, [am_cv_prog_cc_stdc=no ac_save_CC="$CC" @@ -411,7 +641,7 @@ CC="$ac_save_CC" if test -z "$am_cv_prog_cc_stdc"; then AC_MSG_RESULT([none needed]) else - AC_MSG_RESULT($am_cv_prog_cc_stdc) + AC_MSG_RESULT([$am_cv_prog_cc_stdc]) fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; diff --git a/contrib/ntp/adjtimed/Makefile.in b/contrib/ntp/adjtimed/Makefile.in index f223c8e..72ae621 100644 --- a/contrib/ntp/adjtimed/Makefile.in +++ b/contrib/ntp/adjtimed/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../ansi2knr #no-dependencies @@ -108,107 +124,93 @@ INCLUDES = -I$(top_srcdir)/include LDADD = ../libntp/libntp.a #EXTRA_DIST = TAGS ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = adjtimed mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = adjtimed$(EXEEXT) +bin_PROGRAMS = @MAKE_ADJTIMED@ +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr adjtimed_SOURCES = adjtimed.c -adjtimed_OBJECTS = adjtimed$U.o +adjtimed_OBJECTS = adjtimed$U.$(OBJEXT) adjtimed_LDADD = $(LDADD) -adjtimed_DEPENDENCIES = ../libntp/libntp.a +adjtimed_DEPENDENCIES = ../libntp/libntp.a adjtimed_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = adjtimed.c -DIST_COMMON = README Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best +DIST_SOURCES = adjtimed.c depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/adjtimed$U.Po -SOURCES = adjtimed.c -OBJECTS = adjtimed$U.o - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu adjtimed/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - +@AMDEP@DEP_FILES = $(DEPDIR)/adjtimed$U.Po +DIST_COMMON = README Makefile.am Makefile.in -mostlyclean-binPROGRAMS: +SOURCES = adjtimed.c +OBJECTS = adjtimed$U.$(OBJEXT) -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu adjtimed/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - adjtimed: $(adjtimed_OBJECTS) $(adjtimed_DEPENDENCIES) @rm -f adjtimed $(LINK) $(adjtimed_LDFLAGS) $(adjtimed_OBJECTS) $(adjtimed_LDADD) $(LIBS) adjtimed_.c: adjtimed.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/adjtimed.c; then echo $(srcdir)/adjtimed.c; else echo adjtimed.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > adjtimed_.c -adjtimed_.o : $(ANSI2KNR) +adjtimed_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -219,9 +221,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -234,74 +236,71 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/adjtimed$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/adjtimed$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -312,45 +311,55 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ + uninstall uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/ntp/build b/contrib/ntp/build index 8caf641..22252d3 100755 --- a/contrib/ntp/build +++ b/contrib/ntp/build @@ -1,11 +1,27 @@ #! /bin/sh LOGF=make.log - -CONFIG_ARGS="$@" - IAM=`hostname || uname -n` +case "$1" in + 0.*) + SIG=$1 + shift + CONFIG_ARGS="$@" + KEY=`sed -e q < .buildkey` + case "$SIG" in + $KEY) ;; + *) + echo "Wrong directory for build on host $IAM" + exit 1 + ;; + esac + ;; + *) + CONFIG_ARGS="$@" + ;; +esac + #set -e #set -x @@ -28,6 +44,17 @@ case "$IAM" in ;; esac +KEYSUF="" + +case "$CONFIG_ARGS" in + *--with-crypto=autokey*) + KEYSUF="-autokey" + ;; + *--without-crypto*) + [ -d rsaref2 ] && KEYSUF="-norsaref" + ;; +esac + CCSUF="" case "$CC" in @@ -36,7 +63,7 @@ case "$CC" in ;; esac -BDIR="$BDIR$CCSUF" +BDIR="$BDIR$KEYSUF$CCSUF" [ -d "$BDIR" ] || mkdir $BDIR [ -f "$BDIR/.buildcvo" ] || echo $CVO > $BDIR/.buildcvo @@ -47,6 +74,8 @@ cd $BDIR ( [ -f config.status ] || ../configure $CONFIG_ARGS +./config.status + case "$MAKE" in '') make && make check ;; diff --git a/contrib/ntp/clockstuff/Makefile.in b/contrib/ntp/clockstuff/Makefile.in index 8eea5a9..da00d8d 100644 --- a/contrib/ntp/clockstuff/Makefile.in +++ b/contrib/ntp/clockstuff/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies @@ -111,90 +127,77 @@ propdelay_LDADD = -lm chutest_LDADD = ../libntp/libntp.a clktest_LDADD = ../libntp/libntp.a ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = clockstuff mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = propdelay$(EXEEXT) chutest$(EXEEXT) clktest$(EXEEXT) +noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ +PROGRAMS = $(noinst_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr chutest_SOURCES = chutest.c -chutest_OBJECTS = chutest$U.o -chutest_DEPENDENCIES = ../libntp/libntp.a +chutest_OBJECTS = chutest$U.$(OBJEXT) +chutest_DEPENDENCIES = ../libntp/libntp.a chutest_LDFLAGS = clktest_SOURCES = clktest.c -clktest_OBJECTS = clktest$U.o -clktest_DEPENDENCIES = ../libntp/libntp.a +clktest_OBJECTS = clktest$U.$(OBJEXT) +clktest_DEPENDENCIES = ../libntp/libntp.a clktest_LDFLAGS = propdelay_SOURCES = propdelay.c -propdelay_OBJECTS = propdelay$U.o -propdelay_DEPENDENCIES = +propdelay_OBJECTS = propdelay$U.$(OBJEXT) +propdelay_DEPENDENCIES = propdelay_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = chutest.c clktest.c propdelay.c -DIST_COMMON = README Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best +DIST_SOURCES = chutest.c clktest.c propdelay.c depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/chutest$U.Po $(DEPDIR)/clktest$U.Po \ -$(DEPDIR)/propdelay$U.Po +@AMDEP@DEP_FILES = $(DEPDIR)/chutest$U.Po $(DEPDIR)/clktest$U.Po \ +@AMDEP@ $(DEPDIR)/propdelay$U.Po +DIST_COMMON = README Makefile.am Makefile.in + SOURCES = chutest.c clktest.c propdelay.c -OBJECTS = chutest$U.o clktest$U.o propdelay$U.o +OBJECTS = chutest$U.$(OBJEXT) clktest$U.$(OBJEXT) propdelay$U.$(OBJEXT) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu clockstuff/Makefile +all: all-am -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu clockstuff/Makefile -mostlyclean-noinstPROGRAMS: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - propdelay: $(propdelay_OBJECTS) $(propdelay_DEPENDENCIES) @rm -f propdelay $(LINK) $(propdelay_LDFLAGS) $(propdelay_OBJECTS) $(propdelay_LDADD) $(LIBS) @@ -204,7 +207,8 @@ clktest_.c: clktest.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clktest.c; then echo $(srcdir)/clktest.c; else echo clktest.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > clktest_.c propdelay_.c: propdelay.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/propdelay.c; then echo $(srcdir)/propdelay.c; else echo propdelay.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > propdelay_.c -chutest_.o clktest_.o propdelay_.o : $(ANSI2KNR) +chutest_.$(OBJEXT) clktest_.$(OBJEXT) propdelay_.$(OBJEXT) : \ +$(ANSI2KNR) tags: TAGS @@ -215,9 +219,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -230,75 +234,72 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/chutest$U.Po -@AMDEP@include $(DEPDIR)/clktest$U.Po -@AMDEP@include $(DEPDIR)/propdelay$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/chutest$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clktest$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/propdelay$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -309,45 +310,53 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am -clean-am: clean-noinstPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-kr tags uninstall uninstall-am #EXTRA_DIST = TAGS diff --git a/contrib/ntp/conf/baldwin.conf b/contrib/ntp/conf/baldwin.conf index 0781825..0998a9f 100644 --- a/contrib/ntp/conf/baldwin.conf +++ b/contrib/ntp/conf/baldwin.conf @@ -6,18 +6,17 @@ # driver, as well as a multicast server. The prefer keyword on the # local clock driver declares an external clock and that the time of # this server should not be wiggled by an NTP peer, unless the -# external clock comes unstuck. Note the use of the multicast group +# external source comes unstuck. Note the use of the multicast group # ID assigned to NTP, 224.0.1.1, which identifies this as a multicast # server rather than a broadcast one. The other NTP peers are known # stratum-1 chimes intended as backup should the external clock croak. # -peer 127.127.1.0 prefer # local clock driver -fudge 127.127.12.0 stratum 0 refid GPS +server 127.127.1.0 prefer # local clock driver broadcast 224.0.1.1 key 6 ttl 127 -peer rackety.udel.edu # (Sun4c/40 IPC) -peer barnstable.udel.edu # (Sun4c/65 SS1+) -peer mizbeaver.udel.edu #(Bancomm bc700LAN) -peer pogo.udel.edu # (Sun4c/65 SS1+) +peer rackety.udel.edu +peer barnstable.udel.edu +peer mizbeaver.udel.edu +peer pogo.udel.edu # # Miscellaneous stuff # diff --git a/contrib/ntp/conf/grundoon.conf b/contrib/ntp/conf/grundoon.conf index 4462923..a26522d 100644 --- a/contrib/ntp/conf/grundoon.conf +++ b/contrib/ntp/conf/grundoon.conf @@ -2,153 +2,35 @@ # NTP configuration file (ntp.conf) # grundoon.udel.edu # -# This machine can best be described as the kitchen sink. It has, in -# addition to the baseboard tty ports ttya and ttyb, an 8-line -# Serial/Parallel Interface (SPIF) with ports ttyz00 through ttyz07. The -# configuration includes the following drivers, clock addresses and Unix -# device names. -# -# Local Clock 127.127.1.0 /dev/audio -# PST 1020 WWV/WWVH Receiver 127.127.3.1 /dev/pst1 -# Spectracom 8170 WWVB Receiver 127.127.4.1 /dev/wwvb1 -# IRIG Audio Decoder 127.127.6.0 /dev/audio -# Scratchbuilt CHU Receiver 127.127.7.1 /dev/chu1 -# NIST ACTS modem 127.127.18.1 /dev/acts1 -# Heath GC-1000 WWV Receiver 127.127.19.1 /dev/pst1 -# PPS Clock 127.127.22.1 none -# -# This machine has the kernel modifications described in the README.kern -# file, as well as the tty_clk, tty_chu and ppsclock streams modules. -# -# Spectracom 8170/Netclock-2 WWVB receiver. This receiver is equipped -# with a 1-pps and IRIG outputs. The 1-pps signal is connected via the -# ppsclock streams module and the carrier detect line of the CHU -# receiver below (ttyb). The IRIG signal is connected via an attenuator -# to the audio port (/dev/audio). The propagation delay computed from -# geographical coordinates is 8.8 ms, while the receiver delay -# calibrated at the factory is 17.3 ms, for a total delay of 26.1 ms. -# This is confirmed within 0.1 ms at the 1-pps signal output using a -# portable cesium clock. We add a fudge time1 of 3.5 ms so the driver -# time agrees with the 1-pps signal to within 1 ms. The fudge flag4 is -# set to cause the receiver to dump the quality table once each day to -# the clockstats file. - -# -#server 127.127.4.1 # /dev/wwvb1 -> /dev/ttyz03 -#fudge 127.127.4.1 time1 0.0035 flag4 1 -# -# IRIG Audio Decoder. The IRGI signal of the Spectracom WWVB receiver is -# connected to the audio codec via a resistor attenuator. We add a fudge -# time1 of 3.5 ms so the driver agrees with the calibrated 1-pps signal -# to within 0.1 ms. We also specify a reference ID of WWVB to indicate -# the signal origin. Note the prefer keyword in the server line, which -# favors this driver over all others that survive the clock selection -# algorithm. See README.refclock for further insight on this feature. -# -server 127.127.6.0 prefer # /dev/audio -fudge 127.127.6.0 time1 0.0005 refid WWVB +server 127.127.11.1 prefer # Arbiter 1088 GPS receiver +fudge 127.127.11.1 time1 .00487 flag1 1 flag4 1 +server 127.127.22.1 minpoll 4 # PPS quick poll +fudge 127.127.22.1 # use PLL/FLL loop -# -# PST/Traconex 1020 WWV/WWVH Receier. The internal DIPswitches are set -# as near as possible to the delays to WWV (8.8 ms) and WWVH (28.1 ms), -# as computed from geographical coordinates. We add a fudge time1 of 5.9 -# ms so the driver time agrees with the 1-pps signal to within 1 ms for -# WWV. We also set the stratum to 1, so this receiver will not normally -# be selected, unless the primary WWVB receiver comes unstuck. -# -server 127.127.3.1 # /dev/pst1 -> ttyz05 -fudge 127.127.3.1 time1 0.0059 stratum 1 +broadcast 128.4.2.255 key 5 # brpadcast on LAN shared key +broadcast 239.1.1.2 autokey # multicast on WAN autokey +manycastclient 239.1.1.1 autokey maxpoll 12 ttl 7 +manycastserver 239.1.1.1 # -# Scratchbuilt CHU Receiver. The audio signal from a computer controlled -# CHU receiver is connected to a gadget box, which contains a 103A modem -# chip and level converter operating at 300 bps. The propagation delay -# computed from geographical coordinates is 3.0 ms, which is the value -# of the fudge time1 parameter. We add a fudge time2 of 9.9 ms so that -# the driver time agrees with the 1-pps signal to within a few ms, -# ordinarily the best possible with this receiver. The fudge flag3 is -# set because the 1-pps signal happens to be connected vit the carrier -# detect line on this port (ttyb). We also set the stratum to 1, so this -# receiver will not normally be selected, unless the primary WWVB -# receiver comes unstuck. -# -server 127.127.7.1 # /dev/chu1 -> /dev/ttyb -fudge 127.127.7.1 time1 0.0030 time2 0.0099 flag3 1 stratum 1 - -# -# NIST Automated Computer Time Service. This driver calls a special -# telephone number in Boulder, CO, to fetch the time directly from the -# NIST cesium farm. The details of the complicated calling program are -# in the README.refclock file. The Practical Peripherals 9600SA modem -# does not work correctly with the ACTS echo-delay scheme for -# automatically calculating the propagation delay, so the fudge flag2 is -# set to disable the feature. Instead, we add a fudge time1 of 65.0 ms -# so that the driver time agrees with th e1-pps signal to within 1 ms. -# The phone command specifies three alternate telephone numbers, -# including AT modem command prefix, which will be tried one after the -# other at each measurement attempt. In this case, a cron job is used to -# set fudge flag1, causing a measurement attempt, every six hours. -# -server 127.127.18.1 # /dev/acts1 -> /dev/ttyz00 -fudge 127.127.18.1 time1 0.0650 flag2 1 -phone atdt13034944774 atdt13034944785 atdt13034944774 - +# Access control stuff # -# Heath GC-1000 Most Accurate Clock. This is a WWV receiver with a -# claimed accuracy better than 100 ms under "hi spec" conditions, but -# such conditions are not frequent. The propagation delay DIPswitchs are -# set to 9 ms, as close as possible to the 8.8 ms computed from -# geographical coordinates. We add a fudge time2 of 40.0 ms so that the -# driver time agrees with the 1-pps signal to within 50 ms, ordinarily -# the best possible with this receiver. We also set the stratum to 1, so -# this receiver will not normally be selected, unless the primary WWVB -# receiver comes unstuck. +restrict default noserve # default deny +restrict 127.0.0.1 # allow local host +restrict 128.4.0.0 mask 255.255.0.0 # allow DCnet clients +restrict 128.175.0.0 mask 255.255.0.0 # allow UDel clients +restrict 140.173.0.0 mask 255.255.0.0 # allow DARTnet/CAIRN clients # -server 127.127.19.1 # /dev/heath1 -> ttyz07 -fudge 127.127.19.1 time1 0.040 stratum 1 - -# -# Undisciplined Local Clock. This is a fake driver intended for backup -# and when no outside source of synchronized time is available. The -# default stratum is usually 3, but in this case we elect to use stratum -# 0. Since the server line does not have the prefer keyword, this driver -# is never used for synchronization, unless no other other -# synchronization source is available. In case the local host is -# controlled by some external source, such as an external oscillator or -# another protocol, the prefer keyword would cause the local host to -# disregard all other synchronization sources, unless the kernel -# modifications are in use and declare an unsynchronized condition. -# -server 127.127.1.0 # local clock -fudge 127.127.1.0 stratum 0 - -# -# PPS Clock. This driver is used to capture a 1-pps signal when the PPS -# kernel modifications are not in use. It can be configured for the -# tty_clk or ppsclock streams module or no module at all, assuming the -# RS232 connector is properly wired. Normally, the 1-pps signal is -# generated by a radio clock, in this cast the Spectracom clock -# 127.127.4.1 also configured for this host. When used this way, the -# associated radio clock normally has the prefer keyword in the serve -# command line. The PPS driver then will be selected only if the prefer -# peer is operating within nominal error bounds. See the README.refclock -# file for further details. +# Authentication stuff # -#server 127.127.22.1 # pps clock - +crypto # enable public key +keys /usr/local/etc/ntp.keys # path for keys file +trustedkey 3 4 5 14 # define trusted keys +requestkey 14 # key (7) for accessing server variables +controlkey 14 # key (6) for accessing server variables # -# Miscellaneous stuff. We enable authentication in order to prevent +# Miscellaneous stuff # driftfile /etc/ntp.drift # path for drift file -statsdir /grundoon/ntpstats/ # directory for statistics files -filegen peerstats file peerstats type day enable +statsdir /var/spool/ntpstats/ # directory for statistics files filegen loopstats file loopstats type day enable -filegen clockstats file clockstats type day enable - -# -# Authentication stuff -# -keys /usr/local/etc/ntp.keys # path for keys file -trustedkey 1 2 3 4 5 6 14 15 # define trusted keys -requestkey 15 # key (7) for accessing server variables -controlkey 15 # key (6) for accessing server variables diff --git a/contrib/ntp/conf/pogo.conf b/contrib/ntp/conf/pogo.conf index e97d4c5..2014fdd 100644 --- a/contrib/ntp/conf/pogo.conf +++ b/contrib/ntp/conf/pogo.conf @@ -1,30 +1,55 @@ # # NTP configuration file (ntp.conf) -# pogo.udel.edu -# -server 127.127.10.1 prefer # austron 2201A gps receiver -peer 128.4.1.1 # rackety.udel.edu (Sun4c/40 IPC) -peer 128.4.1.2 # mizbeaver.udel.edu (Bancomm bc700LAN) -peer 128.4.1.4 # barnstable.udel.edu (Sun4c/65 SS1+) -peer 128.4.1.5 maxpoll 8 # churchy.udel.edu (cisco IGS router) -peer 132.163.135.130 maxpoll 8 # time_A.timefreq.bldrdoc.gov (Cesium) -peer 131.188.1.40 maxpoll 8 # ntps1-0.uni-erlangen.de (DCF77) -peer 129.132.2.21 maxpoll 8 # swisstime.ethz.ch (DCF77) -peer 130.155.98.13 maxpoll 8 # terss.ml.csiro.au (Cesium) -peer 192.36.143.150 maxpoll 8 # Time1.Stupi.SE (Cesium) +# SunOS pogo.udel.edu 5.8 Generic sun4u sparc SUNW,Ultra-1 # -# Miscellaneous stuff +server 127.127.6.1 prefer # IRIG from GPS1 +fudge 127.127.6.1 refid GPS1 time1 -.002777 flag2 1 +server 127.127.4.1 # spectracom GPS receiver +# delays: prop 0.0088 ant .0002 rcvr .0173 = 26.3 ms; os .0035 +fudge 127.127.4.1 refid GPS2 time1 .000221 +server 127.127.22.0 # PPS from GPS2 +fudge 127.127.22.0 flag3 1 # kernel PPS # -precision -18 # clock reading precision (usec) -driftfile /etc/ntp.drift # path for drift file -statsdir /pogo/ntpstats/ # directory for statistics files -filegen peerstats file peerstats type day enable -filegen loopstats file loopstats type day enable -filegen clockstats file clockstats type day enable +# Backups +# +server 128.4.1.2 # mizbeaver +server 128.175.60.175 version 3 # ntp1.nss +# +# Services +# +manycastclient 239.1.1.1 autokey maxpoll 12 ttl 7 +manycastserver 239.1.1.1 +# +# Access control stuff +# +restrict default noserve # default deny +restrict 127.0.0.1 # allow local host +restrict 128.4.0.0 mask 255.255.0.0 # allow DCnet clients +restrict 128.175.0.0 mask 255.255.0.0 # allow UDel clients +restrict 140.173.0.0 mask 255.255.0.0 # allow DARTnet/CAIRN clients # # Authentication stuff # +# Local filesystem +# /etc/ntpkey -> ntpkey.3171396491 +# /etc/ntpkey.3171396491 +# +# NFS mounted filesystem +# /usr/local/etc/ntpkey -> /etc/ntpkey +# /usr/local/etc/ntpkey_dh -> ntpkey_dh.3171396491 +# /usr/local/etc/ntpkey_dh.3171396491 +# /usr/local/etc/ntpkey_pogo.udel.edu -> ntpkey_pogo.udel.edu.3171396491 +# /usr/local/etc/ntpkey_pogo.udel.edu.3171396491 +# +crypto privatekey /etc/ntpkey # enable public key keys /usr/local/etc/ntp.keys # path for keys file -trustedkey 3 4 5 6 14 # define trusted keys -requestkey 15 # key (7) for accessing server variables -controlkey 15 # key (6) for accessing server variables +trustedkey 3 4 5 14 # define trusted keys +requestkey 14 # key (7) for accessing server variables +controlkey 14 # key (6) for accessing server variables +# +# Miscellaneous stuff +# +driftfile /etc/ntp.drift # path for drift file +statsdir /var/spool/ntpstats/ # directory for statistics files +filegen loopstats file loopstats type day enable + diff --git a/contrib/ntp/conf/rackety.conf b/contrib/ntp/conf/rackety.conf new file mode 100644 index 0000000..d3f231c --- /dev/null +++ b/contrib/ntp/conf/rackety.conf @@ -0,0 +1,48 @@ +# +# NTP configuration file (ntp.conf) +# SunOS rackety.u 4.1.3 243 sun4c +# +server 127.127.4.0 prefer # Spectracom GPS receiver #1 +fudge 127.127.4.0 refid GPS1 time1 -.000097 flag1 1 +server 127.127.4.1 # Spectracom GPS receiver #2 +fudge 127.127.4.1 refid GPS2 time1 -.000097 flag1 1 +server 127.127.4.2 # Spectracom WWVB receiver #1 +# delays: prop 0.0088 ant .0002 rcvr .0173 = 26.3 ms; os .0035 +fudge 127.127.4.2 refid WVB1 time1 .0021 flag4 1 flag1 1 +server 127.127.4.3 # Spectracom WWVB receiver #2 +# delays: prop 0.0088 ant .0002 rcvr .0173 = 26.3 ms; os .0035 +fudge 127.127.4.3 refid WVB2 time1 .0021 flag4 1 flag1 1 +server 127.127.22.1 # PPS +fudge 127.127.22.1 flag3 1 # kernel PPS +# +# Services +# +broadcast 224.0.1.1 autokey # multicast +broadcast 128.4.1.255 autokey # local subnet broadcast +manycastclient 239.1.1.1 autokey maxpoll 12 ttl 7 # manycast +manycastserver 239.1.1.1 # manycast +# +# Access controls +# +restrict default limited # default limit clients per net +restrict 127.0.0.1 # allow local host +restrict 128.4.0.0 mask 255.255.0.0 # allow DCnet clients +restrict 128.175.0.0 mask 255.255.0.0 # allow UDELnet clients +restrict 140.173.0.0 mask 255.255.0.0 # allow DARTnet/CAIRN clients +# +# Authentication stuff +# +crypto # enable public key +keys /usr/local/etc/ntp.keys # symmetric keys file +trustedkey 3 4 5 14 # define trusted keys +requestkey 14 # key (7) for accessing server variables +controlkey 14 # key (6) for accessing server variables +# +# Miscellaneous stuff +# +driftfile /etc/ntp.drift # frequency offset +statsdir /rackety/ntpstats/ # directory for statistics files +filegen peerstats file peerstats type day enable +filegen loopstats file loopstats type day enable +filegen clockstats file clockstats type day enable + diff --git a/contrib/ntp/config.guess b/contrib/ntp/config.guess index a28a214..c339a94 100755 --- a/contrib/ntp/config.guess +++ b/contrib/ntp/config.guess @@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -# + +timestamp='2001-06-29' + # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -23,51 +25,153 @@ # the same distribution terms that you use for the rest of that program. # Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list <autoconf@gnu.org>. +# Please send patches to <config-patches@gnu.org>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -77,41 +181,52 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text .globl main + .align 4 .ent main main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit .end main EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; esac fi rm -f $dummy.s $dummy @@ -127,11 +242,8 @@ EOF echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -156,13 +268,13 @@ EOF wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -218,15 +330,12 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor + # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not @@ -250,15 +359,9 @@ EOF *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -271,9 +374,6 @@ EOF powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -289,6 +389,7 @@ EOF mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -307,12 +408,16 @@ EOF exit (-1); } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 + && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -328,15 +433,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -357,9 +465,17 @@ EOF ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c @@ -373,7 +489,8 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then @@ -382,9 +499,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -392,7 +509,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -402,7 +519,7 @@ EOF ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -418,11 +535,31 @@ EOF echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> @@ -453,12 +590,18 @@ EOF exit (0); } EOF - ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + eval $set_cc_for_build + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include <unistd.h> @@ -485,7 +628,8 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; @@ -504,7 +648,7 @@ EOF hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -547,29 +691,30 @@ EOF -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) @@ -579,17 +724,8 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; @@ -599,6 +735,9 @@ EOF i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -617,150 +756,95 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - armv*) UNAME_MACHINE=$UNAME_MACHINE ;; - arm* | sa110*) UNAME_MACHINE="arm" ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac - + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev67 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;; - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc | elf32ppclinux) - # Determine Lib Version - cat >$dummy.c <<EOF -#include <features.h> -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unkown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;; + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF + # Determine whether the default compiler is a.out or elf + cat >$dummy.c <<EOF #include <features.h> #ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -768,28 +852,31 @@ EOF #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); + printf ("%s-pc-linux-gnu\n", argv[1]); # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) + i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, @@ -797,22 +884,23 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:5:7*) - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585 - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; - i?86:*:3.2:*) + i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo ${UNAME_MACHINE}-pc-isc$UNAME_REL @@ -830,7 +918,11 @@ EOF echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -854,7 +946,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -865,21 +957,24 @@ EOF 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -913,7 +1008,7 @@ EOF mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) @@ -944,6 +1039,64 @@ EOF *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1035,11 +1188,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -1050,7 +1216,8 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +eval $set_cc_for_build +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -1083,6 +1250,48 @@ then esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/contrib/ntp/config.h.in b/contrib/ntp/config.h.in index 24fedb1..aa38268 100644 --- a/contrib/ntp/config.h.in +++ b/contrib/ntp/config.h.in @@ -1,67 +1,4 @@ /* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -#undef _ALL_SOURCE -#endif - -/* Define if type char is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -#undef __CHAR_UNSIGNED__ -#endif - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef gid_t - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define if on MINIX. */ -#undef _MINIX - -/* Define if your struct nlist has an n_un member. */ -#undef NLIST_NAME_UNION - -/* Define if you have <nlist.h>. */ -#undef NLIST_STRUCT - -/* Define to `long' if <sys/types.h> doesn't define. */ -#undef off_t - -/* Define if the system does not provide POSIX.1 features except - with this defined. */ -#undef _POSIX_1_SOURCE - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define if your <sys/time.h> declares struct tm. */ -#undef TM_IN_SYS_TIME - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef uid_t - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - /* debugging code */ #undef DEBUG @@ -134,6 +71,12 @@ /* HOPF 6021 clock */ #undef CLOCK_HOPF6021 +/* HOPF PCI clock device */ +#undef CLOCK_HOPF_PCI + +/* HOPF serial clock device*/ +#undef CLOCK_HOPF_SERIAL + /* HP 58503A GPS receiver */ #undef CLOCK_HPGPS @@ -326,6 +269,9 @@ /* can we use SIGPOLL for tty IO? */ #undef USE_TTY_SIGPOLL +/* should we use clock_settime()? */ +#undef USE_CLOCK_SETTIME + /* do we want the CHU driver? */ #undef CLOCK_CHU @@ -353,6 +299,9 @@ /* do we need an s_char typedef? */ #undef NEED_S_CHAR_TYPEDEF +/* include the GDT Surveying code? */ +#undef GDT_SURVEYING + /* does SIOCGIFCONF return size in the buffer? */ #undef SIZE_RETURNED_IN_BUFFER @@ -426,9 +375,6 @@ /* Define if you have the TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, and ASYNC_PPS_CD_NEG ioctls (linux) */ #undef HAVE_TIO_SERIAL_STUFF -/* Define if you use struct timespec rather than struct timeval (time in ns rather than us) */ -#undef HAVE_TIMESPEC - /* Define if you have the interface in the Draft RFC */ #undef HAVE_PPSAPI @@ -438,6 +384,10 @@ /* Do we have support for SHMEM_STATUS? */ #undef ONCORE_SHMEM_STATUS +/***/ + +/* Which way should we declare... */ + /* adjtime()? */ #undef DECL_ADJTIME_0 @@ -450,6 +400,9 @@ /* cfset[io]speed()? */ #undef DECL_CFSETISPEED_0 +/* hstrerror()? */ +#undef DECL_HSTRERROR_0 + /* ioctl()? */ #undef DECL_IOCTL_0 @@ -459,6 +412,9 @@ /* memmove()? */ #undef DECL_MEMMOVE_0 +/* memset()? */ +#undef DECL_MEMSET_0 + /* mkstemp()? */ #undef DECL_MKSTEMP_0 @@ -518,387 +474,511 @@ /* toupper()? */ #undef DECL_TOUPPER_0 -/* The number of bytes in a int. */ -#undef SIZEOF_INT +/* strerror()? */ +#undef DECL_STRERROR_0 -/* The number of bytes in a long. */ -#undef SIZEOF_LONG +#undef ULONG_CONST -/* The number of bytes in a signed char. */ -#undef SIZEOF_SIGNED_CHAR +/* Autokey? */ +#undef AUTOKEY -/* Define if you have the K_open function. */ -#undef HAVE_K_OPEN +/* Define if you have the <arpa/nameser.h> header file. */ +#undef HAVE_ARPA_NAMESER_H -/* Define if you have the __adjtimex function. */ -#undef HAVE___ADJTIMEX +/* Do we have audio support? */ +#undef HAVE_AUDIO -/* Define if you have the __ntp_gettime function. */ -#undef HAVE___NTP_GETTIME +/* Define if you have the <bstring.h> header file. */ +#undef HAVE_BSTRING_H -/* Define if you have the clock_settime function. */ +/* Define if you have the `clock_settime' function. */ #undef HAVE_CLOCK_SETTIME -/* Define if you have the daemon function. */ +/* Define if you have the `daemon' function. */ #undef HAVE_DAEMON -/* Define if you have the getbootfile function. */ +/* Define if you have the <errno.h> header file. */ +#undef HAVE_ERRNO_H + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the `finite' function. */ +#undef HAVE_FINITE + +/* Define if you have the `getbootfile' function. */ #undef HAVE_GETBOOTFILE -/* Define if you have the getdtablesize function. */ +/* Define if you have the `getclock' function. */ +#undef HAVE_GETCLOCK + +/* Define if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE -/* Define if you have the getrusage function. */ +/* Define if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE -/* Define if you have the gettimeofday function. */ +/* Define if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define if you have the getuid function. */ +/* Define if you have the `getuid' function. */ #undef HAVE_GETUID -/* Define if you have the kvm_open function. */ +/* Define if you have the `hstrerror' function. */ +#undef HAVE_HSTRERROR + +/* Define if you have the <ieeefp.h> header file. */ +#undef HAVE_IEEEFP_H + +/* Define if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the `isfinite' function. */ +#undef HAVE_ISFINITE + +/* Define if you have the `kvm_open' function. */ #undef HAVE_KVM_OPEN -/* Define if you have the memcpy function. */ +/* Define if you have the `K_open' function. */ +#undef HAVE_K_OPEN + +/* Define if you have the `advapi32' library (-ladvapi32). */ +#undef HAVE_LIBADVAPI32 + +/* Define if you have the `elf' library (-lelf). */ +#undef HAVE_LIBELF + +/* Define if you have the `gen' library (-lgen). */ +#undef HAVE_LIBGEN + +/* Define if you have the `kvm' library (-lkvm). */ +#undef HAVE_LIBKVM + +/* Define if you have the `ld' library (-lld). */ +#undef HAVE_LIBLD + +/* Define if you have the `mld' library (-lmld). */ +#undef HAVE_LIBMLD + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `posix4' library (-lposix4). */ +#undef HAVE_LIBPOSIX4 + +/* Define if you have the `readline' library (-lreadline). */ +#undef HAVE_LIBREADLINE + +/* Define if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the <machine/inline.h> header file. */ +#undef HAVE_MACHINE_INLINE_H + +/* Define if you have the <math.h> header file. */ +#undef HAVE_MATH_H + +/* Define if you have the `memcpy' function. */ #undef HAVE_MEMCPY -/* Define if you have the memlk function. */ +/* Define if you have the `memlk' function. */ #undef HAVE_MEMLK -/* Define if you have the memmove function. */ +/* Define if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define if you have the memset function. */ +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the `memset' function. */ #undef HAVE_MEMSET -/* Define if you have the mkstemp function. */ +/* Define if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP -/* Define if you have the mktime function. */ +/* Define if you have the `mktime' function. */ #undef HAVE_MKTIME -/* Define if you have the mlockall function. */ +/* Define if you have the `mlockall' function. */ #undef HAVE_MLOCKALL -/* Define if you have the mrand48 function. */ +/* Define if you have the `mrand48' function. */ #undef HAVE_MRAND48 -/* Define if you have the nice function. */ +/* Define if you have the <netdb.h> header file. */ +#undef HAVE_NETDB_H + +/* Define if you have the <netinet/in.h> header file. */ +#undef HAVE_NETINET_IN_H + +/* Define if you have the <netinet/in_systm.h> header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define if you have the <netinfo/ni.h> header file. */ +#undef HAVE_NETINFO_NI_H + +/* Define if you have the <net/if.h> header file. */ +#undef HAVE_NET_IF_H + +/* Define if you have the `nice' function. */ #undef HAVE_NICE -/* Define if you have the nlist function. */ +/* Define if you have the `nlist' function. */ #undef HAVE_NLIST -/* Define if you have the ntp_adjtime function. */ +/* Define if you have the `ntp_adjtime' function. */ #undef HAVE_NTP_ADJTIME -/* Define if you have the ntp_gettime function. */ +/* Define if you have the `ntp_gettime' function. */ #undef HAVE_NTP_GETTIME -/* Define if you have the plock function. */ +/* Define if you have the `plock' function. */ #undef HAVE_PLOCK -/* Define if you have the pututline function. */ +/* Define if you have the <poll.h> header file. */ +#undef HAVE_POLL_H + +/* Define if you have the `pututline' function. */ #undef HAVE_PUTUTLINE -/* Define if you have the pututxline function. */ +/* Define if you have the `pututxline' function. */ #undef HAVE_PUTUTXLINE -/* Define if you have the random function. */ +/* Define if you have the `random' function. */ #undef HAVE_RANDOM -/* Define if you have the rtprio function. */ +/* Define if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define if you have the <resolv.h> header file. */ +#undef HAVE_RESOLV_H + +/* Define if you have the `rtprio' function. */ #undef HAVE_RTPRIO -/* Define if you have the sched_setscheduler function. */ +/* Define if you have the <sched.h> header file. */ +#undef HAVE_SCHED_H + +/* Define if you have the `sched_setscheduler' function. */ #undef HAVE_SCHED_SETSCHEDULER -/* Define if you have the setlinebuf function. */ +/* Define if you have the `setlinebuf' function. */ #undef HAVE_SETLINEBUF -/* Define if you have the setpgid function. */ +/* Define if you have the `setpgid' function. */ #undef HAVE_SETPGID -/* Define if you have the setpriority function. */ +/* Define if you have the `setpriority' function. */ #undef HAVE_SETPRIORITY -/* Define if you have the setsid function. */ +/* Define if you have the `setsid' function. */ #undef HAVE_SETSID -/* Define if you have the settimeofday function. */ +/* Define if you have the `settimeofday' function. */ #undef HAVE_SETTIMEOFDAY -/* Define if you have the setvbuf function. */ +/* Define if you have the `setvbuf' function. */ #undef HAVE_SETVBUF -/* Define if you have the sigaction function. */ +/* Define if you have the <sgtty.h> header file. */ +#undef HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ #undef HAVE_SIGACTION -/* Define if you have the sigset function. */ +/* Define if you have the `sigset' function. */ #undef HAVE_SIGSET -/* Define if you have the sigsuspend function. */ +/* Define if you have the `sigsuspend' function. */ #undef HAVE_SIGSUSPEND -/* Define if you have the sigvec function. */ +/* Define if you have the `sigvec' function. */ #undef HAVE_SIGVEC -/* Define if you have the srand48 function. */ +/* Define if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the `srand48' function. */ #undef HAVE_SRAND48 -/* Define if you have the srandom function. */ -#undef HAVE_SRANDOM +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H -/* Define if you have the stime function. */ +/* Define if you have the `stime' function. */ #undef HAVE_STIME -/* Define if you have the strchr function. */ +/* Define if you have the `strchr' function. */ #undef HAVE_STRCHR -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the sysconf function. */ -#undef HAVE_SYSCONF - -/* Define if you have the sysctl function. */ -#undef HAVE_SYSCTL - -/* Define if you have the timer_create function. */ -#undef HAVE_TIMER_CREATE - -/* Define if you have the timer_settime function. */ -#undef HAVE_TIMER_SETTIME - -/* Define if you have the umask function. */ -#undef HAVE_UMASK - -/* Define if you have the uname function. */ -#undef HAVE_UNAME +/* Define if you have the `strdup' function. */ +#undef HAVE_STRDUP -/* Define if you have the updwtmp function. */ -#undef HAVE_UPDWTMP - -/* Define if you have the updwtmpx function. */ -#undef HAVE_UPDWTMPX - -/* Define if you have the vsprintf function. */ -#undef HAVE_VSPRINTF - -/* Define if you have the </sys/sync/queue.h> header file. */ -#undef HAVE__SYS_SYNC_QUEUE_H - -/* Define if you have the </sys/sync/sema.h> header file. */ -#undef HAVE__SYS_SYNC_SEMA_H - -/* Define if you have the <arpa/nameser.h> header file. */ -#undef HAVE_ARPA_NAMESER_H - -/* Define if you have the <bstring.h> header file. */ -#undef HAVE_BSTRING_H - -/* Define if you have the <errno.h> header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the <machine/inline.h> header file. */ -#undef HAVE_MACHINE_INLINE_H - -/* Define if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the <net/if.h> header file. */ -#undef HAVE_NET_IF_H - -/* Define if you have the <netdb.h> header file. */ -#undef HAVE_NETDB_H - -/* Define if you have the <netinet/in.h> header file. */ -#undef HAVE_NETINET_IN_H - -/* Define if you have the <netinet/in_systm.h> header file. */ -#undef HAVE_NETINET_IN_SYSTM_H +/* Define if you have the `strerror' function. */ +#undef HAVE_STRERROR -/* Define if you have the <netinfo/ni.h> header file. */ -#undef HAVE_NETINFO_NI_H +/* Define if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H -/* Define if you have the <poll.h> header file. */ -#undef HAVE_POLL_H +/* Define if you have the <string.h> header file. */ +#undef HAVE_STRING_H -/* Define if you have the <resolv.h> header file. */ -#undef HAVE_RESOLV_H +/* Do we have struct ntptimeval? */ +#undef HAVE_STRUCT_NTPTIMEVAL -/* Define if you have the <sched.h> header file. */ -#undef HAVE_SCHED_H +/* Define if `time.tv_nsec' is member of `struct ntptimeval'. */ +#undef HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC -/* Define if you have the <sgtty.h> header file. */ -#undef HAVE_SGTTY_H +/* Do we have struct timespec? */ +#undef HAVE_STRUCT_TIMESPEC -/* Define if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H +/* Define if you have the <sun/audioio.h> header file. */ +#undef HAVE_SUN_AUDIOIO_H -/* Define if you have the <string.h> header file. */ -#undef HAVE_STRING_H +/* Define if you have the `sysconf' function. */ +#undef HAVE_SYSCONF -/* Define if you have the <sun/audioio.h> header file. */ -#undef HAVE_SUN_AUDIOIO_H +/* Define if you have the `sysctl' function. */ +#undef HAVE_SYSCTL -/* Define if you have the <sys/audioio.h> header file. */ +/* Define if you have the <sys/audioio.h> header file. */ #undef HAVE_SYS_AUDIOIO_H -/* Define if you have the <sys/clkdefs.h> header file. */ +/* Define if you have the <sys/clkdefs.h> header file. */ #undef HAVE_SYS_CLKDEFS_H -/* Define if you have the <sys/file.h> header file. */ +/* Define if you have the <sys/file.h> header file. */ #undef HAVE_SYS_FILE_H -/* Define if you have the <sys/i8253.h> header file. */ +/* Define if you have the <sys/i8253.h> header file. */ #undef HAVE_SYS_I8253_H -/* Define if you have the <sys/ioctl.h> header file. */ +/* Define if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H -/* Define if you have the <sys/lock.h> header file. */ +/* Define if you have the <sys/lock.h> header file. */ #undef HAVE_SYS_LOCK_H -/* Define if you have the <sys/mman.h> header file. */ +/* Define if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H -/* Define if you have the <sys/modem.h> header file. */ +/* Define if you have the <sys/modem.h> header file. */ #undef HAVE_SYS_MODEM_H -/* Define if you have the <sys/param.h> header file. */ +/* Define if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H -/* Define if you have the <sys/pcl720.h> header file. */ +/* Define if you have the <sys/pcl720.h> header file. */ #undef HAVE_SYS_PCL720_H -/* Define if you have the <sys/ppsclock.h> header file. */ +/* Define if you have the <sys/ppsclock.h> header file. */ #undef HAVE_SYS_PPSCLOCK_H -/* Define if you have the <sys/ppstime.h> header file. */ +/* Define if you have the <sys/ppstime.h> header file. */ #undef HAVE_SYS_PPSTIME_H -/* Define if you have the <sys/proc.h> header file. */ +/* Define if you have the <sys/proc.h> header file. */ #undef HAVE_SYS_PROC_H -/* Define if you have the <sys/resource.h> header file. */ +/* Define if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H -/* Define if you have the <sys/sched.h> header file. */ +/* Define if you have the <sys/sched.h> header file. */ #undef HAVE_SYS_SCHED_H -/* Define if you have the <sys/select.h> header file. */ +/* Define if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H -/* Define if you have the <sys/sio.h> header file. */ +/* Define if you have the <sys/sio.h> header file. */ #undef HAVE_SYS_SIO_H -/* Define if you have the <sys/sockio.h> header file. */ +/* Define if you have the <sys/sockio.h> header file. */ #undef HAVE_SYS_SOCKIO_H -/* Define if you have the <sys/stat.h> header file. */ +/* Define if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H -/* Define if you have the <sys/stream.h> header file. */ +/* Define if you have the <sys/stream.h> header file. */ #undef HAVE_SYS_STREAM_H -/* Define if you have the <sys/stropts.h> header file. */ +/* Define if you have the <sys/stropts.h> header file. */ #undef HAVE_SYS_STROPTS_H -/* Define if you have the <sys/sysctl.h> header file. */ +/* Define if you have the <sys/sysctl.h> header file. */ #undef HAVE_SYS_SYSCTL_H -/* Define if you have the <sys/syssgi.h> header file. */ +/* Define if you have the <sys/syssgi.h> header file. */ #undef HAVE_SYS_SYSSGI_H -/* Define if you have the <sys/termios.h> header file. */ +/* Define if you have the <sys/termios.h> header file. */ #undef HAVE_SYS_TERMIOS_H -/* Define if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the <sys/timepps.h> header file. */ +/* Define if you have the <sys/timepps.h> header file. */ #undef HAVE_SYS_TIMEPPS_H -/* Define if you have the <sys/timers.h> header file. */ +/* Define if you have the <sys/timers.h> header file. */ #undef HAVE_SYS_TIMERS_H -/* Define if you have the <sys/timex.h> header file. */ +/* Define if you have the <sys/timex.h> header file. */ #undef HAVE_SYS_TIMEX_H -/* Define if you have the <sys/tpro.h> header file. */ +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <sys/tpro.h> header file. */ #undef HAVE_SYS_TPRO_H -/* Define if you have the <sys/types.h> header file. */ +/* Define if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H -/* Define if you have the <sys/wait.h> header file. */ +/* Define if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H -/* Define if you have the <termio.h> header file. */ -#undef HAVE_TERMIO_H +/* Define if the system has the type `s_char'. */ +#undef HAVE_S_CHAR -/* Define if you have the <termios.h> header file. */ +/* Define if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H -/* Define if you have the <timepps.h> header file. */ +/* Define if you have the <termio.h> header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the <timepps.h> header file. */ #undef HAVE_TIMEPPS_H -/* Define if you have the <timex.h> header file. */ +/* Define if you have the `timer_create' function. */ +#undef HAVE_TIMER_CREATE + +/* Define if you have the `timer_settime' function. */ +#undef HAVE_TIMER_SETTIME + +/* Define if you have the <timex.h> header file. */ #undef HAVE_TIMEX_H -/* Define if you have the <unistd.h> header file. */ +/* Define if you have the `umask' function. */ +#undef HAVE_UMASK + +/* Define if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define if you have the <utmp.h> header file. */ -#undef HAVE_UTMP_H +/* Define if you have the `updwtmp' function. */ +#undef HAVE_UPDWTMP -/* Define if you have the <utmpx.h> header file. */ -#undef HAVE_UTMPX_H +/* Define if you have the `updwtmpx' function. */ +#undef HAVE_UPDWTMPX -/* Define if you have the advapi32 library (-ladvapi32). */ -#undef HAVE_LIBADVAPI32 +/* Define if you have the <utmpx.h> header file. */ +#undef HAVE_UTMPX_H -/* Define if you have the elf library (-lelf). */ -#undef HAVE_LIBELF +/* Define if you have the <utmp.h> header file. */ +#undef HAVE_UTMP_H -/* Define if you have the gen library (-lgen). */ -#undef HAVE_LIBGEN +/* Define if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF -/* Define if you have the kvm library (-lkvm). */ -#undef HAVE_LIBKVM +/* Define if you have the </sys/sync/queue.h> header file. */ +#undef HAVE__SYS_SYNC_QUEUE_H -/* Define if you have the ld library (-lld). */ -#undef HAVE_LIBLD +/* Define if you have the </sys/sync/sema.h> header file. */ +#undef HAVE__SYS_SYNC_SEMA_H -/* Define if you have the mld library (-lmld). */ -#undef HAVE_LIBMLD +/* Define if you have the `__adjtimex' function. */ +#undef HAVE___ADJTIMEX -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL +/* Define if you have the `__ntp_gettime' function. */ +#undef HAVE___NTP_GETTIME -/* Define if you have the rt library (-lrt). */ -#undef HAVE_LIBRT +/* Default location of crypto key info */ +#undef NTP_KEYSDIR -/* Define if you have the socket library (-lsocket). */ -#undef HAVE_LIBSOCKET +/* Use OpenSSL? */ +#undef OPENSSL /* Name of package */ #undef PACKAGE +/* Define if compiler has function prototypes */ +#undef PROTOTYPES + +/* Public key? */ +#undef PUBKEY + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Use RSAREF? */ +#undef RSAREF + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `signed char', as computed by sizeof. */ +#undef SIZEOF_SIGNED_CHAR + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define if your <sys/time.h> declares `struct tm'. */ +#undef TM_IN_SYS_TIME + /* Version number of package */ #undef VERSION -/* Define if compiler has function prototypes */ -#undef PROTOTYPES +/* Define if your processor stores words with the most significant byte first + (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN -/* Do we have struct ntptimeval? */ -#undef HAVE_STRUCT_NTPTIMEVAL +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Define if on MINIX. */ +#undef _MINIX + +/* Define if the system does not provide POSIX.1 features except with this + defined. */ +#undef _POSIX_1_SOURCE + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef gid_t -/* Does ntptimeval use struct timespec? */ -#undef TIMESPEC_IN_NTPTIMEVAL +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `long' if <sys/types.h> does not define. */ +#undef off_t + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t + +/* Define to `long' if <sys/types.h> does not define. */ +#undef time_t +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef uid_t diff --git a/contrib/ntp/config.sub b/contrib/ntp/config.sub index e494441..578b302 100755 --- a/contrib/ntp/config.sub +++ b/contrib/ntp/config.sub @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-06-08' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to <config-patches@gnu.org>. +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +51,73 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,7 +143,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; @@ -105,9 +154,17 @@ case $os in -scout) ;; -wrs) - os=vxworks + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos basic_machine=$1 ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; @@ -156,33 +213,50 @@ case $os in -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v) + | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ + | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500 | z8k) basic_machine=$basic_machine-unknown ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65) + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -192,23 +266,30 @@ case $basic_machine in ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. - vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ + | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ + | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | t3e-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* ) + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -245,14 +326,14 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) @@ -299,13 +380,16 @@ case $basic_machine in basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -353,6 +437,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -426,22 +514,21 @@ case $basic_machine in ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; @@ -453,14 +540,6 @@ case $basic_machine in basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -486,10 +565,14 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; - *mint | *MiNT) + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; @@ -507,14 +590,22 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) - basic_machine=i386-unknown + basic_machine=i386-pc os=-msdos ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -524,7 +615,7 @@ case $basic_machine in os=-netbsd ;; netwinder) - basic_machine=armv4l-corel + basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) @@ -572,9 +663,16 @@ case $basic_machine in basic_machine=i960-intel os=-mon960 ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -604,28 +702,28 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexen) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86) + pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -640,6 +738,10 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -719,6 +821,10 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix @@ -727,6 +833,10 @@ case $basic_machine in basic_machine=t3e-cray os=-unicos ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -779,6 +889,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -822,13 +936,20 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; - sparc | sparcv9) + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -850,6 +971,9 @@ case $basic_machine in basic_machine=c4x-none os=-coff ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -906,14 +1030,29 @@ case $os in | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mon960* | -lnews*) + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` @@ -927,6 +1066,12 @@ case $os in -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -951,6 +1096,9 @@ case $os in -ns2 ) os=-nextstep2 ;; + -nsk*) + os=-nsk + ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` @@ -985,7 +1133,7 @@ case $os in -xenix) os=-xenix ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) @@ -1013,12 +1161,15 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; - arm*-corel) + arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -1127,7 +1278,7 @@ case $basic_machine in *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) @@ -1187,7 +1338,7 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -1205,7 +1356,7 @@ case $basic_machine in -mpw* | -macos*) vendor=apple ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac @@ -1214,3 +1365,11 @@ case $basic_machine in esac echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/contrib/ntp/configure b/contrib/ntp/configure index fd25f49..913f331 100755 --- a/contrib/ntp/configure +++ b/contrib/ntp/configure @@ -1,153 +1,145 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by Autoconf 2.50. # +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -# Defaults: -ac_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors" -ac_help="$ac_help - --enable-debugging + include debugging code" -ac_help="$ac_help - --enable-dst-minutes=60 + minutes per DST adjustment" -ac_help="$ac_help - --enable-md5 + include support for MD5 keys" -ac_help="$ac_help - --enable-BANCOMM - Datum/Bancomm bc635/VME interface" -ac_help="$ac_help - --enable-GPSVME - TrueTime GPS receiver/VME interface" -ac_help="$ac_help - --enable-SHM - SHM clock attached thru shared memory" -ac_help="$ac_help - --enable-all-clocks + include all suitable non-PARSE clocks:" -ac_help="$ac_help - --enable-ACTS + ACTS modem service" -ac_help="$ac_help - --enable-ARBITER + Arbiter 1088A/B GPS receiver" -ac_help="$ac_help - --enable-ARCRON-MSF + Arcron MSF receiver" -ac_help="$ac_help - --enable-AS2201 + Austron 2200A/2201A GPS receiver" -ac_help="$ac_help - --enable-ATOM + PPS interface" -ac_help="$ac_help - --enable-CHU - CHU modem/decoder" -ac_help="$ac_help - --enable-AUDIO-CHU s CHU audio/decoder" -ac_help="$ac_help - --enable-DATUM s Datum Programmable Time System" -ac_help="$ac_help - --enable-FG + Forum Graphic GPS" -ac_help="$ac_help - --enable-HEATH s Heath GC-1000 WWV/WWVH receiver" -ac_help="$ac_help - --enable-HPGPS + HP 58503A GPS receiver" -ac_help="$ac_help - --enable-IRIG s Sun IRIG audio decoder" -ac_help="$ac_help - --enable-LEITCH + Leitch CSD 5300 Master Clock System Driver" -ac_help="$ac_help - --enable-LOCAL-CLOCK + local clock reference" -ac_help="$ac_help - --enable-MSFEES + EES M201 MSF receiver" -ac_help="$ac_help - --enable-MX4200 s Magnavox MX4200 GPS receiver" -ac_help="$ac_help - --enable-NMEA + NMEA GPS receiver" -ac_help="$ac_help - --enable-ONCORE + Motorola VP/UT Oncore GPS receiver" -ac_help="$ac_help - --enable-PALISADE + Palisade clock" -ac_help="$ac_help - --enable-PST + PST/Traconex 1020 WWV/WWVH receiver" -ac_help="$ac_help - --enable-JUPITER s Rockwell Jupiter GPS receiver" -ac_help="$ac_help - --enable-PTBACTS s PTB modem service" -ac_help="$ac_help - --enable-TPRO s KSI/Odetics TPRO/S GPS receiver/IRIG interface" -ac_help="$ac_help - --enable-TRAK + TRAK 8810 GPS receiver" -ac_help="$ac_help - --enable-CHRONOLOG + Chrono-log K-series WWVB receiver" -ac_help="$ac_help - --enable-DUMBCLOCK + Dumb generic hh:mm:ss local clock" -ac_help="$ac_help - --enable-PCF + Conrad parallel port radio clock" -ac_help="$ac_help - --enable-SPECTRACOM + Spectracom 8170/Netclock/2 WWVB receiver" -ac_help="$ac_help - --enable-TRUETIME s Kinemetrics/TrueTime receivers" -ac_help="$ac_help - --enable-ULINK + Ultralink WWVB receiver" -ac_help="$ac_help - --enable-WWV + WWV Audio receiver" -ac_help="$ac_help - --enable-USNO s USNO modem service" -ac_help="$ac_help - --enable-parse-clocks - include all suitable PARSE clocks:" -ac_help="$ac_help - --enable-COMPUTIME s Diem Computime Radio Clock" -ac_help="$ac_help - --enable-DCF7000 s ELV/DCF7000 clock" -ac_help="$ac_help - --enable-HOPF6021 s HOPF 6021 clock" -ac_help="$ac_help - --enable-MEINBERG s Meinberg clocks" -ac_help="$ac_help - --enable-RAWDCF s DCF77 raw time code" -ac_help="$ac_help - --enable-RCC8000 s RCC 8000 clock" -ac_help="$ac_help - --enable-SCHMID s Schmid DCF77 clock" -ac_help="$ac_help - --enable-TRIMTAIP s Trimble GPS receiver/TAIP protocol" -ac_help="$ac_help - --enable-TRIMTSIP s Trimble GPS receiver/TSIP protocol" -ac_help="$ac_help - --enable-WHARTON s WHARTON 400A Series clock" -ac_help="$ac_help - --enable-VARITEXT s VARITEXT clock" -ac_help="$ac_help - --enable-kmem s read /dev/kmem for tick and/or tickadj" -ac_help="$ac_help - --enable-accurate-adjtime - s the adjtime() call is accurate" -ac_help="$ac_help - --enable-tick=VALUE s force a value for 'tick'" -ac_help="$ac_help - --enable-tickadj=VALUE s force a value for 'tickadj'" -ac_help="$ac_help - --enable-udp-wildcard s use UDP wildcard delivery" -ac_help="$ac_help - --enable-slew-always s always slew the time" -ac_help="$ac_help - --enable-step-slew s step and slew the time" -ac_help="$ac_help - --enable-ntpdate-step s if ntpdate should step the time" -ac_help="$ac_help - --enable-hourly-todr-sync - s if we should sync TODR hourly" -ac_help="$ac_help - --enable-kernel-fll-bug s if we should avoid a kernel FLL bug" +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Avoid depending upon Character Ranges. +ac_cr_az='abcdefghijklmnopqrstuvwxyz' +ac_cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +ac_cr_09='0123456789' +ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09 + +# Sed expression to map a string onto a valid sh and CPP variable names. +ac_tr_sh="sed y%*+%pp%;s%[^_$ac_cr_alnum]%_%g" +ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[^_$ac_cr_alnum]%_%g" + +ac_unique_file="ntpd/ntp_refclock.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#else +# if HAVE_STRINGS_H +# include <strings.h> +# endif +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -156,10 +148,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -173,17 +170,16 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -191,59 +187,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -252,95 +248,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -349,12 +297,12 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. @@ -375,26 +323,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -411,7 +359,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -421,7 +369,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -432,58 +380,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -494,98 +441,89 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$ac_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir \ + exec_prefix prefix do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + NONE ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=ntpd/ntp_refclock.c +test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then @@ -596,13 +534,383 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<EOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +EOF + + cat <<\EOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +EOF +fi + +if test -n "$ac_init_help"; then + + cat <<\EOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-debugging + include debugging code + --enable-dst-minutes=60 + minutes per DST adjustment + --enable-HOPFSERIAL + hopf serial clock device + --enable-HOPFPCI + hopf 6039 PCI board + --enable-BANCOMM - Datum/Bancomm bc635/VME interface + --enable-GPSVME - TrueTime GPS receiver/VME interface + --enable-SHM - SHM clock attached thru shared memory + --enable-all-clocks + include all suitable non-PARSE clocks: + --enable-ACTS + ACTS modem service + --enable-ARBITER + Arbiter 1088A/B GPS receiver + --enable-ARCRON-MSF + Arcron MSF receiver + --enable-ATOM s ATOM PPS interface + --enable-AS2201 + Austron 2200A/2201A GPS receiver + --enable-CHU - CHU modem/decoder + --enable-AUDIO-CHU s CHU audio/decoder + --enable-DATUM s Datum Programmable Time System + --enable-FG + Forum Graphic GPS + --enable-HEATH s Heath GC-1000 WWV/WWVH receiver + --enable-HPGPS + HP 58503A GPS receiver + --enable-IRIG s Sun IRIG audio decoder + --enable-LEITCH + Leitch CSD 5300 Master Clock System Driver + --enable-LOCAL-CLOCK + local clock reference + --enable-MSFEES + EES M201 MSF receiver + --enable-MX4200 s Magnavox MX4200 GPS receiver + --enable-NMEA + NMEA GPS receiver + --enable-ONCORE s Motorola VP/UT Oncore GPS receiver + --enable-PALISADE + Palisade clock + --enable-PST + PST/Traconex 1020 WWV/WWVH receiver + --enable-JUPITER s Rockwell Jupiter GPS receiver + --enable-PTBACTS s PTB modem service + --enable-TPRO s KSI/Odetics TPRO/S GPS receiver/IRIG interface + --enable-TRAK + TRAK 8810 GPS receiver + --enable-CHRONOLOG + Chrono-log K-series WWVB receiver + --enable-DUMBCLOCK + Dumb generic hh:mm:ss local clock + --enable-PCF + Conrad parallel port radio clock + --enable-SPECTRACOM + Spectracom 8170/Netclock/2 WWVB receiver + --enable-TRUETIME s Kinemetrics/TrueTime receivers + --enable-ULINK + Ultralink WWVB receiver + --enable-WWV + WWV Audio receiver + --enable-USNO s USNO modem service + --enable-parse-clocks - include all suitable PARSE clocks: + --enable-COMPUTIME s Diem Computime Radio Clock + --enable-DCF7000 s ELV/DCF7000 clock + --enable-HOPF6021 s HOPF 6021 clock + --enable-MEINBERG s Meinberg clocks + --enable-RAWDCF s DCF77 raw time code + --enable-RCC8000 s RCC 8000 clock + --enable-SCHMID s Schmid DCF77 clock + --enable-TRIMTAIP s Trimble GPS receiver/TAIP protocol + --enable-TRIMTSIP s Trimble GPS receiver/TSIP protocol + --enable-WHARTON s WHARTON 400A Series clock + --enable-VARITEXT s VARITEXT clock + --enable-kmem s read /dev/kmem for tick and/or tickadj + --enable-accurate-adjtime + s the adjtime() call is accurate + --enable-tick=VALUE s force a value for 'tick' + --enable-tickadj=VALUE s force a value for 'tickadj' + --enable-udp-wildcard s use UDP wildcard delivery + --enable-slew-always s always slew the time + --enable-step-slew s step and slew the time + --enable-ntpdate-step s if ntpdate should step the time + --enable-hourly-todr-sync + s if we should sync TODR hourly + --enable-kernel-fll-bug s if we should avoid a kernel FLL bug + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-openssl-libdir + =/something/reasonable + --with-openssl-incdir + =/something/reasonable + --with-crypto + ={autokey,rsaref} + --with-electricfence - compile with ElectricFence malloc debugger + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.50. Invocation command line was + + $ $0 $@ + +EOF +{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_status=$?; ac_signal='$ac_signal'; { (exit $ac_status); exit $ac_status; }' $ac_signal +done +ac_signal=0 +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -613,40 +921,94 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:924: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:935: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:943: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_suggest_removing_cache=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:959: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,set) + { echo "$as_me:963: WARNING: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was not set in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:969: WARNING: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: WARNING: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:971: WARNING: former value: $ac_old_val" >&5 +echo "$as_me: WARNING: former value: $ac_old_val" >&2;} + { echo "$as_me:973: WARNING: current value: $ac_new_val" >&5 +echo "$as_me: WARNING: current value: $ac_new_val" >&2;} + ac_suggest_removing_cache=: + fi;; + esac +done +if $ac_suggest_removing_cache; then + { echo "$as_me:980: WARNING: changes in the environment can compromise the build" >&5 +echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;} + { echo "$as_me:982: WARNING: consider removing $cache_file and starting over" >&5 +echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;} fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:1001: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:1004: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do @@ -658,129 +1020,126 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:1030: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:1040: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:1044: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:1053: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:1057: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1062: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:1069: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:1078: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1083: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:1090: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:1099: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1104: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:699: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:720: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:738: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- - -cat >> confdefs.h <<EOF +cat >>confdefs.h <<EOF #define STR_SYSTEM "$target" EOF +ac_config_headers="$ac_config_headers config.h" - + ac_config_commands="$ac_config_commands default-1" if test "$program_transform_name" = s,x,x,; then program_transform_name= else # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed + cat <<\EOF >conftest.sed s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed +EOF + program_transform_name=`echo $program_transform_name | sed -f conftest.sed` + rm -f conftest.sed fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,${program_prefix},;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" # sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +test -z "$program_transform_name" && program_transform_name="s,x,x," # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -789,31 +1148,39 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:798: checking for a BSD compatible install" >&5 +echo "$as_me:1156: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do + IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -823,145 +1190,157 @@ else ;; esac done - IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:1205: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:851: checking whether build environment is sane" >&5 +echo "$as_me:1216: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } + { { echo "$as_me:1239: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi - test "$2" = conftestfile + test "$2" = conftest.file ) then # Ok. : else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } + { { echo "$as_me:1252: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi rm -f conftest* -echo "$ac_t""yes" 1>&6 - -test x"${MISSING+set}" = xset || \ - MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing" +echo "$as_me:1259: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test x"${MISSING+set}" = xset || + MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing" +# Use eval to expand $SHELL if eval "$MISSING --run :"; then am_missing_run="$MISSING --run " else am_missing_run= - echo "configure: warning: \`missing' script is too old or missing" 1>&2 + am_backtick='`' + { echo "$as_me:1269: WARNING: ${am_backtick}missing' script is too old or missing" >&5 +echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} fi for ac_prog in mawk gawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:903: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:1277: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AWK="$ac_prog" +echo "$as_me:1292: found $ac_dir/$ac_word" >&5 +break +done + fi fi -AWK="$ac_cv_prog_AWK" +AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 + echo "$as_me:1300: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1303: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$AWK" && break + test -n "$AWK" && break done -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:933: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:1310: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftestmake <<\EOF + cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:1330: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:1334: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi - # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" - : -fi +fi; if test "x$enable_dependency_tracking" = xno; then AMDEP="#" else @@ -979,293 +1358,648 @@ else AMDEPBACKSLASH= fi - - - - if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then DEPDIR=.deps + # We redirect because .deps might already exist and be populated. + # In this situation we don't want to see an error. + rmdir .deps > /dev/null 2>&1 else DEPDIR=_deps fi +# test to see if srcdir already configured +if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:1373: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi - - +# Define the identity of the package. PACKAGE=ntp +VERSION=4.1.0 -VERSION=4.0.99b - -if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF +cat >>confdefs.h <<EOF #define PACKAGE "$PACKAGE" EOF -cat >> confdefs.h <<EOF +cat >>confdefs.h <<EOF #define VERSION "$VERSION" EOF +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. - - +# Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"} - - AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"} - - AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - - AMTAR=${AMTAR-"${am_missing_run}tar"} - - if test -z "$install_sh"; then - install_sh="$ac_aux_dir/install-sh" - test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh" - test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh" - install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`" -fi - - - - + for install_sh in "$ac_aux_dir/install-sh" \ + "$ac_aux_dir/install.sh" \ + "${am_missing_run}${ac_auxdir}/install-sh"; + do + test -f "$install_sh" && break + done + # FIXME: an evil hack: we remove the SHELL invocation from + # install_sh because automake adds it back in. Sigh. + install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'` +fi + +# We'd like to do this but we can't because it will unconditionally +# require config.guess. One way would be if autoconf had the capability +# to let us compile in this code only when config.guess was already +# a possibility. +#if test "$cross_compiling" != no; then +# # since we are cross-compiling, we need to check for a suitable `strip' +# AM_PROG_STRIP +# if test -z "$STRIP"; then +# AC_MSG_WARN([strip missing, install-strip will not strip binaries]) +# fi +#fi + +# If $STRIP is defined (either by the user, or by AM_PROG_STRIP), +# instruct install-strip to use install-sh and the given $STRIP program. +# Otherwise, just use ${INSTALL}: the idea is to use the vendor install +# as much as possible, because it's faster. +if test -z "$STRIP"; then + # The top level make will set INSTALL_PROGRAM=$(INSTALL_STRIP_PROGRAM) + # and the double dolard below is there to make sure that ${INSTALL} + # is substitued in the sub-makes, not at the top-level; this is + # needed if ${INSTALL} is a relative path (ajusted in each subdirectory + # by config.status). + INSTALL_STRIP_PROGRAM='$${INSTALL} -s' + INSTALL_STRIP_PROGRAM_ENV='' +else + _am_dirpart="`echo $install_sh | sed -e 's,//*[^/]*$,,'`" + INSTALL_STRIP_PROGRAM="\${SHELL} \`CDPATH=: && cd $_am_dirpart && pwd\`/install-sh -c -s" + INSTALL_STRIP_PROGRAM_ENV="STRIPPROG='\$(STRIP)'" +fi + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +ac_cv_var_oncore_ok=no +ac_cv_var_atom_ok=no - +iCFLAGS="$CFLAGS" - +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1465: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1480: found $ac_dir/$ac_word" >&5 +break +done +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1488: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1491: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1500: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1515: found $ac_dir/$ac_word" >&5 +break +done -ac_cv_var_oncore_ok=no +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1523: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1526: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -iCFLAGS="$CFLAGS" + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1065: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1539: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1554: found $ac_dir/$ac_word" >&5 +break +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1562: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1565: result: no" >&5 +echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1574: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1589: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1597: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1600: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1095: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:1613: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1633: found $ac_dir/$ac_word" >&5 +break +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" + set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1655: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1658: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1146: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1669: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1684: found $ac_dir/$ac_word" >&5 +break +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:1692: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:1695: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + + test -n "$CC" && break + done fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1708: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1723: found $ac_dir/$ac_word" >&5 +break +done -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1178: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1731: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1734: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi -cat > conftest.$ac_ext << EOF +fi -#line 1189 "configure" +test -z "$CC" && { { echo "$as_me:1746: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +cat >conftest.$ac_ext <<_ACEOF +#line 1751 "configure" #include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compiler, and finding out an intuition +# of exeext. +echo "$as_me:1767: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1770: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1773: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `ls a.exe conftest.exe a.* conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1790: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1796: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1801: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1807: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1810: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no else - ac_cv_prog_cc_cross=yes + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1817: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1220: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1225: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes +echo "$as_me:1825: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1832: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1834: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1837: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1839: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1842: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done else - ac_cv_prog_gcc=no -fi + { { echo "$as_me:1858: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +rm -f conftest$ac_cv_exeext +echo "$as_me:1864: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1870: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - GCC= + cat >conftest.$ac_ext <<_ACEOF +#line 1876 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1888: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1891: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1903: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } fi -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1253: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1910: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1914: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +#line 1920 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1935: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1938: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1941: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1944: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1956: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1962: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1968 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1980: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1983: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1986: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1989: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +echo "$as_me:1999: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -1279,108 +2013,367 @@ else CFLAGS= fi fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2026: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2029: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2032: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2035: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 2047 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2060: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2063: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2066: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2069: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 2079 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2091: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2094: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2097: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2100: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +echo '#ifdef __cplusplus' >>confdefs.h +echo $ac_declaration >>confdefs.h +echo '#endif' >>confdefs.h + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_config_commands="$ac_config_commands default-2" -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1286: checking how to run the C preprocessor" >&5 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:2131: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + # break 2 since there is a loop in there. + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 1301 "configure" + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2153 "configure" #include "confdefs.h" #include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2158: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2164: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 1318 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2187 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2191: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2197: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 1335 "configure" + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break 2 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2234: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2244 "configure" #include "confdefs.h" #include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2249: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2255: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2278 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2282: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2288: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi - CPP="$ac_cv_prog_CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - ac_cv_prog_CPP="$CPP" + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi -echo "$ac_t""$CPP" 1>&6 - - - +rm -f conftest.err conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2316: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +am_make=${MAKE-make} +# BSD make uses .include +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:2334: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +_am_include='#' +for am_inc in include .include; do + echo "$am_inc confinc" > confmf + if test "`$am_make -f confmf 2> /dev/null`" = "done"; then + _am_include=$am_inc + break + fi +done +echo "$as_me:2345: result: $_am_include" >&5 +echo "${ECHO_T}$_am_include" >&6 +rm -f confinc confmf depcc="$CC" depcpp="$CPP" -echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6 -echo "configure:1374: checking dependency style of $depcc" >&5 -if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -if test -z "$AMDEP"; then - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h + +echo "$as_me:2352: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir confdir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" confdir + cd confdir am_cv_CC_dependencies_compiler_type=none - for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do + for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "./depcomp"`; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + case "$depmode" in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll @@ -1393,107 +2386,321 @@ if test -z "$AMDEP"; then ;; none) break ;; esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. if depmode="$depmode" \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL $am_depcomp $depcc -c conftest.c 2>/dev/null && + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type="$depmode" break fi done - rm -f conftest.* + cd .. + rm -rf confdir else am_cv_CC_dependencies_compiler_type=none fi fi - -echo "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6 +echo "$as_me:2409: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" +echo "$as_me:2413: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 2421 "configure" +#include "confdefs.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:2470: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2473: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2476: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2479: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1419: checking how to run the C preprocessor" >&5 +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2496: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2499: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:2509: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + # break 2 since there is a loop in there. + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 1434 "configure" + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2531 "configure" #include "confdefs.h" #include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2536: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2542: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 1451 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2565 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2569: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2575: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 1468 "configure" + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break 2 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2612: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2622 "configure" #include "confdefs.h" #include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + Syntax error +_ACEOF +if { (eval echo "$as_me:2627: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2633: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2656 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:2660: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2666: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi - CPP="$ac_cv_prog_CPP" +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - ac_cv_prog_CPP="$CPP" + { { echo "$as_me:2694: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$CPP" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu case "$target" in *-pc-cygwin*) @@ -1522,7 +2729,9 @@ case "$host" in *-*-vxworks*) # Quick and dirty sanity check case "$VX_KERNEL" in - '') { echo "configure: error: Please follow the directions in html/vxworks.html!" 1>&2; exit 1; } + '') { { echo "$as_me:2732: error: Please follow the directions in html/vxworks.html!" >&5 +echo "$as_me: error: Please follow the directions in html/vxworks.html!" >&2;} + { (exit 1); exit 1; }; } ;; esac CFLAGS="$CFLAGS -DSYS_VXWORKS" @@ -1533,84 +2742,90 @@ esac for ac_prog in mawk gawk nawk awk do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1540: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2747: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AWK="$ac_prog" +echo "$as_me:2762: found $ac_dir/$ac_word" >&5 +break +done + fi fi -AWK="$ac_cv_prog_AWK" +AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 + echo "$as_me:2770: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2773: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$AWK" && break + test -n "$AWK" && break done -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1570: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2780: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftestmake <<\EOF + cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:2800: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:2804: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi - rm -f conftest* case "$GCC" in yes) CFLAGS="$CFLAGS -Wall" - # CFLAGS="$CFLAGS -Wtraditional" - CFLAGS="$CFLAGS -Wshadow" - # CFLAGS="$CFLAGS -Wwrite-strings" - CFLAGS="$CFLAGS -Wconversion" - CFLAGS="$CFLAGS -Wpointer-arith" - CFLAGS="$CFLAGS -Wcast-qual" # CFLAGS="$CFLAGS -Wcast-align" + CFLAGS="$CFLAGS -Wcast-qual" + # CFLAGS="$CFLAGS -Wconversion" + # CFLAGS="$CFLAGS -Werror" + CFLAGS="$CFLAGS -Wmissing-prototypes" + CFLAGS="$CFLAGS -Wpointer-arith" + CFLAGS="$CFLAGS -Wshadow" CFLAGS="$CFLAGS -Wstrict-prototypes" + # CFLAGS="$CFLAGS -Wtraditional" + # CFLAGS="$CFLAGS -Wwrite-strings" - echo $ac_n "checking whether ${CC-cc} -pipe works""... $ac_c" 1>&6 -echo "configure:1612: checking whether ${CC-cc} -pipe works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_pipe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:2825: checking whether ${CC-cc} -pipe works" >&5 +echo $ECHO_N "checking whether ${CC-cc} -pipe works... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -pipe -c conftest.c 2>&1`" -a -s conftest.o; then @@ -1619,10 +2834,10 @@ else ac_cv_prog_cc_pipe=no fi rm -f conftest* - -fi -echo "$ac_t""$ac_cv_prog_cc_pipe" 1>&6 +fi +echo "$as_me:2839: result: $ac_cv_prog_cc_pipe" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_pipe" >&6 case "$ac_cv_prog_cc_pipe" in yes) @@ -1635,7 +2850,11 @@ esac ac_busted_vpath_in_make=no case "$target" in + *-next-nextstep3) + CFLAGS="$CFLAGS -posix" + ;; *-*-irix6.1*) # 64 bit only + # busted vpath? ;; *-*-irix6*) # 6.2 (and later?) ac_busted_vpath_in_make=yes @@ -1657,8 +2876,6 @@ case "$target" in esac fi ;; - *-next-nextstep3) - CFLAGS="$CFLAGS -posix" ;; *-*-solaris2.5.1) ac_busted_vpath_in_make=yes ;; @@ -1669,163 +2886,162 @@ case "$ac_busted_vpath_in_make$srcdir" in yes.) ;; *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | sed -e 's/GNU Make version \(1-9.]*\).*/\1/' -e q`" in '') - { echo "configure: error: building outside of the main directory requires GNU make" 1>&2; exit 1; } + { { echo "$as_me:2889: error: building outside of the main directory requires GNU make" >&5 +echo "$as_me: error: building outside of the main directory requires GNU make" >&2;} + { (exit 1); exit 1; }; } ;; *) ;; esac ;; esac - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1682: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 +echo "$as_me:2898: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:2902: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:2905: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 fi -if test $ac_cv_prog_gcc = yes; then - echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1704: checking whether ${CC-cc} needs -traditional" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:2910: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" - cat > conftest.$ac_ext <<EOF -#line 1710 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 2917 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_prog_gcc_traditional=yes else - rm -rf conftest* ac_cv_prog_gcc_traditional=no fi rm -f conftest* - if test $ac_cv_prog_gcc_traditional = no; then - cat > conftest.$ac_ext <<EOF -#line 1728 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 2932 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi - -echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 +echo "$as_me:2945: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1750: checking for AIX" >&5 -cat > conftest.$ac_ext <<EOF -#line 1752 "configure" +echo "$as_me:2952: checking for AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 2955 "configure" #include "confdefs.h" #ifdef _AIX yes #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF + echo "$as_me:2964: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\EOF #define _ALL_SOURCE 1 EOF else - rm -rf conftest* - echo "$ac_t""no" 1>&6 + echo "$as_me:2971: result: no" >&5 +echo "${ECHO_T}no" >&6 fi rm -f conftest* - -ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1775: checking for minix/config.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:2976: checking for minix/config.h" >&5 +echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1780 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 2982 "configure" #include "confdefs.h" #include <minix/config.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +_ACEOF +if { (eval echo "$as_me:2986: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2992: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_minix_config_h=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cv_header_minix_config_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 +echo "$as_me:3011: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 +if test $ac_cv_header_minix_config_h = yes; then MINIX=yes else - echo "$ac_t""no" 1>&6 -MINIX= + MINIX= fi if test "$MINIX" = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define _POSIX_SOURCE 1 EOF - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\EOF #define _POSIX_1_SOURCE 2 EOF - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\EOF #define _MINIX 1 EOF fi -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1823: checking for POSIXized ISC" >&5 +echo "$as_me:3035: checking for POSIXized ISC" >&5 +echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then - echo "$ac_t""yes" 1>&6 + echo "$as_me:3040: result: yes" >&5 +echo "${ECHO_T}yes" >&6 ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define _POSIX_SOURCE 1 EOF @@ -1835,75 +3051,195 @@ EOF CC="$CC -Xp" fi else - echo "$ac_t""no" 1>&6 + echo "$as_me:3054: result: no" >&5 +echo "${ECHO_T}no" >&6 ISC= fi -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1846: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:3062: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:3077: found $ac_dir/$ac_word" >&5 +break +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:3085: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:3088: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:3097: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:3112: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:3121: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:3124: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" fi # Extract the first word of "sh", so it can be a program name with args. set dummy sh; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1876: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_PATH_SH'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3135: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PATH_SH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$PATH_SH" in - /*) + case $PATH_SH in + [\\/]* | ?:[\\/]*) ac_cv_path_PATH_SH="$PATH_SH" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_PATH_SH="$PATH_SH" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_PATH_SH="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PATH_SH="$ac_dir/$ac_word" + echo "$as_me:3152: found $ac_dir/$ac_word" >&5 + break +fi +done + ;; esac fi -PATH_SH="$ac_cv_path_PATH_SH" +PATH_SH=$ac_cv_path_PATH_SH + if test -n "$PATH_SH"; then - echo "$ac_t""$PATH_SH" 1>&6 + echo "$as_me:3163: result: $PATH_SH" >&5 +echo "${ECHO_T}$PATH_SH" >&6 +else + echo "$as_me:3166: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo "$as_me:3172: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PATH_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PATH_PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PATH_PERL="$PATH_PERL" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PATH_PERL="$ac_dir/$ac_word" + echo "$as_me:3189: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PATH_PERL=$ac_cv_path_PATH_PERL + +if test -n "$PATH_PERL"; then + echo "$as_me:3200: result: $PATH_PERL" >&5 +echo "${ECHO_T}$PATH_PERL" >&6 +else + echo "$as_me:3203: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + cat >conftest.$ac_ext <<_ACEOF +#line 3208 "configure" +#include "confdefs.h" +#define ACAT(a,b)a ## b +ACAT(Cir,cus) + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "Circus" >/dev/null 2>&1; then + cat >>confdefs.h <<\EOF +#define ULONG_CONST(a) a ## UL +EOF + +else + cat >conftest.$ac_ext <<_ACEOF +#line 3222 "configure" +#include "confdefs.h" +#define RCAT(a,b)a/**/b +RCAT(Rei,ser) + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "Reiser" >/dev/null 2>&1; then + cat >>confdefs.h <<\EOF +#define ULONG_CONST(a) a/**/L +EOF + else - echo "$ac_t""no" 1>&6 + { { echo "$as_me:3235: error: How do we create an unsigned long constant?" >&5 +echo "$as_me: error: How do we create an unsigned long constant?" >&2;} + { (exit 1); exit 1; }; } fi +rm -f conftest* +fi +rm -f conftest* case "$target" in *-*-vxworks*) @@ -1918,31 +3254,39 @@ esac # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1927: checking for a BSD compatible install" >&5 +echo "$as_me:3262: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do + IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -1952,681 +3296,911 @@ else ;; esac done - IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:3311: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - case "$target" in *-pc-cygwin*) - echo $ac_n "checking for main in -ladvapi32""... $ac_c" 1>&6 -echo "configure:1983: checking for main in -ladvapi32" >&5 -ac_lib_var=`echo advapi32'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3325: checking for main in -ladvapi32" >&5 +echo $ECHO_N "checking for main in -ladvapi32... $ECHO_C" >&6 +if test "${ac_cv_lib_advapi32_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ladvapi32 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1991 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3333 "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo advapi32 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3345: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3348: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3351: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3354: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_advapi32_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_advapi32_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3365: result: $ac_cv_lib_advapi32_main" >&5 +echo "${ECHO_T}$ac_cv_lib_advapi32_main" >&6 +if test $ac_cv_lib_advapi32_main = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBADVAPI32 1 EOF LIBS="-ladvapi32 $LIBS" -else - echo "$ac_t""no" 1>&6 fi ;; esac -echo $ac_n "checking for nlist in -lelf""... $ac_c" 1>&6 -echo "configure:2028: checking for nlist in -lelf" >&5 -ac_lib_var=`echo elf'_'nlist | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3379: checking for nlist in -lelf" >&5 +echo $ECHO_N "checking for nlist in -lelf... $ECHO_C" >&6 +if test "${ac_cv_lib_elf_nlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lelf $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2036 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3387 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char nlist(); - -int main() { -nlist() -; return 0; } -EOF -if { (eval echo configure:2047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo elf | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char nlist (); +int +main () +{ +nlist (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3406: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3409: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3412: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3415: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_elf_nlist=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_elf_nlist=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3426: result: $ac_cv_lib_elf_nlist" >&5 +echo "${ECHO_T}$ac_cv_lib_elf_nlist" >&6 +if test $ac_cv_lib_elf_nlist = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBELF 1 EOF LIBS="-lelf $LIBS" -else - echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for main in -lkvm""... $ac_c" 1>&6 -echo "configure:2075: checking for main in -lkvm" >&5 -ac_lib_var=`echo kvm'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3437: checking for main in -lkvm" >&5 +echo $ECHO_N "checking for main in -lkvm... $ECHO_C" >&6 +if test "${ac_cv_lib_kvm_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lkvm $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2083 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3445 "configure" #include "confdefs.h" -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo kvm | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3457: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3460: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3463: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3466: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_kvm_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_kvm_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3477: result: $ac_cv_lib_kvm_main" >&5 +echo "${ECHO_T}$ac_cv_lib_kvm_main" >&6 +if test $ac_cv_lib_kvm_main = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBKVM 1 EOF LIBS="-lkvm $LIBS" -else - echo "$ac_t""no" 1>&6 fi - echo $ac_n "checking for nlist in -lld""... $ac_c" 1>&6 -echo "configure:2117: checking for nlist in -lld" >&5 -ac_lib_var=`echo ld'_'nlist | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3488: checking for nlist in -lld" >&5 +echo $ECHO_N "checking for nlist in -lld... $ECHO_C" >&6 +if test "${ac_cv_lib_ld_nlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lld $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2125 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3496 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char nlist(); - -int main() { -nlist() -; return 0; } -EOF -if { (eval echo configure:2136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo ld | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char nlist (); +int +main () +{ +nlist (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3515: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3518: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3521: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3524: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ld_nlist=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ld_nlist=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3535: result: $ac_cv_lib_ld_nlist" >&5 +echo "${ECHO_T}$ac_cv_lib_ld_nlist" >&6 +if test $ac_cv_lib_ld_nlist = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBLD 1 EOF LIBS="-lld $LIBS" -else - echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for nlist in -lmld""... $ac_c" 1>&6 -echo "configure:2164: checking for nlist in -lmld" >&5 -ac_lib_var=`echo mld'_'nlist | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3546: checking for nlist in -lmld" >&5 +echo $ECHO_N "checking for nlist in -lmld... $ECHO_C" >&6 +if test "${ac_cv_lib_mld_nlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lmld $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2172 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3554 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char nlist(); - -int main() { -nlist() -; return 0; } -EOF -if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo mld | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char nlist (); +int +main () +{ +nlist (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3573: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3576: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3579: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3582: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mld_nlist=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mld_nlist=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3593: result: $ac_cv_lib_mld_nlist" >&5 +echo "${ECHO_T}$ac_cv_lib_mld_nlist" >&6 +if test $ac_cv_lib_mld_nlist = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBMLD 1 EOF LIBS="-lmld $LIBS" -else - echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for gethostent""... $ac_c" 1>&6 -echo "configure:2211: checking for gethostent" >&5 -if eval "test \"`echo '$''{'ac_cv_func_gethostent'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3604: checking for gethostent" >&5 +echo $ECHO_N "checking for gethostent... $ECHO_C" >&6 +if test "${ac_cv_func_gethostent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2216 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 3610 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostent(); below. */ + which can conflict with char gethostent (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostent(); - -int main() { + builtin and then its argument prototype would still apply. */ +char gethostent (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostent) || defined (__stub___gethostent) choke me #else -gethostent(); +f = gethostent; #endif -; return 0; } -EOF -if { (eval echo configure:2239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_gethostent=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_gethostent=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'gethostent`\" = yes"; then - echo "$ac_t""yes" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3641: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3644: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3647: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3650: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostent=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostent=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3660: result: $ac_cv_func_gethostent" >&5 +echo "${ECHO_T}$ac_cv_func_gethostent" >&6 +if test $ac_cv_func_gethostent = yes; then : else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for gethostent in -lnsl""... $ac_c" 1>&6 -echo "configure:2257: checking for gethostent in -lnsl" >&5 -ac_lib_var=`echo nsl'_'gethostent | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3666: checking for gethostent in -lnsl" >&5 +echo $ECHO_N "checking for gethostent in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl -lsocket $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2265 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3674 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostent(); - -int main() { -gethostent() -; return 0; } -EOF -if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char gethostent (); +int +main () +{ +gethostent (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3693: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3696: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3699: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3702: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostent=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostent=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3713: result: $ac_cv_lib_nsl_gethostent" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6 +if test $ac_cv_lib_nsl_gethostent = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBNSL 1 EOF LIBS="-lnsl $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi -echo $ac_n "checking for openlog""... $ac_c" 1>&6 -echo "configure:2306: checking for openlog" >&5 -if eval "test \"`echo '$''{'ac_cv_func_openlog'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3726: checking for openlog" >&5 +echo $ECHO_N "checking for openlog... $ECHO_C" >&6 +if test "${ac_cv_func_openlog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2311 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 3732 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char openlog(); below. */ + which can conflict with char openlog (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char openlog(); - -int main() { + builtin and then its argument prototype would still apply. */ +char openlog (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_openlog) || defined (__stub___openlog) choke me #else -openlog(); +f = openlog; #endif -; return 0; } -EOF -if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_openlog=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_openlog=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'openlog`\" = yes"; then - echo "$ac_t""yes" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3763: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3766: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3769: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3772: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_openlog=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_openlog=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3782: result: $ac_cv_func_openlog" >&5 +echo "${ECHO_T}$ac_cv_func_openlog" >&6 +if test $ac_cv_func_openlog = yes; then : else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for openlog in -lgen""... $ac_c" 1>&6 -echo "configure:2352: checking for openlog in -lgen" >&5 -ac_lib_var=`echo gen'_'openlog | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3788: checking for openlog in -lgen" >&5 +echo $ECHO_N "checking for openlog in -lgen... $ECHO_C" >&6 +if test "${ac_cv_lib_gen_openlog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lgen $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2360 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3796 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char openlog(); - -int main() { -openlog() -; return 0; } + builtin and then its argument prototype would still apply. */ +char openlog (); +int +main () +{ +openlog (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3815: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3818: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3821: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3824: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gen_openlog=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gen_openlog=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3835: result: $ac_cv_lib_gen_openlog" >&5 +echo "${ECHO_T}$ac_cv_lib_gen_openlog" >&6 +if test $ac_cv_lib_gen_openlog = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBGEN 1 EOF -if { (eval echo configure:2371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + + LIBS="-lgen $LIBS" + fi -rm -f conftest* -LIBS="$ac_save_LIBS" fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo gen | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - LIBS="-lgen $LIBS" +echo "$as_me:3848: checking for readline in -lreadline" >&5 +echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6 +if test "${ac_cv_lib_readline_readline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 3856 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char readline (); +int +main () +{ +readline (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3875: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3878: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3881: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3884: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_readline_readline=yes else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_readline_readline=no fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3895: result: $ac_cv_lib_readline_readline" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6 +if test $ac_cv_lib_readline_readline = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBREADLINE 1 +EOF + + LIBS="-lreadline $LIBS" fi +case "$target" in + *-*-linux*) ;; + *) -echo $ac_n "checking for sched_setscheduler in -lrt""... $ac_c" 1>&6 -echo "configure:2402: checking for sched_setscheduler in -lrt" >&5 -ac_lib_var=`echo rt'_'sched_setscheduler | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:3910: checking for sched_setscheduler in -lrt" >&5 +echo $ECHO_N "checking for sched_setscheduler in -lrt... $ECHO_C" >&6 +if test "${ac_cv_lib_rt_sched_setscheduler+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2410 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3918 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sched_setscheduler(); - -int main() { -sched_setscheduler() -; return 0; } -EOF -if { (eval echo configure:2421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo rt | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char sched_setscheduler (); +int +main () +{ +sched_setscheduler (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3937: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3940: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3943: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3946: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_rt_sched_setscheduler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_rt_sched_setscheduler=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3957: result: $ac_cv_lib_rt_sched_setscheduler" >&5 +echo "${ECHO_T}$ac_cv_lib_rt_sched_setscheduler" >&6 +if test $ac_cv_lib_rt_sched_setscheduler = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBRT 1 EOF LIBS="-lrt $LIBS" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for sched_setscheduler in -lposix4""... $ac_c" 1>&6 -echo "configure:2447: checking for sched_setscheduler in -lposix4" >&5 -ac_lib_var=`echo posix4'_'sched_setscheduler | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:3968: checking for sched_setscheduler in -lposix4" >&5 +echo $ECHO_N "checking for sched_setscheduler in -lposix4... $ECHO_C" >&6 +if test "${ac_cv_lib_posix4_sched_setscheduler+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2455 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 3976 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char sched_setscheduler(); - -int main() { -sched_setscheduler() -; return 0; } -EOF -if { (eval echo configure:2466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo posix4 | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char sched_setscheduler (); +int +main () +{ +sched_setscheduler (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3995: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3998: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4001: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4004: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix4_sched_setscheduler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_posix4_sched_setscheduler=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4015: result: $ac_cv_lib_posix4_sched_setscheduler" >&5 +echo "${ECHO_T}$ac_cv_lib_posix4_sched_setscheduler" >&6 +if test $ac_cv_lib_posix4_sched_setscheduler = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBPOSIX4 1 EOF LIBS="-lposix4 $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi -echo $ac_n "checking for setsockopt""... $ac_c" 1>&6 -echo "configure:2496: checking for setsockopt" >&5 -if eval "test \"`echo '$''{'ac_cv_func_setsockopt'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + ;; +esac + +echo "$as_me:4031: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2501 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4037 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char setsockopt(); below. */ + which can conflict with char setsockopt (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char setsockopt(); - -int main() { + builtin and then its argument prototype would still apply. */ +char setsockopt (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_setsockopt) || defined (__stub___setsockopt) choke me #else -setsockopt(); +f = setsockopt; #endif -; return 0; } -EOF -if { (eval echo configure:2524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_setsockopt=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_setsockopt=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'setsockopt`\" = yes"; then - echo "$ac_t""yes" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4068: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4071: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4074: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4077: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4087: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then : else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for setsockopt in -lsocket""... $ac_c" 1>&6 -echo "configure:2542: checking for setsockopt in -lsocket" >&5 -ac_lib_var=`echo socket'_'setsockopt | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:4093: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2550 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 4101 "configure" #include "confdefs.h" + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char setsockopt(); - -int main() { -setsockopt() -; return 0; } -EOF -if { (eval echo configure:2561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +int +main () +{ +setsockopt (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4120: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4123: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4126: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4129: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4140: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBSOCKET 1 EOF LIBS="-lsocket $LIBS" -else - echo "$ac_t""no" 1>&6 fi fi - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2592: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:4153: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2597 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4159 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +_ACEOF +if { (eval echo "$as_me:4167: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4173: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 2622 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4195 "configure" #include "confdefs.h" #include <string.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2635,16 +4209,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 2640 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4213 "configure" #include "confdefs.h" #include <stdlib.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2653,740 +4227,910 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <<EOF -#line 2661 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4234 "configure" #include "confdefs.h" #include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4260: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4263: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4265: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4268: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:4281: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi -for ac_hdr in bstring.h errno.h fcntl.h memory.h netdb.h poll.h resolv.h +for ac_header in bstring.h errno.h fcntl.h ieeefp.h math.h memory.h netdb.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2699: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2704 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4294: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4300 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4304: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4310: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4329: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in sched.h sgtty.h stdlib.h string.h termio.h termios.h +for ac_header in poll.h resolv.h sched.h sgtty.h stdlib.h string.h termio.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2739: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2744 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4342: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4348 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4352: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4358: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4377: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in timepps.h timex.h unistd.h utmp.h utmpx.h +for ac_header in termios.h timepps.h timex.h unistd.h utmp.h utmpx.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2779: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2784 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4390: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4396 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4400: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4406: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4425: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in arpa/nameser.h net/if.h netinet/in_systm.h netinet/in.h +for ac_header in arpa/nameser.h net/if.h netinet/in_systm.h netinet/in.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2819: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2824 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4438: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4444 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4448: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4454: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4473: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in netinfo/ni.h +for ac_header in netinfo/ni.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2859: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2864 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4486: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4492 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4496: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4502: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4521: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_NETINFO 1 EOF -else - echo "$ac_t""no" 1>&6 fi done -for ac_hdr in sun/audioio.h sys/audioio.h +for ac_header in sun/audioio.h sys/audioio.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2902: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2907 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4537: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4543 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4547: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4553: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4572: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in sys/clkdefs.h sys/file.h +for ac_header in sys/clkdefs.h sys/file.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2942: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2947 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2952: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4585: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4591 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4595: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4601: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4620: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done case "$target" in *-*-sunos4*) ;; - *) for ac_hdr in sys/ioctl.h + *) +for ac_header in sys/ioctl.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2984: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2989 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4636: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4642 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4646: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4652: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4671: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done ;; esac -for ac_hdr in sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h + +for ac_header in sys/lock.h sys/mman.h sys/modem.h sys/param.h sys/ppsclock.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3026: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3031 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4687: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4693 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4697: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4703: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4722: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in sys/ppstime.h sys/proc.h sys/resource.h sys/sched.h +for ac_header in sys/ppstime.h sys/proc.h sys/resource.h sys/sched.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3066: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3071 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4735: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4741 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4745: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4751: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4770: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done case "$target" in *-*-sco*) - for ac_hdr in sys/sio.h + +for ac_header in sys/sio.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3108: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3113 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4786: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4792 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4796: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4802: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4821: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done ;; esac -for ac_hdr in sys/select.h sys/sockio.h sys/stat.h sys/stream.h + +for ac_header in sys/select.h sys/sockio.h sys/stat.h sys/stream.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3150: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3155 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4837: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4843 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4847: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4853: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4872: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in sys/stropts.h sys/sysctl.h sys/syssgi.h sys/termios.h +for ac_header in sys/stropts.h sys/sysctl.h sys/syssgi.h sys/termios.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3190: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3195 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4885: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4891 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4895: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4901: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4920: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -for ac_hdr in sys/time.h +for ac_header in sys/time.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3230: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3235 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4933: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4939 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4943: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4949: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:4968: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -cat > conftest.$ac_ext <<EOF -#line 3267 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 4979 "configure" #include "confdefs.h" #include <sys/timepps.h> #ifdef PPS_API_VERS_1 yes #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - for ac_hdr in sys/timepps.h + +for ac_header in sys/timepps.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3282: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3287 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:4993: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4999 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5003: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5009: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:5028: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done fi rm -f conftest* -for ac_hdr in sys/timers.h sys/timex.h sys/tpro.h sys/types.h sys/wait.h +for ac_header in sys/timers.h sys/timex.h sys/tpro.h sys/types.h sys/wait.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3325: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3330 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:5044: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5050 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5054: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5060: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:5079: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3362: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5089: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3367 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5095 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> #include <time.h> -int main() { + +int +main () +{ struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:3376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5110: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5113: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5116: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5119: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_time=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_time=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 +echo "$as_me:5129: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF @@ -3394,193 +5138,245 @@ fi case "$target" in *-convex-*) - for ac_hdr in /sys/sync/queue.h /sys/sync/sema.h + +for ac_header in /sys/sync/queue.h /sys/sync/sema.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3402: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3407 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:5145: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5151 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5155: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5161: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:5180: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done ;; *-*-bsdi*) - for ac_hdr in machine/inline.h sys/pcl720.h sys/i8253.h + +for ac_header in machine/inline.h sys/pcl720.h sys/i8253.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3444: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3449 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3454: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:5196: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5202 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5206: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5212: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:5231: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 + fi done ;; esac -ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for nlist.h""... $ac_c" 1>&6 -echo "configure:3485: checking for nlist.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5244: checking for nlist.h" >&5 +echo $ECHO_N "checking for nlist.h... $ECHO_C" >&6 +if test "${ac_cv_header_nlist_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3490 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5250 "configure" #include "confdefs.h" #include <nlist.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3495: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +_ACEOF +if { (eval echo "$as_me:5254: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5260: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_nlist_h=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cv_header_nlist_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF +echo "$as_me:5279: result: $ac_cv_header_nlist_h" >&5 +echo "${ECHO_T}$ac_cv_header_nlist_h" >&6 +if test $ac_cv_header_nlist_h = yes; then + cat >>confdefs.h <<\EOF #define NLIST_STRUCT 1 EOF -echo $ac_n "checking for n_un in struct nlist""... $ac_c" 1>&6 -echo "configure:3516: checking for n_un in struct nlist" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_nlist_n_un'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5286: checking for n_un in struct nlist" >&5 +echo $ECHO_N "checking for n_un in struct nlist... $ECHO_C" >&6 +if test "${ac_cv_struct_nlist_n_un+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3521 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5292 "configure" #include "confdefs.h" #include <nlist.h> -int main() { +int +main () +{ struct nlist n; n.n_un.n_name = 0; -; return 0; } -EOF -if { (eval echo configure:3528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5304: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5307: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5310: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5313: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_nlist_n_un=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_nlist_n_un=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_nlist_n_un=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_nlist_n_un" 1>&6 +echo "$as_me:5323: result: $ac_cv_struct_nlist_n_un" >&5 +echo "${ECHO_T}$ac_cv_struct_nlist_n_un" >&6 if test $ac_cv_struct_nlist_n_un = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NLIST_NAME_UNION 1 EOF fi -else - echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for basic volatile support""... $ac_c" 1>&6 -echo "configure:3553: checking for basic volatile support" >&5 -if eval "test \"`echo '$''{'ac_cv_c_volatile'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5334: checking for basic volatile support" >&5 +echo $ECHO_N "checking for basic volatile support... $ECHO_C" >&6 +if test "${ac_cv_c_volatile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3558 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5340 "configure" #include "confdefs.h" -int main() { +int +main () +{ volatile int x; -; return 0; } -EOF -if { (eval echo configure:3566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5353: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5356: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5359: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5362: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_volatile=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_volatile=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_volatile=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_volatile" 1>&6 +echo "$as_me:5373: result: $ac_cv_c_volatile" >&5 +echo "${ECHO_T}$ac_cv_c_volatile" >&6 case "$ac_cv_c_volatile" in yes) ;; - *) cat >> confdefs.h <<\EOF -#define volatile + *) cat >>confdefs.h <<\EOF +#define volatile EOF ;; @@ -3591,13 +5387,11 @@ case "$target" in # Assume that solaris2 is Ansi C... ;; *) - - -echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:3599: checking for ${CC-cc} option to accept ANSI C" >&5 -if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5391: checking for ${CC-cc} option to accept ANSI C" >&5 +echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 +if test "${am_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else am_cv_prog_cc_stdc=no ac_save_CC="$CC" @@ -3611,8 +5405,8 @@ ac_save_CC="$CC" for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - cat > conftest.$ac_ext <<EOF -#line 3616 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5409 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -3643,90 +5437,119 @@ int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, i int argc; char **argv; -int main() { +int +main () +{ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -; return 0; } -EOF -if { (eval echo configure:3653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5451: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5454: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5457: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5460: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_prog_cc_stdc="$ac_arg"; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext done CC="$ac_save_CC" fi if test -z "$am_cv_prog_cc_stdc"; then - echo "$ac_t""none needed" 1>&6 + echo "$as_me:5474: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 else - echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 + echo "$as_me:5477: result: $am_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$am_cv_prog_cc_stdc" >&6 fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac - - -echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 -echo "configure:3679: checking for function prototypes" >&5 +echo "$as_me:5485: checking for function prototypes" >&5 +echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 if test "$am_cv_prog_cc_stdc" != no; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF + echo "$as_me:5488: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\EOF #define PROTOTYPES 1 EOF U= ANSI2KNR= else - echo "$ac_t""no" 1>&6 + echo "$as_me:5497: result: no" >&5 +echo "${ECHO_T}no" >&6 U=_ ANSI2KNR=./ansi2knr - # Ensure some checks needed by ansi2knr itself. - echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3692: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +# Ensure some checks needed by ansi2knr itself. +echo "$as_me:5502: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3697 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5508 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +_ACEOF +if { (eval echo "$as_me:5516: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5522: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 3722 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5544 "configure" #include "confdefs.h" #include <string.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -3735,16 +5558,16 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 3740 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5562 "configure" #include "confdefs.h" #include <stdlib.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -3753,259 +5576,352 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <<EOF -#line 3761 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5583 "configure" #include "confdefs.h" #include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:5609: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5612: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:5614: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5617: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:5630: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi - for ac_hdr in string.h +for ac_header in string.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3799: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3804 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:5643: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5649 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5653: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5659: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$ac_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 +echo "$as_me:5678: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 EOF - -else - echo "$ac_t""no" 1>&6 -fi -done fi +done ;; esac -echo $ac_n "checking if C compiler permits function prototypes""... $ac_c" 1>&6 -echo "configure:3840: checking if C compiler permits function prototypes" >&5 -if eval "test \"`echo '$''{'ac_cv_have_prototypes'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5690: checking if C compiler permits function prototypes" >&5 +echo $ECHO_N "checking if C compiler permits function prototypes... $ECHO_C" >&6 +if test "${ac_cv_have_prototypes+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3845 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5696 "configure" #include "confdefs.h" extern int foo (short); int foo(short i) { return i; } -int main() { +int +main () +{ int i; -; return 0; } -EOF -if { (eval echo configure:3855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5711: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5714: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5717: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5720: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_have_prototypes=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_have_prototypes=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_have_prototypes=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_have_prototypes" 1>&6 +echo "$as_me:5731: result: $ac_cv_have_prototypes" >&5 +echo "${ECHO_T}$ac_cv_have_prototypes" >&6 if test "$ac_cv_have_prototypes" = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_PROTOTYPES 1 EOF fi -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3877: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5740: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3882 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5746 "configure" #include "confdefs.h" -int main() { - -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; + ; + return 0; } -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:3931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5804: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5807: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5810: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5813: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 +echo "$as_me:5823: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const + +cat >>confdefs.h <<\EOF +#define const EOF fi case "$host" in $target) - echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3954: checking whether byte ordering is bigendian" >&5 -if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:5835: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. -cat > conftest.$ac_ext <<EOF -#line 3961 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 5843 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> -int main() { +int +main () +{ #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif -; return 0; } -EOF -if { (eval echo configure:3972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5860: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5863: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5866: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5869: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. -cat > conftest.$ac_ext <<EOF -#line 3976 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 5873 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> -int main() { +int +main () +{ #if BYTE_ORDER != BIG_ENDIAN not big endian #endif -; return 0; } -EOF -if { (eval echo configure:3987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5890: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5893: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5896: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5899: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_bigendian=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_bigendian=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + { { echo "$as_me:5915: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } else - cat > conftest.$ac_ext <<EOF -#line 4007 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5920 "configure" #include "confdefs.h" -main () { +int +main () +{ /* Are we little or big endian? From Harbison&Steele. */ union { @@ -4015,25 +5931,34 @@ main () { u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } -EOF -if { (eval echo configure:4020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:5936: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5939: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:5941: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5944: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_bigendian=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_bigendian=yes + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_bigendian=yes fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +echo "$as_me:5957: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 if test $ac_cv_c_bigendian = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define WORDS_BIGENDIAN 1 EOF @@ -4045,28 +5970,30 @@ fi # LITTLEENDIAN ;; *-*-vxworks*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define WORDS_BIGENDIAN 1 EOF ;; - *) { echo "configure: error: Cross-compiling needs explicit byte order" 1>&2; exit 1; } + *) { { echo "$as_me:5978: error: Cross-compiling needs explicit byte order" >&5 +echo "$as_me: error: Cross-compiling needs explicit byte order" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; esac -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:4060: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:5985: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4065 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 5991 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -4074,166 +6001,298 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -int main() { +int +main () +{ int i; -; return 0; } -EOF -if { (eval echo configure:4082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6013: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6016: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6019: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6022: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_signal=void else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_signal=int fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:6032: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <<EOF +cat >>confdefs.h <<EOF #define RETSIGTYPE $ac_cv_type_signal EOF +for ac_header in stdlib.h string.h memory.h strings.h inttypes.h unistd.h +do +ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` +echo "$as_me:6042: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6048 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6052: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6058: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$ac_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6077: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $ac_tr_cpp` 1 +EOF + +fi +done -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:4101: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6087: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4106 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6093 "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6108: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6111: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6114: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6117: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_off_t=yes else - rm -rf conftest* - ac_cv_type_off_t=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:6127: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<EOF #define off_t long EOF fi -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:4134: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6139: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4139 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6145 "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6160: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6163: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6166: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6169: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_size_t=yes else - rm -rf conftest* - ac_cv_type_size_t=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:6179: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<EOF #define size_t unsigned EOF fi -echo $ac_n "checking for time_t""... $ac_c" 1>&6 -echo "configure:4167: checking for time_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6191: checking for time_t" >&5 +echo $ECHO_N "checking for time_t... $ECHO_C" >&6 +if test "${ac_cv_type_time_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4172 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6197 "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])time_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +$ac_includes_default +int +main () +{ +if ((time_t *) 0) + return 0; +if (sizeof (time_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6212: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6215: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6218: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6221: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_time_t=yes else - rm -rf conftest* - ac_cv_type_time_t=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_time_t=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_time_t" 1>&6 -if test $ac_cv_type_time_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:6231: result: $ac_cv_type_time_t" >&5 +echo "${ECHO_T}$ac_cv_type_time_t" >&6 +if test $ac_cv_type_time_t = yes; then + : +else + +cat >>confdefs.h <<EOF #define time_t long EOF fi -echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:4200: checking whether struct tm is in sys/time.h or time.h" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6243: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4205 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6249 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> -int main() { + +int +main () +{ struct tm *tp; tp->tm_sec; -; return 0; } -EOF -if { (eval echo configure:4213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6263: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6266: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6269: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6272: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_tm=sys/time.h + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_tm=sys/time.h fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_tm" 1>&6 +echo "$as_me:6282: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define TM_IN_SYS_TIME 1 EOF fi - -echo $ac_n "checking for a fallback value for HZ""... $ac_c" 1>&6 -echo "configure:4235: checking for a fallback value for HZ" >&5 -if eval "test \"`echo '$''{'ac_cv_var_default_hz'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6292: checking for a fallback value for HZ" >&5 +echo $ECHO_N "checking for a fallback value for HZ... $ECHO_C" >&6 +if test "${ac_cv_var_default_hz+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_default_hz=100 case "$target" in @@ -4245,17 +6304,16 @@ case "$target" in ;; esac fi - -echo "$ac_t""$ac_cv_var_default_hz" 1>&6 -cat >> confdefs.h <<EOF +echo "$as_me:6307: result: $ac_cv_var_default_hz" >&5 +echo "${ECHO_T}$ac_cv_var_default_hz" >&6 +cat >>confdefs.h <<EOF #define DEFAULT_HZ $ac_cv_var_default_hz EOF - -echo $ac_n "checking if we need to override the system's value for HZ""... $ac_c" 1>&6 -echo "configure:4257: checking if we need to override the system's value for HZ" >&5 -if eval "test \"`echo '$''{'ac_cv_var_override_hz'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6313: checking if we need to override the system's value for HZ" >&5 +echo $ECHO_N "checking if we need to override the system's value for HZ... $ECHO_C" >&6 +if test "${ac_cv_var_override_hz+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_override_hz=no case "$target" in @@ -4273,63 +6331,73 @@ case "$target" in ;; esac fi - -echo "$ac_t""$ac_cv_var_override_hz" 1>&6 +echo "$as_me:6334: result: $ac_cv_var_override_hz" >&5 +echo "${ECHO_T}$ac_cv_var_override_hz" >&6 case "$ac_cv_var_override_hz" in yes) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define OVERRIDE_HZ 1 EOF ;; esac - - -echo $ac_n "checking struct sigaction for sa_sigaction""... $ac_c" 1>&6 -echo "configure:4291: checking struct sigaction for sa_sigaction" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_sigaction_has_sa_sigaction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6345: checking struct sigaction for sa_sigaction" >&5 +echo $ECHO_N "checking struct sigaction for sa_sigaction... $ECHO_C" >&6 +if test "${ac_cv_struct_sigaction_has_sa_sigaction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat > conftest.$ac_ext <<EOF -#line 4297 "configure" + + cat >conftest.$ac_ext <<_ACEOF +#line 6352 "configure" #include "confdefs.h" #include <signal.h> -int main() { +int +main () +{ struct sigaction act; act.sa_sigaction = 0; -; return 0; } -EOF -if { (eval echo configure:4304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6364: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6367: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6370: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6373: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_sigaction_has_sa_sigaction=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_sigaction_has_sa_sigaction=no - -fi -rm -f conftest* - + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_sigaction_has_sa_sigaction=no fi +rm -f conftest.$ac_objext conftest.$ac_ext -echo "$ac_t""$ac_cv_struct_sigaction_has_sa_sigaction" 1>&6 +fi +echo "$as_me:6385: result: $ac_cv_struct_sigaction_has_sa_sigaction" >&5 +echo "${ECHO_T}$ac_cv_struct_sigaction_has_sa_sigaction" >&6 if test $ac_cv_struct_sigaction_has_sa_sigaction = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION 1 EOF fi -echo $ac_n "checking for struct ppsclockev""... $ac_c" 1>&6 -echo "configure:4328: checking for struct ppsclockev" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_ppsclockev'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6394: checking for struct ppsclockev" >&5 +echo $ECHO_N "checking for struct ppsclockev... $ECHO_C" >&6 +if test "${ac_cv_struct_ppsclockev+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4333 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6400 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4342,189 +6410,310 @@ else #ifdef HAVE_SYS_PPSCLOCK_H # include <sys/ppsclock.h> #endif -int main() { +int +main () +{ extern struct ppsclockev *pce; return pce->serial; -; return 0; } -EOF -if { (eval echo configure:4352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6424: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6427: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6430: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6433: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_ppsclockev=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_ppsclockev=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_ppsclockev=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_ppsclockev" 1>&6 +echo "$as_me:6444: result: $ac_cv_struct_ppsclockev" >&5 +echo "${ECHO_T}$ac_cv_struct_ppsclockev" >&6 if test $ac_cv_struct_ppsclockev = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_STRUCT_PPSCLOCKEV 1 EOF fi -echo $ac_n "checking struct sockaddr for sa_len""... $ac_c" 1>&6 -echo "configure:4374: checking struct sockaddr for sa_len" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_sockaddr_has_sa_len'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6453: checking struct sockaddr for sa_len" >&5 +echo $ECHO_N "checking struct sockaddr for sa_len... $ECHO_C" >&6 +if test "${ac_cv_struct_sockaddr_has_sa_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4379 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6459 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> -int main() { +int +main () +{ extern struct sockaddr *ps; return ps->sa_len; -; return 0; } -EOF -if { (eval echo configure:4390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6475: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6478: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6481: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6484: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_sockaddr_has_sa_len=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_sockaddr_has_sa_len=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_sockaddr_has_sa_len=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_sockaddr_has_sa_len" 1>&6 +echo "$as_me:6495: result: $ac_cv_struct_sockaddr_has_sa_len" >&5 +echo "${ECHO_T}$ac_cv_struct_sockaddr_has_sa_len" >&6 if test $ac_cv_struct_sockaddr_has_sa_len = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_SA_LEN_IN_STRUCT_SOCKADDR 1 EOF fi -echo $ac_n "checking struct clockinfo for hz""... $ac_c" 1>&6 -echo "configure:4412: checking struct clockinfo for hz" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_clockinfo_has_hz'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6504: checking struct clockinfo for hz" >&5 +echo $ECHO_N "checking struct clockinfo for hz... $ECHO_C" >&6 +if test "${ac_cv_struct_clockinfo_has_hz+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4417 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6510 "configure" #include "confdefs.h" #include <sys/time.h> -int main() { +int +main () +{ extern struct clockinfo *pc; return pc->hz; -; return 0; } -EOF -if { (eval echo configure:4427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6525: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6528: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6531: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6534: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_clockinfo_has_hz=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_clockinfo_has_hz=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_clockinfo_has_hz=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_clockinfo_has_hz" 1>&6 +echo "$as_me:6545: result: $ac_cv_struct_clockinfo_has_hz" >&5 +echo "${ECHO_T}$ac_cv_struct_clockinfo_has_hz" >&6 if test $ac_cv_struct_clockinfo_has_hz = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_HZ_IN_STRUCT_CLOCKINFO 1 EOF fi -echo $ac_n "checking struct clockinfo for tickadj""... $ac_c" 1>&6 -echo "configure:4449: checking struct clockinfo for tickadj" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_clockinfo_has_tickadj'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6554: checking struct clockinfo for tickadj" >&5 +echo $ECHO_N "checking struct clockinfo for tickadj... $ECHO_C" >&6 +if test "${ac_cv_struct_clockinfo_has_tickadj+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4454 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6560 "configure" #include "confdefs.h" #include <sys/time.h> -int main() { +int +main () +{ extern struct clockinfo *pc; return pc->tickadj; -; return 0; } -EOF -if { (eval echo configure:4464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6575: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6578: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6581: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6584: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_clockinfo_has_tickadj=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_clockinfo_has_tickadj=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_clockinfo_has_tickadj=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_clockinfo_has_tickadj" 1>&6 +echo "$as_me:6595: result: $ac_cv_struct_clockinfo_has_tickadj" >&5 +echo "${ECHO_T}$ac_cv_struct_clockinfo_has_tickadj" >&6 if test $ac_cv_struct_clockinfo_has_tickadj = yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_TICKADJ_IN_STRUCT_CLOCKINFO 1 EOF fi -echo $ac_n "checking for struct ntptimeval""... $ac_c" 1>&6 -echo "configure:4486: checking for struct ntptimeval" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_ntptimeval'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6604: checking for struct timespec" >&5 +echo $ECHO_N "checking for struct timespec... $ECHO_C" >&6 +if test "${ac_cv_struct_timespec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6610 "configure" +#include "confdefs.h" + +#include <sys/time.h> +/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */ +#ifdef HAVE_ERRNO_H +# include <errno.h> +#endif +#ifdef HAVE_SYS_TIMEPPS_H +# define FRAC 4294967296 +# include <sys/timepps.h> +#endif +int +main () +{ +struct timespec n; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6631: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6634: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6637: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6640: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_timespec=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_timespec=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:6650: result: $ac_cv_struct_timespec" >&5 +echo "${ECHO_T}$ac_cv_struct_timespec" >&6 +if test $ac_cv_struct_timespec = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_STRUCT_TIMESPEC 1 +EOF + +fi + +echo "$as_me:6660: checking for struct ntptimeval" >&5 +echo $ECHO_N "checking for struct ntptimeval... $ECHO_C" >&6 +if test "${ac_cv_struct_ntptimeval+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4491 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6666 "configure" #include "confdefs.h" #include <sys/time.h> #include <sys/timex.h> -int main() { +int +main () +{ struct ntptimeval n; -; return 0; } -EOF -if { (eval echo configure:4500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6680: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6683: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6686: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6689: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_struct_ntptimeval=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_ntptimeval=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_ntptimeval=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_struct_ntptimeval" 1>&6 +echo "$as_me:6699: result: $ac_cv_struct_ntptimeval" >&5 +echo "${ECHO_T}$ac_cv_struct_ntptimeval" >&6 if test $ac_cv_struct_ntptimeval = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define HAVE_STRUCT_NTPTIMEVAL 1 EOF fi -echo $ac_n "checking struct ntptimeval for time.tv_nsec""... $ac_c" 1>&6 -echo "configure:4521: checking struct ntptimeval for time.tv_nsec" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_ntptimeval_tv_nsec'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6709: checking for struct ntptimeval.time.tv_nsec" >&5 +echo $ECHO_N "checking for struct ntptimeval.time.tv_nsec... $ECHO_C" >&6 +if test "${ac_cv_member_struct_ntptimeval_time_tv_nsec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4526 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6715 "configure" #include "confdefs.h" - #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else @@ -4539,254 +6728,626 @@ else # include <timex.h> # endif #endif -int main() { - -extern struct ntptimeval *ntv; -return ntv->time.tv_nsec; -; return 0; } -EOF -if { (eval echo configure:4549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_ntptimeval_tv_nsec=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_ntptimeval_tv_nsec=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_struct_ntptimeval_tv_nsec" 1>&6 -if test "$ac_cv_struct_ntptimeval_tv_nsec" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_TV_NSEC_IN_NTPTIMEVAL 1 -EOF -fi - -echo $ac_n "checking for struct timespec in struct ntptimeval""... $ac_c" 1>&6 -echo "configure:4571: checking for struct timespec in struct ntptimeval" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_ntptimeval_timespec'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 4576 "configure" -#include "confdefs.h" -#include <sys/time.h> -#include <sys/timex.h> -int main() { -struct ntptimeval n; n.time.tv_nsec = 0; -; return 0; } -EOF -if { (eval echo configure:4584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_ntptimeval_timespec=yes +int +main () +{ +struct ntptimeval foo; +foo.time.tv_nsec; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6742: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6745: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6748: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6751: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_ntptimeval_time_tv_nsec=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_ntptimeval_timespec=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_member_struct_ntptimeval_time_tv_nsec=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:6761: result: $ac_cv_member_struct_ntptimeval_time_tv_nsec" >&5 +echo "${ECHO_T}$ac_cv_member_struct_ntptimeval_time_tv_nsec" >&6 +if test $ac_cv_member_struct_ntptimeval_time_tv_nsec = yes; then -echo "$ac_t""$ac_cv_struct_ntptimeval_timespec" 1>&6 -if test $ac_cv_struct_ntptimeval_timespec = yes; then - cat >> confdefs.h <<\EOF -#define TIMESPEC_IN_NTPTIMEVAL 1 +cat >>confdefs.h <<EOF +#define HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC 1 EOF fi -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:4605: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:6771: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <<EOF -#line 4612 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6779 "configure" #include "confdefs.h" +#ifndef __cplusplus +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:4619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6788: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6791: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6794: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6797: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext done fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in +echo "$as_me:6808: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline + no) +cat >>confdefs.h <<\EOF +#define inline EOF ;; - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define inline $ac_cv_c_inline EOF ;; esac -echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:4645: checking whether char is unsigned" >&5 -if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$GCC" = yes; then - # GCC predefines this symbol on systems where it applies. -cat > conftest.$ac_ext <<EOF -#line 4652 "configure" -#include "confdefs.h" -#ifdef __CHAR_UNSIGNED__ - yes -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_char_unsigned=yes -else - rm -rf conftest* - ac_cv_c_char_unsigned=no -fi -rm -f conftest* - -else -if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +echo "$as_me:6823: checking whether char is unsigned" >&5 +echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6 +if test "${ac_cv_c_char_unsigned+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4674 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 6829 "configure" #include "confdefs.h" -/* volatile prevents gcc2 from optimizing the test away on sparcs. */ -#if !defined(__STDC__) || __STDC__ != 1 -#define volatile -#endif -main() { - volatile char c = 255; exit(c < 0); +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !(((char) -1) < 0)] + ; + return 0; } -EOF -if { (eval echo configure:4684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_char_unsigned=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6841: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6844: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6847: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6850: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_char_unsigned=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_char_unsigned=yes fi -rm -fr conftest* -fi - -fi +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 +echo "$as_me:6860: result: $ac_cv_c_char_unsigned" >&5 +echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define __CHAR_UNSIGNED__ 1 EOF fi case "$host" in $target) - echo $ac_n "checking size of signed char""... $ac_c" 1>&6 -echo "configure:4709: checking size of signed char" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_signed_char'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:6870: checking for signed char" >&5 +echo $ECHO_N "checking for signed char... $ECHO_C" >&6 +if test "${ac_cv_type_signed_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 6876 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((signed char *) 0) + return 0; +if (sizeof (signed char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6891: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6894: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6897: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6900: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signed_char=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_signed_char=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:6910: result: $ac_cv_type_signed_char" >&5 +echo "${ECHO_T}$ac_cv_type_signed_char" >&6 + +echo "$as_me:6913: checking size of signed char" >&5 +echo $ECHO_N "checking size of signed char... $ECHO_C" >&6 +if test "${ac_cv_sizeof_signed_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_signed_char" = yes; then if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 6922 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6934: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6937: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6940: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6943: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 6948 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6960: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6963: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6966: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6969: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done else - cat > conftest.$ac_ext <<EOF -#line 4717 "configure" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 6985 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(signed char)); - exit(0); +int _array_ [1 - 2 * !((sizeof (signed char)) >= $ac_mid)] + ; + return 0; } -EOF -if { (eval echo configure:4728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_signed_char=`cat conftestval` +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6997: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7000: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7003: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7006: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 7022 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7034: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7037: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7040: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7043: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_signed_char=$ac_lo else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_signed_char=0 + if test "$cross_compiling" = yes; then + { { echo "$as_me:7056: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 7061 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (signed char))); +fclose (f); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7077: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7080: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7082: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7085: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_signed_char=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_signed_char=0 fi - fi -echo "$ac_t""$ac_cv_sizeof_signed_char" 1>&6 -cat >> confdefs.h <<EOF +echo "$as_me:7101: result: $ac_cv_sizeof_signed_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_signed_char" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char EOF - ;; *) case "$target" in *-*-vxworks*) - echo $ac_n "checking size of signed char""... $ac_c" 1>&6 -echo "configure:4751: checking size of signed char" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_signed_char'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:7110: checking for signed char" >&5 +echo $ECHO_N "checking for signed char... $ECHO_C" >&6 +if test "${ac_cv_type_signed_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 7116 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((signed char *) 0) + return 0; +if (sizeof (signed char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7131: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7134: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7137: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7140: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signed_char=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_signed_char=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7150: result: $ac_cv_type_signed_char" >&5 +echo "${ECHO_T}$ac_cv_type_signed_char" >&6 + +echo "$as_me:7153: checking size of signed char" >&5 +echo $ECHO_N "checking size of signed char... $ECHO_C" >&6 +if test "${ac_cv_sizeof_signed_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_signed_char" = yes; then if test "$cross_compiling" = yes; then - ac_cv_sizeof_signed_char=1 + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 7162 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7174: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7177: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7180: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7183: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7188 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7200: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7203: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7206: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7209: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done else - cat > conftest.$ac_ext <<EOF -#line 4759 "configure" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7225 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(signed char)); - exit(0); +int _array_ [1 - 2 * !((sizeof (signed char)) >= $ac_mid)] + ; + return 0; } -EOF -if { (eval echo configure:4770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_signed_char=`cat conftestval` +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7237: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7240: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7243: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7246: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 7262 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (signed char)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7274: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7277: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7280: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7283: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_signed_char=$ac_lo else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_signed_char=0 + if test "$cross_compiling" = yes; then + { { echo "$as_me:7296: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 7301 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (signed char))); +fclose (f); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7317: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7320: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7322: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7325: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_signed_char=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_signed_char=0 fi - fi -echo "$ac_t""$ac_cv_sizeof_signed_char" 1>&6 -cat >> confdefs.h <<EOF +echo "$as_me:7341: result: $ac_cv_sizeof_signed_char" >&5 +echo "${ECHO_T}$ac_cv_sizeof_signed_char" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_SIGNED_CHAR $ac_cv_sizeof_signed_char EOF - ;; - *) { echo "configure: error: Cross-compiling needs explicit SIZEOF_SIGNED_LONG" 1>&2; exit 1; } + *) { { echo "$as_me:7348: error: Cross-compiling needs explicit SIZEOF_SIGNED_LONG" >&5 +echo "$as_me: error: Cross-compiling needs explicit SIZEOF_SIGNED_LONG" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; @@ -4794,89 +7355,487 @@ esac case "$host" in $target) - echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:4799: checking size of int" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:7358: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 7364 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7379: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7382: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7385: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7388: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_int=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7398: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:7401: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 7410 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7422: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7425: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7428: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7431: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7436 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7448: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7451: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7454: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7457: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done else - cat > conftest.$ac_ext <<EOF -#line 4807 "configure" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7473 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(int)); - exit(0); +int _array_ [1 - 2 * !((sizeof (int)) >= $ac_mid)] + ; + return 0; } -EOF -if { (eval echo configure:4818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_int=`cat conftestval` +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7485: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7488: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7491: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7494: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 7510 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7522: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7525: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7528: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7531: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_int=$ac_lo else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 + if test "$cross_compiling" = yes; then + { { echo "$as_me:7544: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 7549 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (int))); +fclose (f); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7565: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7568: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7570: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7573: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >> confdefs.h <<EOF +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:7589: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_INT $ac_cv_sizeof_int EOF - ;; *) case "$target" in *-*-vxworks*) - echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:4841: checking size of int" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:7598: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 7604 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7619: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7622: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7625: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7628: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_int=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7638: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:7641: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then if test "$cross_compiling" = yes; then - ac_cv_sizeof_int=4 + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 7650 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7662: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7665: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7668: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7671: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7676 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7688: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7691: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7694: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7697: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done else - cat > conftest.$ac_ext <<EOF -#line 4849 "configure" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7713 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(int)); - exit(0); +int _array_ [1 - 2 * !((sizeof (int)) >= $ac_mid)] + ; + return 0; } -EOF -if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_int=`cat conftestval` +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7725: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7728: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7731: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7734: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 7750 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (int)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7762: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7765: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7768: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7771: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_int=$ac_lo else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_int=0 + if test "$cross_compiling" = yes; then + { { echo "$as_me:7784: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 7789 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (int))); +fclose (f); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:7805: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7808: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:7810: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7813: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi -echo "$ac_t""$ac_cv_sizeof_int" 1>&6 -cat >> confdefs.h <<EOF +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:7829: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_INT $ac_cv_sizeof_int EOF - ;; - *) { echo "configure: error: Cross-compiling needs explicit SIZEOF_INT" 1>&2; exit 1; } + *) { { echo "$as_me:7836: error: Cross-compiling needs explicit SIZEOF_INT" >&5 +echo "$as_me: error: Cross-compiling needs explicit SIZEOF_INT" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; @@ -4884,123 +7843,538 @@ esac case "$host" in $target) - echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4889: checking size of long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:7846: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7852 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7867: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7870: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7873: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7876: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_long=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7886: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:7889: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 7898 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7910: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7913: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7916: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7919: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7924 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7936: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7939: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7942: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7945: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 7961 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) >= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7973: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7976: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7979: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7982: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 7998 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8010: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8013: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8016: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8019: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_long=$ac_lo else if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + { { echo "$as_me:8032: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } else - cat > conftest.$ac_ext <<EOF -#line 4897 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8037 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long)); - exit(0); +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (long))); +fclose (f); + ; + return 0; } -EOF -if { (eval echo configure:4908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:8053: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8056: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:8058: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8061: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi - fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <<EOF +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:8077: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_LONG $ac_cv_sizeof_long EOF - ;; *) case "$target" in *-*-vxworks*) - echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4931: checking size of long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:8086: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + cat >conftest.$ac_ext <<_ACEOF +#line 8092 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8107: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8110: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8113: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8116: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_long=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:8126: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:8129: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then if test "$cross_compiling" = yes; then - ac_cv_sizeof_long=4 + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +#line 8138 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) >= 0)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8150: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8153: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8156: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8159: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 8164 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8176: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8179: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8182: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8185: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1`; ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done else - cat > conftest.$ac_ext <<EOF -#line 4939 "configure" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +#line 8201 "configure" #include "confdefs.h" -#include <stdio.h> -main() +$ac_includes_default +int +main () { - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof(long)); - exit(0); +int _array_ [1 - 2 * !((sizeof (long)) >= $ac_mid)] + ; + return 0; } -EOF -if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_sizeof_long=`cat conftestval` +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8213: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8216: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8219: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8222: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_hi=`expr $ac_mid - 1`; ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done +fi +rm -f conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +#line 8238 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +int _array_ [1 - 2 * !((sizeof (long)) <= $ac_mid)] + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8250: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8253: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8256: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8259: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_lo=`expr $ac_mid + 1` +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +ac_cv_sizeof_long=$ac_lo else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_sizeof_long=0 + if test "$cross_compiling" = yes; then + { { echo "$as_me:8272: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 8277 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +FILE *f = fopen ("conftest.val", "w"); +if (!f) + exit (1); +fprintf (f, "%d", (sizeof (long))); +fclose (f); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:8293: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8296: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:8298: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8301: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 fi -rm -fr conftest* +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 fi - fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <<EOF +echo "$as_me:8317: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<EOF #define SIZEOF_LONG $ac_cv_sizeof_long EOF - ;; - *) { echo "configure: error: Cross-compiling needs explicit SIZEOF_LONG" 1>&2; exit 1; } + *) { { echo "$as_me:8324: error: Cross-compiling needs explicit SIZEOF_LONG" >&5 +echo "$as_me: error: Cross-compiling needs explicit SIZEOF_LONG" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; esac -echo $ac_n "checking for s_char""... $ac_c" 1>&6 -echo "configure:4977: checking for s_char" >&5 -if eval "test \"`echo '$''{'ac_cv_type_s_char'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:8332: checking for s_char" >&5 +echo $ECHO_N "checking for s_char... $ECHO_C" >&6 +if test "${ac_cv_type_s_char+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 4982 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8338 "configure" #include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])s_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +$ac_includes_default +int +main () +{ +if ((s_char *) 0) + return 0; +if (sizeof (s_char)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8353: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8356: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8359: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8362: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_s_char=yes else - rm -rf conftest* - ac_cv_type_s_char=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_s_char=no fi -rm -f conftest* - +rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_s_char" 1>&6 -if test $ac_cv_type_s_char = no; then - cat >> confdefs.h <<\EOF -#define s_char signed char +echo "$as_me:8372: result: $ac_cv_type_s_char" >&5 +echo "${ECHO_T}$ac_cv_type_s_char" >&6 +if test $ac_cv_type_s_char = yes; then + +cat >>confdefs.h <<EOF +#define HAVE_S_CHAR 1 EOF fi @@ -5011,119 +8385,135 @@ case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in ;; no0no) # We have signed chars, can't say 'signed char', no s_char typedef. - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NEED_S_CHAR_TYPEDEF 1 EOF ;; no1no) # We have signed chars, can say 'signed char', no s_char typedef. - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NEED_S_CHAR_TYPEDEF 1 EOF ;; yes0no) # We have unsigned chars, can't say 'signed char', no s_char typedef. - { echo "configure: error: No way to specify a signed character!" 1>&2; exit 1; } + { { echo "$as_me:8402: error: No way to specify a signed character!" >&5 +echo "$as_me: error: No way to specify a signed character!" >&2;} + { (exit 1); exit 1; }; } ;; yes1no) # We have unsigned chars, can say 'signed char', no s_char typedef. - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NEED_S_CHAR_TYPEDEF 1 EOF ;; esac -echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5040: checking for uid_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:8414: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 +if test "${ac_cv_type_uid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5045 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8420 "configure" #include "confdefs.h" #include <sys/types.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "uid_t" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_type_uid_t=yes else - rm -rf conftest* ac_cv_type_uid_t=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +echo "$as_me:8434: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\EOF #define uid_t int EOF - cat >> confdefs.h <<\EOF +cat >>confdefs.h <<\EOF #define gid_t int EOF fi - case "$target" in *-*-linux*) - for ac_func in __adjtimex __ntp_gettime + +for ac_func in __adjtimex __ntp_gettime do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5079: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8454: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5084 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8460 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8491: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8494: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8497: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8500: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8510: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done @@ -5137,285 +8527,542 @@ case "$target" in # this conditional will need to change. Maybe use AC_TRY_RUN # instead to try to set the time to itself and check errno. ;; - *) for ac_func in clock_settime + *) +for ac_func in clock_settime do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5144: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8534: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5149 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8540 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8571: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8574: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8577: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8580: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8590: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac -for ac_func in daemon getbootfile getdtablesize getrusage + +for ac_func in daemon do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5201: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8606: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5206 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8612 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8643: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8646: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8649: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8652: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8662: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done -for ac_func in gettimeofday +for ac_func in finite do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5256: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8675: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5261 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8681 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8712: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8715: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8718: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8721: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8731: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + +for ac_func in isfinite +do +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8743: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8749 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8780: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8783: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8786: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8789: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8799: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 +EOF + +else + echo "$as_me:8807: checking for isfinite with <math.h>" >&5 +echo $ECHO_N "checking for isfinite with <math.h>... $ECHO_C" >&6 + _libs=$LIBS + LIBS="$LIBS -lm" + cat >conftest.$ac_ext <<_ACEOF +#line 8812 "configure" +#include "confdefs.h" +#include <math.h> +int +main () +{ +float f = 0.0; isfinite(f) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8824: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8827: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8830: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8833: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:8835: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\EOF +#define HAVE_ISFINITE 1 +EOF + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:8844: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS=$_libs fi -rm -f conftest* +done + fi +done -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - +for ac_func in getbootfile getclock getdtablesize getrusage gettimeofday +do +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8858: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 + cat >conftest.$ac_ext <<_ACEOF +#line 8864 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8895: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8898: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8901: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8904: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8914: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 +EOF + fi done case "$target" in *-pc-cygwin*) ;; - *) for ac_func in getuid + *) +for ac_func in getuid do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5314: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:8931: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5319 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 8937 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8968: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8971: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8974: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8977: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8987: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac -for ac_func in K_open kvm_open memcpy memmove memset + +for ac_func in hstrerror K_open kvm_open memcpy memmove memset do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5371: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9003: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5376 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9009 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9040: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9043: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9046: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9049: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9059: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done @@ -5423,120 +9070,150 @@ case "$target" in *-*-sco3.2v5.0.*) # Just stubs. Idiots. ;; - *) for ac_func in mkstemp + *) +for ac_func in mkstemp do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5430: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9077: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5435 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9083 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9114: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9117: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9120: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9123: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9133: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac + for ac_func in mktime do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5487: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9149: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5492 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9155 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:5515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9186: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9189: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9192: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9195: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 +echo "$as_me:9205: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF - + else - echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" + LIBOBJS="$LIBOBJS $ac_func.$ac_objext" fi done - case "$target" in *-*-aix4*) # Just a stub. Idiots. @@ -5550,226 +9227,285 @@ case "$target" in alpha*-dec-osf4*|alpha*-dec-osf5*) # mlockall is there, as a #define calling memlk via <sys/mman.h> # Not easy to test for - cheat. - for ac_func in memlk + +for ac_func in memlk do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5557: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9234: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5562 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9240 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:5585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9271: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9274: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9277: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9280: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9290: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF ac_cv_func_mlockall='yes' -else - echo "$ac_t""no" 1>&6 fi done - for ac_func in mlockall +for ac_func in mlockall do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5612: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9303: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5617 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9309 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9340: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9343: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9346: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9349: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9359: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; - *) for ac_func in mlockall + *) +for ac_func in mlockall do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5668: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9374: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5673 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9380 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9411: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9414: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9417: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9420: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9430: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac -for ac_func in nice nlist + +for ac_func in mrand48 srand48 nice nlist do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5725: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9446: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5730 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9452 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9483: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9486: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9489: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9492: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9502: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done @@ -5777,173 +9513,225 @@ case "$target" in *-*-solaris2.6) # Broken... ;; - *) for ac_func in ntp_adjtime ntp_gettime + *) + +for ac_func in ntp_adjtime ntp_gettime do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5784: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9521: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5789 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9527 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9558: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9561: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9564: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9567: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9577: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac -for ac_func in plock pututline pututxline rtprio + +for ac_func in plock pututline pututxline readlink rtprio do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5841: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9593: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5846 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9599 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9630: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9633: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9636: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9639: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9649: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done -for ac_func in random srandom mrand48 srand48 +case "$ac_cv_func_mrand48" in + yes) ;; + *) +for ac_func in random do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5896: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9665: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5901 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9671 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:5924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9702: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9705: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9708: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9711: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 +echo "$as_me:9721: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF - + else - echo "$ac_t""no" 1>&6 + LIBOBJS="$LIBOBJS $ac_func.$ac_objext" fi done + ;; +esac case "$target" in *-*-aix4*) # Just a stub in AIX 4. Idiots. @@ -5951,285 +9739,357 @@ case "$target" in *-*-solaris2.5*) # Just stubs in solaris2.5. Idiots. ;; - *) for ac_func in sched_setscheduler + *) +for ac_func in sched_setscheduler do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5958: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9746: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 5963 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9752 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9783: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9786: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9789: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9792: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9802: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:5986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac + for ac_func in setlinebuf do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6015: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9818: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6020 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9824 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9855: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9858: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9861: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9864: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9874: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done for ac_func in setpgid setpriority setsid settimeofday setvbuf sigaction do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6070: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9887: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6075 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9893 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9924: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9927: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9930: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9933: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9943: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done for ac_func in sigvec sigset sigsuspend stime strchr sysconf sysctl do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6125: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:9956: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6130 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 9962 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9993: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9996: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9999: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10002: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10012: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done -for ac_func in strerror +for ac_func in snprintf strdup strerror do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6180: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:10025: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6185 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10031 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } -EOF -if { (eval echo configure:6208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10062: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10065: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10068: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10071: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 +echo "$as_me:10081: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF - + else - echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" + LIBOBJS="$LIBOBJS $ac_func.$ac_objext" fi done - case "$target" in *-*-aix4*) # Just stubs. Idiots. @@ -6240,58 +10100,74 @@ case "$target" in *-*-openbsd*) # Just stubs. Idiots. ;; - *) for ac_func in timer_create timer_settime + *) + +for ac_func in timer_create timer_settime do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6247: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:10108: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6252 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10114 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10145: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10148: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10151: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10154: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10164: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done @@ -6301,163 +10177,205 @@ case "$target" in *-pc-cygwin*) # I have no idea... ;; - *) for ac_func in umask + *) +for ac_func in umask do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6308: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:10184: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6313 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10190 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10221: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10224: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10227: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10230: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10240: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done ;; esac + for ac_func in uname updwtmp updwtmpx vsprintf do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6365: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` +echo "$as_me:10256: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6370 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10262 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ + which can conflict with char $ac_func (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +f = $ac_func; #endif -; return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10293: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10296: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10299: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10302: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$ac_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$ac_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10312: result: `eval echo '${'$ac_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 +if test `eval echo '${'$ac_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $ac_tr_cpp` 1 EOF -if { (eval echo configure:6393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done - -echo $ac_n "checking number of arguments to gettimeofday()""... $ac_c" 1>&6 -echo "configure:6419: checking number of arguments to gettimeofday()" >&5 -if eval "test \"`echo '$''{'ac_cv_func_Xettimeofday_nargs'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10322: checking number of arguments to gettimeofday()" >&5 +echo $ECHO_N "checking number of arguments to gettimeofday()... $ECHO_C" >&6 +if test "${ac_cv_func_Xettimeofday_nargs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6424 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10328 "configure" #include "confdefs.h" #include <sys/time.h> -int main() { +int +main () +{ gettimeofday((struct timeval*)0,(struct timezone*)0); settimeofday((struct timeval*)0,(struct timezone*)0); -; return 0; } -EOF -if { (eval echo configure:6434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10343: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10346: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10349: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10352: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_Xettimeofday_nargs=2 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_Xettimeofday_nargs=1 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_Xettimeofday_nargs=1 fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_func_Xettimeofday_nargs" 1>&6 +echo "$as_me:10363: result: $ac_cv_func_Xettimeofday_nargs" >&5 +echo "${ECHO_T}$ac_cv_func_Xettimeofday_nargs" >&6 if test $ac_cv_func_Xettimeofday_nargs = 1; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define SYSV_TIMEOFDAY 1 EOF fi -echo $ac_n "checking number of arguments taken by setpgrp()""... $ac_c" 1>&6 -echo "configure:6456: checking number of arguments taken by setpgrp()" >&5 -if eval "test \"`echo '$''{'ac_cv_func_setpgrp_nargs'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10372: checking number of arguments taken by setpgrp()" >&5 +echo $ECHO_N "checking number of arguments taken by setpgrp()... $ECHO_C" >&6 +if test "${ac_cv_func_setpgrp_nargs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6461 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10378 "configure" #include "confdefs.h" #ifdef HAVE_SYS_TYPES_H @@ -6467,26 +10385,39 @@ else # include <unistd.h> #endif -int main() { +int +main () +{ setpgrp(0,0); -; return 0; } -EOF -if { (eval echo configure:6475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10397: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10400: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10403: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10406: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_setpgrp_nargs=2 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_setpgrp_nargs=0 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_setpgrp_nargs=0 fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_func_setpgrp_nargs" 1>&6 +echo "$as_me:10417: result: $ac_cv_func_setpgrp_nargs" >&5 +echo "${ECHO_T}$ac_cv_func_setpgrp_nargs" >&6 if test $ac_cv_func_setpgrp_nargs = 0; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_SETPGRP_0 1 EOF @@ -6495,13 +10426,13 @@ fi save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -I$srcdir/include" -echo $ac_n "checking argument pointer type of qsort()'s compare function and base""... $ac_c" 1>&6 -echo "configure:6500: checking argument pointer type of qsort()'s compare function and base" >&5 -if eval "test \"`echo '$''{'ac_cv_func_qsort_argtype'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10429: checking argument pointer type of qsort()'s compare function and base" >&5 +echo $ECHO_N "checking argument pointer type of qsort()'s compare function and base... $ECHO_C" >&6 +if test "${ac_cv_func_qsort_argtype+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6505 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10435 "configure" #include "confdefs.h" #include "l_stdlib.h" @@ -6518,29 +10449,42 @@ int sortfunc(a, b) const void *a; const void *b; { return 0; } -int main() { +int +main () +{ qsort(base, 2, sizeof(char *), sortfunc); -; return 0; } -EOF -if { (eval echo configure:6528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10463: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10466: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10469: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10472: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_qsort_argtype=void else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_qsort_argtype=char + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_qsort_argtype=char fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_func_qsort_argtype" 1>&6 +echo "$as_me:10483: result: $ac_cv_func_qsort_argtype" >&5 +echo "${ECHO_T}$ac_cv_func_qsort_argtype" >&6 case "$ac_cv_func_qsort_argtype" in void) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define QSORT_USES_VOID_P 1 EOF @@ -6549,48 +10493,61 @@ esac CFLAGS=$save_CFLAGS -echo $ac_n "checking if we need to declare 'errno'""... $ac_c" 1>&6 -echo "configure:6554: checking if we need to declare 'errno'" >&5 -if eval "test \"`echo '$''{'ac_cv_decl_errno'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10496: checking if we need to declare 'errno'" >&5 +echo $ECHO_N "checking if we need to declare 'errno'... $ECHO_C" >&6 +if test "${ac_cv_decl_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6559 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10502 "configure" #include "confdefs.h" #ifdef HAVE_ERRNO_H #include <errno.h> #endif -int main() { +int +main () +{ errno = 0; -; return 0; } -EOF -if { (eval echo configure:6568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10516: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10519: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10522: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10525: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_decl_errno=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_decl_errno=yes + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_decl_errno=yes fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_decl_errno" 1>&6 +echo "$as_me:10535: result: $ac_cv_decl_errno" >&5 +echo "${ECHO_T}$ac_cv_decl_errno" >&6 case "$ac_cv_decl_errno" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define DECL_ERRNO 1 EOF ;; esac -echo $ac_n "checking if we may declare 'h_errno'""... $ac_c" 1>&6 -echo "configure:6589: checking if we may declare 'h_errno'" >&5 -if eval "test \"`echo '$''{'ac_cv_decl_h_errno'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10544: checking if we may declare 'h_errno'" >&5 +echo $ECHO_N "checking if we may declare 'h_errno'... $ECHO_C" >&6 +if test "${ac_cv_decl_h_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6594 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10550 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_NETINET_IN_H @@ -6605,74 +10562,100 @@ else #ifdef HAVE_RESOLV_H #include <resolv.h> #endif -int main() { +int +main () +{ extern int h_errno; -; return 0; } -EOF -if { (eval echo configure:6613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10574: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10577: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10580: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10583: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_decl_h_errno=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_decl_h_errno=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_decl_h_errno=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_decl_h_errno" 1>&6 +echo "$as_me:10593: result: $ac_cv_decl_h_errno" >&5 +echo "${ECHO_T}$ac_cv_decl_h_errno" >&6 case "$ac_cv_decl_h_errno" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define DECL_H_ERRNO 1 EOF ;; esac -echo $ac_n "checking if declaring 'char *sys_errlist[]' is ok""... $ac_c" 1>&6 -echo "configure:6634: checking if declaring 'char *sys_errlist[]' is ok" >&5 -if eval "test \"`echo '$''{'ac_cv_decl_sys_errlist'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10602: checking if declaring 'char *sys_errlist[]' is ok" >&5 +echo $ECHO_N "checking if declaring 'char *sys_errlist[]' is ok... $ECHO_C" >&6 +if test "${ac_cv_decl_sys_errlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6639 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10608 "configure" #include "confdefs.h" #include <stdio.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif -int main() { - extern char *sys_errlist[]; - -; return 0; } -EOF -if { (eval echo configure:6650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +int +main () +{ +extern char *sys_errlist[]; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10624: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10627: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10630: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10633: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_decl_sys_errlist=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_decl_sys_errlist=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_decl_sys_errlist=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_decl_sys_errlist" 1>&6 +echo "$as_me:10643: result: $ac_cv_decl_sys_errlist" >&5 +echo "${ECHO_T}$ac_cv_decl_sys_errlist" >&6 case "$ac_cv_decl_sys_errlist" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define CHAR_SYS_ERRLIST 1 EOF ;; esac -echo $ac_n "checking if declaring 'syscall()' is ok""... $ac_c" 1>&6 -echo "configure:6671: checking if declaring 'syscall()' is ok" >&5 -if eval "test \"`echo '$''{'ac_cv_decl_syscall'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10652: checking if declaring 'syscall()' is ok" >&5 +echo $ECHO_N "checking if declaring 'syscall()' is ok... $ECHO_C" >&6 +if test "${ac_cv_decl_syscall+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 6676 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 10658 "configure" #include "confdefs.h" #ifdef HAVE_SYS_TYPES_H @@ -6687,119 +10670,138 @@ else #define P(x) () #endif -int main() { +int +main () +{ extern int syscall P((int, ...)); -; return 0; } -EOF -if { (eval echo configure:6695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10682: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10685: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10688: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10691: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_decl_syscall=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_decl_syscall=no + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_decl_syscall=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_decl_syscall" 1>&6 +echo "$as_me:10701: result: $ac_cv_decl_syscall" >&5 +echo "${ECHO_T}$ac_cv_decl_syscall" >&6 case "$ac_cv_decl_syscall" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define DECL_SYSCALL 1 EOF ;; esac case "$target" in + *-*-aix4.3.*) + cat >>confdefs.h <<\EOF +#define DECL_HSTRERROR_0 1 +EOF + # Needed for XLC under AIX 4.3.2 + ;; *-*-osf[45]*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_PLOCK_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_STIME_1 1 EOF ;; *-*-riscos4*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_ADJTIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_BZERO_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IOCTL_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IPC_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MEMMOVE_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MKTEMP_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_RENAME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SELECT_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETITIMER_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETPRIORITY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_STDIO_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_STRTOL_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SYSLOG_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIMEOFDAY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TOLOWER_0 1 EOF ;; *-*-solaris2*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MKSTEMP_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETPRIORITY_1 1 EOF case "$target" in *-*-solaris2.4) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIMEOFDAY_0 1 EOF @@ -6807,161 +10809,165 @@ EOF esac ;; *-*-sunos4*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_ADJTIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_BCOPY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_BZERO_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IOCTL_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IPC_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MEMMOVE_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MKTEMP_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MKSTEMP_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MRAND48_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_RENAME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SELECT_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETITIMER_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETPRIORITY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SIGVEC_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SRAND48_0 1 EOF case "`basename $ac_cv_prog_CC`" in acc*) ;; - *) cat >> confdefs.h <<\EOF + *) cat >>confdefs.h <<\EOF #define DECL_STDIO_0 1 EOF ;; esac - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_STRTOL_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SYSLOG_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIMEOFDAY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TOLOWER_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TOUPPER_0 1 EOF + cat >>confdefs.h <<\EOF +#define DECL_STRERROR_0 1 +EOF + ;; *-*-ultrix4*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_ADJTIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_BZERO_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_CFSETISPEED_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IOCTL_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_IPC_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MKTEMP_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_MRAND48_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_NLIST_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_PLOCK_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SELECT_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETITIMER_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SETPRIORITY_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SRAND48_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_STIME_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_SYSLOG_0 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DECL_TIMEOFDAY_0 1 EOF @@ -6970,27 +10976,27 @@ esac case "$target" in *-*-sco3.2*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define TERMIOS_NEEDS__SVID3 1 EOF ;; esac -echo $ac_n "checking if we should use a streams device for ifconfig""... $ac_c" 1>&6 -echo "configure:6982: checking if we should use a streams device for ifconfig" >&5 -if eval "test \"`echo '$''{'ac_cv_var_use_streams_device_for_ifconfig'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10986: checking if we should use a streams device for ifconfig" >&5 +echo $ECHO_N "checking if we should use a streams device for ifconfig... $ECHO_C" >&6 +if test "${ac_cv_var_use_streams_device_for_ifconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_use_streams_device_for_ifconfig=no fi +echo "$as_me:10993: result: $ac_cv_var_use_streams_device_for_ifconfig" >&5 +echo "${ECHO_T}$ac_cv_var_use_streams_device_for_ifconfig" >&6 -echo "$ac_t""$ac_cv_var_use_streams_device_for_ifconfig" 1>&6 - -echo $ac_n "checking if we need extra room for SO_RCVBUF""... $ac_c" 1>&6 -echo "configure:6992: checking if we need extra room for SO_RCVBUF" >&5 -if eval "test \"`echo '$''{'ac_cv_var_rcvbuf_slop'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:10996: checking if we need extra room for SO_RCVBUF" >&5 +echo $ECHO_N "checking if we need extra room for SO_RCVBUF... $ECHO_C" >&6 +if test "${ac_cv_var_rcvbuf_slop+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7000,19 +11006,19 @@ case "$target" in esac ac_cv_var_rcvbuf_slop=$ans fi - -echo "$ac_t""$ac_cv_var_rcvbuf_slop" 1>&6 +echo "$as_me:11009: result: $ac_cv_var_rcvbuf_slop" >&5 +echo "${ECHO_T}$ac_cv_var_rcvbuf_slop" >&6 case "$ac_cv_var_rcvbuf_slop" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define NEED_RCVBUF_SLOP 1 EOF ;; esac -echo $ac_n "checking if we will open the broadcast socket""... $ac_c" 1>&6 -echo "configure:7014: checking if we will open the broadcast socket" >&5 -if eval "test \"`echo '$''{'ac_cv_var_open_bcast_socket'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11018: checking if we will open the broadcast socket" >&5 +echo $ECHO_N "checking if we will open the broadcast socket... $ECHO_C" >&6 +if test "${ac_cv_var_open_bcast_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=yes case "$target" in @@ -7025,19 +11031,19 @@ case "$target" in esac ac_cv_var_open_bcast_socket=$ans fi - -echo "$ac_t""$ac_cv_var_open_bcast_socket" 1>&6 +echo "$as_me:11034: result: $ac_cv_var_open_bcast_socket" >&5 +echo "${ECHO_T}$ac_cv_var_open_bcast_socket" >&6 case "$ac_cv_var_open_bcast_socket" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define OPEN_BCAST_SOCKET 1 EOF ;; esac -echo $ac_n "checking if we want the HPUX version of FindConfig()""... $ac_c" 1>&6 -echo "configure:7039: checking if we want the HPUX version of FindConfig()" >&5 -if eval "test \"`echo '$''{'ac_cv_var_hpux_findconfig'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11043: checking if we want the HPUX version of FindConfig()" >&5 +echo $ECHO_N "checking if we want the HPUX version of FindConfig()... $ECHO_C" >&6 +if test "${ac_cv_var_hpux_findconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7047,19 +11053,19 @@ case "$target" in esac ac_cv_var_hpux_findconfig=$ans fi - -echo "$ac_t""$ac_cv_var_hpux_findconfig" 1>&6 +echo "$as_me:11056: result: $ac_cv_var_hpux_findconfig" >&5 +echo "${ECHO_T}$ac_cv_var_hpux_findconfig" >&6 case "$ac_cv_var_hpux_findconfig" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define NEED_HPUX_FINDCONFIG 1 EOF ;; esac -echo $ac_n "checking if process groups are set with -pid""... $ac_c" 1>&6 -echo "configure:7061: checking if process groups are set with -pid" >&5 -if eval "test \"`echo '$''{'ac_cv_arg_setpgrp_negpid'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11065: checking if process groups are set with -pid" >&5 +echo $ECHO_N "checking if process groups are set with -pid... $ECHO_C" >&6 +if test "${ac_cv_arg_setpgrp_negpid+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in *-*-hpux[567]*) @@ -7083,22 +11089,22 @@ else esac ac_cv_arg_setpgrp_negpid=$ans fi - -echo "$ac_t""$ac_cv_arg_setpgrp_negpid" 1>&6 +echo "$as_me:11092: result: $ac_cv_arg_setpgrp_negpid" >&5 +echo "${ECHO_T}$ac_cv_arg_setpgrp_negpid" >&6 case "$ac_cv_arg_setpgrp_negpid" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define UDP_BACKWARDS_SETOWN 1 EOF ;; esac -echo $ac_n "checking if we need a ctty for F_SETOWN""... $ac_c" 1>&6 -echo "configure:7097: checking if we need a ctty for F_SETOWN" >&5 -if eval "test \"`echo '$''{'ac_cv_func_ctty_for_f_setown'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11101: checking if we need a ctty for F_SETOWN" >&5 +echo $ECHO_N "checking if we need a ctty for F_SETOWN... $ECHO_C" >&6 +if test "${ac_cv_func_ctty_for_f_setown+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in - *-*-bsdi2*) + *-*-bsdi23*) ans=yes ;; *-*-freebsd*) @@ -7107,6 +11113,9 @@ else *-*-netbsd*) ans=yes ;; + *-*-openbsd*) + ans=yes + ;; *-*-osf*) ans=yes ;; @@ -7115,18 +11124,18 @@ else esac ac_cv_func_ctty_for_f_setown=$ans fi - -echo "$ac_t""$ac_cv_func_ctty_for_f_setown" 1>&6 +echo "$as_me:11127: result: $ac_cv_func_ctty_for_f_setown" >&5 +echo "${ECHO_T}$ac_cv_func_ctty_for_f_setown" >&6 case "$ac_cv_func_ctty_for_f_setown" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define USE_FSETOWNCTTY 1 EOF ;; esac ntp_warning='GRONK' -echo $ac_n "checking if we'll use clock_settime or settimeofday or stime""... $ac_c" 1>&6 -echo "configure:7130: checking if we'll use clock_settime or settimeofday or stime" >&5 +echo "$as_me:11137: checking if we'll use clock_settime or settimeofday or stime" >&5 +echo $ECHO_N "checking if we'll use clock_settime or settimeofday or stime... $ECHO_C" >&6 case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in yes*) ntp_warning='' @@ -7140,24 +11149,26 @@ case "$ac_cv_func_clock_settime$ac_cv_func_settimeofday$ac_cv_func_stime" in ntp_warning='Which is the worst of the three' ans='stime()' ;; - *) + *) case "$host" in $target) ntp_warning='Which leaves us with nothing to use!' ans=none ;; esac esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:11159: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 case "$ntp_warning" in '') ;; - *) echo "configure: warning: *** $ntp_warning ***" 1>&2 + *) { echo "$as_me:11163: WARNING: *** $ntp_warning ***" >&5 +echo "$as_me: WARNING: *** $ntp_warning ***" >&2;} ;; esac -echo $ac_n "checking if we have a losing syscall()""... $ac_c" 1>&6 -echo "configure:7159: checking if we have a losing syscall()" >&5 -if eval "test \"`echo '$''{'ac_cv_var_syscall_bug'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11168: checking if we have a losing syscall()" >&5 +echo $ECHO_N "checking if we have a losing syscall()... $ECHO_C" >&6 +if test "${ac_cv_var_syscall_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in *-*-solaris2.4*) @@ -7168,19 +11179,19 @@ else esac ac_cv_var_syscall_bug=$ans fi - -echo "$ac_t""$ac_cv_var_syscall_bug" 1>&6 +echo "$as_me:11182: result: $ac_cv_var_syscall_bug" >&5 +echo "${ECHO_T}$ac_cv_var_syscall_bug" >&6 case "$ac_cv_var_syscall_bug" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define SYSCALL_BUG 1 EOF ;; esac -echo $ac_n "checking for Streams/TLI""... $ac_c" 1>&6 -echo "configure:7182: checking for Streams/TLI" >&5 -if eval "test \"`echo '$''{'ac_cv_var_streams_tli'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11191: checking for Streams/TLI" >&5 +echo $ECHO_N "checking for Streams/TLI... $ECHO_C" >&6 +if test "${ac_cv_var_streams_tli+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$ac_cv_header_sys_stropts_h" in yes) @@ -7195,49 +11206,47 @@ else esac ac_cv_var_streams_tli=$ans fi - -echo "$ac_t""$ac_cv_var_streams_tli" 1>&6 +echo "$as_me:11209: result: $ac_cv_var_streams_tli" >&5 +echo "${ECHO_T}$ac_cv_var_streams_tli" >&6 case "$ac_cv_var_streams_tli" in yes) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define STREAMS_TLI 1 EOF ;; esac -echo $ac_n "checking for SIGIO""... $ac_c" 1>&6 -echo "configure:7211: checking for SIGIO" >&5 -if eval "test \"`echo '$''{'ac_cv_hdr_def_sigio'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11220: checking for SIGIO" >&5 +echo $ECHO_N "checking for SIGIO... $ECHO_C" >&6 +if test "${ac_cv_hdr_def_sigio+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7216 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11226 "configure" #include "confdefs.h" #include <signal.h> #ifdef SIGIO yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_hdr_def_sigio=yes else - rm -rf conftest* ac_cv_hdr_def_sigio=no fi rm -f conftest* fi +echo "$as_me:11243: result: $ac_cv_hdr_def_sigio" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigio" >&6 -echo "$ac_t""$ac_cv_hdr_def_sigio" 1>&6 - -echo $ac_n "checking if we want to use signalled IO""... $ac_c" 1>&6 -echo "configure:7239: checking if we want to use signalled IO" >&5 -if eval "test \"`echo '$''{'ac_cv_var_signalled_io'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11246: checking if we want to use signalled IO" >&5 +echo $ECHO_N "checking if we want to use signalled IO... $ECHO_C" >&6 +if test "${ac_cv_var_signalled_io+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigio" in @@ -7276,80 +11285,76 @@ case "$ac_cv_hdr_def_sigio" in esac ac_cv_var_signalled_io=$ans fi - -echo "$ac_t""$ac_cv_var_signalled_io" 1>&6 +echo "$as_me:11288: result: $ac_cv_var_signalled_io" >&5 +echo "${ECHO_T}$ac_cv_var_signalled_io" >&6 case "$ac_cv_var_signalled_io" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define HAVE_SIGNALED_IO 1 EOF ;; esac -echo $ac_n "checking for SIGPOLL""... $ac_c" 1>&6 -echo "configure:7290: checking for SIGPOLL" >&5 -if eval "test \"`echo '$''{'ac_cv_hdr_def_sigpoll'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11297: checking for SIGPOLL" >&5 +echo $ECHO_N "checking for SIGPOLL... $ECHO_C" >&6 +if test "${ac_cv_hdr_def_sigpoll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7295 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11303 "configure" #include "confdefs.h" #include <signal.h> #ifdef SIGPOLL yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_hdr_def_sigpoll=yes else - rm -rf conftest* ac_cv_hdr_def_sigpoll=no fi rm -f conftest* fi +echo "$as_me:11320: result: $ac_cv_hdr_def_sigpoll" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigpoll" >&6 -echo "$ac_t""$ac_cv_hdr_def_sigpoll" 1>&6 - -echo $ac_n "checking for SIGSYS""... $ac_c" 1>&6 -echo "configure:7318: checking for SIGSYS" >&5 -if eval "test \"`echo '$''{'ac_cv_hdr_def_sigsys'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11323: checking for SIGSYS" >&5 +echo $ECHO_N "checking for SIGSYS... $ECHO_C" >&6 +if test "${ac_cv_hdr_def_sigsys+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7323 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11329 "configure" #include "confdefs.h" #include <signal.h> #ifdef SIGSYS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_hdr_def_sigsys=yes else - rm -rf conftest* ac_cv_hdr_def_sigsys=no fi rm -f conftest* fi +echo "$as_me:11346: result: $ac_cv_hdr_def_sigsys" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_sigsys" >&6 -echo "$ac_t""$ac_cv_hdr_def_sigsys" 1>&6 - -echo $ac_n "checking if we can use SIGPOLL for UDP I/O""... $ac_c" 1>&6 -echo "configure:7346: checking if we can use SIGPOLL for UDP I/O" >&5 -if eval "test \"`echo '$''{'ac_cv_var_use_udp_sigpoll'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11349: checking if we can use SIGPOLL for UDP I/O" >&5 +echo $ECHO_N "checking if we can use SIGPOLL for UDP I/O... $ECHO_C" >&6 +if test "${ac_cv_var_use_udp_sigpoll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigpoll" in yes) - case "$target" in + case "$target" in mips-sgi-irix*) ans=no ;; @@ -7383,23 +11388,23 @@ case "$ac_cv_hdr_def_sigpoll" in *) ans=yes ;; esac - ;; + ;; esac ac_cv_var_use_udp_sigpoll=$ans fi - -echo "$ac_t""$ac_cv_var_use_udp_sigpoll" 1>&6 +echo "$as_me:11395: result: $ac_cv_var_use_udp_sigpoll" >&5 +echo "${ECHO_T}$ac_cv_var_use_udp_sigpoll" >&6 case "$ac_cv_var_use_udp_sigpoll" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define USE_UDP_SIGPOLL 1 EOF ;; esac -echo $ac_n "checking if we can use SIGPOLL for TTY I/O""... $ac_c" 1>&6 -echo "configure:7401: checking if we can use SIGPOLL for TTY I/O" >&5 -if eval "test \"`echo '$''{'ac_cv_var_use_tty_sigpoll'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11404: checking if we can use SIGPOLL for TTY I/O" >&5 +echo $ECHO_N "checking if we can use SIGPOLL for TTY I/O... $ECHO_C" >&6 +if test "${ac_cv_var_use_tty_sigpoll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$ac_cv_hdr_def_sigpoll" in @@ -7442,10 +11447,10 @@ case "$ac_cv_hdr_def_sigpoll" in esac ac_cv_var_use_tty_sigpoll=$ans fi - -echo "$ac_t""$ac_cv_var_use_tty_sigpoll" 1>&6 +echo "$as_me:11450: result: $ac_cv_var_use_tty_sigpoll" >&5 +echo "${ECHO_T}$ac_cv_var_use_tty_sigpoll" >&6 case "$ac_cv_var_use_tty_sigpoll" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define USE_TTY_SIGPOLL 1 EOF ;; @@ -7453,33 +11458,31 @@ esac case "$ac_cv_header_sys_sio_h" in yes) - echo $ac_n "checking sys/sio.h for TIOCDCDTIMESTAMP""... $ac_c" 1>&6 -echo "configure:7458: checking sys/sio.h for TIOCDCDTIMESTAMP" >&5 -if eval "test \"`echo '$''{'ac_cv_hdr_def_tiocdcdtimestamp'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:11461: checking sys/sio.h for TIOCDCDTIMESTAMP" >&5 +echo $ECHO_N "checking sys/sio.h for TIOCDCDTIMESTAMP... $ECHO_C" >&6 +if test "${ac_cv_hdr_def_tiocdcdtimestamp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7463 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11467 "configure" #include "confdefs.h" #include <sys/sio.h> #ifdef TIOCDCDTIMESTAMP yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_hdr_def_tiocdcdtimestamp=yes else - rm -rf conftest* ac_cv_hdr_def_tiocdcdtimestamp=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_hdr_def_tiocdcdtimestamp" 1>&6 +echo "$as_me:11484: result: $ac_cv_hdr_def_tiocdcdtimestamp" >&5 +echo "${ECHO_T}$ac_cv_hdr_def_tiocdcdtimestamp" >&6 ;; esac @@ -7489,10 +11492,10 @@ case "$ac_cv_hdr_def_tiocdcdtimestamp" in ;; esac -echo $ac_n "checking if nlist() values might require extra indirection""... $ac_c" 1>&6 -echo "configure:7494: checking if nlist() values might require extra indirection" >&5 -if eval "test \"`echo '$''{'ac_cv_var_nlist_extra_indirection'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11495: checking if nlist() values might require extra indirection" >&5 +echo $ECHO_N "checking if nlist() values might require extra indirection... $ECHO_C" >&6 +if test "${ac_cv_var_nlist_extra_indirection+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7502,19 +11505,19 @@ case "$target" in esac ac_cv_var_nlist_extra_indirection=$ans fi - -echo "$ac_t""$ac_cv_var_nlist_extra_indirection" 1>&6 +echo "$as_me:11508: result: $ac_cv_var_nlist_extra_indirection" >&5 +echo "${ECHO_T}$ac_cv_var_nlist_extra_indirection" >&6 case "$ac_cv_var_nlist_extra_indirection" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define NLIST_EXTRA_INDIRECTION 1 EOF ;; esac -echo $ac_n "checking for a minimum recommended value of tickadj""... $ac_c" 1>&6 -echo "configure:7516: checking for a minimum recommended value of tickadj" >&5 -if eval "test \"`echo '$''{'ac_cv_var_min_rec_tickadj'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11517: checking for a minimum recommended value of tickadj" >&5 +echo $ECHO_N "checking for a minimum recommended value of tickadj... $ECHO_C" >&6 +if test "${ac_cv_var_min_rec_tickadj+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7524,20 +11527,20 @@ case "$target" in esac ac_cv_var_min_rec_tickadj=$ans fi - -echo "$ac_t""$ac_cv_var_min_rec_tickadj" 1>&6 +echo "$as_me:11530: result: $ac_cv_var_min_rec_tickadj" >&5 +echo "${ECHO_T}$ac_cv_var_min_rec_tickadj" >&6 case "$ac_cv_var_min_rec_tickadj" in ''|no) ;; - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define MIN_REC_TICKADJ $ac_cv_var_min_rec_tickadj EOF ;; esac -echo $ac_n "checking if the TTY code permits PARENB and IGNPAR""... $ac_c" 1>&6 -echo "configure:7539: checking if the TTY code permits PARENB and IGNPAR" >&5 -if eval "test \"`echo '$''{'ac_cv_var_no_parenb_ignpar'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11540: checking if the TTY code permits PARENB and IGNPAR" >&5 +echo $ECHO_N "checking if the TTY code permits PARENB and IGNPAR... $ECHO_C" >&6 +if test "${ac_cv_var_no_parenb_ignpar+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7550,122 +11553,121 @@ case "$target" in esac ac_cv_var_no_parenb_ignpar=$ans fi - -echo "$ac_t""$ac_cv_var_no_parenb_ignpar" 1>&6 +echo "$as_me:11556: result: $ac_cv_var_no_parenb_ignpar" >&5 +echo "${ECHO_T}$ac_cv_var_no_parenb_ignpar" >&6 case "$ac_cv_var_no_parenb_ignpar" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define NO_PARENB_IGNPAR 1 EOF ;; esac -echo $ac_n "checking if we're including debugging code""... $ac_c" 1>&6 -echo "configure:7564: checking if we're including debugging code" >&5 +echo "$as_me:11565: checking if we're including debugging code" >&5 +echo $ECHO_N "checking if we're including debugging code... $ECHO_C" >&6 # Check whether --enable-debugging or --disable-debugging was given. if test "${enable_debugging+set}" = set; then enableval="$enable_debugging" ntp_ok=$enableval else ntp_ok=yes -fi - +fi; if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define DEBUG 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:11580: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for a the number of minutes in a DST adjustment""... $ac_c" 1>&6 -echo "configure:7582: checking for a the number of minutes in a DST adjustment" >&5 +echo "$as_me:11583: checking for a the number of minutes in a DST adjustment" >&5 +echo $ECHO_N "checking for a the number of minutes in a DST adjustment... $ECHO_C" >&6 # Check whether --enable-dst_minutes or --disable-dst_minutes was given. if test "${enable_dst_minutes+set}" = set; then enableval="$enable_dst_minutes" ans=$enableval else ans=60 -fi - -cat >> confdefs.h <<EOF +fi; +cat >>confdefs.h <<EOF #define DSTMINUTES $ans EOF -echo "$ac_t""$ans" 1>&6 +echo "$as_me:11596: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we have the tty_clk line discipline/streams module""... $ac_c" 1>&6 -echo "configure:7598: checking if we have the tty_clk line discipline/streams module" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tty_clk'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11599: checking if we have the tty_clk line discipline/streams module" >&5 +echo $ECHO_N "checking if we have the tty_clk line discipline/streams module... $ECHO_C" >&6 +if test "${ac_cv_var_tty_clk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$ac_cv_header_sys_clkdefs_h$ac_cv_hdr_def_tiocdcdtimestamp" in *yes*) ac_cv_var_tty_clk=yes ;; esac fi - -echo "$ac_t""$ac_cv_var_tty_clk" 1>&6 +echo "$as_me:11608: result: $ac_cv_var_tty_clk" >&5 +echo "${ECHO_T}$ac_cv_var_tty_clk" >&6 case "$ac_cv_var_tty_clk" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define TTYCLK 1 EOF ;; esac -echo $ac_n "checking for the ppsclock streams module""... $ac_c" 1>&6 -echo "configure:7616: checking for the ppsclock streams module" >&5 -if eval "test \"`echo '$''{'ac_cv_var_ppsclock'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11617: checking for the ppsclock streams module" >&5 +echo $ECHO_N "checking for the ppsclock streams module... $ECHO_C" >&6 +if test "${ac_cv_var_ppsclock+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev fi - -echo "$ac_t""$ac_cv_var_ppsclock" 1>&6 +echo "$as_me:11624: result: $ac_cv_var_ppsclock" >&5 +echo "${ECHO_T}$ac_cv_var_ppsclock" >&6 case "$ac_cv_var_ppsclock" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define PPS 1 EOF ;; esac -echo $ac_n "checking for kernel multicast support""... $ac_c" 1>&6 -echo "configure:7632: checking for kernel multicast support" >&5 -if eval "test \"`echo '$''{'ac_cv_var_mcast'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11633: checking for kernel multicast support" >&5 +echo $ECHO_N "checking for kernel multicast support... $ECHO_C" >&6 +if test "${ac_cv_var_mcast+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_mcast=no case "$target" in i386-sequent-sysv4) ;; - *) cat > conftest.$ac_ext <<EOF -#line 7640 "configure" + *) cat >conftest.$ac_ext <<_ACEOF +#line 11642 "configure" #include "confdefs.h" #include <netinet/in.h> #ifdef IP_ADD_MEMBERSHIP yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_var_mcast=yes fi rm -f conftest* ;; esac fi - -echo "$ac_t""$ac_cv_var_mcast" 1>&6 +echo "$as_me:11658: result: $ac_cv_var_mcast" >&5 +echo "${ECHO_T}$ac_cv_var_mcast" >&6 case "$ac_cv_var_mcast" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define MCAST 1 EOF ;; esac -echo $ac_n "checking availability of ntp_{adj,get}time()""... $ac_c" 1>&6 -echo "configure:7667: checking availability of ntp_{adj,get}time()" >&5 -if eval "test \"`echo '$''{'ac_cv_var_ntp_syscalls'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11667: checking availability of ntp_{adj,get}time()" >&5 +echo $ECHO_N "checking availability of ntp_{adj,get}time()... $ECHO_C" >&6 +if test "${ac_cv_var_ntp_syscalls+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_var_ntp_syscalls=no case "$ac_cv_func___adjtimex" in @@ -7676,18 +11678,17 @@ else yesyes) ac_cv_var_ntp_syscalls=libc ;; - *) cat > conftest.$ac_ext <<EOF -#line 7681 "configure" + *) cat >conftest.$ac_ext <<_ACEOF +#line 11682 "configure" #include "confdefs.h" #include <sys/syscall.h> #if defined(SYS_ntp_gettime) && defined(SYS_ntp_adjtime) yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_var_ntp_syscalls=kernel fi rm -f conftest* @@ -7697,17 +11698,17 @@ rm -f conftest* ;; esac fi - -echo "$ac_t""$ac_cv_var_ntp_syscalls" 1>&6 +echo "$as_me:11701: result: $ac_cv_var_ntp_syscalls" >&5 +echo "${ECHO_T}$ac_cv_var_ntp_syscalls" >&6 case "$ac_cv_var_ntp_syscalls" in libc) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NTP_SYSCALLS_LIBC 1 EOF ;; kernel) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NTP_SYSCALLS_STD 1 EOF @@ -7716,38 +11717,36 @@ EOF ;; esac -echo $ac_n "checking if sys/timex.h has STA_FLL""... $ac_c" 1>&6 -echo "configure:7721: checking if sys/timex.h has STA_FLL" >&5 -if eval "test \"`echo '$''{'ac_cv_var_sta_fll'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11720: checking if sys/timex.h has STA_FLL" >&5 +echo $ECHO_N "checking if sys/timex.h has STA_FLL... $ECHO_C" >&6 +if test "${ac_cv_var_sta_fll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7726 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11726 "configure" #include "confdefs.h" #include <sys/timex.h> #ifdef STA_FLL yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ac_cv_var_sta_fll=yes else - rm -rf conftest* ac_cv_var_sta_fll=no fi rm -f conftest* fi +echo "$as_me:11743: result: $ac_cv_var_sta_fll" >&5 +echo "${ECHO_T}$ac_cv_var_sta_fll" >&6 -echo "$ac_t""$ac_cv_var_sta_fll" 1>&6 - -echo $ac_n "checking if we have kernel PLL support""... $ac_c" 1>&6 -echo "configure:7749: checking if we have kernel PLL support" >&5 -if eval "test \"`echo '$''{'ac_cv_var_kernel_pll'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11746: checking if we have kernel PLL support" >&5 +echo $ECHO_N "checking if we have kernel PLL support... $ECHO_C" >&6 +if test "${ac_cv_var_kernel_pll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$ac_cv_header_sys_timex_h$ac_cv_struct_ntptimeval$ac_cv_var_sta_fll$ac_cv_var_ntp_syscalls" in *no*) @@ -7757,21 +11756,21 @@ else ;; esac fi - -echo "$ac_t""$ac_cv_var_kernel_pll" 1>&6 +echo "$as_me:11759: result: $ac_cv_var_kernel_pll" >&5 +echo "${ECHO_T}$ac_cv_var_kernel_pll" >&6 case "$ac_cv_var_kernel_pll" in yes) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define KERNEL_PLL 1 EOF ;; esac -echo $ac_n "checking if SIOCGIFCONF returns buffer size in the buffer""... $ac_c" 1>&6 -echo "configure:7773: checking if SIOCGIFCONF returns buffer size in the buffer" >&5 -if eval "test \"`echo '$''{'ac_cv_var_size_returned_in_buffer'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11770: checking if SIOCGIFCONF returns buffer size in the buffer" >&5 +echo $ECHO_N "checking if SIOCGIFCONF returns buffer size in the buffer... $ECHO_C" >&6 +if test "${ac_cv_var_size_returned_in_buffer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -7787,59 +11786,32 @@ else esac ac_cv_var_size_returned_in_buffer=$ans fi - -echo "$ac_t""$ac_cv_var_size_returned_in_buffer" 1>&6 +echo "$as_me:11789: result: $ac_cv_var_size_returned_in_buffer" >&5 +echo "${ECHO_T}$ac_cv_var_size_returned_in_buffer" >&6 case "$ac_cv_var_size_returned_in_buffer" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define SIZE_RETURNED_IN_BUFFER 1 EOF ;; esac - -echo $ac_n "checking if we want to use MD5 authentication""... $ac_c" 1>&6 -echo "configure:7802: checking if we want to use MD5 authentication" >&5 -if eval "test \"`echo '$''{'ac_cv_var_use_md5'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # Check whether --enable-md5 or --disable-md5 was given. -if test "${enable_md5+set}" = set; then - enableval="$enable_md5" - ans=$enableval -else - ans=yes -fi - -ac_cv_var_use_md5=$ans -fi - -echo "$ac_t""$ac_cv_var_use_md5" 1>&6 -case "$ac_cv_var_use_md5" in - yes) cat >> confdefs.h <<\EOF -#define MD5 1 -EOF - ;; -esac - # Check for ioctls TIOCGPPSEV -echo $ac_n "checking ioctl TIOCGPPSEV""... $ac_c" 1>&6 -echo "configure:7827: checking ioctl TIOCGPPSEV" >&5 +echo "$as_me:11799: checking ioctl TIOCGPPSEV" >&5 +echo $ECHO_N "checking ioctl TIOCGPPSEV... $ECHO_C" >&6 if test "$ac_cv_header_termios_h" = "yes"; then - cat > conftest.$ac_ext <<EOF -#line 7830 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11803 "configure" #include "confdefs.h" #include <termios.h> #ifdef TIOCGPPSEV yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -7848,33 +11820,32 @@ else ntp_ok=no fi if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_TIOCGPPSEV 1 EOF ac_cv_var_oncore_ok=yes fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:11829: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Check for ioctls TIOCSPPS -echo $ac_n "checking ioctl TIOCSPPS""... $ac_c" 1>&6 -echo "configure:7862: checking ioctl TIOCSPPS" >&5 +echo "$as_me:11833: checking ioctl TIOCSPPS" >&5 +echo $ECHO_N "checking ioctl TIOCSPPS... $ECHO_C" >&6 if test "$ac_cv_header_termios_h" = "yes"; then - cat > conftest.$ac_ext <<EOF -#line 7865 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11837 "configure" #include "confdefs.h" #include <termios.h> #ifdef TIOCSPPS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -7884,32 +11855,31 @@ else fi if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_TIOCSPPS 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:11863: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Check for ioctls CIOGETEV -echo $ac_n "checking ioctl CIOGETEV""... $ac_c" 1>&6 -echo "configure:7897: checking ioctl CIOGETEV" >&5 +echo "$as_me:11867: checking ioctl CIOGETEV" >&5 +echo $ECHO_N "checking ioctl CIOGETEV... $ECHO_C" >&6 if test "$ac_cv_header_sys_ppsclock_h" = "yes"; then - cat > conftest.$ac_ext <<EOF -#line 7900 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11871 "configure" #include "confdefs.h" #include <sys/ppsclock.h> #ifdef CIOGETEV yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=yes else - rm -rf conftest* ntp_ok=no fi rm -f conftest* @@ -7919,71 +11889,88 @@ ntp_ok=no fi if test "$ntp_ok" = "yes"; then ac_cv_var_oncore_ok=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_CIOGETEV 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:11897: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +# ATOM/PPSAPI stuff. + +# ATOM used to require struct timespec, but that's been fixed now. + +# case "$ac_cv_struct_timespec" in +# 'yes') +# ac_cv_var_atom_ok=yes +# ;; +# esac +ac_cv_var_atom_ok=yes # Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff. -# there is NO way that I can tell to tell if a given OS is using timespec or -# timeval so just set it here for the one case that is KNOWN to use timespec. -case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h" in - *yes*) - cat >> confdefs.h <<\EOF +# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline') + +# The PPSAPI needs ATOM + +# The PPSAPI needs struct timespec. + +case "$ac_cv_c_inline$ac_cv_struct_timespec$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h" in + inlineyes*yes*) + cat >>confdefs.h <<\EOF #define HAVE_PPSAPI 1 EOF ac_cv_var_oncore_ok=yes - cat >> confdefs.h <<\EOF -#define HAVE_TIMESPEC 1 -EOF - ;; esac # Check for ioctls TIOCGSERIAL, TIOCSSERIAL, ASYNC_PPS_CD_POS, ASYNC_PPS_CD_NEG -ac_safe=`echo "linux/serial.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/serial.h""... $ac_c" 1>&6 -echo "configure:7951: checking for linux/serial.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:11930: checking for linux/serial.h" >&5 +echo $ECHO_N "checking for linux/serial.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_serial_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 7956 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11936 "configure" #include "confdefs.h" #include <linux/serial.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +_ACEOF +if { (eval echo "$as_me:11940: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11946: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cpp_err=yes fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : +if test -z "$ac_cpp_err"; then + ac_cv_header_linux_serial_h=yes else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_linux_serial_h=no +fi +rm -f conftest.err conftest.$ac_ext fi +echo "$as_me:11965: result: $ac_cv_header_linux_serial_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_serial_h" >&6 -echo $ac_n "checking ioctl TIOCGSERIAL""... $ac_c" 1>&6 -echo "configure:7983: checking ioctl TIOCGSERIAL" >&5 +echo "$as_me:11968: checking ioctl TIOCGSERIAL" >&5 +echo $ECHO_N "checking ioctl TIOCGSERIAL... $ECHO_C" >&6 case "$ac_cv_header_sys_ppsclock_h$ac_cv_header_linux_serial_h" in yesyes) - cat > conftest.$ac_ext <<EOF -#line 7987 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 11973 "configure" #include "confdefs.h" #include <sys/time.h> typedef int u_int; @@ -8002,11 +11989,10 @@ typedef int u_int; #endif #endif #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=yes fi rm -f conftest* @@ -8017,84 +12003,125 @@ rm -f conftest* ;; esac if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define HAVE_TIO_SERIAL_STUFF 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12011: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Check for SHMEM_STATUS support -echo $ac_n "checking SHMEM_STATUS support""... $ac_c" 1>&6 -echo "configure:8030: checking SHMEM_STATUS support" >&5 +echo "$as_me:12015: checking SHMEM_STATUS support" >&5 +echo $ECHO_N "checking SHMEM_STATUS support... $ECHO_C" >&6 case "$ac_cv_header_sys_mman_h" in yes) ntp_ok=yes ;; *) ntp_ok=no ;; esac if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define ONCORE_SHMEM_STATUS 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 - +echo "$as_me:12027: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 ntp_refclock=no +echo "$as_me:12032: checking for hopf serial clock device" >&5 +echo $ECHO_N "checking for hopf serial clock device... $ECHO_C" >&6 +# Check whether --enable-HOPFSERIAL or --disable-HOPFSERIAL was given. +if test "${enable_HOPFSERIAL+set}" = set; then + enableval="$enable_HOPFSERIAL" + ntp_ok=$enableval +else + ntp_ok=$ntp_eac +fi; + if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + cat >>confdefs.h <<\EOF +#define CLOCK_HOPF_SERIAL 1 +EOF + + fi + echo "$as_me:12048: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + +echo "$as_me:12051: checking for hopf PCI clock 6039" >&5 +echo $ECHO_N "checking for hopf PCI clock 6039... $ECHO_C" >&6 +# Check whether --enable-HOPFPCI or --disable-HOPFPCI was given. +if test "${enable_HOPFPCI+set}" = set; then + enableval="$enable_HOPFPCI" + ntp_ok=$enableval +else + ntp_ok=$ntp_eac +fi; +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + cat >>confdefs.h <<\EOF +#define CLOCK_HOPF_PCI 1 +EOF + +fi +echo "$as_me:12067: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 + # HPUX only, and by explicit request -echo $ac_n "checking Datum/Bancomm bc635/VME interface""... $ac_c" 1>&6 -echo "configure:8048: checking Datum/Bancomm bc635/VME interface" >&5 +echo "$as_me:12071: checking Datum/Bancomm bc635/VME interface" >&5 +echo $ECHO_N "checking Datum/Bancomm bc635/VME interface... $ECHO_C" >&6 # Check whether --enable-BANCOMM or --disable-BANCOMM was given. if test "${enable_BANCOMM+set}" = set; then enableval="$enable_BANCOMM" ntp_ok=$enableval else ntp_ok=no -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_BANC 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12087: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$target" in yes*-*-hpux*) ;; - yes*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*) { echo "$as_me:12091: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac #HPUX only, and only by explicit request -echo $ac_n "checking TrueTime GPS receiver/VME interface""... $ac_c" 1>&6 -echo "configure:8072: checking TrueTime GPS receiver/VME interface" >&5 +echo "$as_me:12096: checking TrueTime GPS receiver/VME interface" >&5 +echo $ECHO_N "checking TrueTime GPS receiver/VME interface... $ECHO_C" >&6 # Check whether --enable-GPSVME or --disable-GPSVME was given. if test "${enable_GPSVME+set}" = set; then enableval="$enable_GPSVME" ntp_ok=$enableval else ntp_ok=no -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_GPSVME 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12112: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$target" in yes*-*-hpux*) ;; - yes*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*) { echo "$as_me:12116: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac -echo $ac_n "checking for PCL720 clock support""... $ac_c" 1>&6 -echo "configure:8095: checking for PCL720 clock support" >&5 +echo "$as_me:12120: checking for PCL720 clock support" >&5 +echo $ECHO_N "checking for PCL720 clock support... $ECHO_C" >&6 case "$ac_cv_header_machine_inline_h$ac_cv_header_sys_pcl720_h$ac_cv_header_sys_i8253_h" in yesyesyes) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PPS720 1 EOF @@ -8104,68 +12131,78 @@ EOF ans=no ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:12134: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking for SHM clock attached thru shared memory""... $ac_c" 1>&6 -echo "configure:8111: checking for SHM clock attached thru shared memory" >&5 +echo "$as_me:12137: checking for SHM clock attached thru shared memory" >&5 +echo $ECHO_N "checking for SHM clock attached thru shared memory... $ECHO_C" >&6 # Check whether --enable-SHM or --disable-SHM was given. if test "${enable_SHM+set}" = set; then enableval="$enable_SHM" ntp_ok=$enableval else ntp_ok=no -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_SHM 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12153: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for default inclusion of all suitable non-PARSE clocks""... $ac_c" 1>&6 -echo "configure:8130: checking for default inclusion of all suitable non-PARSE clocks" >&5 +echo "$as_me:12156: checking for default inclusion of all suitable non-PARSE clocks" >&5 +echo $ECHO_N "checking for default inclusion of all suitable non-PARSE clocks... $ECHO_C" >&6 # Check whether --enable-all-clocks or --disable-all-clocks was given. if test "${enable_all_clocks+set}" = set; then enableval="$enable_all_clocks" ntp_eac=$enableval else ntp_eac=yes -fi - -echo "$ac_t""$ntp_eac" 1>&6 - -echo $ac_n "checking if we have support for PARSE clocks""... $ac_c" 1>&6 -echo "configure:8142: checking if we have support for PARSE clocks" >&5 -case "$ac_cv_header_termio_h$ac_cv_header_termios_h" in - *yes*) +fi; +echo "$as_me:12165: result: $ntp_eac" >&5 +echo "${ECHO_T}$ntp_eac" >&6 + +echo "$as_me:12168: checking if we have support for PARSE clocks" >&5 +echo $ECHO_N "checking if we have support for PARSE clocks... $ECHO_C" >&6 +case "$ac_cv_var_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in + yes*yes*) ntp_canparse=yes ;; *) ntp_canparse=no ;; esac -echo "$ac_t""$ntp_canparse" 1>&6 +echo "$as_me:12177: result: $ntp_canparse" >&5 +echo "${ECHO_T}$ntp_canparse" >&6 -echo $ac_n "checking if we have support for audio clocks""... $ac_c" 1>&6 -echo "configure:8153: checking if we have support for audio clocks" >&5 +echo "$as_me:12180: checking if we have support for audio clocks" >&5 +echo $ECHO_N "checking if we have support for audio clocks... $ECHO_C" >&6 case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in - *yes*) ntp_canaudio=yes ;; - *) ntp_canaudio=no ;; + *yes*) + ntp_canaudio=yes + +cat >>confdefs.h <<\EOF +#define HAVE_AUDIO +EOF + + ;; + *) ntp_canaudio=no ;; esac -echo "$ac_t""$ntp_canaudio" 1>&6 +echo "$as_me:12193: result: $ntp_canaudio" >&5 +echo "${ECHO_T}$ntp_canaudio" >&6 # Requires modem control -echo $ac_n "checking ACTS modem service""... $ac_c" 1>&6 -echo "configure:8162: checking ACTS modem service" >&5 +echo "$as_me:12197: checking ACTS modem service" >&5 +echo $ECHO_N "checking ACTS modem service... $ECHO_C" >&6 # Check whether --enable-ACTS or --disable-ACTS was given. if test "${enable_ACTS+set}" = set; then enableval="$enable_ACTS" ntp_ok=$enableval else - cat > conftest.$ac_ext <<EOF -#line 8169 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 12205 "configure" #include "confdefs.h" #include <termios.h> #ifdef HAVE_SYS_IOCTL_H @@ -8174,127 +12211,128 @@ else #ifdef TIOCMBIS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=$ntp_eac else - rm -rf conftest* ntp_ok=no fi rm -f conftest* -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ACTS 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12232: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Arbiter 1088A/B GPS receiver""... $ac_c" 1>&6 -echo "configure:8202: checking Arbiter 1088A/B GPS receiver" >&5 +echo "$as_me:12235: checking Arbiter 1088A/B GPS receiver" >&5 +echo $ECHO_N "checking Arbiter 1088A/B GPS receiver... $ECHO_C" >&6 # Check whether --enable-ARBITER or --disable-ARBITER was given. if test "${enable_ARBITER+set}" = set; then enableval="$enable_ARBITER" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ARBITER 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12251: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Arcron MSF receiver""... $ac_c" 1>&6 -echo "configure:8221: checking Arcron MSF receiver" >&5 +echo "$as_me:12254: checking Arcron MSF receiver" >&5 +echo $ECHO_N "checking Arcron MSF receiver... $ECHO_C" >&6 # Check whether --enable-ARCRON_MSF or --disable-ARCRON_MSF was given. if test "${enable_ARCRON_MSF+set}" = set; then enableval="$enable_ARCRON_MSF" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ARCRON_MSF 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12270: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Austron 2200A/2201A GPS receiver""... $ac_c" 1>&6 -echo "configure:8240: checking Austron 2200A/2201A GPS receiver" >&5 -# Check whether --enable-AS2201 or --disable-AS2201 was given. -if test "${enable_AS2201+set}" = set; then - enableval="$enable_AS2201" +echo "$as_me:12273: checking ATOM PPS interface" >&5 +echo $ECHO_N "checking ATOM PPS interface... $ECHO_C" >&6 +# Check whether --enable-ATOM or --disable-ATOM was given. +if test "${enable_ATOM+set}" = set; then + enableval="$enable_ATOM" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; +case "$ac_cv_var_atom_ok" in + no) ntp_ok=no ;; +esac if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF -#define CLOCK_AS2201 1 + cat >>confdefs.h <<\EOF +#define CLOCK_ATOM 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12292: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking PPS interface""... $ac_c" 1>&6 -echo "configure:8259: checking PPS interface" >&5 -# Check whether --enable-ATOM or --disable-ATOM was given. -if test "${enable_ATOM+set}" = set; then - enableval="$enable_ATOM" +echo "$as_me:12295: checking Austron 2200A/2201A GPS receiver" >&5 +echo $ECHO_N "checking Austron 2200A/2201A GPS receiver... $ECHO_C" >&6 +# Check whether --enable-AS2201 or --disable-AS2201 was given. +if test "${enable_AS2201+set}" = set; then + enableval="$enable_AS2201" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF -#define CLOCK_ATOM 1 + cat >>confdefs.h <<\EOF +#define CLOCK_AS2201 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12311: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking CHU modem/decoder""... $ac_c" 1>&6 -echo "configure:8278: checking CHU modem/decoder" >&5 +echo "$as_me:12314: checking CHU modem/decoder" >&5 +echo $ECHO_N "checking CHU modem/decoder... $ECHO_C" >&6 # Check whether --enable-CHU or --disable-CHU was given. if test "${enable_CHU+set}" = set; then enableval="$enable_CHU" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_CHU 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12330: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 ac_refclock_chu=$ntp_ok -echo $ac_n "checking CHU audio/decoder""... $ac_c" 1>&6 -echo "configure:8298: checking CHU audio/decoder" >&5 +echo "$as_me:12334: checking CHU audio/decoder" >&5 +echo $ECHO_N "checking CHU audio/decoder... $ECHO_C" >&6 # Check whether --enable-AUDIO-CHU or --disable-AUDIO-CHU was given. if test "${enable_AUDIO_CHU+set}" = set; then enableval="$enable_AUDIO_CHU" @@ -8304,23 +12342,24 @@ else *no*) ntp_ok=no ;; *) ntp_ok=yes ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define AUDIO_CHU 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12352: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # We used to check for sunos/solaris target... case "$ntp_ok$ac_refclock_chu$ntp_canaudio" in - yes*no*) echo "configure: warning: *** But the expected answer is...no ***" 1>&2 ;; + yes*no*) { echo "$as_me:12356: WARNING: *** But the expected answer is...no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is...no ***" >&2;} ;; esac # Not under HP-UX -echo $ac_n "checking Datum Programmable Time System""... $ac_c" 1>&6 -echo "configure:8324: checking Datum Programmable Time System" >&5 +echo "$as_me:12361: checking Datum Programmable Time System" >&5 +echo $ECHO_N "checking Datum Programmable Time System... $ECHO_C" >&6 # Check whether --enable-DATUM or --disable-DATUM was given. if test "${enable_DATUM+set}" = set; then enableval="$enable_DATUM" @@ -8333,46 +12372,46 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_DATUM 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12383: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Forum Graphic GPS""... $ac_c" 1>&6 -echo "configure:8349: checking Forum Graphic GPS" >&5 +echo "$as_me:12386: checking Forum Graphic GPS" >&5 +echo $ECHO_N "checking Forum Graphic GPS... $ECHO_C" >&6 # Check whether --enable-FG or --disable-FG was given. if test "${enable_FG+set}" = set; then enableval="$enable_FG" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_FG 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12402: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Requires modem control -echo $ac_n "checking Heath GC-1000 WWV/WWVH receiver""... $ac_c" 1>&6 -echo "configure:8369: checking Heath GC-1000 WWV/WWVH receiver" >&5 +echo "$as_me:12406: checking Heath GC-1000 WWV/WWVH receiver" >&5 +echo $ECHO_N "checking Heath GC-1000 WWV/WWVH receiver... $ECHO_C" >&6 # Check whether --enable-HEATH or --disable-HEATH was given. if test "${enable_HEATH+set}" = set; then enableval="$enable_HEATH" ntp_ok=$enableval else - cat > conftest.$ac_ext <<EOF -#line 8376 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 12414 "configure" #include "confdefs.h" #include <termios.h> #ifdef HAVE_SYS_IOCTL_H @@ -8381,50 +12420,48 @@ else #ifdef TIOCMBIS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=$ntp_eac else - rm -rf conftest* ntp_ok=no fi rm -f conftest* -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_HEATH 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12441: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking HP 58503A GPS receiver""... $ac_c" 1>&6 -echo "configure:8409: checking HP 58503A GPS receiver" >&5 +echo "$as_me:12444: checking HP 58503A GPS receiver" >&5 +echo $ECHO_N "checking HP 58503A GPS receiver... $ECHO_C" >&6 # Check whether --enable-HPGPS or --disable-HPGPS was given. if test "${enable_HPGPS+set}" = set; then enableval="$enable_HPGPS" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_HPGPS 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12460: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Sun IRIG audio decoder""... $ac_c" 1>&6 -echo "configure:8428: checking Sun IRIG audio decoder" >&5 +echo "$as_me:12463: checking Sun IRIG audio decoder" >&5 +echo $ECHO_N "checking Sun IRIG audio decoder... $ECHO_C" >&6 # Check whether --enable-IRIG or --disable-IRIG was given. if test "${enable_IRIG+set}" = set; then enableval="$enable_IRIG" @@ -8434,80 +12471,81 @@ else *no*) ntp_ok=no ;; *) ntp_ok=yes ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_IRIG 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12482: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canaudio" in - yesno) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yesno) { echo "$as_me:12485: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac -echo $ac_n "checking Leitch CSD 5300 Master Clock System Driver""... $ac_c" 1>&6 -echo "configure:8453: checking Leitch CSD 5300 Master Clock System Driver" >&5 +echo "$as_me:12489: checking Leitch CSD 5300 Master Clock System Driver" >&5 +echo $ECHO_N "checking Leitch CSD 5300 Master Clock System Driver... $ECHO_C" >&6 # Check whether --enable-LEITCH or --disable-LEITCH was given. if test "${enable_LEITCH+set}" = set; then enableval="$enable_LEITCH" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_LEITCH 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12505: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking local clock reference""... $ac_c" 1>&6 -echo "configure:8472: checking local clock reference" >&5 +echo "$as_me:12508: checking local clock reference" >&5 +echo $ECHO_N "checking local clock reference... $ECHO_C" >&6 # Check whether --enable-LOCAL-CLOCK or --disable-LOCAL-CLOCK was given. if test "${enable_LOCAL_CLOCK+set}" = set; then enableval="$enable_LOCAL_CLOCK" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_LOCAL 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12524: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking EES M201 MSF receiver""... $ac_c" 1>&6 -echo "configure:8491: checking EES M201 MSF receiver" >&5 +echo "$as_me:12527: checking EES M201 MSF receiver" >&5 +echo $ECHO_N "checking EES M201 MSF receiver... $ECHO_C" >&6 # Check whether --enable-MSFEES or --disable-MSFEES was given. if test "${enable_MSFEES+set}" = set; then enableval="$enable_MSFEES" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_MSFEES 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12543: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Not Ultrix -echo $ac_n "checking Magnavox MX4200 GPS receiver""... $ac_c" 1>&6 -echo "configure:8511: checking Magnavox MX4200 GPS receiver" >&5 +echo "$as_me:12547: checking Magnavox MX4200 GPS receiver" >&5 +echo $ECHO_N "checking Magnavox MX4200 GPS receiver... $ECHO_C" >&6 # Check whether --enable-MX4200 or --disable-MX4200 was given. if test "${enable_MX4200+set}" = set; then enableval="$enable_MX4200" @@ -8519,63 +12557,64 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_MX4200 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12568: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$target" in - yes*-*-ultrix*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*-*-ultrix*) { echo "$as_me:12571: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac -echo $ac_n "checking NMEA GPS receiver""... $ac_c" 1>&6 -echo "configure:8538: checking NMEA GPS receiver" >&5 +echo "$as_me:12575: checking NMEA GPS receiver" >&5 +echo $ECHO_N "checking NMEA GPS receiver... $ECHO_C" >&6 # Check whether --enable-NMEA or --disable-NMEA was given. if test "${enable_NMEA+set}" = set; then enableval="$enable_NMEA" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_NMEA 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12591: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for ONCORE Motorola VP/UT Oncore GPS""... $ac_c" 1>&6 -echo "configure:8557: checking for ONCORE Motorola VP/UT Oncore GPS" >&5 +echo "$as_me:12594: checking for ONCORE Motorola VP/UT Oncore GPS" >&5 +echo $ECHO_N "checking for ONCORE Motorola VP/UT Oncore GPS... $ECHO_C" >&6 # Check whether --enable-ONCORE or --disable-ONCORE was given. if test "${enable_ONCORE+set}" = set; then enableval="$enable_ONCORE" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; case "$ac_cv_var_oncore_ok" in no) ntp_ok=no ;; esac if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ONCORE 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12613: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for Palisade clock""... $ac_c" 1>&6 -echo "configure:8579: checking for Palisade clock" >&5 +echo "$as_me:12616: checking for Palisade clock" >&5 +echo $ECHO_N "checking for Palisade clock... $ECHO_C" >&6 # Check whether --enable-PALISADE or --disable-PALISADE was given. if test "${enable_PALISADE+set}" = set; then enableval="$enable_PALISADE" @@ -8588,40 +12627,40 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PALISADE 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12639: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking PST/Traconex 1020 WWV/WWVH receiver""... $ac_c" 1>&6 -echo "configure:8605: checking PST/Traconex 1020 WWV/WWVH receiver" >&5 +echo "$as_me:12642: checking PST/Traconex 1020 WWV/WWVH receiver" >&5 +echo $ECHO_N "checking PST/Traconex 1020 WWV/WWVH receiver... $ECHO_C" >&6 # Check whether --enable-PST or --disable-PST was given. if test "${enable_PST+set}" = set; then enableval="$enable_PST" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PST 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12658: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Not Ultrix -echo $ac_n "checking Rockwell Jupiter GPS receiver""... $ac_c" 1>&6 -echo "configure:8625: checking Rockwell Jupiter GPS receiver" >&5 +echo "$as_me:12662: checking Rockwell Jupiter GPS receiver" >&5 +echo $ECHO_N "checking Rockwell Jupiter GPS receiver... $ECHO_C" >&6 # Check whether --enable-JUPITER or --disable-JUPITER was given. if test "${enable_JUPITER+set}" = set; then enableval="$enable_JUPITER" @@ -8633,30 +12672,31 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_JUPITER 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12683: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$target" in - yes*-*-ultrix*) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yes*-*-ultrix*) { echo "$as_me:12686: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac # Requires modem control -echo $ac_n "checking PTB modem service""... $ac_c" 1>&6 -echo "configure:8653: checking PTB modem service" >&5 +echo "$as_me:12691: checking PTB modem service" >&5 +echo $ECHO_N "checking PTB modem service... $ECHO_C" >&6 # Check whether --enable-PTBACTS or --disable-PTBACTS was given. if test "${enable_PTBACTS+set}" = set; then enableval="$enable_PTBACTS" ntp_ok=$enableval else - cat > conftest.$ac_ext <<EOF -#line 8660 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 12699 "configure" #include "confdefs.h" #include <termios.h> #ifdef HAVE_SYS_IOCTL_H @@ -8665,31 +12705,29 @@ else #ifdef TIOCMBIS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=$ntp_eac else - rm -rf conftest* ntp_ok=no fi rm -f conftest* -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PTBACTS 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12726: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking KSI/Odetics TPRO/S GPS receiver/IRIG interface""... $ac_c" 1>&6 -echo "configure:8693: checking KSI/Odetics TPRO/S GPS receiver/IRIG interface" >&5 +echo "$as_me:12729: checking KSI/Odetics TPRO/S GPS receiver/IRIG interface" >&5 +echo $ECHO_N "checking KSI/Odetics TPRO/S GPS receiver/IRIG interface... $ECHO_C" >&6 # Check whether --enable-TPRO or --disable-TPRO was given. if test "${enable_TPRO+set}" = set; then enableval="$enable_TPRO" @@ -8702,118 +12740,119 @@ else *) ntp_ok=no ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_TPRO 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12751: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ac_cv_header_sys_tpro" in - yesno) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yesno) { echo "$as_me:12754: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac -echo $ac_n "checking TRAK 8810 GPS receiver""... $ac_c" 1>&6 -echo "configure:8721: checking TRAK 8810 GPS receiver" >&5 +echo "$as_me:12758: checking TRAK 8810 GPS receiver" >&5 +echo $ECHO_N "checking TRAK 8810 GPS receiver... $ECHO_C" >&6 # Check whether --enable-TRAK or --disable-TRAK was given. if test "${enable_TRAK+set}" = set; then enableval="$enable_TRAK" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_TRAK 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12774: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Chrono-log K-series WWVB receiver""... $ac_c" 1>&6 -echo "configure:8740: checking Chrono-log K-series WWVB receiver" >&5 +echo "$as_me:12777: checking Chrono-log K-series WWVB receiver" >&5 +echo $ECHO_N "checking Chrono-log K-series WWVB receiver... $ECHO_C" >&6 # Check whether --enable-CHRONOLOG or --disable-CHRONOLOG was given. if test "${enable_CHRONOLOG+set}" = set; then enableval="$enable_CHRONOLOG" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_CHRONOLOG 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12793: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Dumb generic hh:mm:ss local clock""... $ac_c" 1>&6 -echo "configure:8759: checking Dumb generic hh:mm:ss local clock" >&5 +echo "$as_me:12796: checking Dumb generic hh:mm:ss local clock" >&5 +echo $ECHO_N "checking Dumb generic hh:mm:ss local clock... $ECHO_C" >&6 # Check whether --enable-DUMBCLOCK or --disable-DUMBCLOCK was given. if test "${enable_DUMBCLOCK+set}" = set; then enableval="$enable_DUMBCLOCK" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_DUMBCLOCK 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12812: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Conrad parallel port radio clock""... $ac_c" 1>&6 -echo "configure:8778: checking Conrad parallel port radio clock" >&5 +echo "$as_me:12815: checking Conrad parallel port radio clock" >&5 +echo $ECHO_N "checking Conrad parallel port radio clock... $ECHO_C" >&6 # Check whether --enable-PCF or --disable-PCF was given. if test "${enable_PCF+set}" = set; then enableval="$enable_PCF" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PCF 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12831: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking Spectracom 8170/Netclock/2 WWVB receiver""... $ac_c" 1>&6 -echo "configure:8797: checking Spectracom 8170/Netclock/2 WWVB receiver" >&5 +echo "$as_me:12834: checking Spectracom 8170/Netclock/2 WWVB receiver" >&5 +echo $ECHO_N "checking Spectracom 8170/Netclock/2 WWVB receiver... $ECHO_C" >&6 # Check whether --enable-SPECTRACOM or --disable-SPECTRACOM was given. if test "${enable_SPECTRACOM+set}" = set; then enableval="$enable_SPECTRACOM" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_SPECTRACOM 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12850: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 # Not on a vax-dec-bsd -echo $ac_n "checking Kinemetrics/TrueTime receivers""... $ac_c" 1>&6 -echo "configure:8817: checking Kinemetrics/TrueTime receivers" >&5 +echo "$as_me:12854: checking Kinemetrics/TrueTime receivers" >&5 +echo $ECHO_N "checking Kinemetrics/TrueTime receivers... $ECHO_C" >&6 # Check whether --enable-TRUETIME or --disable-TRUETIME was given. if test "${enable_TRUETIME+set}" = set; then enableval="$enable_TRUETIME" @@ -8827,41 +12866,42 @@ else ntp_ok=$ntp_eac ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_TRUETIME 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12877: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$target" in - yesvax-dec-bsd) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yesvax-dec-bsd) { echo "$as_me:12880: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac -echo $ac_n "checking Ultralink M320 WWVB receiver""... $ac_c" 1>&6 -echo "configure:8846: checking Ultralink M320 WWVB receiver" >&5 +echo "$as_me:12884: checking Ultralink M320 WWVB receiver" >&5 +echo $ECHO_N "checking Ultralink M320 WWVB receiver... $ECHO_C" >&6 # Check whether --enable-ULINK or --disable-ULINK was given. if test "${enable_ULINK+set}" = set; then enableval="$enable_ULINK" ntp_ok=$enableval else ntp_ok=$ntp_eac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ULINK 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12900: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking WWV receiver""... $ac_c" 1>&6 -echo "configure:8865: checking WWV receiver" >&5 +echo "$as_me:12903: checking WWV receiver" >&5 +echo $ECHO_N "checking WWV receiver... $ECHO_C" >&6 # Check whether --enable-WWV or --disable-WWV was given. if test "${enable_WWV+set}" = set; then enableval="$enable_WWV" @@ -8871,30 +12911,31 @@ else *no*) ntp_ok=no ;; *) ntp_ok=yes ;; esac -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_WWV 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12922: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canaudio" in - yesno) echo "configure: warning: *** But the expected answer is... no ***" 1>&2 ;; + yesno) { echo "$as_me:12925: WARNING: *** But the expected answer is... no ***" >&5 +echo "$as_me: WARNING: *** But the expected answer is... no ***" >&2;} ;; esac # Requires modem control -echo $ac_n "checking USNO modem service""... $ac_c" 1>&6 -echo "configure:8891: checking USNO modem service" >&5 +echo "$as_me:12930: checking USNO modem service" >&5 +echo $ECHO_N "checking USNO modem service... $ECHO_C" >&6 # Check whether --enable-USNO or --disable-USNO was given. if test "${enable_USNO+set}" = set; then enableval="$enable_USNO" ntp_ok=$enableval else - cat > conftest.$ac_ext <<EOF -#line 8898 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 12938 "configure" #include "confdefs.h" #include <termios.h> #ifdef HAVE_SYS_IOCTL_H @@ -8903,31 +12944,29 @@ else #ifdef TIOCMBIS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* ntp_ok=$ntp_eac else - rm -rf conftest* ntp_ok=no fi rm -f conftest* -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_USNO 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:12965: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 -echo $ac_n "checking for default inclusion of all suitable PARSE clocks""... $ac_c" 1>&6 -echo "configure:8931: checking for default inclusion of all suitable PARSE clocks" >&5 +echo "$as_me:12968: checking for default inclusion of all suitable PARSE clocks" >&5 +echo $ECHO_N "checking for default inclusion of all suitable PARSE clocks... $ECHO_C" >&6 # Check whether --enable-parse-clocks or --disable-parse-clocks was given. if test "${enable_parse_clocks+set}" = set; then enableval="$enable_parse_clocks" @@ -8938,16 +12977,20 @@ else *) ntp_eapc=no ;; esac ntp_eapc=no -fi - -echo "$ac_t""$ntp_eapc" 1>&6 +fi; +echo "$as_me:12981: result: $ntp_eapc" >&5 +echo "${ECHO_T}$ntp_eapc" >&6 case "$ntp_eac$ntp_eapc$ntp_canparse" in noyes*) - { echo "configure: error: "--enable-parse-clocks" requires "--enable-all-clocks"." 1>&2; exit 1; } + { { echo "$as_me:12986: error: \"--enable-parse-clocks\" requires \"--enable-all-clocks\"." >&5 +echo "$as_me: error: \"--enable-parse-clocks\" requires \"--enable-all-clocks\"." >&2;} + { (exit 1); exit 1; }; } ;; yesyesno) - { echo "configure: error: You said "--enable-parse-clocks" but PARSE isn't supported on this platform!" 1>&2; exit 1; } + { { echo "$as_me:12991: error: You said \"--enable-parse-clocks\" but PARSE isn't supported on this platform!" >&5 +echo "$as_me: error: You said \"--enable-parse-clocks\" but PARSE isn't supported on this platform!" >&2;} + { (exit 1); exit 1; }; } ;; *) ;; esac @@ -8956,139 +12999,149 @@ ntp_libparse=no ntp_parseutil=no ntp_rawdcf=no -echo $ac_n "checking Diem Computime Radio Clock""... $ac_c" 1>&6 -echo "configure:8961: checking Diem Computime Radio Clock" >&5 +echo "$as_me:13002: checking Diem Computime Radio Clock" >&5 +echo $ECHO_N "checking Diem Computime Radio Clock... $ECHO_C" >&6 # Check whether --enable-COMPUTIME or --disable-COMPUTIME was given. if test "${enable_COMPUTIME+set}" = set; then enableval="$enable_COMPUTIME" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_COMPUTIME 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13019: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13023: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking ELV/DCF7000 clock""... $ac_c" 1>&6 -echo "configure:8986: checking ELV/DCF7000 clock" >&5 +echo "$as_me:13029: checking ELV/DCF7000 clock" >&5 +echo $ECHO_N "checking ELV/DCF7000 clock... $ECHO_C" >&6 # Check whether --enable-DCF7000 or --disable-DCF7000 was given. if test "${enable_DCF7000+set}" = set; then enableval="$enable_DCF7000" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_DCF7000 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13046: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13050: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking HOPF 6021 clock""... $ac_c" 1>&6 -echo "configure:9011: checking HOPF 6021 clock" >&5 +echo "$as_me:13056: checking HOPF 6021 clock" >&5 +echo $ECHO_N "checking HOPF 6021 clock... $ECHO_C" >&6 # Check whether --enable-HOPF6021 or --disable-HOPF6021 was given. if test "${enable_HOPF6021+set}" = set; then enableval="$enable_HOPF6021" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_HOPF6021 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13073: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13077: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking Meinberg clocks""... $ac_c" 1>&6 -echo "configure:9036: checking Meinberg clocks" >&5 +echo "$as_me:13083: checking Meinberg clocks" >&5 +echo $ECHO_N "checking Meinberg clocks... $ECHO_C" >&6 # Check whether --enable-MEINBERG or --disable-MEINBERG was given. if test "${enable_MEINBERG+set}" = set; then enableval="$enable_MEINBERG" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_MEINBERG 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13100: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13104: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking DCF77 raw time code""... $ac_c" 1>&6 -echo "configure:9061: checking DCF77 raw time code" >&5 +echo "$as_me:13110: checking DCF77 raw time code" >&5 +echo $ECHO_N "checking DCF77 raw time code... $ECHO_C" >&6 # Check whether --enable-RAWDCF or --disable-RAWDCF was given. if test "${enable_RAWDCF+set}" = set; then enableval="$enable_RAWDCF" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_parseutil=yes ntp_refclock=yes ntp_rawdcf=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_RAWDCF 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13129: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13133: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac case "$ntp_rawdcf" in yes) - echo $ac_n "checking if we must enable parity for RAWDCF""... $ac_c" 1>&6 -echo "configure:9090: checking if we must enable parity for RAWDCF" >&5 -if eval "test \"`echo '$''{'ac_cv_var_rawdcf_parity'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:13141: checking if we must enable parity for RAWDCF" >&5 +echo $ECHO_N "checking if we must enable parity for RAWDCF... $ECHO_C" >&6 +if test "${ac_cv_var_rawdcf_parity+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=no case "$target" in @@ -9098,10 +13151,10 @@ else esac ac_cv_var_rawdcf_parity=$ans fi - -echo "$ac_t""$ac_cv_var_rawdcf_parity" 1>&6 +echo "$as_me:13154: result: $ac_cv_var_rawdcf_parity" >&5 +echo "${ECHO_T}$ac_cv_var_rawdcf_parity" >&6 case "$ac_cv_var_rawdcf_parity" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define RAWDCF_NO_IGNPAR 1 EOF ;; @@ -9113,207 +13166,392 @@ EOF ;; esac -echo $ac_n "checking RCC 8000 clock""... $ac_c" 1>&6 -echo "configure:9118: checking RCC 8000 clock" >&5 +echo "$as_me:13169: checking RCC 8000 clock" >&5 +echo $ECHO_N "checking RCC 8000 clock... $ECHO_C" >&6 # Check whether --enable-RCC8000 or --disable-RCC8000 was given. if test "${enable_RCC8000+set}" = set; then enableval="$enable_RCC8000" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_RCC8000 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13186: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13190: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking Schmid DCF77 clock""... $ac_c" 1>&6 -echo "configure:9143: checking Schmid DCF77 clock" >&5 +echo "$as_me:13196: checking Schmid DCF77 clock" >&5 +echo $ECHO_N "checking Schmid DCF77 clock... $ECHO_C" >&6 # Check whether --enable-SCHMID or --disable-SCHMID was given. if test "${enable_SCHMID+set}" = set; then enableval="$enable_SCHMID" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_SCHMID 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13213: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13217: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking Trimble GPS receiver/TAIP protocol""... $ac_c" 1>&6 -echo "configure:9168: checking Trimble GPS receiver/TAIP protocol" >&5 +echo "$as_me:13223: checking Trimble GPS receiver/TAIP protocol" >&5 +echo $ECHO_N "checking Trimble GPS receiver/TAIP protocol... $ECHO_C" >&6 # Check whether --enable-TRIMTAIP or --disable-TRIMTAIP was given. if test "${enable_TRIMTAIP+set}" = set; then enableval="$enable_TRIMTAIP" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_TRIMTAIP 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13240: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13244: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking Trimble GPS receiver/TSIP protocol""... $ac_c" 1>&6 -echo "configure:9193: checking Trimble GPS receiver/TSIP protocol" >&5 +echo "$as_me:13250: checking Trimble GPS receiver/TSIP protocol" >&5 +echo $ECHO_N "checking Trimble GPS receiver/TSIP protocol... $ECHO_C" >&6 # Check whether --enable-TRIMTSIP or --disable-TRIMTSIP was given. if test "${enable_TRIMTSIP+set}" = set; then enableval="$enable_TRIMTSIP" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_TRIMTSIP 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13267: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13271: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking WHARTON 400A Series clock""... $ac_c" 1>&6 -echo "configure:9218: checking WHARTON 400A Series clock" >&5 +echo "$as_me:13277: checking WHARTON 400A Series clock" >&5 +echo $ECHO_N "checking WHARTON 400A Series clock... $ECHO_C" >&6 # Check whether --enable-WHARTON or --disable-WHARTON was given. if test "${enable_WHARTON+set}" = set; then enableval="$enable_WHARTON" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_WHARTON_400A 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13294: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13298: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac -echo $ac_n "checking VARITEXT clock""... $ac_c" 1>&6 -echo "configure:9243: checking VARITEXT clock" >&5 +echo "$as_me:13304: checking VARITEXT clock" >&5 +echo $ECHO_N "checking VARITEXT clock... $ECHO_C" >&6 # Check whether --enable-VARITEXT or --disable-VARITEXT was given. if test "${enable_VARITEXT+set}" = set; then enableval="$enable_VARITEXT" ntp_ok=$enableval else ntp_ok=$ntp_eapc -fi - +fi; if test "$ntp_ok" = "yes"; then ntp_libparse=yes ntp_refclock=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_VARITEXT 1 EOF fi -echo "$ac_t""$ntp_ok" 1>&6 +echo "$as_me:13321: result: $ntp_ok" >&5 +echo "${ECHO_T}$ntp_ok" >&6 case "$ntp_ok$ntp_canparse" in yesno) - { echo "configure: error: That's a parse clock and this system doesn't support it!" 1>&2; exit 1; } + { { echo "$as_me:13325: error: That's a parse clock and this system doesn't support it!" >&5 +echo "$as_me: error: That's a parse clock and this system doesn't support it!" >&2;} + { (exit 1); exit 1; }; } ;; esac - - - -echo $ac_n "checking if we need to make and use the parse libraries""... $ac_c" 1>&6 -echo "configure:9271: checking if we need to make and use the parse libraries" >&5 +echo "$as_me:13331: checking if we need to make and use the parse libraries" >&5 +echo $ECHO_N "checking if we need to make and use the parse libraries... $ECHO_C" >&6 ans=no case "$ntp_libparse" in yes) ans=yes - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_PARSE 1 EOF LIBPARSE=../libparse/libparse.a MAKE_LIBPARSE=libparse.a MAKE_CHECK_Y2K=check_y2k - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define PPS_SAMPLE 1 EOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define CLOCK_ATOM 1 EOF ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:13354: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + +echo "$as_me:13357: checking for openssl library directory" >&5 +echo $ECHO_N "checking for openssl library directory... $ECHO_C" >&6 + +# Check whether --with-openssl-libdir or --without-openssl-libdir was given. +if test "${with_openssl_libdir+set}" = set; then + withval="$with_openssl_libdir" + ans=$withval +else + ans=yes +fi; +case "$ans" in + no) ;; + yes) # Look in: + ans="/usr/lib /usr/local/lib /usr/local/ssl/lib" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) ;; + *) # Look for libcrypto.a and libssl.a: + for i in $ans no + do + test -f $i/libcrypto.a -a -f $i/libssl.a && break + done + case "$i" in + no) + ans=no + OPENSSL_LIB= + ;; + *) ans=$i + OPENSSL_LIB=$ans + ;; + esac + ;; +esac +echo "$as_me:13393: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 +echo "$as_me:13396: checking for openssl include directory" >&5 +echo $ECHO_N "checking for openssl include directory... $ECHO_C" >&6 +# Check whether --with-openssl-incdir or --without-openssl-incdir was given. +if test "${with_openssl_incdir+set}" = set; then + withval="$with_openssl_incdir" + ans=$withval +else + ans=yes +fi; +case "$ans" in + no) ;; + yes) # look in: + ans="/usr/include /usr/local/include /usr/local/ssl/include" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) ;; + *) # look for openssl/opensslconf.h: + for i in $ans no + do + test -f $i/openssl/opensslconf.h && break + done + case "$i" in + no) + ans=no + OPENSSL_INC= + ;; + *) ans=$i + OPENSSL_INC=$ans + ;; + esac + ;; +esac +echo "$as_me:13432: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 +echo "$as_me:13435: checking for the level of crypto support" >&5 +echo $ECHO_N "checking for the level of crypto support... $ECHO_C" >&6 -echo $ac_n "checking if we need to make and use the RSAREF library""... $ac_c" 1>&6 -echo "configure:9299: checking if we need to make and use the RSAREF library" >&5 -ans=no -if test -f $srcdir/rsaref2/source/rsa.c -then - ans=yes - LIBRSAREF=../librsaref/librsaref.a - MAKE_LIBRSAREF=librsaref.a - cat >> confdefs.h <<\EOF +# Check whether --with-crypto or --without-crypto was given. +if test "${with_crypto+set}" = set; then + withval="$with_crypto" + ans=$withval +else + ans=yes +fi; +case "$ans" in + no) ;; + yes|rsaref|openssl) + case "$ans" in + yes|rsaref) # Just "rsaref" when OpenSSL is ready + ans=no + ;; + *) + if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC" + then + ans=no + else + # We have OpenSSL inc/lib - use them. + ans=openssl + CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC" + LDFLAGS="$LDFLAGS -L$OPENSSL_LIB" + LIBS="$LIBS -lcrypto" + cat >>confdefs.h <<\EOF #define DES 1 EOF -fi -echo "$ac_t""$ans" 1>&6 +cat >>confdefs.h <<\EOF +#define OPENSSL +EOF + +cat >>confdefs.h <<\EOF +#define PUBKEY +EOF + + fi + ;; + esac + + case "$ans" in + no) + if test -f $srcdir/rsaref2/source/digit.c + then + ans=rsaref + RSAOBJS=digit.o + RSASRCS="digit.c digit.h" + RSADIR=rsaref2 + fi + if test -f $srcdir/rsaeuro1/source/rsaeuro.h + then + ans=rsaref + RSAOBJS="md4c.o shsc.o" + RSASRCS="md4c.c shsc.c" + RSADIR=rsaeuro1 + fi + if test "$ans" = "rsaref"; then + LIBRSAREF=../librsaref/librsaref.a + MAKE_LIBRSAREF=librsaref.a + cat >>confdefs.h <<\EOF +#define DES 1 +EOF + + cat >>confdefs.h <<\EOF +#define PUBKEY 1 +EOF +cat >>confdefs.h <<\EOF +#define RSAREF +EOF + + fi + ;; + esac + ;; +esac + +case "$ans" in + no) ;; + *) + +cat >>confdefs.h <<\EOF +#define AUTOKEY +EOF + + AUTOKEY=1 + ;; +esac +echo "$as_me:13526: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 + +echo "$as_me:13529: checking if we want to compile with ElectricFence" >&5 +echo $ECHO_N "checking if we want to compile with ElectricFence... $ECHO_C" >&6 + +# Check whether --with-electricfence or --without-electricfence was given. +if test "${with_electricfence+set}" = set; then + withval="$with_electricfence" + ans=$withval +else + ans=no +fi; +case "$ans" in + no) ;; + *) + LIBS="$LIBS \${top_builddir}/ElectricFence/libefence.a" + EF_PROGS="eftest tstheap" + EF_LIBS=libefence.a + ans=yes + ;; +esac +echo "$as_me:13550: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we can make dcf parse utilities""... $ac_c" 1>&6 -echo "configure:9317: checking if we can make dcf parse utilities" >&5 +echo "$as_me:13553: checking if we can make dcf parse utilities" >&5 +echo $ECHO_N "checking if we can make dcf parse utilities... $ECHO_C" >&6 ans=no if test "$ntp_parseutil" = "yes"; then case "$target" in @@ -9324,11 +13562,11 @@ if test "$ntp_parseutil" = "yes"; then ;; esac fi -echo "$ac_t""$ans" 1>&6 +echo "$as_me:13565: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 - -echo $ac_n "checking if we can build kernel streams modules for parse""... $ac_c" 1>&6 -echo "configure:9332: checking if we can build kernel streams modules for parse" >&5 +echo "$as_me:13568: checking if we can build kernel streams modules for parse" >&5 +echo $ECHO_N "checking if we can build kernel streams modules for parse... $ECHO_C" >&6 ans=no case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in yesyes) @@ -9336,7 +13574,7 @@ case "$ntp_parseutil$ac_cv_header_sys_stropts_h" in sparc-*-sunos4*) case "$ac_cv_var_kernel_pll" in yes) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define PPS_SYNC 1 EOF @@ -9352,22 +13590,22 @@ EOF esac ;; esac -echo "$ac_t""$ans" 1>&6 +echo "$as_me:13593: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we need basic refclock support""... $ac_c" 1>&6 -echo "configure:9359: checking if we need basic refclock support" >&5 +echo "$as_me:13596: checking if we need basic refclock support" >&5 +echo $ECHO_N "checking if we need basic refclock support... $ECHO_C" >&6 if test "$ntp_refclock" = "yes"; then - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define REFCLOCK 1 EOF fi -echo "$ac_t""$ntp_refclock" 1>&6 - - +echo "$as_me:13604: result: $ntp_refclock" >&5 +echo "${ECHO_T}$ntp_refclock" >&6 -echo $ac_n "checking if we want HP-UX adjtimed support""... $ac_c" 1>&6 -echo "configure:9371: checking if we want HP-UX adjtimed support" >&5 +echo "$as_me:13607: checking if we want HP-UX adjtimed support" >&5 +echo $ECHO_N "checking if we want HP-UX adjtimed support... $ECHO_C" >&6 case "$target" in *-*-hpux[56789]*) ans=yes @@ -9377,24 +13615,25 @@ case "$target" in esac if test "$ans" = "yes"; then MAKE_ADJTIMED=adjtimed - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define NEED_HPUX_ADJTIME 1 EOF fi -echo "$ac_t""$ans" 1>&6 +echo "$as_me:13623: result: $ans" >&5 +echo "${ECHO_T}$ans" >&6 -echo $ac_n "checking if we can read kmem""... $ac_c" 1>&6 -echo "configure:9389: checking if we can read kmem" >&5 -if eval "test \"`echo '$''{'ac_cv_var_can_kmem'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13626: checking if we can read kmem" >&5 +echo $ECHO_N "checking if we can read kmem... $ECHO_C" >&6 +if test "${ac_cv_var_can_kmem+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-kmem or --disable-kmem was given. if test "${enable_kmem+set}" = set; then enableval="$enable_kmem" ans=$enableval else - case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in + case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in *yes*) ans=yes ;; @@ -9421,33 +13660,32 @@ else ans=no ;; esac - -fi +fi; ac_cv_var_can_kmem=$ans fi - -echo "$ac_t""$ac_cv_var_can_kmem" 1>&6 +echo "$as_me:13667: result: $ac_cv_var_can_kmem" >&5 +echo "${ECHO_T}$ac_cv_var_can_kmem" >&6 case "$ac_cv_var_can_kmem" in *yes*) ;; - *) cat >> confdefs.h <<\EOF + *) cat >>confdefs.h <<\EOF #define NOKMEM 1 EOF ;; esac -echo $ac_n "checking if adjtime is accurate""... $ac_c" 1>&6 -echo "configure:9442: checking if adjtime is accurate" >&5 -if eval "test \"`echo '$''{'ac_cv_var_adjtime_is_accurate'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13678: checking if adjtime is accurate" >&5 +echo $ECHO_N "checking if adjtime is accurate... $ECHO_C" >&6 +if test "${ac_cv_var_adjtime_is_accurate+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-accurate-adjtime or --disable-accurate-adjtime was given. if test "${enable_accurate_adjtime+set}" = set; then enableval="$enable_accurate_adjtime" ans=$enableval else - case "$target" in + case "$target" in i386-sequent-ptx*) ans=no ;; @@ -9475,24 +13713,23 @@ else *) ans=no ;; esac - -fi +fi; ac_cv_var_adjtime_is_accurate=$ans fi - -echo "$ac_t""$ac_cv_var_adjtime_is_accurate" 1>&6 +echo "$as_me:13720: result: $ac_cv_var_adjtime_is_accurate" >&5 +echo "${ECHO_T}$ac_cv_var_adjtime_is_accurate" >&6 case "$ac_cv_var_adjtime_is_accurate" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define ADJTIME_IS_ACCURATE 1 EOF ;; esac -echo $ac_n "checking the name of 'tick' in the kernel""... $ac_c" 1>&6 -echo "configure:9494: checking the name of 'tick' in the kernel" >&5 -if eval "test \"`echo '$''{'ac_cv_var_nlist_tick'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13729: checking the name of 'tick' in the kernel" >&5 +echo $ECHO_N "checking the name of 'tick' in the kernel... $ECHO_C" >&6 +if test "${ac_cv_var_nlist_tick+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=_tick case "$target" in @@ -9523,20 +13760,20 @@ case "$target" in esac ac_cv_var_nlist_tick=$ans fi - -echo "$ac_t""$ac_cv_var_nlist_tick" 1>&6 +echo "$as_me:13763: result: $ac_cv_var_nlist_tick" >&5 +echo "${ECHO_T}$ac_cv_var_nlist_tick" >&6 case "$ac_cv_var_nlist_tick" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define K_TICK_NAME "$ac_cv_var_nlist_tick" EOF ;; esac # -echo $ac_n "checking for the units of 'tick'""... $ac_c" 1>&6 -echo "configure:9538: checking for the units of 'tick'" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tick_nano'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13773: checking for the units of 'tick'" >&5 +echo $ECHO_N "checking for the units of 'tick'... $ECHO_C" >&6 +if test "${ac_cv_var_tick_nano+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=usec case "$target" in @@ -9546,21 +13783,21 @@ case "$target" in esac ac_cv_var_tick_nano=$ans fi - -echo "$ac_t""$ac_cv_var_tick_nano" 1>&6 +echo "$as_me:13786: result: $ac_cv_var_tick_nano" >&5 +echo "${ECHO_T}$ac_cv_var_tick_nano" >&6 case "$ac_cv_var_tick_nano" in nsec) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define TICK_NANO 1 EOF ;; esac # -echo $ac_n "checking the name of 'tickadj' in the kernel""... $ac_c" 1>&6 -echo "configure:9562: checking the name of 'tickadj' in the kernel" >&5 -if eval "test \"`echo '$''{'ac_cv_var_nlist_tickadj'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13797: checking the name of 'tickadj' in the kernel" >&5 +echo $ECHO_N "checking the name of 'tickadj' in the kernel... $ECHO_C" >&6 +if test "${ac_cv_var_nlist_tickadj+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=_tickadj case "$target" in @@ -9600,20 +13837,20 @@ case "$target" in esac ac_cv_var_nlist_tickadj=$ans fi - -echo "$ac_t""$ac_cv_var_nlist_tickadj" 1>&6 +echo "$as_me:13840: result: $ac_cv_var_nlist_tickadj" >&5 +echo "${ECHO_T}$ac_cv_var_nlist_tickadj" >&6 case "$ac_cv_var_nlist_tickadj" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define K_TICKADJ_NAME "$ac_cv_var_nlist_tickadj" EOF ;; esac # -echo $ac_n "checking for the units of 'tickadj'""... $ac_c" 1>&6 -echo "configure:9615: checking for the units of 'tickadj'" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tickadj_nano'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13850: checking for the units of 'tickadj'" >&5 +echo $ECHO_N "checking for the units of 'tickadj'... $ECHO_C" >&6 +if test "${ac_cv_var_tickadj_nano+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ans=usec case "$target" in @@ -9623,21 +13860,21 @@ case "$target" in esac ac_cv_var_tickadj_nano=$ans fi - -echo "$ac_t""$ac_cv_var_tickadj_nano" 1>&6 +echo "$as_me:13863: result: $ac_cv_var_tickadj_nano" >&5 +echo "${ECHO_T}$ac_cv_var_tickadj_nano" >&6 case "$ac_cv_var_tickadj_nano" in nsec) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\EOF #define TICKADJ_NANO 1 EOF ;; esac # -echo $ac_n "checking half-heartedly for 'dosynctodr' in the kernel""... $ac_c" 1>&6 -echo "configure:9639: checking half-heartedly for 'dosynctodr' in the kernel" >&5 -if eval "test \"`echo '$''{'ac_cv_var_nlist_dosynctodr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13874: checking half-heartedly for 'dosynctodr' in the kernel" >&5 +echo $ECHO_N "checking half-heartedly for 'dosynctodr' in the kernel... $ECHO_C" >&6 +if test "${ac_cv_var_nlist_dosynctodr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in *-apple-aux[23]*) @@ -9676,21 +13913,21 @@ else esac ac_cv_var_nlist_dosynctodr=$ans fi - -echo "$ac_t""$ac_cv_var_nlist_dosynctodr" 1>&6 +echo "$as_me:13916: result: $ac_cv_var_nlist_dosynctodr" >&5 +echo "${ECHO_T}$ac_cv_var_nlist_dosynctodr" >&6 case "$ac_cv_var_nlist_dosynctodr" in no) ;; - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define K_DOSYNCTODR_NAME "$ac_cv_var_nlist_dosynctodr" EOF ;; esac # -echo $ac_n "checking half-heartedly for 'noprintf' in the kernel""... $ac_c" 1>&6 -echo "configure:9692: checking half-heartedly for 'noprintf' in the kernel" >&5 -if eval "test \"`echo '$''{'ac_cv_var_nlist_noprintf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13927: checking half-heartedly for 'noprintf' in the kernel" >&5 +echo $ECHO_N "checking half-heartedly for 'noprintf' in the kernel... $ECHO_C" >&6 +if test "${ac_cv_var_nlist_noprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in *-apple-aux[23]*) @@ -9723,24 +13960,21 @@ else esac ac_cv_var_nlist_noprintf=$ans fi - -echo "$ac_t""$ac_cv_var_nlist_noprintf" 1>&6 +echo "$as_me:13963: result: $ac_cv_var_nlist_noprintf" >&5 +echo "${ECHO_T}$ac_cv_var_nlist_noprintf" >&6 case "$ac_cv_var_nlist_noprintf" in no) ;; - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define K_NOPRINTF_NAME "$ac_cv_var_nlist_noprintf" EOF ;; esac - - - -echo $ac_n "checking for a default value for 'tick'""... $ac_c" 1>&6 -echo "configure:9742: checking for a default value for 'tick'" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tick'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:13974: checking for a default value for 'tick'" >&5 +echo $ECHO_N "checking for a default value for 'tick'... $ECHO_C" >&6 +if test "${ac_cv_var_tick+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-tick or --disable-tick was given. if test "${enable_tick+set}" = set; then @@ -9767,24 +14001,23 @@ else ans='1000000L/hz' ;; esac -fi - +fi; ac_cv_var_tick=$ans fi - -echo "$ac_t""$ac_cv_var_tick" 1>&6 +echo "$as_me:14007: result: $ac_cv_var_tick" >&5 +echo "${ECHO_T}$ac_cv_var_tick" >&6 case "$ac_cv_var_tick" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define PRESET_TICK $ac_cv_var_tick EOF ;; esac -echo $ac_n "checking for a default value for 'tickadj'""... $ac_c" 1>&6 -echo "configure:9786: checking for a default value for 'tickadj'" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tickadj'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14017: checking for a default value for 'tickadj'" >&5 +echo $ECHO_N "checking for a default value for 'tickadj'... $ECHO_C" >&6 +if test "${ac_cv_var_tickadj+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-tickadj or --disable-tickadj was given. if test "${enable_tickadj+set}" = set; then @@ -9836,15 +14069,14 @@ else ans=50 ;; esac -fi - +fi; ac_cv_var_tickadj=$ans fi - -echo "$ac_t""$ac_cv_var_tickadj" 1>&6 +echo "$as_me:14075: result: $ac_cv_var_tickadj" >&5 +echo "${ECHO_T}$ac_cv_var_tickadj" >&6 case "$ac_cv_var_tickadj" in ''|no) ;; # HMS: I think we can only get 'no' here... - *) cat >> confdefs.h <<EOF + *) cat >>confdefs.h <<EOF #define PRESET_TICKADJ $ac_cv_var_tickadj EOF ;; @@ -9855,14 +14087,14 @@ esac # Unfortunately, there is no easy way to know if particular release # has this "feature" or any obvious way to test for it. case "$target" in - mips-sni-sysv4*) cat >> confdefs.h <<\EOF + mips-sni-sysv4*) cat >>confdefs.h <<\EOF #define RELIANTUNIX_CLOCK 1 EOF ;; esac case "$target" in - *-*-sco3.2v5*) cat >> confdefs.h <<\EOF + *-*-sco3.2v5*) cat >>confdefs.h <<\EOF #define SCO5_CLOCK 1 EOF ;; @@ -9871,15 +14103,18 @@ esac ac_cv_make_tickadj=yes case "$ac_cv_var_can_kmem$ac_cv_var_tick$ac_cv_var_tickadj" in nonono) # Don't read KMEM, no presets. Bogus. - echo "configure: warning: Can't read kmem" 1>&2 + { echo "$as_me:14106: WARNING: Can't read kmem" >&5 +echo "$as_me: WARNING: Can't read kmem" >&2;} ac_cv_make_tickadj=no ;; nono*) # Don't read KMEM, no PRESET_TICK but PRESET_TICKADJ. Bogus. - echo "configure: warning: Can't read kmem but no PRESET_TICK. No tickadj." 1>&2 + { echo "$as_me:14111: WARNING: Can't read kmem but no PRESET_TICK. No tickadj." >&5 +echo "$as_me: WARNING: Can't read kmem but no PRESET_TICK. No tickadj." >&2;} ac_cv_make_tickadj=no ;; no*no) # Don't read KMEM, PRESET_TICK but no PRESET_TICKADJ. Bogus. - echo "configure: warning: Can't read kmem but no PRESET_TICKADJ. No tickadj." 1>&2 + { echo "$as_me:14116: WARNING: Can't read kmem but no PRESET_TICKADJ. No tickadj." >&5 +echo "$as_me: WARNING: Can't read kmem but no PRESET_TICKADJ. No tickadj." >&2;} ac_cv_make_tickadj=no ;; no*) # Don't read KMEM, PRESET_TICK and PRESET_TICKADJ. Cool. @@ -9887,14 +14122,43 @@ case "$ac_cv_var_can_kmem$ac_cv_var_tick$ac_cv_var_tickadj" in yesnono) # Read KMEM, no presets. Cool. ;; yesno*) # Read KMEM, no PRESET_TICK but PRESET_TICKADJ. Bogus. - echo "configure: warning: PRESET_TICKADJ is defined but not PRESET_TICK. Please report this." 1>&2 + { echo "$as_me:14125: WARNING: PRESET_TICKADJ is defined but not PRESET_TICK. Please report this." >&5 +echo "$as_me: WARNING: PRESET_TICKADJ is defined but not PRESET_TICK. Please report this." >&2;} ;; yes*no) # Read KMEM, PRESET_TICK but no PRESET_TICKADJ. Cool. ;; yes*) # READ KMEM, PRESET_TICK and PRESET_TICKADJ. ;; *) # Generally bogus. - { echo "configure: error: This shouldn't happen." 1>&2; exit 1; } + { { echo "$as_me:14133: error: This shouldn't happen." >&5 +echo "$as_me: error: This shouldn't happen." >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +echo "$as_me:14139: checking if we want and can make the ntptime utility" >&5 +echo $ECHO_N "checking if we want and can make the ntptime utility... $ECHO_C" >&6 +if test "${ac_cv_make_ntptime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$target" in + *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in + yesyes) + ans=yes + ;; + *) + ans=no + ;; + esac + ;; +esac +ac_cv_make_ntptime=$ans +fi +echo "$as_me:14157: result: $ac_cv_make_ntptime" >&5 +echo "${ECHO_T}$ac_cv_make_ntptime" >&6 +case "$ac_cv_make_ntptime" in + yes) + MAKE_NTPTIME=ntptime ;; esac @@ -9903,63 +14167,59 @@ case "$target" in # tickadj is pretty useless on newer versions of ReliantUNIX # Do not bother ac_cv_make_tickadj=no - ;; + ;; + *-*-irix*) + ac_cv_make_tickadj=no + ;; *-*-solaris2*) # DLM says tickadj is a no-no starting with solaris2.5 case "$target" in *-*-solaris2.0-4*) ;; *) ac_cv_make_tickadj=no ;; esac - ;; + ;; esac - - -echo $ac_n "checking if we want and can make the tickadj utility""... $ac_c" 1>&6 -echo "configure:9919: checking if we want and can make the tickadj utility" >&5 -if eval "test \"`echo '$''{'ac_cv_make_tickadj'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14182: checking if we want and can make the tickadj utility" >&5 +echo $ECHO_N "checking if we want and can make the tickadj utility... $ECHO_C" >&6 +if test "${ac_cv_make_tickadj+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_make_tickadj=yes fi - -echo "$ac_t""$ac_cv_make_tickadj" 1>&6 +echo "$as_me:14189: result: $ac_cv_make_tickadj" >&5 +echo "${ECHO_T}$ac_cv_make_tickadj" >&6 case "$ac_cv_make_tickadj" in yes) MAKE_TICKADJ=tickadj ;; esac - -echo $ac_n "checking if we want and can make the ntptime utility""... $ac_c" 1>&6 -echo "configure:9935: checking if we want and can make the ntptime utility" >&5 -if eval "test \"`echo '$''{'ac_cv_make_ntptime'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14197: checking if we want and can make the timetrim utility" >&5 +echo $ECHO_N "checking if we want and can make the timetrim utility... $ECHO_C" >&6 +if test "${ac_cv_make_timetrim+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$target" in - *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in - yesyes) - ans=yes - ;; - *) - ans=no - ;; - esac + *-*-irix*) + ac_cv_make_timetrim=yes + ;; + *) + ac_cv_make_timetrim=no ;; esac -ac_cv_make_ntptime=$ans fi - -echo "$ac_t""$ac_cv_make_ntptime" 1>&6 -case "$ac_cv_make_ntptime" in +echo "$as_me:14211: result: $ac_cv_make_timetrim" >&5 +echo "${ECHO_T}$ac_cv_make_timetrim" >&6 +case "$ac_cv_make_timetrim" in yes) - MAKE_NTPTIME=ntptime + MAKE_TIMETRIM=timetrim ;; esac -echo $ac_n "checking if we want UDP wildcard delivery""... $ac_c" 1>&6 -echo "configure:9961: checking if we want UDP wildcard delivery" >&5 -if eval "test \"`echo '$''{'ac_cv_var_udp_wildcard_delivery'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14219: checking if we want UDP wildcard delivery" >&5 +echo $ECHO_N "checking if we want UDP wildcard delivery... $ECHO_C" >&6 +if test "${ac_cv_var_udp_wildcard_delivery+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-udp-wildcard or --disable-udp-wildcard was given. if test "${enable_udp_wildcard+set}" = set; then @@ -10011,14 +14271,13 @@ else ans=yes ;; esac -fi - +fi; ac_cv_var_udp_wildcard_delivery=$ans fi - -echo "$ac_t""$ac_cv_var_udp_wildcard_delivery" 1>&6 +echo "$as_me:14277: result: $ac_cv_var_udp_wildcard_delivery" >&5 +echo "${ECHO_T}$ac_cv_var_udp_wildcard_delivery" >&6 case "$ac_cv_var_udp_wildcard_delivery" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define UDP_WILDCARD_DELIVERY 1 EOF ;; @@ -10035,17 +14294,17 @@ case "$host" in ;; esac -echo $ac_n "checking if we should always slew the time""... $ac_c" 1>&6 -echo "configure:10040: checking if we should always slew the time" >&5 -if eval "test \"`echo '$''{'ac_cv_var_slew_always'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14297: checking if we should always slew the time" >&5 +echo $ECHO_N "checking if we should always slew the time... $ECHO_C" >&6 +if test "${ac_cv_var_slew_always+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-slew-always or --disable-slew-always was given. if test "${enable_slew_always+set}" = set; then enableval="$enable_slew_always" ans=$enableval else - case "$target" in + case "$target" in *-apple-aux[23]*) ans=yes ;; @@ -10061,31 +14320,30 @@ else *) ans=no ;; esac - -fi +fi; ac_cv_var_slew_always=$ans fi - -echo "$ac_t""$ac_cv_var_slew_always" 1>&6 +echo "$as_me:14327: result: $ac_cv_var_slew_always" >&5 +echo "${ECHO_T}$ac_cv_var_slew_always" >&6 case "$ac_cv_var_slew_always" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define SLEWALWAYS 1 EOF ;; esac -echo $ac_n "checking if we should step and slew the time""... $ac_c" 1>&6 -echo "configure:10080: checking if we should step and slew the time" >&5 -if eval "test \"`echo '$''{'ac_cv_var_step_slew'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14336: checking if we should step and slew the time" >&5 +echo $ECHO_N "checking if we should step and slew the time... $ECHO_C" >&6 +if test "${ac_cv_var_step_slew+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-step-slew or --disable-step-slew was given. if test "${enable_step_slew+set}" = set; then enableval="$enable_step_slew" ans=$enableval else - case "$target" in + case "$target" in *-sni-sysv*) ans=yes ;; @@ -10104,55 +14362,53 @@ else *) ans=no ;; esac - -fi +fi; ac_cv_var_step_slew=$ans fi - -echo "$ac_t""$ac_cv_var_step_slew" 1>&6 +echo "$as_me:14369: result: $ac_cv_var_step_slew" >&5 +echo "${ECHO_T}$ac_cv_var_step_slew" >&6 case "$ac_cv_var_step_slew" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define STEP_SLEW 1 EOF ;; esac -echo $ac_n "checking if ntpdate should step the time""... $ac_c" 1>&6 -echo "configure:10123: checking if ntpdate should step the time" >&5 -if eval "test \"`echo '$''{'ac_cv_var_ntpdate_step'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14378: checking if ntpdate should step the time" >&5 +echo $ECHO_N "checking if ntpdate should step the time... $ECHO_C" >&6 +if test "${ac_cv_var_ntpdate_step+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-ntpdate-step or --disable-ntpdate-step was given. if test "${enable_ntpdate_step+set}" = set; then enableval="$enable_ntpdate_step" ans=$enableval else - case "$target" in + case "$target" in *-apple-aux[23]*) ans=yes ;; *) ans=no ;; esac - -fi +fi; ac_cv_var_ntpdate_step=$ans fi - -echo "$ac_t""$ac_cv_var_ntpdate_step" 1>&6 +echo "$as_me:14399: result: $ac_cv_var_ntpdate_step" >&5 +echo "${ECHO_T}$ac_cv_var_ntpdate_step" >&6 case "$ac_cv_var_ntpdate_step" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define FORCE_NTPDATE_STEP 1 EOF ;; esac -echo $ac_n "checking if we should sync TODR clock every hour""... $ac_c" 1>&6 -echo "configure:10154: checking if we should sync TODR clock every hour" >&5 -if eval "test \"`echo '$''{'ac_cv_var_sync_todr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14408: checking if we should sync TODR clock every hour" >&5 +echo $ECHO_N "checking if we should sync TODR clock every hour... $ECHO_C" >&6 +if test "${ac_cv_var_sync_todr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-hourly-todr-sync or --disable-hourly-todr-sync was given. if test "${enable_hourly_todr_sync+set}" = set; then @@ -10169,37 +14425,64 @@ else *) ans=no ;; esac -fi - +fi; ac_cv_var_sync_todr=$ans fi - -echo "$ac_t""$ac_cv_var_sync_todr" 1>&6 +echo "$as_me:14431: result: $ac_cv_var_sync_todr" >&5 +echo "${ECHO_T}$ac_cv_var_sync_todr" >&6 case "$ac_cv_var_sync_todr" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define DOSYNCTODR 1 EOF ;; esac -echo $ac_n "checking if we should avoid kernel FLL bug""... $ac_c" 1>&6 -echo "configure:10187: checking if we should avoid kernel FLL bug" >&5 -if eval "test \"`echo '$''{'ac_cv_var_kernel_fll_bug'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:14440: checking if we should avoid kernel FLL bug" >&5 +echo $ECHO_N "checking if we should avoid kernel FLL bug... $ECHO_C" >&6 +if test "${ac_cv_var_kernel_fll_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Check whether --enable-kernel-fll-bug or --disable-kernel-fll-bug was given. if test "${enable_kernel_fll_bug+set}" = set; then enableval="$enable_kernel_fll_bug" ans=$enableval else - case "$target" in + case "$target" in *-*-solaris2.6) - ans=yes + unamev=`uname -v` + case "$unamev" in + Generic_105181-*) + old_IFS="$IFS" + IFS="-" + set $unamev + IFS="$old_IFS" + if test "$2" -ge 17 + then + # Generic_105181-17 and higher + ans=no + else + ans=yes + fi + ;; + *) ans=yes + ;; + esac ;; *-*-solaris2.7) - case "`uname -v`" in - Generic_106541-07) - ans=no + unamev=`uname -v` + case "$unamev" in + Generic_106541-*) + old_IFS="$IFS" + IFS="-" + set $unamev + IFS="$old_IFS" + if test "$2" -ge 07 + then + # Generic_106541-07 and higher + ans=no + else + ans=yes + fi ;; *) ans=yes ;; @@ -10208,15 +14491,14 @@ else *) ans=no ;; esac - -fi +fi; ac_cv_var_kernel_fll_bug=$ans fi - -echo "$ac_t""$ac_cv_var_kernel_fll_bug" 1>&6 +echo "$as_me:14498: result: $ac_cv_var_kernel_fll_bug" >&5 +echo "${ECHO_T}$ac_cv_var_kernel_fll_bug" >&6 case "$ac_cv_var_kernel_fll_bug" in - yes) cat >> confdefs.h <<\EOF + yes) cat >>confdefs.h <<\EOF #define KERNEL_FLL_BUG 1 EOF ;; @@ -10233,425 +14515,927 @@ case "$host" in ;; esac + ac_expanded=`( + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + eval echo \""$sysconfdir"\" + )` + +cat >>confdefs.h <<EOF +#define NTP_KEYSDIR "$ac_expanded" +EOF + # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` -trap '' 1 2 15 -cat > confcache <<\EOF +ac_config_files="$ac_config_files Makefile adjtimed/Makefile clockstuff/Makefile ElectricFence/Makefile include/Makefile kernel/Makefile kernel/sys/Makefile libntp/Makefile libparse/Makefile librsaref/Makefile ntpd/Makefile ntpdc/Makefile ntpdate/Makefile ntpq/Makefile ntptrace/Makefile parseutil/Makefile scripts/Makefile scripts/calc_tickadj scripts/checktime scripts/freq_adj scripts/mkver scripts/ntp-wait scripts/ntpsweep scripts/ntpver scripts/plot_summary scripts/summary util/Makefile" + +ac_config_commands="$ac_config_commands default" + +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:14615: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.50, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 do - case "\$ac_option" in + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:14791: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # Handling of arguments. + 'Makefile' ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + 'adjtimed/Makefile' ) CONFIG_FILES="$CONFIG_FILES adjtimed/Makefile" ;; + 'clockstuff/Makefile' ) CONFIG_FILES="$CONFIG_FILES clockstuff/Makefile" ;; + 'ElectricFence/Makefile' ) CONFIG_FILES="$CONFIG_FILES ElectricFence/Makefile" ;; + 'include/Makefile' ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + 'kernel/Makefile' ) CONFIG_FILES="$CONFIG_FILES kernel/Makefile" ;; + 'kernel/sys/Makefile' ) CONFIG_FILES="$CONFIG_FILES kernel/sys/Makefile" ;; + 'libntp/Makefile' ) CONFIG_FILES="$CONFIG_FILES libntp/Makefile" ;; + 'libparse/Makefile' ) CONFIG_FILES="$CONFIG_FILES libparse/Makefile" ;; + 'librsaref/Makefile' ) CONFIG_FILES="$CONFIG_FILES librsaref/Makefile" ;; + 'ntpd/Makefile' ) CONFIG_FILES="$CONFIG_FILES ntpd/Makefile" ;; + 'ntpdc/Makefile' ) CONFIG_FILES="$CONFIG_FILES ntpdc/Makefile" ;; + 'ntpdate/Makefile' ) CONFIG_FILES="$CONFIG_FILES ntpdate/Makefile" ;; + 'ntpq/Makefile' ) CONFIG_FILES="$CONFIG_FILES ntpq/Makefile" ;; + 'ntptrace/Makefile' ) CONFIG_FILES="$CONFIG_FILES ntptrace/Makefile" ;; + 'parseutil/Makefile' ) CONFIG_FILES="$CONFIG_FILES parseutil/Makefile" ;; + 'scripts/Makefile' ) CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; + 'scripts/calc_tickadj' ) CONFIG_FILES="$CONFIG_FILES scripts/calc_tickadj" ;; + 'scripts/checktime' ) CONFIG_FILES="$CONFIG_FILES scripts/checktime" ;; + 'scripts/freq_adj' ) CONFIG_FILES="$CONFIG_FILES scripts/freq_adj" ;; + 'scripts/mkver' ) CONFIG_FILES="$CONFIG_FILES scripts/mkver" ;; + 'scripts/ntp-wait' ) CONFIG_FILES="$CONFIG_FILES scripts/ntp-wait" ;; + 'scripts/ntpsweep' ) CONFIG_FILES="$CONFIG_FILES scripts/ntpsweep" ;; + 'scripts/ntpver' ) CONFIG_FILES="$CONFIG_FILES scripts/ntpver" ;; + 'scripts/plot_summary' ) CONFIG_FILES="$CONFIG_FILES scripts/plot_summary" ;; + 'scripts/summary' ) CONFIG_FILES="$CONFIG_FILES scripts/summary" ;; + 'util/Makefile' ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + 'default-1' ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + 'default-2' ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;; + 'default' ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + 'config.h' ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + # This is an error. + -*) { { echo "$as_me:14843: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + *) { { echo "$as_me:14848: error: invalid argument: $1" >&5 +echo "$as_me: error: invalid argument: $1" >&2;} + { (exit 1); exit 1; }; };; esac + shift done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.50, executed with + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` -trap 'rm -fr `echo "Makefile adjtimed/Makefile clockstuff/Makefile \ -include/Makefile kernel/Makefile kernel/sys/Makefile libntp/Makefile \ -libparse/Makefile librsaref/Makefile ntpd/Makefile ntpdc/Makefile \ -ntpdate/Makefile ntpq/Makefile ntptrace/Makefile parseutil/Makefile \ -scripts/Makefile scripts/mkver scripts/ntpver util/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +_ACEOF EOF -cat >> $CONFIG_STATUS <<EOF -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@AMTAR@%$AMTAR%g -s%@install_sh@%$install_sh%g -s%@AWK@%$AWK%g -s%@SET_MAKE@%$SET_MAKE%g -s%@AMDEP@%$AMDEP%g -s%@AMDEPBACKSLASH@%$AMDEPBACKSLASH%g -s%@DEPDIR@%$DEPDIR%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@CCDEPMODE@%$CCDEPMODE%g -s%@LN_S@%$LN_S%g -s%@RANLIB@%$RANLIB%g -s%@PATH_SH@%$PATH_SH%g -s%@U@%$U%g -s%@ANSI2KNR@%$ANSI2KNR%g -s%@LIBOBJS@%$LIBOBJS%g -s%@LIBPARSE@%$LIBPARSE%g -s%@MAKE_LIBPARSE@%$MAKE_LIBPARSE%g -s%@MAKE_LIBPARSE_KERNEL@%$MAKE_LIBPARSE_KERNEL%g -s%@MAKE_CHECK_Y2K@%$MAKE_CHECK_Y2K%g -s%@RSAREF@%$RSAREF%g -s%@LIBRSAREF@%$LIBRSAREF%g -s%@MAKE_LIBRSAREF@%$MAKE_LIBRSAREF%g -s%@TESTDCF@%$TESTDCF%g -s%@DCFD@%$DCFD%g -s%@MAKE_PARSEKMODULE@%$MAKE_PARSEKMODULE%g -s%@PROPDELAY@%$PROPDELAY%g -s%@CHUTEST@%$CHUTEST%g -s%@CLKTEST@%$CLKTEST%g -s%@MAKE_ADJTIMED@%$MAKE_ADJTIMED%g -s%@MAKE_TICKADJ@%$MAKE_TICKADJ%g -s%@MAKE_NTPTIME@%$MAKE_NTPTIME%g +cat >>$CONFIG_STATUS <<\EOF +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit $?); exit $?; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} -CEOF EOF -cat >> $CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<EOF +# +# INIT-COMMANDS section. +# -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" +am_indx=1 + for am_file in config.h; do + case " $CONFIG_HEADERS " in + *" $am_file "*) + echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` + done +AMDEP="$AMDEP" +ac_aux_dir="$ac_aux_dir" + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@INSTALL_STRIP_PROGRAM_ENV@,$INSTALL_STRIP_PROGRAM_ENV,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@AMDEP@,$AMDEP,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@_am_include@,$_am_include,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@PATH_SH@,$PATH_SH,;t t +s,@PATH_PERL@,$PATH_PERL,;t t +s,@U@,$U,;t t +s,@ANSI2KNR@,$ANSI2KNR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LIBPARSE@,$LIBPARSE,;t t +s,@MAKE_LIBPARSE@,$MAKE_LIBPARSE,;t t +s,@MAKE_LIBPARSE_KERNEL@,$MAKE_LIBPARSE_KERNEL,;t t +s,@MAKE_CHECK_Y2K@,$MAKE_CHECK_Y2K,;t t +s,@RSAOBJS@,$RSAOBJS,;t t +s,@RSASRCS@,$RSASRCS,;t t +s,@RSADIR@,$RSADIR,;t t +s,@RSAREF@,$RSAREF,;t t +s,@LIBRSAREF@,$LIBRSAREF,;t t +s,@MAKE_LIBRSAREF@,$MAKE_LIBRSAREF,;t t +s,@OPENSSL@,$OPENSSL,;t t +s,@OPENSSL_INC@,$OPENSSL_INC,;t t +s,@OPENSSL_LIB@,$OPENSSL_LIB,;t t +s,@MAKE_NTP_GENKEYS@,$MAKE_NTP_GENKEYS,;t t +s,@AUTOKEY@,$AUTOKEY,;t t +s,@EF_PROGS@,$EF_PROGS,;t t +s,@EF_LIBS@,$EF_LIBS,;t t +s,@TESTDCF@,$TESTDCF,;t t +s,@DCFD@,$DCFD,;t t +s,@MAKE_PARSEKMODULE@,$MAKE_PARSEKMODULE,;t t +s,@PROPDELAY@,$PROPDELAY,;t t +s,@CHUTEST@,$CHUTEST,;t t +s,@CLKTEST@,$CLKTEST,;t t +s,@MAKE_ADJTIMED@,$MAKE_ADJTIMED,;t t +s,@MAKE_NTPTIME@,$MAKE_NTPTIME,;t t +s,@MAKE_TICKADJ@,$MAKE_TICKADJ,;t t +s,@MAKE_TIMETRIM@,$MAKE_TIMETRIM,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF +fi # test -n "$CONFIG_FILES" -CONFIG_FILES=\${CONFIG_FILES-"Makefile adjtimed/Makefile clockstuff/Makefile \ -include/Makefile kernel/Makefile kernel/sys/Makefile libntp/Makefile \ -libparse/Makefile librsaref/Makefile ntpd/Makefile ntpdc/Makefile \ -ntpdate/Makefile ntpq/Makefile ntptrace/Makefile parseutil/Makefile \ -scripts/Makefile scripts/mkver scripts/ntpver util/Makefile"} EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; esac - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac + if test x"$ac_file" != x-; then + { echo "$as_me:15153: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:15171: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:15184: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <<EOF - CONFIG_HEADERS="config.h" -EOF -cat >> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr + test x"$ac_file" != x- && { echo "$as_me:15245: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:15256: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:15269: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.undefs >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:15386: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file fi - rm -f $ac_file - mv conftest.h $ac_file + else + cat $tmp/config.h + rm -f $tmp/config.h fi -fi; done - +done EOF -cat >> $CONFIG_STATUS <<EOF - -AMDEP="$AMDEP" -ac_aux_dir="$ac_aux_dir" +cat >>$CONFIG_STATUS <<\EOF -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + default-2 ) test x"$AMDEP" != x"" || for mf in $CONFIG_FILES; do case "$mf" in @@ -10689,12 +15473,35 @@ for mf in $CONFIG_FILES; do echo '# dummy' > "$dirpart/$file" done done + ;; + default ) chmod +x scripts/calc_tickadj scripts/checktime scripts/freq_adj scripts/mkver scripts/ntp-wait scripts/ntpsweep scripts/ntpver scripts/plot_summary scripts/summary ;; + esac +done +EOF -chmod +x scripts/ntpver scripts/mkver -exit 0 +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi #test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h]) diff --git a/contrib/ntp/configure.in b/contrib/ntp/configure.in index c8cf3da..9a40c8a 100644 --- a/contrib/ntp/configure.in +++ b/contrib/ntp/configure.in @@ -5,16 +5,18 @@ AC_CANONICAL_SYSTEM AC_DEFINE_UNQUOTED(STR_SYSTEM, "$target") AM_CONFIG_HEADER(config.h) AC_ARG_PROGRAM -AM_INIT_AUTOMAKE(ntp, 4.0.99b) -AC_PREREQ(2.13) +AM_INIT_AUTOMAKE(ntp, 4.1.0) +AC_PREREQ(2.49) ac_cv_var_oncore_ok=no +ac_cv_var_atom_ok=no dnl Grab any initial CFLAGS so we can pick better defaults. iCFLAGS="$CFLAGS" dnl we need to check for cross compile tools for vxWorks here AC_PROG_CC +AC_PROG_CC_STDC AC_PROG_CPP case "$target" in @@ -62,14 +64,16 @@ rm -f conftest* case "$GCC" in yes) CFLAGS="$CFLAGS -Wall" - # CFLAGS="$CFLAGS -Wtraditional" - CFLAGS="$CFLAGS -Wshadow" - # CFLAGS="$CFLAGS -Wwrite-strings" - CFLAGS="$CFLAGS -Wconversion" - CFLAGS="$CFLAGS -Wpointer-arith" - CFLAGS="$CFLAGS -Wcast-qual" # CFLAGS="$CFLAGS -Wcast-align" + CFLAGS="$CFLAGS -Wcast-qual" + # CFLAGS="$CFLAGS -Wconversion" + # CFLAGS="$CFLAGS -Werror" + CFLAGS="$CFLAGS -Wmissing-prototypes" + CFLAGS="$CFLAGS -Wpointer-arith" + CFLAGS="$CFLAGS -Wshadow" CFLAGS="$CFLAGS -Wstrict-prototypes" + # CFLAGS="$CFLAGS -Wtraditional" + # CFLAGS="$CFLAGS -Wwrite-strings" AC_CACHE_CHECK(whether ${CC-cc} -pipe works, ac_cv_prog_cc_pipe, [echo 'void f(){}' > conftest.c @@ -92,7 +96,11 @@ esac ac_busted_vpath_in_make=no case "$target" in + *-next-nextstep3) + CFLAGS="$CFLAGS -posix" + ;; *-*-irix6.1*) # 64 bit only + # busted vpath? ;; *-*-irix6*) # 6.2 (and later?) ac_busted_vpath_in_make=yes @@ -114,8 +122,6 @@ case "$target" in esac fi ;; - *-next-nextstep3) - CFLAGS="$CFLAGS -posix" ;; *-*-solaris2.5.1) ac_busted_vpath_in_make=yes ;; @@ -156,6 +162,9 @@ AC_MINIX AC_ISC_POSIX AC_PROG_RANLIB AC_PATH_PROG(PATH_SH, sh) +AC_PATH_PROG(PATH_PERL, perl) + +hs_ULONG_CONST case "$target" in *-*-vxworks*) @@ -170,25 +179,35 @@ case "$target" in AC_CHECK_LIB(advapi32, main) ;; esac -AC_CHECK_LIB(elf, nlist) +AC_CHECK_LIB(elf, nlist) dnl Only needed for tickadj... dnl AC_CHECK_LIB(kvm, main, , , -lelf) AC_CHECK_LIB(kvm, main) dnl We already know about -lelf here... AC_CHECK_LIB(ld, nlist) AC_CHECK_LIB(mld, nlist) AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent, , , -lsocket)) AC_CHECK_FUNC(openlog, , AC_CHECK_LIB(gen, openlog)) +AC_CHECK_LIB(readline, readline) dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt, -dnl so only use one of them -AC_CHECK_LIB(rt, sched_setscheduler, , +dnl so only use one of them. Linux (glibc-2.1.2 and -2.2.2, at least) +dnl does Strange Things with extra processes using the Posix-compatibility +dnl real-time library, so we don't want to use it. + +case "$target" in + *-*-linux*) ;; + *) + AC_CHECK_LIB(rt, sched_setscheduler, , AC_CHECK_LIB(posix4, sched_setscheduler)) + ;; +esac + AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) AC_HEADER_STDC -AC_CHECK_HEADERS(bstring.h errno.h fcntl.h memory.h netdb.h poll.h resolv.h) -AC_CHECK_HEADERS(sched.h sgtty.h stdlib.h string.h termio.h termios.h) -AC_CHECK_HEADERS(timepps.h timex.h unistd.h utmp.h utmpx.h) +AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h memory.h netdb.h) +AC_CHECK_HEADERS(poll.h resolv.h sched.h sgtty.h stdlib.h string.h termio.h) +AC_CHECK_HEADERS(termios.h timepps.h timex.h unistd.h utmp.h utmpx.h) AC_CHECK_HEADERS(arpa/nameser.h net/if.h netinet/in_systm.h netinet/in.h) AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO)]) AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h) @@ -421,6 +440,23 @@ if test $ac_cv_struct_clockinfo_has_tickadj = yes; then AC_DEFINE(HAVE_TICKADJ_IN_STRUCT_CLOCKINFO) fi +AC_CACHE_CHECK([for struct timespec], ac_cv_struct_timespec, +[AC_TRY_COMPILE([ +#include <sys/time.h> +/* Under SunOS, timespec is in sys/timepps.h, which needs errno.h and FRAC */ +#ifdef HAVE_ERRNO_H +# include <errno.h> +#endif +#ifdef HAVE_SYS_TIMEPPS_H +# define FRAC 4294967296 +# include <sys/timepps.h> +#endif], +[struct timespec n;], +ac_cv_struct_timespec=yes, ac_cv_struct_timespec=no)]) +if test $ac_cv_struct_timespec = yes; then + AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1, [Do we have struct timespec?]) +fi + AC_CACHE_CHECK([for struct ntptimeval], ac_cv_struct_ntptimeval, [AC_TRY_COMPILE([ #include <sys/time.h> @@ -431,9 +467,8 @@ if test $ac_cv_struct_ntptimeval = yes; then AC_DEFINE(HAVE_STRUCT_NTPTIMEVAL, 1, [Do we have struct ntptimeval?]) fi -AC_CACHE_CHECK(struct ntptimeval for time.tv_nsec, ac_cv_struct_ntptimeval_tv_nsec, -[AC_TRY_COMPILE([ -#ifdef HAVE_SYS_TIME_H +AC_CHECK_MEMBERS([struct ntptimeval.time.tv_nsec], , , +[#ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else # ifdef HAVE_TIME_H @@ -446,24 +481,7 @@ AC_CACHE_CHECK(struct ntptimeval for time.tv_nsec, ac_cv_struct_ntptimeval_tv_ns # ifdef HAVE_TIMEX_H # include <timex.h> # endif -#endif],[ -extern struct ntptimeval *ntv; -return ntv->time.tv_nsec;], - ac_cv_struct_ntptimeval_tv_nsec=yes, - ac_cv_struct_ntptimeval_tv_nsec=no) -]) -if test "$ac_cv_struct_ntptimeval_tv_nsec" = "yes"; then - AC_DEFINE(HAVE_TV_NSEC_IN_NTPTIMEVAL) -fi - -AC_CACHE_CHECK([for struct timespec in struct ntptimeval], ac_cv_struct_ntptimeval_timespec, -[AC_TRY_COMPILE([#include <sys/time.h> -#include <sys/timex.h>], -[struct ntptimeval n; n.time.tv_nsec = 0;], -ac_cv_struct_ntptimeval_timespec=yes, ac_cv_struct_ntptimeval_timespec=no)]) -if test $ac_cv_struct_ntptimeval_timespec = yes; then - AC_DEFINE(TIMESPEC_IN_NTPTIMEVAL, 1, [Does ntptimeval use struct timespec?]) -fi +#endif]) AC_C_INLINE AC_C_CHAR_UNSIGNED dnl CROSS_COMPILE? @@ -509,7 +527,7 @@ case "$host" in ;; esac -AC_CHECK_TYPE(s_char, signed char) +AC_CHECK_TYPES([s_char]) case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in *yes) # We have a typedef for s_char. Might as well believe it... @@ -549,15 +567,25 @@ case "$target" in *) AC_CHECK_FUNCS(clock_settime) ;; esac -AC_CHECK_FUNCS(daemon getbootfile getdtablesize getrusage) -AC_CHECK_FUNCS(gettimeofday) +AC_CHECK_FUNCS(daemon) +AC_CHECK_FUNCS(finite, , + [AC_CHECK_FUNCS(isfinite, , + [AC_MSG_CHECKING(for isfinite with <math.h>) + _libs=$LIBS + LIBS="$LIBS -lm" + AC_TRY_LINK([#include <math.h>], [float f = 0.0; isfinite(f)], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ISFINITE)], + AC_MSG_RESULT(no)) + LIBS=$_libs])]) +AC_CHECK_FUNCS(getbootfile getclock getdtablesize getrusage gettimeofday) case "$target" in *-pc-cygwin*) ;; *) AC_CHECK_FUNCS(getuid) ;; esac -AC_CHECK_FUNCS(K_open kvm_open memcpy memmove memset) +AC_CHECK_FUNCS(hstrerror K_open kvm_open memcpy memmove memset) case "$target" in *-*-sco3.2v5.0.*) # Just stubs. Idiots. @@ -585,7 +613,7 @@ case "$target" in *) AC_CHECK_FUNCS(mlockall) ;; esac -AC_CHECK_FUNCS(nice nlist) +AC_CHECK_FUNCS(mrand48 srand48 nice nlist) case "$target" in *-*-solaris2.6) # Broken... @@ -593,8 +621,11 @@ case "$target" in *) AC_CHECK_FUNCS(ntp_adjtime ntp_gettime) ;; esac -AC_CHECK_FUNCS(plock pututline pututxline rtprio) -AC_CHECK_FUNCS(random srandom mrand48 srand48) +AC_CHECK_FUNCS(plock pututline pututxline readlink rtprio) +case "$ac_cv_func_mrand48" in + yes) ;; + *) AC_REPLACE_FUNCS(random) ;; +esac case "$target" in *-*-aix4*) # Just a stub in AIX 4. Idiots. @@ -608,7 +639,7 @@ esac AC_CHECK_FUNCS(setlinebuf) AC_CHECK_FUNCS(setpgid setpriority setsid settimeofday setvbuf sigaction) AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl) -AC_REPLACE_FUNCS(strerror) +AC_REPLACE_FUNCS(snprintf strdup strerror) case "$target" in *-*-aix4*) # Just stubs. Idiots. @@ -728,15 +759,13 @@ case "$ac_cv_decl_h_errno" in esac dnl See if char *sys_errlist[] is OK. -dnl If you get the quoting right on the next line, you tried something I didn't. AC_CACHE_CHECK([[if declaring 'char *sys_errlist[]' is ok]], ac_cv_decl_sys_errlist, [AC_TRY_COMPILE([#include <stdio.h> #ifdef HAVE_ERRNO_H #include <errno.h> #endif], - changequote(<<, >>)dnl - <<extern char *sys_errlist[];>> - changequote([, ]), + [extern char *sys_errlist[]; +], ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)]) case "$ac_cv_decl_sys_errlist" in yes) AC_DEFINE(CHAR_SYS_ERRLIST) ;; @@ -763,9 +792,10 @@ case "$ac_cv_decl_syscall" in esac case "$target" in -changequote(<<, >>)dnl - *-*-osf[45]*) -changequote([, ])dnl + *-*-aix4.3.*) + AC_DEFINE(DECL_HSTRERROR_0) # Needed for XLC under AIX 4.3.2 + ;; + *-*-osf[[45]]*) AC_DEFINE(DECL_PLOCK_0) AC_DEFINE(DECL_STIME_1) ;; @@ -823,6 +853,7 @@ changequote([, ])dnl AC_DEFINE(DECL_TIMEOFDAY_0) AC_DEFINE(DECL_TOLOWER_0) AC_DEFINE(DECL_TOUPPER_0) + AC_DEFINE(DECL_STRERROR_0) ;; *-*-ultrix4*) AC_DEFINE(DECL_ADJTIME_0) @@ -856,13 +887,11 @@ AC_CACHE_CHECK(if we should use a streams device for ifconfig, AC_CACHE_CHECK(if we need extra room for SO_RCVBUF, ac_cv_var_rcvbuf_slop, [ans=no -changequote(<<, >>)dnl case "$target" in - *-*-hpux[567]*) + *-*-hpux[[567]]*) ans=yes ;; esac -changequote([, ])dnl ac_cv_var_rcvbuf_slop=$ans]) case "$ac_cv_var_rcvbuf_slop" in yes) AC_DEFINE(NEED_RCVBUF_SLOP) ;; @@ -896,9 +925,8 @@ case "$ac_cv_var_hpux_findconfig" in esac AC_CACHE_CHECK(if process groups are set with -pid, ac_cv_arg_setpgrp_negpid, -[changequote(<<, >>)dnl -case "$target" in - *-*-hpux[567]*) +[case "$target" in + *-*-hpux[[567]]*) ans=no ;; *-*-hpux*) @@ -917,7 +945,6 @@ case "$target" in ans=no ;; esac -changequote([, ])dnl ac_cv_arg_setpgrp_negpid=$ans]) case "$ac_cv_arg_setpgrp_negpid" in yes) AC_DEFINE(UDP_BACKWARDS_SETOWN) ;; @@ -925,7 +952,7 @@ esac AC_CACHE_CHECK(if we need a ctty for F_SETOWN, ac_cv_func_ctty_for_f_setown, [case "$target" in - *-*-bsdi2*) + *-*-bsdi[23]*) ans=yes ;; *-*-freebsd*) @@ -934,6 +961,9 @@ AC_CACHE_CHECK(if we need a ctty for F_SETOWN, ac_cv_func_ctty_for_f_setown, *-*-netbsd*) ans=yes ;; + *-*-openbsd*) + ans=yes + ;; *-*-osf*) ans=yes ;; @@ -1076,7 +1106,6 @@ AC_CACHE_CHECK(if we can use SIGPOLL for UDP I/O, ac_cv_var_use_udp_sigpoll, [ans=no case "$ac_cv_hdr_def_sigpoll" in yes) - changequote(<<, >>)dnl case "$target" in mips-sgi-irix*) ans=no @@ -1111,7 +1140,6 @@ case "$ac_cv_hdr_def_sigpoll" in *) ans=yes ;; esac - changequote([, ])dnl ;; esac ac_cv_var_use_udp_sigpoll=$ans]) @@ -1270,7 +1298,7 @@ case "$ac_cv_var_mcast" in yes) AC_DEFINE(MCAST) ;; esac -AC_CACHE_CHECK([availability of ntp_{adj,get}time()], ac_cv_var_ntp_syscalls, +AC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls, [ac_cv_var_ntp_syscalls=no case "$ac_cv_func___adjtimex" in yes) @@ -1350,14 +1378,6 @@ dnl case "$ac_cv_var_gdt_surveying" in dnl yes) AC_DEFINE(GDT_SURVEYING) ;; dnl esac -AC_CACHE_CHECK(if we want to use MD5 authentication, ac_cv_var_use_md5, -[AC_ARG_ENABLE(md5, [ --enable-md5 + include support for MD5 keys], - [ans=$enableval], [ans=yes]) -ac_cv_var_use_md5=$ans]) -case "$ac_cv_var_use_md5" in - yes) AC_DEFINE(MD5) ;; -esac - # Check for ioctls TIOCGPPSEV AC_MSG_CHECKING(ioctl TIOCGPPSEV) if test "$ac_cv_header_termios_h" = "yes"; then @@ -1412,15 +1432,30 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) + +# ATOM/PPSAPI stuff. + +# ATOM used to require struct timespec, but that's been fixed now. + +# case "$ac_cv_struct_timespec" in +# 'yes') +# ac_cv_var_atom_ok=yes +# ;; +# esac +ac_cv_var_atom_ok=yes + # Check for header timepps.h, if found then we have PPS API (Draft RFC) stuff. -# there is NO way that I can tell to tell if a given OS is using timespec or -# timeval so just set it here for the one case that is KNOWN to use timespec. -case "$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h" in - *yes*) +# The PPSAPI headers need "inline" ($ac_cv_c_inline='inline') + +# The PPSAPI needs ATOM + +# The PPSAPI needs struct timespec. + +case "$ac_cv_c_inline$ac_cv_struct_timespec$ac_cv_header_timepps_h$ac_cv_header_sys_timepps_h" in + inlineyes*yes*) AC_DEFINE(HAVE_PPSAPI) ac_cv_var_oncore_ok=yes - AC_DEFINE(HAVE_TIMESPEC) ;; esac @@ -1484,6 +1519,25 @@ dnl AC_SUBST(UNIXCERT) ntp_refclock=no +AC_MSG_CHECKING(for hopf serial clock device) +AC_ARG_ENABLE(HOPFSERIAL, [ --enable-HOPFSERIAL + hopf serial clock device], + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) + if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_HOPF_SERIAL) + fi + AC_MSG_RESULT($ntp_ok) + + +AC_MSG_CHECKING(for hopf PCI clock 6039) +AC_ARG_ENABLE(HOPFPCI, [ --enable-HOPFPCI + hopf 6039 PCI board], + [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +if test "$ntp_ok" = "yes"; then + ntp_refclock=yes + AC_DEFINE(CLOCK_HOPF_PCI) +fi +AC_MSG_RESULT($ntp_ok) + # HPUX only, and by explicit request AC_MSG_CHECKING(Datum/Bancomm bc635/VME interface) AC_ARG_ENABLE(BANCOMM, [ --enable-BANCOMM - Datum/Bancomm bc635/VME interface], @@ -1495,7 +1549,7 @@ fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$target" in yes*-*-hpux*) ;; - yes*) AC_WARN(*** But the expected answer is... no ***) ;; + yes*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac #HPUX only, and only by explicit request @@ -1509,7 +1563,7 @@ fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$target" in yes*-*-hpux*) ;; - yes*) AC_WARN(*** But the expected answer is... no ***) ;; + yes*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac AC_MSG_CHECKING(for PCL720 clock support) @@ -1539,8 +1593,8 @@ AC_ARG_ENABLE(all-clocks, [ --enable-all-clocks + include all suitable non- AC_MSG_RESULT($ntp_eac) AC_MSG_CHECKING(if we have support for PARSE clocks) -case "$ac_cv_header_termio_h$ac_cv_header_termios_h" in - *yes*) +case "$ac_cv_var_atom_ok$ac_cv_header_termio_h$ac_cv_header_termios_h" in + yes*yes*) ntp_canparse=yes ;; *) ntp_canparse=no @@ -1550,8 +1604,11 @@ AC_MSG_RESULT($ntp_canparse) AC_MSG_CHECKING([if we have support for audio clocks]) case "$ac_cv_header_sun_audioio_h$ac_cv_header_sys_audioio_h" in - *yes*) ntp_canaudio=yes ;; - *) ntp_canaudio=no ;; + *yes*) + ntp_canaudio=yes + AC_DEFINE(HAVE_AUDIO, , [Do we have audio support?]) + ;; + *) ntp_canaudio=no ;; esac AC_MSG_RESULT($ntp_canaudio) @@ -1592,21 +1649,24 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) -AC_MSG_CHECKING(Austron 2200A/2201A GPS receiver) -AC_ARG_ENABLE(AS2201, [ --enable-AS2201 + Austron 2200A/2201A GPS receiver], +AC_MSG_CHECKING(ATOM PPS interface) +AC_ARG_ENABLE(ATOM, [ --enable-ATOM s ATOM PPS interface], [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) +case "$ac_cv_var_atom_ok" in + no) ntp_ok=no ;; +esac if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_AS2201) + AC_DEFINE(CLOCK_ATOM) fi AC_MSG_RESULT($ntp_ok) -AC_MSG_CHECKING(PPS interface) -AC_ARG_ENABLE(ATOM, [ --enable-ATOM + PPS interface], +AC_MSG_CHECKING(Austron 2200A/2201A GPS receiver) +AC_ARG_ENABLE(AS2201, [ --enable-AS2201 + Austron 2200A/2201A GPS receiver], [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) if test "$ntp_ok" = "yes"; then ntp_refclock=yes - AC_DEFINE(CLOCK_ATOM) + AC_DEFINE(CLOCK_AS2201) fi AC_MSG_RESULT($ntp_ok) @@ -1633,7 +1693,7 @@ fi AC_MSG_RESULT($ntp_ok) # We used to check for sunos/solaris target... case "$ntp_ok$ac_refclock_chu$ntp_canaudio" in - yes*no*) AC_WARN(*** But the expected answer is...no ***) ;; + yes*no*) AC_MSG_WARN(*** But the expected answer is...no ***) ;; esac # Not under HP-UX @@ -1703,7 +1763,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canaudio" in - yesno) AC_WARN(*** But the expected answer is... no ***) ;; + yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac AC_MSG_CHECKING(Leitch CSD 5300 Master Clock System Driver) @@ -1749,7 +1809,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$target" in - yes*-*-ultrix*) AC_WARN(*** But the expected answer is... no ***) ;; + yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac AC_MSG_CHECKING(NMEA GPS receiver) @@ -1762,7 +1822,7 @@ fi AC_MSG_RESULT($ntp_ok) AC_MSG_CHECKING(for ONCORE Motorola VP/UT Oncore GPS) -AC_ARG_ENABLE(ONCORE, [ --enable-ONCORE + Motorola VP/UT Oncore GPS receiver], +AC_ARG_ENABLE(ONCORE, [ --enable-ONCORE s Motorola VP/UT Oncore GPS receiver], [ntp_ok=$enableval], [ntp_ok=$ntp_eac]) case "$ac_cv_var_oncore_ok" in no) ntp_ok=no ;; @@ -1815,7 +1875,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$target" in - yes*-*-ultrix*) AC_WARN(*** But the expected answer is... no ***) ;; + yes*-*-ultrix*) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac # Requires modem control @@ -1853,7 +1913,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ac_cv_header_sys_tpro" in - yesno) AC_WARN(*** But the expected answer is... no ***) ;; + yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac AC_MSG_CHECKING(TRAK 8810 GPS receiver) @@ -1919,7 +1979,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$target" in - yesvax-dec-bsd) AC_WARN(*** But the expected answer is... no ***) ;; + yesvax-dec-bsd) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac AC_MSG_CHECKING(Ultralink M320 WWVB receiver) @@ -1944,7 +2004,7 @@ if test "$ntp_ok" = "yes"; then fi AC_MSG_RESULT($ntp_ok) case "$ntp_ok$ntp_canaudio" in - yesno) AC_WARN(*** But the expected answer is... no ***) ;; + yesno) AC_MSG_WARN(*** But the expected answer is... no ***) ;; esac # Requires modem control @@ -2196,18 +2256,163 @@ case "$ntp_libparse" in esac AC_MSG_RESULT($ans) +AC_SUBST(RSAOBJS) +AC_SUBST(RSASRCS) +AC_SUBST(RSADIR) AC_SUBST(RSAREF) AC_SUBST(LIBRSAREF) AC_SUBST(MAKE_LIBRSAREF) -AC_MSG_CHECKING(if we need to make and use the RSAREF library) -ans=no -if test -f $srcdir/rsaref2/source/rsa.c -then + +AC_SUBST(OPENSSL) +AC_SUBST(OPENSSL_INC) +AC_SUBST(OPENSSL_LIB) + +AC_SUBST(MAKE_NTP_GENKEYS) + +AC_MSG_CHECKING(for openssl library directory) +AC_ARG_WITH(openssl-libdir, + AC_HELP_STRING([--with-openssl-libdir], [+ =/something/reasonable]), +[ans=$withval], [ans=yes]) +case "$ans" in + no) ;; + yes) # Look in: + ans="/usr/lib /usr/local/lib /usr/local/ssl/lib" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) ;; + *) # Look for libcrypto.a and libssl.a: + for i in $ans no + do + test -f $i/libcrypto.a -a -f $i/libssl.a && break + done + case "$i" in + no) + ans=no + OPENSSL_LIB= + ;; + *) ans=$i + OPENSSL_LIB=$ans + ;; + esac + ;; +esac +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(for openssl include directory) +AC_ARG_WITH(openssl-incdir, + AC_HELP_STRING([--with-openssl-incdir], [+ =/something/reasonable]), +[ans=$withval], [ans=yes]) +case "$ans" in + no) ;; + yes) # look in: + ans="/usr/include /usr/local/include /usr/local/ssl/include" + ;; + *) # Look where they said + ;; +esac +case "$ans" in + no) ;; + *) # look for openssl/opensslconf.h: + for i in $ans no + do + test -f $i/openssl/opensslconf.h && break + done + case "$i" in + no) + ans=no + OPENSSL_INC= + ;; + *) ans=$i + OPENSSL_INC=$ans + ;; + esac + ;; +esac +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(for the level of crypto support) +AC_ARG_WITH(crypto, + AC_HELP_STRING([--with-crypto], [+ ={autokey,rsaref}]), +dnl AC_HELP_STRING([--with-crypto], [+ ={autokey,openssl,rsaref}]), +[ans=$withval], [ans=yes]) +case "$ans" in + no) ;; + yes|rsaref|openssl) + case "$ans" in + yes|rsaref) # Just "rsaref" when OpenSSL is ready + ans=no + ;; + *) + if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INC" + then + ans=no + else + # We have OpenSSL inc/lib - use them. + ans=openssl + CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC" + LDFLAGS="$LDFLAGS -L$OPENSSL_LIB" + LIBS="$LIBS -lcrypto" + AC_DEFINE(DES) + AC_DEFINE(OPENSSL, , [Use OpenSSL?]) + AC_DEFINE(PUBKEY, , [Public key?]) + fi + ;; + esac + + case "$ans" in + no) + if test -f $srcdir/rsaref2/source/digit.c + then + ans=rsaref + RSAOBJS=digit.o + RSASRCS="digit.c digit.h" + RSADIR=rsaref2 + fi + if test -f $srcdir/rsaeuro1/source/rsaeuro.h + then + ans=rsaref + RSAOBJS="md4c.o shsc.o" + RSASRCS="md4c.c shsc.c" + RSADIR=rsaeuro1 + fi + if test "$ans" = "rsaref"; then + LIBRSAREF=../librsaref/librsaref.a + MAKE_LIBRSAREF=librsaref.a + AC_DEFINE(DES) + AC_DEFINE(PUBKEY) + AC_DEFINE(RSAREF, , [Use RSAREF?]) + fi + ;; + esac + ;; +esac +AC_SUBST(AUTOKEY) +case "$ans" in + no) ;; + *) + AC_DEFINE(AUTOKEY, , [Autokey?]) + AUTOKEY=1 + ;; +esac +AC_MSG_RESULT($ans) + +AC_MSG_CHECKING(if we want to compile with ElectricFence) +AC_ARG_WITH(electricfence, [ --with-electricfence - compile with ElectricFence malloc debugger], +[ans=$withval], [ans=no]) +case "$ans" in + no) ;; + *) + LIBS="$LIBS \${top_builddir}/ElectricFence/libefence.a" + EF_PROGS="eftest tstheap" + AC_SUBST(EF_PROGS) + EF_LIBS=libefence.a + AC_SUBST(EF_LIBS) ans=yes - LIBRSAREF=../librsaref/librsaref.a - MAKE_LIBRSAREF=librsaref.a - AC_DEFINE(DES) -fi + ;; +esac AC_MSG_RESULT($ans) AC_SUBST(TESTDCF) @@ -2263,15 +2468,13 @@ AC_SUBST(CLKTEST) dnl Set to "clktest" AC_SUBST(MAKE_ADJTIMED) AC_MSG_CHECKING(if we want HP-UX adjtimed support) -changequote(<<, >>)dnl case "$target" in - *-*-hpux[56789]*) + *-*-hpux[[56789]]*) ans=yes ;; *) ans=no ;; esac -changequote([, ])dnl if test "$ans" = "yes"; then MAKE_ADJTIMED=adjtimed AC_DEFINE(NEED_HPUX_ADJTIME) @@ -2281,8 +2484,7 @@ AC_MSG_RESULT($ans) AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem, [AC_ARG_ENABLE(kmem, [ --enable-kmem s read /dev/kmem for tick and/or tickadj], [ans=$enableval], - [changequote(<<, >>)dnl - case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in + [case "$ac_cv_func_nlist$ac_cv_func_K_open$ac_cv_func_kvm_open" in *yes*) ans=yes ;; @@ -2299,7 +2501,7 @@ AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem, *-*-hpux*) #ans=no ;; - *-*-irix[456]*) + *-*-irix[[456]]*) ans=no ;; *-*-linux*) @@ -2309,7 +2511,6 @@ AC_CACHE_CHECK(if we can read kmem, ac_cv_var_can_kmem, ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_can_kmem=$ans]) @@ -2322,15 +2523,14 @@ AC_CACHE_CHECK(if adjtime is accurate, ac_cv_var_adjtime_is_accurate, [AC_ARG_ENABLE(accurate-adjtime, [ --enable-accurate-adjtime s the adjtime() call is accurate], [ans=$enableval], - [changequote(<<, >>)dnl - case "$target" in + [case "$target" in i386-sequent-ptx*) ans=no ;; i386-unknown-osf1*) ans=yes ;; - mips-sgi-irix[456]*) + mips-sgi-irix[[456]]*) ans=yes ;; *-fujitsu-uxp*) @@ -2342,7 +2542,7 @@ AC_CACHE_CHECK(if adjtime is accurate, ac_cv_var_adjtime_is_accurate, *-*-linux*) ans=yes ;; - *-*-solaris2.[01]*) + *-*-solaris2.[[01]]*) ans=no ;; *-*-solaris2*) @@ -2351,7 +2551,6 @@ AC_CACHE_CHECK(if adjtime is accurate, ac_cv_var_adjtime_is_accurate, *) ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_adjtime_is_accurate=$ans]) case "$ac_cv_var_adjtime_is_accurate" in @@ -2360,25 +2559,24 @@ esac AC_CACHE_CHECK([the name of 'tick' in the kernel], ac_cv_var_nlist_tick, -[changequote(<<, >>)dnl -ans=_tick +[ans=_tick case "$target" in m68*-hp-hpux*) # HP9000/300? ans=_old_tick ;; - *-apple-aux[23]*) + *-apple-aux[[23]]*) ans=tick ;; *-hp-hpux*) ans=old_tick ;; - *-ibm-aix[34]*) + *-ibm-aix[[34]]*) ans=no ;; *-*-ptx*) ans=tick ;; - *-*-sco3.2v[45]*) + *-*-sco3.2v[[45]]*) ans=no ;; *-*-solaris2*) @@ -2388,7 +2586,6 @@ case "$target" in ans=tick ;; esac -changequote([, ])dnl ac_cv_var_nlist_tick=$ans]) case "$ac_cv_var_nlist_tick" in ''|no) ;; # HMS: I think we can only get 'no' here... @@ -2397,14 +2594,12 @@ esac # AC_CACHE_CHECK([for the units of 'tick'], ac_cv_var_tick_nano, -[changequote(<<, >>)dnl -ans=usec +[ans=usec case "$target" in *-*-solaris2*) ans=nsec ;; esac -changequote([, ])dnl ac_cv_var_tick_nano=$ans]) case "$ac_cv_var_tick_nano" in nsec) @@ -2414,13 +2609,12 @@ esac # AC_CACHE_CHECK([the name of 'tickadj' in the kernel], ac_cv_var_nlist_tickadj, -[changequote(<<, >>)dnl -ans=_tickadj +[ans=_tickadj case "$target" in m68*-hp-hpux*) # HP9000/300? ans=_tickadj ;; - *-apple-aux[23]*) + *-apple-aux[[23]]*) ans=tickadj ;; *-hp-hpux10*) @@ -2451,7 +2645,6 @@ case "$target" in ans=tickadj ;; esac -changequote([, ])dnl ac_cv_var_nlist_tickadj=$ans]) case "$ac_cv_var_nlist_tickadj" in ''|no) ;; # HMS: I think we can only get 'no' here... @@ -2460,14 +2653,12 @@ esac # AC_CACHE_CHECK([for the units of 'tickadj'], ac_cv_var_tickadj_nano, -[changequote(<<, >>)dnl -ans=usec +[ans=usec case "$target" in *-*-solaris2*) ans=nsec ;; esac -changequote([, ])dnl ac_cv_var_tickadj_nano=$ans]) case "$ac_cv_var_tickadj_nano" in nsec) @@ -2477,9 +2668,8 @@ esac # AC_CACHE_CHECK([half-heartedly for 'dosynctodr' in the kernel], ac_cv_var_nlist_dosynctodr, -[changequote(<<, >>)dnl -case "$target" in - *-apple-aux[23]*) +[case "$target" in + *-apple-aux[[23]]*) ans=no ;; *-sni-sysv*) @@ -2513,7 +2703,6 @@ case "$target" in ans=_dosynctodr ;; esac -changequote([, ])dnl ac_cv_var_nlist_dosynctodr=$ans]) case "$ac_cv_var_nlist_dosynctodr" in no) ;; @@ -2523,9 +2712,8 @@ esac # AC_CACHE_CHECK([half-heartedly for 'noprintf' in the kernel], ac_cv_var_nlist_noprintf, -[changequote(<<, >>)dnl -case "$target" in - *-apple-aux[23]*) +[case "$target" in + *-apple-aux[[23]]*) ans=no ;; *-sni-sysv*) @@ -2553,7 +2741,6 @@ case "$target" in ans=_noprintf ;; esac -changequote([, ])dnl ac_cv_var_nlist_noprintf=$ans]) case "$ac_cv_var_nlist_noprintf" in no) ;; @@ -2703,22 +2890,44 @@ case "$ac_cv_var_can_kmem$ac_cv_var_tick$ac_cv_var_tickadj" in ;; esac +AC_SUBST(MAKE_NTPTIME) +AC_CACHE_CHECK(if we want and can make the ntptime utility, ac_cv_make_ntptime, +[case "$target" in + *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in + yesyes) + ans=yes + ;; + *) + ans=no + ;; + esac + ;; +esac +ac_cv_make_ntptime=$ans]) +case "$ac_cv_make_ntptime" in + yes) + MAKE_NTPTIME=ntptime + ;; +esac + +AC_SUBST(MAKE_TICKADJ) case "$target" in mips-sni-sysv4*) # tickadj is pretty useless on newer versions of ReliantUNIX # Do not bother ac_cv_make_tickadj=no - ;; + ;; + *-*-irix*) + ac_cv_make_tickadj=no + ;; *-*-solaris2*) # DLM says tickadj is a no-no starting with solaris2.5 case "$target" in *-*-solaris2.[0-4]*) ;; *) ac_cv_make_tickadj=no ;; esac - ;; + ;; esac - -AC_SUBST(MAKE_TICKADJ) AC_CACHE_CHECK(if we want and can make the tickadj utility, ac_cv_make_tickadj, ac_cv_make_tickadj=yes) case "$ac_cv_make_tickadj" in @@ -2727,23 +2936,19 @@ case "$ac_cv_make_tickadj" in ;; esac -AC_SUBST(MAKE_NTPTIME) -AC_CACHE_CHECK(if we want and can make the ntptime utility, ac_cv_make_ntptime, +AC_SUBST(MAKE_TIMETRIM) +AC_CACHE_CHECK(if we want and can make the timetrim utility, ac_cv_make_timetrim, [case "$target" in - *) case "$ac_cv_struct_ntptimeval$ac_cv_var_kernel_pll" in - yesyes) - ans=yes - ;; - *) - ans=no - ;; - esac + *-*-irix*) + ac_cv_make_timetrim=yes ;; -esac -ac_cv_make_ntptime=$ans]) -case "$ac_cv_make_ntptime" in + *) + ac_cv_make_timetrim=no + ;; +esac]) +case "$ac_cv_make_timetrim" in yes) - MAKE_NTPTIME=ntptime + MAKE_TIMETRIM=timetrim ;; esac @@ -2814,12 +3019,11 @@ esac AC_CACHE_CHECK(if we should always slew the time, ac_cv_var_slew_always, [AC_ARG_ENABLE(slew-always, [ --enable-slew-always s always slew the time], [ans=$enableval], - [changequote(<<, >>)dnl - case "$target" in - *-apple-aux[23]*) + [case "$target" in + *-apple-aux[[23]]*) ans=yes ;; - *-*-bsdi[012]*) + *-*-bsdi[[012]]*) ans=no ;; *-*-bsdi*) @@ -2831,7 +3035,6 @@ AC_CACHE_CHECK(if we should always slew the time, ac_cv_var_slew_always, *) ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_slew_always=$ans]) case "$ac_cv_var_slew_always" in @@ -2841,8 +3044,7 @@ esac AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew, [AC_ARG_ENABLE(step-slew, [ --enable-step-slew s step and slew the time], [ans=$enableval], - [changequote(<<, >>)dnl - case "$target" in + [case "$target" in *-sni-sysv*) ans=yes ;; @@ -2852,7 +3054,7 @@ AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew, *-*-ptx*) ans=yes ;; - *-*-solaris2.[012]*) + *-*-solaris2.[[012]]*) ans=yes ;; *-*-sysv4*) # HMS: Does this catch Fujitsu UXP? @@ -2861,7 +3063,6 @@ AC_CACHE_CHECK(if we should step and slew the time, ac_cv_var_step_slew, *) ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_step_slew=$ans]) case "$ac_cv_var_step_slew" in @@ -2871,15 +3072,13 @@ esac AC_CACHE_CHECK(if ntpdate should step the time, ac_cv_var_ntpdate_step, [AC_ARG_ENABLE(ntpdate-step, [ --enable-ntpdate-step s if ntpdate should step the time], [ans=$enableval], - [changequote(<<, >>)dnl - case "$target" in - *-apple-aux[23]*) + [case "$target" in + *-apple-aux[[23]]*) ans=yes ;; *) ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_ntpdate_step=$ans]) case "$ac_cv_var_ntpdate_step" in @@ -2908,15 +3107,42 @@ esac AC_CACHE_CHECK(if we should avoid kernel FLL bug, ac_cv_var_kernel_fll_bug, [AC_ARG_ENABLE(kernel-fll-bug, [ --enable-kernel-fll-bug s if we should avoid a kernel FLL bug], [ans=$enableval], - [changequote(<<, >>)dnl - case "$target" in + [case "$target" in *-*-solaris2.6) - ans=yes + unamev=`uname -v` + case "$unamev" in + Generic_105181-*) + old_IFS="$IFS" + IFS="-" + set $unamev + IFS="$old_IFS" + if test "$2" -ge 17 + then + # Generic_105181-17 and higher + ans=no + else + ans=yes + fi + ;; + *) ans=yes + ;; + esac ;; *-*-solaris2.7) - case "`uname -v`" in - Generic_106541-07) - ans=no + unamev=`uname -v` + case "$unamev" in + Generic_106541-*) + old_IFS="$IFS" + IFS="-" + set $unamev + IFS="$old_IFS" + if test "$2" -ge 07 + then + # Generic_106541-07 and higher + ans=no + else + ans=yes + fi ;; *) ans=yes ;; @@ -2925,7 +3151,6 @@ AC_CACHE_CHECK(if we should avoid kernel FLL bug, ac_cv_var_kernel_fll_bug, *) ans=no ;; esac - changequote([, ])dnl ]) ac_cv_var_kernel_fll_bug=$ans]) case "$ac_cv_var_kernel_fll_bug" in @@ -2943,14 +3168,20 @@ case "$host" in ;; esac +AC_DEFINE_DIR(NTP_KEYSDIR, sysconfdir, [Default location of crypto key info]) + # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` -AC_OUTPUT(Makefile adjtimed/Makefile clockstuff/Makefile \ +AC_CONFIG_FILES(Makefile adjtimed/Makefile clockstuff/Makefile \ +ElectricFence/Makefile include/Makefile kernel/Makefile kernel/sys/Makefile libntp/Makefile \ libparse/Makefile librsaref/Makefile ntpd/Makefile ntpdc/Makefile \ ntpdate/Makefile ntpq/Makefile ntptrace/Makefile parseutil/Makefile \ -scripts/Makefile scripts/mkver scripts/ntpver util/Makefile, -[chmod +x scripts/ntpver scripts/mkver]) +scripts/Makefile scripts/calc_tickadj scripts/checktime scripts/freq_adj \ +scripts/mkver scripts/ntp-wait scripts/ntpsweep scripts/ntpver \ +scripts/plot_summary scripts/summary util/Makefile) +AC_CONFIG_COMMANDS(default, [[chmod +x scripts/calc_tickadj scripts/checktime scripts/freq_adj scripts/mkver scripts/ntp-wait scripts/ntpsweep scripts/ntpver scripts/plot_summary scripts/summary]], []) +AC_OUTPUT #test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h]) diff --git a/contrib/ntp/depcomp b/contrib/ntp/depcomp index 7906096..30f36ee8 100755 --- a/contrib/ntp/depcomp +++ b/contrib/ntp/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -# Copyright (C) 1999 Free Software Foundation, Inc. +# Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,6 +48,18 @@ if test "$depmode" = dashXmstdout; then fi case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! + if "$@" -MT "$object" -MF "$tmpdepfile" -MD -MP; then : + else + stat=$? + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: @@ -67,9 +79,12 @@ gcc) rm -f "$tmpdepfile" exit $stat fi - rm -f "$depfile" + rm -f "$depfile" echo "$object : \\" > "$depfile" - sed 's/^[^:]*: / /' < "$tmpdepfile" >> "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is @@ -94,41 +109,84 @@ hp) exit 1 ;; -dashmd) - # The Java front end to gcc doesn't run cpp, so we can't use the -Wp - # trick. Instead we must use -M and then rename the resulting .d - # file. This is also the case for older versions of gcc, which - # don't implement -Wp. - if "$@" -MD; then : +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" else - stat=$? - rm -f FIXME + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" exit $stat fi - FIXME: rewrite the file + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). + tr ' ' ' +' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr ' +' ' ' >> $depfile + + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" ;; -sgi) +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. + tmpdepfile=`echo "$object" | sed 's/\(.*\)\..*$/\1.u/'` if test "$libtool" = yes; then - "$@" "-Wc,-MDupdate,$tmpdepfile" + "$@" -Wc,-M else - "$@" -MDupdate "$tmpdepfile" + "$@" -M fi + stat=$? if test $stat -eq 0; then : else - stat=$? rm -f "$tmpdepfile" exit $stat fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed 's/^[^:]*: / /' < "$tmpdepfile" >> "$depfile" - tr ' ' ' + + if test -f "$tmpdepfile"; then + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). + tr ' ' ' +' < "$tmpdepfile" | sed 's/^[^\.]*\.o://' | tr ' +' ' ' >> $depfile + + tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi rm -f "$tmpdepfile" ;; @@ -166,7 +224,7 @@ dashmstdout) stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" + rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ @@ -210,7 +268,7 @@ makedepend) stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" + rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tail +3 "$tmpdepfile" | tr ' ' ' ' | \ @@ -229,7 +287,7 @@ cpp) *" --mode=compile "*) for arg do # cycle over the arguments - case "$arg" in + case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet @@ -243,7 +301,8 @@ cpp) ;; esac "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)"/ s::'"$object"'\: \1:p' > "$tmpdepfile" + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" @@ -251,8 +310,47 @@ cpp) wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed < "$tmpdepfile" -e 's/^[^:]*: //' -e 's/$/ :/' >> "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; diff --git a/contrib/ntp/flock-build b/contrib/ntp/flock-build new file mode 100755 index 0000000..5e2bb0c --- /dev/null +++ b/contrib/ntp/flock-build @@ -0,0 +1,45 @@ +#! /bin/sh + +BUILD_ARGS="$@" +PARSE="--enable-parse-clocks" +#PARSE= + +# * baldwin sparc-sun-solaris2.7 +# bridgeport sparc-sun-solaris2.6 +# bunnylou alpha-dec-osf4.0 +# * churchy alpha-dec-osf4.0 +# cowbird alpha-dec-osf4.0 +# grundoon sparc-sun-sunos4.1.3 +# * hepzibah freebsd-2.2.5 +# malarky sparc-sun-solaris2.8 +# * pogo sparc-sun-solaris2.8 +# * porkypine mips-dec-ultrix4.4 +# * rackety sparc-sun-sunos4.1.3/cc +# * snavely hppa1.1-hp-hpux10.20 +# whimsy sparc-sun-solaris2.7 + +c_d=`pwd` + +SIG=`perl -e 'print rand'` +echo $SIG > .buildkey + +case "$LIST" in + '') LIST="baldwin churchy hepzibah pogo porkypine rackety snavely" ;; +esac + +for i in $LIST +do + echo $i + case "1" in + 0) + ssh $i "cd $c_d ; ./build $SIG $PARSE $BUILD_ARGS" & + ssh $i "cd $c_d ; ./build $SIG $PARSE --with-crypto=autokey $BUILD_ARGS" & + ssh $i "cd $c_d ; ./build $SIG $PARSE --without-crypto $BUILD_ARGS" & + ;; + 1) ssh $i "cd $c_d ; \ +./build $SIG $PARSE $BUILD_ARGS ; \ +./build $SIG $PARSE --with-crypto=autokey $BUILD_ARGS ; \ +./build $SIG $PARSE --without-crypto $BUILD_ARGS" & + ;; + esac +done diff --git a/contrib/ntp/html/Oncore-SHMEM.htm b/contrib/ntp/html/Oncore-SHMEM.htm new file mode 100644 index 0000000..3148f6a --- /dev/null +++ b/contrib/ntp/html/Oncore-SHMEM.htm @@ -0,0 +1,257 @@ +<HTML> +<HEAD> + <TITLE> ONCORE - SHMEM </TITLE> +</HEAD> +<BODY> +<H3> +Motorola ONCORE - The Shared Memory Interface +</H3> +<HR> + +<H4> +Introduction +</H4> + +<P> +In NMEA mode, the Oncore GPS receiver provides the user with the same information as +other GPS receivers. +In BINARY mode, it can provide a lot of additional information. +<P> +In particular, you can ask for satellite positions, satellite health, signal levels, +the ephemeris and the almanac, and you can set many operational parameters. +In the case of the VP, +you can get the pseudorange corrections necessary to act as a DGPS base station, and you can see +the raw satellite data messages themselves. +<P> +When using the Oncore GPS receiver with NTP, this additional information is usually +not available since the receiver is only talking to the oncore driver in NTPD. +To make this information available for use in other programs, +(say graphic displays of satellites positions, plots of SA, etc.), a shared memory interface +(SHMEM) has been added to the refclock_oncore driver on those operating systems that support +shared memory. +<P> +To make use of this information you will need an Oncore Reference Manual for the +Oncore GPS receiver that you have. The Manual for the VP only exists as a paper +document, the UT manuals are available as a pdf document online. +<P> +This interface was written by Poul-Henning Kamp (phk@FreeBSD.org), and modified by +Reg Clemens (reg@dwf.com). +The interface is known to work in FreeBSD, Linux, and Solaris. +<H4> +Activating the Interface +</H4> +Although the Shared Memory Interface will be compiled into the Oncore driver +on those systems where Shared Memory is supported, to activate this interface you must +include a <B>STATUS</B> line in the <tt>/etc/ntp.oncore</tt> data file that looks like +<PRE> + STATUS < file_name > +</PRE> +Thus a line like +<PRE> + STATUS /var/adm/ntpstats/ONCORE +</PRE> +would be acceptable. +This file name will be used to access the Shared Memory. +<P> +In addition, one the two keywords <B>Posn2D</B> and <B>Posn3D</B> can be added to +see @@Ea records containing the 2D or 3D position of the station (see below). +Thus to activate the interface, and see 3D positions, something like +<PRE> + STATUS /var/adm/ntpstats/ONCORE + Posn3D +</PRE> +would be required. +<H4> +Storage of Messages in Shared Memory +</H4> +With the shared memory interface, the oncore driver (refclock_oncore) allocates space +for all of the messages that it is configured to receive, and then puts each message +in the appropriate slot in shared memory as it arrives from the receiver. +Since there is no easy way for a client program to know when the shared memory has +been updated, +a sequence number is associated with each message, and is incremented when a new message +arrives. +With the sequence number it is easy to check through the shared memory segment for messages that +have changed. +<P> +The Oncore binary messages are kept in their full length, as described in the Reference +manual, that is everything from the @@ prefix thru the <checksum><CR><LF>. +<P> +The data starts at location ONE of SHMEM (NOT location ZERO). +<P> +The messages are stacked in a series of variable length structures, that look like +<PRE> + struct message { + u_int length; + u_char sequence; + u_char message[length]; + } +</PRE> +<P> +if something like that were legal. +That is, there are two bytes (caution, these may NOT be aligned with word boundaries, so +the field needs to be treated as a pair of u_char), that contains the length of the next +message. +This is followed by a u_char sequence number, that is incremented whenever a new message of +this type is received. +This is followed by 'length' characters of the actual message. +<P> +The next structure starts immediately following the last char of the previous message (no alignment). +Thus, each structure starts a distance of 'length+3' from the previous structure. +<P> +Following the last structure, is a u_int containing a zero length to indicate the end +of the data. +<P> +The messages are recognized by reading the headers in the data itself, viz @@Ea or whatever. +<P> +There are two special cases. +<P> +(1) The almanac takes a total of 34 submessages all starting with @@Cb. <br> +35 slots are allocated in shared memory. +Each @@Cb message is initially placed in the first of these locations, +and then later it is moved to the appropriate location for that submessage. +The submessages can be distinguished by the first two characters following the @@Cb header, +and new data is received only when the almanac changes. +<P> +(2) The @@Ea message contains the calculated location of the antenna, and is received +once per second. +However, when in timekeeping mode, the receiver is normally put in 0D mode, with the +position fixed, to get better accuracy. +In 0D mode no position is calculated. +<P> +When the SHMEM option is active, +and if one of <B>Posn2D</B> or <B>Posn3D</B> is specified, +one @@Ea record is hijacked each 15s, and the receiver +is put back in 2D/3D mode so the the current location can be determined (for position determination, or for +tracking SA). +The timekeeping code is careful NOT to use the time associated with this (less accurate) 2D/3D tick +in its timekeeping functions. +<P> +Following the initial @@Ea message are 3 additional slots for a total of four. +As with the almanac, the first gets filled each time a new record becomes available, +later in the code, the message is distributed to the appropriate slot. +The additional slots are for messages containing 0D, 2D and 3D positions. +These messages can be distinguished by different bit patterns in the last data byte of the record. +<H4> +Opening the Shared Memory File +</H4> +The shared memory segment is accessed through a file name given on a <B>ACCESS</B> card in the +<tt>/etc/ntp.oncore</tt> input file. +The following code could be used to open the Shared Memory Segment: + +<PRE> + char *Buf, *file; + int size, fd; + struct stat statbuf; + + file = "/var/adm/ntpstats/ONCORE"; /* the file name on my ACCESS card */ + if ((fd=open(file, O_RDONLY)) < 0) { + fprintf(stderr, "Cant open %s\n", file); + exit(1); + } + + if (stat(file, &statbuf) < 0) { + fprintf(stderr, "Cant stat %s\n", file); + exit(1); + } + + size = statbuf.st_size; + if ((Buf=mmap(0, size, PROT_READ, MAP_SHARED, fd, (off_t) 0)) < 0) { + fprintf(stderr, "MMAP failed\n"); + exit(1); + } +</PRE> + +<H4> +Accessing the data +</H4> +The following code shows how to get to the individual records. + +<PRE> + void oncore_msg_Ea(), oncore_msg_As(), oncore_msg_Bb(); + + struct Msg { + char c[5]; + unsigned int seq; + void (*go_to)(uchar *); + }; + + struct Msg Hdr[] = { {"@@Bb", 0, &oncore_msg_Bb}, + {"@@Ea", 0, &oncore_msg_Ea}, + {"@@As", 0, &oncore_msg_As}}; + + void + read_data() + { + int i, j, k, n, iseq, jseq; + uchar *cp, *cp1; + + + for(cp=Buf+1; (n = 256*(*cp) + *(cp+1)) != 0; cp+=(n+3)) { + for (k=0; k < sizeof(Hdr)/sizeof(Hdr[0]); k++) { + if (!strncmp(cp+3, Hdr[k].c, 4)) { /* am I interested? */ + iseq = *(cp+2); + jseq = Hdr[k].seq; + Hdr[k].seq = iseq; + if (iseq > jseq) { /* has it changed? */ + /* verify checksum */ + j = 0; + cp1 = cp+3; /* points to start of oncore response */ + for (i=2; i < n-3; i++) + j ^= cp1[i]; + if (j == cp1[n-3]) { /* good checksum */ + Hdr[k].go_to(cp1); + } else { + fprintf(stderr, "Bad Checksum for %s\n", Hdr[k].c); + break; + } + } + } + } + if (!strncmp(cp+3, "@@Ea", 4)) + cp += 3*(n+3); + if (!strncmp(cp+3, "@@Cb", 4)) + cp += 34*(n+3); + } + } + + oncore_msg_Bb(uchar *buf) + { + /* process Bb messages */ + } + + oncore_msg_Ea(uchar *buf) + { + /* process Ea messages */ + } + + oncore_msg_As(uchar *buf) + { + /* process As messages */ + } +</PRE> + +The structure Hdr contains the Identifying string for each of the messages that +we want to examine, and the name of a program to call when a new message of that +type is arrives. +The loop can be run every few seconds to check for new data. +<H4> +Examples +</H4> +There are two complete examples available. +The first plots satellite positions and the station position as affected by SA, and +keeps track of the mean station position, so you can run it for periods of days +to get a better station position. +The second shows the effective horizon by watching satellite tracks. +The examples will be found in the GNU-zipped tar file +<A HREF=ftp://ftp.udel.edu/pub/ntp/software/OncorePlot.tar.gz> +ftp://ftp.udel.edu/pub/ntp/software/OncorePlot.tar.gz</A>. +<P> +Try the new interface, enjoy. +<HR> +<ADDRESS> +Reg.Clemens (reg@dwf.com), +Poul-Henning Kamp (phk@FreeBSD.org) +<ADDRESS> +</BODY> +</HTML> diff --git a/contrib/ntp/html/accopt.htm b/contrib/ntp/html/accopt.htm index d64a0d1..b0f5a9d 100644 --- a/contrib/ntp/html/accopt.htm +++ b/contrib/ntp/html/accopt.htm @@ -1,219 +1,210 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Access Control Options -</TITLE> -</HEAD> -<BODY> - -<H3> -Access Control Options</H3> - -<HR> -<H4> -Access Control Support</H4> -<TT>ntpd</TT> implements a general purpose address-and-mask based restriction -list. The list is sorted by address and by mask, and the list is searched -in this order for matches, with the last match found defining the restriction -flags associated with the incoming packets. The source address of incoming -packets is used for the match, with the 32-bit address being and'ed with -the mask associated with the restriction entry and then compared with the -entry's address (which has also been and'ed with the mask) to look for -a match. Additional information and examples can be found in the <A HREF="notes.htm">Notes -on Configuring NTP and Setting up a NTP Subnet </A>page. - -<P>The restriction facility was implemented in conformance with the access -policies for the original NSFnet backbone time servers. While this facility -may be otherwise useful for keeping unwanted or broken remote time servers -from affecting your own, it should not be considered an alternative to -the standard NTP authentication facility. Source address based restrictions -are easily circumvented by a determined cracker. -<H4> -Access Control Commands</H4> - -<DL> -<DT> -<TT>restrict <I>numeric_address</I> [mask <I>numeric_mask</I>] [<I>flag</I>] -[...]</TT></DT> - -<DD> -The <I><TT>numeric_address</TT></I> argument, expressed in dotted-quad -form, is the address of an host or network. The <I><TT>mask</TT></I> argument, -also expressed in dotted-quad form, defaults to <TT>255.255.255.255</TT>, -meaning that the <I><TT>numeric_address</TT></I> is treated as the address -of an individual host. A default entry (address <TT>0.0.0.0</TT>, mask -<TT>0.0.0.0</TT>) is always included and, given the sort algorithm, is -always the first entry in the list. Note that, while <I><TT>numeric_address</TT></I> -is normally given in dotted-quad format, the text string <TT>default</TT>, -with no mask option, may be used to indicate the default entry.</DD> - -<DD> -In the current implementation, <I><TT>flag</TT></I> always restricts access, -i.e., an entry with no flags indicates that free access to the server is -to be given. The flags are not orthogonal, in that more restrictive flags -will often make less restrictive ones redundant. The flags can generally -be classed into two catagories, those which restrict time service and those -which restrict informational queries and attempts to do run-time reconfiguration -of the server. One or more of the following flags may be specified:</DD> - -<DD> - </DD> - -<DL> -<DT> -<TT>ignore</TT></DT> - -<DD> -Ignore all packets from hosts which match this entry. If this flag is specified -neither queries nor time server polls will be responded to.</DD> - -<DD> - </DD> - -<DT> -<TT>noquery</TT></DT> - -<DD> -Ignore all NTP mode 6 and 7 packets (i.e. information queries and configuration -requests) from the source. Time service is not affected.</DD> - -<DD> - </DD> - -<DT> -<TT>nomodify</TT></DT> - -<DD> -Ignore all NTP mode 6 and 7 packets which attempt to modify the state of -the server (i.e. run time reconfiguration). Queries which return information -are permitted.</DD> - -<DD> - </DD> - -<DT> -<TT>notrap</TT></DT> - -<DD> -Decline to provide mode 6 control message trap service to matching hosts. -The trap service is a subsystem of the mode 6 control message protocol -which is intended for use by remote event logging programs.</DD> - -<DD> - </DD> - -<DT> -<TT>lowpriotrap</TT></DT> - -<DD> -Declare traps set by matching hosts to be low priority. The number of traps -a server can maintain is limited (the current limit is 3). Traps are usually -assigned on a first come, first served basis, with later trap requestors -being denied service. This flag modifies the assignment algorithm by allowing -low priority traps to be overridden by later requests for normal priority -traps.</DD> - -<DD> - </DD> - -<DT> -<TT>noserve</TT></DT> - -<DD> -Ignore NTP packets whose mode is other than 6 or 7. In effect, time service -is denied, though queries may still be permitted.</DD> - -<DD> - </DD> - -<DT> -<TT>nopeer</TT></DT> - -<DD> -Provide stateless time service to polling hosts, but do not allocate peer -memory resources to these hosts even if they otherwise might be considered -useful as future synchronization partners.</DD> - -<DD> - </DD> - -<DT> -<TT>notrust</TT></DT> - -<DD> -Treat these hosts normally in other respects, but never use them as synchronization -sources.</DD> - -<DD> - </DD> - -<DT> -<TT>limited</TT></DT> - -<DD> -These hosts are subject to limitation of number of clients from the same -net. Net in this context refers to the IP notion of net (class A, class -B, class C, etc.). Only the first <TT>client_limit</TT> hosts that have -shown up at the server and that have been active during the last <TT>client_limit_period</TT> -seconds are accepted. Requests from other clients from the same net are -rejected. Only time request packets are taken into account. Query packets -sent by the <TT>ntpq</TT> and <TT>ntpdc</TT> programs are not subject to -these limits. A history of clients is kept using the monitoring capability -of <TT>ntpd</TT>. Thus, monitoring is always active as long as there is -a restriction entry with the <TT>limited</TT> flag.</DD> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Access Control Options</title> +</head> +<body> +<h3>Access Control Options</h3> + +<img align="left" src="pic/pogo6.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>The skunk watches for intruders and sprays.<br clear="left"> +</p> + +<hr> +<h4>Access Control Support</h4> + +<tt>ntpd</tt> implements a general purpose address-and-mask based +restriction list. The list is sorted by address and by mask, and +the list is searched in this order for matches, with the last match +found defining the restriction flags associated with the incoming +packets. The source address of incoming packets is used for the +match, with the 32- bit address being and'ed with the mask +associated with the restriction entry and then compared with the +entry's address (which has also been and'ed with the mask) to look +for a match. Additional information and examples can be found in +the <a href="notes.htm">Notes on Configuring NTP and Setting up a +NTP Subnet</a> page. + +<p>The restriction facility was implemented in conformance with the +access policies for the original NSFnet backbone time servers. +While this facility may be otherwise useful for keeping unwanted or +broken remote time servers from affecting your own, it should not +be considered an alternative to the standard NTP authentication +facility. Source address based restrictions are easily circumvented +by a determined cracker.</p> + +<h4>The Kiss-of-Death Packet</h4> + +<p>Ordinarily, packets denied service are simply dropped with no +further action except incrementing statistics counters. Sometimes a +more proactive response is needed, such as a server message that +explicitly requests the client to stop sending and leave a message +for the system operator. A special packet format has been created +for this purpose called the kiss-of-death packet. If the <tt> +kod</tt> flag is set and either service is denied or the client +limit is exceeded, the server it returns the packet and sets the +leap bits unsynchronized, stratum zero and the ASCII string "DENY" +in the reference source identifier field. If the <tt>kod</tt> flag +is not set, the server simply drops the packet.</p> + +<p>A client or peer receiving a kiss-of-death packet performs a set +of sanity checks to minimize security exposure. If this is the +first packet received from the server, the client assumes an access +denied condition at the server. It updates the stratum and +reference identifier peer variables and sets the access denied +(test 4) bit in the peer flash variable. If this bit is set, the +client sends no packets to the server. If this is not the first +packet, the client assumes a client limit condition at the server, +but does not update the peer variables. In either case, a message +is sent to the system log.</p> + +<h4>Access Control Commands</h4> + +<dl> +<dt><tt>restrict <i>numeric_address</i> [mask <i>numeric_mask</i>] +[<i>flag</i>][...]</tt></dt> + +<dd>The <i><tt>numeric_address</tt></i> argument, expressed in +dotted- quad form, is the address of an host or network. The <i> +<tt>mask</tt></i> argument, also expressed in dotted-quad form, +defaults to <tt>255.255.255.255</tt>, meaning that the <i><tt> +numeric_address</tt></i> is treated as the address of an individual +host. A default entry (address <tt>0.0.0.0</tt>, mask <tt> +0.0.0.0</tt>) is always included and, given the sort algorithm, is +always the first entry in the list. Note that, while <i><tt> +numeric_address</tt></i> is normally given in dotted-quad format, +the text string <tt>default</tt>, with no mask option, may be used +to indicate the default entry.</dd> + +<dd>In the current implementation, <i><tt>flag</tt></i> always +restricts access, i.e., an entry with no flags indicates that free +access to the server is to be given. The flags are not orthogonal, +in that more restrictive flags will often make less restrictive +ones redundant. The flags can generally be classed into two +catagories, those which restrict time service and those which +restrict informational queries and attempts to do run-time +reconfiguration of the server. One or more of the following flags +may be specified:</dd> + +<dd> +<dl> +<dt><tt>kod</tt></dt> + +<dd>If access is denied, send a kiss-of-death packet.</dd> + +<dt><tt>ignore</tt></dt> + +<dd>Ignore all packets from hosts which match this entry. If this +flag is specified neither queries nor time server polls will be +responded to.</dd> + +<dt><tt>noquery</tt></dt> + +<dd>Ignore all NTP mode 6 and 7 packets (i.e. information queries +and configuration requests) from the source. Time service is not +affected.</dd> + +<dt><tt>nomodify</tt></dt> + +<dd>Ignore all NTP mode 6 and 7 packets which attempt to modify the +state of the server (i.e. run time reconfiguration). Queries which +return information are permitted.</dd> + +<dt><tt>notrap</tt></dt> + +<dd>Decline to provide mode 6 control message trap service to +matching hosts. The trap service is a subsystem of the mode 6 +control message protocol which is intended for use by remote event +logging programs.</dd> + +<dt><tt>lowpriotrap</tt></dt> + +<dd>Declare traps set by matching hosts to be low priority. The +number of traps a server can maintain is limited (the current limit +is 3). Traps are usually assigned on a first come, first served +basis, with later trap requestors being denied service. This flag +modifies the assignment algorithm by allowing low priority traps to +be overridden by later requests for normal priority traps.</dd> + +<dt><tt>noserve</tt></dt> + +<dd>Ignore NTP packets whose mode is other than 6 or 7. In effect, +time service is denied, though queries may still be permitted.</dd> + +<dt><tt>nopeer</tt></dt> + +<dd>Provide stateless time service to polling hosts, but do not +allocate peer memory resources to these hosts even if they +otherwise might be considered useful as future synchronization +partners.</dd> + +<dt><tt>notrust</tt></dt> + +<dd>Treat these hosts normally in other respects, but never use +them as synchronization sources.</dd> + +<dt><tt>limited</tt></dt> + +<dd>These hosts are subject to limitation of number of clients from +the same net. Net in this context refers to the IP notion of net +(class A, class B, class C, etc.). Only the first <tt> +client_limit</tt> hosts that have shown up at the server and that +have been active during the last <tt>client_limit_period</tt> +seconds are accepted. Requests from other clients from the same net +are rejected. Only time request packets are taken into account. +Query packets sent by the <tt>ntpq</tt> and <tt>ntpdc</tt> programs +are not subject to these limits. A history of clients is kept using +the monitoring capability of <tt>ntpd</tt>. Thus, monitoring is +always active as long as there is a restriction entry with the <tt> +limited</tt> flag.</dd> + +<dt><tt>ntpport</tt></dt> + +<dd>This is actually a match algorithm modifier, rather than a +restriction flag. Its presence causes the restriction entry to be +matched only if the source port in the packet is the standard NTP +UDP port (123). Both <tt>ntpport</tt> and <tt>non-ntpport</tt> may +be specified. The <tt>ntpport</tt> is considered more specific and +is sorted later in the list.</dd> + +<dt><tt>version</tt></dt> + +<dd>Ignore these hosts if not the current NTP version.</dd> +</dl> +</dd> + +<dd>Default restriction list entries, with the flags <tt>ignore, +interface, ntpport</tt>, for each of the local host's interface +addresses are inserted into the table at startup to prevent the +server from attempting to synchronize to its own time. A default +entry is also always present, though if it is otherwise +unconfigured; no flags are associated with the default entry (i.e., +everything besides your own NTP server is unrestricted).</dd> + +<dt><tt>clientlimit <i>limit</i></tt></dt> + +<dd>Set the <tt>client_limit</tt> variable, which limits the number +of simultaneous access-controlled clients. The default value for +this variable is 3.</dd> + +<dt><tt>clientperiod <i>period</i></tt></dt> + +<dd>Set the <tt>client_limit_period</tt> variable, which specifies +the number of seconds after which a client is considered inactive +and thus no longer is counted for client limit restriction. The +default value for this variable is 3600 seconds.</dd> +</dl> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<DD> - </DD> - -<DT> -<TT>ntpport</TT></DT> - -<DD> -This is actually a match algorithm modifier, rather than a restriction -flag. Its presence causes the restriction entry to be matched only if the -source port in the packet is the standard NTP UDP port (123). Both <TT>ntpport</TT> -and <TT>non-ntpport</TT> may be specified. The <TT>ntpport</TT> is considered -more specific and is sorted later in the list.</DD> - -<DD> - </DD> -</DL> - -<DD> -Default restriction list entries, with the flags <TT>ignore, ntpport</TT>, -for each of the local host's interface addresses are inserted into the -table at startup to prevent the server from attempting to synchronize to -its own time. A default entry is also always present, though if it is otherwise -unconfigured; no flags are associated with the default entry (i.e., everything -besides your own NTP server is unrestricted).</DD> - -<DD> - </DD> - -<DT> -<TT>clientlimit <I>limit</I></TT></DT> - -<DD> -Set the <TT>client_limit</TT> variable, which limits the number of simultaneous -access-controlled clients. The default value for this variable is 3.</DD> - -<DD> - </DD> - -<DT> -<TT>clientperiod <I>period</I></TT></DT> - -<DD> -Set the <TT>client_limit_period</TT> variable, which specifies the number -of seconds after which a client is considered inactive and thus no longer -is counted for client limit restriction. The default value for this variable -is 3600 seconds.</DD> -</DL> - -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> diff --git a/contrib/ntp/html/assoc.htm b/contrib/ntp/html/assoc.htm index 69cb7bc..a56d122 100644 --- a/contrib/ntp/html/assoc.htm +++ b/contrib/ntp/html/assoc.htm @@ -1,170 +1,89 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Release Notes -</TITLE> -</HEAD> -<BODY> - -<H3> -Association Management</H3> - -<HR> -<H4> -Association Modes</H4> -This release of the NTP Version 4 (NTPv4) daemon for Unix incorporates -new features and refinements to the NTP Version 3 (NTPv3) algorithms. However, -it continues the tradition of retaining backwards compatibility with older -versions. The NTPv4 version has been under development for quite a while -and isn't finished yet. In fact, quite a number of NTPv4 features have -already been implemented in the current NTPv3, including a number of new -operating modes for automatic server discovery and improved accuracy in -occasionally-connected networks. Following is an extended abstract describing -the new features.. - -<P>An ephemeral association of some mode is mobilized when a message arrives -from another client or server. For instance, a symmetric-passive association -is mobilized upon arrival of a message from a symmetric- active peer. A -client association is mobilized upon arrival of a broadcast message from -a multicast server or a server message from a manycast server. Ephemeral -associations are demobilized when either (a) the server becomes unreachable -or (b) an error occurs on initial contact before the association is mobilized. - -<P>The one exception to (a) and (b) above is when -<TT><A HREF="authopt.htm">autokey</A></TT> is in use and the initial -authentication check fails due to unknown -key identifier or autokey mismatch. This exception is necessary because -the Unix kernel does not bind the local address until the first packet -is received. The result in broadcast mode is a rather painful initial exchange, -where authentication fails until after the first round of messages. The -result in multicast mode is in general fatal, especially if multiple interfaces -are in use. As promiscuous modes such as multicast and manycast require -authentication for reliable and safe operation, autokey is in general useless -with these modes until and if the input/output machinery is overhauled. - -<P>Following is a summary of the protocol operations for each mode. - -<P>Peer Modes (Active and Passive) -<UL>In these modes, two client/server peers agree to back each other up, -should the synchronization source for either peer fail. One or both peers -is configured in symmetric-active mode using the peer command. Alternatively, -one - the active peer - is configured in this mode and the other, the passive -peer, operates in symmetric-passive mode and requires no prior configuration. -Both association scenarios operate in NTPv4 as in NTPv3; however, several -bugs in the handling of keys and recovery of resources when an active peer -fails, have been corrected in NTPv4. The original NTPv3 authentication -scheme is applicable in this mode, as well as the new NTPv3 autokey scheme.</UL> -Client/Server Modes -<UL>In these modes, a client sends a request to the server and expects -a reply at some future time. The client is configured in client mode using -the server (sic) command; the server requires no prior configuration. The -original NTPv3 authentication scheme is applicable in this mode, as well -as the new NTPv3 autokey scheme.</UL> -Broadcast/Multicast Modes -<UL>In these modes, the server generates messages at intervals specified -by the minpoll subcommand. When using IP multicast addresses, the scope -of the multicast tree is specified by the ttl subcommand in hops. When -using a local interface broadcast address, the scope is limited to the -attached subnet. The client responds to the first message received by waiting -an interval randomized over the minpoll interval, in order to avoid implosions. -Then, it polls the server in burst mode, in order to accumulate data to -reliably set the host clock. This normally results in eight client/server -cycles over a 32-s interval. When the next multicast message is received, -the client computes the offset between the system clock just set and the -apparent time of the multicast message in order to correct the apparent -time in future multicast messages.</UL> -Manycast Mode -<UL>In this mode, a configured client broadcasts a request message as in -client mode to a designated multicast group address. All servers configured -as manycast clients and in ttl range respond with a server reply message. -Each reply mobilizes a persistent client/server association as in client -mode. Then, the NTP intersection and clustering algorithms act to discard -all but the "best" of these associations, which then continue as in client/server -mode.</UL> - -<H4> -Burst Mode</H4> -Burst mode can be configured when the network attachment requires an initial -calling or training procedure. Each poll initiates a burst of eight request -messages at intervals randomized over the range 3-5 s. The reply messages -update the clock filter, which then selects the best (most accurate) among -them. When the last reply in the burst is sent, the next reply updates -the client variables and system clock in the usual manner, as if only a -single request/reply cycle had occurred. This mode does produce additional -network overhead and can cause trouble if used indiscriminately. It should -only be used where the poll interval is expected to settle to values above -1024 s. -<H4> -Revised Error Checking</H4> -It is very important to avoid spurious mobilizations from possibly broken -or rogue servers; in particular, to avoid denial-of-service attacks. In -order to resist such attacks, arriving messages that might mobilize ephemeral -associations are carefully screened using a series of eleven sanity checks. -<OL> -<LI> -Duplicate packet. This message is a duplicate of one previously received.</LI> - -<BR> -<LI> -Bogus packet. This message did not result from a message previously sent, -or messages have been received out of order.</LI> - -<BR> -<LI> -Unsynchronized. The server has not yet stored the previous timestamps.</LI> - -<BR> -<LI> -Invalid delay or dispersion. Either the delay or dispersion or both computed -from the message timestamps are above the normal range.</LI> - -<BR> -<LI> -Authentication failed. The sent MAC does not match the received MAC, either -due to the wrong key material or damaged message.</LI> - -<BR> -<LI> -Server unsynchronized. The server indicates unsynchronized in the leap -bits included in the packet.</LI> - -<BR> -<LI> -Server stratum check. The server is operating at a stratum above the normal -range.</LI> - -<BR> -<LI> -Delay/dispersion check. The related server packet data values are above -the normal range.</LI> - -<BR> -<LI> -Autokey failed. The hash of the current session key does not match the -most recent key identifiers used. (The hash is repeated four times, in -order to recover from lost packets whenever possible.)</LI> - -<BR> -<LI> -Access denied. The sender has been blocked by the access control list.</LI> - -<BR> -<LI> -Key not found. The key identifier does not match any identifier in the -key list or the key has expired or been revoked.</LI> -</OL> -Failure to pass tests 5-11 is sufficient evidence to discard the packet -without forming an association. However, failure to pass tests 1-4 is not -necessarily grounds to reject the packet, since subsequent packets may -be acceptable. In this case, the association is mobilized, but only the -packet timestamps are stored. For the moment, and until the cryptographic -signature algorithm is available, test 9 is temporarily disabled. -<BR> -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -<BR> -</BODY> -</HTML> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html><title> +Association Management +</title></head><body><h3> +Association Management +</h3> + +<img align=left src=pic/alice51.gif alt="gif"><a href=http://www.eecis.udel.edu/~mills/pictures.htm> +from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>Make sure who your friends are. +<br clear=left><hr> + +<h4>Association Modes</h4> + +<p>NTP Version 4 (NTPv4) incorporates new features and refinements to the NTP Version 3 (NTPv3) algorithms; however, it continues the tradition of backwards compatibility with older versions. A number of new operating modes for automatic server discovery and improved accuracy in occasionally connected networks are provided. Following is an overview of the new features; additional information is available on the <a href=confopt.htm>Configuration Options</a> and <a href=authopt.htm>Authentication Options</a> pages and in the papers, reports, memoranda and briefings at <a href=http://www.ntp.org>www.ntp.org</a>. + +<p>There are two types of associations: persistent associations, which result from configuration file commands, and ephemeral associations, which result from protocol operations described below. A persistent association is never demobilized, although it may become dormant when the associated server becomes unreachable. An ephemeral association is mobilized when a message arrives from a server; for instance, a symmetric passive association is mobilized upon arrival of a symmetric active message. A broadcast client association is mobilized upon arrival of a broadcast server message, while a manycast client association is mobilized upon arrival of a manycast server message. + +<p>Ordinarily, successful mobilization of an ephemeral association requires the server to be cryptographically authenticated to the dependent client. This can be done using either symmetric-key or public-key cryptography, as described in the <a href=authopt.htm>Authentication Options</a> page. The cryptographic means insure an unbroken chain of trust between the dependent client and the primary servers at the root of the synchronization subnet. We call this chain the provenance of the client and define new vocabulary as to proventicate a client or provide proventic credentials. Once mobilized, ephemeral associations are demobilized when either (a) the server becomes unreachable or (b) the server refreshes the key media without notifying the client. + +<p>There are three principal modes of operation: client/server, symmetric active/passive and broadcast. In addition, there are two modes using IP Multicast support: multicast and manycast. These modes are selected based on the scope of service, intended flow of time and proventic values and means of configuration. Following is a summary of the operations in each mode. + +<h4>Client/Server Mode</h4> + +<p>Client/server mode is probably the most common configuration in the Internet today. It operates in the classic remote-procedure-call (RPC) paradigm with stateless servers. In this mode a client sends a request to the server and expects a reply at some future time. In some contexts this would be described as a "pull" operation, in that the client pulls the time and proventic values from the server. A client is configured in client mode using the <tt>server</tt> (sic) command and specifying the server DNS name or address; the server requires no prior configuration. The original NTPv3 authentication scheme is applicable in this mode, as well as the new NTPv4 Autokey proventication scheme. In addition, two burst modes described below can be used in appropriate cases. + +<h4>Symmetric Active/Passive Mode</h4> + +<p>Symmetric active/passive mode is intended for configurations were a clique of low-stratum peers operate as mutual backups for each other. Each peer operates with one or more primary reference sources, such as a radio clock, or a subset of secondary servers known to be reliable and proventicated. Should one of the peers lose all reference sources or simply cease operation, the other peers will automatically reconfigure so that time and proventication values can flow from the surviving peers to all the others in the clique. In some contexts this would be described as a "push-pull" operation, in that the peer either pulls or pushes the time and proventic values depending on the particular configuration. + +<p>Symmetric peers operate with their sources in some NTP mode and with each other in symmetric mode. A peer is configured in symmetric active mode using the <tt>peer</tt> command and specifying the other peer DNS name or address. The other peer can also be configured in symmetric active mode in a similar way. However, if the other peer is not specifically configured in this way, a symmetric passive association is mobilized upon arrival of a symmetric active message. Since an intruder can impersonate a symmetric active peer and inject false time values, symmetric mode should always be cryptographically validated. The original NTPv3 authentication scheme is applicable in this mode, as well as the new NTPv4 Autokey proventication scheme. + +<h4>Broadcast Mode</h4> + +<p>Broadcast mode is intended for configurations involving one or a few servers and a possibly very large client population. A broadcast server is configured using the <tt>broadcast</tt> command and a local subnet address. A broadcast client is configured using the <tt>broadcastclient</tt> command, in which case it responds to broadcast messages received on any interface. Since an intruder can impersonate a broadcast server and inject false time values, this mode should always be cryptographically validated. The original NTPv3 authentication scheme is applicable in this mode, as well as the new NTPv4 Autokey proventication scheme. + +<p>The server generates broadcast messages continuously at intervals specified by the <tt>minpoll</tt> keyword and with a time-to-live span specified by the <tt>ttl</tt> keyword. A NTPv4 broadcast client responds to the first proventicated message received by waiting an interval randomized over the <tt>minpoll</tt> interval, in order to avoid implosion at the server. Then, the client polls the server in burst mode in order to reliably set the host clock and validate the source. This normally results in a volley of eight client/server cycles over a 30-s interval during which both the synchronization and cryptographic protocols run concurrently. When the next broadcast message is received after the volley, the client computes the offset between the apparent broadcast time and the (unicast) client time. This offset is used to compensate for the propagation time between the broadcast server and client. Once the offset is computed, the server continues as before and the client sends no further messages. + +<h4>IP Multicast Support</h4> + +<p>Broadcast mode in both NTPv3 and NTPv4 is limited to directly connected subnets such as Ethernets which support broadcast technology. Ordinarily, this technology does not operate beyond the first hop router or gateway. Where service is intended beyond the local subnet, IP multicasting can be used where supported by the operating system and the routers support the Internet Group Management Protocol (IGMP). Most current kernels and available routers do support IP multicast technology, although service providers are sometimes reluctant to deploy it. + +<p>A general discussion of IP multicast technology is beyond the scope here. In simple terms a host or router sending to a IP multicast group (class D) address expects all hosts or routers listening on this address to receive the message. There is no intrinsic limit on the number of senders or receivers and senders can be receivers and vice versa. The IANA has assigned multicast group address 224.0.1.1 to NTP, but this address should be used only where the multicast span can be reliably constrained to protect neighbor networks. In general, administratively scoped group addresses should be used, as described in RFC-2365, or GLOP group addresses, as described in RFC-2770. + +<h4>Multicasting</h4> + +<p>IP multicasting can be used to extend the scope of a timekeeping subnet in two ways: multicasting and manycasting. A multicast client is configured using the <tt>broadcast</tt> command, but with a multicast group (class D) address instead of a local subnet broadcast address. However, there is a subtle difference between broadcasting and multicasting. Broadcasting is specific to each interface and local subnet address. If more than one interface is attached to a machine, a separate <tt>broadcast</tt> command applies to each one separately. This provides a way to limit exposure in a firewall, for example. + +<p>IP multicasting is a different paradigm. A multicast message has the same format as a broadcast message and is configured with the same <tt>broadcast</tt> command, but with a multicast group address instead of a local subnet address. By design, multicast messages travel from the sender via a shortest-path or shared tree to the receivers, which may require these messages emit from one or all interfaces, but carry a common source address. However, it is possible to configure multiple multicast group addresses using multiple <tt>broadcast</tt> commands. Other than these particulars, multicast messages are processed just like broadcast messages. Note that the calibration feature in broadcast mode is extremely important, since IP multicast messages can travel far different paths through the IP routing fabric than ordinary IP unicast messages. + +<h4>Manycasting</h4> + +<p>Manycasting is a automatic discovery and configuration paradigm new to NTPv4. It is intended as a means for a multicast client to troll the nearby network neighborhood to find cooperating manycast servers, validate them using cryptographic means and evaluate their time values with respect to other servers that might be lurking in the vicinity. The intended result is that each manycast client mobilizes client associations with the "best" three of the available manycast servers, yet automatically reconfigures to sustain this number of servers should one or another fail. + +<p>Note that the manycasting paradigm does not coincide with the anycasting paradigm described in RFC-1546, which is designed to find a single server from a clique of servers providing the same service. The manycasting paradigm is designed to find a plurality of redundant servers, in this case willing NTP servers. + +<p>A persistent manycast client association is configured using the <tt>server</tt> command, but with a multicast (class D) group address instead of an ordinary IP (class A, B, C) address. It sends client mode messages to this address at the maximum feasible poll interval and minimum feasible time-to-live hops, depending on how many servers have already been found. There can be as many manycast client associations as different group addresss, each one serving as a template for a future ephemeral client/server mode association. + +<p>Manycast servers configured with the <tt>manycastserver</tt> command listen on the specified group address for manycast client messages. Note the distinction between manycast client, which is configured with a <tt>server</tt> command, and manycast server, which is configured with a <tt>manycastserver</tt> command. If a manycast server is in range of the current time-to-live and is itself synchronized to a valid source and operating at a stratum level equal to or lower than the manycast client, it replies to the manycast client message with an ordinary server mode message. + +<p>The manycast client receiving this message mobilizes an ephemeral client association as in ordinary client/server mode according to the matching manycast client template. Then, the client polls the server at its unicast address in burst mode in order to reliably set the host clock and validate the source. This normally results in a volley of eight client/server cycles over a 30-s interval during which both the synchronization and cryptographic protocols run concurrently. Following the volley, the client runs the NTP intersection and clustering algorithms, which act to discard all but the best three associations. The surviving associations then continue in ordinary client/server mode. + +<p>The manycast client polling program is designed to reduce as much as possible the volume of messages and the effects of implosion due to near-simultaneous arrival of manycast server messages. The program uses a poll interval eight times the system poll interval, which starts out at the <tt>minpoll</tt> value and under normal circumstances increases gradually to the <tt>maxpolll</tt> value. Initially, the time-to-live is set at one hop. At each retransmission the time-to-live is incremented by one until at least three manycast servers are found. Further retransmissions use the same time-to-live value. + +<p>If less than three servers are found when the time-to-live has reached the maximum specified by the <tt>ttl</tt> keyword, the poll interval is doubled. For each transmission after that, the poll interval is doubled again until reaching the maximum of eight times the value specified by the <tt>maxpoll</tt> keyword. Further transmissions use the same poll interval and time-to-live values. + +<p>The above scenario happens for each manycast client message, which repeats at the designated poll interval. However, once the ephemeral client association is mobilized, subsequent manycast server replies are discarded, since they will fail the message digest test. If during a poll interval the number of client associations falls below three, all manycast client prototype associations are reset to the initial poll interval and time-to-live values and operation resumes from the beginning. It is important in manycast mode to avoid frequent manycast client messages, since each one requires all manycast servers in range to respond. The result could well be an implosion, either minor or major, depending on the number of servers in range. The recommended value for <tt>maxpoll</tt> is 12 (4,096 s) and for <tt>ttl</tt> is 7. + +<p>It is possible and frequently useful to configure a host as both a manycast client and manycast server. A number of hosts configured this way and sharing a common group address will automatically organize themselves in an optimum configuration based on the smallest synchronization distance computed by the NTP mitigation algorithms. For example, consider an NTP subnet of two primary servers and maybe a dozen dependent clients. All servers and clients are configured as both multicast client and multicast server with multicast group address 239.1.1.1. In addition, the primary servers are configured for a primary reference source such as a GPS receiver. + +Once operations have stabilized in this scenario, the primary servers will affiliate with the primary reference source and each other, since they both operate at the same stratum (1), but not with any client, since clients operate at a higher stratum. The clients will find both primary servers and in addition, one of their own at the minimum synchronization distance. If one of the primary servers loses its GPS receiver, it will continue to operate as a client and other clients will time out the corresponding association and re-associate accordingly. + +<h4>Burst Modes</h4> + +<p>There are two burst modes that can be enabled in client/server mode using the <tt>iburst</tt> and <tt>burst</tt> keywords. In either mode a single poll initiates a burst of eight client messages at intervals randomized over the range 1-4 s. However, the interval between the first and second messages is increased to about 16 s in order for a dialup modem to complete a call, if necessary. Received server messages update the NTPv4 clock filter, which selects the best (most accurate) time values. When the last client message in the burst is sent, the next received server message updates the system variables and sets the system clock in the usual manner, as if only a single client/server cycle had occurred. The result is not only a rapid and reliable setting of the system clock, but a considerable reduction in network jitter. + +<p>The <tt>iburst</tt> keyword can be configured for cases where it is important to set the clock quickly when an association is first mobilized or first becomes reachable or when the network attachment requires an initial calling or training procedure. The burst is initiated only when the server first becomes reachable and results in good accuracy with intermittent connections typical of PPP and ISDN services. Outlyers due to initial dial-up delays, etc., are avoided and the client sets the clock within 30 s after the first message. + +<p>The <tt>burst</tt> keyword can be configured in cases of excessive network jitter or when the network attachment requires an initial calling or training procedure. The burst is initiated at each poll interval when the server is reachable. The burst does produce additional network overhead and can cause trouble if used indiscriminately. It should only be used where the poll interval is expected to settle to values at or above 1024 s. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> diff --git a/contrib/ntp/html/audio.htm b/contrib/ntp/html/audio.htm index 5df5570..b345bc7 100644 --- a/contrib/ntp/html/audio.htm +++ b/contrib/ntp/html/audio.htm @@ -1,153 +1,187 @@ -<html><head><title> -Reference Clock Audio Drivers -</title></head><body><h3> -Reference Clock Audio Drivers -</h3><hr> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Reference Clock Audio Drivers</title> +</head> +<body> +<h3>Reference Clock Audio Drivers</h3> +<img align="left" src="pic/radio2.jpg" alt="gif"> + +<p>Make a little noise here.<br clear="left"> +</p> + +<hr> <p>There are some applications in which the computer time can be disciplined to an audio signal, rather than a serial timecode and -communications port or special purpose bus peripheral. This is useful in -such cases where the audio signal is sent over a telephone circuit, for -example, or received directly from a shortwave receiver. In such cases -the audio signal can be connected via an ordinary sound card or -baseboard audio codec. The suite of NTP reference clock drivers -currently includes three drivers suitable for these applications. They -include a driver for the Inter Range Instrumentation Group (IRIG) -signals produced by most radio clocks and timing devices, another for -the Canadian time/frequency radio station CHU and a third for the NIST +communications port or special purpose bus peripheral. This is +useful in such cases where the audio signal is sent over a +telephone circuit, for example, or received directly from a +shortwave receiver. In such cases the audio signal can be connected +via an ordinary sound card or baseboard audio codec. The suite of +NTP reference clock drivers currently includes three drivers +suitable for these applications. They include a driver for the +Inter Range Instrumentation Group (IRIG) signals produced by most +radio clocks and timing devices, another for the Canadian +time/frequency radio station CHU and a third for the NIST time/frequency radio stations WWV and WWVH. The radio drivers are -designed to work with ordinary inexpensive shortwave radios and may be -one of the least expensive ways to build a good primary time server. +designed to work with ordinary inexpensive shortwave radios and may +be one of the least expensive ways to build a good primary time +server.</p> <p>All three drivers make ample use of sophisticated digital signal -processing algorithms designed to efficiently extract timing signals -from noise and interference. The radio station drivers in particular -implement optimum linear demodulation and decoding techniques, including -maximum likelihood and soft-decision methods. The documentation page for -each driver contains an in-depth discussion on the algorithms and -performance expectations. In some cases the algorithms are further -analyzed, modelled and evaluated in a technical report. +processing algorithms designed to efficiently extract timing +signals from noise and interference. The radio station drivers in +particular implement optimum linear demodulation and decoding +techniques, including maximum likelihood and soft-decision methods. +The documentation page for each driver contains an in-depth +discussion on the algorithms and performance expectations. In some +cases the algorithms are further analyzed, modelled and evaluated +in a technical report.</p> <p>Currently, the audio drivers are compatible with Sun operating systems, including Solaris and SunOS, and the native audio codec -interface supported by these systems. In fact, the interface is quite -generic and support for other systems, in particular the various Unix -generics, should not be difficult. Volunteers are solicited. - -<p>The audio drivers include a number of common features designed to -groom input signals, suppress spikes and normalize signal levels. An -automatic gain control (AGC) feature provides protection against -overdriven or underdriven input signals. It is designed to maintain -adequate demodulator signal amplitude while avoiding occasional noise -spikes. In order to assure reliable operation, the signal level must be -in the range where the audio gain control is effective. In general, this -means the input signal level must be such as to cause the AGC to set the -gain somewhere in the middle of the range from 0 to 255, as indicated in -the timecode displayed by the <tt>ntpq</tt> program. +interface supported by these systems. In fact, the interface is +quite generic and support for other systems, in particular the +various Unix generics, should not be difficult. Volunteers are +solicited.</p> + +<p>The audio drivers include a number of common features designed +to groom input signals, suppress spikes and normalize signal +levels. An automatic gain control (AGC) feature provides protection +against overdriven or underdriven input signals. It is designed to +maintain adequate demodulator signal amplitude while avoiding +occasional noise spikes. In order to assure reliable operation, the +signal level must be in the range where the audio gain control is +effective. In general, this means the input signal level must be +such as to cause the AGC to set the gain somewhere in the middle of +the range from 0 to 255, as indicated in the timecode displayed by +the <tt>ntpq</tt> program.</p> <p>The drivers operate by disciplining a logical clock based on the codec sample clock to the audio signal as received. This is done by -stuffing or slipping samples as required to maintain exact frequency to -the order of 0.1 PPM. In order for the driver to reliably lock on the -audio signal, the sample clock frequency tolerance must be less than 250 -PPM (.025 percent) for the IRIG driver and half that for the radio -drivers. The largest error observed so far is about 60 PPM, but it is -possible some sound cards or codecs may exceed that value. +stuffing or slipping samples as required to maintain exact +frequency to the order of 0.1 PPM. In order for the driver to +reliably lock on the audio signal, the sample clock frequency +tolerance must be less than 250 PPM (.025 percent) for the IRIG +driver and half that for the radio drivers. The largest error +observed so far is about 60 PPM, but it is possible some sound +cards or codecs may exceed that value.</p> <p>The drivers include provisions to select the input port and to monitor the input signal. The <tt>fudge flag 2</tt> selects the -microphone port if set to zero or the line-in port if set to one. It -does not seem useful to specify the compact disc player port. The -<tt>fudge flag 3</tt> enables the input signal monitor using the -previously selected output port and output gain. Both of these flags can -be set in the configuration file or remotely using the <tt>ntpdc</tt> -utility program. - -<H4>Shortwave Radio Drivers</H4> - -<p>The WWV/H and CHU audio drivers require an external shortwave radio -with the radio output - speaker or headphone jack - connected to either -the microphone or line-in port on the computer. There is some degree of -art in setting up the radio and antenna and getting the setup to work. -While the drivers are highly sophisticated and efficient in extracting -timing signals from noise and interference, it always helps to have as -clear a signal as possible. - -<p>The most important factor affecting the radio signal is the antenna. -It need not be long - even 15 feet is enough if it is located outside of -a metal frame building, preferably on the roof, and away from metallic -objects. An ordinary CB whip mounted on a PVC pipe and wooden X-frame on -the roof should work well with most portable radios, as they are -optimized for small antennas. +microphone port if set to zero or the line-in port if set to one. +It does not seem useful to specify the compact disc player port. +The <tt>fudge flag 3</tt> enables the input signal monitor using +the previously selected output port and output gain. Both of these +flags can be set in the configuration file or remotely using the +<tt>ntpdc</tt> utility program.</p> + +<h4>Shortwave Radio Drivers</h4> + +<p>The WWV/H and CHU audio drivers require an external shortwave +radio with the radio output - speaker or headphone jack - connected +to either the microphone or line-in port on the computer. There is +some degree of art in setting up the radio and antenna and getting +the setup to work. While the drivers are highly sophisticated and +efficient in extracting timing signals from noise and interference, +it always helps to have as clear a signal as possible.</p> + +<p>The most important factor affecting the radio signal is the +antenna. It need not be long - even 15 feet is enough if it is +located outside of a metal frame building, preferably on the roof, +and away from metallic objects. An ordinary CB whip mounted on a +PVC pipe and wooden X-frame on the roof should work well with most +portable radios, as they are optimized for small antennas.</p> <p>The radio need not be located near the computer; in fact, it generally works better if the radio is outside the near field of computers and other electromagnetic noisemakers. It can be in the -elevator penthouse connected by house wiring, which can also be used to -power the radio. A couple of center-tapped audio transformers will -minimize noise pickup and provide phantom power to the radio with return -via the AC neutral wire. +elevator penthouse connected by house wiring, which can also be +used to power the radio. A couple of center-tapped audio +transformers will minimize noise pickup and provide phantom power +to the radio with return via the AC neutral wire.</p> <p>The WWV/H and CHU transmitters operate on several frequencies simultaneously, so that in most parts of North America at least one -frequency supports propagation to the receiver location at any given -hour. While both drivers support the ICOM CI-V radio interface and can tune the radio automatically, computer-tunable radios are expensive and probably not cost effective compared to a GPS receiver. So, the radio frequency must usually be fixed and chosen by compromise. +frequency supports propagation to the receiver location at any +given hour. While both drivers support the ICOM CI-V radio +interface and can tune the radio automatically, computer-tunable +radios are expensive and probably not cost effective compared to a +GPS receiver. So, the radio frequency must usually be fixed and +chosen by compromise.</p> -<p>Shortwave (3-30 MHz) radio propagation phenomena are well known to -shortwave enthusiasts. The phenomena generally obey the following rules: +<p>Shortwave (3-30 MHz) radio propagation phenomena are well known +to shortwave enthusiasts. The phenomena generally obey the +following rules:</p> <ul> +<li>The optimum frequency is higher in daytime than nighttime, +stays high longer on summer days and low longer on winter +nights.</li> -<p><li>The optimum frequency is higher in daytime than nighttime, stays -high longer on summer days and low longer on winter nights. - -<p><li>Transitions between daytime and nightime conditions generally -occur somewhat after sunrise and sunset at the midpoint of the path from -transmitter to receiver. - -<p><li>Ambient noise (static) on the lower frequencies follows the -thunderstorm season, so is higher on summer afternoons and evenings. +<li>Transitions between daytime and nightime conditions generally +occur somewhat after sunrise and sunset at the midpoint of the path +from transmitter to receiver.</li> -<p><li>The lower frequency bands are best for shorter distances, while -the higher bands are best for longer distances. +<li>Ambient noise (static) on the lower frequencies follows the +thunderstorm season, so is higher on summer afternoons and +evenings.</li> -<p><li>The optimum frequencies are higher at the peak of the 11-year -sunspot cycle and lower at the trough. The current sunspot cycle should -peak in the first couple of years beginning the century. +<li>The lower frequency bands are best for shorter distances, while +the higher bands are best for longer distances.</li> +<li>The optimum frequencies are higher at the peak of the 11-year +sunspot cycle and lower at the trough. The current sunspot cycle +should peak in the first couple of years beginning the +century.</li> </ul> -The best way to choose a frequency is to listen at various times over -the day and determine the best highest (daytime) and lowest (nighttime) -frequencies. Then, assuming one is available, choose the highest -frequency between these frequencies. This strategy assumes that the high -frequency is more problematic than the low, that the low frequency -probably comes with severe multipath and static, and insures that -probably twice a day the chosen frequency will work. For instance, on -the east coast the best compromise CHU frequency is probably 7335 kHz -and the best WWV frequency is probably 15 MHz. +The best way to choose a frequency is to listen at various times +over the day and determine the best highest (daytime) and lowest +(nighttime) frequencies. Then, assuming one is available, choose +the highest frequency between these frequencies. This strategy +assumes that the high frequency is more problematic than the low, +that the low frequency probably comes with severe multipath and +static, and insures that probably twice a day the chosen frequency +will work. For instance, on the east coast the best compromise CHU +frequency is probably 7335 kHz and the best WWV frequency is +probably 15 MHz. <h4>Debugging Aids</h4> -<p>The audio drivers include extensive debugging support to help hook up -the audio signals and monitor the driver operations. The documentation -page for each driver describes the various messages that can be produced -either in real-time or written to the <tt>clockstats</tt> file for -later analysis. Of particular help in verifying signal connections and -compatibility is a provision to monitor the signal via headphones or -speaker. - - -<p>The drivers write a synthesized timecode to the <tt>clockstats</tt> -file each time the clock is set or verified and at other times if verbose monitoring is enabled. The format includes several fixed-length fields defining the Gregorian time to the millisecond, together with additional variable-length fields specific to each driver. The data include the intervals since the clock was last set or verified, the audio gain and various state variables and counters specific to each driver. - -<H4>Additional Information</H4> - -<A HREF="refclock.htm">Reference Clock Drivers</A> -<br><A HREF="driver7.htm">Radio CHU Audio Demodulator/Decoder</A> -<br><A HREF="driver36.htm">Radio WWV/H Audio Demodulator/Decoder</A> -<br><A HREF="driver6.htm">IRIG Audio Decoder</A> +<p>The audio drivers include extensive debugging support to help +hook up the audio signals and monitor the driver operations. The +documentation page for each driver describes the various messages +that can be produced either in real-time or written to the <tt> +clockstats</tt> file for later analysis. Of particular help in +verifying signal connections and compatibility is a provision to +monitor the signal via headphones or speaker.</p> + +<p>The drivers write a synthesized timecode to the <tt> +clockstats</tt> file each time the clock is set or verified and at +other times if verbose monitoring is enabled. The format includes +several fixed-length fields defining the Gregorian time to the +millisecond, together with additional variable-length fields +specific to each driver. The data include the intervals since the +clock was last set or verified, the audio gain and various state +variables and counters specific to each driver.</p> + +<h4>Additional Information</h4> + +<a href="refclock.htm">Reference Clock Drivers</a> <br> +<a href="driver7.htm">Radio CHU Audio Demodulator/Decoder</a> <br> +<a href="driver36.htm">Radio WWV/H Audio Demodulator/Decoder</a> +<br> +<a href="driver6.htm">IRIG Audio Decoder</a> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/authopt.htm b/contrib/ntp/html/authopt.htm index 506d4f3..29df75d 100644 --- a/contrib/ntp/html/authopt.htm +++ b/contrib/ntp/html/authopt.htm @@ -1,281 +1,415 @@ -<HTML><HEAD><TITLE> -Authentication Options -</TITLE></HEAD><BODY><H3> -Authentication Options -</H3><HR> - -<H4>Authentication Support</H4> - -Authentication support allows the NTP client to verify that the server -is in fact known and trusted and not an intruder intending accidentally -or on purpose to masquerade as that server. The NTPv3 specification RFC-1305 -defines an scheme which provides cryptographic authentication of received -NTP packets. Originally, this was done using the Data Encryption Standard -(DES) operating in Cipher Block Chaining (CBC) mode, commonly called DES-CBC. -Subsequently, this was augmented by the RSA Message Digest 5 (MD5) using -a private key, commonly called keyed-MD5. Either algorithm computes a message -digest, or one-way hash, which can be used to verify the server has the -correct private key and key identifier. NTPv4 retains this scheme and, -in addition, provides a new <I>autokey </I>scheme based on reverse hashing -and public key cryptography. Authentication can be configured separately -for each association using the <TT>key </TT>or <TT>autokey </TT>subcommands -on the <TT>peer</TT>, <TT>server</TT>, <TT>broadcast</TT> and <TT>manycastclient</TT> -commands as described in the <A HREF="config.htm">Configuration Options</A> -page. - -<P>The authentication options specify the suite of keys, select the key -for each configured association and manage the configuration operations, -as described below. The <TT>auth</TT> flag which controls these functions -can be set or reset by the <TT>enable</TT> and <TT>disable</TT> configuration -commands and also by remote configuration commands sent by a <TT>ntpdc</TT> -program running in another machine. If this flag is set, persistent peer -associations and remote configuration commands are effective only if cryptographically -authenticated. If this flag is disabled, these operations are effective -even if not cryptographic authenticated. It should be understood that operating -in the latter mode invites a significant vulnerability where a rogue hacker -can seriously disrupt client operations. - -<P>The <TT>auth</TT> flag affects all authentication procedures described -below; however, it operates differently if cryptographic support is compiled -in the distribution. If this support is available and the flag is enabled, -then persistent associations are mobilized and remote configuration commands -are effective only if successfully authenticated. If the support is unavailable -and the flag is enabled, then it is not possible under any conditions to -mobilize persistent associations or respond to remote configuration commands. -The <TT>auth </TT>flag normally defaults to set if cryptographic support -is available and to reset otherwise. - -<P>With the above vulnerabilities in mind, it is desirable to set the auth -flag in all cases. One aspect which is often confusing is the name resolution -process which maps server names in the configuration file to IP addresses. -In order to protect against bogus name server messages, this process is -authenticated using an internally generated key which is normally invisible -to the user. However, if cryptographic support is unavailable and the <TT>auth</TT> -flag is enabled, the name resolution process will fail. This can be avoided -either by specifying IP addresses instead of host names, which is generally -inadvisable, or by leaving the flag disabled and enabling it once the name -resolution process is complete. -<H4> -Private Key Scheme</H4> -The original RFC-1305 specification allows any one of possibly 65,536 keys, -each distinguished a 32-bit key identifier, to authenticate an association. -The servers involved must agree on the key and key identifier to authenticate -their messages. Keys and related information are specified in a key file, -usually called <TT>ntp.key</TT>s, which should be exchanged and stored -using secure procedures beyond the scope of the NTP protocol itself. Besides -the keys used for ordinary NTP associations, additional ones can be used -as passwords for the <TT><A HREF="ntpq.htm">ntpq</A></TT> and <TT><A HREF="ntpdc.htm">ntpdc</A></TT> -utility programs. - -<P>When <TT>ntpd </TT>is first started, it reads the key file and installs -the keys in the key cache. However, the keys must be activated before they -can be used with the <TT>trusted </TT>command. This allows, for instance, -the installation of possibly several batches of keys and then activating -or inactivating each batch remotely using <TT>ntpdc</TT>. This also provides -a revocation capability that can be used if a key becomes compromised. -The <TT>requestkey </TT>command selects the key used as the password for -the <TT>ntpdc </TT>utility, while the <TT>controlkey </TT>command selects -the key used as the password for the the <TT>ntpq </TT>utility. -<H4> -Autokey Scheme</H4> -The original NTPv3 authentication scheme described in RFC-1305 continues -to be supported. In NTPv4, an additional authentication scheme called <I>autokey -</I>is available. It operates much like the S-KEY scheme, in that a session -key list is constructed and the entries used in reverse order. A description -of the scheme, along with a comprehensive security analysis, is contained -in a technical report available from the IETF web page <A HREF="www.ietf.org">www.ietf.org</A> -. - -<P>The autokey scheme is specifically designed for multicast modes, where -clients normally do not send messages to the server. In these modes, the -server uses the scheme to generate a key list by repeated hashing of a -secret value. The list is used in reverse order to generate a unique session -key for each message sent. The client regenerates the session key and verifies -the hash matches the previous session key. Each message contains the public -values binding the session key to the secret value, but these values need -to be verified only when the server generates a new key list or more than -four server messages have been lost. - -<P>The scheme is appropriate for client/server and symmetric-peer modes -as well. In these modes, the client generates a session key as in multicast -modes. The server regenerates the session key and uses it to formulates -a reply using its own public values. The client verifies the key identifier -of the reply matches the request, verifies the public values and validates -the message. In peer mode, each peer independently generates a key list -and operates as in the multicast mode. - -<P>The autokey scheme requires no change to the NTP packet header format -or message authentication code (MAC), which is appended to the header; -however, if autokey is in use, an extensions field is inserted between -the header and MAC. The extensions field contains a random public value -which is updated at intervals specified by the revoke command, together -with related cryptographic values used in the signing algorithm. The format -of the extensions field is defined in Internet Draft draft-NTP- auth-coexist-00.txt. -The MAC itself is constructed in the same way as NTPv3, but using the original -NTP header and the extensions field padded to a 64-bit boundary. Each new -public value is encrypted by the host private value. It is the intent of -the design, not yet finalized, that the public value, encrypted public -value, public key and certificate be embedded in the extensions field where -the client can decrypt as needed. However, the relatively expensive encryption -and decryption operations are necessary only when the public value is changed. - -<P>Note that both the original NTPv3 authentication scheme and the new -NTPv4 autokey scheme operate separately for each configured association, -so there may be several session key lists operating independently at the -same time. Since all keys, including session keys, occupy the same key -cache, provisions have been made to avoid collisions, where some random -roll happens to collide with another already generated. Since something -like four billion different session key identifiers are available, the -chances are small that this might happen. If it happens during generation, -the generator terminates the current session key list. By the time the -next list is generated, the collided key will probably have been expired -or revoked. - -<P>While permanent keys have lifetimes that expire only when manually revoked, -random session keys have a lifetime specified at the time of generation. -When generating a key list for an association, the lifetime of each key -is set to expire one poll interval later than it is scheduled to be used. -The maximum lifetime of any key in the list is specified by the <TT>autokey</TT> -command. Lifetime enforcement is a backup to the normal procedure that -revokes the last-used key at the time the next key on the key list is used. -<H4> -Authentication Commands</H4> - -<DL> -<DT> -<TT>keys <I>keyfile</I></TT></DT> - -<DD> -Specifies the file name containing the encryption keys and key identifiers -used by <TT>ntpd</TT>, <TT>ntpq</TT> and <TT>ntpdc</TT> when operating -in authenticated mode. The format of this file is described later in this -document.</DD> - -<DD> - </DD> - -<DT> -<TT>trustedkey <I>key</I> [...]</TT></DT> - -<DD> -Specifies the encryption key identifiers which are trusted for the purposes -of authenticating peers suitable for synchronization, as well as keys used -by the <TT>ntpq </TT>and <TT>ntpdc </TT>programs. The authentication procedures -require that both the local and remote servers share the same key and key -identifier for this purpose, although different keys can be used with different -servers. The <I><TT>key</TT></I> arguments are 32-bit unsigned integers -with values less than 65,536. Note that NTP key 0 is used to indicate an -invalid key and/or key identifier, so should not be used for any other -purpose.</DD> - -<DD> - </DD> - -<DT> -<TT>requestkey <I>key</I></TT></DT> - -<DD> -Specifies the key identifier to use with the <TT>ntpdc</TT> program, which -uses a proprietary protocol specific to this implementation of <TT>ntpd</TT>. -This program is useful to diagnose and repair problems that affect <TT>ntpd</TT> -operation. The <I><TT>key</TT></I> argument to this command is a 32-bit -key identifier for a previously defined trusted key. If no <TT>requestkey -</TT>command is included in the configuration file, or if the keys don't -match, any request to change a server variable with be denied.</DD> - -<DD> - </DD> - -<DT> -<TT>controlkey <I>key</I></TT></DT> - -<DD> -Specifies the key identifier to use with the <TT>ntpq</TT> program, which -uses the standard protocol defined in RFC-1305. This program is useful -to diagnose and repair problems that affect <TT>ntpd</TT> operation. The -<I><TT>key</TT></I> argument to this command is a 32-bit key identifier -for a trusted key in the key cache. If no <TT>controlkey </TT>command is -included in the configuration file, or if the keys don't match, any request -to change a server variable with be denied.</DD> -</DL> - -<H4> -Authentication Key File Format</H4> -In the case of DES, the keys are 56 bits long with, depending on type, -a parity check on each byte. In the case of MD5, the keys are 64 bits (8 -bytes). <TT>ntpd</TT> reads its keys from a file specified using the <TT>-k</TT> -command line option or the <TT>keys</TT> statement in the configuration -file. While key number 0 is fixed by the NTP standard (as 56 zero bits) -and may not be changed, one or more of the keys numbered 1 through 15 may -be arbitrarily set in the keys file. - -<P>The key file uses the same comment conventions as the configuration -file. Key entries use a fixed format of the form - -<P><I><TT>keyno type key</TT></I> - -<P>where <I><TT>keyno</TT></I> is a positive integer, <I><TT>type</TT></I> -is a single character which defines the key format, and <I><TT>key</TT></I> -is the key itself. - -<P>The key may be given in one of three different formats, controlled by -the <I><TT>type</TT></I> character. The three key types, and corresponding -formats, are listed following. -<DL> -<DT> -<TT>S</TT></DT> - -<DD> -The key is a 64-bit hexadecimal number in the format specified in the DES -specification; that is, the high order seven bits of each octet are used -to form the 56-bit key while the low order bit of each octet is given a -value such that odd parity is maintained for the octet. Leading zeroes -must be specified (i.e., the key must be exactly 16 hex digits long) and -odd parity must be maintained. Hence a zero key, in standard format, would -be given as <TT>0101010101010101</TT>.</DD> - -<DD> - </DD> - -<DT> -<TT>N</TT></DT> - -<DD> -The key is a 64-bit hexadecimal number in the format specified in the NTP -standard. This is the same as the DES format, except the bits in each octet -have been rotated one bit right so that the parity bit is now the high -order bit of the octet. Leading zeroes must be specified and odd parity -must be maintained. A zero key in NTP format would be specified as <TT>8080808080808080</TT>.</DD> - -<DD> - </DD> - -<DT> -<TT>A</TT></DT> - -<DD> -The key is a 1-to-8 character ASCII string. A key is formed from this by -using the low order 7 bits of each ASCII character in the string, with -zeroes added on the right when necessary to form a full width 56-bit key, -in the same way that encryption keys are formed from Unix passwords.</DD> - -<DD> - </DD> - -<DT> -<TT>M</TT></DT> - -<DD> -The key is a 1-to-8 character ASCII string, using the MD5 authentication -scheme. Note that both the keys and the authentication schemes (DES or -MD5) must be identical between a set of peers sharing the same key number.</DD> -</DL> -Note that the keys used by the <TT>ntpq</TT> and <TT>ntpdc</TT> programs -are checked against passwords requested by the programs and entered by -hand, so it is generally appropriate to specify these keys in ASCII format. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Authentication Options</title> +</head> +<body> +<h3>Authentication Options</h3> + +<img align="left" src="pic/alice44.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>Our resident cryptographer; now you see him, now you don't.<br +clear="left"> +</p> + +<hr> +<h4>Authentication Support</h4> + +<p>Authentication support allows the NTP client to verify that the +server is in fact known and trusted and not an intruder intending +accidentally or on purpose to masquerade as that server. The NTPv3 +specification RFC-1305 defines an scheme which provides +cryptographic authentication of received NTP packets. Originally, +this was done using the Data Encryption Standard (DES) algorithm +operating in Cipher Block Chaining (CBC) mode, commonly called +DES-CBC. Subsequently, this was augmented by the RSA Message Digest +5 (MD5) algorithm using a private key, commonly called keyed-MD5. +Either algorithm computes a message digest, or one-way hash, which +can be used to verify the server has the correct private key and +key identifier.</p> + +<p>NTPv4 retains the NTPv3 schemes, properly described as +symmetric-key cryptography and, in addition, provides a new Autokey +scheme based on public-key cryptography. Public-key cryptography is +generally considered more secure than symmetric-key cryptography, +since the security is based on a private value which is generated +by each server and never revealed. With Autokey all key +distribution and management functions involve only public values, +which considerably simplifies key distribution and storage.</p> + +<p>Authentication is configured separately for each association +using the <tt>key</tt> or <tt>autokey</tt> subcommands on the <tt> +peer</tt>, <tt>server</tt>, <tt>broadcast</tt> and <tt> +manycastclient</tt> commands as described in the <a href= +"config.htm">Configuration Options</a> page. The authentication +options described below specify the suite of keys, select the key +for each configured association and manage the configuration +operations.</p> + +<p>The <tt>auth</tt> flag controls whether new associations or +remote configuration commands require cryptographic authentication. +This flag can be set or reset by the <tt>enable</tt> and <tt> +disable</tt> configuration commands and also by remote +configuration commands sent by a <tt>ntpdc</tt> program running in +another machine. If this flag is enabled, which is the default +case, new broadcast client and symmetric passive associations and +remote configuration commands must be cryptographically +authenticated using either symmetric-key or public-key schemes. If +this flag is disabled, these operations are effective even if not +cryptographic authenticated. It should be understood that operating +in the latter mode invites a significant vulnerability where a +rogue hacker can seriously disrupt client timekeeping.</p> + +<p>In networks with firewalls and large numbers of broadcast +clients it may be acceptable to disable authentication, since that +avoids key distribution and simplifies network maintenance. +However, when the configuration file contains host names, or when a +server or client is configured remotely, host names are resolved +using the DNS and a separate name resolution process. In order to +protect against bogus name server messages, name resolution +messages are authenticated using an internally generated key which +is normally invisible to the user. However, if cryptographic +support is disabled, the name resolution process will fail. This +can be avoided either by specifying IP addresses instead of host +names, which is generally inadvisable, or by enabling the flag for +name resolution and disabled it once the name resolution process is +complete.</p> + +<p>An attractive alternative where multicast support is available +is manycast mode, in which clients periodically troll for servers. +Cryptographic authentication in this mode uses public-key schemes +as described below. The principle advantage of this manycast mode +is that potential servers need not be configured in advance, since +the client finds them during regular operation, and the +configuration files for all clients can be identical.</p> + +<p>In addition to the default symmetric-key cryptographic support, +support for public-key cryptography is available if the requisite +<tt>rsaref20</tt> software distribution has been installed before +building the distribution. Public-key cryptography provides secure +authentication of servers without compromising accuracy and +stability. The security model and protocol schemes for both +symmetric-key and public-key cryptography are described below.</p> + +<h4>Symmetric-Key Scheme</h4> + +The original RFC-1305 specification allows any one of possibly +65,534 keys, each distinguished by a 32-bit key identifier, to +authenticate an association. The servers and clients involved must +agree on the key and key identifier to authenticate their messages. +Keys and related information are specified in a key file, usually +called <tt>ntp.keys</tt>, which should be exchanged and stored +using secure procedures beyond the scope of the NTP protocol +itself. Besides the keys used for ordinary NTP associations, +additional keys can be used as passwords for the <tt><a href= +"ntpq.htm">ntpq</a></tt> and <tt><a href="ntpdc.htm">ntpdc</a></tt> +utility programs. + +<p>When <tt>ntpd</tt> is first started, it reads the key file +specified int he <tt>keys</tt> command and installs the keys in the +key cache. However, the keys must be activated with the <tt> +trusted</tt> command before use. This allows, for instance, the +installation of possibly several batches of keys and then +activating or deactivating each batch remotely using <tt> +ntpdc</tt>. This also provides a revocation capability that can be +used if a key becomes compromised. The <tt>requestkey</tt> command +selects the key used as the password for the <tt>ntpdc</tt> +utility, while the <tt>controlkey</tt> command selects the key used +as the password for the <tt>ntpq</tt> utility.</p> + +<h4>Public-Key Scheme</h4> + +The original NTPv3 authentication scheme described in RFC-1305 +continues to be supported; however, in NTPv4 an additional +authentication scheme called Autokey is available. It uses MD5 +message digest, RSA public-key signature and Diffie-Hellman key +agreement algorithms available from several sources, but not +included in the NTPv4 software distribution. In order to be +effective, the <tt>rsaref20</tt> package must be installed as +described in the <tt>README.rsa</tt> file. Once installed, the +configure and build process automatically detects it and compiles +the routines required. The Autokey scheme has several modes of +operation corresponding to the various NTP modes supported. RSA +signatures with timestamps are used in all modes to verify the +source of cryptographic values. All modes use a special cookie +which can be computed independently by the client and server. In +symmetric modes the cookie is constructed using the Diffie-Hellman +key agreement algorithm. In other modes the cookie is constructed +from the IP addresses and a private value known only to the server. +All modes use in addition a variant of the S-KEY scheme, in which a +pseudo-random key list is generated and used in reverse order. +These schemes are described along with an executive summary, +current status, briefing slides and reading list, on the <a href= +"http://www.eecis.udel.edu/~mills/autokey.htm">Autonomous +Authentication</a> page. + +<p>The cryptographic values used by the Autokey scheme are +incorporated as a set of files generated by the <a href= +"genkeys.htm"><tt>ntp-genkeys</tt></a> program, including the +symmetric private keys, public/private key pair, and the agreement +parameters. See the <tt>ntp-genkeys</tt> page for a description of +the formats of these files. They contain cryptographic values +generated by the algorithms of the <tt>rsaref20</tt> package and +are in printable ASCII format. All file names include the +timestamp, in NTP seconds, following the default names given below. +Since the file data are derived from random values seeded by the +system clock and the file name includes the timestamp, every +generation produces a different file and different file name.</p> + +<p>The <tt>ntp.keys</tt> file contains the DES/MD5 private keys. It +must be distributed by secure means to other servers and clients +sharing the same security compartment and made visible only to +root. While this file is not used with the Autokey scheme, it is +needed to authenticate some remote configuration commands used by +the <a href="ntpdc.htm"><tt>ntpq</tt></a> and <a href="ntpq.htm"> +<tt>ntpdc</tt></a> utilities. The <tt>ntpkey</tt> file contains the +RSA private key. It is useful only to the machine that generated it +and never shared with any other daemon or application program, so +must be made visible only to root.</p> + +<p>The <tt>ntp_dh</tt> file contains the agreement parameters, +which are used only in symmetric (active and passive) modes. It is +necessary that both peers beginning a symmetric-mode association +share the same parameters, but it does not matter which <tt> +ntp_dh</tt> file generates them. If one of the peers contains the +parameters, the other peer obtains them using the Autokey protocol. +If both peers contain the parameters, the most recent copy is used +by both peers. If a peer does not have the parameters, they will be +requested by all associations, either configured or not; but, none +of the associations can proceed until one of them has received the +parameters. Once loaded, the parameters can be provided on request +to other clients and servers. The <tt>ntp_dh</tt> file can be also +be distributed using insecure means, since the data are public +values.</p> + +<p>The <tt>ntpkey_<i>host</i></tt> file contains the RSA public +key, where <tt><i>host</i></tt> is the name of the host. Each host +must have its own <tt>ntpkey_<i>host</i></tt> file, which is +normally provided to other hosts using the Autokey protocol Each +<tt>server</tt> or <tt>peer</tt> association requires the public +key associated with the particular server or peer to be loaded +either directly from a local file or indirectly from the server +using the Autokey protocol. These files can be widely distributed +and stored using insecure means, since the data are public +values.</p> + +<p>The optional <tt>ntpkey_certif_<i>host</i></tt> file contains +the PKI certificate for the host. This provides a binding between +the host hame and RSA public key. In the current implementation the +certificate is obtained by a client, if present, but the contents +are ignored.</p> + +<p>Due to the widespread use of interface-specific naming, the host +names used in configured and mobilized associations are determined +by the Unix <tt>gethostname()</tt> library routine. Both the <tt> +ntp-genkeys</tt> program and the Autokey protocol derive the name +of the public key file using the name returned by this routine. +While every server and client is required to load their own public +and private keys, the public keys for each client or peer +association can be obtained from the server or peer using the +Autokey protocol. Note however, that at the current stage of +development the authenticity of the server or peer and the +cryptographic binding of the server name, address and public key is +not yet established by a certificate authority or web of trust.</p> + +<h4>Leapseconds Table</h4> + +<p>The NIST provides a table showing the epoch for all historic +occasions of leap second insertion since 1972. The leapsecond table +shows each epoch of insertion along with the offset of +International Atomic Time (TAI) with respect to Coordinated +Universtal Time (UTC), as disseminated by NTP. The table can be +obtained directly from NIST national time servers using <tt> +ftp</tt> as the ASCII file <tt>pub/leap-seconds</tt>.</p> + +<p>While not strictly a security function, the Autokey scheme +provides means to securely retrieve the leapsecond table from a +server or peer. Servers load the leapsecond table directly from the +file specified in the <tt>crypto</tt> command, while clients can +load the table indirectly from the servers using the Autokey +protocol. Once loaded, the table can be provided on request to +other clients and servers.</p> + +<h4>Key Management</h4> + +<p>All key files are installed by default in <tt> +/usr/local/etc</tt>, which is normally in a shared filesystem in +NFS-mounted networks and avoids installing them in each machine +separately. The default can be overridden by the <tt>keysdir</tt> +configuration command. However, this is not a good place to install +the private key file, since each machine needs its own file. A +suitable place to install it is in <tt>/etc</tt>, which is normally +not in a shared filesystem.</p> + +<p>The recommended practice is to keep the timestamp extensions +when installing a file and to install a link from the default name +(without the timestamp extension) to the actual file. This allows +new file generations to be activated simply by changing the link. +However, <tt>ntpd</tt> parses the link name when present to extract +the extension value and sends it along with the public key and host +name when requested. This allows clients to verify that the file +and generation time are always current. However, the actual +location of each file can be overridden by the <tt>crypto</tt> +configuration command.</p> + +<p>All cryptographic keys and related parameters should be +regenerated on a periodic and automatic basis, like once per month. +The <tt>ntp-genkeys</tt> program uses the same timestamp extension +for all files generated at one time, so each generation is distinct +and can be readily recognized in monitoring data. While a +public/private key pair must be generated by every server and +client, the public keys and agreement parameters do not need to be +explicitly copied to all machines in the same security compartment, +since they can be obtained automatically using the Autokey +protocol. However, it is necessary that all primary servers have +the same agreement parameter file. The recommended way to do this +is for one of the primary servers to generate that file and then +copy it to the other primary servers in the same compartment using +the Unix <tt>rdist</tt> command. Future versions of the Autokey +protocol are to contain provisions for an agreement protocol to do +this automatically.</p> + +<p>Servers and clients can make a new generation in the following +way. All machines have loaded the old generation at startup and are +operating normally. At designated intervals, each machine generates +a new public/private key pair and makes links from the default file +names to the new file names. The <tt>ntpd</tt> is then restarted +and loads the new generation, with result clients no longer can +authenticate correctly. The Autokey protocol is designed so that +after a few minutes the clients time out and restart the protocol +from the beginning, with result the new generation is loaded and +operation continues as before. A similar procedure can be used for +the agreement parameter file, but in this case precautions must be +take to be sure that all machines with this file have the same +copy.</p> + +<h4>Authentication Commands</h4> + +<dl> +<dt><tt>autokey [<i>logsec</i>]</tt></dt> + +<dd>Specifies the interval between regenerations of the session key +list used with the Autokey protocol. Note that the size of the key +list for each association depends on this interval and the current +poll interval. The default value is 12 (4096 s or about 1.1 hours). +For poll intervals above the specified interval, a session key list +with a single entry will be regenerated for every message +sent.</dd> + +<dt><tt>controlkey <i>key</i></tt></dt> + +<dd>Specifies the key identifier to use with the <a href= +"ntpq.htm"><tt>ntpq</tt></a> utility, which uses the standard +protocol defined in RFC-1305. The <tt><i>key</i></tt> argument is +the key identifier for a trusted key, where the value can be in the +range 1 to 65534, inclusive.</dd> + +<dt><tt>crypto [flags <i>flags</i>] [privatekey <i>file</i>] +[publickey <i>file</i>] [dhparms <i>file</i>] [leap <i> +file</i>]</tt></dt> + +<dd>This command requires the NTP daemon build process be +configured with the RSA library. This command activates public-key +cryptography and loads the required RSA private and public key +files and the optional Diffie-Hellman agreement parameter file, if +present. If one or more files are left unspecified, the default +names are used as described below. Following are the +subcommands:</dd> + +<dd> +<dl> +<dt><tt>privatekey <i>file</i></tt></dt> + +<dd>Specifies the location of the RSA private key file, which +otherwise defaults to <tt>/usr/local/etc/ntpkey</tt>.</dd> + +<dt><tt>publickey <i>file</i></tt></dt> + +<dd>Specifies the location of the RSA public key file, which +otherwise defaults to <tt>/usr/local/etc/ntpkey_<i>host</i></tt>., +where <i>host</i> is the name of the generating machine.</dd> + +<dt><tt>dhparms <i>file</i></tt></dt> + +<dd>Specifies the location of the Diffie-Hellman parameters file, +which otherwise defaults to <tt>/usr/local/etc/ntpkey_dh</tt>.</dd> + +<dt><tt>leap <i>file</i></tt></dt> + +<dd>Specifies the location of the leapsecond table file, which +otherwise defaults to <tt>/usr/local/etc/ntpkey_leap</tt>.</dd> +</dl> +</dd> + +<dt><tt>keys <i>keyfile</i></tt></dt> + +<dd>Specifies the location of the DES/MD5 private key file +containing the keys and key identifiers used by <tt>ntpd</tt>, <tt> +ntpq</tt> and <tt>ntpdc</tt> when operating in symmetric-key +mode.</dd> + +<dt><tt>keysdir <i>path</i></tt></dt> + +<dd>This command requires the NTP daemon build process be +configured with the RSA library. It specifies the default directory +path for the private key file, agreement parameters file and one or +more public key files. The default when this command does not +appear in the configuration file is <tt>/usr/local/etc/</tt>.</dd> + +<dt><tt>requestkey <i>key</i></tt></dt> + +<dd>Specifies the key identifier to use with the <a href= +"ntpdc.htm"><tt>ntpdc</tt></a> utility program, which uses a +proprietary protocol specific to this implementation of <tt> +ntpd</tt>. The <tt><i>key</i></tt> argument is a key identifier for +the trusted key, where the value can be in the range 1 to 65534, +inclusive.</dd> + +<dt><tt>revoke [<i>logsec</i>]</tt></dt> + +<dd>Specifies the interval between re-randomization of certain +cryptographic values used by the Autokey scheme, as a power of 2 in +seconds. These values need to be updated frequently in order to +deflect brute-force attacks on the algorithms of the scheme; +however, updating some values is a relatively expensive operation. +The default interval is 16 (65,536 s or about 18 hours). For poll +intervals above the specified interval, the values will be updated +for every message sent.</dd> + +<dt><tt>trustedkey <i>key</i> [...]</tt></dt> + +<dd>Specifies the key identifiers which are trusted for the +purposes of authenticating peers with symmetric-key cryptography, +as well as keys used by the <tt>ntpq</tt> and <tt>ntpdc</tt> +programs. The authentication procedures require that both the local +and remote servers share the same key and key identifier for this +purpose, although different keys can be used with different +servers. The <tt><i>key</i></tt> arguments are 32-bit unsigned +integers with values from 1 to 65,534.</dd> +</dl> + +<h4>Files</h4> + +<tt>ntp.keys</tt> private MD5 keys <br> +<tt>ntpkey</tt> RSA private key <br> +<tt>ntpkey_<i>host</i></tt> RSA public key <br> +<tt>ntp_dh</tt> Diffie-Hellman agreement parameters + +<h4>Bugs</h4> + +The <tt>ntpkey_<i>host</i></tt> files are really digital +certificates. These should be obtained via secure directory +services when they become universally available. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/biblio.htm b/contrib/ntp/html/biblio.htm index 3396481..7f621d3 100644 --- a/contrib/ntp/html/biblio.htm +++ b/contrib/ntp/html/biblio.htm @@ -3,257 +3,104 @@ Protocol Conformance Statement </title></head><body><h3> Protocol Conformance Statement </h3> -<BR><IMG align=left SRC="pic/flatheads.gif">From <i>The -Wizard of Oz</i>, L. Frank Baum + +<img align=left src=pic/flatheads.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>From <i>The +Wizard of Oz</i>, L. Frank Baum</a> <p>Say it three times and it must be right. <br clear=left> <hr> -<p>The Network Time Protocol (NTP) is used to synchronize the time of -a computer client or server to another server or reference time source, -such as a radio or satellite receiver or modem. It provides accuracies -typically within a millisecond on LANs up to a few tens of milliseconds -on WANs relative to Coordinated Universal Time (UTC), as provided by a -Global Positioning Service (GPS) receiver, for example. - -<p>Typical NTP configurations utilize multiple redundant servers and -diverse network paths, in order to achieve high accuracy and -reliability. Some configurations include cryptographic authentication to -prevent accidental or malicious protocol attacks. Information on the NTP -architecture, protocol and algorithms can be found in the following -articles and reports, which are available online. General issues of the -concepts and facilities assumed by NTP are discussed in tne <a -href=exec.htm>Executive Summary - Computer Network Time -Synchronization</a> page, while issues related to the NTP timescale and -pending century are discussed in the <A HREF=y2k.htm> Network Time -Protocol Year 2000 Conformance Statement</A> page, both of which are -included in this document. - -<p>Note that network timekeeping technology continues to advance and may -obsolete some of the following documents. For a current list of all -papers, reports, briefings and other documents relevant to the NTP -community, see the <a href=http://www.eecis.udel.edu/~mills>David L. -Mills</a> web page. - -<P>The NTP architecture, protocol and algorithm models are described in - -<UL> - -<li>Mills, D.L. Internet time synchronization: the Network Time -Protocol. <I>IEEE Trans. Communications COM-39, 10</I> (October 1991), -1482-1493. <A -HREF=http://www.eecis.udel.edu/~mills/database/papers/trans.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/papers/trans.pdf> -PDF</a>. Also in: Yang, Z., and T.A. Marsland (Eds.). <I>Global States -and Time in Distributed Systems</I>. IEEE Computer Society Press, Los -Alamitos, CA, 1994, 91-102. -</UL> - -The NTP specification and implementation has evolved over the last two -decades to the current Version 4 of the protocol. This version includes -significant enhancements in accuracy and reliability, as determined by -experience in an estimated total of well over 100,000 clients and -servers in the Internet, while retaining backward compatibility with -previous versions. - -<P>This software distribution contains an implementation of the NTP -Version 4 architecture, protocol and algorithms. While a formal -specification of this version is not yet available, this version is -fully compliant with the previous NTP Version 3 specification and -implementation defined in -<UL> - -<li>Mills, D.L. Network Time Protocol (Version 3) specification, -implementation and analysis. Network Working Group Report RFC-1305, -University of Delaware, March 1992, 113 pp. Abstract: <A -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305a.ps> -PostScript)</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305a.pdf> -PDF</A>, Body: <a -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305b.ps> -PostScript)</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305b.pdf> -PDF</A>, Appendices: <A -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.ps> -PostScript</a> | <a -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.pdf> -PDF</A>. - -</UL> - -The NTP Version 4 implementation adds a number of extensions and -refinements to the previous version, including an autonomous -configuration and authentication capability, improved clock discipline -algorithms capable of submicrosecond accuracy and many other -refinements. Specific changes since the Version 3 specification was -issued include: - -<OL> - -<p><LI>Support for precision-time kernel modifications, as described -in</LI> - -<P>Mills, D.L. Unix kernel modifications for precision time -synchronization. Electrical Engineering Department Report 94-10-1, -University of Delaware, October 1994, 24 pp. Abstract: <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/kern/kerna.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/reports/kern/kerna.pdf> -PDF</a>, Body: <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.pdf> -PDF</a>. Major revision and update of: Network Working Group Report -RFC-1589, University of Delaware, March 1994. 31 pp. <A -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc1589.txt>ASCII</A> - -<p><LI>Support for IP Multicasting, as described in</LI> - -<P>Mills, D.L, and A. Thyagarajan. Network time protocol version 4 -proposed changes. Electrical Engineering Department Report 94-10-2, -University of Delaware, October 1994, 32 pp. Abstract: <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/acts/actsa.ps> -PostScript</A> | <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/acts/actsa.pdf> -PDF</A>, Body: <a -HREF=http://www.eecis.udel.edu/~mills/database/reports/acts/actsb.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/reports/acts/actsb.pdf> -PDF</a> - -<p><LI>A new hybrid phase/frequency-lock clock discipline, which -replaces the RFC-1305 local clock algorithm, as described in</LI> - - -<P>Mills, D.L. Clock discipline algorithms for the Network Time Protocol -Version 4. Electrical Engineering Report 97-3-3, University of Delaware, -March 1997, 35 pp. Abstract: <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/allan/securea.ps> -PostScript</A> | <a -HREF= -http://www.eecis.udel.edu/~mills/database/reports/allan/securea.pdf> -PDF</a>, Body: <A -HREF=http://www.eecis.udel.edu/~mills/database/reports/allan/secureb.ps> -PostScript</A> | <a -HREF= -http://www.eecis.udel.edu/~mills/database/reports/allan/secureb.pdf> -PDF</a> - -<P>Mills, D.L. Improved algorithms for synchronizing computer network -clocks. <I>IEEE/ACM Trans. Networks 3, 3</I> (June 1995), 245-254. <A -HREF=http://www.eecis.udel.edu/~mills/database/papers/tune2.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/papers/tune2.pdf> -PDF</a> - -<P><LI>Engineered refinements to radio clock drivers and interface code, -as describedin:</LI> - -<P>Mills, D.L. Precision synchronization of computer network clocks. -<I>ACM Computer Communication Review 24, 2</I> (April 1994). 28-43. <A -HREF=http://www.eecis.udel.edu/~mills/database/papers/fine.ps> -PostScript</A> | <A -HREF=http://www.eecis.udel.edu/~mills/database/papers/fine.pdf> -PDF</a> - -<P><LI>Support for over two dozen reference clock drivers for all known -national and international radio, satellite and modem standard time -services known at this time. See the <A HREF=refclock.htm>Reference -Clock Drivers </A>page.</LI> - -<P><LI>A new security model and authentication scheme based on public- -key cryptography called <I>autokey</I>, as described in</LI> - -<P>Mills, D.L., T.S. Glassey, and M.E. McNeil. Coexistence and -interoperability of NTP authentication schemes. Internet Draft -draft-mills-ntp-auth-coexist-00.txt, University of Delaware and Coastek -InfoSys, Inc., November 1997, 8 pp. <A -HREF=http://www.eecis.udel.edu/~mills/memos/draft.txt>ASCII</A> - -<P>Mills, D.L. Authentication scheme for distributed, ubiquitous, real- -time protocols. <I>Proc. Advanced Telecommunications/Information -Distribution Research Program (ATIRP) Conference</I> (College Park MD, -January 1997), 293-298. <A -HREF=http://www.eecis.udel.edu/~mills/database/papers/atirp.ps> -PostScript</A> | <a -HREF=http://www.eecis.udel.edu/~mills/database/papers/atirp.pdf> -PDF</a> - -<P>Mills, D.L. Proposed authentication enhancements for the Network Time +<p>The Network Time Protocol (NTP) is used to synchronize the time of a computer client or server to another server or reference time source, such as a radio or satellite receiver or modem. It provides accuracies typically within a millisecond on LANs up to a few tens of milliseconds on WANs relative to Coordinated Universal Time (UTC), as provided by a Global Positioning Service (GPS) receiver, for example. Typical NTP configurations utilize multiple redundant servers and diverse network paths, in order to achieve high accuracy and reliability. Some configurations include cryptographic authentication to prevent accidental or malicious protocol attacks. + +<p>Information on the NTP architecture, protocol and algorithms can be found in the following articles and reports, which are available online. General issues of the concepts and facilities assumed by NTP are discussed in the <a href=exec.htm>Executive Summary - Computer Network Time Synchronization</a> page, while issues related to the NTP timescale and pending century are discussed in the <a href=y2k.htm> Network Time Protocol Year 2000 Conformance Statement</a> page, both of which are included in this software distribution. Network timekeeping technology continues to advance and may obsolete some of the following documents. For a current list of all papers, reports, briefings and other documents relevant to the NTP community, see the <a href=http://www.eecis.udel.edu/~mills>David L. Mills</a> web page. A historical perspective is available in + +<ul> + +<p><li>Mills, D.L. A brief history of NTP time: confessions of an Internet timekeeper. Submitted for publication; please do not cite or redistribute. <a href=database/papers/history.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/history.pdf>PDF</a> + +</ul> + +<p>The NTP architecture, protocol and algorithm models are described in + +<ul> + +<p><li>Mills, D.L. Internet time synchronization: the Network Time Protocol. <I>IEEE Trans. Communications COM-39, 10</I> (October 1991), 1482-1493. <a href=http://www.eecis.udel.edu/~mills/database/papers/trans.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/trans.pdf> PDF</a>. Also in: Yang, Z., and T.A. Marsland (Eds.). <I>Global States and Time in Distributed Systems</I>. IEEE Computer Society Press, Los Alamitos, CA, 1994, 91-102. + +</ul> + +<p>The NTP specification and implementation has evolved over the last two decades to the current Version 4 of the protocol. This version includes significant enhancements in accuracy and reliability, as determined by experience in an estimated total of well over 100,000 clients and servers in the Internet, while retaining backward compatibility with previous versions. This software distribution contains an implementation of the NTP Version 4 architecture, protocol and algorithms. While a formal specification of this version is not yet available, this version is fully compliant with the previous NTP Version 3 specification and implementation defined in +<ul> + +<p><li>Mills, D.L. Network Time Protocol (Version 3) specification, implementation and analysis. Network Working Group Report RFC-1305, University of Delaware, March 1992, 113 pp. Abstract: <a +href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305a.ps> PostScript)</a> | <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305a.pdf> PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305b.ps> PostScript)</a> | <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305b.pdf> PDF</a>, Appendices: <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.pdf> PDF</a>. + +</ul> + +<p>The NTP Version 4 implementation adds a number of extensions and refinements to the previous version, including an autonomous configuration and authentication capability, improved clock discipline algorithms capable of submicrosecond accuracy and many other refinements. Specific changes since the Version 3 specification was issued include: + +<ol> + +<p><li>Support for precision-time kernel modifications, as described in + +<p>Mills, D.L., and P.-H. Kamp. The nanokernel. <i>Proc. Precision Time and Time Interval (PTTI) Applications and Planning Meeting</i> (Reston VA, November 2000). Paper: <a href=http://www.eecis.udel.edu/~mills/database/papers/nano/nano2.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/nano/nano2.pdf>PDF</a>, Slides: <a href=database/brief/nano/nano.htm>HTML</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/nano/nano.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/nano/nano.ppt>PowerPoint</a> + +<p>Mills, D.L. Unix kernel modifications for precision time synchronization. Electrical Engineering Department Report 94-10-1, University of Delaware, October 1994, 24 pp. Abstract: <a href=http://www.eecis.udel.edu/~mills/database/reports/kern/kerna.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/kern/kerna.pdf> PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.pdf> PDF</a>. Major revision and update of: Network Working Group Report RFC-1589, University of Delaware, March 1994. 31 pp. <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc1589.txt>ASCII</a> + +<p><li>Support for IP Multicasting, as described the <a href=assoc.htm>Association Management</a> page and in + +<p>Mills, D.L, and A. Thyagarajan. Network time protocol version 4 proposed changes. Electrical Engineering Department Report 94-10-2, University of Delaware, October 1994, 32 pp. Abstract: <a href=http://www.eecis.udel.edu/~mills/database/reports/acts/actsa.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/acts/actsa.pdf> PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/reports/acts/actsb.ps> PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/acts/actsb.pdf> PDF</a> + +<p><li>A new hybrid phase/frequency-lock clock discipline, which +replaces the RFC-1305 local clock algorithm, as described in</li> + +<p>Mills, D.L. Improved algorithms for synchronizing computer network clocks. <I>IEEE/ACM Trans. Networks 3, 3</I> (June 1995), 245-254. <a href=http://www.eecis.udel.edu/~mills/database/papers/tune2.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/tune2.pdf>PDF</a> + +<p>Mills, D.L. Clock discipline algorithms for the Network Time Protocol Version 4. Electrical Engineering Report 97-3-3, University of Delaware, March 1997, 35 pp. Abstract: <a href=http://www.eecis.udel.edu/~mills/database/reports/allan/securea.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/allan/securea.pdf> PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/reports/allan/secureb.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/allan/secureb.pdf>PDF</a> + +<p><li>Simple Network Monitoring Protocol (SNMP) monitoring tools, as described in</li> + +<p>Sethi, A.S., H. Gao, and D.L. Mills. Management of the Network Time Protocol (NTP) with SNMP. Computer and Information Sciences Report 98-09, University of Delaware, November 1998, 32 pp. <a href=http://www.eecis.udel.edu/~mills/database/reports/ntp-mib-tr.ps>PostScript</a> | <a href=database/reports/ntp-mib-tr.pdf>PDF</a> + +<p><li>Engineered refinements to radio clock drivers and interface code, as described in in the <a href=pps.htm>Pulse-per-second (PPS) Signal Interfacing</a> page and</li> + +<p>Mogul, J., D. Mills, J. Brittenson, J. Stone and U. Windl. Pulse-per-second API for Unix-like operating systems, version 1. Request for Comments RFC-2783, Internet Engineering Task Force, March 2000, 31 pp. <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc2783.txt>ASCII</a> + +<p>Mills, D.L. Precision synchronization of computer network clocks. <I>ACM Computer Communication Review 24, 2</I> (April 1994). 28-43. <a href=http://www.eecis.udel.edu/~mills/database/papers/fine.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/fine.pdf>PDF</a> + +<p><li>Support for over two dozen reference clock drivers for all known national and international radio, satellite and modem standard time services known at this time. See the <a href=refclock.htm>Reference Clock Drivers</a> page.</li> + +<p><li>A new security model and authentication scheme based on public-key cryptography called <I>Autokey</I>, as described in the <a href=authopt.htm>Authentication Options</a> page and in</li> + +<p>Mills, D.L. Public-Key cryptography for the Network Time Protocol. Internet Draft draft-ietf-stime-ntpauth-00.txt, University of Delaware, June 2000, 36 pp. <a href=http://www.eecis.udel.edu/~mills/database/memos/draft-ietf-stime-ntpauth-00.txt>ASCII</a> + +<p>Mills, D.L. Public key cryptography for the Network Time Protocol. Electrical Engineering Report 00-5-1, University of Delaware, May 2000. 23 pp. Abstract: <a href=http://www.eecis.udel.edu/~mills/database/reports/pkey/pkeya.ps>PostScript</a> | <a href=database/reports/pkey/pkeya.pdf>PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/reports/pkey/pkeyb.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/pkey/pkeyb.pdf>PDF</a> + +<p>Mills, D.L. Authentication scheme for distributed, ubiquitous, real-time protocols. <I>Proc. Advanced Telecommunications/Information Distribution Research Program (ATIRP) Conference</I> (College Park MD, January 1997), 293-298. <a href=http://www.eecis.udel.edu/~mills/database/papers/atirp.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/atirp.pdf>PDF</a> + +<p>Mills, D.L. Proposed authentication enhancements for the Network Time Protocol version 4. Electrical Engineering Report 96-10-3, University of -Delaware, October 1996, 36 pp. Abstract: <A -HREF= -http://www.eecis.udel.edu/~mills/database/reports/secure/securea.ps> -PostScript</A> | <a -HREF= -http://www.eecis.udel.edu/~mills/database/reports/secure/securea.pdf> -PDF</a>, Body: <A -HREF= -http://www.eecis.udel.edu/~mills/database/reports/secure/secureb.ps> -PostScript</A> | <a -HREF= -http://www.eecis.udel.edu/~mills/database/reports/secure/secureb.pdf> -PDF</a> - -<P><LI> Support for the MD5 cryptographic hash algorithm, in addition to -the DES-CBC algorithm described in RFC-1305, as described in the <A -HREF=ntpd.htm><TT>ntpd</TT> - Network Time Protocol (NTP) daemon -</A>page.</LI> - -<P><LI>The prefer-peer scheme, as described in the <A -HREF=prefer.htm>Mitigation Rules and the <TT>prefer</TT> Keyword -</A>page.</LI> - -<P><LI>Specification for the Simple Network Time Protocol (SNTP), as -described in</LI> - -<P>Mills, D.L. Simple network time protocol (SNTP) version 4 for IPv4, -IPv6 and OSI. Network Working Group Report RFC-2030, University of -Delaware, October 1996, 18 pp. <A -HREF=http://www.eecis.udel.edu/~mills/database/rfc/rfc2030.txt> -ASCII</A>. Obsoletes RFC-1769 and RFC-1361. - -<P><LI>Performance surveys for NTP Version 4 can be found in</LI> - -<p><li>Mills, D.L., A. Thyagarajan and B.C. Huffman. Internet -timekeeping around the globe. <i>Proc. Precision Time and Time Interval -(PTTI) Applications and Planning Meeting</i> (Long Beach CA, December -1997), 365-371. Paper: <a -href=http://www.eecis.udel.edu/~mills/database/papers/survey5.ps> -PostScript</a> | <a -href=http://www.eecis.udel.edu/~mills/database/papers/survey5.pdf> -PDF</a>, Slides: <a -href= -http://www.eecis.udel.edu/~mills/database/brief/survey/survey/index.htm> -HTML</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/survey/survey.ps> -PostScript</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/survey.ppt> -PowerPoint</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/survey/survey.pdf> -PDF</a></li> - -<p><li>Mills, D.L. The network computer as precision timekeeper. -<i>Proc. Precision Time and Time Interval (PTTI) Applications and -Planning Meeting</i> (Reston VA, December 1996), 96-108. Paper: <a -href=http://www.eecis.udel.edu/~mills/database/papers/ptti.ps> -PostScript</a> | <a -href=http://www.eecis.udel.edu/~mills/database/papers/ptti.pdf> -PDF</a>, Slides: <a -href= -http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti/index.htm> -HTML</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.ps> -PostScript</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.ppt> -PowerPoint</a> | <a -href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.pdf> -PDF</a></li> - -</OL> - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +Delaware, October 1996, 36 pp. Abstract: <a href=http://www.eecis.udel.edu/~mills/database/reports/secure/securea.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/secure/securea.pdf>PDF</a>, Body: <a href=http://www.eecis.udel.edu/~mills/database/reports/secure/secureb.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/reports/secure/secureb.pdf>PDF</a> + +<p><li> Support for the MD5 cryptographic hash algorithm, in addition to the DES-CBC algorithm described in RFC-1305, as described in the <a href=ntpd.htm><tt>ntpd</tt> - Network Time Protocol (NTP) daemon </a>page.</li> + +<p><li>The prefer-peer scheme, as described in the <a href=prefer.htm>Mitigation Rules and the <tt>prefer</tt> Keyword </a>page.</li> + +<p><li>Specification for the Simple Network Time Protocol (SNTP), as described in</li> + +<p>Mills, D.L. Simple network time protocol (SNTP) version 4 for IPv4, IPv6 and OSI. Network Working Group Report RFC-2030, University of Delaware, October 1996, 18 pp. <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc2030.txt>ASCII</a>. Obsoletes RFC-1769 and RFC-1361. + +<p><li>Support for International Atomic Time (TAI), as described in</li> + +<p>Levine, J., and D. Mills. Using the Network Time Protocol to transmit International Atomic Time (TAI). <i>Proc. Precision Time and Time Interval (PTTI) Applications and Planning Meeting</i> (Reston VA, November 2000). Paper: <a href=http://www.eecis.udel.edu/~mills/database/papers/tai.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/tai.pdf>PDF</a> + +<p><li>Performance surveys for NTP Version 4 can be found in</li> + +<p>Mills, D.L., A. Thyagarajan and B.C. Huffman. Internet timekeeping around the globe. <i>Proc. Precision Time and Time Interval (PTTI) Applications and Planning Meeting</i> (Long Beach CA, December 1997), 365-371. Paper: <a +href=http://www.eecis.udel.edu/~mills/database/papers/survey5.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/survey5.pdf>PDF</a>, Slides: <a href=http://www.eecis.udel.edu/~mills/database/brief/survey/survey/index.htm>HTML</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/survey/survey.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/survey.ppt>PowerPoint</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/survey/survey.pdf>PDF</a> + +<p>Mills, D.L. The network computer as precision timekeeper. <i>Proc. Precision Time and Time Interval (PTTI) Applications and Planning Meeting</i> (Reston VA, December 1996), 96-108. Paper: <a href=http://www.eecis.udel.edu/~mills/database/papers/ptti.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/papers/ptti.pdf>PDF</a>, Slides: <a href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti/index.htm>HTML</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.ps>PostScript</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.ppt>PowerPoint</a> | <a href=http://www.eecis.udel.edu/~mills/database/brief/ptti/ptti.pdf>PDF</a> + +</ol> + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/build.htm b/contrib/ntp/html/build.htm index 44b0391..5981de3 100644 --- a/contrib/ntp/html/build.htm +++ b/contrib/ntp/html/build.htm @@ -1,186 +1,239 @@ -<HTML><HEAD><TITLE> -Building and Installing the Distribution -</TITLE></HEAD><BODY><H3> -Building and Installing the Distribution -</H3> - -<img align=left src=pic/beaver.gif>From <i>pogo</i>, Walt Kelly - -<p>For putting out compiler fires. -<br clear=left><hr> - -<H4>Building and Installing the Distribution</H4> - -As a practical matter, every computer architecture and operating system -version seems to be different than any other. The device drivers may be -different, the input/output system may bew idiosyncratic and the -libraries may have different semantics. It is not possible in a software -distribution such as this one to support every individual sysdtem with a -common set of binaries, even with the same system but different -versions. Therefore, it is necessary to configure each system -individually for each system and version, both at compile time and at -run time. In almost all cases, these procedures are completely automatic -and all the newbie user need do is type "make" and the autoconfigure -system does the rest. There are some exceptions, as noted below. - -<p>The autoconfigure system inspects the hardware and software -environment and tests for the presence of system header files and the -contents of these files to determine if certain features are available. -When one or more of these features are present, the code is compiled to -use them; if not, no special code is compiled. However, even if the code -is compiled to use these features, the code does a special test at run -time to see if one or more are actually present and avoids using them if -not present. In such cases a warning message is sent to the system log, -but the daemon should still work properly. - -Some programs included in this distribution use cryptographic algorithms -to verify server authenticity and credentials. As required by the -International Trade in Arms Regulations (ITAR), now called the Defense -Trade Regulations (DTR), certain cryptographic products and media, -including the Data Encryption Standard (DES), cannot be exported without -per-instance license. For this reason, the DES encryption routine has -been removed from the the current version, even though it is used only -to compute a message digest. Current DTR regulations allow export of the -the MD5 message digest routine, which is in fact the preferred -algorithm, and this is included in the current -version. - -<P>The NTP authentication routines conform to the interface used by RSA -Laboratories in the <TT>rsaref20.zip</TT> package, which is downloadable -from <TT>ftp.rsa.com</TT> or via the web at <TT>www.rsa.com</TT>. -Outside the U.S. and Canada, the functionally identical -<TT>rsaeuro.zip</TT> package is available from J.S.A. Kapp and other -sources. The recommended way to integrate the DES routines in either -package with the NTP build procedures is to copy the <TT>desc.c</TT> -file from the <TT>./source</TT> directory in the package to the -<TT>./libntp</TT> directory in the distribution. Then copy the header -files <TT>rsaref.h</TT>, <TT>des.h</TT> and <TT>md2.h</TT> in the -<TT>./source</TT> directory to the <TT>./include</TT> directory. Do not -copy the <TT>global.h</TT> header file; the one in the distribution has -been modified. These steps must be completed before the configuration -process described below. - -<H4>Building and Installing under Unix</H4> - -Make sure that you have all necessary tools for building executables. -These tools include <TT>cc/gcc, make, awk, sed, tr, sh, grep, egrep</TT> -and a few others. Not all of these tools exist in the standard -distribution of modern Unix versions (compilers are likely to be an -add-on product - consider using the GNU tools and <TT>gcc</TT> -compiler in this case). For a successful build, all of these tools -should be accessible via the current path. - -<H4>Configuration</H4> - -Use the <TT>./configure</TT> command to perform an automatic -configuration procedure. This procedure normally includes the debugging -code, which can be useful in diagnosing problems found in initial test, -and all reference clock drivers known to work with each machine and +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Building and Installing the Distribution</title> +</head> +<body> +<h3>Building and Installing the Distribution</h3> + +<img align="left" src="pic/beaver.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>For putting out compiler fires.<br clear="left"> +</p> + +<hr> +<h4>Building and Installing the Distribution</h4> + +<p>As a practical matter, every computer architecture and operating +system version seems to be different than any other. The device +drivers may be different, the input/output system may be +idiosyncratic and the libraries may have different semantics. It is +not possible in a software distribution such as this one to support +every individual sysdtem with a common set of binaries, even with +the same system but different versions. Therefore, it is necessary +to configure each system individually for each system and version, +both at compile time and at run time. In almost all cases, these +procedures are completely automatic and all the newbie user need do +is type "make" and the autoconfigure system does the rest. There +are some exceptions, as noted below.</p> + +<p>Some programs included in this distribution use cryptographic +algorithms to verify server authenticity and credentials. As +required by the International Trade in Arms Regulations (ITAR), now +called the Defense Trade Regulations (DTR), certain cryptographic +products and media, including the Data Encryption Standard (DES), +cannot be exported without per-instance license. For this reason, +the DES encryption routine has been removed from the the current +version, even though it is used only to compute a message digest. +Current DTR regulations allow export of the the MD5 message digest +routine, which is in fact the preferred algorithm, and this is +included in the current version.</p> + +<p>The NTP authentication routines conform to the interface used by +RSA Laboratories in the <tt>rsaref20.zip</tt> package, which was +formerly downloadable from <tt>ftp.rsa.com</tt> or via the web at +<tt>www.rsa.com</tt>, but this may no longer be the case. Outside +the US and Canada, the functionally identical <tt>rsaeuro.zip</tt> +package is available from J.S.A. Kapp and other sources. The +recommended way to integrate the routines in either package with +the NTP build procedures is to uncompress and extract the <tt> +rsaref20</tt> files in a top level directory with that name. Then +install a link to that directory from <tt>rsaref2</tt> in the top +level directory of the distribution. Use <tt>rsaeuro1</tt> instead +for that distribution. These steps must be completed +before the configuration process described below.</p> + +<h4>Building and Installing under Unix</h4> + +Make sure that you have all necessary tools for building +executables. These tools include <tt>cc/gcc, make, awk, sed, tr, +sh, grep, egrep</tt> and a few others. Not all of these tools exist +in the standard distribution of modern Unix versions (compilers are +likely to be an add-on product - consider using the GNU tools and +<tt>gcc</tt> compiler in this case). For a successful build, all of +these tools should be accessible via the current path. + +<p>The first thing to do is uncompress the distribution and extract +the source tree. Use the <tt>./configure</tt> command to perform an +automatic configuration procedure. This command inspects the +hardware and software environment and tests for the presence of +system header files and the contents of these files to determine if +certain features are present. When one or more of these features +are present, the code is compiled to use them; if not, no special +code is compiled. However, even if the code is compiled to use +these features, the code does a special test at run time to see if +one or more are actually present and avoids using them if not +present. In such cases a warning message is sent to the system log, +but the daemon should still work properly.</p> + +<p>The default build normally includes the debugging code, which +can be useful in diagnosing problems found in initial test, and all +reference clock drivers known to work with each machine and operating system. Unless memory space is at a premium, this is a sensible strategy and saves lots of messy fiddling. If you need to -delete either the debugging code or one or more or all reference clock -drivers to save space, see the <A HREF="config.htm">Configuration -Options</A> page. - -<P>If your site supports multiple architectures and uses NFS to share -files, you can use a single source tree to compile executables for all -architectures. While running on a target architecture machine and with -the distribution base directory active, create a subdirectory using a -command like <TT>mkdir A.`config.guess`</TT>, which will create an -architecture-specific directory with name peculiar to the architecture -and operating system. Then change to this directory and configure with -the <TT>../configure</TT> command. The remaining steps are the same -whether building in the base directory or in the subdirectory. - -<H4>Compilation</H4> - -Peruse the operating-system-specific information for your architecture -under <A HREF="hints.htm">Hints and Kinks</A>. - -<P>Use the <TT>make</TT> command to compile all source modules, +delete either the debugging code or one or more or all reference +clock drivers to save space, see the <a href="config.htm"> +Configuration Options</a> page.</p> + +<p>If your site supports multiple architectures and uses NFS to +share files, you can use a single source tree to compile +executables for all architectures. While running on a target +architecture machine and with the distribution base directory +active, create a subdirectory using a command like <tt>mkdir +A.`config.guess`</tt>, which will create an architecture-specific +directory with name peculiar to the architecture and operating +system. Then change to this directory and configure with the <tt> +../configure</tt> command. The remaining steps are the same whether +building in the base directory or in the subdirectory.</p> + +<h4>Compilation</h4> + +Peruse the operating-system-specific information for your +architecture under <a href="hints.htm">Hints and Kinks</a>. + +<p>Use the <tt>make</tt> command to compile all source modules, construct the libraries and link the distribution. Expect few or no -warnings using <TT>cc</TT> and a moderate level of warnings using -<TT>gcc</TT>. Note: On some Unix platforms the use of <TT>gcc</TT> can -result in quite a few complaints about system header files and type -inconsistencies, especially about pointer variables. This is usually the -case when the system header files are not up to ANSI standards or -<TT>gcc</TT>-isms, when gcc is not installed properly, or when operating -system updates and patches are applied and gcc is not reinstalled. While -the autoconfigure process is quite thorough, the Unix programming -cultures of the various workstation makers still remain idiosyncratic. - -<H4>Installation</H4> - -As root, use the <TT>make install</TT> command to install the binaries -in the destination directory. You must of course have write permission -on the install destination directory. This includes the programs <TT><A -HREF="ntpd.htm">ntpd</A></TT> (the daemon), <TT><A -HREF="ntpdc.htm">ntpdc</A></TT> (an <TT>ntpd</TT>-dependent query -program), <TT><A HREF="ntpq.htm">ntpq</A></TT> (a standard query -program), <TT><A HREF="ntpdate.htm">ntpdate</A></TT> (an <TT>rdate</TT> -replacement for boot time date setting and sloppy time keeping) and -<TT><A HREF="ntptrace.htm">ntptrace</A></TT> (a utility useful to find -the primary (stratum-1) servers). In some systems, the <TT><A -HREF="tickadj.htm">tickadj</A></TT> (a utility useful to adjust kernel -variables) is installed. If the precision time kernel modifications are -present, the <TT><A HREF="ntptime.htm">ntptime</A></TT> (a utility -useful to debug kernel time functions) is installed. - -<P>You are now ready to configure the daemon and start it. You will need -to create a NTP configuration file <TT>ntp.conf</TT> and possibly a -cryptographic key file <TT>ntp.keys</TT>. Directions for doing that are -in the <A HREF="notes.htm">Notes on Configuring NTP and Setting up a NTP -Subnet</A>. The behavior when the daemon starts for the first time can -be counterintuitive. To reduce the level of angst, see the <a -href=quick.htm>Quick Start</a> page. A tutorial on debugging technique -is in <A HREF="debug.htm">NTP Debugging Technique</A>. - -<P>If problems peculiar to the particular hardware and software -environment (e.g. operating system -specific issues) are suspected, -browse the <A HREF="hints.htm">Hints and Kinks</A> page. - -<P>Bug reports of a general nature can be sent to David Mills <A -HREF="mailto: mills@udel.edu"><mills@udel.edu></A>. Bug reports of a -specific nature on features implemented by the programmer corps -mentioned in the <A HREF="copyright.htm">Copyright</A> page should be -sent directly to the implementor listed in that page, with copy to -mills@udel.edu. - -<P><B>Please include the version of the source distribution (e.g., ntp- -4.0.70a) in your bug report.</B> - -<P><B>Please include the <B>output</B> of <TT>config.guess</TT> in your -bug report.</B> - -<P><B>It will look something like: <TT>pdp11-dec-fuzzos3.4</TT></B> - -<P>Additional <TT>make</TT> commands - -<DL> - -<DT><TT>make clean</TT></DT> - -<DD>Cleans out object files, programs and temporary files.</DD> - -<DT><TT>make distclean</TT></DT> - -<DD>Does the work of <TT>clean</TT>, but cleans out all directories in -preparation for a new distribution release.</DD> - -<DT><TT>make dist</TT></DT> - -<DD> -Does the work of <TT>make distclean</TT>, but constructs compressed tar -files for distribution. You must have GNU automake to perform this -function.</DD> - -</DL> - -<H4>Building and Installing under Windows NT</H4> -See <tt><a href="hints/winnt.htm">hints/winnt.htm</a> </tt>for directions -to compile the sources and install the executables. - -<hr><a href=index.htm><img align=left -src=pic/home.gif></a><address><a href="mailto:mills@udel.edu"> David L. -Mills <mills@udel.edu></a> -</address></body></html> +warnings using <tt>cc</tt> and a moderate level of warnings using +<tt>gcc</tt>. Note: On some Unix platforms the use of <tt>gcc</tt> +can result in quite a few complaints about system header files and +type inconsistencies, especially about pointer variables. This is +usually the case when the system header files are not up to ANSI +standards or <tt>gcc</tt>-isms, when gcc is not installed properly, +or when operating system updates and patches are applied and gcc is +not reinstalled. While the autoconfigure process is quite thorough, +the Unix programming cultures of the various workstation makers +still remain idiosyncratic.</p> + +<h4>Installation</h4> + +As root, use the <tt>make install</tt> command to install the +binaries in the destination directory. You must of course have +write permission on the install in the destination directory. This +includes the following programs: + +<ul> +<li><a href="ntpd.htm"><tt>ntpd</tt> - Network Time Protocol (NTP) +daemon</a></li> + +<li><a href="ntpq.htm"><tt>ntpq</tt> - standard NTP query +program</a></li> + +<li><a href="ntpdc.htm"><tt>ntpdc</tt> - special NTP query +program</a></li> + +<li><a href="ntpdate.htm"><tt>ntpdate</tt> - set the date and time +via NTP</a></li> + +<li><a href="ntptrace.htm"><tt>ntptrace</tt> - trace a chain of NTP +servers back to the primary source</a></li> +</ul> + +<p>If the precision time kernel modifications are present, the +following program is installed:</p> + +<ul> +<li><a href="ntptime.htm"><tt>ntptime</tt> - read kernel time +variables</a></li> +</ul> + +<p>If the public key authentication functions are present, the +following program is installed:</p> + +<ul> +<li><a href="genkeys.htm"><tt>ntp-genkeys</tt> - generate public +and private keys</a></li> +</ul> + +<p>In some systems that include the capability to edit kernel +variables, the following program is installed:</p> + +<ul> +<li><a href="tickadj.htm"><tt>tickadj</tt> - set time-related +kernel variables</a></li> +</ul> + +<h4>Configuration</h4> + +<p>You are now ready to configure the daemon and start it. You will +need to create a NTP configuration file <tt>ntp.conf</tt> and +possibly a cryptographic key file <tt>ntp.keys</tt>. Newbies should +see the <a href="quick.htm">Quick Start</a> page for orientation. +Seasoned veterans can start with the <a href="ntpd.htm"><tt> +ntpd</tt> - Network Time Protocol (NTP) daemon</a> page and move on +to the specific configuration option pages from there. A tutorial +on NTP subnet design and configuration options is in the <a href= +"notes.htm">Notes on Configuring NTP and Setting up a NTP +Subnet</a> page.</p> + +<h4>If You Have Problems</h4> + +<p>If you have problems peculiar to the particular hardware and +software environment (e.g. operating system-specific issues), +browse the <a href="hints.htm">Hints and Kinks</a> page. For other +problems a tutorial on debugging technique is in the <a href= +"debug.htm">NTP Debugging Technique</a> page. As always, the first +line of general assistance is the <a href="http://www.ntp.org">NTP +web site www.ntp.org</a> and the FAQ resident there. Requests for +assistance of a general nature and of interest to other timekeepers +should be sent to the NTP newsgroup. Bug reports of a specific +nature should be sent to <a href="mailto:bugs@mail.ntp.org"> +<bugs@mail.ntp.org></a>. Bug reports of a specific nature on +features implemented by the programmer corps mentioned in the <a +href="copyright.htm">Copyright</a> page should be sent directly to +the implementor listed in that page, with copy to +bugs@mail.ntp.org.</p> + +<p>Please include the version of the source distribution (e.g., +ntp-4.0.70a) in your bug report, as well as billboards from the +relevant utility programs and debug trace, if available. Please +include the output of <tt>config.guess</tt> in your bug report. It +will look something like:</p> + +<p><tt>pdp11-dec-fuzzos3.4</tt></p> + +<p>Additional <tt>make</tt> commands</p> + +<dl> +<dt><tt>make clean</tt></dt> + +<dd>Cleans out object files, programs and temporary files.</dd> + +<dt><tt>make distclean</tt></dt> + +<dd>Does the work of <tt>clean</tt>, but cleans out all directories +in preparation for a new distribution release.</dd> + +<dt><tt>make dist</tt></dt> + +<dd>Does the work of <tt>make distclean</tt>, but constructs +compressed tar files for distribution. You must have GNU automake +to perform this function.</dd> +</dl> + +<h4>Building and Installing under Windows NT</h4> + +See <tt><a href="hints/winnt.htm">hints/winnt.htm</a></tt> for +directions to compile the sources and install the executables. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/clockopt.htm b/contrib/ntp/html/clockopt.htm index b128b42..18773f0 100644 --- a/contrib/ntp/html/clockopt.htm +++ b/contrib/ntp/html/clockopt.htm @@ -1,193 +1,76 @@ -<HTML><HEAD><TITLE> +<html><head><title> Reference Clock Options -</TITLE></HEAD><BODY><H3> +</title></head><body><h3> Reference Clock Options -</H3><HR> - -<H4>Reference Clock Support</H4> - -The NTP Version 4 daemon supports many different radio, satellite and -modem reference clocks plus a special pseudo-clock used for backup or -when no other clock source is available. Detailed descriptions of -individual device drivers and options can be found in the <A -HREF="refclock.htm">Reference Clock Drivers </A>page. Additional -information can be found in the pages referenced there, including the <A -HREF="rdebug.htm">Debugging Hints for Reference Clock Drivers</A> and <A -HREF="howto.html">How To Write a Reference Clock Driver</A> pages. In -many drivers, support for a PPS signal is available as described in <A -HREF="pps.htm">Pulse-per-second (PPS) Signal Interfacing</A> page. Many -drivers support special line discipline/streams modules which can -significantly improve the accuracy using the driver. These are described -in the <A HREF="ldisc.htm">Line Disciplines and Streams Drivers</A> +</h3> + +<img align=left src=pic/boom4.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>Pogo</i>, Walt Kelly</a> + +<p>See the radios, all in a row. +<br clear=left><hr> + +<h4>Reference Clock Support</h4> + +The NTP Version 4 daemon supports some three dozen different radio, satellite and modem reference clocks plus a special pseudo-clock used for backup or when no other clock source is available. Detailed descriptions of individual device drivers and options can be found in the <a HREF="refclock.htm">Reference Clock Drivers </a>page. Additional information can be found in the pages linked there, including the <a HREF="rdebug.htm">Debugging Hints for Reference Clock Drivers</a> and <a HREF="howto.htm">How To Write a Reference Clock Driver</a> pages. In addition, support for a PPS signal is available as described in <a HREF="pps.htm">Pulse-per-second (PPS) Signal Interfacing</a> page. Many drivers support special line discipline/streams modules which can significantly improve the accuracy using the driver. These are described in the <a HREF="ldisc.htm">Line Disciplines and Streams Drivers</a> page. -<P>A reference clock will generally (though not always) be a radio -timecode receiver which is synchronized to a source of standard time -such as the services offered by the NRC in Canada and NIST and USNO in -the U.S. The interface between the computer and the timecode receiver is -device dependent, but is usually a serial port. A device driver specific -to each reference clock must be selected and compiled in the -distribution; however, most common radio, satellite and modem clocks are -included by default. Note that an attempt to configure a reference clock -when the driver has not been included or the hardware port has not been -appropriately configured results in a scalding remark to the system log -file, but is otherwise non hazardous. - -<P>For the purposes of configuration, <TT>ntpd</TT> treats reference -clocks in a manner analogous to normal NTP peers as much as possible. -Reference clocks are identified by a syntactically correct but invalid -IP address, in order to distinguish them from normal NTP peers. -Reference clock addresses are of the form <TT>127.127.<I>t.u</I></TT>, -where <I><TT>t</TT></I> is an integer denoting the clock type and -<I><TT>u</TT></I> indicates the unit number. While it may seem overkill, -it is in fact sometimes useful to configure multiple reference clocks of -the same type, in which case the unit numbers must be unique. - -<P>The <TT>server</TT> command is used to configure a reference clock, -where the <I><TT>address</TT></I> argument in that command is the clock -address. The <TT>key</TT>, <TT>version</TT> and <TT>ttl</TT> options are -not used for reference clock support. The <TT>mode</TT> option is added -for reference clock support, as described below. The <TT>prefer</TT> -option can be useful to persuade the server to cherish a reference clock -with somewhat more enthusiasm than other reference clocks or peers. -Further information on this option can be found in the <A -HREF="prefer.htm">Mitigation Rules and the <TT>prefer</TT> Keyword -</A>page. The <TT>minpoll</TT> and <TT>maxpoll</TT> options have meaning -only for selected clock drivers. See the individual clock driver -document pages for additional information. - -<P>The stratum number of a reference clock is by default zero. Since the -<TT>ntpd</TT> daemon adds one to the stratum of each peer, a primary -server ordinarily displays stratum one. In order to provide engineered -backups, it is often useful to specify the reference clock stratum as -greater than zero. The <TT>stratum</TT> option is used for this purpose. -Also, in cases involving both a reference clock and a pulse-per-second -(PPS) discipline signal, it is useful to specify the reference clock -identifier as other than the default, depending on the driver. The -<TT>refid</TT> option is used for this purpose. Except where noted, -these options apply to all clock drivers. - -<H4>Reference Clock Commands</H4> - -<DL><DT><TT>server 127.127.<I>t.u</I> [prefer] [mode <I>int</I>] -[minpoll <I>int</I>] [maxpoll <I>int</I>]</TT></DT> -<DD>This command can be used to configure reference clocks in special -ways. The options are interpreted as follows:</DD> - -<DL><DT><TT>prefer</TT></DT> -<DD>Marks the reference clock as preferred. All other things being -equal, this host will be chosen for synchronization among a set of -correctly operating hosts. See the <A HREF="prefer.htm">Mitigation Rules -and the <TT>prefer</TT> Keyword </A>page for further information.</DD> - -<DT><TT>mode <I>int</I></TT></DT> -<DD>Specifies a mode number which is interpreted in a device-specific -fashion. For instance, it selects a dialing protocol in the ACTS driver -and a device subtype in the <TT>parse</TT> drivers.</DD> - -<DT><TT>minpoll <I>int</I></TT></DT> -<DT><TT>maxpoll<I> int</I></TT></DT> -<DD>These options specify the minimum and maximum polling interval for -reference clock messages, in seconds to the power of two. For most -directly connected reference clocks, both <TT>minpoll</TT> and -<TT>maxpoll</TT> default to 6 (64 s). For modem reference clocks, -<TT>minpoll</TT> defaults to 10 (17.1 m) and <TT>maxpoll</TT> defaults -to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) -inclusive.</DD> - -</DL> - -<DT><TT>fudge 127.127.<I>t.u</I> [time1 <I>sec</I>] [time2 <I>sec</I>] -[stratum <I>int</I>] [refid <I>string</I>] [mode <I>int</I>] [flag1 0|1] -[flag2 0|1] [flag3 0|1] [flag4 0|1]</TT></DT> -<DD>This command can be used to configure reference clocks in special -ways. It must immediately follow the <TT>server</TT> command which +<p>A reference clock will generally (though not always) be a radio timecode receiver which is synchronized to a source of standard time such as the services offered by the NRC in Canada and NIST and USNO in the US. The interface between the computer and the timecode receiver is device dependent, but is usually a serial port. A device driver specific to each reference clock must be selected and compiled in the distribution; however, most common radio, satellite and modem clocks are included by default. Note that an attempt to configure a reference clock when the driver has not been compiled or the hardware port has not been appropriately configured results in a scalding remark to the system log file, but is otherwise non hazardous. + +<p>For the purposes of configuration, <tt>ntpd</tt> treats reference clocks in a manner analogous to normal NTP peers as much as possible. Reference clocks are identified by a syntactically correct but invalid IP address, in order to distinguish them from normal NTP peers. Reference clock addresses are of the form <tt>127.127.<i>t.u</i></tt>, where <i><tt>t</tt></i> is an integer denoting the clock type and <i><tt>u</tt></i> indicates the unit number in the range 0-3. While it may seem overkill, it is in fact sometimes useful to configure multiple reference clocks of the same type, in which case the unit numbers must be unique. + +<p>The <tt>server</tt> command is used to configure a reference clock, where the <i><tt>address</tt></i> argument in that command is the clock address. The <tt>key</tt>, <tt>version</tt> and <tt>ttl</tt> options are not used for reference clock support. The <tt>mode</tt> option is added for reference clock support, as described below. The <tt>prefer</tt> option can be useful to persuade the server to cherish a reference clock with somewhat more enthusiasm than other reference clocks or peers. Further information on this option can be found in the <a HREF="prefer.htm">Mitigation Rules and the <tt>prefer</tt> Keyword </a>page. The <tt>minpoll</tt> and <tt>maxpoll</tt> options have meaning only for selected clock drivers. See the individual clock driver document pages for additional information. + +<p>The <tt>fudge</tt> command is used to provide additional information for individual clock drivers and normally follows immediately after the <tt>server</tt> command. The <i><tt>address</tt></i> argument specifies the clock address. The <tt>refid</tt> and <tt>stratum</tt> options control can be used to override the defaults for the device. There are two optional device-dependent time offsets and four flags that can be included in the <tt>fudge</tt> command as well. + +<p>The stratum number of a reference clock is by default zero. Since the <tt>ntpd</tt> daemon adds one to the stratum of each peer, a primary server ordinarily displays an external stratum of one. In order to provide engineered backups, it is often useful to specify the reference clock stratum as greater than zero. The <tt>stratum</tt> option is used for this purpose. Also, in cases involving both a reference clock and a pulse-per-second (PPS) discipline signal, it is useful to specify the reference clock identifier as other than the default, depending on the driver. The <tt>refid</tt> option is used for this purpose. Except where noted, these options apply to all clock drivers. + +<h4>Reference Clock Commands</h4> + +<dl><dt><tt>server 127.127.<i>t.u</i> [prefer] [mode <i>int</i>] [minpoll <i>int</i>] [maxpoll <i>int</i>]</tt></dt> <dd>This command can be used to configure reference clocks in special ways. The options are interpreted as follows:</dd> + +<dl><dt><tt>prefer</tt></dt> +<dd>Marks the reference clock as preferred. All other things being equal, this host will be chosen for synchronization among a set of correctly operating hosts. See the <a HREF="prefer.htm">Mitigation Rules and the <tt>prefer</tt> Keyword </a>page for further information.</dd> + +<dt><tt>mode <i>int</i></tt></dt> +<dd>Specifies a mode number which is interpreted in a device-specific fashion. For instance, it selects a dialing protocol in the ACTS driver and a device subtype in the <tt>parse</tt> drivers.</dd> + +<dt><tt>minpoll <i>int</i></tt></dt> +<dt><tt>maxpoll<i> int</i></tt></dt> +<dd>These options specify the minimum and maximum polling interval for reference clock messages, in seconds to the power of two. For most directly connected reference clocks, both <tt>minpoll</tt> and <tt>maxpoll</tt> default to 6 (64 s). For modem reference clocks, <tt>minpoll</tt> defaults to 10 (17.1 m) and <tt>maxpoll</tt> defaults to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.</dd> + +</dl> + +<dt><tt>fudge 127.127.<i>t.u</i> [time1 <i>sec</i>] [time2 <i>sec</i>] +[stratum <i>int</i>] [refid <i>string</i>] [mode <i>int</i>] [flag1 0|1] +[flag2 0|1] [flag3 0|1] [flag4 0|1]</tt></dt> +<dd>This command can be used to configure reference clocks in special +ways. It must immediately follow the <tt>server</tt> command which configures the driver. Note that the same capability is possible at run -time using the <TT><A HREF="ntpdc.htm">ntpdc</A></TT> program. The -options are interpreted as follows:</DD> - -<DL> - -<DT><TT>time1 <I>sec</I></TT></DT> -<DD>Specifies a constant to be added to the time offset produced by the -driver, a fixed-point decimal number in seconds. This is used as a -calibration constant to adjust the nominal time offset of a particular -clock to agree with an external standard, such as a precision PPS -signal. It also provides a way to correct a systematic error or bias due -to serial port latencies, different cable lengths or receiver internal -delay. The specified offset is in addition to the propagation delay -provided by other means, such as internal DIPswitches. Where a -calibration for an individual system and driver is available, an -approximate correction is noted in the driver documentation pages.</DD> - -<DT><TT>time2 <I>secs</I></TT></DT> -<DD>Specifies a fixed-point decimal number in seconds, which is -interpreted in a driver-dependent way. See the descriptions of specific -drivers in the <A HREF="refclock.htm">reference clock drivers</A> -page.</DD> - -<DT><TT>stratum <I>int</I></TT></DT> -<DD>Specifies the stratum number assigned to the driver, an integer -between 0 and 15. This number overrides the default stratum number -ordinarily assigned by the driver itself, usually zero.</DD> - -<DT><TT>refid <I>string</I></TT></DT> -<DD>Specifies an ASCII string of from one to four characters which -defines the reference identifier used by the driver. This string -overrides the default identifier ordinarily assigned by the driver -itself.</DD> - -<DT><TT>mode <I>int</I></TT></DT> -<DD>Specifies a mode number which is interpreted in a device-specific -fashion. For instance, it selects a dialing protocol in the ACTS driver -and a device subtype in the <TT>parse</TT> drivers.</DD> - -<DT><TT>flag1</TT> <TT>flag2</TT> <TT>flag3</TT> <TT>flag4</TT></DT> -<DD>These four flags are used for customizing the clock driver. The -interpretation of these values, and whether they are used at all, is a -function of the particular clock driver. However, by convention -<TT>flag4</TT> is used to enable recording monitoring data to the -<TT>clockstats</TT> file configured with the <TT>filegen</TT> command. -When a PPS signal is available, a special automatic calibration facility -is provided. If the <tt>flag1</tt> switch is set and the PPS signal is -actively disciplining the system time, the calibration value is -automatically adjusted to maintain a residual offset of zero. Further -information on the <TT>filegen</TT> command can be found in the <A -HREF="monopt.htm">Monitoring Options </A>page.</DD> - -</DL> - -<DT><TT>pps <I>device</I> [assert|clear] [hardpps]</TT></DT> -<DD>Specifies the name and options for the serial port device to which -the PPS signal is connected. Note, this command replaces use of -<TT>fudge flag3</TT>, which was used for the same purpose in NTPv3. Note -that this command should preceed the <TT>server</TT> and <TT>fudge</TT> -command for the same device. Note also that the <TT>assert</TT>, -<TT>clear</TT> and <TT>hardpps</TT> options are only available if the -<tt>ppsapi</tt> standard PPS interface is available.</DD> - -<DL> - -<DT><TT>device</TT></DT> -<DD>Specify the device name associated with the PPS signal. The name -must match exactly the link name specified in the driver documentation -page.</DD> - -<DT><TT>assert</TT></DT> -<DT><TT>clear</TT></DT> -<DD>Using <TT>assert</TT> or <TT>clear</TT> specifies if the high going -or low going edge of the signal must be used. The default is -<TT>assert</TT>.</DD> - -<DT><TT>hardpps</TT></DT> -<DD>This flag is used to tell the kernel that the signal from this -device must be used to drive hardpps().</DD> - -<DD>The <TT>assert</TT>, <TT>clear</TT> and <TT>hardpps</TT> options -are only available if the PPSAPI is used.</DD> - -</DL> - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +time using the <tt><a HREF="ntpdc.htm">ntpdc</a></tt> program. The +options are interpreted as follows:</dd> + +<dl> + +<dt><tt>time1 <i>sec</i></tt></dt> +<dd>Specifies a constant to be added to the time offset produced by the driver, a fixed-point decimal number in seconds. This is used as a calibration constant to adjust the nominal time offset of a particular clock to agree with an external standard, such as a precision PPS signal. It also provides a way to correct a systematic error or bias due to serial port or operating system latencies, different cable lengths or receiver internal delay. The specified offset is in addition to the propagation delay provided by other means, such as internal DIPswitches. Where a calibration for an individual system and driver is available, an approximate correction is noted in the driver documentation pages.</dd> + +<p><dd>Note: in order to facilitate calibration when more than one radio clock or PPS signal is supported, a special calibration feature is available. It takes the form of an argument to the <tt>enable</tt> command described in the <a href=miscopt.htm>Miscellaneous Options</a> page and operates as described in the <a href=refclock.hrm>Reference Clock Drivers</a> page.</dd> + +<dt><tt>time2 <i>secs</i></tt></dt> +<dd>Specifies a fixed-point decimal number in seconds, which is interpreted in a driver-dependent way. See the descriptions of specific drivers in the <a HREF="refclock.htm">reference clock drivers</a> page.</dd> + +<dt><tt>stratum <i>int</i></tt></dt> +<dd>Specifies the stratum number assigned to the driver, an integer between 0 and 15. This number overrides the default stratum number ordinarily assigned by the driver itself, usually zero.</dd> + +<dt><tt>refid <i>string</i></tt></dt> +<dd>Specifies an ASCII string of from one to four characters which defines the reference identifier used by the driver. This string overrides the default identifier ordinarily assigned by the driver itself.</dd> + +<dt><tt>mode <i>int</i></tt></dt> +<dd>Specifies a mode number which is interpreted in a device-specific fashion. For instance, it selects a dialing protocol in the ACTS driver and a device subtype in the <tt>parse</tt> drivers.</dd> + +<dt><tt>flag1</tt> <tt>flag2</tt> <tt>flag3</tt> <tt>flag4</tt></dt> +<dd>These four flags are used for customizing the clock driver. The interpretation of these values, and whether they are used at all, is a function of the particular clock driver. However, by convention <tt>flag4</tt> is used to enable recording monitoring data to the <tt>clockstats</tt> file configured with the <tt>filegen</tt> command. Further information on the <tt>filegen</tt> command can be found in the <a HREF="monopt.htm">Monitoring Options </a>page.</dd> + +</dl> + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a>/address></a></body></html> diff --git a/contrib/ntp/html/config.htm b/contrib/ntp/html/config.htm index f8606f2..2fafb0c 100644 --- a/contrib/ntp/html/config.htm +++ b/contrib/ntp/html/config.htm @@ -1,11 +1,15 @@ -<HTML><HEAD><TITLE> +<html><head><title> Configuration Options -</TITLE></HEAD><BODY><H3> +</title></head><body><h3> Configuration Options -</H3> +</h3> -<IMG align=left SRC="pic/pogo3a.gif">From <i>pogo</i>, Walt Kelly -<BR clear=left><HR> +<img align=left src=pic/pogo3a.gif><a +href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>Pogo</i>, +Walt Kelly</a> + +<p>Gnu autoconfigure tools are in the backpack. +<br clear=left><hr> <H4>Basic Configuration Options - the <TT>configure</TT> utility</H4> @@ -18,273 +22,166 @@ driver support, debugging support, and so forth. <P>Configuration options are specified as arguments to the <TT>configure</TT> script. Following is a summary of the current -options: +options, as of the 4.0.99m version: <P>Usage: <TT>configure [options] [host]</TT> <BR>Options: <TT>[defaults in brackets after descriptions]</TT> -<PRE>Configuration - - --cache-file=FILE cache test -results in FILE - -- -help &n -bsp; print this message - --no- -create -do not create output files - --quiet, --silent do not print -`checking...' messages - -- -version   -; print the version of autoconf that created - - +Configuration: +<PRE> + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print `checking...' messages + --version print the version of autoconf that created configure -Directory and file names +</PRE> - --prefix=PREFIX install -architecture-independent files in - - -PREFIX [/usr/local] - --exec-prefix=EPREFIX install architecture-dependent files -in EPREFIX - - +Directory and file names: + +<PRE> + --prefix=PREFIX install architecture-independent files in PREFIX +[/usr/local] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] - -- -bindir=DIR -user executables in DIR [EPREFIX/bin] - -- -sbindir=DIR system -admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program -executables in DIR [EPREFIX/libexec] - -- -datadir=DIR read- -only architecture-independent data in DIR - - + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] - --sysconfdir=DIR read-only -single-machine data in DIR - - + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture- -independent data in DIR - - + --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] - --localstatedir=DIR modifiable single-machine -data in DIR - - + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - -- -libdir=DIR -object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header -files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc -in DIR - - -[/usr/include] - -- -infodir=DIR info -documentation in DIR [PREFIX/info] - -- -mandir=DIR -man documentation in DIR [PREFIX/man] - -- -srcdir=DIR -find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed -program - - + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + --program-prefix=PREFIX prepend PREFIX to installed program names -Host type - - -- -build=BUILD -configure for building on BUILD [BUILD=HOST] - -- -host=HOST &nb -sp; configure for HOST [guessed] - --target=TARGET -configure for TARGET [TARGET=HOST]</PRE> - -<PRE>Features and packages - - --disable-FEATURE do not include -FEATURE (same as --enable- - - -FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use -PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include -files are in DIR - --x-libraries=DIR X library files -are in DIR - ---enable- and --disable- with options recognized - - -debugging -Include debugging code [enable] - gdt- -surveying Include GDT survey code -[disable] - -md5 &nb -sp; Include support for MD5 keys [enable] - -des &nb -sp; Include support for DES keys [enable] - all- -clocks Include -drivers for all reference clocks - - + --program-suffix=SUFFIX append SUFFIX to installed program +names + --program-transform-name=PROGRAM run sed PROGRAM on installed program +names +</PRE> + +Host type: + +<PRE> + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +</PRE> + +Optional packages: + +<PRE> + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + + openssl-libdir=DIR OpenSSL object code libraries in DIR [/usr/lib +/usr/local/lib /usr/local/ssl/lib] + openssl-incdir=DIR OpenSSL header files in DIR [/usr/include +/usr/local/include /usr/local/ssl/include] + crypto=autokey Use autokey cryptography + crypto=rsaref Use the RSAREF library + electricfence Compile with ElectricFence malloc debugger +</PRE> + +Optional features: + +<PRE> + --disable-FEATURE do not include FEATURE (same as +--enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + + accurate-adjtime The adjtime() call is accurate + debugging Include debugging code [enable] + des Include support for DES keys [enable] + dst-minutes=VALUE Minutes per DST adjustment [60] + gdt-surveying Include GDT survey code [disable] + hourly-todr-sync If we should sync TODR hourly + kernel-fll-bug If we should avoid a (Solaris) kernel FLL bug + kmem Read /dev/kmem for 'tick' and/or 'tickadj' + md5 Include support for MD5 keys [enable] + ntpdate-step If ntpdate should step the time + slew-always Always slew the time + step-slew Step and slew the time + tick=VALUE Force a value for 'tick' + tickadj=VALUE Force a value for 'tickadj' + udp-wildcard Use UDP wildcard delivery +</PRE> + +Radio clocks (these are ordinarily enabled, if supported by the +machine and operating system): + +<PRE> + all-clocks Include drivers for all suitable non-PARSE +clocks [enable] + ACTS NIST dialup clock + ARBITER Arbiter 1088A/B GPS receiver + ARCRON_MSF Arcron MSF receiver + AS2201 Austron 2200A or 2201A GPS receiver + ATOM ATOM PPS interface + AUDIO-CHU CHU audio decoder + BANCOMM Datum/Bancomm BC635/VME interface + (requires an explicit --enable-BANCOMM request) + CHRONOLOG Chrono-log K-series WWVB receiver + CHU CHU modem decoder + DATUM Datum Programmable Time System + DUMBCLOCK Dumb generic hh:mm:ss local clock + FG Forum Graphic GPS + GPSVME TrueTime GPS receiver with VME interface + (requires an explicit --enable-GPSVME request) + HEATH HeathKit GC-1000 Most Accurate Clock + HOPFPCI HOPF 6039 PCI board + HOPFSERIAL HOPF serial clock device + HPGPS HP 58503A GPS Time & Frequency receiver + IRIG IRIG (Audio) Clock + JUPITER Rockwell Jupiter GPS receiver + LEITCH Leitch CSD 5300 Master Clock System Driver + LOCAL-CLOCK Local clock driver + MSFEES EES M201 MSF receiver + MX4200 Magnavox MX4200 GPS receiver + NMEA NMEA GPS receiver + ONCORE Motorola VP/UT Oncore GPS receiver + PALISADE Palisade clock + PCF Conrad parallel port radio clock + PST PST/Traconex 1020 WWV/H receiver + PTBACTS PTB dialup clock support + SHM Clock attached through shared memory + (requires an explicit --enable-SHM request) + SPECTRACOM Spectracom 8170/Netclock/2 WWVB receiver + TRAK TRAK 8810 GPS station clock + TPRO KSI/Odetics TPRO/S IRIG Interface + TRUETIME Kinemetrics/TrueTime (generic) receiver + ULINK Ultralink WWVB receiver + USNO US Naval Observatory dialup clock + WWV WWV audio receiver +</PRE> + +PARSE Clocks: + +<PRE> + parse-clocks Include drivers for all suitable PARSE clocks [enable] - - Radio Clocks (these are ordinarily enabled, if supported by the - - -machine and operating system) - - -ACTS &n -bsp; NIST dialup clock - -ARBITER   -; Arbiter 1088A/B GPS receiver - -AS2201 - Austron 2200A or 2201A GPS receiver - -ATOM &n -bsp; ATOM clock - -BANCOMM   -; BANCOMM clock - -CHU &nb -sp; CHU clock - -DATUM & -nbsp; Datum Programmable Time System - -DCF7000   -; ELV/DCF7000 - -GPSVME - GPS-VME Clock - -HEATH & -nbsp; HeathKit GC-1000 Most Accurate Clock - -HOPF6021 &nbs -p; HOPF6021 Radio Clock support - -HPGPS & -nbsp; HP 58503A GPS Time & Frequency receiver - -IRIG &n -bsp; IRIG (Audio) Clock - -LEITCH - Leitch CSD 5300 Master Clock System Driver - LOCAL- -CLOCK Local Clock driver - -MEINBERG &nbs -p; Meinberg clocks - -MSFEES - MSFEES clock - -MOTO &n -bsp; Motorola GPS clock - -MX4200 - MX4200 clock - -NMEA &n -bsp; NMEA GPS clock - -PARSE & -nbsp; PARSE clock code - -PST &nb -sp; PST/Traconex 1020 WWV/H receiver - -PTBACTS   -; PTB dialup clock support - -RAWDCF - use raw DCF77 time code - -RCC8000   -; RCC8000 Radio Clock support - -SCHMID - SCHMID DCF77 clock support - -TRAK &n -bsp; TRAK 8810 GPS station clock - -TPRO &n -bsp; KSI/Odetics TPRO/S IRIG Interface - -TRIMTAIP &nbs -p; Trimble GPS/TAIP Protocol - -TRIMTSIP &nbs -p; Trimble GPS/TSIP Protocol - -TRUETIME &nbs -p; Kinemetrics/TrueTime (generic) receiver - -WWVB &n -bsp; Spectracom 8170 or Netclock/2 WWVB receiver - -USNO &n -bsp; US Naval Observatory dialup clock - Miscellany - - accurate-adjtime The -adjtime() call is accurate - -kmem &n -bsp; Read kmem - -tick=VALUE Force a -value for 'tick' - -tickadj=VALUE Force a value for -'tickadj' - udp- -wildcard Use UDP wildcard -delivery - slew- -always Always slew the -time - step- -slew Step -and slew the time - ntpdate- -step If ntpdate should step -the time - hourly-todr-sync If we should -sync TODR hourly</PRE> + COMPUTIME Diem Computime Radio Clock + DCF7000 ELV/DCF7000 Clock + HOPF6021 HOPF 6021 Radio Clock support + MEINBERG Meinberg clocks + RAWDCF DCF77 raw time code + RCC8000 RCC 8000 Radio Clock support + SCHMID SCHMID DCF77 clock support + TRIMTAIP Trimble GPS/TAIP Protocol + TRIMTSIP Trimble GPS/TSIP Protocol + VARITEXT VARITEXT clock + WHARTON Wharton 400A Series clock +</PRE> <hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> diff --git a/contrib/ntp/html/confopt.htm b/contrib/ntp/html/confopt.htm index 68ddf7f..8f911ef 100644 --- a/contrib/ntp/html/confopt.htm +++ b/contrib/ntp/html/confopt.htm @@ -1,330 +1,257 @@ -<html><head><title> -Configuration Options -</title></head><body><h3> -Configuration Options -</h3><hr> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Configuration Options</title> +</head> +<body> +<h3>Configuration Options</h3> +<img align="left" src="pic/boom3a.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>The chicken is getting configuration advice.<br clear="left"> +</p> + +<hr> <h4>Configuration Support</h4> <p>Following is a description of the configuration commands in -NTPv4. These commands have the same basic functions as in NTPv3 -and in some cases new functions and new operands. The various -modes are determined by the command keyword and the type of the -required IP address. Addresses are classed by type as (s) a -remote server or peer (IP class A, B and C), (b) the broadcast -address of a local interface, (m) a multicast address (IP class -D), or (r) a reference clock address (127.127.x.x). Note that, -while autokey and burst modes are supported by these commands, -their effect in some weird mode combinations can be meaningless -or even destructive.</p> +NTPv4. These commands have the same basic functions as in NTPv3 and +in some cases new functions and new arguments. There are two +classes of commands, configuration commands that configure a +persistent association with a remote server or peer or reference +clock, and auxilliary commands that specify environmental variables +that control various related operations.</p> + +<h4>Configuration Commands</h4> + +<p>The various modes are determined by the command keyword and the +type of the required IP address. Addresses are classed by type as +(s) a remote server or peer (IP class A, B and C), (b) the +broadcast address of a local interface, (m) a multicast address (IP +class D), or (r) a reference clock address (127.127.x.x). Note that +only those options applicable to each command are listed below. Use +of options not listed may not be caught as an error, but may result +in some weird and even destructive behavior.</p> + +<dl> +<dt><tt>server <i>address</i> [key <i>key</i> | autokey] [burst] +[iburst] [version <i>version</i>] [prefer] [minpoll <i>minpoll</i>] +[maxpoll <i>maxpoll</i>]</tt></dt> + +<dt><tt>peer <i>address</i> [key <i>key</i> | autokey] [version <i> +version</i>] [prefer] [minpoll <i>minpoll</i>] [maxpoll <i> +maxpoll</i>]</tt></dt> + +<dt><tt>broadcast <i>address</i> [key <i>key</i> | autokey] +[version <i>version</i>] [minpoll <i>minpoll</i>] [ttl <i> +ttl</i>]</tt></dt> + +<dt><tt>manycastclient <i>address</i> [key <i>key</i> | autokey] +[version <i>version</i>] [minpoll <i>minpoll</i> [maxpoll <i> +maxpoll</i>] [ttl <i>ttl</i>]</tt></dt> + +<dd>These four commands specify the time server name or address to +be used and the mode in which to operate. The <i>address</i> can be +either a DNS name or a IP address in dotted-quad notation. +Additional information on association behavior can be found in the +<a href="assoc.htm">Association Management</a> page. + +<dl> +<dt><tt>server</tt></dt> + +<dd>For type s and r addresses, this command mobilizes a persistent +client mode association with the specified remote server or local +radio clock. In this mode the local clock can synchronized to the +remote server, but the remote server can never be synchronized to +the local clock. This command should NOT be used for type <tt> +b</tt> or <tt>m</tt> addresses.</dd> + +<dt><tt>peer</tt></dt> + +<dd>For type s addresses (only), this command mobilizes a +persistent symmetric-active mode association with the specified +remote peer. In this mode the local clock can be synchronized to +the remote peer or the remote peer can be synchronized to the local +clock. This is useful in a network of servers where, depending on +various failure scenarios, either the local or remote peer may be +the better source of time. This command should NOT be used for type +<tt>b</tt>, <tt>m</tt> or <tt>r</tt> addresses.</dd> + +<dt><tt>broadcast</tt></dt> + +<dd>For type <tt>b</tt> and <tt>m</tt> addresses (only), this +command mobilizes a persistent broadcast mode association. Multiple +commands can be used to specify multiple local broadcast interfaces +(subnets) and/or multiple multicast groups. Note that local +broadcast messages go only to the interface associated with the +subnet specified, but multicast messages go to all interfaces.</dd> + +<dd>In broadcast mode the local server sends periodic broadcast +messages to a client population at the <i><tt>address</tt></i> +specified, which is usually the broadcast address on (one of) the +local network(s) or a multicast address assigned to NTP. The IANA +has assigned the multicast group address 224.0.1.1 exclusively to +NTP, but other nonconflicting addresses can be used to contain the +messages within administrative boundaries. Ordinarily, this +specification applies only to the local server operating as a +sender; for operation as a broadcast client, see the <tt> +broadcastclient</tt> or <tt>multicastclient</tt> commands +below.</dd> + +<dt><tt>manycastclient</tt></dt> + +<dd>For type <tt>m</tt> addresses (only), this command mobilizes a +manycast client mode association for the multicast address +specified. In this case a specific address must be supplied which +matches the address used on the <tt>manycastserver</tt> command for +the designated manycast servers. The NTP multicast address +224.0.1.1 assigned by the IANA should NOT be used, unless specific +means are taken to avoid spraying large areas of the Internet with +these messages and causing a possibly massive implosion of replies +at the sender.</dd> + +<dd>The <tt>manycast</tt> command specifies that the local server +is to operate in client mode with the remote servers that are +discovered as the result of broadcast/multicast messages. The +client broadcasts a request message to the group address associated +with the specified <i><tt>address</tt></i> and specifically enabled +servers respond to these messages. The client selects the servers +providing the best time and continues as with the <tt>server</tt> +command. The remaining servers are discarded as if never +heard.</dd> + +<dt>Options</dt> + +<dt><tt>autokey</tt></dt> + +<dd>All packets sent to and received from the server or peer are to +include authentication fields encrypted using the autokey scheme +described in the <a href="authopt.htm">Authentication Options</a> +page.</dd> + +<dt><tt>burst</tt></dt> + +<dd>when the server is reachable and at each poll interval, send a +burst of eight packets instead of the usual one packet. The spacing +between the first and the second packets is about 16s to allow a +modem call to complete, while the spacing between the remaining +packets is about 2s. This is designed to improve timekeeping +quality with the <tt>server</tt> command and <tt>s</tt> +addresses.</dd> + +<dt><tt>iburst</tt></dt> + +<dd>When the server is unreachable and at each poll interval, send +a burst of eight packets instead of the usual one. As long as the +server is unreachable, the spacing between packets is about 16s to +allow a modem call to complete. Once the server is reachable, the +spacing between packets is about 2s. This is designed to speed the +initial synchronization acquisition with the <tt>server</tt> +command and <tt>s</tt> addresses and when <tt>ntpd</tt> is started +with the <tt>-q</tt> option.</dd> + +<dt><tt>key</tt> <i><tt>key</tt></i></dt> + +<dd>All packets sent to and received from the server or peer are to +include authentication fields encrypted using the specified <i> +key</i> identifier with values from 1 to 65534, inclusive. The +default is to include no encryption field.</dd> + +<dt><tt>minpoll <i>minpoll</i></tt><br> +<tt>maxpoll <i>maxpoll</i></tt></dt> + +<dd>These options specify the minimum and maximum poll intervals +for NTP messages, in seconds to the power of two. The maximum poll +interval defaults to 10 (1,024 s), but can be increased by the <tt> +maxpoll</tt> option to an upper limit of 17 (36.4 h). The minimum +poll interval defaults to 6 (64 s), but can be decreased by the +<tt>minpoll</tt> option to a lower limit of 4 (16 s).</dd> + +<dt><tt>prefer</tt></dt> + +<dd>Marks the server as preferred. All other things being equal, +this host will be chosen for synchronization among a set of +correctly operating hosts. See the <a href="prefer.htm">Mitigation +Rules and the <tt>prefer</tt> Keyword</a> page for further +information.</dd> + +<dt><tt>ttl <i>ttl</i></tt></dt> + +<dd>This option is used only with broadcast server and manycast +client modes. It specifies the time-to-live <i><tt>ttl</tt></i> to +use on broadcast server and multicast server and the maximum <i> +<tt>ttl</tt></i> for the expanding ring search with manycast client +packets. Selection of the proper value, which defaults to 127, is +something of a black art and should be coordinated with the network +administrator.</dd> + +<dt><tt>version <i>version</i></tt></dt> + +<dd>Specifies the version number to be used for outgoing NTP +packets. Versions 1-4 are the choices, with version 4 the +default.</dd> +</dl> +</dd> +</dl> + +<h4>Auxilliary Commands</h4> <dl> - <dt><tt>peer </tt><i><tt>address</tt></i><tt> [autokey | key </tt><i><tt>key</tt></i><tt>] - [burst] [version </tt><i><tt>version</tt></i><tt>] - [prefer] [minpoll </tt><i><tt>minpoll</tt></i><tt>]</tt><i><tt> - </tt></i><tt>[maxpoll </tt><i><tt>maxpoll</tt></i><tt>]</tt></dt> - <dd> </dd> - <dt><tt>server </tt><i><tt>address</tt></i><tt> [autokey | - key </tt><i><tt>key</tt></i><tt>] [burst] [version </tt><i><tt>version</tt></i><tt>] - [prefer] [minpoll </tt><i><tt>minpoll</tt></i><tt>]</tt><i><tt> - </tt></i><tt>[maxpoll </tt><i><tt>maxpoll</tt></i><tt>]</tt></dt> - <dd> </dd> - <dt><tt>broadcast </tt><i><tt>address</tt></i><tt> [autokey | - key </tt><i><tt>key</tt></i><tt>] [burst] [version </tt><i><tt>version</tt></i><tt>] - [minpoll </tt><i><tt>minpoll</tt></i><tt>]</tt><i><tt> </tt></i><tt>[maxpoll - </tt><i><tt>maxpoll</tt></i><tt>] [ttl </tt><i><tt>ttl</tt></i><tt>]</tt></dt> - <dd> </dd> - <dt><tt>manycastclient </tt><i><tt>address</tt></i><tt> - [autokey | key </tt><i><tt>key</tt></i><tt>] [burst] - [version </tt><i><tt>version</tt></i><tt>] [minpoll </tt><i><tt>minpoll - </tt></i><tt>[maxpoll </tt><i><tt>maxpoll</tt></i><tt>] - [ttl </tt><i><tt>ttl</tt></i><tt>]</tt></dt> - <dd> </dd> - <dd>These four commands specify the time server name or - address to be used and the mode in which to operate. The <i><tt>address</tt></i><tt> - </tt>can be either a DNS name or a IP address in - dotted-quad notation. Additional information on - association behavior can be found in the <a - href="assoc.htm">Association Management</a> page.</dd> - <dd> </dd> - <dd><dl> - <dt><tt>server</tt></dt> - <dd>For type s and r addresses, this operates as the - NTPv3 server command, which mobilizes a - persistent client mode association. The <tt>server</tt> - command specifies that the local server is to - operate in client mode with the specified remote - server. In this mode, the local server can be - synchronized to the remote server, but the remote - server can never be synchronized to the local - server.</dd> - <dd> </dd> - <dt><tt>peer</tt></dt> - <dd>For type s addresses (only), this operates as the - current <tt>peer </tt>command, which mobilizes a - persistent symmetric-active mode association, - except that additional modes are available. This - command should NOT be used for type b, m or r - addresses.</dd> - <dd> </dd> - <dd>The <tt>peer</tt> command specifies that the - local server is to operate in symmetric active - mode with the remote server. In this mode, the - local server can be synchronized to the remote - server and, in addition, the remote server can be - synchronized by the local server. This is useful - in a network of servers where, depending on - various failure scenarios, either the local or - remote server may be the better source of time.</dd> - <dd> </dd> - <dt><tt>broadcast</tt></dt> - <dd>For type b and m addresses (only), this is - operates as the current NTPv3 <tt>broadcast </tt>command, - which mobilizes a persistent broadcast mode - association, except that additional modes are - available. Multiple commands can be used to - specify multiple local broadcast interfaces - (subnets) and/or multiple multicast groups. Note - that local broadcast messages go only to the - interface associated with the subnet specified, - but multicast messages go to all interfaces. In - the current implementation, the source address - used for these messages is the Unix host default - address.</dd> - <dd> </dd> - <dd>In broadcast mode, the local server sends - periodic broadcast messages to a client - population at the <i><tt>address </tt></i>specified, - which is usually the broadcast address on (one - of) the local network(s) or a multicast address - assigned to NTP. The IANA has assigned the - multicast group address 224.0.1.1 exclusively to - NTP, but other nonconflicting addresses can be - used to contain the messages within - administrative boundaries.. Ordinarily, this - specification applies only to the local server - operating as a sender; for operation as a - broadcast client, see the <tt>broadcastclient</tt> - or <tt>multicastclient</tt> commands below.</dd> - <dd> </dd> - <dt><tt>manycastclient</tt> </dt> - <dd>For type m addresses (only), this mobilizes a - manycast client-mode association for the - multicast address specified. In this case a - specific address must be supplied which matches - the address used on the <tt>manycastserver </tt>command - for the designated manycast servers. The NTP - multicast address 224.0.1.1 assigned by the IANA - should NOT be used, unless specific means are - taken to avoid spraying large areas of the - Internet with these messages and causing a - possibly massive implosion of replies at the - sender. </dd> - <dd> </dd> - <dd>The <tt>manycast </tt>command specifies that the - local server is to operate in client mode with - the remote server that are discovered as the - result of broadcast/multicast messages. The - client broadcasts a request message to the group - address associated with the specified <i><tt>address - </tt></i>and specifically enabled servers respond - to these messages. The client selects the servers - providing the best time and continues as with the - <tt>server </tt>command. The remaining servers - are discarded as if never heard.</dd> - <dd> </dd> - </dl> - </dd> - <dd>Options</dd> - <dd> </dd> - <dd><dl> - <dt><tt>autokey</tt></dt> - <dd>All packets sent to the address are to include - authentication fields encrypted using the autokey - scheme.</dd> - <dd> </dd> - <dt><tt>burst</tt></dt> - <dd>At each poll interval, send a burst of eight - packets spaced, instead of the usual one.</dd> - <dd> </dd> - <dt><tt>key </tt><i><tt>key</tt></i></dt> - <dd>All packets sent to the address are to include - authentication fields encrypted using the - specified <i>key</i> identifier, which is an - unsigned 32-bit integer less than 65536. The - default is to include no encryption field.</dd> - <dd> </dd> - <dt><tt>version </tt><i><tt>version</tt></i></dt> - <dd>Specifies the version number to be used for - outgoing NTP packets. Versions 1-4 are the - choices, with version 4 the default.</dd> - <dd> </dd> - <dt><tt>prefer</tt></dt> - <dd>Marks the server as preferred. All other things - being equal, this host will be chosen for - synchronization among a set of correctly - operating hosts. See the <a href="prefer.htm">Mitigation - Rules and the <tt>prefer</tt> Keyword </a>page - for further information.</dd> - <dd> </dd> - <dt><tt>ttl </tt><i><tt>ttl</tt></i></dt> - <dd>This option is used only with broadcast mode. It - specifies the time-to-live <i><tt>ttl</tt></i> to - use on multicast packets. Selection of the proper - value, which defaults to 127, is something of a - black art and must be coordinated with the - network administrator.</dd> - <dd> </dd> - <dt><tt>minpoll </tt><i><tt>minpoll</tt></i></dt> - <dt><tt>maxpoll </tt><i><tt>maxpoll</tt></i></dt> - <dd>These options specify the minimum and maximum - polling intervals for NTP messages, in seconds to - the power of two. The default range is 6 (64 s) - to 10 (1,024 s).The allowable range is 4 (16 s) - to 17 (36.4 h) inclusive.</dd> - <dd> </dd> - </dl> - </dd> - <dt><tt>broadcastclient</tt></dt> - <dd>This command directs the local server to listen for and - respond to broadcast messages received on any local - interface. Upon hearing a broadcast message for the first - time, the local server measures the nominal network delay - using a brief client/server exchange with the remote - server, then enters the broadcastclient mode, in which it - listens for and synchronizes to succeeding broadcast - messages. Note that, in order to avoid accidental or - malicious disruption in this mode, both the local and - remote servers should operate using authentication and - the same trusted key and key identifier.</dd> - <dd> </dd> - <dt><tt>multicastclient [</tt><i><tt>address</tt></i><tt>] - [...]</tt></dt> - <dd>This command directs the local server to listen for - multicast messages at the group address(es) of the global - network. The default address is that assigned by the - Numbers Czar to NTP (224.0.1.1). This command operates in - the same way as the <tt>broadcastclient</tt> command, but - uses IP multicasting. Support for this command requires a - multicast kernel.</dd> - <dd> </dd> - <dt><tt>driftfile </tt><i><tt>driftfile</tt></i></dt> - <dd>This command specifies the name of the file used to - record the frequency offset of the local clock - oscillator. If the file exists, it is read at startup in - order to set the initial frequency offset and then - updated once per hour with the current frequency offset - computed by the daemon. If the file does not exist or - this command is not given, the initial frequency offset - is assumed zero. In this case, it may take some hours for - the frequency to stabilize and the residual timing errors - to subside.</dd> - <dd> </dd> - <dd>The file format consists of a single line containing a - single floating point number, which records the frequency - offset measured in parts-per-million (PPM). The file is - updated by first writing the current drift value into a - temporary file and then renaming this file to replace the - old version. This implies that <tt>ntpd</tt> must have - write permission for the directory the drift file is - located in, and that file system links, symbolic or - otherwise, should be avoided.</dd> - <dd> </dd> - <dt><tt>manycastserver </tt><i><tt>address </tt></i><tt>[...]</tt></dt> - <dd>This command directs the local server to listen for and - respond to broadcast messages received on any local - interface, and in addition enables the server to respond - to client mode messages to the multicast group - address(es) (type m) specified. At least one address is - required, but The NTP multicast address 224.0.1.1 - assigned by the IANA should NOT be used, unless specific - means are taken to limit the span of the reply and avoid - a possibly massive implosion at the original sender.</dd> - <dd> </dd> - <dt><tt>revoke [</tt><i><tt>logsec</tt></i><tt>]</tt> </dt> - <dd>Specifies the interval between recomputations of the - private value used with the autokey feature, which - ordinarily requires an expensive public- key computation. - The default value is 12 (65,536 s or about 18 hours). For - poll intervals above the specified interval, a new - private value will be recomputed for every message sent.</dd> - <dd> </dd> - <dt><tt>autokey [</tt><i><tt>logsec</tt></i><tt>]</tt> </dt> - <dd>Specifies the interval between regenerations of the - session key list used with the autokey feature. Note that - the size of the key list for each association depends on - this interval and the current poll interval. The default - value is 12 (4096 s or about 1.1 hours). For poll - intervals above the specified interval, a session key - list with a single entry will be regenerated for every - message sent.</dd> - <dd> </dd> - <dt><tt>enable [auth | bclient | kernel | monitor | ntp | - stats]</tt></dt> - <dt><tt>disable [auth | bclient | kernel | monitor | ntp | - stats</tt><font face="Courier New">] </font></dt> - <dd>Provides a way to enable or disable various server - options. Flags not mentioned are unaffected. Note that - all of these flags can be controlled remotely using the <a - href="ntpdc.htm"><tt>ntpdc</tt></a> utility program.</dd> - <dd> </dd> - <dd><dl> - <dt><tt>auth</tt></dt> - <dd>Enables the server to synchronize with - unconfigured peers only if the peer has been - correctly authenticated using a trusted key and - key identifier. The default for this flag is - enable.</dd> - <dd> </dd> - <dt><tt>bclient</tt></dt> - <dd>When enabled, this is identical to the <tt>broadcastclient</tt> - command. The default for this flag is disable.</dd> - <dd> </dd> - <dt><tt>kernel</tt></dt> - <dd>Enables the precision-time kernel support for the - <tt>ntp_adjtime()</tt> system call, if - implemented. Ordinarily, support for this routine - is detected automatically when the NTP daemon is - compiled, so it is not necessary for the user to - worry about this flag. It flag is provided - primarily so that this support can be disabled - during kernel development.</dd> - <dd> </dd> - <dt><tt>monitor</tt></dt> - <dd>Enables the monitoring facility. See the <tt>ntpdc</tt> - program and the <tt>monlist</tt> command or - further information. The default for this flag is - enable.</dd> - <dd> </dd> - <dt><tt>ntp</tt></dt> - <dd>Enables the server to adjust its local clock by - means of NTP. If disabled, the local clock - free-runs at its intrinsic time and frequency - offset. This flag is useful in case the local - clock is controlled by some other device or - protocol and NTP is used only to provide - synchronization to other clients. In this case, - the local clock driver can be used to provide - this function and also certain time variables for - error estimates and leap-indicators. See the <a - href="refclock.htm">Reference Clock Drivers </a>page - for further information. The default for this - flag is enable.</dd> - <dd> </dd> - <dt><tt>stats</tt></dt> - <dd>Enables the statistics facility. See the <a - href="monopt.htm">Monitoring Options </a>page for - further information. The default for this flag is - enable.</dd> - <dd> </dd> - </dl> - </dd> +<dt><tt>broadcastclient</tt></dt> + +<dd>This command enables reception of broadcast server messages to +any local interface (type b) address. Upon receiving a message for +the first time, the broadcast client measures the nominal server +propagation delay using a brief client/server exchange with the +server, then enters the broadcast client mode, in which it +synchronizes to succeeding broadcast messages. Note that, in order +to avoid accidental or malicious disruption in this mode, both the +server and client should operate using symmetric-key or public-key +authentication as described in the <a href="authopt.htm"> +Authentication Options</a> page.</dd> + +<dt><tt>manycastserver <i>address</i> [...]</tt></dt> + +<dd>This command enables reception of manycast client messages to +the multicast group address(es) (type m) specified. At least one +address is required, but The NTP multicast address 224.0.1.1 +assigned by the IANA should NOT be used, unless specific means are +taken to limit the span of the reply and avoid a possibly massive +implosion at the original sender. Note that, in order to avoid +accidental or malicious disruption in this mode, both the server +and client should operate using symmetric-key or public-key +authentication as described in the <a href="authopt.htm"> +Authentication Options</a> page.</dd> + +<dt><tt>multicastclient [<i>address</i>] [...]</tt></dt> + +<dd>This command enables reception of multicast server messages to +the multicast group address(es) (type m) specified. Upon receiving +a message for the first time, the multicast client measures the +nominal server propagation delay using a brief client/server +exchange with the server, then enters the broadcast client mode, in +which it synchronizes to succeeding multicast messages. Note that, +in order to avoid accidental or malicious disruption in this mode, +both the server and client should operate using symmetric-key or +public-key authentication as described in the <a href= +"authopt.htm">Authentication Options</a> page.</dd> </dl> +<h4>Bugs</h4> + +<p>The syntax checking is not picky; some combinations of +ridiculous and even hilarious options and modes may not be +detected.</p> + <hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> -<address> - David L. Mills (mills@udel.edu) -</address> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> </body> </html> + diff --git a/contrib/ntp/html/copyright.htm b/contrib/ntp/html/copyright.htm index 527b5d0..2f052a7 100644 --- a/contrib/ntp/html/copyright.htm +++ b/contrib/ntp/html/copyright.htm @@ -1,202 +1,142 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html><head><title> Copyright Notice </title></head><body><h3> Copyright Notice </h3> -<IMG align=left HEIGHT=264 WIDTH=206 SRC=pic/sheepb.jpg >"Clone -me," says Dolly sheepishly +<img align=left src=pic/sheepb.jpg>"Clone me," says Dolly sheepishly <br clear=left><hr> -<P>The following copyright notice applies to all files collectively -called the Network Time Protocol Version 4 Distribution. Unless -specifically declared otherwise in an individual file, this notice -applies as if the text was explicitly included in the file. +<P>The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this notice applies as if the text was explicitly included in the file. <br> -<PRE> -/*********************************************************************** - * * - * Copyright (c) David L. Mills 1992-2000 * - * * - * Permission to use, copy, modify, and distribute this software and * - * its documentation for any purpose and without fee is hereby * - * granted, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission * - * notice appear in supporting documentation, and that the name * - * University of Delaware not be used in advertising or publicity * - * pertaining to distribution of the software without specific, * - * written prior permission. The University of Delaware makes no * - * representations about the suitability this software for any * - * purpose. It is provided "as is" without express or implied * - * warranty. * - * * - *********************************************************************** - */ -</PRE> - -The following individuals contributed in part to the Network Time -Protocol Distribution Version 4 and are acknowledged as authors of this -work. - -<OL> - -<LI><A HREF="mailto: marka@syd.dms.csiro.au">Mark Andrews -<marka@syd.dms.csiro.au></a> Leitch atomic clock controller</LI> - -<LI><A HREF="mailto: vbais@mailman1.intel.co">Viraj Bais -<vbais@mailman1.intel.com></a> and <A HREF="mailto: +<pre> +*********************************************************************** +* * +* Copyright (c) David L. Mills 1992-2001 * +* * +* Permission to use, copy, modify, and distribute this software and * +* its documentation for any purpose and without fee is hereby * +* granted, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission * +* notice appear in supporting documentation, and that the name * +* University of Delaware not be used in advertising or publicity * +* pertaining to distribution of the software without specific, * +* written prior permission. The University of Delaware makes no * +* representations about the suitability this software for any * +* purpose. It is provided "as is" without express or implied * +* warranty. * +* * +*********************************************************************** +</pre> + +The following individuals contributed in part to the Network Time Protocol Distribution Version 4 and are acknowledged as authors of this work. + +<ol> + +<li><A HREF="mailto: marka@syd.dms.csiro.au">Mark Andrews <marka@syd.dms.csiro.au></a> Leitch atomic clock controller</li> + +<li><A HREF="mailto: altmeier@atlsoft.de">Bernd Altmeier <altmeier@atlsoft.de></a> hopf Elektronik serial line and PCI-bus devices</li> + +<li><A HREF="mailto: vbais@mailman1.intel.co">Viraj Bais <vbais@mailman1.intel.com></a> and <A HREF="mailto: kirkwood@striderfm.intel.com">Clayton Kirkwood -<kirkwood@striderfm.intel.com></a> port to WindowsNT 3.5</LI> +<kirkwood@striderfm.intel.com></a> port to WindowsNT 3.5</li> -<LI><A HREF="mailto: michael.barone@lmco.com">Michael Barone -<michael,barone@lmco.com></a> GPSVME fixes</LI> +<li><A HREF="mailto: michael.barone@lmco.com">Michael Barone <michael,barone@lmco.com></a> GPSVME fixes</li> -<LI><A HREF="mailto: karl@owl.HQ.ileaf.com">Karl Berry -<karl@owl.HQ.ileaf.com></a> syslog to file option</LI> +<li><A HREF="mailto: karl@owl.HQ.ileaf.com">Karl Berry <karl@owl.HQ.ileaf.com></a> syslog to file option</li> -<LI><A HREF="mailto: greg.brackley@bigfoot.com">Greg Brackley -<greg.brackley@bigfoot.com></a> Major rework of WINNT port. Clean -up recvbuf and iosignal code into separate modules.</LI> +<li><A HREF="mailto: greg.brackley@bigfoot.com">Greg Brackley <greg.brackley@bigfoot.com></a> Major rework of WINNT port. Clean up recvbuf and iosignal code into separate modules.</li> -<LI><A HREF="mailto: Piete.Brooks@cl.cam.ac.uk">Piete Brooks -<Piete.Brooks@cl.cam.ac.uk></a> MSF clock driver, Trimble PARSE -support</LI> +<li><A HREF="mailto: Marc.Brett@westgeo.com">Marc Brett <Marc.Brett@westgeo.com></a> Magnavox GPS clock driver</li> -<LI><A HREF="mailto: clift@ml.csiro.au">Steve Clift -<clift@ml.csiro.au></a> OMEGA clock driver</LI> +<li><A HREF="mailto: Piete.Brooks@cl.cam.ac.uk">Piete Brooks <Piete.Brooks@cl.cam.ac.uk></a> MSF clock driver, Trimble PARSE support</li> -<LI><A HREF="mailto:casey@csc.co.za">Casey Crellin -<casey@csc.co.za></a> vxWorks (Tornado) port and help with target -configuration</LI> +<li><A HREF="mailto: reg@dwf.com">Reg Clemens <reg@dwf.com></a> Oncore driver (Current maintainer)</li> -<LI><A HREF="mailto: Sven_Dietrich@trimble.COM">Sven Dietrich -<sven_dietrich@trimble.com></a> Palisade reference clock driver, -NT adj. residuals, integrated Greg's Winnt port.</LI> +<li><A HREF="mailto: clift@ml.csiro.au">Steve Clift <clift@ml.csiro.au></a> OMEGA clock driver</li> -<LI><A HREF="mailto: dundas@salt.jpl.nasa.gov">John A. Dundas III -<dundas@salt.jpl.nasa.gov></a> Apple A/UX port</LI> +<li><A HREF="mailto:casey@csc.co.za">Casey Crellin <casey@csc.co.za></a> vxWorks (Tornado) port and help with target configuration</li> -<LI><A HREF="mailto: duwe@immd4.informatik.uni-erlangen.de">Torsten Duwe -<duwe@immd4.informatik.uni-erlangen.de></a> Linux port</LI> +<li><A HREF="mailto: Sven_Dietrich@trimble.COM">Sven Dietrich <sven_dietrich@trimble.com></a> Palisade reference clock driver, NT adj. residuals, integrated Greg's Winnt port.</li> -<LI><A HREF="mailto: dennis@mrbill.canet.ca">Dennis Ferguson -<dennis@mrbill.canet.ca></a> foundation code for NTP Version 2 as -specified in RFC-1119</LI> +<li><A HREF="mailto: dundas@salt.jpl.nasa.gov">John A. Dundas III <dundas@salt.jpl.nasa.gov></a> Apple A/UX port</li> -<LI><A HREF="mailto: glenn@herald.usask.ca">Glenn Hollinger -<glenn@herald.usask.ca></a> GOES clock driver</LI> +<li><A HREF="mailto: duwe@immd4.informatik.uni-erlangen.de">Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de></a> Linux port</li> -<LI><A HREF="mailto: iglesias@uci.edu">Mike Iglesias -<iglesias@uci.edu></a> DEC Alpha port</LI> +<li><A HREF="mailto: dennis@mrbill.canet.ca">Dennis Ferguson +<dennis@mrbill.canet.ca></a> foundation code for NTP Version 2 as specified in RFC-1119</li> -<LI><A HREF="mailto: jagubox.gsfc.nasa.gov">Jim Jagielski -<jim@jagubox.gsfc.nasa.gov></a> A/UX port</LI> +<li><A HREF="mailto: glenn@herald.usask.ca">Glenn Hollinger <glenn@herald.usask.ca></a> GOES clock driver</li> -<LI><A HREF="mailto: jbj@chatham.usdesign.com">Jeff Johnson -<jbj@chatham.usdesign.com></a> massive prototyping overhaul</LI> +<li><A HREF="mailto: iglesias@uci.edu">Mike Iglesias <iglesias@uci.edu></a> DEC Alpha port</li> -<LI><A HREF="mailto: jones@hermes.chpc.utexas.edu">William L. Jones -<jones@hermes.chpc.utexas.edu></a> RS/6000 AIX modifications, HPUX -modifications</LI> +<li><A HREF="mailto: jagubox.gsfc.nasa.gov">Jim Jagielski <jim@jagubox.gsfc.nasa.gov></a> A/UX port</li> -<LI><A HREF="mailto:Hans.Lambermont@nl.origin-it.com">Hans Lambermont -<Hans.Lambermont@nl.origin-it.com></A> or <A -HREF="mailto:H.Lambermont@chello.nl"><H.Lambermont@chello.nl></A> -ntpsweep</LI> +<li><A HREF="mailto: jbj@chatham.usdesign.com">Jeff Johnson <jbj@chatham.usdesign.com></a> massive prototyping overhaul</li> -<LI><A HREF="http://www4.informatik.uni-erlangen.de/~kardel">Frank -Kardel</A> <A HREF="mailto: Frank.Kardel@informatik.uni-erlangen.de"> -<Frank.Kardel@informatik.uni-erlangen.de></a> PARSE -<GENERIC> driver (14 reference clocks), STREAMS modules for PARSE, -support scripts, syslog cleanup</LI> +<li><A HREF="mailto:Hans.Lambermont@nl.origin-it.com">Hans Lambermont <Hans.Lambermont@nl.origin-it.com></A> or <A +HREF="mailto:H.Lambermont@chello.nl"><H.Lambermont@chello.nl></A> ntpsweep</li> -<LI><A HREF="mailto: dkatz@cisco.com">Dave Katz -<dkatz@cisco.com></a> RS/6000 AIX port</LI> +<li><A HREF="mailto: phk@FreeBSD.ORG">Poul-Henning Kamp <phk@FreeBSD.ORG></a> Oncore driver (Original author)</li> -<LI><A HREF="mailto: leres@ee.lbl.gov">Craig Leres -<leres@ee.lbl.gov></a> 4.4BSD port, ppsclock, Maganavox GPS clock -driver</LI> +<li><A HREF="http://www4.informatik.uni-erlangen.de/~kardel">Frank Kardel</A> <A HREF="mailto: Frank.Kardel@informatik.uni-erlangen.de"> <Frank.Kardel@informatik.uni-erlangen.de></a> PARSE <GENERIC> driver (14 reference clocks), STREAMS modules for PARSE, support scripts, syslog cleanup</li> -<LI><A HREF="mailto: lindholm@ucs.ubc.ca">George Lindholm -<lindholm@ucs.ubc.ca></a> SunOS 5.1 port</LI> +<li><A HREF="mailto: jones@hermes.chpc.utexas.edu">William L. Jones <jones@hermes.chpc.utexas.edu></a> RS/6000 AIX modifications, HPUX modifications</li> -<LI><A HREF="mailto: louie@ni.umd.edu">Louis A. Mamakos -<louie@ni.umd.edu></a> MD5-based authentication</LI> +<li><A HREF="mailto: dkatz@cisco.com">Dave Katz <dkatz@cisco.com></a> RS/6000 AIX port</li> -<LI><A HREF="mailto: thorinn@diku.dk">Lars H. Mathiesen -<thorinn@diku.dk></a> adaptation of foundation code for Version 3 -as specified in RFC-1305</LI> +<li><A HREF="mailto: leres@ee.lbl.gov">Craig Leres +<leres@ee.lbl.gov></a> 4.4BSD port, ppsclock, Magnavox GPS clock driver</li> -<LI><A HREF="mailto: mills@udel.edu">David L. Mills -<mills@udel.edu></a> Version 4 foundation: clock discipline, -authentication, precision kernel; clock drivers: Spectracom, Austron, -Arbiter, Heath, ATOM, ACTS, KSI/Odetics; audio clock drivers: CHU, -WWV/H, IRIG</LI> +<li><A HREF="mailto: lindholm@ucs.ubc.ca">George Lindholm <lindholm@ucs.ubc.ca></a> SunOS 5.1 port</li> -<LI><A HREF="mailto: moeller@gwdgv1.dnet.gwdg.de">Wolfgang Moeller -<moeller@gwdgv1.dnet.gwdg.de></a> VMS port</LI> +<li><A HREF="mailto: louie@ni.umd.edu">Louis A. Mamakos <louie@ni.umd.edu></a> MD5-based authentication</li> -<LI><A HREF="mailto: mogul@pa.dec.com">Jeffrey Mogul -<mogul@pa.dec.com></a> ntptrace utility</LI> +<li><A HREF="mailto: thorinn@diku.dk">Lars H. Mathiesen <thorinn@diku.dk></a> adaptation of foundation code for Version 3 as specified in RFC-1305</li> -<LI><A HREF="mailto: tmoore@fievel.daytonoh.ncr.com">Tom Moore -<tmoore@fievel.daytonoh.ncr.com></a> i386 svr4 port</LI> +<li><A HREF="mailto: mills@udel.edu">David L. Mills <mills@udel.edu></a> Version 4 foundation: clock discipline, authentication, precision kernel; clock drivers: Spectracom, Austron, Arbiter, Heath, ATOM, ACTS, KSI/Odetics; audio clock drivers: CHU, WWV/H, IRIG</li> -<LI><A HREF="mailto: derek@toybox.demon.co.uk">Derek Mulcahy -<derek@toybox.demon.co.uk></a> and <A HREF="mailto: -d@hd.org">Damon Hart-Davis <d@hd.org></a> ARCRON MSF clock -driver</LI> +<li><A HREF="mailto: moeller@gwdgv1.dnet.gwdg.de">Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de></a> VMS port</li> -<LI><A HREF="mailto: Rainer.Pruy@informatik.uni-erlangen.de">Rainer Pruy -<Rainer.Pruy@informatik.uni-erlangen.de></a> monitoring/trap -scripts, statistics file handling</LI> +<li><A HREF="mailto: mogul@pa.dec.com">Jeffrey Mogul <mogul@pa.dec.com></a> ntptrace utility</li> -<LI><A HREF="mailto: dirce@zk3.dec.com">Dirce Richards -<dirce@zk3.dec.com></a> Digital UNIX V4.0 port</LI> +<li><A HREF="mailto: tmoore@fievel.daytonoh.ncr.com">Tom Moore <tmoore@fievel.daytonoh.ncr.com></a> i386 svr4 port</li> -<LI><A HREF="mailto: wsanchez@apple.com">Wilfredo Sánchez -<wsanchez@apple.com></A> added support for NetInfo</LI> +<li><A HREF="mailto: kamal@whence.com">Kamal A Mostafa <kamal@whence.com></a> SCO OpenServer port</li> -<LI><A HREF="mailto: mrapple@quack.kfu.com">Nick Sayer -<mrapple@quack.kfu.com></a> SunOS streams modules</LI> +<li><A HREF="mailto: derek@toybox.demon.co.uk">Derek Mulcahy <derek@toybox.demon.co.uk></a> and <A HREF="mailto: d@hd.org">Damon Hart-Davis <d@hd.org></a> ARCRON MSF clock driver</li> -<LI><A HREF="mailto: jack@innovativeinternet.com">Jack Sasportas -<jack@innovativeinternet.com></A> Saved a Lot of space on the -stuff in the html/pic/ subdirectory</LI> +<li><A HREF="mailto: Rainer.Pruy@informatik.uni-erlangen.de">Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de></a> monitoring/trap scripts, statistics file handling</li> -<LI><A HREF="mailto: schnitz@unipress.com">Ray Schnitzler -<schnitz@unipress.com></a> Unixware1 port</LI> +<li><A HREF="mailto: dirce@zk3.dec.com">Dirce Richards <dirce@zk3.dec.com></a> Digital UNIX V4.0 port</li> -<LI><A HREF="mailto: shields@tembel.org">Michael Shields -<shields@tembel.org></a> USNO clock driver</LI> +<li><A HREF="mailto: wsanchez@apple.com">Wilfredo Sánchez <wsanchez@apple.com></A> added support for NetInfo</li> -<LI><A HREF="mailto: pebbles.jpl.nasa.gov">Jeff Steinman -<jss@pebbles.jpl.nasa.gov></a> Datum PTS clock driver</LI> +<li><A HREF="mailto: mrapple@quack.kfu.com">Nick Sayer <mrapple@quack.kfu.com></a> SunOS streams modules</li> -<LI><A HREF="mailto: harlan@pfcs.com">Harlan Stenn -<harlan@pfcs.com></a> GNU automake/autoconfigure makeover, various -other bits (see the ChangeLog)</LI> +<li><A HREF="mailto: jack@innovativeinternet.com">Jack Sasportas <jack@innovativeinternet.com></A> Saved a Lot of space on the stuff in the html/pic/ subdirectory</li> -<LI><A HREF="mailto: ken@sdd.hp.com">Kenneth Stone -<ken@sdd.hp.com></a> HP-UX port</LI> +<li><A HREF="mailto: schnitz@unipress.com">Ray Schnitzler <schnitz@unipress.com></a> Unixware1 port</li> -<LI><A HREF="mailto: ajit@ee.udel.edu">Ajit Thyagarajan -<ajit@ee.udel.edu></a>IP multicast/anycast support</LI> +<li><A HREF="mailto: shields@tembel.org">Michael Shields <shields@tembel.org></a> USNO clock driver</li> -<LI><A HREF="mailto: tsuruoka@nc.fukuoka-u.ac.jp">Tomoaki TSURUOKA -<tsuruoka@nc.fukuoka-u.ac.jp></a>TRAK clock driver</LI> +<li><A HREF="mailto: pebbles.jpl.nasa.gov">Jeff Steinman <jss@pebbles.jpl.nasa.gov></a> Datum PTS clock driver</li> -<LI><A HREF="mailto: vixie@vix.com">Paul A Vixie -<vixie@vix.com></a> TrueTime GPS driver, generic TrueTime clock -driver</LI> +<li><A HREF="mailto: harlan@pfcs.com">Harlan Stenn <harlan@pfcs.com></a> GNU automake/autoconfigure makeover, various other bits (see the ChangeLog)</li> -<LI><A HREF="mailto: Ulrich.Windl@rz.uni-regensburg.de">Ulrich Windl -<Ulrich.Windl@rz.uni-regensburg.de></a> corrected and validated -HTML documents according to the HTML DTD</LI> +<li><A HREF="mailto: ken@sdd.hp.com">Kenneth Stone <ken@sdd.hp.com></a> HP-UX port</li> -</OL> +<li><A HREF="mailto: ajit@ee.udel.edu">Ajit Thyagarajan <ajit@ee.udel.edu></a>IP multicast/anycast support</li> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<li><A HREF="mailto: tsuruoka@nc.fukuoka-u.ac.jp">Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp></a>TRAK clock driver</li> + +<li><A HREF="mailto: vixie@vix.com">Paul A Vixie <vixie@vix.com></a> TrueTime GPS driver, generic TrueTime clock driver</li> + +<li><A HREF="mailto: Ulrich.Windl@rz.uni-regensburg.de">Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de></a> corrected and validated HTML documents according to the HTML DTD</li> + +</ol> + +<hr> +<a href=index.htm><img align=left src=pic/home.gif alt="gif"></a><address><a href=mailto:mills@udel.edu>David L. Mills <mills@udel.edu></a></address></body></html> diff --git a/contrib/ntp/html/debug.htm b/contrib/ntp/html/debug.htm index bf16049..564bb18 100644 --- a/contrib/ntp/html/debug.htm +++ b/contrib/ntp/html/debug.htm @@ -1,288 +1,477 @@ -<HTML><HEAD><TITLE> -NTP Debugging Techniques -</TITLE></HEAD><BODY><H3> -NTP Debugging Techniques -</H3> - -<IMG align=left SRC="pic/pogo.gif"><I>Pogo Possum</I>, with toolkit -and bug, Walt Kelly -<br clear=left><hr> - -<P>Once the NTP software distribution has been compiled and installed -and the configuration file constructed, the next step is to verify -correct operation and fix any bugs that may result. Usually, the command -line that starts the daemon is included in the system startup file, so -it is executed only at system boot time; however, the daemon can be -stopped and restarted from root at any time. Usually, no command-line -arguments are required, unless special actions described in the -<TT><A HREF="ntpd.htm">ntpd</A></TT> page are required. Once started, -the daemon will begin sending messages, as specified in the -configuration file, and interpreting received messages. - -<P>The best way to verify correct operation is using the <TT><A -HREF="ntpq.htm">ntpq</A></TT> and <TT><A HREF="ntpdc.htm">ntpdc</A></TT> -utility programs, either on the server itself or from another machine -elsewhere in the network. The <TT>ntpq</TT> program implements the -management functions specified in Appendix A of the NTP specification <A -HREF="http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.ps" -> -RFC-1305, Appendix A</A>. The <TT>ntpdc</TT> program implements -additional functions not provided in the standard. Both programs can be -used to inspect the state variables defined in the specification and, in -the case of <TT>ntpdc</TT>, additional ones of interest. In addition, -the <TT>ntpdc</TT> program can be used to selectively enable and disable -some functions of the daemon while the daemon is running. - -<P>In extreme cases with elusive bugs, the daemon can operate in two -modes, depending on the presence of the <TT>-d</TT> command-line debug -switch. If not present, the daemon detaches from the controlling -terminal and proceeds autonomously. If one or more <TT>-d</TT> switches -are present, the daemon does not detach and generates special output -useful for debugging. In general, interpretation of this output requires -reference to the sources. However, a single <TT>-d</TT> does produce -only mildly cryptic output and can be very useful in finding problems -with configuration and network troubles. With a little experience, the -volume of output can be reduced by piping the output to <TT>grep -</TT>and specifying the keyword of the trace you want to see. - -<P>Some problems are immediately apparent when the daemon first starts -running. The most common of these are the lack of a ntp (UDP port 123) -in the host <TT>/etc/services</TT> file. Note that NTP does not use TCP -in any form. Other problems are apparent in the system log file. The log -file should show the startup banner, some cryptic initialization data, -and the computed precision value. The next most common problem is -incorrect DNS names. Check that each DNS name used in the configuration -file responds to the Unix <TT>ping</TT> command. - -<P>When first started, the daemon normally polls the servers listed in -the configuration file at 64-second intervals. In order to allow a +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>NTP Debugging Techniques</title> +</head> +<body> +<h3>NTP Debugging Techniques</h3> + +<img align="left" src="pic/pogo.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>We make house calls and bring our own bugs.<br clear="left"> +</p> + +<hr> +<p>Once the NTP software distribution has been compiled and +installed and the configuration file constructed, the next step is +to verify correct operation and fix any bugs that may result. +Usually, the command line that starts the daemon is included in the +system startup file, so it is executed only at system boot time; +however, the daemon can be stopped and restarted from root at any +time. Usually, no command-line arguments are required, unless +special actions described in the <tt><a href="ntpd.htm"> +ntpd</a></tt> page are required. Once started, the daemon will +begin sending and receiving messages, as specified in the +configuration file.</p> + +<h4>Initial Startup</h4> + +<p>The best way to verify correct operation is using the <tt><a +href="ntpq.htm">ntpq</a></tt> and <tt><a href="ntpdc.htm"> +ntpdc</a></tt> utility programs, either on the server itself or +from another machine elsewhere in the network. The <tt>ntpq</tt> +program implements the management functions specified in the NTP +specification <a href= +"http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305c.ps"> +RFC-1305, Appendix A</a>. The <tt>ntpdc</tt> program implements +additional functions not provided in the standard. Both programs +can be used to inspect the state variables defined in the +specification and, in the case of <tt>ntpdc</tt>, additional ones +of interest. In addition, the <tt>ntpdc</tt> program can be used to +selectively reconfigure and enable or disable some functions while +the daemon is running.</p> + +<p>In extreme cases with elusive bugs, the daemon can operate in +two modes, depending on the presence of the <tt>-d</tt> +command-line debug switch. If not present, the daemon detaches from +the controlling terminal and proceeds autonomously. If one or more +<tt>-d</tt> switches are present, the daemon does not detach and +generates special output useful for debugging. In general, +interpretation of this output requires reference to the sources. +However, a single <tt>-d</tt> does produce only mildly cryptic +output and can be very useful in finding problems with +configuration and network troubles. With a little experience, the +volume of output can be reduced by piping the output to <tt> +grep</tt> and specifying the keyword of the trace you want to +see.</p> + +<p>Some problems are immediately apparent when the daemon first +starts running. The most common of these are the lack of a UDP port +for NTP (123) in the Unix <tt>/etc/services</tt> file (or +equivalent in some systems). Note that NTP does not use TCP in any +form. Other problems are apparent in the system log file. The log +file should show the startup banner, some cryptic initialization +data and the computed precision value. The next most common problem +is incorrect DNS names. Check that each DNS name used in the +configuration file exists and that the address responds to the Unix +<tt>ping</tt> command.</p> + +<p>When first started, the daemon normally polls the servers listed +in the configuration file at 64-s intervals. In order to allow a sufficient number of samples for the NTP algorithms to reliably -discriminate between correctly operating servers and possible intruders, -at least four valid messages from at least one server is required before -the daemon can set the local clock. However, if the current local time -is greater than 1000 seconds in error from the server time, the daemon -will not set the local clock; instead, it will plant a message in the -system log and shut down. It is necessary to set the local clock to -within 1000 seconds first, either by a time-of-year hardware clock, by -first using the <A HREF="ntpdate.htm"><TT>ntpdate</TT> </A>program or -manually be eyeball and wristwatch. - -<P>After starting the daemon, run the <TT>ntpq</TT> program using the -<TT>-n</TT> switch, which will avoid possible distractions due to name -resolution problems. Use the <TT>pe</TT> command to display a billboard -showing the status of configured peers and possibly other clients poking -the daemon. After operating for a few minutes, the display should be -something like: - -<PRE>ntpq>pe -remote refid st t when poll reach delay offset disp -=================================================================== -+128.4.2.6 132.249.16.1 2 u 131 256 373 9.89 16.28 23.25 -*128.4.1.20 .WWVB. 1 u 137 256 377 280.62 21.74 20.23 --128.8.2.88 128.8.10.1 2 u 49 128 376 294.14 5.94 17.47 -+128.4.2.17 .WWVB. 1 u 173 256 377 279.95 20.56 16.40 -</PRE> - -The host addresses shown in the <TT>remote</TT> column should agree with -the DNS entries in the configuration file, plus any peers not mentioned -in the file at the same or lower than your stratum that happen to be -configured to peer with you. Be prepared for surprises in cases where -the peer has multiple addresses or multiple names. The <TT>refid</TT> -entry shows the current source of synchronization for each peer, while -the <TT>st</TT> reveals the stratum, <TT>t</TT> the type (<TT>u</TT> = -unicast, <TT>m</TT> = multicast, <TT>l</TT> = local, <TT>-</TT> = don't -know), and <TT>poll</TT> the polling interval in seconds. The -<TT>when</TT> entry shows the time since the peer was last heard, -normally in seconds, while the <TT>reach</TT> entry shows the status of -the reachability register (see RFC-1305) in octal. The remaining entries -show the latest delay, offset and dispersion computed for the peer in -milliseconds. Note that in NTP Version 4 the dispersion entry includes -only the RMS error component; earlier versions included all components. - -<P>The tattletale character at the left margin displays the +discriminate between correctly operating servers and possible +intruders, at least four valid messages from the majority of +servers and peers listed in the configuration file is required +before the daemon can set the local clock. However, if the +difference between the client time and server time is greater than +the panic threshold, which defaults to 1000 s, the daemon will send +a message to the system log and shut down without setting the +clock. It is necessary to set the local clock to within the panic +threshold first, either manually by eyeball and wristwatch and the +Unix <tt>date</tt> command, or by the <tt>ntpdate</tt> or <tt>ntpd +-q</tt> commands. The panic threshold can be changed by the <tt> +tinker panic</tt> command discribed on the <a href="miscopt.htm"> +Miscellaneous Options</a> page. The panic threshold can be disabled +entirely by the <tt>-g</tt> command line option described on the <a +href="ntpd.htm">ntpd - Network Time Protocol (NTP) daemon</a> +page.</p> + +<p>If the difference between local time and server time is less +than the panic threshold but greater than the step threshold, which +defaults to 125 ms, the daemon will perform a step adjustment; +otherwise, it will gradually slew the clock to the nominal time. +The step threshold can be changed by the <tt>tinker step</tt> +command discribed on the <a href="miscopt.htm">Miscellaneous +Options</a> page. The step threshold can be disabled entirely by +the <tt>-x</tt> command line option described on the <a href= +"ntpd.htm">ntpd - Network Time Protocol (NTP) daemon</a> page. In +this case the clock will never be stepped; however, users should +understand the implications for doing this in a distributed data +network where all processing must be tightly synchronized. See the +<a href="leap.htm">NTP Timescale and Leap Seconds</a> page for +further information. If a step adjustment is made, the clock +discipline algorithm will start all over again, requiring another +round of at least four messages as before. This is necessary so +that all servers and peers operate on the same set of time +values.</p> + +<p>The clock discipline algorithm is designed to avoid large noise +spikes that might occur on a congested network or access line. If +an offset sample exceeds the step threshold, it is ignored and a +timer started. If a later sample is below the step threshold, the +counter is reset. However, if the counter is greater than the +stepout interval, which defaults to 900 s, the next sample will +step or slew the time as directed. The stepout threshold can be +changed by the <tt>tinker stepout</tt> command discribed on the <a +href="miscopt.htm">Miscellaneous Options</a> page.</p> + +<p>If, as discussed later on this page, for some reason the +hardware clock oscillator frequency error is very large, the time +errors upon first startup of the daemon may increase over time +until exceeding the step threshold, which requires another step +correction. However, due to provisions that reduce vulnerability to +noise spikes, the second correction will not be done until after +the stepout threshold. When the frequency error is very large, it +may take a number of cycles like this until converging on the +nominal frequency correction. After this, the correction is written +to the <tt>ntp.drift</tt> file, which is read upon subsequent +restarts, so the herky-jerky cycles should not recur.</p> + +<h4>Verifying Correct Operation</h4> + +<p>After starting the daemon, run the <tt>ntpq</tt> program using +the <tt>-n</tt> switch, which will avoid possible distractions due +to name resolution problems. Use the <tt>pe</tt> command to display +a billboard showing the status of configured peers and possibly +other clients poking the daemon. After operating for a few minutes, +the display should be something like:</p> + +<pre> +ntpq> pe + remote refid st t when poll reach delay offset jitter +===================================================================== +-isipc6.cairn.ne .GPS1. 1 u 18 64 377 65.592 -5.891 0.044 ++saicpc-isiepc2. pogo.udel.edu 2 u 241 128 370 10.477 -0.117 0.067 ++uclpc.cairn.net pogo.udel.edu 2 u 37 64 177 212.111 -0.551 0.187 +*pogo.udel.edu .GPS1. 1 u 95 128 377 0.607 0.123 0.027 +</pre> + +<p>The host names or addresses shown in the <tt>remote</tt> column +correspond to the server and peer entries listed in the +configuration file; however, the DNS names might not agree if the +names listed are not the canonical DNS names. The <tt>refid</tt> +column shows the current source of synchronization, while the <tt> +st</tt> column reveals the stratum, <tt>t</tt> the type (<tt>u</tt> += unicast, <tt>m</tt> = multicast, <tt>l</tt> = local, <tt>-</tt> = +don't know), and <tt>poll</tt> the poll interval in seconds. The +<tt>when</tt> column shows the time since the peer was last heard +in seconds, while the <tt>reach</tt> column shows the status of the +reachability register (see RFC-1305) in octal. The remaining +entries show the latest delay, offset and jitter in milliseconds. +Note that in NTP Version 4 what used to be the <tt>dispersion</tt> +column has been replaced by the <tt>jitter</tt> column.</p> + +<p>The tattletale symbol at the left margin displays the synchronization status of each peer. The currently selected peer is -marked <TT>*</TT>, while additional peers designated acceptable for -synchronization, but not currently selected, are marked <TT>+</TT>. -Peers marked <TT>*</TT> and <TT>+</TT> are included in a weighted -average computation to set the local clock; the data produced by peers -marked with other symbols are discarded. See the <TT>ntpq</TT> -documentation for the meaning of these symbols. - -<P>Additional details for each peer separately can be determined by the -following procedure. First, use the <TT>as</TT> command to display an -index of association identifiers, such as - -<PRE>ntpq>as -ind assID status conf reach auth condition last_event cnt -========================================================= - 1 11670 7414 no yes ok candidate reachable 1 - 2 11673 7614 no yes ok sys.peer reachable 1 - 3 11833 7314 no yes ok outlyer reachable 1 - 4 11868 7414 no yes ok candidate reachable 1 - </PRE> - -Each line in this billboard is associated with the corresponding line -the <TT>pe</TT> billboard above. Next, use the <TT>rv</TT> command and -the respective identifier to display a detailed synopsis of the selected -peer, such as - -<PRE>ntpq>rv 11670 -status=7414 reach, auth, sel_sync, 1 event, event_reach -srcadr=128.4.2.6, srcport=123, dstadr=128.4.2.7, dstport=123, keyid=1, -stratum=2, precision=-10, rootdelay=362.00, rootdispersion=21.99, -refid=132.249.16.1, -reftime=af00bb44.849b0000 Fri, Jan 15 1993 4:25:40.517, -delay= 9.89, offset= 16.28, -dispersion=23.25, reach=373, valid=8, -hmode=2, pmode=1, hpoll=8, ppoll=10, leap=00, flash=0x0, -org=af00bb48.31a90000 Fri, Jan 15 1993 4:25:44.193, -rec=af00bb48.305e3000 Fri, Jan 15 1993 4:25:44.188, -xmt=af00bb1e.16689000 Fri, Jan 15 1993 4:25:02.087, -filtdelay= 16.40 9.89 140.08 9.63 9.72 9.22 10.79 122.99, -filtoffset= 13.24 16.28 -49.19 16.04 16.83 16.49 16.95 -39.43, -filterror= 16.27 20.17 27.98 31.89 35.80 39.70 43.61 47.52 -</PRE> - -A detailed explanation of the fields in this billboard are beyond the -scope of this discussion; however, most variables defined in the -specification RFC-1305 can be found. The most useful portion for -debugging is the last three lines, which give the roundtrip delay, clock -offset and dispersion for each of the last eight measurement rounds, all -in milliseconds. Note that the dispersion, which is an estimate of the -error, increases as the age of the sample increases. From these data, it -is usually possible to determine the incidence of severe packet loss, -network congestion, and unstable local clock oscillators. There are no -hard and fast rules here, since every case is unique; however, if one or -more of the rounds show zeros, or if the clock offset changes -dramatically in the same direction for each round, cause for alarm -exists. - -<P>Finally, the state of the local clock can be determined using the -<TT>rv</TT> command (without the argument), such as - -<PRE>ntpq>rv -status=0664 leap_none, sync_ntp, 6 events, event_peer/strat_chg -system="UNIX", leap=00, stratum=2, rootdelay=280.62, -rootdispersion=45.26, peer=11673, refid=128.4.1.20, -reftime=af00bb42.56111000 Fri, Jan 15 1993 4:25:38.336, -poll=8, clock=af00bbcd.8a5de000 Fri, Jan 15 1993 4:27:57.540, -phase=21.147, freq=13319.46, compliance=2 -</PRE> - -The most useful data in this billboard show when the clock was last -adjusted <TT>reftime</TT>, together with its status and most recent -exception event. An explanation of these data is in the specification -RFC-1305. - -<P>When nothing seems to happen in the <TT>pe</TT> billboard after some -minutes, there may be a network problem. The most common network problem -is an access controlled router on the path to the selected peer. No -known public NTP time server selectively restricts access at this time, -although this may change in future; however, many private networks do. -It also may be the case that the server is down or running in -unsynchronized mode due to a local problem. Use the <TT>ntpq</TT> -program to spy on its own variables in the same way you can spy on your -own. - -<P>Once the daemon has set the local clock, it will continuously track -the discrepancy between local time and NTP time and adjust the local -clock accordingly. There are two components of this adjustment, time and -frequency. These adjustments are automatically determined by the clock -discipline algorithm, which functions as a hybrid phase/frequency -feedback loop. The behavior of this algorithm is carefully controlled to -minimize residual errors due to network jitter and frequency variations -of the local clock hardware oscillator that normally occur in practice. -However, when started for the first time, the algorithm may take some -time to converge on the intrinsic frequency error of the host machine. - -<P>It has sometimes been the experience that the local clock oscillator -frequency error is too large for the NTP discipline algorithm, which can -correct frequency errors as large as 43 seconds per day. There are two -possibilities that may result in this problem. First, the hardware time- -of-year clock chip must be disabled when using NTP, since this can -destabilize the discipline process. This is usually done using the -<TT><A HREF="tickadj.htm">tickadj</A></TT> program and the <TT>-s</TT> -command line argument, but other means may be necessary. For instance, -in the Sun Solaris kernel, this can be done using a command in the -system startup file. - -<P>Normally, the daemon will adjust the local clock in small steps in -such a way that system and user programs are unaware of its operation. -The adjustment process operates continuously as long as the apparent -clock error exceeds 128 milliseconds, which for most Internet paths is a -quite rare event. If the event is simply an outlyer due to an occasional -network delay spike, the correction is simply discarded; however, if the -apparent time error persists for an interval of about 20 minutes, the -local clock is stepped to the new value (as an option, the daemon can be -compiled to slew at an accelerated rate to the new value, rather than be -stepped). This behavior is designed to resist errors due to severely -congested network paths, as well as errors due to confused radio clocks -upon the epoch of a leap second. - -<H4>Debugging Checklist</H4> - -If the <TT>ntpq</TT> or <TT>ntpdc</TT> programs do not show that -messages are being received by the daemon or that received messages do -not result in correct synchronization, verify the following: - -<OL> - -<P><LI>Verify the <TT>/etc/services</TT> file host machine is configured -to -accept UDP packets on the NTP port 123. NTP is specifically designed to -use UDP and does not respond to TCP.</LI> - -<P><LI>Check the system log for <TT>ntpd</TT> messages about -configuration -errors, name-lookup failures or initialization problems.</LI> - -<P><LI>Using the <TT>ntpdc</TT> program and <TT>iostats</TT> command, -verify that the received packets and packets sent counters are -incrementing. If the packets send counter does not increment and the -configuration file includes designated servers, something may be wrong -in the network configuration of the ntpd host. If this counter does -increment and packets are actually being sent to the network, but the -received packets counter does not increment, something may be wrong in -the network or the server may not be responding.</LI> - -<P><LI>If both the packets sent counter and received packets counter do -increment, but the <TT>rec</TT> timestamp in the <TT>pe</TT> billboard -shows far from the current date, received packets are probably being -discarded for some reason. There is a handy, undocumented state variable -<TT>flash</TT> visible in the <TT>pe</TT>billboard. The value is in hex -and normally has the value zero (OK). However, if something is wrong, -the bits of this variable, reading from the right, correspond to the -sanity checks listed in Section 3.4.3 of the NTP specification <A -HREF="http://www.eecis.udel.edu/~mills/database/rfc/rfc1305/rfc1305b.ps" ->RFC-1305</A>. A bit other than zero indicates the associated sanity -check failed.</LI> - -<P><LI>If the <TT>org, rec</TT> and <TT>xmt</TT> timestamps in the -<TT>pe</TT> billboard appear current, but the local clock is not set, as -indicated by a stratum number less than 16 in the <TT>rv</TT> command -without arguments, verify that valid clock offset, roundtrip delay and -dispersion are displayed for at least one peer. The clock offset should -be less than 1000 seconds, the roundtrip delay less than one second and -the dispersion less than one second.</LI> - - -<P><LI>While the algorithm can tolerate a relatively large frequency -error (up to 500 parts per million or 43 seconds per day), various -configuration errors (and in some cases kernel bugs) can exceed this -tolerance, leading to erratic behavior. This can result in frequent loss -of synchronization, together with wildly swinging offsets. Use the -<TT>ntpdc</TT> program (or temporary configuration file) and <TT>disable -pll</TT> command to prevent the <TT>ntpd</TT> daemon from setting the -clock. Using the <TT>ntpq</TT> or <TT>ntpdc</TT> programs, watch the -apparent offset as it varies over time to determine the intrinsic -frequency error. If the error increases by more than 22 milliseconds per -64-second poll interval, the intrinsic frequency must be reduced by some -means. The easiest way to do this is with the <TT><A -HREF="tickadj.htm">tickadj</A></TT> program and the <TT>-t</TT> -command line argument.</LI> - -</OL> - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +marked <tt>*</tt>, while additional peers designated acceptable for +synchronization, but not currently selected, are marked <tt>+</tt>. +Peers marked <tt>*</tt> and <tt>+</tt> are included in the weighted +average computation to set the local clock; the data produced by +peers marked with other symbols are discarded. See the <tt> +ntpq</tt> page for the meaning of these symbols.</p> + +<p>Additional details for each peer separately can be determined by +the following procedure. First, use the <tt>as</tt> command to +display an index of association identifiers, such as</p> + +<pre> +ntpq> as +ind assID status conf reach auth condition last_event cnt +=========================================================== + 1 50252 f314 yes yes ok outlyer reachable 1 + 2 50253 f414 yes yes ok candidat reachable 1 + 3 50254 f414 yes yes ok candidat reachable 1 + 4 50255 f614 yes yes ok sys.peer reachable 1 +</pre> + +<p>Each line in this billboard is associated with the corresponding +line in the <tt>pe</tt> billboard above. The <tt>assID</tt> shows +the unique identifier for each mobilized association, while the +<tt>status</tt> column shows the peer status word in hex, as +defined in the NTP specification. Next, use the <tt>rv</tt> command +and the respective <tt>assID</tt> identifier to display a detailed +synopsis for the selected peer, such as</p> + +<pre> +ntpq> rv 50253 +status=f414 reach, conf, auth, sel_candidat, 1 event, event_reach, +srcadr=saicpc-isiepc2.cairn.net, srcport=123, dstadr=140.173.1.46, +dstport=123, keyid=3816249004, stratum=2, precision=-27, +rootdelay=10.925, rootdispersion=12.848, refid=pogo.udel.edu, +reftime=bd11b225.133e1437 Sat, Jul 8 2000 13:59:01.075, delay=10.550, +offset=-1.357, jitter=0.074, dispersion=1.444, reach=377, valid=7, +hmode=1, pmode=1, hpoll=6, ppoll=7, leap=00, flash=00 ok, +org=bd11b23c.01385836 Sat, Jul 8 2000 13:59:24.004, +rec=bd11b23c.02dc8fb8 Sat, Jul 8 2000 13:59:24.011, +xmt=bd11b21a.ac34c1a8 Sat, Jul 8 2000 13:58:50.672, +filtdelay= 10.45 10.50 10.63 10.40 10.48 10.43 10.49 11.26, +filtoffset= -1.18 -1.26 -1.26 -1.35 -1.35 -1.42 -1.54 -1.81, +filtdisp= 0.51 1.47 2.46 3.45 4.40 5.34 6.33 7.28, +hostname="miro.time.saic.com", publickey=3171359012, pcookie=0x6629adb2, +hcookie=0x61f99cdb, initsequence=61, initkey=0x287b649c, +timestamp=3172053041 +</pre> + +<p>A detailed explanation of the fields in this billboard are +beyond the scope of this discussion; however, most variables +defined in the NTP Version 3 specification RFC-1305 are available +along with others defined for NTP Version 4. This particular +example was chosen to illustrate probably the most complex +configuration involving symmetric modes and public-key +cryptography. As the result of debugging experience, the names and +values of these variables may change from time to time. An +explanation of the current set is on the <tt>ntpq</tt> page.</p> + +<p>A useful indicator of miscellaneous problems is the <tt> +flash</tt> value, which reveals the state of the various sanity +tests on incoming packets. There are currently eleven bits, one for +each test, numbered from the right, which is for test 1. If the +test fails, the corresponding bit is set to one and zero otherwise. +If any bit is set following each processing step, the packet is +discarded. The meaning of each test is described on the <tt> +ntpq</tt> page.</p> + +<p>The three lines identified as <tt>filtdelay</tt>, <tt> +filtoffset</tt> and <tt>filtdisp</tt> reveal the roundtrip delay, +clock offset and dispersion for each of the last eight measurement +rounds, all in milliseconds. Note that the dispersion, which is an +estimate of the error, increases as the age of the sample +increases. From these data, it is usually possible to determine the +incidence of severe packet loss, network congestion, and unstable +local clock oscillators. There are no hard and fast rules here, +since every case is unique; however, if one or more of the rounds +show large values or change radically from one round to another, +the network is probably congested or lossy.</p> + +<p>Once the daemon has set the local clock, it will continuously +track the discrepancy between local time and NTP time and adjust +the local clock accordingly. There are two components of this +adjustment, time and frequency. These adjustments are automatically +determined by the clock discipline algorithm, which functions as a +hybrid phase/frequency feedback loop. The behavior of this +algorithm is carefully controlled to minimize residual errors due +to network jitter and frequency variations of the local clock +hardware oscillator that normally occur in practice. However, when +started for the first time, the algorithm may take some time to +converge on the intrinsic frequency error of the host machine.</p> + +<p>The state of the local clock itself can be determined using the +<tt>rv</tt> command (without the argument), such as</p> + +<pre> +ntpq> rv +status=0644 leap_none, sync_ntp, 4 events, event_peer/strat_chg, +version="ntpd 4.0.99j4-r Fri Jul 7 23:38:17 GMT 2000 (1)", +processor="i386", system="FreeBSD3.4-RELEASE", leap=00, stratum=2, +precision=-27, rootdelay=0.552, rootdispersion=12.532, peer=50255, +refid=pogo.udel.edu, +reftime=bd11b220.ac89f40a Sat, Jul 8 2000 13:58:56.673, poll=6, +clock=bd11b225.ee201472 Sat, Jul 8 2000 13:59:01.930, state=4, +phase=0.179, frequency=44.298, jitter=0.022, stability=0.001, +hostname="barnstable.udel.edu", publickey=3171372095, params=3171372095, +refresh=3172016539 +</pre> + +<p>An explanation about most of these variables is in the RFC-1305 +specification. The most useful ones include <tt>clock</tt>, which +shows when the clock was last adjusted, and <tt>reftime</tt>, which +shows when the server clock of <tt>refid</tt> was last adjusted. +The <tt>version</tt>, <tt>processor</tt> and <tt>system</tt> values +are very helpful when included in bug reports. The mean millisecond +time offset (<tt>phase</tt>) and deviation (<tt>jitter</tt>) +monitor the clock quality, while the mean PPM frequency offset +(<tt>frequency</tt>) and deviation (<tt>stability</tt>) monitor the +clock stability and serve as a useful diagnostic tool. It has been +the experience of NTP operators over the years that these data +represent useful environment and hardware alarms. If the +motherboard fan freezes up or some hardware bit sticks, the system +clock is usually the first to notice it.</p> + +<p>Among the new variables added for NTP Version 4 are the <tt> +hostname</tt>, <tt>publickey</tt>, <tt>params</tt> and <tt> +refresh</tt>, which are used for the Autokey public-key +cryptography described on the <a href="authopt.htm">Authentication +Options</a> page. The values show the filestamps, in NTP seconds, +that the associated values were created. These are useful in +diagnosing problems with cryptographic key consistency and ordering +principles.</p> + +<p>When nothing seems to happen in the <tt>pe</tt> billboard after +some minutes, there may be a network problem. One common network +problem is an access controlled router on the path to the selected +peer or an access controlled server using methods described on the +<a href="accopt.htm">Access Control Options</a> page. Another +common problem is that the server is down or running in +unsynchronized mode due to a local problem. Use the <tt>ntpq</tt> +program to spy on the server variables in the same way you can spy +on your own.</p> + +<p>Normally, the daemon will adjust the local clock in small steps +in such a way that system and user programs are unaware of its +operation. The adjustment process operates continuously as long as +the apparent clock error exceeds the step threshold for a period +longer than the stepout threshold, which for most Internet paths is +a very rare event. If the event is simply an outlyer due to an +occasional network delay spike, the correction is simply discarded; +however, if the apparent time error persists for longer than the +stepout threshold of about 17 minutes, the local clock is stepped +or slewed to the new value as directed. This behavior is designed +to resist errors due to severely congested network paths, as well +as errors due to confused radio clocks upon the epoch of a leap +second.</p> + +<h4>Special Problems</h4> + +<p>The frequency tolerance of computer clock oscillators can vary +widely, which can put a strain on the daemon's ability to +compensate for the intrinsic frequency error. While the daemon can +handle frequency errors up to 500 parts-per-million (PPM), or 43 +seconds per day, values much above 100 PPM reduce the headroom and +increase the time to learn the particular value and record it in +the <tt>ntp.drift</tt> file. In extreme cases before the particular +oscillator frequency error has been determined, the residual system +time offsets can sweep from one extreme to the other of the 128-ms +tracking window only for the behavior to repeat at 900-s intervals +until the measurements have converged.</p> + +<p>In order to determine if excessive frequency error is a problem, +observe the nominal <tt>filtoffset</tt> values for a number of +rounds and divide by the poll interval. If the result is something +approaching 500 PPM, there is a good chance that NTP will not work +properly until the frequency error is reduced by some means. A +common cause is the hardware time-of-year (TOY) clock chip, which +must be disabled when NTP disciplines the software clock. For some +systems this can be done using the <tt><a href="tickadj.htm"> +tickadj</a></tt> utility and the <tt>-s</tt> command line argument. +For other systems this can be done using a command in the system +startup file.</p> + +<p>If the TOY chip is not the cause, the problem may be that the +hardware clock frequency may simply be too slow or two fast. In +some systems this might require tweaking a trimmer capacitor on the +motherboard. For other systems the clock frequency can be adjusted +in increments of 100 PPM using the <tt>tickadj</tt> utility and the +<tt>-t</tt> command line argument. Note that the <tt>tickadj</tt> +alters certain kernel variables and, while the utility attempts to +figure out an acceptable way to do this, there are many cases where +<tt>tickadj</tt> is incompatible with a running kernel.</p> + +<p>Provisions are included in <tt>ntpd</tt> for access controls +which deflect unwanted traffic from selected hosts or networks. The +controls described on the <a href="accopt.htm">Access Control +Options</a> include detailed packet filter operations based on +source address and address mask. Normally, filtered packets are +dropped without notice other than to increment tally counters. +However, the server can configure to generate what is called a +kiss-of-death (KOD) packet and send to the client. In case of +outright access denied, the KOD is the response to the first client +packet. In this case the client association is permanently disabled +and the access denied bit (test 4) is set in the flash peer +variable mentioned above and a message is sent to the system +log.</p> + +<p>The access control provisions include a limit on the packet rate +from a host or network. If an incoming packet exceeds the limit, it +is dropped and a KOD sent to the source. If this occurs after the +client association has synchronized, the association is not +disabled, but a message is sent to the system log. See the <a href= +"accopt.htm">Access Control Options</a> page for further +informatin.</p> + +<p>In some reported scenarios an access line may show low to +moderate network delays during some period of the day and moderate +to high delays during other periods. Often the delay on one +direction of transmission dominates, which can result in large time +offset errors, sometimes in the range up to a few seconds. It is +not usually convenient to run <tt>ntpd</tt> throughout the day in +such scenarios, since this could result in several time steps, +especially if the condition persists for greater than the stepout +threshold.</p> + +<p>The recommended approach in such scenarios is first to calibrate +the local clock frequency error by running <tt>ntpd</tt> in +continuous mode during the quiet interval and let it write the +frequency to the <tt>ntp.drift</tt> file. Then, run <tt>ntpd +-q</tt> from a cron job each day at some time in the quiet +interval. In systems with the nanokernel or microkernel performance +enhancements, including Solaris, Tru64, Linux and FreeBSD, the +kernel continuously disciplines the frequency so that the residual +correction produced by <tt>ntpd</tt> is usually less than a few +milliseconds.</p> + +<h4>Debugging Checklist</h4> + +If the <tt>ntpq</tt> or <tt>ntpdc</tt> programs do not show that +messages are being received by the daemon or that received messages +do not result in correct synchronization, verify the following: + +<ol> +<li style="list-style: none"></li> + +<li>Verify the <tt>/etc/services</tt> file host machine is +configured to accept UDP packets on the NTP port 123. NTP is +specifically designed to use UDP and does not respond to TCP.</li> + +<li style="list-style: none"></li> + +<li>Check the system log for <tt>ntpd</tt> messages about +configuration errors, name-lookup failures or initialization +problems.</li> + +<li style="list-style: none"></li> + +<li>Verify using <tt>ping</tt> or other utility that packets +actually do make the round trip between the client and server. +Verify using <tt>nslookup</tt> or other utility that the DNS server +names do exist and resolve to valid Internet addresses.</li> + +<li>Using the <tt>ntpdc</tt> program, verify that the packets +received and packets sent counters are incrementing. If the sent +counter does not increment and the configuration file includes +configured servers, something may be wrong in the host network or +interface configuration. If this counter does increment, but the +received counter does not increment, something may be wrong in the +network or the server NTP daemon may not be running or the server +itself may be down or not responding.</li> + +<li style="list-style: none"></li> + +<li>If both the sent and received counters do increment, but the +<tt>reach</tt> values in the <tt>pe</tt> billboard with <tt> +ntpq</tt> continues to show zero, received packets are probably +being discarded for some reason. If this is the case, the cause +should be evident from the <tt>flash</tt> variable as discussed +above and on the <tt>ntpq</tt> page.</li> + +<li style="list-style: none"></li> + +<li>If the <tt>reach</tt> values in the <tt>pe</tt> billboard show +the servers are alive and responding, note the tattletale symbols +at the left margin, which indicate the status of each server +resulting from the various grooming and mitigation algorithms. The +interpretation of these symbols is discussed on the <tt>ntpq</tt> +page. After a few minutes of operation, one or another of the +reachable server candidates should show a * tattletale symbol. If +this doesn't happen, the intersection algorithm, which classifies +the servers as truechimers or falsetickers, may be unable to find a +majority of truechimers among the server population.</li> + +<li style="list-style: none"></li> + +<li>If all else fails, see the FAQ and/or the discussion and +briefings at <a href="http://www.eecis.udel.edu/~mills/ntp.htm"> +Network Time Synchronization Project.</a></li> +</ol> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/driver1.htm b/contrib/ntp/html/driver1.htm index 1f88e7d..b70010f 100644 --- a/contrib/ntp/html/driver1.htm +++ b/contrib/ntp/html/driver1.htm @@ -1,157 +1,157 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Undisciplined Local Clock -</TITLE> -</HEAD> -<BODY> - -<H3> -Undisciplined Local Clock</H3> - -<HR> -<H4> -Synopsis</H4> -Address: 127.127.1.<I>u</I> -<BR>Reference ID: <TT>LCL</TT> -<BR>Driver ID: <TT>LOCAL</TT> -<H4> -Description</H4> -This driver is intended for use in an isolated network where no external -source of synchronization such as a radio clock or modem is available. -It allows a designated time server to act as a primary server to provide -synchronization to other clients on the network. Pick a machine that has -a good clock oscillator (Digital machines are good, Sun machines are not) -and configure it with this driver. Set the clock using the best means available, -like eyeball-and-wristwatch. Then, point all the other machines at this -one or use broadcast (not multicast) mode to distribute time. - -<P>Another application for this driver is if a particular server clock -is to be used as the clock of last resort when all other normal synchronization -sources have gone away. This is especially useful if that server has an -ovenized oscillator. For this you would configure this driver at a stratum -greater than any other likely sources of time (say 3 or 4) to prevent the -server taking over when legitimate sources are still available. - -<P>A third application for this driver is when an external discipline source -is available, such as the NIST <TT>lockclock</TT> program, which synchronizes -the local clock via a telephone modem and the NIST Automated Computer Time -Service (ACTS), or the Digital Time Synchronization Service (DTSS), which -runs on DCE machines. In this case the stratum should be set at zero, indicating -a bona fide stratum-1 source. In the case of DTSS, the local clock can -have a rather large jitter, depending on the interval between corrections -and the intrinsic frequency error of the clock oscillator. In extreme cases, -this can cause clients to exceed the 128-ms slew window and drop off the -NTP subnet. - -<P>In the case where a NTP time server is synchronized to some device or -protocol that is not external to the NTP daemon itself, some means should -be provided to pass such things as error and health values to the NTP daemon -for dissemination to its clients. If this is not done, there is a very -real danger that the device or protocol could fail and with no means to -tell NTP clients of the mishap. When ordinary Unix system calls like <TT>adjtime()</TT> -are used to discipline the kernel clock, there is no obvious way this can -be done without modifying the code for each case. However, when a modified -kernel with the <TT>ntp_adjtime()</TT> system call is available, -that routine can be used for the same purpose as the <TT>adjtime()</TT> -routine and in addition provided with the estimated error, maximum error, -and leap-indicator values. This is the preferred way to synchronize the -kernel clock and pass information to the NTP clients. - -<P>In the default mode the behavior of the clock selection algorithm is -modified when this driver is in use. The algorithm is designed so that -this driver will never be selected unless no other discipline source is -available. This can be overridden with the <TT>prefer</TT> keyword of the -<TT>server</TT> configuration command, in which case only this driver will -be selected for synchronization and all other discipline sources will be -ignored. This behavior is intended for use when an external discipline -source controls the system clock. See the <A HREF="prefer.htm">Mitigation -Rules and the <TT>prefer</TT> Keyword </A>page for a detailed description -of the exact behavior. - -<P>The stratum for this driver is set at 3 by default, but can be changed -by the <TT>fudge</TT> configuration command and/or the <TT>ntpdc</TT> utility. -The reference ID is <TT>LCL</TT> by default, but can be changed using the -same mechanisms. <B>*NEVER*</B> configure this driver to operate at a stratum -which might possibly disrupt a client with access to a bona fide primary -server, unless the local clock oscillator is reliably disciplined by another -source. <B>*NEVER NEVER*</B> configure a server which might devolve to -an undisciplined local clock to use multicast mode. - -<P>This driver provides a mechanism to trim the local clock in both time -and frequency, as well as a way to manipulate the leap bits. The <TT>fudge -time1</TT> parameter adjusts the time (in seconds) and the <TT>fudge time2</TT> -parameter adjusts the frequency (in parts per million). Both parameters -are additive and operate only once; that is, each command (as from <TT>ntpdc</TT>) -adds signed increments in time or frequency to the nominal local clock -time and frequency. -<H4> -Monitor Data</H4> -No <TT>filegen clockstats</TT> monitor data are produced by this driver. -<H4> -Fudge Factors</H4> - -<DL> -<DT> -<TT>time1 <I>time</I></TT></DT> - -<DD> -Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.</DD> - -<DT> -<TT>time2 <I>time</I></TT></DT> - -<DD> -Specifies the frequency offset calibration factor, in parts per million, -with default 0.0.</DD> - -<DT> -<TT>stratum <I>number</I></TT></DT> - -<DD> -Specifies the driver stratum, in decimal from 0 to 15, with default 3.</DD> - -<DT> -<TT>refid <I>string</I></TT></DT> - -<DD> -Specifies the driver reference identifier, an ASCII string from one to -four characters, with default <TT>LCL</TT>.</DD> - -<DT> -<TT>flag1 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag2 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag3 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag4 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - - -<P>Additional Information - -<P><A HREF="refclock.htm">Reference Clock Drivers</A></DL> - -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<meta http-equiv="Content-Type" content= +"text/html; charset=iso-8859-1"> +<meta name="GENERATOR" content= +"Mozilla/4.01 [en] (Win95; I) [Netscape]"> +<title>Undisciplined Local Clock</title> +</head> +<body> +<h3>Undisciplined Local Clock</h3> + +<hr> +<h4>Synopsis</h4> + +Address: 127.127.1.<i>u</i> <br> +Reference ID: <tt>LCL</tt> <br> +Driver ID: <tt>LOCAL</tt> + +<h4>Description</h4> + +<p>This driver is intended for use in an isolated network where no +external source of synchronization such as a radio clock or modem +is available. It allows a designated time server to act as a +primary server to provide synchronization to other clients on the +network. Pick a machine that has a good clock oscillator (Digital +machines are good, Sun machines are not) and configure it with this +driver. Set the clock using the best means available, like +eyeball-and-wristwatch. Then, point all the other machines at this +one or use broadcast (not multicast) mode to distribute time.</p> + +<p>Another application for this driver is if a particular server +clock is to be used as the clock of last resort when all other +normal synchronization sources have gone away. This is especially +useful if that server has an ovenized oscillator. For this you +would configure this driver at a stratum greater than any other +likely sources of time (say 3 or 4) to prevent the server taking +over when legitimate sources are still available.</p> + +<p>A third application for this driver is when an external +discipline source is available, such as the NIST <tt>lockclock</tt> +program, which synchronizes the local clock via a telephone modem +and the NIST Automated Computer Time Service (ACTS), or the Digital +Time Synchronization Service (DTSS), which runs on DCE machines. In +this case the stratum should be set at zero, indicating a bona fide +stratum-1 source. In the case of DTSS, the local clock can have a +rather large jitter, depending on the interval between corrections +and the intrinsic frequency error of the clock oscillator. In +extreme cases, this can cause clients to exceed the 128-ms slew +window and drop off the NTP subnet.</p> + +<p>In the case where a NTP time server is synchronized to some +device or protocol that is not external to the NTP daemon itself, +some means should be provided to pass such things as error and +health values to the NTP daemon for dissemination to its clients. +If this is not done, there is a very real danger that the device or +protocol could fail and with no means to tell NTP clients of the +mishap. When ordinary Unix system calls like <tt>adjtime()</tt> are +used to discipline the kernel clock, there is no obvious way this +can be done without modifying the code for each case. However, when +a modified kernel with the <tt>ntp_adjtime()</tt> system call +is available, that routine can be used for the same purpose as the +<tt>adjtime()</tt> routine and in addition provided with the +estimated error, maximum error, and leap-indicator values. This is +the preferred way to synchronize the kernel clock and pass +information to the NTP clients.</p> + +<p>In the default mode the behavior of the clock selection +algorithm is modified when this driver is in use. The algorithm is +designed so that this driver will never be selected unless no other +discipline source is available. This can be overridden with the +<tt>prefer</tt> keyword of the <tt>server</tt> configuration +command, in which case only this driver will be selected for +synchronization and all other discipline sources will be ignored. +This behavior is intended for use when an external discipline +source controls the system clock. See the <a href="prefer.htm"> +Mitigation Rules and the <tt>prefer</tt> Keyword</a> page for a +detailed description of the exact behavior.</p> + +<p>The stratum for this driver is set at 3 by default, but can be +changed by the <tt>fudge</tt> configuration command and/or the <tt> +ntpdc</tt> utility. The reference ID is <tt>LCL</tt> by default, +but can be changed using the same mechanisms. <b>*NEVER*</b> +configure this driver to operate at a stratum which might possibly +disrupt a client with access to a bona fide primary server, unless +the local clock oscillator is reliably disciplined by another +source. <b>*NEVER NEVER*</b> configure a server which might devolve +to an undisciplined local clock to use multicast mode.</p> + +<p>This driver provides a mechanism to trim the local clock in both +time and frequency, as well as a way to manipulate the leap bits. +The <tt>fudge time1</tt> parameter adjusts the time (in seconds) +and the <tt>fudge time2</tt> parameter adjusts the frequency (in +parts per million). Both parameters are additive and operate only +once; that is, each command (as from <tt>ntpdc</tt>) adds signed +increments in time or frequency to the nominal local clock time and +frequency.</p> + +<h4>Monitor Data</h4> + +No <tt>filegen clockstats</tt> monitor data are produced by this +driver. + +<h4>Fudge Factors</h4> + +<dl> +<dt><tt>time1 <i>time</i></tt></dt> + +<dd>Specifies the time offset calibration factor, in seconds and +fraction, with default 0.0.</dd> + +<dt><tt>time2 <i>time</i></tt></dt> + +<dd>Specifies the frequency offset calibration factor, in parts per +million, with default 0.0.</dd> + +<dt><tt>stratum <i>number</i></tt></dt> + +<dd>Specifies the driver stratum, in decimal from 0 to 15, with +default 3.</dd> + +<dt><tt>refid <i>string</i></tt></dt> + +<dd>Specifies the driver reference identifier, an ASCII string from +one to four characters, with default <tt>LCL</tt>.</dd> + +<dt><tt>flag1 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> + +<dt><tt>flag2 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> + +<dt><tt>flag3 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> + +<dt><tt>flag4 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> +</dl> + +<p>Additional Information</p> + +<p><a href="refclock.htm">Reference Clock Drivers</a></p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/driver20.htm b/contrib/ntp/html/driver20.htm index e6a4bd2..6d1126b 100644 --- a/contrib/ntp/html/driver20.htm +++ b/contrib/ntp/html/driver20.htm @@ -1,39 +1,46 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Generic NMEA GPS Receiver -</TITLE> -</HEAD> -<BODY> - -<H3> -Generic NMEA GPS Receiver</H3> - -<HR> -<H4> -Synopsis</H4> -Address: 127.127.20.<I>u</I> -<BR>Reference ID: <TT>GPS</TT> -<BR>Driver ID: <TT>GPS_NMEA</TT> -<BR>Serial Port: <TT>/dev/gps<I>u</I></TT>; 4800 baud, 8-bits, no parity -<BR>Features: <TT>tty_clk</TT> -<H4> -Description</H4> -This driver supports GPS receivers with the <TT>$GPRMC</TT> NMEA output string. -The driver expect the receiver to be set up to transmit a <TT>$GPRMC</TT> +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; Linux 2.2.16-22 i586) [Netscape]"> + <title>Generic NMEA GPS Receiver +</title> +</head> +<body> + +<h3> +Generic NMEA GPS Receiver</h3> + +<hr> +<h4> +Synopsis</h4> +Address: 127.127.20.<i>u</i> +<br>Reference ID: <tt>GPS</tt> +<br>Driver ID: <tt>GPS_NMEA</tt> +<br>Serial Port: <tt>/dev/gps<i>u</i></tt>; 4800 baud, 8-bits, no parity +<br>Features: <tt>tty_clk</tt> +<h4> +Description</h4> +This driver supports GPS receivers with the <tt>$GPRMC</tt> NMEA output +string by default. Alternately the <tt>$GPGGA</tt> or <tt>$GPGLL +</tt>may +be selected. +<br>The driver expects the receiver to be set up to transmit a <tt>$GPRMC</tt> message every second. - -<P>The accuracy depend on the receiver used. Inexpesive GPS models are -available with a claimed PPS signal accuracy of 1 <FONT FACE="Symbol">m</FONT>s +<p>The accuracy depend on the receiver used. Inexpesive GPS models are +available with a claimed PPS signal accuracy of 1 <font face="Symbol">m</font>s or better relative to the broadcast signal. However, in most cases the actual accuracy is limited by the precision of the timecode and the latencies of the serial interface and operating system. - -<P>The $GPRMC message that the GPS transmits look like this: -<PRE>$GPRMC,POS_UTC,POS_STAT,LAT,LAT_REF,LON,LON_REF,SPD,HDG,DATE,MAG_VAR,MAG_REF*CC<cr><lf> - - POS_UTC - UTC of position. Hours, minutes and seconds. (hhmmss) +<p>If the Operating System supports the PPSAPI, RFC-2783, it will be used. +<br> +<p>The various GPS sentences that this driver recognises look like this: +<br>(others quietly ignored) +<pre><tt>$GPRMC,POS_UTC,POS_STAT,LAT,LAT_REF,LON,LON_REF,SPD,HDG,DATE,MAG_VAR,MAG_REF*CC<cr><lf> +$GPGLL,LAT,LAT_REF,LONG,LONG_REF,POS_UTC,POS_STAT*CC<cr><lf> +$GPGGA,POS_UTC,LAT,LAT_REF,LONG,LONG_REF,FIX_MODE,SAT_USED,HDOP,ALT,ALT_UNIT,GEO,G_UNIT,D_AGE,D_REF*CC<cr><lf> + + POS_UTC - UTC of position. Hours, minutes and seconds [fraction (opt.)]. (hhmmss[.fff]) POS_STAT - Position status. (A = Data valid, V = Data invalid) LAT - Latitude (llll.ll) LAT_REF - Latitude direction. (N = North, S = South) @@ -44,88 +51,111 @@ of the serial interface and operating system. DATE - Date (ddmmyy) MAG_VAR - Magnetic variation (degrees) (x.x) MAG_REF - Magnetic variation (E = East, W = West) + FIX_MODE - Position Fix Mode ( 0 = Invalid, >0 = Valid) + SAT_USED - Number Satellites used in solution + HDOP - Horizontal Dilution of Precision + ALT - Antenna Altitude + ALT_UNIT - Altitude Units (Metres/Feet) + GEO - Geoid/Elipsoid separation + G_UNIT - Geoid units (M/F) + D_AGE - Age of last DGPS Fix + D_REF - Reference ID of DGPS station CC - Checksum (optional) - <cr><lf> - Sentence terminator.</PRE> -The driver will send a <TT>$PMOTG,RMC,0000*1D<cr><lf></TT> message -each time a <TT>$GPRMC</TT> string is needed. This is not needed on most -GPS receivers because they automatically send the <TT>$GPRMC</TT> string -every second and will only work on GPS receivers that understand the <TT>$PMOTG</TT> + <cr><lf> - Sentence terminator.</tt></pre> +Alternate GPS sentences (other than <tt>$GPRMC</tt> - the default) may +be enabled by setting the relevent bits of 'mode' in the server configuration +line +<br> * server 127.127.20.x mode X +<br> bit 0 - enables RMC ( value = +1) +<br> bit 1 - enables GGA ( value = +2) +<br> bit 2 - enables GLL +( value = 4) +<br>multiple sentences may be selected +<br> +<p>The driver will send a <tt>$PMOTG,RMC,0000*1D<cr><lf></tt> message +each time a <tt>$GPRMC</tt> string is needed. This is not needed on most +GPS receivers because they automatically send the <tt>$GPRMC</tt> string +every second and will only work on GPS receivers that understand the <tt>$PMOTG</tt> string. Others will just ignore it. -<H4> -Setting up the Garmin GPS-25XL</H4> +<h4> +Setting up the Garmin GPS-25XL</h4> Switch off all output with by sending it the following string. -<PRE>"$PGRMO,,2<cr><lf>"</PRE> +<pre>"$PGRMO,,2<cr><lf>"</pre> Now switch only $GPRMC on by sending it the following string. -<PRE>"$PGRMO,GPRMC,1<cr><lf>"</PRE> +<pre>"$PGRMO,GPRMC,1<cr><lf>"</pre> On some systems the PPS signal isn't switched on by default. It can be switched on by sending the following string. -<PRE>"$PGRMC,,,,,,,,,,,,2<cr><lf>"</PRE> +<pre>"$PGRMC,,,,,,,,,,,,2<cr><lf>"</pre> -<H4> -Monitor Data</H4> -The $GPRMC string that is used is written to the clockstats file. -<H4> -Fudge Factors</H4> +<h4> +Monitor Data</h4> +The GPS sentence(s) that is used is written to the clockstats file. +<h4> +Fudge Factors</h4> -<DL> -<DT> -<TT>time1 <I>time</I></TT></DT> +<dl> +<dt> +<tt>time1 <i>time</i></tt></dt> -<DD> +<dd> Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.</DD> +with default 0.0.</dd> -<DT> -<TT>time2 <I>time</I></TT></DT> +<dt> +<tt>time2 <i>time</i></tt></dt> -<DD> -Not used by this driver.</DD> +<dd> +Not used by this driver.</dd> -<DT> -<TT>stratum <I>number</I></TT></DT> +<dt> +<tt>stratum <i>number</i></tt></dt> -<DD> -Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD> +<dd> +Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd> -<DT> -<TT>refid <I>string</I></TT></DT> +<dt> +<tt>refid <i>string</i></tt></dt> -<DD> +<dd> Specifies the driver reference identifier, an ASCII string from one to -four characters, with default <TT>GPS</TT>.</DD> - -<DT> -<TT>flag1 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> +four characters, with default <tt>GPS</tt>.</dd> -<DT> -<TT>flag2 0 | 1</TT></DT> +<dt> +<tt>flag1 0 | 1</tt></dt> -<DD> -Not used by this driver.</DD> +<dd> +Not used by this driver.</dd> -<DT> -<TT>flag3 0 | 1</TT></DT> +<dt> +<tt>flag2 0 | 1</tt></dt> -<DD> -Not used by this driver.</DD> +<dd> +Specifies the PPS signal on-time edge: 0 for assert (default), 1 for clear.</dd> -<DT> -<TT>flag4 0 | 1</TT></DT> +<dt> +<tt>flag3 0 | 1</tt></dt> -<DD> -Not used by this driver.</DD> +<dd> +Controls the kernel PPS discipline: 0 for disable (default), 1 for enable.</dd> +<dt> +<tt>flag4 0 | 1</tt></dt> -<P>Additional Information +<dd> +Not used by this driver.</dd> -<P><A HREF="refclock.htm">Reference Clock Drivers</A></DL> +<br> +<p> +<br> +<br> +<p>Additional Information +<p><a href="refclock.htm">Reference Clock Drivers</a></dl> -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> +<hr> +<address> +David L. Mills (mills@udel.edu)</address> -</BODY> -</HTML> +</body> +</html> diff --git a/contrib/ntp/html/driver22.htm b/contrib/ntp/html/driver22.htm index 313d2b8..a293cbc 100644 --- a/contrib/ntp/html/driver22.htm +++ b/contrib/ntp/html/driver22.htm @@ -1,129 +1,159 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>PPS Clock Discipline -</TITLE> -</HEAD> -<BODY> - -<H3> -PPS Clock Discipline</H3> - -<HR> -<H4> -Synopsis</H4> -Address: 127.127.22.<I>u</I> -<BR>Reference ID: <TT>PPS</TT> -<BR>Driver ID: <TT>PPS</TT> -<BR>Serial Port: <TT>/dev/pps<I>u</I></TT>; 9600 baud, 8-bits, no parity -<BR>Features: <TT>tty_clk</TT> -<H4> -Description</H4> -This driver furnishes an interface for pulse-per-second (PPS) signals produced -by a cesium clock, radio clock or related equipment. It can be used to -remove accumulated jitter and retime a secondary server when synchronized -to a primary server over a congested, wide-area network and before redistributing -the time to local clients. - -<P>In order for this driver to work, the local clock must be set to within -+-500 ms by another means, such as a radio clock or NTP itself. The PPS -signal is connected via a serial port and <A HREF="gadget.htm">gadget box</A> -consisting of a one-shot and RS232 level converter. When operated at 38.4 -kbps with a SPARCstation IPC, this arrangement has a worst-case jitter -less than 26 us. - -<P>There are three ways in which this driver can be used. The first way -uses the <TT>ppsclock</TT> line discipline and works only for the baseboard -serial ports of the Sun SPARCstation running SunOS 4.x. The PPS signal -is connected via the gadget box to the carrier detect (DCD) line of a serial -port. The signal is activated for this port by a <TT>fudge flag3 1</TT> -command following the <TT>server</TT> command in the configuration file. -This causes the <TT>ppsclock</TT> streams module to be configured for that -port and to capture a timestamp at the on-time transition of the PPS signal. -This driver then reads the timestamp directly by a designated <TT>ioctl()</TT> -system call. This provides the most accurate time and least jitter of any -other scheme. There is no need to configure a dedicated device for this -purpose, which ordinarily is the device used for the associated radio clock. - -<P>The second way uses the <TT>tty_clk</TT> line discipline and works for -any architecture supporting a serial port. If after a few seconds this -driver finds no <TT>ppsclock</TT> module configured, it attempts to open -a serial port device <TT>/dev/pps%d</TT>, where <TT>%d</TT> is the unit -number, and assign the <TT>tty_clk</TT> line discipline to it. If the line -discipline fails, no harm is done except the accuracy is reduced somewhat. -The pulse generator in the gadget box must be adjusted to produce a start -bit of length 26 usec at 38400 bps. Used with the <TT>tty_clk</TT> line -discipline, this produces an ASCII DEL character ('\377') followed by a -timestamp at the on-time transition of the PPS signal. - -<P>The third way involves an auxiliary radio clock driver which calls the -PPS driver with a timestamp captured by that driver. This use is documented -in the source code for the driver(s) involved. -<H4> -Fudge Factors</H4> - -<DL> -<DT> -<TT>time1 <I>time</I></TT></DT> - -<DD> -Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0. This parameter can be used to compensate for the UART -and OS delays. Allow about 247 us for UART delays at 38400 bps and about -1 ms for SunOS streams nonsense.</DD> - -<DT> -<TT>time2 <I>time</I></TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>stratum <I>number</I></TT></DT> - -<DD> -Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD> - -<DT> -<TT>refid <I>string</I></TT></DT> - -<DD> -Specifies the driver reference identifier, an ASCII string from one to -four characters, with default <TT>PPS</TT>.</DD> - -<DT> -<TT>flag1 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag2 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag3 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>flag4 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> - - -<P>Additional Information - -<P><A HREF="refclock.htm">Reference Clock Drivers</A></DL> - -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>PPS Clock Discipline</title> +</head> +<body> +<h3>PPS Clock Discipline</h3> + +<hr> +<h4>Synopsis</h4> + +Address: 127.127.22.<i>u</i> <br> +Reference ID: <tt>PPS</tt> <br> +Driver ID: <tt>PPS</tt> <br> +Serial or Parallel Port: <tt>/dev/pps<i>u</i></tt> <br> +Requires: PPSAPI interface + +<p>Note: This driver supersedes an older one of the same name. The +older driver operated with several somewhat archaic signal +interface devices, required intricate configuration and was poorly +documented. This driver operates only with the PPSAPI interface +proposed as an IETF standard. Note also that the <tt>pps</tt> +configuration command has been obsoleted by this driver.</p> + +<h4>Description</h4> + +<p>This driver furnishes an interface for the pulse-per-second +(PPS) produced by a cesium clock, radio clock or related equipment. +It can be used to augment the serial timecode generated by a GPS +receiver, for example. It can be used to remove accumulated jitter +and re-time a secondary server when synchronized to a primary +server over a congested, wide-area network and before +redistributing the time to local clients. The driver includes +extensive signal sanity checks and grooming algorithms. A range +gate and frequency discriminator reject noise and signals with +incorrect frequency. A multiple-stage median filter rejects jitter +due to hardware interrupt and operating system latencies. A +trimmed-mean algorithm determines the best time samples. With +typical workstations and processing loads, the incidental jitter +can be reduced to less than a microsecond.</p> + +<p>While this driver can discipline the time and frequency relative +to the PPS source, it cannot number the seconds. For this purpose a +auxiliary source is required, ordinarily a radio clock operated as +a primary reference (stratum 1) source; however, another NTP time +server can be used as well. For this purpose, the auxiliary source +is marked as the prefer peer, as described in the <a href= +"prefer.htm">Mitigation Rules and the <tt>prefer</tt> Keyword</a> +page.</p> + +<p>The driver requires the PPSAPI interface<sup>1</sup>, which is a +proposed IETF standard. The interface consists of the <tt> +timepps.h</tt> header file and associated kernel support. Support +for this interface is included in current versions of FreeBSD and +Linux and proprietary versions for Digital/Compaq Tru64 (Alpha), +Sun Solaris and Sun SunOS. See the <a href="pps.htm"> +Pulse-per-second (PPS) Signal Interfacing</a> page for further +information.</p> + +<p>The PPS source can be connected via a serial or parallel port, +depending on the hardware and operating system. The port can be +dedicated to the PPS source or shared with another device. A radio +clock is usually connected via a serial port and the PPS source +connected via a level converter to the data carrier detect (DCD) +pin (DB-9 pin 1, DB-25 pin 8) of the same connector. In some +systems where a parallel port and driver are available, the PPS +signal can be connected directly to the ACK pin (pin 10) of the +connector. Whether the PPS signal is connected via a dedicated port +or shared with another device, the driver opens the device <tt> +/dev/pps%d</tt>, where <tt>%d</tt> is the unit number. As with +other drivers, links can be used to redirect the logical name to +the actual physical device.</p> + +<p>The driver normally operates like any other driver and uses the +same mitigation algorithms and PLL/FLL clock discipline +incorporated in the daemon. If kernel PLL/FLL support is available, +the kernel PLL/FLL clock discipline is used instead. The default +behavior is not to use the kernel PPS clock discipline, even if +present. This driver incorporates a good deal of signal processing +to reduce jitter using the median filter and trimmed average +algorithms in the driver interface. As the result, performance with +minpoll and maxpoll configured at the minimum 4 (16s) is generally +better than the kernel PPS clock discipline. However, fudge flag 3 +can be used to enable this discipline if necessary.</p> + +<p>Note that the PPS source is considered reachable only if the +auxiliary source is the prefer peer, is reachable and is selected +to discipline the system clock. The stratum assigned to the PPS +source is automatically determined. If the auxiliary source is +unreachable or inoperative, the stratum is set to 16; otherwise it +is set to match the stratum of the auxiliary source. Since the +stratum is determined dynamically, it is not possible to assign +another stratum using the <tt>fudge</tt> command as in other +drivers.</p> + +<h4>Fudge Factors</h4> + +<dl> +<dt><tt>time1 <i>time</i></tt></dt> + +<dd>Specifies the time offset calibration factor, in seconds and +fraction, with default 0.0.dd></dd> + +<dt><tt>time2 <i>time</i></tt></dt> + +<dd>Not used by this driver.</dd> + +<dt><tt>stratum <i>number</i></tt></dt> + +<dd>Specifies the driver stratum, in decimal from 0 to 15, with +default 0.</dd> + +<dt><tt>refid <i>string</i></tt></dt> + +<dd>Specifies the driver reference identifier, an ASCII string from +one to four characters, with default <tt>PPS</tt>.</dd> + +<dt><tt>flag1 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> + +<dt><tt>flag2 0 | 1</tt></dt> + +<dd>Specifies the PPS signal on-time edge: 0 for assert (default), +1 for clear.</dd> + +<dt><tt>flag3 0 | 1</tt></dt> + +<dd>Controls the kernel PPS discipline: 0 for disable (default), 1 +for enable.</dd> + +<dt><tt>flag4 0 | 1</tt></dt> + +<dd>Not used by this driver.</dd> +</dl> + +<p>Additional Information</p> + +<p><a href="refclock.htm">Reference Clock Drivers</a></p> + +<p>Reference</p> + +<ol> +<li>Mogul, J., D. Mills, J. Brittenson, J. Stone and U. Windl. +Pulse-per-second API for Unix-like operating systems, version 1. +Request for Comments RFC-2783, Internet Engineering Task Force, +March 2000, 31 pp.</li> +</ol> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -</BODY> -</HTML> diff --git a/contrib/ntp/html/driver23.htm b/contrib/ntp/html/driver23.htm index 6633999..8d6fc9d 100644 --- a/contrib/ntp/html/driver23.htm +++ b/contrib/ntp/html/driver23.htm @@ -1,87 +1,178 @@ <HTML> <HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>PTB Modem Time Service -</TITLE> + <META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 per Windows"> + <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> + <TITLE>PTB Modem Time Service </TITLE> </HEAD> <BODY> -<H3> -PTB Modem Time Service</H3> - -<HR> -<H4> -Synopsis</H4> -Address: 127.127.23.<I>u</I> -<BR>Reference ID: <TT>PTB</TT> -<BR>Driver ID: <TT>ACTS_PTP</TT> -<BR>Serial Port: <TT>/dev/ptb<I>u</I></TT>; 1200 baud, 8-bits, no parity -<BR>Requires: <TT>/usr/include/sys/termios.h</TT> header file with modem -control -<H4> -Description</H4> -No further information available. -<H4> -Fudge Factors</H4> +<H3>PTB Modem Time Service and other European Laboratories Time +Services</H3> + +<HR ALIGN=LEFT> + +<H4>Synopsis</H4> + +<P>Address: 127.127.23.<I>u</I> <BR> +Reference ID: <TT>PTB</TT> <BR> +Driver ID: <TT>ACTS_PTB</TT><BR> +Serial Port: <TT>/dev/ptb<I>u</I></TT>; 1200 baud, 8-bits, no +parity <BR> +Requires: <TT>/usr/include/sys/termios.h</TT> header file with +modem control</P> + +<H4>Description</H4> + +<P>This driver supports the PTB Automated Computer Time Service +(ACTS) and it is a modified version of the NIST ACTS driver so +see it for more informations..</P> + +<P>It periodically dials a prespecified telephone number, receives +the PTB timecode data and calculates the local clock correction. +It designed primarily for use when neither a radio clock nor connectivity +to Internet time servers is available. For the best accuracy, +the individual telephone line/modem delay needs to be calibrated +using outside sources.</P> + +<P>The only change between this driver and the NIST one is the +data format. Infact PTB data format is the following:</P> + +<P><FONT SIZE="-1" FACE="Courier New">Data format<BR> +0000000000111111111122222222223333333333444444444455555555556666666666777777777 + 7<BR> +0123456789012345678901234567890123456789012345678901234567890123456789012345678 + 9<BR> +1995-01-23 20:58:51 MEZ 10402303260219950123195849740+40000500 + *<BR> +A B C D EF G H IJ K L M N O P Q R S T U V W +XY Z<CR><LF><BR> +A year<BR> +B month<BR> +C day<BR> +D hour<BR> +E : normally<BR> +A for DST to ST switch first hour<BR> +B for DST to ST switch second hour if not marked in H<BR> +F minute<BR> +G second<BR> +H timezone<BR> +I day of week<BR> +J week of year<BR> +K day of year<BR> +L month for next ST/DST changes<BR> +M day<BR> +N hour<BR> +O UTC year<BR> +P UTC month<BR> +Q UTC day<BR> +R UTC hour<BR> +S UTC minute<BR> +T modified julian day (MJD)<BR> +U DUT1<BR> +V direction and month if leap second<BR> +W signal delay (assumed/measured)<BR> +X sequence number for additional text line in Y<BR> +Y additional text<BR> +Z on time marker (* - assumed delay / # measured delay)<BR> + <CR>!<LF> ! is second change !<BR> +</FONT><BR> +This format is an ITU-R Recommendation (ITU-R TF583.4) and is now available from the primary +timing centres of the following countries: +Austria, Belgium, Germany, Italy, The Netherlands, Poland, Portugal, Romania, Spain, Sweden, +Switzerland, Turkey, United Kingdom. +Some examples are: +</P> + +<UL> + <LI>In Germany by Physikalisch-Technische Bundesanstalt (PTB)'s + timecode service. Phone number: +49 5 31 51 20 38. +</UL> + +<BLOCKQUOTE> + <P>For more detail, see <A HREF="http://www.ptb.de/english/org/4/43/433/disse.htm">http://www.ptb.de/english/org/4/43/433/disse.htm</A></P> +</BLOCKQUOTE> + +<UL> + <LI>In the UK by National Physical Laboratory (NPL)'s TRUETIME + service. Phone number: 0891 516 333 +</UL> + +<BLOCKQUOTE> + <P>For more detail, see <A HREF="http://www.npl.co.uk/npl/ctm/truetime.html">http://www.npl.co.uk/npl/ctm/truetime.html</A></P> +</BLOCKQUOTE> + +<UL> + <LI>In Italy by Istituto Elettrotecnico Nazionale "Galileo + Ferrais" (IEN)'s CTD service. Phone number: 166 11 46 + 15 +</UL> + +<BLOCKQUOTE> + <P>For more detail, see <A HREF="http://www.ien.it/tf/time/Pagina42.html">http://www.ien.it/tf/time/Pagina42.html</A></P> +</BLOCKQUOTE> + +<UL> + <LI>In Switzerland by Swiss Federal Office of Metrology 's timecode + service. Phone number: 031 323 32 25 +</UL> + +<BLOCKQUOTE> + <P>For more detail, see <A HREF="http://www.ofmet.admin.ch/de/labors/4/Zeitvert.html%20">http://www.ofmet.admin.ch/de/labors/4/Zeitvert.html + </A></P> +</BLOCKQUOTE> + +<UL> + <LI>In Sweden by SP Swedish National Testing and Research Institute + 's timecode service. Phone number: +46 33 415783 +</UL> + +<BLOCKQUOTE> + <P>For more detail, see <A HREF="http://www.sp.se/pne/ElectricalMetrology/ElMeteng/frameset.htm">http://www.sp.se/pne/ElectricalMetrology/ElMeteng/frameset.htm</A><BR> +<BR> + </P> +</BLOCKQUOTE> + +<H4>Fudge Factors</H4> <DL> -<DT> -<TT>time1 <I>time</I></TT></DT> - -<DD> -Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.</DD> - -<DT> -<TT>time2 <I>time</I></TT></DT> - -<DD> -Not used by this driver.</DD> - -<DT> -<TT>stratum <I>number</I></TT></DT> - -<DD> -Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD> - -<DT> -<TT>refid <I>string</I></TT></DT> - -<DD> -Specifies the driver reference identifier, an ASCII string from one to -four characters, with default PTB.</DD> - -<DT> -<TT>flag1 0 | 1</TT></DT> - -<DD> -Not used by this driver.</DD> + <DT><TT>time1 <I>time</I></TT> + <DD>Specifies the time offset calibration factor, in seconds + and fraction, with default 0.0. + <DT><TT>time2 <I>time</I></TT> + <DD>Not used by this driver. + <DT><TT>stratum <I>number</I></TT> + <DD>Specifies the driver stratum, in decimal from 0 to 15, with + default 0. + <DT><TT>refid <I>string</I></TT> + <DD>Specifies the driver reference identifier, an ASCII string + from one to four characters, with default PTB. + <DT><TT>flag1 0 | 1</TT> + <DD>Not used by this driver. + <DT><TT>flag2 0 | 1</TT> + <DD>Not used by this driver. + <DT><TT>flag3 0 | 1</TT> + <DD>Not used by this driver. + <DT><TT>flag4 0 | 1</TT> + <DD>Not used by this driver. +</DL> -<DT> -<TT>flag2 0 | 1</TT></DT> +<P>Additional Information</P> -<DD> -Not used by this driver.</DD> +<P>A keyword in the ntp.conf file permits a direct connection +to a serial port of source of time like IEN CTD signal. It is +sufficient to use the string DIRECT in place of the phone number.</P> -<DT> -<TT>flag3 0 | 1</TT></DT> +<P>Example:</P> -<DD> -Not used by this driver.</DD> +<P><FONT FACE="Courier New">server 127.127.23.1</FONT></P> -<DT> -<TT>flag4 0 | 1</TT></DT> +<P><FONT FACE="Courier New">phone DIRECT</FONT></P> -<DD> -Not used by this drivert.</DD> -</DL> -Additional Information +<P><A HREF="refclock.htm">Reference Clock Drivers</A> <HR ALIGN=LEFT></P> -<P><A HREF="refclock.htm">Reference Clock Drivers</A> -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> +<ADDRESS>by Marco Mascarello (masca@tf.ien.it) for David L. Mills +(mills@udel.edu)</ADDRESS> </BODY> </HTML> + diff --git a/contrib/ntp/html/driver30.htm b/contrib/ntp/html/driver30.htm index fab604b..d2ec9dd 100644 --- a/contrib/ntp/html/driver30.htm +++ b/contrib/ntp/html/driver30.htm @@ -17,31 +17,31 @@ Motorola Oncore GPS receiver</H3> <H4> Synopsis</H4> -Address: 127.127.30.0<BR> +Address: 127.127.30.<i>u</i><BR> Reference ID: <TT>GPS</TT><BR> Driver ID: ONCORE<BR> -Serial Port: <TT>/dev/oncore.serial.0</TT>; 9600 baud, 8-bits, +Serial Port: <TT>/dev/oncore.serial.</TT><i>u</i>; 9600 baud, 8-bits, no parity.<BR> -PPS Port: <TT>/dev/oncore.pps.0</TT>; <TT>PPS_CAPTUREASSERT</TT> -required, <TT>PPS_OFFSETASSERT</TT> supported. +PPS Port: <TT>/dev/oncore.pps.</TT><i>u</i>; <TT>PPS_CAPTUREASSERT</TT> +required, <TT>PPS_OFFSETASSERT</TT> supported.<BR> +Configuration File: <TT>/etc/ntp.oncore<TT><i>u</i> or, +<TT>/etc/ntp.oncore.<TT><i>u</i>, or <TT>/etc/ntp.oncore<TT>. <H4> Description</H4> -This driver supports various models of the <A -HREF="http://www.mot.com/AECS/PNSB/products">Motorola Oncore GPS -receivers</A> as long as they support the <I>Motorola Binary -Protocol</I>. - -<P>The three most interesting versions of the Oncore are the "VP", -the "UT+", -and the "Remote" which is a prepackaged "UT+". -The "VP" is no longer available. - -<P>The evaluation kit +This driver supports most models of the +<A HREF="http://www.mot.com/AECS/PNSB/products">Motorola Oncore GPS receivers</A> +(Basic, PVT6, VP, UT, UT+, GT, GT+, SL, M12), +as long as they support the <I>Motorola Binary Protocol</I>. + +<P>The three most interesting versions of the Oncore are the VP, +the UT+, and the "Remote" which is a prepackaged UT+. +The VP is no longer available. +The Motorola evaluation kit can also be recommended, it interfaces to a PC straightaway, using the serial (DCD) or parallel port for PPS input and packs the receiver in a nice and sturdy box. Two less expensive interface kits are available from -<A HREF="http://www.tapr.org">TAPR </A>. +<A HREF="http://www.tapr.org">TAPR</A>. <BR> <CENTER><TABLE NOSAVE > @@ -74,17 +74,27 @@ pulse-per-second output from the receiver. The serial data stream alone does not provide precision time stamps (0-50msec variance, according to the manual), whereas the PPS output is precise down to 50 nsec (1 sigma) for the VP/UT models. +If you do not have the PPS signal available, then you should probably be using +the NMEA driver rather than the Oncore driver. <P>The driver will use the "position hold" mode with user provided coordinates, the receivers built-in site-survey, -or a similar algorithm implemented in this driver. +or a similar algorithm implemented in this driver to determine the antenna position. <H4> Monitor Data</H4> -The driver is quite chatty on stdout if ntpd is run with -debugging. -A manual will be required though. -Additional information is written to the clockstats file, if configured. +The driver always puts a lot of useful information on the clockstats file, +and when run with debugging can be quite chatty on stdout. +When first starting to use the driver you should definitely review the information +written to the clockstats file to verify that the driver is running correctly. +<P> +In addition, on platforms supporting Shared Memory, all of the messages +received from the Oncore receiver are made available in shared memory for +use by other programs. +See the <A HREF=Oncore-SHMEM.htm> Oncore-SHMEM </A> manual page for +information on how to use this option. +For either debugging or using the SHMEM option, an Oncore Reference Manual +for the specific receiver in use will be required. <H4> Fudge Factors</H4> @@ -141,8 +151,9 @@ Not used by this driver.</DD> Not used by this driver.</DD> </DL> <B>Additional Information</B> -<P>The driver has been tested on FreeBSD, Linux and SunOS. - +<P>The driver was initially developed on FreeBSD, and has since been tested +on Linux, SunOS and Solaris. +<P><B>Configuration</B> <P>There is a driver specific configuration file <TT>/etc/ntp.oncore</TT> that contains information on the startup mode, the location of the GPS receiver, an offset of the PPS signal from zero, and the cable delay. @@ -165,11 +176,11 @@ to UTC(GPS) with better than 50 nsec (1 sigma) accuracy. The limiting factor will be the timebase of the computer and the precision with which you can timestamp the rising flank of the PPS signal. -Using FreeBSD, a FPGA based Timecounter/PPS interface +Using FreeBSD, a FPGA based Timecounter/PPS interface, and an ovenized quartz oscillator, that performance has been reproduced. For more details on this aspect: <A HREF="http://phk.freebsd.dk/rover.html">Sub-Microsecond -timekeeping under FreeBSD</A> +timekeeping under FreeBSD</A>. <HR> <ADDRESS> Poul-Henning Kamp (phk@FreeBSD.org), diff --git a/contrib/ntp/html/driver34.htm b/contrib/ntp/html/driver34.htm index e9dcdbc..c114c72 100644 --- a/contrib/ntp/html/driver34.htm +++ b/contrib/ntp/html/driver34.htm @@ -1,7 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso8859-1"> -<title>Dumb Clock</title> +<title>Ultralink Clock</title> </head> <body> @@ -10,18 +10,19 @@ <hr> <h4>Synopsis</h4> Address: 127.127.34.<i>u</i><br> -Reference ID: <TT>ULINK</TT><br> +Reference ID: <TT>WWVB</TT><br> Driver ID: <tt>ULINK</tt><br> -Serial Port: <tt>/dev/ulink<i>u</i></tt>; 9600 bps, 8-bits, +Serial Port: <tt>/dev/wwvb<i>u</i></tt>; 9600 bps, 8-bits, no parity<br> <br>Features: <tt>(none)</tt> <h4>Description</h4> -This driver supports the Ultralink Model 320 RS-232 powered WWVB receiver. PDF specs available on <a href="http://www.linuxfoundary.com">www.linuxfoundary.com</a>. While the unit may support them, this driver does nothing with leap seconds, quality codes, etc. (though it probably should). +This driver supports the Ultralink Model 320 RS-232 powered WWVB receiver. PDF specs available on <a href="http://www.ulio.com">www.ulio.com</a>. +This driver also supports the Model 330,331,332 decoders in both polled or continous time code mode. Leap second and quality are supported. <P>Most of this code is originally from refclock_wwvb.c with thanks. Any mistakes are mine. Any improvements are welcome. - +<hr> <pre> - The timecode format is: + The Model 320 timecode format is: <cr><lf>SQRYYYYDDD+HH:MM:SS.mmLT<cr> @@ -40,14 +41,55 @@ This driver supports the Ultralink Model 320 RS-232 powered WWVB receiver. PDF L = Leap second pending at end of month -- 'I' = inset, 'D'=delete T = DST <-> STD transition indicators - Note that this driver does not do anything with the L or T flags. + Note that this driver does not do anything with the T flag. - The M320 also has a 'U' command which returns UT1 correction information. It - is not used in this driver. + The M320 also has a 'U' command which returns UT1 correction information. + It is not used in this driver. +</pre> +<hr> +<pre> + The Model 33x timecode format is: + + S9+D 00 YYYY+DDDUTCS HH:MM:SSl+5 + + Where: + + S = sync indicator S insync N not in sync + the sync flag is WWVB decoder sync + nothing to do with time being correct + 9+ = signal level 0 thru 9+ If over 9 indicated as 9+ + D = data bit ( fun to watch but useless ;-) + space + 00 = hours since last GOOD WWVB frame sync + space + YYYY = current year + + = leap year indicator + DDD = day of year + UTC = timezone (always UTC) + S = daylight savings indicator + space + HH = hours + : = This is the REAL in sync indicator (: = insync) + MM = minutes + : = : = in sync ? = NOT in sync + SS = seconds + L = leap second flag + +5 = UT1 correction (sign + digit )) + + This driver ignores UT1 correction,DST indicator,Leap year + and signal level. + +</pre> +<hr> +<pre> + +Fudge factors + flag1 polling enable (1=poll 0=no poll) + </pre> <hr> - <address><a href="mailto:dstrout@linuxfoundary.com">root</a></address> + <address><a href="mailto:dstrout@linuxfoundary.com">mail</a></address> <!-- hhmts start --> Last modified: Tue Sep 14 05:53:08 EDT 1999 <!-- hhmts end --> diff --git a/contrib/ntp/html/driver35.htm b/contrib/ntp/html/driver35.htm index d3b77e0..0e6aebf 100644 --- a/contrib/ntp/html/driver35.htm +++ b/contrib/ntp/html/driver35.htm @@ -1,4 +1,4 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Conrad parallel port radio clock</title> @@ -13,32 +13,30 @@ <p>Address: 127.127.35.<i>u</i><br> Reference ID: <tt>PCF</tt><br> Driver ID: <tt>PCF</tt><br> -Parallel Port: <tt>/dev/pcfclock<i>u</i></tt> +Parallel Port: <tt>/dev/pcfclocks/<i>u</i></tt> or <tt>/dev/pcfclock<i>u</i></tt> </p> <h4>Description</h4> -<p>This driver supports the parallel port radio clocks sold by <a -href="http://www.conrad-electronic.com/">Conrad Electronic</a> under -order numbers 967602 and 642002. The battery-powered radio clock is -put between a parallel port and your printer. It receives the legal -German time, which is either CET or CEST, from the DCF77 transmitter -and uses it to set internal quartz clock. The DCF77 transmitter is -located near to Frankfurt/Main and covers a radius of more than 1500 -kilometers. - -<p>The driver requires that the pcfclock device driver be installed. -A device driver for Linux 2.2 is available at -<a href="http://home.pages.de/~voegele/pcf.html">the pcfclock driver -page</a>. +<p>This driver supports the parallel port radio clock sold by +<a href="http://www.conrad-electronic.com/">Conrad Electronic</a> under +order numbers 967602 and 642002. This clock is put between a parallel +port and your printer. It receives the legal German time, which is +either CET or CEST, from the DCF77 transmitter and uses it to set its +internal quartz clock. The DCF77 transmitter is located near to +Frankfurt/Main and covers a radius of more than 1500 kilometers. + +<p>The pcfclock device driver is required in order to use this +reference clock driver. Currently device drivers for +<a href="http://home.pages.de/~voegele/pcf.html">Linux</a> and +<a href="http://schumann.cx/pcfclock/">FreeBSD</a> are available.</p> + +<p>This driver uses C library functions to convert the received +timecode to UTC and thus requires that the local timezone be CET or +CEST. If your server is not located in Central Europe you have to set +the environment variable TZ to CET before starting <tt>ntpd</tt>. </p> -<p>The driver uses C library functions to convert the received -timecode to UTC and therefore requires that the local timezone be -CET/CEST. If your server is not located in Central Europe, you have -to set the environment variable TZ to CET before <tt>ntpd</tt> is -started.</p> - <h4>Monitor Data</h4> <p>Each timecode is written to the <tt>clockstats</tt> file in the format @@ -49,7 +47,7 @@ started.</p> <dl> <dt><tt>time1 <i>time</i></tt></dt> <dd>Specifies the time offset calibration factor, in seconds and fraction, -with default 0.0.</dd> +with default 0.1725.</dd> <dt><tt>time2 <i>time</i></tt></dt> <dd>Not used by this driver.</dd> @@ -66,7 +64,8 @@ four characters, with default <tt>PCF</tt>.</dd> <dd>Not used by this driver.</dd> <dt><tt>flag2 0 | 1</tt></dt> -<dd>Not used by this driver.</dd> +<dd>If set to 1, the radio clock's synchronisation status bit is +ignored, ie the timecode is used without a check.</dd> <dt><tt>flag3 0 | 1</tt></dt> <dd>Not used by this driver.</dd> @@ -76,7 +75,6 @@ four characters, with default <tt>PCF</tt>.</dd> </dl> <hr> -<address>Andreas Voegele (andreas.voegele@gmx.de)</address> - +<address>Andreas Voegele <voegelas@users.sourceforge.net></address> </body> </html> diff --git a/contrib/ntp/html/driver36.htm b/contrib/ntp/html/driver36.htm index 6f70dcc..2c74646 100644 --- a/contrib/ntp/html/driver36.htm +++ b/contrib/ntp/html/driver36.htm @@ -1,581 +1,634 @@ -<html><head><title> -Radio WWV/H Audio Demodulator/Decoder -</title></head><body><h3> -Radio WWV/H Audio Demodulator/Decoder -</h3><hr> - +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Radio WWV/H Audio Demodulator/Decoder</title> +</head> +<body> +<h3>Radio WWV/H Audio Demodulator/Decoder</h3> + +<hr> <h4>Synopsis</h4> -Address: 127.127.36.<I>u</I> -<br>Reference ID: <tt>WWV</tt> or <tt>WWVH</tt> -<br>Driver ID: <tt>WWV_AUDIO</tt> -<br>Autotune Port: <tt>/dev/icom</tt>; 9600 baud, 8-bits, no parity -<br>Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt> +Address: 127.127.36.<i>u</i> <br> +Reference ID: <tt>WWV</tt> or <tt>WWVH</tt> <br> +Driver ID: <tt>WWV_AUDIO</tt> <br> +Autotune Port: <tt>/dev/icom</tt>; 1200/9600 baud, 8-bits, no +parity <br> +Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt> <h4>Description</h4> This driver synchronizes the computer time using data encoded in -shortwave radio transmissions from NIST time/frequency stations WWV in -Ft. Collins, CO, and WWVH in Kauai, HI. Transmissions are made +shortwave radio transmissions from NIST time/frequency stations WWV +in Ft. Collins, CO, and WWVH in Kauai, HI. Transmissions are made continuously on 2.5, 5, 10, 15 and 20 MHz. An ordinary shortwave -receiver can be tuned manually to one of these frequencies or, in the -case of ICOM receivers, the receiver can be tuned automatically by the -driver as propagation conditions change throughout the day and night. -The performance of this driver when tracking one of the stations is -ordinarily better than 1 ms in time with frequency drift less than 0.5 -PPM when not tracking either station. +receiver can be tuned manually to one of these frequencies or, in +the case of ICOM receivers, the receiver can be tuned automatically +by the driver as propagation conditions change throughout the day +and night. The performance of this driver when tracking one of the +stations is ordinarily better than 1 ms in time with frequency +drift less than 0.5 PPM when not tracking either station. <p>The demodulation and decoding algorithms used by this driver are -based on a machine language program developed for the TAPR DSP93 DSP -unit, which uses the TI 320C25 DSP chip. The analysis, design and -performance of the program running on this unit is described in: Mills, -D.L. A precision radio clock for WWV transmissions. Electrical -Engineering Report 97-8-1, University of Delaware, August 1997, 25 pp. -Available from <a href=http://www.eecis.udel.edu/~mills/reports.htm> -www.eecis.udel.edu/~mills/reports.htm</a>. For use in this driver, the -original program was rebuilt in the C language and adapted to the NTP -driver interface. The algorithms have been modified somewhat to improve -performance under weak signal conditions and to provide an automatic -station identification feature. - -<p>This driver incorporates several features in common with other audio -drivers such as described in the <a href=driver7.htm>Radio CHU Audio -Demodulator/Decoder</a> and the <a href=driver6.htm>IRIG Audio -Decoder</a> pages. They include automatic gain control (AGC), selectable -audio codec port and signal monitoring capabilities. For a discussion of -these common features, as well as a guide to hookup, debugging and -monitoring, see the <a href=audio.htm>Reference Clock Audio Drivers</a> -page. - -<p>The WWV signal format is described in NIST Special Publication 432 -(Revised 1990). It consists of three elements, a 5-ms, 1000-Hz pulse, -which occurs at the beginning of each second, a 800-ms, 1000-Hz pulse, -which occurs at the beginning of each minute, and a pulse-width -modulated 100-Hz subcarrier for the data bits, one bit per second. The -WWVH format is identical, except that the 1000-Hz pulses are sent at -1200 Hz. Each minute encodes nine BCD digits for the time of century -plus seven bits for the daylight savings time (DST) indicator, leap -warning indicator and DUT1 correction. +based on a machine language program developed for the TAPR DSP93 +DSP unit, which uses the TI 320C25 DSP chip. The analysis, design +and performance of the program running on this unit is described +in: Mills, D.L. A precision radio clock for WWV transmissions. +Electrical Engineering Report 97-8-1, University of Delaware, +August 1997, 25 pp. Available from <a href= +"http://www.eecis.udel.edu/~mills/reports.htm"> +www.eecis.udel.edu/~mills/reports.htm</a>. For use in this driver, +the original program was rebuilt in the C language and adapted to +the NTP driver interface. The algorithms have been modified +somewhat to improve performance under weak signal conditions and to +provide an automatic station identification feature.</p> + +<p>This driver incorporates several features in common with other +audio drivers such as described in the <a href="driver7.htm">Radio +CHU Audio Demodulator/Decoder</a> and the <a href="driver6.htm"> +IRIG Audio Decoder</a> pages. They include automatic gain control +(AGC), selectable audio codec port and signal monitoring +capabilities. For a discussion of these common features, as well as +a guide to hookup, debugging and monitoring, see the <a href= +"audio.htm">Reference Clock Audio Drivers</a> page.</p> + +<p>The WWV signal format is described in NIST Special Publication +432 (Revised 1990). It consists of three elements, a 5-ms, 1000-Hz +pulse, which occurs at the beginning of each second, a 800-ms, +1000-Hz pulse, which occurs at the beginning of each minute, and a +pulse-width modulated 100-Hz subcarrier for the data bits, one bit +per second. The WWVH format is identical, except that the 1000-Hz +pulses are sent at 1200 Hz. Each minute encodes nine BCD digits for +the time of century plus seven bits for the daylight savings time +(DST) indicator, leap warning indicator and DUT1 correction.</p> <h4>Program Architecture</h4> -<p>As in the original program, the clock discipline is modelled as a -Markov process, with probabilistic state transitions corresponding to a -conventional clock and the probabilities of received decimal digits. The -result is a performance level which results in very high accuracy and -reliability, even under conditions when the minute beep of the signal, -normally its most prominent feature, can barely be detected by ear with -a shortwave receiver. - -<p>The analog audio signal from the shortwave radio is sampled at 8000 -Hz and converted to digital representation. The 1000/1200-Hz pulses and -100-Hz subcarrier are first separated using two IIR filters, a 600-Hz -bandpass filter centered on 1100 Hz and a 150-Hz lowpass filter. The -minute sync pulse is extracted using a 800-ms synchronous matched filter -and pulse grooming logic which discriminates between WWV and WWVH -signals and noise. The second sync pulse is extracted using a 5-ms FIR -matched filter and 8000-stage comb filter. - -<p>The phase of the 100-Hz subcarrier relative to the second sync pulse -is fixed at the transmitter; however, the audio highpass filter in most -radios affects the phase response at 100 Hz in unpredictable ways. The -driver adjusts for each radio using two 170-ms synchronous matched -filters. The I (in-phase) filter is used to demodulate the subcarrier -envelope, while the Q (quadrature-phase) filter is used in a tracking -loop to discipline the codec sample clock and thus the demodulator -phase. +<p>As in the original program, the clock discipline is modelled as +a Markov process, with probabilistic state transitions +corresponding to a conventional clock and the probabilities of +received decimal digits. The result is a performance level which +results in very high accuracy and reliability, even under +conditions when the minute beep of the signal, normally its most +prominent feature, can barely be detected by ear with a shortwave +receiver.</p> + +<p>The analog audio signal from the shortwave radio is sampled at +8000 Hz and converted to digital representation. The 1000/1200-Hz +pulses and 100-Hz subcarrier are first separated using two IIR +filters, a 600-Hz bandpass filter centered on 1100 Hz and a 150-Hz +lowpass filter. The minute sync pulse is extracted using a 800-ms +synchronous matched filter and pulse grooming logic which +discriminates between WWV and WWVH signals and noise. The second +sync pulse is extracted using a 5-ms FIR matched filter and +8000-stage comb filter.</p> + +<p>The phase of the 100-Hz subcarrier relative to the second sync +pulse is fixed at the transmitter; however, the audio highpass +filter in most radios affects the phase response at 100 Hz in +unpredictable ways. The driver adjusts for each radio using two +170-ms synchronous matched filters. The I (in-phase) filter is used +to demodulate the subcarrier envelope, while the Q +(quadrature-phase) filter is used in a tracking loop to discipline +the codec sample clock and thus the demodulator phase.</p> <p>The data bit probabilities are determined from the subcarrier envelope using a threshold-corrected slicer. The averaged envelope -amplitude 30 ms from the beginning of the second establishes the minimum -(noise floor) value, while the amplitude 200 ms from the beginning -establishes the maximum (signal peak) value. The slice level is midway -between these two values. The negative-going envelope transition at the -slice level establishes the length of the data pulse, which in turn -establish probabilities for binary zero (P0) or binary one (P1). The -values are established by linear interpolation between the pulse lengths -for P0 (300 ms) and P1 (500 ms) so that the sum is equal to one. If the -driver has not synchronized to the minute pulse, or if the data bit -amplitude, signal/noise ratio (SNR) or length are below thresholds, the -bit is considered invalid and all three probabilities are set to zero. - -<p>The difference between the P1 and P0 probabilities, or likelihood, -for each data bit is exponentially averaged in a set of 60 accumulators, -one for each second, to determine the semi-static miscellaneous bits, -such as DST indicator, leap second warning and DUT1 correction. In this -design, an average value larger than a positive threshold is interpreted -as a hit on one and a value smaller than a negative threshold as a hit -on zero. Values between the two thresholds, which can occur due to -signal fades or loss of signal, are interpreted as a miss, and result in -no change of indication. - -<p>The BCD digit in each digit position of the timecode is represented -as four data bits, all of which must be valid for the digit itself to be -considered valid. If so, the bits are correlated with the bits -corresponding to each of the valid decimal digits in this position. If -the digit is invalid, the correlated value for all digits in this -position is assumed zero. In either case, the values for all digits are -exponentially averaged in a likelihood vector associated with this -position. The digit associated with the maximum over all of the averaged -values then becomes the maximum likelihood selection for this position -and the ratio of the maximum over the next lower value becomes the -likelihood ratio. - -<p>The decoding matrix contains nine row vectors, one for each digit -position. Each row vector includes the maximum likelihood digit, -likelihood vector and other related data. The maximum likelihood digit -for each of the nine digit positions becomes the maximum likelihood time -of the century. A built-in transition function implements a conventional -clock with decimal digits that count the minutes, hours, days and years, -as corrected for leap seconds and leap years. The counting operation -also rotates the likelihood vector corresponding to each digit as it -advances. Thus, once the clock is set, each clock digit should -correspond to the maximum likelihood digit as transmitted. - -<p>Each row of the decoding matrix also includes a compare counter and -the difference (modulo the radix) between the current clock digit and -most recently determined maximum likelihood digit. If a digit likelihood -exceeds the decision level and the difference is constant for a number -of successive minutes in any row, the maximum likelihood digit replaces -the clock digit in that row. When this condition is true for all rows -and the second epoch has been reliably determined, the clock is set (or -verified if it has already been set) and delivers correct time to the -integral second. The fraction within the second is derived from the -logical master clock, which runs at 8000 Hz and drives all system timing -functions. - -<p>The logical master clock is derived from the audio codec clock. Its -frequency is disciplined by a frequency-lock loop (FLL) which operates -independently of the data recovery functions. At averaging intervals -determined by the measured jitter, the frequency error is calculated as -the difference between the most recent and the current second epoch -divided by the interval. The sample clock frequency is then corrected by -this amount using an exponential average. When first started, the -frequency averaging interval is eight seconds, in order to compensate -for intrinsic codec clock frequency offsets up to 125 PPM. Under most -conditions, the averaging interval doubles in stages from the initial -value to over 1000 seconds, which results in an ultimate frequency -precision of 0.125 PPM, or about 11 ms/day. +amplitude 30 ms from the beginning of the second establishes the +minimum (noise floor) value, while the amplitude 200 ms from the +beginning establishes the maximum (signal peak) value. The slice +level is midway between these two values. The negative-going +envelope transition at the slice level establishes the length of +the data pulse, which in turn establish probabilities for binary +zero (P0) or binary one (P1). The values are established by linear +interpolation between the pulse lengths for P0 (300 ms) and P1 (500 +ms) so that the sum is equal to one. If the driver has not +synchronized to the minute pulse, or if the data bit amplitude, +signal/noise ratio (SNR) or length are below thresholds, the bit is +considered invalid and all three probabilities are set to zero.</p> + +<p>The difference between the P1 and P0 probabilities, or +likelihood, for each data bit is exponentially averaged in a set of +60 accumulators, one for each second, to determine the semi-static +miscellaneous bits, such as DST indicator, leap second warning and +DUT1 correction. In this design, an average value larger than a +positive threshold is interpreted as a hit on one and a value +smaller than a negative threshold as a hit on zero. Values between +the two thresholds, which can occur due to signal fades or loss of +signal, are interpreted as a miss, and result in no change of +indication.</p> + +<p>The BCD digit in each digit position of the timecode is +represented as four data bits, all of which must be valid for the +digit itself to be considered valid. If so, the bits are correlated +with the bits corresponding to each of the valid decimal digits in +this position. If the digit is invalid, the correlated value for +all digits in this position is assumed zero. In either case, the +values for all digits are exponentially averaged in a likelihood +vector associated with this position. The digit associated with the +maximum over all of the averaged values then becomes the maximum +likelihood selection for this position and the ratio of the maximum +over the next lower value becomes the likelihood ratio.</p> + +<p>The decoding matrix contains nine row vectors, one for each +digit position. Each row vector includes the maximum likelihood +digit, likelihood vector and other related data. The maximum +likelihood digit for each of the nine digit positions becomes the +maximum likelihood time of the century. A built-in transition +function implements a conventional clock with decimal digits that +count the minutes, hours, days and years, as corrected for leap +seconds and leap years. The counting operation also rotates the +likelihood vector corresponding to each digit as it advances. Thus, +once the clock is set, each clock digit should correspond to the +maximum likelihood digit as transmitted.</p> + +<p>Each row of the decoding matrix also includes a compare counter +and the difference (modulo the radix) between the current clock +digit and most recently determined maximum likelihood digit. If a +digit likelihood exceeds the decision level and the difference is +constant for a number of successive minutes in any row, the maximum +likelihood digit replaces the clock digit in that row. When this +condition is true for all rows and the second epoch has been +reliably determined, the clock is set (or verified if it has +already been set) and delivers correct time to the integral second. +The fraction within the second is derived from the logical master +clock, which runs at 8000 Hz and drives all system timing +functions.</p> + +<p>The logical master clock is derived from the audio codec clock. +Its frequency is disciplined by a frequency-lock loop (FLL) which +operates independently of the data recovery functions. At averaging +intervals determined by the measured jitter, the frequency error is +calculated as the difference between the most recent and the +current second epoch divided by the interval. The sample clock +frequency is then corrected by this amount using an exponential +average. When first started, the frequency averaging interval is +eight seconds, in order to compensate for intrinsic codec clock +frequency offsets up to 125 PPM. Under most conditions, the +averaging interval doubles in stages from the initial value to over +1000 seconds, which results in an ultimate frequency precision of +0.125 PPM, or about 11 ms/day.</p> <p>It is important that the logical clock frequency is stable and -accurately determined, since in most applications the shortwave radio -will be tuned to a fixed frequency where WWV or WWVH signals are not -available throughout the day. In addition, in some parts of the US, -especially on the west coast, signals from either or both WWV and WWVH -may be available at different times or even at the same time. Since the -propagation times from either station are almost always different, each -station must be reliably identified before attempting to set the clock. - -<p>Station identification uses the 800-ms minute pulse transmitted by -each station. In the acquisition phase the entire minute is searched -using both the WWV and WWVH using matched filters and a pulse gate -discriminator similar to that found in radar acquisition and tracking -receivers. The peak amplitude found determines a range gate and window -where the next pulse is expected to be found. The minute is scanned -again to verify the peak is indeed in the window and with acceptable -amplitude, SNR and jitter. At this point the receiver begins to track -the second sync pulse and operate as above until the clock is set. - -<p>Once the minute is synchronized, the range gate is fixed and only -energy within the window is considered for the minute sync pulse. A -compare counter increments by one if the minute pulse has acceptable -amplitude, SNR and jitter and decrements otherwise. This is used as a -quality indicator and reported in the timecode and also for the autotune -function described below. +accurately determined, since in most applications the shortwave +radio will be tuned to a fixed frequency where WWV or WWVH signals +are not available throughout the day. In addition, in some parts of +the US, especially on the west coast, signals from either or both +WWV and WWVH may be available at different times or even at the +same time. Since the propagation times from either station are +almost always different, each station must be reliably identified +before attempting to set the clock.</p> + +<p>Station identification uses the 800-ms minute pulse transmitted +by each station. In the acquisition phase the entire minute is +searched using both the WWV and WWVH using matched filters and a +pulse gate discriminator similar to that found in radar acquisition +and tracking receivers. The peak amplitude found determines a range +gate and window where the next pulse is expected to be found. The +minute is scanned again to verify the peak is indeed in the window +and with acceptable amplitude, SNR and jitter. At this point the +receiver begins to track the second sync pulse and operate as above +until the clock is set.</p> + +<p>Once the minute is synchronized, the range gate is fixed and +only energy within the window is considered for the minute sync +pulse. A compare counter increments by one if the minute pulse has +acceptable amplitude, SNR and jitter and decrements otherwise. This +is used as a quality indicator and reported in the timecode and +also for the autotune function described below.</p> <h4>Performance</h4> -<p>It is the intent of the design that the accuracy and stability of the -indicated time be limited only by the characteristics of the propagation -medium. Conventional wisdom is that synchronization via the HF medium is -good only to a millisecond under the best propagation conditions. The -performance of the NTP daemon disciplined by the driver is clearly -better than this, even under marginal conditions. Ordinarily, with -marginal to good signals and a frequency averaging interval of 1024 s, -the frequency is stabilized within 0.1 PPM and the time within 125 <font -face=Symbol>m</font>s. The frequency stability characteristic is highly -important, since the clock may have to free-run for several hours before -reacquiring the WWV/H signal. - -<p>The expected accuracy over a typical day was determined using the -DSP93 and an oscilloscope and cesium oscillator calibrated with a GPS -receiver. With marginal signals and allowing 15 minutes for initial -synchronization and frequency compensation, the time accuracy determined -from the WWV/H second sync pulse was reliably within 125 <font -face=Symbol>m</font>s. In the particular DSP-93 used for program -development, the uncorrected CPU clock frequency offset was -45.8±0.1 PPM. Over the first hour after initial synchronization, -the clock frequency drifted about 1 PPM as the frequency averaging -interval increased to the maximum 1024 s. Once reaching the maximum, the -frequency wandered over the day up to 1 PPM, but it is not clear whether -this is due to the stability of the DSP-93 clock oscillator or the -changing height of the ionosphere. Once the frequency had stabilized and -after loss of the WWV/H signal, the frequency drift was less than 0.5 -PPM, which is equivalent to 1.8 ms/h or 43 ms/d. This resulted in a step -phase correction up to several milliseconds when the signal returned. - -<p>The measured propagation delay from the WWV transmitter at Boulder, -CO, to the receiver at Newark, DE, is 23.5±0.1 ms. This is -measured to the peak of the pulse after the second sync comb filter and -includes components due to the ionospheric propagation delay, nominally -8.9 ms, communications receiver delay and program delay. The propagation -delay can be expected to change about 0.2 ms over the day, as the result -of changing ionosphere height. The DSP93 program delay was measured at -5.5 ms, most of which is due to the 400-Hz bandpass filter and 5-ms -matched filter. Similar delays can be expected of this driver. +<p>It is the intent of the design that the accuracy and stability +of the indicated time be limited only by the characteristics of the +propagation medium. Conventional wisdom is that synchronization via +the HF medium is good only to a millisecond under the best +propagation conditions. The performance of the NTP daemon +disciplined by the driver is clearly better than this, even under +marginal conditions. Ordinarily, with marginal to good signals and +a frequency averaging interval of 1024 s, the frequency is +stabilized within 0.1 PPM and the time within 125 <font face= +"Symbol">m</font>s. The frequency stability characteristic is +highly important, since the clock may have to free-run for several +hours before reacquiring the WWV/H signal.</p> + +<p>The expected accuracy over a typical day was determined using +the DSP93 and an oscilloscope and cesium oscillator calibrated with +a GPS receiver. With marginal signals and allowing 15 minutes for +initial synchronization and frequency compensation, the time +accuracy determined from the WWV/H second sync pulse was reliably +within 125 <font face="Symbol">m</font>s. In the particular DSP-93 +used for program development, the uncorrected CPU clock frequency +offset was 45.8±0.1 PPM. Over the first hour after initial +synchronization, the clock frequency drifted about 1 PPM as the +frequency averaging interval increased to the maximum 1024 s. Once +reaching the maximum, the frequency wandered over the day up to 1 +PPM, but it is not clear whether this is due to the stability of +the DSP-93 clock oscillator or the changing height of the +ionosphere. Once the frequency had stabilized and after loss of the +WWV/H signal, the frequency drift was less than 0.5 PPM, which is +equivalent to 1.8 ms/h or 43 ms/d. This resulted in a step phase +correction up to several milliseconds when the signal returned.</p> + +<p>The measured propagation delay from the WWV transmitter at +Boulder, CO, to the receiver at Newark, DE, is 23.5±0.1 ms. +This is measured to the peak of the pulse after the second sync +comb filter and includes components due to the ionospheric +propagation delay, nominally 8.9 ms, communications receiver delay +and program delay. The propagation delay can be expected to change +about 0.2 ms over the day, as the result of changing ionosphere +height. The DSP93 program delay was measured at 5.5 ms, most of +which is due to the 400-Hz bandpass filter and 5-ms matched filter. +Similar delays can be expected of this driver.</p> <h4>Program Operation</h4> -The driver begins operation immediately upon startup. It first searches -for one or both of the stations WWV and WWVH and attempts to acquire -minute sync. This may take some fits and starts, as the driver expects -to see three consecutive minutes with good signals and low jitter. If -the autotune function is active, the driver will rotate over all five -frequencies and both WWV and WWVH stations until three good minutes are -found. - -<p>The driver then acquires second sync, which can take up to several -minutes, depending on signal quality. At the same time the driver -accumulates likelihood values for each of the nine digits of the clock, -plus the seven miscellaneous bits included in the WWV/H transmission -format. The minute units digit is decoded first and, when five -repetitions have compared correctly, the remaining eight digits are -decoded. When five repetitions of all nine digits have decoded -correctly, which normally takes 15 minutes with good signals and up to -an hour when buried in noise, and the second sync alarm has not been -raised for two minutes, the clock is set (or verified) and is selectable -to discipline the system clock. - -<p>As long as the clock is set or verified, the system clock offsets are -provided once each second to the reference clock interface, where they -are saved in a buffer. At the end of each minute, the buffer samples are -groomed by the median filter and trimmed-mean averaging functions. Using -these functions, the system clock can in principle be disciplined to a -much finer resolution than the 125-<font face=Symbol>m</font>s sample -interval would suggest, although the ultimate accuracy is probably -limited by propagation delay variations as the ionspheric height varies -throughout the day and night. - -<p>As long as signals are available, the clock frequency is disciplined -for use during times when the signals are unavailable. The algorithm -refines the frequency offset using increasingly longer averaging -intervals to 1024 s, where the precision is about 0.1 PPM. With good -signals, it takes well over two hours to reach this degree of precision; -however, it can take many more hours than this in case of marginal -signals. Once reaching the limit, the algorithm will follow frequency -variations due to temperature fluctuations and ionospheric height -variations. - -<p>It may happen as the hours progress around the clock that WWV and -WWVH signals may appear alone, together or not at all. When the driver -is first started, the NTP reference identifier appears as <tt>NONE</tt>. -When the driver has acquired one or both stations and mitigated which -one is best, it sets the station identifier in the timecode as described -below. In addition, the NTP reference identifier is set to the station -callsign. If the propagation delays has been properly set with the -<tt>fudge time1</tt> (WWV) and <tt>fudge time2</tt> (WWVH) commands in -the configuration file, handover from one station to the other will be -seamless. +The driver begins operation immediately upon startup. It first +searches for one or both of the stations WWV and WWVH and attempts +to acquire minute sync. This may take some fits and starts, as the +driver expects to see three consecutive minutes with good signals +and low jitter. If the autotune function is active, the driver will +rotate over all five frequencies and both WWV and WWVH stations +until three good minutes are found. + +<p>The driver then acquires second sync, which can take up to +several minutes, depending on signal quality. At the same time the +driver accumulates likelihood values for each of the nine digits of +the clock, plus the seven miscellaneous bits included in the WWV/H +transmission format. The minute units digit is decoded first and, +when five repetitions have compared correctly, the remaining eight +digits are decoded. When five repetitions of all nine digits have +decoded correctly, which normally takes 15 minutes with good +signals and up to an hour when buried in noise, and the second sync +alarm has not been raised for two minutes, the clock is set (or +verified) and is selectable to discipline the system clock.</p> + +<p>As long as the clock is set or verified, the system clock +offsets are provided once each second to the reference clock +interface, where they are saved in a buffer. At the end of each +minute, the buffer samples are groomed by the median filter and +trimmed-mean averaging functions. Using these functions, the system +clock can in principle be disciplined to a much finer resolution +than the 125-<font face="Symbol">m</font>s sample interval would +suggest, although the ultimate accuracy is probably limited by +propagation delay variations as the ionspheric height varies +throughout the day and night.</p> + +<p>As long as signals are available, the clock frequency is +disciplined for use during times when the signals are unavailable. +The algorithm refines the frequency offset using increasingly +longer averaging intervals to 1024 s, where the precision is about +0.1 PPM. With good signals, it takes well over two hours to reach +this degree of precision; however, it can take many more hours than +this in case of marginal signals. Once reaching the limit, the +algorithm will follow frequency variations due to temperature +fluctuations and ionospheric height variations.</p> + +<p>It may happen as the hours progress around the clock that WWV +and WWVH signals may appear alone, together or not at all. When the +driver is first started, the NTP reference identifier appears as +<tt>NONE</tt>. When the driver has acquired one or both stations +and mitigated which one is best, it sets the station identifier in +the timecode as described below. In addition, the NTP reference +identifier is set to the station callsign. If the propagation +delays has been properly set with the <tt>fudge time1</tt> (WWV) +and <tt>fudge time2</tt> (WWVH) commands in the configuration file, +handover from one station to the other will be seamless.</p> <p>Once the clock has been set for the first time, it will appear -reachable and selectable to discipline the system clock, even if the -broadcast signal fades to obscurity. A consequence of this design is -that, once the clock is set, the time and frequency are disciplined only -by the second sync pulse and the clock digits themselves are driven by -the clock state machine and ordinarily never changed. However, as long -as the clock is set correctly, it will continue to read correctly after -a period of signal loss, as long as it does not drift more than 500 ms -from the correct time. Assuming the clock frequency can be disciplined -within 1 PPM, the clock could coast without signals for some 5.8 days -without exceeding that limit. If for some reason this did happen, the -clock would be in the wrong second and would never resynchronize. To -protect against this most unlikely situation, if after four days with no -signals, the clock is considered unset and resumes the synchronization -procedure from the beginning. - -<p>To work well, the driver needs a communications receiver with good -audio response at 100 Hz. Most shortwave and communications receivers -roll off the audio response below 250 Hz, so this can be a problem, -especially with receivers using DSP technology, since DSP filters can -have very fast rolloff outside the passband. Some DSP transceivers, in -particular the ICOM 775, have a programmable low frequency cutoff which -can be set as low as 80 Hz. However, this particular radio has a strong -low frequency buzz at about 10 Hz which appears in the audio output and -can affect data recovery under marginal conditions. Although not tested, -it would seem very likely that a cheap shortwave receiver could function -just as well as an expensive communications receiver. +reachable and selectable to discipline the system clock, even if +the broadcast signal fades to obscurity. A consequence of this +design is that, once the clock is set, the time and frequency are +disciplined only by the second sync pulse and the clock digits +themselves are driven by the clock state machine and ordinarily +never changed. However, as long as the clock is set correctly, it +will continue to read correctly after a period of signal loss, as +long as it does not drift more than 500 ms from the correct time. +Assuming the clock frequency can be disciplined within 1 PPM, the +clock could coast without signals for some 5.8 days without +exceeding that limit. If for some reason this did happen, the clock +would be in the wrong second and would never resynchronize. To +protect against this most unlikely situation, if after four days +with no signals, the clock is considered unset and resumes the +synchronization procedure from the beginning.</p> + +<p>To work well, the driver needs a communications receiver with +good audio response at 100 Hz. Most shortwave and communications +receivers roll off the audio response below 250 Hz, so this can be +a problem, especially with receivers using DSP technology, since +DSP filters can have very fast rolloff outside the passband. Some +DSP transceivers, in particular the ICOM 775, have a programmable +low frequency cutoff which can be set as low as 80 Hz. However, +this particular radio has a strong low frequency buzz at about 10 +Hz which appears in the audio output and can affect data recovery +under marginal conditions. Although not tested, it would seem very +likely that a cheap shortwave receiver could function just as well +as an expensive communications receiver.</p> <h4>Autotune</h4> -<p>The driver includes provisions to automatically tune the radio in -response to changing radio propagation conditions throughout the day and -night. The radio interface is compatible with the ICOM CI-V standard, -which is a bidirectional serial bus operating at TTL levels. The bus can -be connected to a serial port using a level converter such as the CT-17. -The serial port speed is presently compiled in the program, but can be -changed in the driver source file. - -<p>Each ICOM radio is assigned a unique 8-bit ID select code, usually -expressed in hex format. To activate the CI-V interface, the -<tt>mode</tt> keyword of the <tt>server</tt> configuration command -specifies a nonzero select code in decimal format. A table of ID select -codes for the known ICOM radios is given below. A missing <tt>mode</tt> -keyword or a zero argument leaves the interface disabled. The driver -will attempt to open the device <tt>/dev/icom</tt> and, if successful -will activate the autotune function and tune the radio to each operating -frequency in turn while attempting to acquire minute sync from either -WWV or WWVH. However, the driver is liberal in what it assumes of the -configuration. If the <tt>/dev/icom</tt> link is not present or the open -fails or the CI-V bus or radio is inoperative, the driver quietly gives -up with no harm done. - -<p>Once acquiring minute sync, the driver operates as described above to -set the clock. However, during seconds 59, 0 and 1 of each minute it -tunes the radio to one of the five broadcast frequencies to measure the -sync pulse and data pulse amplitudes and SNR and update the compare -counter. Each of the five frequencies are probed in a five-minute -rotation to build a database of current propagation conditions for all -signals that can be heard at the time. At the end of each rotation, a -mitigation procedure scans the database and retunes the radio to the -best frequency and station found. For this to work well, the radio -should be set for a fast AGC recovery time. This is most important while -tracking a strong signal, which is normally the case, and then probing -another frequency, which may have much weaker signals. - -<p>Reception conditions for each frequency and station are evaluated -according to a metric which considers the minute sync pulse amplitude, -SNR and jitter, as well as, the data pulse amplitude and SNR. The minute -pulse is evaluated at second 0, while the data pulses are evaluated at -seconds 59 and 1. The results are summarized in a scoreboard of three -bits +<p>The driver includes provisions to automatically tune the radio +in response to changing radio propagation conditions throughout the +day and night. The radio interface is compatible with the ICOM CI-V +standard, which is a bidirectional serial bus operating at TTL +levels. The bus can be connected to a serial port using a level +converter such as the CT-17. The serial port speed is presently +compiled in the program, but can be changed in the driver source +file.</p> + +<p>Each ICOM radio is assigned a unique 8-bit ID select code, +usually expressed in hex format. To activate the CI-V interface, +the <tt>mode</tt> keyword of the <tt>server</tt> configuration +command specifies a nonzero select code in decimal format. A table +of ID select codes for the known ICOM radios is given below. Since +all ICOM select codes are less than 128, the high order bit of the +code is used by the driver to specify the baud rate. If this bit is +not set, the rate is 9600 bps for the newer radios; if set, the +rate is 1200 bps for the older radios. A missing <tt>mode</tt> +keyword or a zero argument leaves the interface disabled.</p> + +<p>If specified, the driver will attempt to open the device <tt> +/dev/icom</tt> and, if successful will activate the autotune +function and tune the radio to each operating frequency in turn +while attempting to acquire minute sync from either WWV or WWVH. +However, the driver is liberal in what it assumes of the +configuration. If the <tt>/dev/icom</tt> link is not present or the +open fails or the CI-V bus or radio is inoperative, the driver +quietly gives up with no harm done.</p> + +<p>Once acquiring minute sync, the driver operates as described +above to set the clock. However, during seconds 59, 0 and 1 of each +minute it tunes the radio to one of the five broadcast frequencies +to measure the sync pulse and data pulse amplitudes and SNR and +update the compare counter. Each of the five frequencies are probed +in a five-minute rotation to build a database of current +propagation conditions for all signals that can be heard at the +time. At the end of each rotation, a mitigation procedure scans the +database and retunes the radio to the best frequency and station +found. For this to work well, the radio should be set for a fast +AGC recovery time. This is most important while tracking a strong +signal, which is normally the case, and then probing another +frequency, which may have much weaker signals.</p> + +<p>Reception conditions for each frequency and station are +evaluated according to a metric which considers the minute sync +pulse amplitude, SNR and jitter, as well as, the data pulse +amplitude and SNR. The minute pulse is evaluated at second 0, while +the data pulses are evaluated at seconds 59 and 1. The results are +summarized in a scoreboard of three bits</p> <dl> +<dt><tt>0x0001</tt></dt> -<p><dt><tt>0x0001</tt> -<dd>Jitter exceeded. The difference in epoches between the last minute -sync pulse and the current one exceeds 50 ms (400 samples).</dd> +<dd>Jitter exceeded. The difference in epoches between the last +minute sync pulse and the current one exceeds 50 ms (400 +samples).</dd> -<dt><tt>0x0002</tt> -<dd>Minute pulse error. For the minute sync pulse in second 0, either -the amplitude or SNR is below threshold (2000 and 20 dB, -respectively).</dd> +<dt><tt>0x0002</tt></dt> -<dt><tt>0x0004</tt> -<dd>Minute pulse error. For both of the data pulses in seocnds 59 and 1, -either the amplitude or SNR is below threshold (1000 and 10 dB, +<dd>Minute pulse error. For the minute sync pulse in second 0, +either the amplitude or SNR is below threshold (2000 and 20 dB, respectively).</dd> +<dt><tt>0x0004</tt></dt> + +<dd>Minute pulse error. For both of the data pulses in seocnds 59 +and 1, either the amplitude or SNR is below threshold (1000 and 10 +dB, respectively).</dd> </dl> <p>If none of the scoreboard bits are set, the compare counter is -increased by one to a maximum of six. If any bits are set, the counter -is decreased by one to a minimum of zero. At the end of each minute, the -frequency and station with the maximum compare count is chosen, with -ties going to the highest frequency. +increased by one to a maximum of six. If any bits are set, the +counter is decreased by one to a minimum of zero. At the end of +each minute, the frequency and station with the maximum compare +count is chosen, with ties going to the highest frequency.</p> <h4>Diagnostics</h4> -<p>The autotune process produces diagnostic information along with the -timecode. This is very useful for evaluating the performance of the -algorithm, as well as radio propagation conditions in general. The -message is produced once each minute for each frequency in turn after -minute sync has been acquired. +<p>The autotune process produces diagnostic information along with +the timecode. This is very useful for evaluating the performance of +the algorithm, as well as radio propagation conditions in general. +The message is produced once each minute for each frequency in turn +after minute sync has been acquired.</p> -<p><tt>wwv5 port agc wwv wwvh</tt> +<p><tt>wwv5 port agc wwv wwvh</tt></p> -<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and gain, -respectively, for this frequency and <tt>wwv</tt> and <tt>wwvh</tt> are -two sets of fields, one each for WWV and WWVH. Each of the two fields -has the format +<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and +gain, respectively, for this frequency and <tt>wwv</tt> and <tt> +wwvh</tt> are two sets of fields, one each for WWV and WWVH. Each +of the two fields has the format</p> -<p><tt>ident score comp sync/snr/jitr</tt> +<p><tt>ident score comp sync/snr/jitr</tt></p> <p>where <tt>ident</tt>encodes the station (<tt>C</tt> for WWV, -<tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 and 20), <tt>score</tt> -is the scoreboard described above, <tt>comp</tt> is the compare counter, -<tt>sync</tt> is the minute sync pulse amplitude, <tt>snr</tt> the SNR -of the pulse and <tt>jitr</tt> is the sample difference between the -current epoch and the last epoch. An example is: +<tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 and 20), <tt> +score</tt> is the scoreboard described above, <tt>comp</tt> is the +compare counter, <tt>sync</tt> is the minute sync pulse amplitude, +<tt>snr</tt> the SNR of the pulse and <tt>jitr</tt> is the sample +difference between the current epoch and the last epoch. An example +is:</p> -<p><tt>wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 22/-12.4/8846</tt> +<p><tt>wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 +22/-12.4/8846</tt></p> <p>Here the radio is tuned to 20 MHz and the line-in port AGC is -currently 111 at that frequency. The message contains a report for WWV -(<tt>C20</tt>) and WWVH (<tt>H20</tt>). The WWV report scoreboard is -0100 and the compare count is 6, which suggests very good reception -conditions, and the minute sync amplitude and SNR are well above -thresholds (2000 and 20 dB, respectively). Probably the most sensitive -indicator of reception quality is the jitter, -3 samples, which is well -below threshold (50 ms or 400 samples). While the message shows solid -reception conditions from WWV, this is not the case for WWVH. Both the -minute sync amplitude and SNR are below thresholds and the jitter is -above threshold. - -<p>A sequence of five messages, one for each minute, might appear as -follows: - -<p><pre>wwv5 2 95 C2 0107 0 164/7.2/8100 H2 0207 0 80/-5.5/7754 +currently 111 at that frequency. The message contains a report for +WWV (<tt>C20</tt>) and WWVH (<tt>H20</tt>). The WWV report +scoreboard is 0100 and the compare count is 6, which suggests very +good reception conditions, and the minute sync amplitude and SNR +are well above thresholds (2000 and 20 dB, respectively). Probably +the most sensitive indicator of reception quality is the jitter, -3 +samples, which is well below threshold (50 ms or 400 samples). +While the message shows solid reception conditions from WWV, this +is not the case for WWVH. Both the minute sync amplitude and SNR +are below thresholds and the jitter is above threshold.</p> + +<p>A sequence of five messages, one for each minute, might appear +as follows:</p> + +<pre> +wwv5 2 95 C2 0107 0 164/7.2/8100 H2 0207 0 80/-5.5/7754 wwv5 2 99 C5 0104 0 3995/21.8/395 H5 0207 0 27/-9.3/18826 wwv5 2 239 C10 0105 0 9994/30.0/2663 H10 0207 0 54/-16.1/-529 wwv5 2 155 C15 0103 3 3300/17.8/-1962 H15 0203 0 236/17.0/4873 -wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 22/-12.4/8846</pre> +wwv5 2 111 C20 0100 6 8348/30.0/-3 H20 0203 0 22/-12.4/8846 +</pre> -<p>Clearly, the only frequencies that are available are 15 MHz and 20 -MHz and propagation may be failing for 15 MHz. However, minute sync -pulses are being heard on 5 and 10 MHz, even though the data pulses are -not. This is typical of late afternoon when the maximum usable frequency -(MUF) is falling and the ionospheric loss at the lower frequencies is -beginning to decrease. +<p>Clearly, the only frequencies that are available are 15 MHz and +20 MHz and propagation may be failing for 15 MHz. However, minute +sync pulses are being heard on 5 and 10 MHz, even though the data +pulses are not. This is typical of late afternoon when the maximum +usable frequency (MUF) is falling and the ionospheric loss at the +lower frequencies is beginning to decrease.</p> <h4>Debugging Aids</h4> <p>The most convenient way to track the driver status is using the -<tt>ntpq</tt> program and the <tt>clockvar</tt> command. This displays -the last determined timecode and related status and error counters, even -when the driver is not discipline the system clock. If the debugging -trace feature (<tt>-d</tt> on the <tt>ntpd</tt> command line)is enabled, -the driver produces detailed status messages as it operates. If the -<tt>fudge flag 4</tt> is set, these messages are written to the -<tt>clockstats</tt> file. All messages produced by this driver have the -prefix <tt>chu</tt> for convenient filtering with the Unix <tt>grep</tt> -command. +<tt>ntpq</tt> program and the <tt>clockvar</tt> command. This +displays the last determined timecode and related status and error +counters, even when the driver is not discipline the system clock. +If the debugging trace feature (<tt>-d</tt> on the <tt>ntpd</tt> +command line)is enabled, the driver produces detailed status +messages as it operates. If the <tt>fudge flag 4</tt> is set, these +messages are written to the <tt>clockstats</tt> file. All messages +produced by this driver have the prefix <tt>chu</tt> for convenient +filtering with the Unix <tt>grep</tt> command.</p> <p>In the following descriptions the units of amplitude, phase, probability and likelihood are normalized to the range 0-6000 for -convenience. In addition, the signal/noise ratio (SNR) and likelihood -ratio are measured in decibels and the words with bit fields are in -hex. Most messages begin with a leader in the following format: +convenience. In addition, the signal/noise ratio (SNR) and +likelihood ratio are measured in decibels and the words with bit +fields are in hex. Most messages begin with a leader in the +following format:</p> -<p><tt>wwvn ss stat sigl</tt> +<p><tt>wwvn ss stat sigl</tt></p> -<p>where <tt>wwvn</tt> is the message code, <tt>ss</tt> the second of -minute, <tt>stat</tt> the driver status word and <tt>sigl</tt> the -second sync pulse amplitude. A full explanation of the status bits is -contained in the driver source listing; however, the following are the -most useful for debugging. +<p>where <tt>wwvn</tt> is the message code, <tt>ss</tt> the second +of minute, <tt>stat</tt> the driver status word and <tt>sigl</tt> +the second sync pulse amplitude. A full explanation of the status +bits is contained in the driver source listing; however, the +following are the most useful for debugging.</p> <dl> +<dt><tt>0x0001</tt></dt> -<p><dt><tt>0x0001</tt> <dd>Minute sync. Set when the decoder has identified a station and acquired the minute sync pulse.</dd> -<p><dt><tt>0x0002</tt> -<dd>Second sync. Set when the decoder has acquired the second sync pulse -and within 125 <font face=Symbol>m</font>s of the correct phase.</dd> -<p><dt><tt>0x0004</tt> -<dd>Minute unit sync. Set when the decoder has reliably determined the -unit digit of the minute.</dd> +<dt><tt>0x0002</tt></dt> + +<dd>Second sync. Set when the decoder has acquired the second sync +pulse and within 125 <font face="Symbol">m</font>s of the correct +phase.</dd> -<p><dt><tt>0x0008</tt> -<dd>Clock set. Set when the decoder has reliably determined all nine -digits of the timecode and is selectable to discipline the system -clock.</dd> +<dt><tt>0x0004</tt></dt> +<dd>Minute unit sync. Set when the decoder has reliably determined +the unit digit of the minute.</dd> + +<dt><tt>0x0008</tt></dt> + +<dd>Clock set. Set when the decoder has reliably determined all +nine digits of the timecode and is selectable to discipline the +system clock.</dd> </dl> -<p>With debugging enabled the driver produces messages in the following -formats: +<p>With debugging enabled the driver produces messages in the +following formats:</p> -<p>Format <tt>wwv8</tt> messages are produced once per minute by the WWV -and WWVH station processes before minute sync has been acquired. They -show the progress of identifying and tracking the minute pulse of each -station. +<p>Format <tt>wwv8</tt> messages are produced once per minute by +the WWV and WWVH station processes before minute sync has been +acquired. They show the progress of identifying and tracking the +minute pulse of each station.</p> -<p><tt>wwv8 port agc ident comp ampl snr epoch jitr offs</tt> +<p><tt>wwv8 port agc ident comp ampl snr epoch jitr offs</tt></p> -<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and gain, -respectively. The <tt>ident</tt>encodes the station (<tt>C</tt> for WWV, -<tt>H</tt> for WWVH) and frequency (2, 5, 10, 15 and 20). For the -encoded frequency, <tt>comp</tt> is the compare counter, <tt>ampl</tt> -the pulse amplitude, <tt>snr</tt> the SNR, <tt>epoch</tt> the sample -number of the minute pulse in the minute, <tt>jitr</tt> the change since -the last <tt>epoch</tt> and <tt>offs</tt> the minute pulse offset -relative to the second pulse. An example is: +<p>where <tt>port</tt> and <tt>agc</tt> are the audio port and +gain, respectively. The <tt>ident</tt>encodes the station +(<tt>C</tt> for WWV, <tt>H</tt> for WWVH) and frequency (2, 5, 10, +15 and 20). For the encoded frequency, <tt>comp</tt> is the compare +counter, <tt>ampl</tt> the pulse amplitude, <tt>snr</tt> the SNR, +<tt>epoch</tt> the sample number of the minute pulse in the minute, +<tt>jitr</tt> the change since the last <tt>epoch</tt> and <tt> +offs</tt> the minute pulse offset relative to the second pulse. An +example is:</p> -<p><tt> wwv8 2 127 C15 2 9247 30.0 18843 -1 1</tt> -<br><tt>wwv8 2 127 H15 0 134 -2.9 19016 193 174</tt> +<p><tt>wwv8 2 127 C15 2 9247 30.0 18843 -1 1</tt><br> +<tt>wwv8 2 127 H15 0 134 -2.9 19016 193 174</tt></p> <p>Here the radio is tuned to 15 MHz and the line-in port AGC is -currently 127 at that frequency. The driver has not yet acquired minute -sync, WWV has been heard for at least two minutes, and WWVH is in the -noise. The WWV minute pulse amplitude and SNR are well above the -threshold (2000 and 6 dB, respectively) and the minute epoch has been -determined -1 sample relative to the last one and 1 sample relative to -the second sync pulse. The compare counter has incrmented to two; when -it gets to three, minute sync has been acquired. +currently 127 at that frequency. The driver has not yet acquired +minute sync, WWV has been heard for at least two minutes, and WWVH +is in the noise. The WWV minute pulse amplitude and SNR are well +above the threshold (2000 and 6 dB, respectively) and the minute +epoch has been determined -1 sample relative to the last one and 1 +sample relative to the second sync pulse. The compare counter has +incrmented to two; when it gets to three, minute sync has been +acquired.</p> + +<p>Format <tt>wwv3</tt> messages are produced after minute sync has +been acquired and until the seconds unit digit is determined. They +show the results of decoding each bit of the transmitted +timecode.</p> + +<p><tt>wwv3 ss stat sigl ampl phas snr prob like</tt></p> -<p>Format <tt>wwv3</tt> messages are produced after minute sync has been -acquired and until the seconds unit digit is determined. They show the -results of decoding each bit of the transmitted timecode. +<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, +<tt>ampl</tt> is the subcarrier amplitude, <tt>phas</tt> the +subcarrier phase, <tt>snr</tt> the subcarrier SNR, <tt>prob</tt> +the bit probability and <tt>like</tt> the bit likelihood. An +example is:</p> -<p><tt>wwv3 ss stat sigl ampl phas snr prob like</tt> +<p><tt>wwv3 28 0123 4122 4286 0 24.8 -5545 -1735</tt></p> -<p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, -<tt>ampl</tt> is the subcarrier amplitude, <tt>phas</tt> the subcarrier -phase, <tt>snr</tt> the subcarrier SNR, <tt>prob</tt> the bit -probability and <tt>like</tt> the bit likelihood. An example is: - -<p><tt>wwv3 28 0123 4122 4286 0 24.8 -5545 -1735</tt> - -<p>Here the driver has acquired minute and second sync, but has not yet -determined the seconds unit digit. However, it has just decoded bit 28 -of the minute. The results show the second sync pulse amplitude well -over the threshold (500), subcarrier amplitude well above the threshold -(1000), good subcarrier tracking phase and SNR well above the threshold -(10 dB). The bit is almost certainly a zero and the likelihood of a zero -in this second is very high. -<p>Format <tt>wwv4</tt> messages are produced for each of the nine BCD -timecode digits until the clock has been set or verified. They show the -results of decoding each digit of the transmitted timecode. -<p><tt>wwv4 ss stat sigl radx ckdig mldig diff cnt like snr</tt> +<p>Here the driver has acquired minute and second sync, but has not +yet determined the seconds unit digit. However, it has just decoded +bit 28 of the minute. The results show the second sync pulse +amplitude well over the threshold (500), subcarrier amplitude well +above the threshold (1000), good subcarrier tracking phase and SNR +well above the threshold (10 dB). The bit is almost certainly a +zero and the likelihood of a zero in this second is very high.</p> + +<p>Format <tt>wwv4</tt> messages are produced for each of the nine +BCD timecode digits until the clock has been set or verified. They +show the results of decoding each digit of the transmitted +timecode.</p> + +<p><tt>wwv4 ss stat sigl radx ckdig mldig diff cnt like +snr</tt></p> <p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, <tt>radx</tt> is the digit radix (3, 4, 6, 10), <tt>ckdig</tt> the current clock digit, <tt>mldig</tt> the maximum likelihood digit, -<tt>diff</tt> the difference between these two digits modulo the radix, -<tt>cnt</tt> the compare counter, <tt>like</tt> the digit likelihood and -<tt>snr</tt> the likelihood ratio. An example is: +<tt>diff</tt> the difference between these two digits modulo the +radix, <tt>cnt</tt> the compare counter, <tt>like</tt> the digit +likelihood and <tt>snr</tt> the likelihood ratio. An example +is:</p> -<p><tt>wwv4 8 010f 5772 10 9 9 0 6 4615 6.1</tt> +<p><tt>wwv4 8 010f 5772 10 9 9 0 6 4615 6.1</tt></p> -<p>Here the driver has previousl set or verified the clock. It has just -decoded the digit preceding second 8 of the minute. The digit radix is -10, the current clock and maximum likelihood digits are both 9, the -likelihood is well above the threshold (1000) and the likelihood -function well above threshold (3.0 dB). Short of a hugely unlikely -probability conspiracy, the clock digit is most certainly a 9. +<p>Here the driver has previousl set or verified the clock. It has +just decoded the digit preceding second 8 of the minute. The digit +radix is 10, the current clock and maximum likelihood digits are +both 9, the likelihood is well above the threshold (1000) and the +likelihood function well above threshold (3.0 dB). Short of a +hugely unlikely probability conspiracy, the clock digit is most +certainly a 9.</p> -<p>Format <tt>wwv2</tt> messages are produced at each master oscillator -frequency update, which starts at 8 s, but eventually climbs to 1024 s. -They show the progress of the algorithm as it refines the frequency -measurement to a precision of 0.1 PPM. +<p>Format <tt>wwv2</tt> messages are produced at each master +oscillator frequency update, which starts at 8 s, but eventually +climbs to 1024 s. They show the progress of the algorithm as it +refines the frequency measurement to a precision of 0.1 PPM.</p> -<p><tt>wwv2 ss stat sigl avint avcnt avinc jitr delt freq</tt> +<p><tt>wwv2 ss stat sigl avint avcnt avinc jitr delt freq</tt></p> <p>where <tt>ss</tt>, <tt>stat</tt> and <tt>sigl</tt> are as above, -<tt>avint</tt> is the averaging interval, <tt>avcnt</tt> the averaging -interval counter, <tt>avinc</tt> the interval increment, <tt>jitr</tt> -the sample change between the beginning and end of the interval, -<tt>delt</tt> the computed frequency change and <tt>freq</tt> the -current frequency (PPM). An example is: +<tt>avint</tt> is the averaging interval, <tt>avcnt</tt> the +averaging interval counter, <tt>avinc</tt> the interval increment, +<tt>jitr</tt> the sample change between the beginning and end of +the interval, <tt>delt</tt> the computed frequency change and <tt> +freq</tt> the current frequency (PPM). An example is:</p> -<p><tt>wwv2 22 030f 5795 256 256 4 0 0.0 66.7</tt> +<p><tt>wwv2 22 030f 5795 256 256 4 0 0.0 66.7</tt></p> <p>Here the driver has acquired minute and second sync and set the -clock. The averaging interval has increased to 256 s on the way to 1024 -s, has stayed at that interval for 4 averaging intervals, has measured -no change in frequency and the current frequency is 66.7 PPM. +clock. The averaging interval has increased to 256 s on the way to +1024 s, has stayed at that interval for 4 averaging intervals, has +measured no change in frequency and the current frequency is 66.7 +PPM.</p> <p>If the CI-V interface for ICOM radios is active, a debug level -greater than 1 will produce a trace of the CI-V command and response -messages. Interpretation of these messages requires knowledge of the -CI-V protocol, which is beyond the scope of this document. +greater than 1 will produce a trace of the CI-V command and +response messages. Interpretation of these messages requires +knowledge of the CI-V protocol, which is beyond the scope of this +document.</p> <h4>Monitor Data</h4> -When enabled by the <tt>filegen</tt> facility, every received timecode -is written to the <tt>clockstats</tt> file in the following format: +When enabled by the <tt>filegen</tt> facility, every received +timecode is written to the <tt>clockstats</tt> file in the +following format: <pre> sq yy ddd hh:mm:ss.fff ld du lset agc stn rfrq errs freq cons @@ -599,130 +652,151 @@ is written to the <tt>clockstats</tt> file in the following format: avgt averaging time </pre> -The fields beginning with <tt>year</tt> and extending through -<tt>dut</tt> are decoded from the received data and are in fixed-length +The fields beginning with <tt>year</tt> and extending through <tt> +dut</tt> are decoded from the received data and are in fixed-length format. The <tt>agc</tt> and <tt>lset</tt> fields, as well as the -following driver-dependent fields, are in variable-length format. +following driver-dependent fields, are in variable-length format. <dl> +<dt><tt>s</tt></dt> + +<dd>The sync indicator is initially <tt>?</tt> before the clock is +set, but turns to space when all nine digits of the timecode are +correctly set.</dd> -<dt><tt>s</tt> -<dd>The sync indicator is initially <tt>?</tt> before the clock is set, -but turns to space when all nine digits of the timecode are correctly -set.</dd> +<dt><tt>q</tt></dt> + +<dd>The quality character is a four-bit hexadecimal code showing +which alarms have been raised. Each bit is associated with a +specific alarm condition according to the following: -<dt><tt>q</tt> -<dd>The quality character is a four-bit hexadecimal code showing which -alarms have been raised. Each bit is associated with a specific alarm -condition according to the following: <dl> +<dt><tt>0x8</tt></dt> + +<dd>Sync alarm. The decoder may not be in correct second or minute +phase relative to the transmitter.</dd> -<dt><tt>0x8</tt> -<dd>Sync alarm. The decoder may not be in correct second or minute phase -relative to the transmitter.</dd> +<dt><tt>0x4</tt></dt> -<dt><tt>0x4</tt> <dd>Error alarm. More than 30 data bit errors occurred in the last minute.</dd> -<dt><tt>0x2</tt> -<dd>Symbol alarm. The probability of correct decoding for a digit or -miscellaneous bit has fallen below the threshold.</dd> +<dt><tt>0x2</tt></dt> -<dt><tt>0x1</tt> -<dd>Decoding alarm. A maximum likelihood digit fails to agree with the -current associated clock digit.</dd> +<dd>Symbol alarm. The probability of correct decoding for a digit +or miscellaneous bit has fallen below the threshold.</dd> +<dt><tt>0x1</tt></dt> + +<dd>Decoding alarm. A maximum likelihood digit fails to agree with +the current associated clock digit.</dd> </dl> -It is important to note that one or more of the above alarms does not -necessarily indicate a clock error, but only that the decoder has -detected a condition that may in future result in an error. +It is important to note that one or more of the above alarms does +not necessarily indicate a clock error, but only that the decoder +has detected a condition that may in future result in an +error.</dd> + +<dt><tt>yyyy ddd hh:mm:ss.fff</tt></dt> -<dt><tt>yyyy ddd hh:mm:ss.fff</tt></tt> -<dd>The timecode format itself is self explanatory. Since the driver -latches the on-time epoch directly from the second sync pulse, the -fraction <tt>fff</tt>is always zero. Although the transmitted timecode -includes only the year of century, the Gregorian year is augmented 2000 -if the indicated year is less than 72 and 1900 otherwise.</dd> +<dd>The timecode format itself is self explanatory. Since the +driver latches the on-time epoch directly from the second sync +pulse, the fraction <tt>fff</tt>is always zero. Although the +transmitted timecode includes only the year of century, the +Gregorian year is augmented 2000 if the indicated year is less than +72 and 1900 otherwise.</dd> -<dt><tt>l</tt> -<dd>The leap second warning is normally space, but changes to <tt>L</tt> -if a leap second is to occur at the end of the month of June or -December.</dd> +<dt><tt>l</tt></dt> + +<dd>The leap second warning is normally space, but changes to <tt> +L</tt> if a leap second is to occur at the end of the month of June +or December.</dd> + +<dt><tt>d</tt></dt> -<dt><tt>d</tt> <dd>The DST state is <tt>S</tt> or <tt>D</tt> when standard time or -daylight time is in effect, respectively. The state is <tt>I</tt> or -<tt>O</tt> when daylight time is about to go into effect or out of -effect, respectively.</dd> -<dt><tt>dut</tt> -<dd>The DUT sign and magnitude shows the current UT1 offset relative to -the displayed UTC time, in deciseconds.</dd> - -<dt><tt>lset</tt> -<dd>Before the clock is set, the interval since last set is the number -of minutes since the driver was started; after the clock is set, this -is number of minutes since the time was last verified relative to the -broadcast signal.</dd> - -<dt><tt>agc</tt> -<dd>The audio gain shows the current codec gain setting in the range 0 -to 255. Ordinarily, the receiver audio gain control or IRIG level -control should be set for a value midway in this range. - -<dt><tt>ident</tt> +daylight time is in effect, respectively. The state is <tt>I</tt> +or <tt>O</tt> when daylight time is about to go into effect or out +of effect, respectively.</dd> + +<dt><tt>dut</tt></dt> + +<dd>The DUT sign and magnitude shows the current UT1 offset +relative to the displayed UTC time, in deciseconds.</dd> + +<dt><tt>lset</tt></dt> + +<dd>Before the clock is set, the interval since last set is the +number of minutes since the driver was started; after the clock is +set, this is number of minutes since the time was last verified +relative to the broadcast signal.</dd> + +<dt><tt>agc</tt></dt> + +<dd>The audio gain shows the current codec gain setting in the +range 0 to 255. Ordinarily, the receiver audio gain control or IRIG +level control should be set for a value midway in this range.</dd> + +<dt><tt>ident</tt></dt> + <dd>The station identifier shows the station, <tt>C</tt> for WWV or -<tt>H</tt> for WWVH, and frequency being tracked. If neither station is -heard on any frequency, the station identifier shows <tt>X</tt>.</dd> - -<dt><tt>comp</tt> -<dd>The minute sync compare counter is useful to determine the quality -of the minute sync signal and can range from 0 (no signal) to 5 -(best).</dd> - -<dt><tt>errs</tt> -<dd>The bit error counter is useful to determine the quality of the data -signal received in the most recent minute. It is normal to drop a couple -of data bits under good signal conditions and increasing numbers as -conditions worsen. While the decoder performs moderately well even with -half the bits are in error in any minute, usually by that point the sync -signals are lost and the decoder reverts to free-run anyway.</dd> - -<dt><tt>freq</tt> -<dd>The frequency offset is the current estimate of the codec frequency -offset to within 0.1 PPM. This may wander a bit over the day due to -local temperature fluctuations and propagation conditions.</dd> - -<dt><tt>avgt</tt> +<tt>H</tt> for WWVH, and frequency being tracked. If neither +station is heard on any frequency, the station identifier shows +<tt>X</tt>.</dd> + +<dt><tt>comp</tt></dt> + +<dd>The minute sync compare counter is useful to determine the +quality of the minute sync signal and can range from 0 (no signal) +to 5 (best).</dd> + +<dt><tt>errs</tt></dt> + +<dd>The bit error counter is useful to determine the quality of the +data signal received in the most recent minute. It is normal to +drop a couple of data bits under good signal conditions and +increasing numbers as conditions worsen. While the decoder performs +moderately well even with half the bits are in error in any minute, +usually by that point the sync signals are lost and the decoder +reverts to free-run anyway.</dd> + +<dt><tt>freq</tt></dt> + +<dd>The frequency offset is the current estimate of the codec +frequency offset to within 0.1 PPM. This may wander a bit over the +day due to local temperature fluctuations and propagation +conditions.</dd> + +<dt><tt>avgt</tt></dt> + <dd>The averaging time is the interval between frequency updates in powers of two to a maximum of 1024 s. Attainment of the maximum -indicates the driver is operating at the best possible resolution in -time and frequency.</dd> - +indicates the driver is operating at the best possible resolution +in time and frequency.</dd> </dl> -<p>An example timecode is: +<p>An example timecode is:</p> -<p><tt> 0 2000 006 22:36:00.000 S +3 1 115 C20 6 5 66.4 1024</tt> +<p><tt>0 2000 006 22:36:00.000 S +3 1 115 C20 6 5 66.4 +1024</tt></p> -<p>Here the clock has been set and no alarms are raised. The year, day -and time are displayed along with no leap warning, standard time and DUT -+0.3 s. The clock was set on the last minute, the AGC is safely in the -middle ot the range 0-255, and the receiver is tracking WWV on 20 MHz. -Excellent reeiving conditions prevail, as indicated by the compare count -6 and 5 bit errors during the last minute. The current frequency is 66.4 -PPM and the averaging interval is 1024 s, indicating the maximum -precision available. +<p>Here the clock has been set and no alarms are raised. The year, +day and time are displayed along with no leap warning, standard +time and DUT +0.3 s. The clock was set on the last minute, the AGC +is safely in the middle ot the range 0-255, and the receiver is +tracking WWV on 20 MHz. Excellent reeiving conditions prevail, as +indicated by the compare count 6 and 5 bit errors during the last +minute. The current frequency is 66.4 PPM and the averaging +interval is 1024 s, indicating the maximum precision available.</p> <h4>Modes</h4> <p>The <tt>mode</tt> keyword of the <tt>server</tt> configuration -command specifies the ICOM ID select code. A missing or zero argument -disables the CI-V interface. Following are the ID select codes for the -known radios. -<p><table cols=6 width=100%> +command specifies the ICOM ID select code. A missing or zero +argument disables the CI-V interface. Following are the ID select +codes for the known radios.</p> +<table cols="6" width="100%"> <tr> <td>Radio</td> <td>Hex</td> @@ -758,6 +832,7 @@ known radios. <td>0x1A</td> <td>26</td> </tr> + <tr> <td>IC751</td> <td>0x1c</td> @@ -766,6 +841,7 @@ known radios. <td>0x34</td> <td>52</td> </tr> + <tr> <td>IC761</td> <td>0x1e</td> @@ -792,48 +868,63 @@ known radios. <td>0x2a</td> <td>42</td> </tr> - </table> <h4>Fudge Factors</h4> <dl> +<dt><tt>time1 <i>time</i></tt></dt> -<dt><tt>time1 <I>time</I></tt></dt> -<dd>Specifies the propagation delay for WWV (40:40:49.0N 105:02:27.0W), -in seconds and fraction, with default 0.0.dd> +<dd>Specifies the propagation delay for WWV (40:40:49.0N +105:02:27.0W), in seconds and fraction, with default 0.0.</dd> -<dt><tt>time2 <I>time</I></tt></dt> -<dd>Specifies the propagation delay for WWVH (21:59:26.0N 159:46:00.0W), -in seconds and fraction, with default 0.0. -</dd> +<dt><tt>time2 <i>time</i></tt></dt> -<dt><tt>stratum <I>number</I></tt></dt> -<dd>Specifies the driver stratum, in decimal from 0 to 15, with default -0.</dd> +<dd>Specifies the propagation delay for WWVH (21:59:26.0N +159:46:00.0W), in seconds and fraction, with default 0.0.</dd> + +<dt><tt>stratum <i>number</i></tt></dt> + +<dd>Specifies the driver stratum, in decimal from 0 to 15, with +default 0.</dd> + +<dt><tt>refid <i>string</i></tt></dt> + +<dd>Ordinarily, this field specifies the driver reference +identifier; however, the driver sets the reference identifier +automatically as described above.</dd> -<dt><tt>refid <I>string</I></tt></dt> -<dd>Ordinarily, this field specifies the driver reference identifier; -however, the driver sets the reference identifier automatically as -described above. <dt><tt>flag1 0 | 1</tt></dt> + <dd>Not used by this driver.</dd> <dt><tt>flag2 0 | 1</tt></dt> -<dd>Specifies the microphone port if set to zero or the line-in port if -set to one. It does not seem useful to specify the compact disc player -port.</dd> + +<dd>Specifies the microphone port if set to zero or the line-in +port if set to one. It does not seem useful to specify the compact +disc player port.</dd> + <dt><tt>flag3 0 | 1</tt></dt> -<dd>Enables audio monitoring of the input signal. For this purpose, the -speaker volume must be set before the driver is started.</dd> + +<dd>Enables audio monitoring of the input signal. For this purpose, +the speaker volume must be set before the driver is started.</dd> <dt><tt>flag4 0 | 1</tt></dt> + <dd>Enable verbose <tt>clockstats</tt> recording if set.</dd> </dl> + <h4>Additional Information</h4> -<A HREF="refclock.htm">Reference Clock Drivers</A> -<br><A HREF="audio.htm">Reference Clock Audio Drivers</A> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<a href="refclock.htm">Reference Clock Drivers</a> <br> +<a href="audio.htm">Reference Clock Audio Drivers</a> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/driver38.htm b/contrib/ntp/html/driver38.htm new file mode 100644 index 0000000..4ae1c78 --- /dev/null +++ b/contrib/ntp/html/driver38.htm @@ -0,0 +1,191 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>hopf clock drivers by ATLSoft</title> +</head> +<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#800080" alink="#FF0000"> + +<h1> +<font face="Arial"><i><blink><font size="5">hopf</font></blink></i><font size="+2"> +</font><font size="3">Serial Line Receivers (6021 and kompatible)</font></font></h1> +<hr> + +<h2> +<font size=+1>Synopsis</font></h2> + +<table border="0" cellpadding cellspacing width="100%"> + <tr> + <td> + +<table border="0" cellpadding="3" bgcolor="#C0C0C0"> +<tr> +<td height="21"> +<div align=right><tt>Address: </tt></div> +</td> + +<td><b>127.127.38.<i>X</i></b></td> +</tr> + +<tr> +<td height="1"> +<div align=right><tt>Reference ID: </tt></div> +</td> + +<td height="1"><a NAME="REFID"></a><b>.hopf. </b>(default)<b>, GPS, DCF</b></td> +</tr> + +<tr> +<td height="21"> +<div align=right><tt>Driver ID: </tt></div> +</td> + +<td height="21"><b>HOPF_S</b></td> +</tr> + +<tr> +<td height="16"> +<div align=right><tt>Serial Port: </tt></div> +</td> + +<td height="16"><b>/dev/hopfclock<i>X</i></b></td> +</tr> + +<tr> +<td height="23"> +<div align=right><tt><font size=+1>Serial I/O</font>: </tt></div> +</td> + +<td height="23"><b>9600 baud, 8-bits, 1-stop, no parity</b></td> +</tr> +</table> + + </td> + <td align="center"><img border="0" src="pic/fg6021.gif" width="238" height="207"></td> + </tr> +</table> + +<hr> + +<h2> +<font size=+1>Description</font></h2> +The <b>refclock_hopf_serial</b> driver supports <a href="http://www.hopf.com">hopf +electronic receivers</a> with serial Interface kompatibel 6021. +<br>Additional software and information about the software drivers is available +from: <a href="http://www.ATLSoft.de/ntp">http://www.ATLSoft.de/ntp</a>. +<br>Latest NTP driver source, executables and documentation is maintained +at: <a href="http://www.ATLSoft.de/ntp">http://www.ATLSoft.de/ntp</a> +<hr> +<h2> +<font size=+1>Operating System Compatibility</font></h2> +<p align="left"> +The hopf clock driver has been tested on the following software and hardware +platforms: +<br> <table bgcolor="#C0C0C0"> +<tr> +<td VALIGN=CENTER WIDTH="23%" nowrap> + <p align="left"><b>Platform</b></p> +</td> + +<td VALIGN=CENTER nowrap> + <p align="left"><b>Operating System</b></p> +</td> + +</tr> + +<tr> +<td VALIGN=CENTER WIDTH="23%" nowrap> + <p align="left">i386 (PC) </p> +</td> + +<td VALIGN=CENTER nowrap> + <p align="left">Linux</p> +</td> + +</tr> + +<tr> +<td nowrap> + <p align="left">i386 (PC) </p> + </td> + +<td nowrap> + <p align="left">Windows NT</p> + </td> + +</tr> + +<tr> +<td nowrap> + <p align="left">i386 (PC) </p> +</td> + +<center> + +<td nowrap>Windows 2000</td> + +</tr> + +</table></center> + +<hr> + +<h2> +<font size=+1>O/S Serial Port Configuration</font></h2> +The driver attempts to open the device <b><tt><a href="#REFID">/dev/hopfclock<i>X</i></a></tt></b> +where <i><b>X</b></i> is the NTP refclock unit number as defined by the +LSB of the refclock address. Valid refclock unit numbers are 0 - +3. +<p>The user is expected to provide a symbolic link to an available serial +port device. This is typically performed by a command such as: +<blockquote><tt>ln -s /dev/ttyS0 /dev/hopfclock0</tt></blockquote> +Windows NT does not support symbolic links to device files. <br> +<b> COMx</b>: +is used by the driver, based on the refclock unit number, where <b> unit 1</b> +corresponds to <b> COM1</b>: and <b> unit 3</b> corresponds to <b>COM3</b>: +<br> +<hr> + +<h2> +<font size=+1>Fudge Factors</font></h2> + +<dl> +<dt> +<b> +<a NAME="time1"></a><tt><font size=+1><a href="#Configuration">time1 <i>time</i></a></font></tt></b></dt> + +<dd> +Specifies the time offset calibration factor, in seconds and fraction, +with default 0.0. Should be set to +20 milliseconds to correct serial line and operating system delays incurred +in capturing time stamps from the synchronous packets.</dd> + +<dt> +<tt><font size=+1><a href="#REFID"><b>refid <i>string</i></b></a></font></tt></dt> + +<dd> +Specifies the driver reference identifier, <b>GPS </b><i>or</i> <b> DCF</b>.</dd> + +<dt> +<tt><font size=+1><b>flag1 0 +| 1</b></font></tt></dt> + +<dd> +When set to 1, driver sync's even if only crystal driven.</dd> +</dl> + +<hr> + +<h2> +<a NAME="DataFormat"></a><font size=+1>Data Format</font></h2> +<p>as specified in clock manual under pt. <u>[ <span lang="EN-GB" style="font-size:10.0pt;font-family: +Arial;mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman"; +mso-ansi-language:EN-GB;mso-fareast-language:DE;mso-bidi-language:AR-SA"><b>Data +String for NTP</b> ( <b><i>Network Time Protocol </i></b>) </span>]</u></p> +<hr> +<h3>Questions or Comments:</h3> +<p><a href="mailto:altmeier@atlsoft.de">Bernd Altmeier</a><a href="http://www.ATLSoft.de"><br> +Ing.-B’ro f’r Software www.ATLSoft.de</a><p>(last updated 02/28/2001) +<br> +</body> +</html> diff --git a/contrib/ntp/html/driver39.htm b/contrib/ntp/html/driver39.htm new file mode 100644 index 0000000..86b0f60 --- /dev/null +++ b/contrib/ntp/html/driver39.htm @@ -0,0 +1,162 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>hopf clock drivers by ATLSoft</title> +</head> +<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#800080" alink="#FF0000"> + +<h1> +<font face="Arial"><i><blink><font size="5">hopf</font></blink></i><font size="+2"> +</font><font size="3">PCI-Bus Receiver (6039 GPS/DCF77)</font></font></h1> +<hr> + +<div align="center"> + <center> + <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td width="50%"> + <h2> +<font size=+1>Synopsis</font></h2> + +<table border="0" cellpadding="3" bgcolor="#C0C0C0"> +<tr> +<td height="21"> +<div align=right><tt>Address: </tt></div> +</td> + +<td height="21"><b>127.127.39.<i>X</i></b></td> +</tr> + +<tr> +<td height="21"> +<div align=right><tt>Reference ID: </tt></div> +</td> + +<td height="21"><a NAME="REFID"></a><b>.hopf. </b>(default)<b>, GPS, DCF</b></td> +</tr> + +<tr> +<td height="21"> +<div align=right><tt>Driver ID: </tt></div> +</td> + +<td height="21"><b>HOPF_P</b></td> +</tr> + +</table> + + </td> + <td valign="middle" align="center"><font face="Arial"><i><blink><font size="5"><img border="0" src="pic/fg6039.jpg" width="141" height="140"></font></blink></i></font></td> + </tr> + </table> + </center> +</div> + +<hr> + +<h2> +<font size=+1>Description</font></h2> +The <b>refclock_hopf_pci </b>driver supports the <a href="http://www.hopf.com">hopf</a> +PCI-bus interface 6039 GPS/DCF77. +<br>Additional software and information about the software drivers maybe available +from: <a href="http://www.ATLSoft.de/ntp">http://www.ATLSoft.de/ntp</a>. +<br>Latest NTP driver source, executables and documentation is maintained +at: <a href="http://www.ATLSoft.de/ntp">http://www.ATLSoft.de/ntp</a> +<hr> +<h2> +<font size=+1>Operating System Compatibility</font></h2> +<p align="left"> +The hopf clock driver has been tested on the following software and hardware +platforms: +<br> <table bgcolor="#C0C0C0"> +<tr> +<td VALIGN=CENTER WIDTH="23%" nowrap> + <p align="left"><b>Platform</b></p> +</td> + +<td VALIGN=CENTER nowrap> + <p align="left"><b>Operating System</b></p> +</td> + +</tr> + +<tr> +<td VALIGN=CENTER WIDTH="23%" nowrap> + <p align="left">i386 (PC) </p> +</td> + +<td VALIGN=CENTER nowrap> + <p align="left">Linux</p> +</td> + +</tr> + +<tr> +<td nowrap> + <p align="left">i386 (PC) </p> + </td> + +<td nowrap> + <p align="left">Windows NT</p> + </td> + +</tr> + +<tr> +<td nowrap> + <p align="left">i386 (PC) </p> +</td> + +<center> + +<td nowrap>Windows 2000</td> + +</tr> + +</table></center> + +<hr> + +<h2> +<font size=+1>O/S System Configuration</font></h2> + +<p> +<b>UNIX</b></p> +The driver attempts to open the device <b><tt><a href="#REFID">/dev/hopf6039</a></tt></b> +. The device entry will be made by the installation process of the kernel module +for the PCI-bus board. The driver sources belongs to the delivery equipment of +the PCI-board. +<p><b>Windows NT/2000</b> +<p> +The driver attempts to open the device by calling the function "OpenHopfDevice()". +This function will be installed by the Device Driver for the PCI-bus board. The +driver belongs to the delivery equipment of the PCI-board.</p> +<hr> + +<h2> +<font size=+1>Fudge Factors</font></h2> + +<dl> + +<dt> +<tt><font size=+1><a href="#REFID"><b>refid <i>string</i></b></a></font></tt></dt> + +<dd> +Specifies the driver reference identifier, <b>GPS </b><i>or</i> <b> DCF</b>.</dd> + +<dt> +<tt><font size=+1><b>flag1 0 +| 1</b></font></tt></dt> + +<dd> +When set to 1, driver sync's even if only crystal driven.</dd> +</dl> + +<hr> +<h3>Questions or Comments:</h3> +<p><a href="mailto:altmeier@atlsoft.de">Bernd Altmeier</a><a href="http://www.ATLSoft.de"><br> +Ing.-B’ro f’r Software www.ATLSoft.de</a><p>(last updated 03/02/2001) +<br> +</body> +</html> diff --git a/contrib/ntp/html/driver6.htm b/contrib/ntp/html/driver6.htm index 9fac978..501f697 100644 --- a/contrib/ntp/html/driver6.htm +++ b/contrib/ntp/html/driver6.htm @@ -1,242 +1,271 @@ -<html><head><title> -IRIG Audio Decoder -</title></head><body><h3> -IRIG Audio Decoder -</h3><hr> - -<H4>Synopsis</H4> - -Address: 127.127.6.<I>u</I> -<BR>Reference ID: <TT>IRIG</TT> -<BR>Driver ID: <TT>IRIG_AUDIO</TT> -<BR>Audio Device: <TT>/dev/audio</TT> and <TT>/dev/audioctl</TT> - -<P>Note: This driver supersedes an older one of the same name, address -and ID which required replacing the original kernel audio driver with -another which works only on older Sun SPARCstation systems. The new -driver described here uses the stock kernel audio driver and works in -SunOS 4.1.3 and Solaris 2.6 versions and probably all versions in -between. The new driver requires no modification of the operating -system. While it is generic and likely portable to other systems, it is -somewhat slower than the original, since the extensive signal -conditioning, filtering and decoding is done in user space, not kernel -space. - -<H4>Description</H4> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>IRIG Audio Decoder</title> +</head> +<body> +<h3>IRIG Audio Decoder</h3> + +<hr> +<h4>Synopsis</h4> + +Address: 127.127.6.<i>u</i> <br> +Reference ID: <tt>IRIG</tt> <br> +Driver ID: <tt>IRIG_AUDIO</tt> <br> +Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt> + +<p>Note: This driver supersedes an older one of the same name, +address and ID which required replacing the original kernel audio +driver with another which works only on older Sun SPARCstation +systems. The new driver described here uses the stock kernel audio +driver and works in SunOS 4.1.3 and Solaris 2.6 versions and +probably all versions in between. The new driver requires no +modification of the operating system. While it is generic and +likely portable to other systems, it is somewhat slower than the +original, since the extensive signal conditioning, filtering and +decoding is done in user space, not kernel space.</p> + +<h4>Description</h4> This driver supports the Inter-Range Instrumentation Group (IRIG) -standard time distribution signal using the audio codec native to some -workstations. This signal is generated by several radio clocks, -including those made by Arbiter, Austron, Bancomm, Odetics, Spectracom -and TrueTime, among others, although it is often an add-on option. The -signal is connected via an optional attenuator box and cable to either -the microphone or line-in port. The driver receives, demodulates and -decodes the IRIG-B and IRIG-E signal formats using internal filters -designed to reduce the effects of noise and interference. - -<p>This driver incorporates several features in common with other audio -drivers such as described in the <a href=driver7.htm>Radio CHU Audio -Demodulator/Decoder</a> and the <a href=driver36.htm>Radio WWV/H Audio -Demodulator/Decoder</a> pages. They include automatic gain control -(AGC), selectable audio codec port and signal monitoring capabilities. -For a discussion of these common features, as well as a guide to hookup, -debugging and monitoring, see the <a href=audio.htm>Reference Clock -Audio Drivers</a> page. - -<P>The IRIG signal format uses an amplitude-modulated carrier with -pulse-width modulated data bits. For IRIG-B, the carrier frequency is -1000 Hz and bit rate 100 b/s; for IRIG-E, the carrier frequenchy is 100 -Hz and bit rate 10 b/s. While IRIG-B provides the best accuracy, -generally within a few tens of microseconds relative to IRIG time, it -can also generate a significant load on the processor with older -workstations. Generally, the accuracy with IRIG-E is about ten times -worse than IRIG-B, but the processor load is ten times less. - -<P>The program processes 8000-Hz mu-law companded samples using separate -signal filters for IRIG-B and IRIG-E, a comb filter, envelope detector -and automatic threshold corrector. Cycle crossings relative to the -corrected slice level determine the width of each pulse and its value - -zero, one or position identifier. The data encode 20 BCD digits which -determine the second, minute, hour and day of the year and sometimes the -year and synchronization condition. The comb filter exponentially -averages the corresponding samples of successive baud intervals in order -to reliably identify the reference carrier cycle. A type-II phase-lock -loop (PLL) performs additional integration and interpolation to -accurately determine the zero crossing of that cycle, which determines -the reference timestamp. A pulse-width discriminator demodulates the -data pulses, which are then encoded as the BCD digits of the timecode. -The timecode and reference timestamp are updated once each second with -IRIG-B (ten seconds with IRIG-E) and local clock offset samples saved -for later processing. At poll intervals of 64 s, the saved samples are -processed by a trimmed-mean filter and used to update the system clock. - -<P>Infinite impulse response (IIR) filters are used with both IRIG-B and -IRIG-E formats. An 800-Hz highpass filter is used for IRIG-B and a -130-Hz lowpass filter for IRIG-E. These are intended for use with noisy -signals, such as might be received over a telephone line or radio -circuit, or when interfering signals may be present in the audio -passband. The driver determines which IRIG format is in use by sampling -the amplitude of each filter output and selecting the one with maximum -signal. An automatic gain control feature provides protection against -overdriven or underdriven input signal amplitudes. It is designed to -maintain adequate demodulator signal amplitude while avoiding occasional -noise spikes. In order to assure reliable capture, the decompanded input -signal amplitude must be greater than 100 units and the codec sample -frequency error less than 250 PPM (.025 percent). - -<P>The program performs a number of error checks to protect against -overdriven or underdriven input signal levels, incorrect signal format -or improper hardware configuration. Specifically, if any of the -following errors occur for a timecode, the data are rejected. +standard time distribution signal using the audio codec native to +some workstations. This signal is generated by several radio +clocks, including those made by Arbiter, Austron, Bancomm, Odetics, +Spectracom and TrueTime, among others, although it is often an +add-on option. The signal is connected via an optional attenuator +box and cable to either the microphone or line-in port. The driver +receives, demodulates and decodes the IRIG-B and IRIG-E signal +formats using internal filters designed to reduce the effects of +noise and interference. + +<p>This driver incorporates several features in common with other +audio drivers such as described in the <a href="driver7.htm">Radio +CHU Audio Demodulator/Decoder</a> and the <a href="driver36.htm"> +Radio WWV/H Audio Demodulator/Decoder</a> pages. They include +automatic gain control (AGC), selectable audio codec port and +signal monitoring capabilities. For a discussion of these common +features, as well as a guide to hookup, debugging and monitoring, +see the <a href="audio.htm">Reference Clock Audio Drivers</a> +page.</p> + +<p>The IRIG signal format uses an amplitude-modulated carrier with +pulse-width modulated data bits. For IRIG-B, the carrier frequency +is 1000 Hz and bit rate 100 b/s; for IRIG-E, the carrier frequenchy +is 100 Hz and bit rate 10 b/s. While IRIG-B provides the best +accuracy, generally within a few tens of microseconds relative to +IRIG time, it can also generate a significant load on the processor +with older workstations. Generally, the accuracy with IRIG-E is +about ten times worse than IRIG-B, but the processor load is ten +times less.</p> + +<p>The program processes 8000-Hz mu-law companded samples using +separate signal filters for IRIG-B and IRIG-E, a comb filter, +envelope detector and automatic threshold corrector. Cycle +crossings relative to the corrected slice level determine the width +of each pulse and its value - zero, one or position identifier. The +data encode 20 BCD digits which determine the second, minute, hour +and day of the year and sometimes the year and synchronization +condition. The comb filter exponentially averages the corresponding +samples of successive baud intervals in order to reliably identify +the reference carrier cycle. A type-II phase-lock loop (PLL) +performs additional integration and interpolation to accurately +determine the zero crossing of that cycle, which determines the +reference timestamp. A pulse-width discriminator demodulates the +data pulses, which are then encoded as the BCD digits of the +timecode. The timecode and reference timestamp are updated once +each second with IRIG-B (ten seconds with IRIG-E) and local clock +offset samples saved for later processing. At poll intervals of 64 +s, the saved samples are processed by a trimmed-mean filter and +used to update the system clock.</p> + +<p>Infinite impulse response (IIR) filters are used with both +IRIG-B and IRIG-E formats. An 800-Hz highpass filter is used for +IRIG-B and a 130-Hz lowpass filter for IRIG-E. These are intended +for use with noisy signals, such as might be received over a +telephone line or radio circuit, or when interfering signals may be +present in the audio passband. The driver determines which IRIG +format is in use by sampling the amplitude of each filter output +and selecting the one with maximum signal. An automatic gain +control feature provides protection against overdriven or +underdriven input signal amplitudes. It is designed to maintain +adequate demodulator signal amplitude while avoiding occasional +noise spikes. In order to assure reliable capture, the decompanded +input signal amplitude must be greater than 100 units and the codec +sample frequency error less than 250 PPM (.025 percent).</p> + +<p>The program performs a number of error checks to protect against +overdriven or underdriven input signal levels, incorrect signal +format or improper hardware configuration. Specifically, if any of +the following errors occur for a timecode, the data are rejected. Secifically, if any of the following errors occur for a time -measurement, the data are rejected. +measurement, the data are rejected.</p> -<OL> +<ol> +<li>The peak carrier amplitude is less than 100 units. This usually +means dead IRIG signal source, broken cable or wrong input +port.</li> -<LI>The peak carrier amplitude is less than 100 units. This usually -means dead IRIG signal source, broken cable or wrong input port.</LI> +<li>The frequency error is greater than ±250 PPM (.025 +percent). This usually means broken codec hardware or wrong codec +configuration.</li> -<LI>The frequency error is greater than ±250 PPM (.025 percent). -This usually means broken codec hardware or wrong codec -configuration.</LI> +<li>The modulation index is less than 0.5. This usually means +overdriven IRIG signal or wrong IRIG format.</li> -<LI>The modulation index is less than 0.5. This usually means overdriven -IRIG signal or wrong IRIG format.</LI> +<li>A frame synchronization error has occured. This usually means +wrong IRIG signal format or the IRIG signal source has lost +synchronization (signature control).</li> -<LI>A frame synchronization error has occured. This usually means wrong -IRIG signal format or the IRIG signal source has lost synchronization -(signature control).</LI> +<li>A data decoding error has occured. This usually means wrong +IRIG signal format.</li> -<LI>A data decoding error has occured. This usually means wrong IRIG -signal format.</LI> +<li>The current second of the day is not exactly one greater than +the previous one. This usually means a very noisy IRIG signal or +insufficient CPU resources.</li> -<LI>The current second of the day is not exactly one greater than the -previous one. This usually means a very noisy IRIG signal or -insufficient CPU resources.</LI> +<li>An audio codec error (overrun) occured. This usually means +insufficient CPU resources, as sometimes happens with Sun SPARC +IPCs when doing something useful.</li> +</ol> -<LI>An audio codec error (overrun) occured. This usually means -insufficient CPU resources, as sometimes happens with Sun SPARC IPCs -when doing something useful.</LI> +Note that additional checks are done elsewhere in the reference +clock interface routines. -</OL> +<p>Unlike other drivers, which can have multiple instantiations, +this one supports only one. It does not seem likely that more than +one audio codec would be useful in a single machine. More than one +would probably chew up too much CPU time anyway.</p> -Note that additional checks are done elsewhere in the reference clock -interface routines. +<h4>IRIG-B Timecode Format</h4> -<P>Unlike other drivers, which can have multiple instantiations, this -one supports only one. It does not seem likely that more than one audio -codec would be useful in a single machine. More than one would probably -chew up too much CPU time anyway. +The 100 elements of the IRIG timecode are numbered from 0 through +99. Position identifiers occur at elements 0, 9, 19 and every ten +thereafter to 99. The control function (CF) elements begin at +element 50 (CF 1) and extend to element 78 (CF 27). The +straight-binary-seconds (SBS) field, which encodes the seconds of +the UTC day, begins at element 80 (CF 28) and extends to element 97 +(CF 44). The encoding of elements 50 (CF 1) through 78 (CF 27) is +device dependent. This driver presently decodes the CF elements, +but does nothing with them. -<H4>IRIG-B Timecode Format</H4> -The 100 elements of the IRIG timecode are numbered from 0 through 99. -Position identifiers occur at elements 0, 9, 19 and every ten thereafter -to 99. The control function (CF) elements begin at element 50 (CF 1) and -extend to element 78 (CF 27). The straight-binary-seconds (SBS) field, -which encodes the seconds of the UTC day, begins at element 80 (CF 28) -and extends to element 97 (CF 44). The encoding of elements 50 (CF 1) -through 78 (CF 27) is device dependent. This driver presently decodes -the CF elements, but does nothing with them. - -<P>Where feasible, the IRIG signal source should be operated with +<p>Where feasible, the IRIG signal source should be operated with signature control so that, if the signal is lost or mutilated, the source produces an unmodulated signal, rather than possibly random -digits. The driver will automatically reject the data and declare itself -unsynchronized in this case. Some devices, in particular Spectracom -radio/satellite clocks, provide additional year and status indication in -the format: +digits. The driver will automatically reject the data and declare +itself unsynchronized in this case. Some devices, in particular +Spectracom radio/satellite clocks, provide additional year and +status indication in the format:</p> -<PRE> Element CF Function +<pre> + Element CF Function ------------------------------------- 55 6 time sync status 60-63 10-13 BCD year units 65-68 15-18 BCD year tens -</PRE> +</pre> + +Other devices set these elements to zero. + +<h4>Performance</h4> + +The mu-law companded data format allows considerable latitude in +signal levels; however, an automatic gain control (AGC) function is +implemented to further compensate for varying input signal levels +and to avoid signal distortion. For proper operation, the IRIG +signal source should be configured for analog signal levels, NOT +digital TTL levels. + +<p>The accuracy of the system clock synchronized to the IRIG-B +source with this driver and the <tt>ntpd</tt> daemon is 10-20 <font +face="symbol">m</font>s with a Sun UltraSPARC II and maybe twice +that with a Sun SPARC IPC. The processor resources consumed by the +daemon can be significant, ranging from about 1.2 percent on the +faster UltraSPARC II to 38 percent on the slower SPARC IPC. +However, the overall timing accuracy is limited by the resolution +and stability of the CPU clock oscillator and the interval between +clock corrections, which is 64 s with this driver. This +performance, while probably the best that can be achieved by the +daemon itself, can be improved with assist from the PPS discipline +as described elsewhere in the documentation.</p> + +<h4>Monitor Data</h4> + +The timecode format used for debugging and data recording includes +data helpful in diagnosing problems with the IRIG signal and codec +connections. With debugging enabled (-d on the ntpd command line), +the driver produces one line for each timecode in the following +format: -Other devices set these elements to zero. +<p><tt>00 1 98 23 19:26:52 721 143 0.694 47 20 0.083 66.5 +3094572411.00027</tt></p> -<H4>Performance</H4> +<p>The first field containes the error flags in hex, where the hex +bits are interpreted as below. This is followed by the IRIG status +indicator, year of century, day of year and time of day. The status +indicator and year are not produced by some IRIG devices. Following +these fields are the signal amplitude (0-8100), codec gain (0-255), +field phase (0-79), time constant (2-20), modulation index (0-1), +carrier phase error (0±0.5) and carrier frequency error +(PPM). The last field is the on-time timestamp in NTP format. The +fraction part is a good indicator of how well the driver is doing. +With an UltrSPARC 30, this is normally within a few tens of +microseconds relative to the IRIG-B signal and within a few hundred +microseconds with IRIG-E.</p> -The mu-law companded data format allows considerable latitude in signal -levels; however, an automatic gain control (AGC) function is implemented -to further compensate for varying input signal levels and to avoid -signal distortion. For proper operation, the IRIG signal source should -be configured for analog signal levels, NOT digital TTL levels. +<h4>Fudge Factors</h4> -<P>The accuracy of the system clock synchronized to the IRIG-B source -with this driver and the <TT>ntpd</TT> daemon is 10-20 <font -face=symbol>m</font>s with a Sun UltraSPARC II and maybe twice that with -a Sun SPARC IPC. The processor resources consumed by the daemon can be -significant, ranging from about 1.2 percent on the faster UltraSPARC II -to 38 percent on the slower SPARC IPC. However, the overall timing -accuracy is limited by the resolution and stability of the CPU clock -oscillator and the interval between clock corrections, which is 64 s -with this driver. This performance, while probably the best that can be -achieved by the daemon itself, can be improved with assist from the PPS -discipline as described elsewhere in the documentation. +<dl> +<dt><tt>time1 <i>time</i></tt></dt> -<H4>Monitor Data</H4> +<dd>Specifies the time offset calibration factor, in seconds and +fraction, with default 0.0.</dd> -The timecode format used for debugging and data recording includes data -helpful in diagnosing problems with the IRIG signal and codec -connections. With debugging enabled (-d on the ntpd command line), the -driver produces one line for each timecode in the following format: +<dt><tt>time2 <i>time</i></tt></dt> -<p><tt>00 1 98 23 19:26:52 721 143 0.694 47 20 0.083 66.5 -3094572411.00027</tt> +<dd>Not used by this driver.</dd> + +<dt><tt>stratum <i>number</i></tt></dt> + +<dd>Specifies the driver stratum, in decimal from 0 to 15, with +default 0.</dd> + +<dt><tt>refid <i>string</i></tt></dt> -<p>The first field containes the error flags in hex, where the hex bits -are interpreted as below. This is followed by the IRIG status indicator, -year of century, day of year and time of day. The status indicator and -year are not produced by some IRIG devices. Following these fields are -the signal amplitude (0-8100), codec gain (0-255), field phase (0-79), -time constant (2-20), modulation index (0-1), carrier phase error -(0±0.5) and carrier frequency error (PPM). The last field is the -on-time timestamp in NTP format. The fraction part is a good indicator -of how well the driver is doing. With an UltrSPARC 30, this is normally -within a few tens of microseconds relative to the IRIG-B signal and -within a few hundred microseconds with IRIG-E. +<dd>Specifies the driver reference identifier, an ASCII string from +one to four characters, with default <tt>IRIG</tt>.</dd> -<H4>Fudge Factors</H4> +<dt><tt>flag1 0 | 1</tt></dt> -<DL> +<dd>Not used by this driver.</dd> -<DT><TT>time1 <I>time</I></TT></DT> -<DD>Specifies the time offset calibration factor, in seconds and -fraction, with default 0.0.</DD> +<dt><tt>flag2 0 | 1</tt></dt> -<DT><TT>time2 <I>time</I></TT></DT> -<DD>Not used by this driver.</DD> +<dd>Specifies the microphone port if set to zero or the line-in +port if set to one. It does not seem useful to specify the compact +disc player port.</dd> -<DT><TT>stratum <I>number</I></TT></DT> -<DD>Specifies the driver stratum, in decimal from 0 to 15, with default -0.</DD> +<dt><tt>flag3 0 | 1</tt></dt> -<DT><TT>refid <I>string</I></TT></DT> -<DD>Specifies the driver reference identifier, an ASCII string from one -to four characters, with default <TT>IRIG</TT>.</DD> +<dd>Enables audio monitoring of the input signal. For this purpose, +the speaker volume must be set before the driver is started.</dd> -<DT><TT>flag1 0 | 1</TT></DT> -<DD>Not used by this driver.</DD> +<dt><tt>flag4 0 | 1</tt></dt> -<DT><TT>flag2 0 | 1</TT></DT> -<DD>Specifies the microphone port if set to zero or the line-in port if -set to one. It does not seem useful to specify the compact disc player -port.</DD> +<dd>Enable verbose <tt>clockstats</tt> recording if set.</dd> +</dl> -<DT><TT>flag3 0 | 1</TT></DT> -<DD>Enables audio monitoring of the input signal. For this purpose, the -speaker volume must be set before the driver is started.</DD> +<h4>Additional Information</h4> -<DT><TT>flag4 0 | 1</TT></DT> -<DD>Enable verbose <TT>clockstats</TT> recording if set.</DD> -</DL> +<a href="refclock.htm">Reference Clock Drivers</a> <br> +<a href="audio.htm">Reference Clock Audio Drivers</a> -<H4>Additional Information</H4> +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> -<A HREF="refclock.htm">Reference Clock Drivers</A> -<br><A HREF="audio.htm">Reference Clock Audio Drivers</A> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/driver7.htm b/contrib/ntp/html/driver7.htm index 5995072..029ac04 100644 --- a/contrib/ntp/html/driver7.htm +++ b/contrib/ntp/html/driver7.htm @@ -1,362 +1,397 @@ -<html><head><title> -Radio CHU Audio Demodulator/Decoder -</title></head><body><h3> -Radio CHU Audio Demodulator/Decoder -</h3><hr> - +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Radio CHU Audio Demodulator/Decoder</title> +</head> +<body> +<h3>Radio CHU Audio Demodulator/Decoder</h3> + +<hr> <h4>Synopsis</h4> -Address: 127.127.7.<I>u</I> -<br>Reference ID: <tt>CHU</tt> -<br>Driver ID: <tt>CHU</tt> -<br>Modem Port: <tt>/dev/chu<I>u</I></tt>; 300 baud, 8-bits, no parity -<br>Autotune Port: <tt>/dev/icom</tt>; 9600 baud, 8-bits, no parity -<br>Audio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt> +Address: 127.127.7.<i>u</i> <br> +Reference ID: <tt>CHU</tt> <br> +Driver ID: <tt>CHU</tt> <br> +Modem Port: <tt>/dev/chu<i>u</i></tt>; 300 baud, 8-bits, no parity +<br> +Autotune Port: <tt>/dev/icom</tt>; 1200/9600 baud, 8-bits, no +parity <br> +Audio Device: <tt>/dev/chu_audio</tt> and <tt>/dev/audioctl</tt> <h4>Description</h4> -This driver synchronizes the computer time using data encoded in radio -transmissions from Canadian time/frequency station CHU in Ottawa, -Ontario. Transmissions are made continuously on 3330 kHz, 7335 kHz and -14670 kHz in upper sideband, compatible AM mode. An ordinary shortwave -receiver can be tuned manually to one of these frequencies or, in the -case of ICOM receivers, the receiver can be tuned automatically as -propagation conditions change throughout the day and night. The -performance of this driver when tracking the station is ordinarily -better than 1 ms in time with frequency drift less than 0.5 PPM when not -tracking the station. - -<p>While there are currently no known commercial CHU receivers, a simple -but effective receiver/demodulator can be constructed from an ordinary -shortwave receiver and Bell 103 compatible, 300-b/s modem or modem chip, -as described in the <a href=pps.htm>Pulse-per-second (PPS) Signal -Interfacing</a> page. The driver can be compiled to use a modem to -receive the radio signal and demodulate the data. Alternatively, the -driver can be compiled to use the audio codec of the Sun workstation or -another with compatible audio interface. In the latter case, the driver -implements the modem using DSP routines, so the radio can be connected -directly to either the microphone on line input port. - -<p>The driver replaces an earlier one built by Dennis Ferguson in 1988. -The earlier driver required a special line discipline which preprocessed -the signal in order to improve accuracy and avoid errors. The new driver -includes more powerful algorithms implemented directly in the driver and -requires no line discipline. It decodes the data using a -maximum-likelihood technique which exploits the considerable degree of -redundancy available to maximize accuracy and minimize errors. - -<p>This driver incorporates several features in common with other audio -drivers such as described in the <a href=driver36.htm>Radio WWV/H Audio -Demodulator/Decoder</a> and the <a href=driver6.htm>IRIG Audio -Decoder</a> pages. They include automatic gain control (AGC), selectable -audio codec port and signal monitoring capabilities. For a discussion of -these common features, as well as a guide to hookup, debugging and -monitoring, see the <a href=audio.htm>Reference Clock Audio Drivers</a> -page. +<p>This driver synchronizes the computer time using data encoded in +radio transmissions from Canadian time/frequency station CHU in +Ottawa, Ontario. It replaces an earlier one, built by Dennis +Ferguson in 1988, which required a special line discipline to +preprocessed the signal. The new driver includes more powerful +algorithms implemented directly in the driver and requires no +preprocessing.</p> + +<p>CHU transmissions are made continuously on 3330 kHz, 7335 kHz +and 14670 kHz in upper sideband, compatible AM mode. An ordinary +shortwave receiver can be tuned manually to one of these +frequencies or, in the case of ICOM receivers, the receiver can be +tuned automatically as propagation conditions change throughout the +day and night. The performance of this driver when tracking the +station is ordinarily better than 1 ms in time with frequency drift +less than 0.5 PPM when not tracking the station.</p> + +<p>While there are currently no known commercial CHU receivers, a +simple but effective receiver/demodulator can be constructed from +an ordinary shortwave receiver and Bell 103 compatible, 300-b/s +modem or modem chip, as described in the <a href="gadget.htm"> +Gadget Box PPS Level Converter and CHU Modem</a> page. The driver +can use the modem to receive the radio signal and demodulate the +data or, if available, the driver can use the audio codec of the +Sun workstation or another with compatible audio interface. In the +latter case, the driver implements the modem using DSP routines, so +the radio can be connected directly to either the microphone on +line input port.</p> + +<p>This driver incorporates several features in common with other +audio drivers such as described in the <a href="driver36.htm">Radio +WWV/H Audio Demodulator/Decoder</a> and the <a href="driver6.htm"> +IRIG Audio Decoder</a> pages. They include automatic gain control +(AGC), selectable audio codec port and signal monitoring +capabilities. For a discussion of these common features, as well as +a guide to hookup, debugging and monitoring, see the <a href= +"audio.htm">Reference Clock Audio Drivers</a> page.</p> <p>Ordinarily, the driver poll interval is set to 14 (about 4.5 h), -although this can be changed with configuration commands. As long as the -clock is set or verified at least once during this interval, the NTP -algorithms will consider the source reachable and selectable to -discipline the system clock. However, if this does not happen for eight -poll intervals, the algorithms will consider the source unreachable and -some other source will be chosen (if available) to discipline the system -clock. - -<p>The decoding algorithms take advantage of all the redundancy -available in each broadcast message or burst. In each burst described in -the next section, every character is sent twice and, in the case of -format A bursts, the burst is sent eight times every minute. In the case -of format B bursts, which are sent once each minute, the burst is -considered correct only if every character matches its repetition in the -burst. In the case of format A messages, a majority decoder requires at -least six repetitions for each digit in the timecode and more than -half of the repetitions decode to the same digit. Every character in -every burst provides an independent timestamp upon arrival with a -potential total of over 60 timestamps for each minute. - -<p>A timecode in the format described below is assembled when all bursts -have been received in the minute. The timecode is considered valid and -the clock set when at least one valid format B burst has been decoded -and the above requirements are met. The <tt>yyyy</tt> year field in the -timecode indicates whether a valid format B burst has been received. -Upon startup, this field is initialized at zero; when a valid format B -burst is received, it will be set to the correct Gregorian year. The -<tt>q</tt> quality character field in the timecode indicates whether a -valid timecode has been determined. If any of the high order three bits -of this character are set, the timecode is invalid. +although this can be changed with configuration commands. As long +as the clock is set or verified at least once during this interval, +the NTP algorithms will consider the source reachable and +selectable to discipline the system clock. However, if this does +not happen for eight poll intervals, the algorithms will consider +the source unreachable and some other source will be chosen (if +available) to discipline the system clock.</p> + +<p>The decoding algorithms process the data using +maximum-likelihood techniques which exploit the considerable degree +of redundancy available in each broadcast message or burst. As +described below, every character is sent twice and, in the case of +format A bursts, the burst is sent eight times every minute. In the +case of format B bursts, which are sent once each minute, the burst +is considered correct only if every character matches its +repetition in the burst. In the case of format A messages, a +majority decoder requires at least six repetitions for each digit +in the timecode and more than half of the repetitions decode to the +same digit. Every character in every burst provides an independent +timestamp upon arrival with a potential total of over 60 timestamps +for each minute.</p> + +<p>A timecode in the format described below is assembled when all +bursts have been received in the minute. The timecode is considered +valid and the clock set when at least one valid format B burst has +been decoded and the above requirements are met. The <tt>yyyy</tt> +year field in the timecode indicates whether a valid format B burst +has been received. Upon startup, this field is initialized at zero; +when a valid format B burst is received, it is set to the current +Gregorian year. The <tt>q</tt> quality character field in the +timecode indicates whether a valid timecode has been determined. If +any of the high order three bits of this character are set, the +timecode is invalid.</p> <p>Once the clock has been set for the first time, it will appear -reachable and selectable to discipline the system clock, even if the -broadcast signal is lost. Since the signals are almost always available -during some period of the day and the NTP clock discipline algorithms -are designed to work well even in this case, it is unlikely that the -system clock could drift more than a few tens of milliseconds during -periods of signal loss. To protect against this most unlikely situation, -if after four days with no signals, the clock is considered unset and -resumes the synchronization procedure from the beginning. - -<p>The last three fields in the timecode are useful in assessing the -quality of the radio channel during the most recent minute bursts were -received. The <tt>bcnt</tt> field shows the number of format A bursts in -the range 1-8. The <tt>dist</tt> field shows the majority decoder -distance, or the minimum number of sample repetitions for each digit of -the timecode in the range 0-16. The <tt>tsmp</tt> field shows the number -of timestamps determined in the range 0-60. For a valid timecode, -<tt>bcnt</tt> must be at least 3, <tt>dist</tt> must be greater than -<tt>bcnt</tt> and <tt>tsmp</tt> must be at least 20. +reachable and selectable to discipline the system clock, even if +the broadcast signal is lost. Since the signals are almost always +available during some period of the day and the NTP clock +discipline algorithms are designed to work well even in this case, +it is unlikely that the system clock could drift more than a few +tens of milliseconds during periods of signal loss. To protect +against this most unlikely situation, if after four days with no +signals, the clock is considered unset and resumes the +synchronization procedure from the beginning.</p> + +<p>The last three fields in the timecode are useful in assessing +the quality of the radio channel during the most recent minute +bursts were received. The <tt>bcnt</tt> field shows the number of +format A bursts in the range 1-8. The <tt>dist</tt> field shows the +majority decoder distance, or the minimum number of sample +repetitions for each digit of the timecode in the range 0-16. The +<tt>tsmp</tt> field shows the number of timestamps determined in +the range 0-60. For a valid timecode, <tt>bcnt</tt> must be at +least 3, <tt>dist</tt> must be greater than <tt>bcnt</tt> and <tt> +tsmp</tt> must be at least 20.</p> <h4>Program Operation</h4> <p>The program consists of four major parts: the DSP modem, maximum -likelihood UART, burst assembler and majority decoder. The DSP modem -demodulates Bell 103 modem answer-frequency signals; that is, frequency- -shift keyed (FSK) tones of 2225 Hz (mark) and 2025 Hz (space). This is -done using a 4th-order IIR filter and limiter/discriminator with 500-Hz -bandpass centered on 2125 Hz and followed by a FIR raised-cosine lowpass -filter optimized for the 300-b/s data rate. Alternately, the driver can -be compiled to delete the modem and input 300 b/s data directly from an -external modem via a serial port. +likelihood UART, burst assembler and majority decoder. The DSP +modem demodulates Bell 103 modem answer-frequency signals; that is, +frequency-shift keyed (FSK) tones of 2225 Hz (mark) and 2025 Hz +(space). This is done using a 4th-order IIR filter and +limiter/discriminator with 500-Hz bandpass centered on 2125 Hz and +followed by a FIR raised-cosine lowpass filter optimized for the +300-b/s data rate. Alternately, the driver can be compiled to +delete the modem and input 300 b/s data directly from an external +modem via a serial port.</p> <p>The maximum likelihood UART is implemented using a set of eight -11-stage shift registers, one for each of eight phases of the 300-b/s -bit clock. At each phase a new baseband signal value from the DSP modem -is shifted into the corresponding register and the maximum and minimum -over all 11 samples computed. This establishes a slice level midway -between the maximum and minimum over all stages. For each stage, a -signal level above this level is a mark (1) and below is a space (0). A -quality metric is calculated for each register with respect to the slice -level and the a-priori signal consisting of a mark bit (previous stop -bit), space (start) bit, eight arbitrary information bits and the first -of the two mark (stop) bits. -<p>The shift registers are processed in round-robin order as each modem -value arrives until one of them shows a valid framing pattern consisting -of a mark bit, space bit, eight arbitrary data bits and a mark bit. When -found, the data bits from the register with the best metric is chosen as -the maximum likelihood character and the UART begins to process the next -character. +11-stage shift registers, one for each of eight phases of the +300-b/s bit clock. At each phase a new baseband signal value from +the DSP modem is shifted into the corresponding register and the +maximum and minimum over all 11 samples computed. This establishes +a slice level midway between the maximum and minimum over all +stages. For each stage, a signal level above this level is a mark +(1) and below is a space (0). A quality metric is calculated for +each register with respect to the slice level and the a-priori +signal consisting of a mark bit (previous stop bit), space (start) +bit, eight arbitrary information bits and the first of the two mark +(stop) bits.</p> + +<p>The shift registers are processed in round-robin order as each +modem value arrives until one of them shows a valid framing pattern +consisting of a mark bit, space bit, eight arbitrary data bits and +a mark bit. When found, the data bits from the register with the +best metric is chosen as the maximum likelihood character and the +UART begins to process the next character.</p> <p>The burst assembler processes characters either from the maximum -likelihood UART or directly from the serial port as configured. A burst -begins when a character is received and is processed after a timeout -interval when no characters are received. If the interval between -characters is greater than two characters, but less than the timeout -interval, the burst is rejected as a runt and a new burst begun. As each -character is received, a timestamp is captured and saved for later -processing. +likelihood UART or directly from the serial port as configured. A +burst begins when a character is received and is processed after a +timeout interval when no characters are received. If the interval +between characters is greater than two characters, but less than +the timeout interval, the burst is rejected as a runt and a new +burst begun. As each character is received, a timestamp is captured +and saved for later processing.</p> <p>A valid burst consists of ten characters in two replicated five-character blocks. A format B block contains the year and other -information in ten hexadecimal digits. A format A block contains the -timecode in ten decimal digits, the first of which is a framing code -(6). The burst assembler must deal with cases where the first character -of a format A burst is lost or is noise. This is done using the framing -code to correct the phase, either one character early or one character -late. - -<p>The burst distance is incremented by one for each bit in the first -block that matches the corresponding bit in the second block and -decremented by one otherwise. In a format B burst the second block is -bit-inverted relative to the first, so a perfect burst of five 8-bit -characters has distance -40. In a format A block the two blocks are -identical, so a perfect burst has distance +40. Format B bursts must be -perfect to be acceptable; however, format A bursts, which are further -processed by the majority decoder, are acceptable if the distance is at -least 28. - -<p>Each minute of transmission includes eight format A bursts containing -two timecodes for each second from 31 through 39. The majority decoder -uses a decoding matrix of ten rows, one for each digit position in the -timecode, and 16 columns, one for each 4-bit code combination that might -be decoded at that position. In order to use the character timestamps, -it is necessary to reliably determine the second number of each burst. -In a valid burst, the last digit of the two timecodes in the block must -match and the value must be in the range 2-9 and greater than in the -previous burst. - -<p>As each hex digit of a valid burst is processed, the value at the row -corresponding to the digit position in the timecode and column -corresponding to the code found at that position is incremented. At the -end of each minute of transmission, each row of the decoding matrix -encodes the number of occurrences of each code found at the -corresponding position of the timecode. However, the first digit -(framing code) is always 6, the ninth (second tens) is always 3 and the -last (second units) changes for each burst, so are not used. - -<p>The maximum over all occurrences at each timecode digit position is -the distance for that position and the corresponding code is the maximum -likelihood candidate. If the distance is zero, the decoder assumes a -miss; if the distance is not more than half the total number of -occurrences, the decoder assumes a soft error; if two different codes -with the same distance are found, the decoder assumes a hard error. In -all these cases the decoder encodes a non-decimal character which will -later cause a format error when the timecode is reformatted. The -decoding distance is defined as the minimum distance over the first nine -digits; the tenth digit varies over the seconds and is uncounted. +information in ten hexadecimal digits. A format A block contains +the timecode in ten decimal digits, the first of which is a framing +code (6). The burst assembler must deal with cases where the first +character of a format A burst is lost or is noise. This is done +using the framing code to correct the phase, either one character +early or one character late.</p> + +<p>The burst distance is incremented by one for each bit in the +first block that matches the corresponding bit in the second block +and decremented by one otherwise. In a format B burst the second +block is bit-inverted relative to the first, so a perfect burst of +five 8-bit characters has distance -40. In a format A block the two +blocks are identical, so a perfect burst has distance +40. Format B +bursts must be perfect to be acceptable; however, format A bursts, +which are further processed by the majority decoder, are acceptable +if the distance is at least 28.</p> + +<p>Each minute of transmission includes eight format A bursts +containing two timecodes for each second from 31 through 39. The +majority decoder uses a decoding matrix of ten rows, one for each +digit position in the timecode, and 16 columns, one for each 4-bit +code combination that might be decoded at that position. In order +to use the character timestamps, it is necessary to reliably +determine the second number of each burst. In a valid burst, the +last digit of the two timecodes in the block must match and the +value must be in the range 2-9 and greater than in the previous +burst.</p> + +<p>As each hex digit of a valid burst is processed, the value at +the row corresponding to the digit position in the timecode and +column corresponding to the code found at that position is +incremented. At the end of each minute of transmission, each row of +the decoding matrix encodes the number of occurrences of each code +found at the corresponding position of the timecode. However, the +first digit (framing code) is always 6, the ninth (second tens) is +always 3 and the last (second units) changes for each burst, so are +not used.</p> + +<p>The maximum over all occurrences at each timecode digit position +is the distance for that position and the corresponding code is the +maximum likelihood candidate. If the distance is zero, the decoder +assumes a miss; if the distance is not more than half the total +number of occurrences, the decoder assumes a soft error; if two +different codes with the same distance are found, the decoder +assumes a hard error. In all these cases the decoder encodes a +non-decimal character which will later cause a format error when +the timecode is reformatted. The decoding distance is defined as +the minimum distance over the first nine digits; the tenth digit +varies over the seconds and is uncounted.</p> <p>The result of the majority decoder is a nine-digit timecode representing the maximum likelihood candidate for the transmitted -timecode in that minute. Note that the second and fraction within the -minute are always zero and that the actual reference point to calculate -timestamp offsets is backdated to the first second of the minute. At -this point the timecode block is reformatted and the year, days, hours -and minutes extracted along with other information from the format B -burst, including DST state, DUT1 correction and leap warning. The -reformatting operation checks the timecode for invalid code combinations -that might have been left by the majority decoder and rejects the entire -timecode if found. +timecode in that minute. Note that the second and fraction within +the minute are always zero and that the actual reference point to +calculate timestamp offsets is backdated to the first second of the +minute. At this point the timecode block is reformatted and the +year, days, hours and minutes extracted along with other +information from the format B burst, including DST state, DUT1 +correction and leap warning. The reformatting operation checks the +timecode for invalid code combinations that might have been left by +the majority decoder and rejects the entire timecode if found.</p> <p>If the timecode is valid, it is passed to the reference clock -interface along with the backdated timestamp offsets accumulated over -the minute. A perfect set of nine bursts could generate as many as 90 -timestamps, but the maximum the interface can handle is 60. These are -processed by the interface using a median filter and trimmed-mean -average, so the resulting system clock correction is usually much better -than would otherwise be the case with radio noise, UART jitter and -occasional burst errors. +interface along with the backdated timestamp offsets accumulated +over the minute. A perfect set of nine bursts could generate as +many as 90 timestamps, but the maximum the interface can handle is +60. These are processed by the interface using a median filter and +trimmed-mean average, so the resulting system clock correction is +usually much better than would otherwise be the case with radio +noise, UART jitter and occasional burst errors.</p> <h4>Autotune</h4> -<p>The driver includes provisions to automatically tune the radio in -response to changing radio propagation conditions throughout the day and -night. The radio interface is compatible with the ICOM CI-V standard, -which is a bidirectional serial bus operating at TTL levels. The bus can -be connected to a standard serial port using a level converter such as -the CT-17. The serial port speed is presently compiled in the program, -but can be changed in the <tt>icom.h</tt> header file. - -<p>Each ICOM radio is assigned a unique 8-bit ID select code, usually -expressed in hex format. To activate the CI-V interface, the -<tt>mode</tt> keyword of the <tt>server</tt> configuration command -specifies a nonzero select code in decimal format. A table of ID select -codes for the known ICOM radios is given below. A missing <tt>mode</tt> -keyword or a zero argument leaves the interface disabled. The driver -will attempt to open the device <tt>/dev/icom</tt> and, if successful -will tune the radio to 3.330 MHz. If after five minutes at this -frequency not more than two format A bursts have been received for any -minute, the driver will tune to 7.335 MHz, then to 14.670 MHz, then -return to 3.330 MHz and continue in this cycle. - -<p>The driver is liberal in what it assumes of the configuration. If the -<tt>/dev/icom</tt> link is not present or the open fails or the CI-V bus -or radio is inoperative, the driver quietly gives up with no harm done. +<p>The driver includes provisions to automatically tune the radio +in response to changing radio propagation conditions throughout the +day and night. The radio interface is compatible with the ICOM CI-V +standard, which is a bidirectional serial bus operating at TTL +levels. The bus can be connected to a standard serial port using a +level converter such as the CT-17. The serial port speed is +presently compiled in the program, but can be changed in the <tt> +icom.h</tt> header file.</p> + +<p>Each ICOM radio is assigned a unique 8-bit ID select code, +usually expressed in hex format. To activate the CI-V interface, +the <tt>mode</tt> keyword of the <tt>server</tt> configuration +command specifies a nonzero select code in decimal format. A table +of ID select codes for the known ICOM radios is given below. Since +all ICOM select codes are less than 128, the high order bit of the +code is used by the driver to specify the baud rate. If this bit is +not set, the rate is 9600 bps for the newer radios; if set, the +rate is 1200 bps for the older radios. A missing <tt>mode</tt> +keyword or a zero argument leaves the interface disabled.</p> + +<p>If specified, the driver will attempt to open the device <tt> +/dev/icom</tt> and, if successful will tune the radio to 3.330 MHz. +If after five minutes at this frequency not more than two format A +bursts have been received for any minute, the driver will tune to +7.335 MHz, then to 14.670 MHz, then return to 3.330 MHz and +continue in this cycle. However, the driver is liberal in what it +assumes of the configuration. If the <tt>/dev/icom</tt> link is not +present or the open fails or the CI-V bus or radio is inoperative, +the driver quietly gives up with no harm done.</p> <h4>Radio Broadcast Format</h4> -<p>The CHU time broadcast includes an audio signal compatible with the -Bell 103 modem standard (mark = 2225 Hz, space = 2025 Hz). It consist of -nine, ten-character bursts transmitted at 300 b/s and beginning each -second from second 31 to second 39 of the minute. Each character -consists of eight data bits plus one start bit and two stop bits to -encode two hex digits. The burst data consist of five characters (ten -hex digits) followed by a repeat of these characters. In format A, the -characters are repeated in the same polarity; in format B, the -characters are repeated in the opposite polarity. - -<p>Format A bursts are sent at seconds 32 through 39 of the minute in -hex digits - -<p><tt>6dddhhmmss6dddhhmmss</tt> -<p>The first ten digits encode a frame marker (<tt>6</tt>) followed by -the day (<tt>ddd</tt>), hour (<tt>hh</tt>), minute (<tt>mm</tt>) and -second (<tt>ss</tt>). Since format A bursts are sent during the -third decade of seconds the tens digit of <tt>ss</tt> is always 3. The -driver uses this to determine correct burst synchronization. These -digits are then repeated with the same polarity. -<p>Format B bursts are sent at second 31 of the minute in hex digits - -<p><tt>xdyyyyttaaxdyyyyttaa</tt> +<p>The CHU time broadcast includes an audio signal compatible with +the Bell 103 modem standard (mark = 2225 Hz, space = 2025 Hz). It +consist of nine, ten-character bursts transmitted at 300 b/s and +beginning each second from second 31 to second 39 of the minute. +Each character consists of eight data bits plus one start bit and +two stop bits to encode two hex digits. The burst data consist of +five characters (ten hex digits) followed by a repeat of these +characters. In format A, the characters are repeated in the same +polarity; in format B, the characters are repeated in the opposite +polarity.</p> + +<p>Format A bursts are sent at seconds 32 through 39 of the minute +in hex digits</p> + +<p><tt>6dddhhmmss6dddhhmmss</tt></p> + +<p>The first ten digits encode a frame marker (<tt>6</tt>) followed +by the day (<tt>ddd</tt>), hour (<tt>hh</tt>), minute (<tt>mm</tt>) +and second (<tt>ss</tt>). Since format A bursts are sent during the +third decade of seconds the tens digit of <tt>ss</tt> is always 3. +The driver uses this to determine correct burst synchronization. +These digits are then repeated with the same polarity.</p> + +<p>Format B bursts are sent at second 31 of the minute in hex +digits</p> + +<p><tt>xdyyyyttaaxdyyyyttaa</tt></p> <p>The first ten digits encode a code (<tt>x</tt> described below) followed by the DUT1 (<tt>d</tt> in deciseconds), Gregorian year -(<tt>yyyy</tt>), difference TAI - UTC (<tt>tt</tt>) and daylight time -indicator (<tt>aa</tt>) peculiar to Canada. These digits are then -repeated with inverted polarity. +(<tt>yyyy</tt>), difference TAI - UTC (<tt>tt</tt>) and daylight +time indicator (<tt>aa</tt>) peculiar to Canada. These digits are +then repeated with inverted polarity.</p> -<p>The <tt>x</tt> is coded +<p>The <tt>x</tt> is coded</p> <dl> +<dt><tt>1</tt></dt> -<dt><tt>1</tt> -<dd>Sign of DUT (0 = +)/dd> +<dd>Sign of DUT (0 = +)/dd></dd> + +<dt><tt>2</tt></dt> -<dt><tt>2</tt> <dd>Leap second warning. One second will be added.</dd> -<dt><tt>4</tt> +<dt><tt>4</tt></dt> + <dd>Leap second warning. One second will be subtracted. This is not likely to happen in our universe.</dd> -<dt><tt>8</tt> -<dd>Even parity bit for this nibble.</dd> +<dt><tt>8</tt></dt> +<dd>Even parity bit for this nibble.</dd> </dl> <p>By design, the last stop bit of the last character in the burst coincides with 0.5 second. Since characters have 11 bits and are transmitted at 300 b/s, the last stop bit of the first character -coincides with 0.5 - 10 * 11/300 = 0.133 second. Depending on the UART, -character interrupts can vary somewhere between the beginning of bit 9 -and end of bit 11. These eccentricities can be corrected along with the -radio propagation delay using the <tt>fudge time1</tt> variable. +coincides with 0.5 - 10 * 11/300 = 0.133 second. Depending on the +UART, character interrupts can vary somewhere between the beginning +of bit 9 and end of bit 11. These eccentricities can be corrected +along with the radio propagation delay using the <tt>fudge +time1</tt> variable.</p> <h4>Debugging Aids</h4> <p>The most convenient way to track the program status is using the -<tt>ntpq</tt> program and the <tt>clockvar</tt> command. This displays -the last determined timecode and related status and error counters, even -when the program is not discipline the system clock. If the debugging -trace feature (<tt>-d</tt> on the <tt>ntpd</tt> command line)is enabled, -the program produces detailed status messages as it operates. If the -<tt>fudge flag 4</tt> is set, these messages are written to the -<tt>clockstats</tt> file. All messages produced by this driver have the -prefix <tt>chu</tt> for convenient filtering with the Unix <tt>grep</tt> -command. - -<p>With debugging enabled the driver produces messages in the following -formats: - -<p>A format <tt>chuA</tt> message is produced for each format A burst -received in seconds 32 through 39 of the minute: - -<p><tt>chuA n b s code</tt> - -<p>where <tt>n</tt> is the number of characters in the burst (0-11), -<tt>b</tt> the burst distance (0-40), <tt>s</tt> the synchronization -distance (0-40) and <tt>code</tt> the burst characters as received. Note -that the hex digits in each character are reversed and the last ten -digits inverted, so the burst -<p><tt>11 40 1091891300ef6e76ecff</tt> -<p>is interpreted as containing 11 characters with burst distance 40. -The nibble-swapped timecode shows DUT1 +0.1 second, year 1998 and TAI - -UTC 31 seconds. - -<p>A format <tt>chuB</tt> message is produced for each format B burst -received in second 31 of the minute: - -<p><tt>chuB n b f s m code</tt> - -<p>where <tt>n</tt> is the number of characters in the burst (0-11), -<tt>b</tt> the burst distance (0-40), <tt>f</tt> the field alignment (- -1, 0, 1), <tt>s</tt>the synchronization distance (0-16), <tt>m</tt>the -burst number (2-9) and <tt>code</tt> the burst characters as received. -Note that the hex digits in each character are reversed, so the burst - -<p><tt>10 38 0 16 9 06851292930685129293</tt> - -<p>is interpreted as containing 11 characters with burst distance 38, -field alignment 0, synchronization distance 16 and burst number 9. The -nibble-swapped timecode shows day 58, hour 21, minute 29 and second 39. +<tt>ntpq</tt> program and the <tt>clockvar</tt> command. This +displays the last determined timecode and related status and error +counters, even when the program is not discipline the system clock. +If the debugging trace feature (<tt>-d</tt> on the <tt>ntpd</tt> +command line)is enabled, the program produces detailed status +messages as it operates. If the <tt>fudge flag 4</tt> is set, these +messages are written to the <tt>clockstats</tt> file. All messages +produced by this driver have the prefix <tt>chu</tt> for convenient +filtering with the Unix <tt>grep</tt> command.</p> + +<p>With debugging enabled the driver produces messages in the +following formats:</p> + +<p>A format <tt>chuA</tt> message is produced for each format A +burst received in seconds 32 through 39 of the minute:</p> + +<p><tt>chuA n b s code</tt></p> + +<p>where <tt>n</tt> is the number of characters in the burst +(0-11), <tt>b</tt> the burst distance (0-40), <tt>s</tt> the +synchronization distance (0-40) and <tt>code</tt> the burst +characters as received. Note that the hex digits in each character +are reversed and the last ten digits inverted, so the burst</p> + +<p><tt>11 40 1091891300ef6e76ecff</tt></p> + +<p>is interpreted as containing 11 characters with burst distance +40. The nibble-swapped timecode shows DUT1 +0.1 second, year 1998 +and TAI -UTC 31 seconds.</p> + +<p>A format <tt>chuB</tt> message is produced for each format B +burst received in second 31 of the minute:</p> + +<p><tt>chuB n b f s m code</tt></p> + +<p>where <tt>n</tt> is the number of characters in the burst +(0-11), <tt>b</tt> the burst distance (0-40), <tt>f</tt> the field +alignment (-1, 0, 1), <tt>s</tt>the synchronization distance +(0-16), <tt>m</tt>the burst number (2-9) and <tt>code</tt> the +burst characters as received. Note that the hex digits in each +character are reversed, so the burst</p> + +<p><tt>10 38 0 16 9 06851292930685129293</tt></p> + +<p>is interpreted as containing 11 characters with burst distance +38, field alignment 0, synchronization distance 16 and burst number +9. The nibble-swapped timecode shows day 58, hour 21, minute 29 and +second 39.</p> <p>If the CI-V interface for ICOM radios is active, a debug level -greater than 1 will produce a trace of the CI-V command and response -messages. Interpretation of these messages requires knowledge of the -CI-V protocol, which is beyond the scope of this document. +greater than 1 will produce a trace of the CI-V command and +response messages. Interpretation of these messages requires +knowledge of the CI-V protocol, which is beyond the scope of this +document.</p> <h4>Monitor Data</h4> -When enabled by the <tt>filegen</tt> facility, every received timecode -is written to the <tt>clockstats</tt> file in the following format: +When enabled by the <tt>filegen</tt> facility, every received +timecode is written to the <tt>clockstats</tt> file in the +following format: <pre> sq yy ddd hh:mm:ss.fff ld dut lset agc rfrq bcnt dist tsmp @@ -380,84 +415,103 @@ is written to the <tt>clockstats</tt> file in the following format: tsmp timestamps captured </pre> -The fields beginning with <tt>year</tt> and extending through -<tt>dut</tt> are decoded from the received data and are in fixed-length +The fields beginning with <tt>year</tt> and extending through <tt> +dut</tt> are decoded from the received data and are in fixed-length format. The <tt>agc</tt> and <tt>lset</tt> fields, as well as the -following driver-dependent fields, are in variable-length format. +following driver-dependent fields, are in variable-length format. <dl> +<dt><tt>s</tt></dt> -<dt><tt>s</tt> -<dd>The sync indicator is initially <tt>?</tt> before the clock is set, -but turns to space when the clock is correctly set.</dd> +<dd>The sync indicator is initially <tt>?</tt> before the clock is +set, but turns to space when the clock is correctly set.</dd> -<dt><tt>q</tt> -<dd>The quality character is a four-bit hexadecimal code showing which -alarms have been raised during the most recent minute. Each bit is -associated with a specific alarm condition according to the following: +<dt><tt>q</tt></dt> + +<dd>The quality character is a four-bit hexadecimal code showing +which alarms have been raised during the most recent minute. Each +bit is associated with a specific alarm condition according to the +following: <dl> -<dt><tt>8</tt> -<dd>Decoder alarm. A majority of repetitions for at least one digit of -the timecode fails to agree. -</dd> +<dt><tt>8</tt></dt> + +<dd>Decoder alarm. A majority of repetitions for at least one digit +of the timecode fails to agree.</dd> -<dt><tt>4</tt> -<dd>Timestamp alarm. Fewer than 20 timestamps have been determined.</dd> +<dt><tt>4</tt></dt> + +<dd>Timestamp alarm. Fewer than 20 timestamps have been +determined.</dd> + +<dt><tt>2</tt></dt> -<dt><tt>2</tt> <dd>Format alarm. The majority timecode contains invalid bit combinations.</dd> -<dt><tt>1</tt> +<dt><tt>1</tt></dt> + <dd>Frame alarm. A framing or format error occurred on at least one burst during the minute.</dd> - </dl> -It is important to note that one or more of the above alarms does not -necessarily indicate a clock error, but only that the decoder has -detected a condition that may in future result in an error. +It is important to note that one or more of the above alarms does +not necessarily indicate a clock error, but only that the decoder +has detected a condition that may in future result in an +error.</dd> + +<dt><tt>yyyy ddd hh:mm:ss.fff</tt></dt> -<dt><tt>yyyy ddd hh:mm:ss.fff</tt></tt> <dd>The timecode format itself is self explanatory. Note that the -Gregorian year is decoded directly from the transmitted timecode.</dd> -<dt><tt>l</tt> -<dd>The leap second warning is normally space, but changes to <tt>L</tt> -if a leap second is to occur at the end of the month of June or -December.</dd> - -<dt><tt>d</tt> -<dd>The DST code for Canada encodes the state for all provinces.</dd> - -<dt><tt>dut</tt> -<dd>The DUT sign and magnitude shows the current UT1 offset relative to -the displayed UTC time, in deciseconds.</dd> - -<dt><tt>lset</tt> -<dd>Before the clock is set, the interval since last set is the number -of minutes since the program was started; after the clock is set, this -is number of minutes since the time was last verified relative to the -broadcast signal.</dd> - -<dt><tt>agc</tt> -<dd>The audio gain shows the current codec gain setting in the range 0 -to 255. Ordinarily, the receiver audio gain control or IRIG level -control should be set for a value midway in this range. - -<dt><tt>rfrq</tt> -<dd>The current radio frequency, if the CI-V interface is active, or 'X' -if not.</dd> - -<dt><tt>bcnt</tt> -<dd>The number of format A bursts received during the most recent minute -bursts were received.</dd> - -<dt><tt>dist</tt> +Gregorian year is decoded directly from the transmitted +timecode.</dd> + +<dt><tt>l</tt></dt> + +<dd>The leap second warning is normally space, but changes to <tt> +L</tt> if a leap second is to occur at the end of the month of June +or December.</dd> + +<dt><tt>d</tt></dt> + +<dd>The DST code for Canada encodes the state for all +provinces.</dd> + +<dt><tt>dut</tt></dt> + +<dd>The DUT sign and magnitude shows the current UT1 offset +relative to the displayed UTC time, in deciseconds.</dd> + +<dt><tt>lset</tt></dt> + +<dd>Before the clock is set, the interval since last set is the +number of minutes since the program was started; after the clock is +set, this is number of minutes since the time was last verified +relative to the broadcast signal.</dd> + +<dt><tt>agc</tt></dt> + +<dd>The audio gain shows the current codec gain setting in the +range 0 to 255. Ordinarily, the receiver audio gain control or IRIG +level control should be set for a value midway in this range.</dd> + +<dt><tt>rfrq</tt></dt> + +<dd>The current radio frequency, if the CI-V interface is active, +or 'X' if not.</dd> + +<dt><tt>bcnt</tt></dt> + +<dd>The number of format A bursts received during the most recent +minute bursts were received.</dd> + +<dt><tt>dist</tt></dt> + <dd>The minimum decoding distance determined during the most recent minute bursts were received.</dd> -<dt><tt>tsmp</tt> +<dt><tt>tsmp</tt></dt> + <dd>The number of timestamps determined during the most recent minute bursts were received.</dd> </dl> @@ -465,12 +519,11 @@ minute bursts were received.</dd> <h4>Modes</h4> <p>The <tt>mode</tt> keyword of the <tt>server</tt> configuration -command specifies the ICOM ID select code. A missing or zero argument -disables the CI-V interface. Following are the ID select codes for the -known radios. - -<p><table cols=6 width=100%> +command specifies the ICOM ID select code. A missing or zero +argument disables the CI-V interface. Following are the ID select +codes for the known radios.</p> +<table cols="6" width="100%"> <tr> <td>Radio</td> <td>Hex</td> @@ -542,50 +595,63 @@ known radios. <td>0x2a</td> <td>42</td> </tr> - </table> <h4>Fudge Factors</h4> <dl> +<dt><tt>time1 <i>time</i></tt></dt> + +<dd>Specifies the propagation delay for CHU (45:18N 75:45N), in +seconds and fraction, with default 0.0.</dd> -<dt><tt>time1 <I>time</I></tt></dt> -<dd>Specifies the propagation delay for CHU (45:18N 75:45N), in seconds -and fraction, with default 0.0.</dd> +<dt><tt>time2 <i>time</i></tt></dt> -<dt><tt>time2 <I>time</I></tt></dt> <dd>Not used by this driver.</dd> -<dt><tt>stratum <I>number</I></tt></dt> -<dd>Specifies the driver stratum, in decimal from 0 to 15, with default -0.</dd> +<dt><tt>stratum <i>number</i></tt></dt> -<dt><tt>refid <I>string</I></tt></dt> -<dd>Specifies the driver reference identifier, an ASCII string from one -to four characters, with default <tt>CHU</tt>.</dd> +<dd>Specifies the driver stratum, in decimal from 0 to 15, with +default 0.</dd> + +<dt><tt>refid <i>string</i></tt></dt> + +<dd>Specifies the driver reference identifier, an ASCII string from +one to four characters, with default <tt>CHU</tt>.</dd> <dt><tt>flag1 0 | 1</tt></dt> + <dd>Not used by this driver.</dd> <dt><tt>flag2 0 | 1</tt></dt> -<dd>When the audio driver is compiled, this flag selects the audio input -port, where 0 is the mike port (default) and 1 is the line-in port. It -does not seem useful to select the compact disc player port.</dd> + +<dd>When the audio driver is compiled, this flag selects the audio +input port, where 0 is the mike port (default) and 1 is the line-in +port. It does not seem useful to select the compact disc player +port.</dd> <dt><tt>flag3 0 | 1</tt></dt> + <dd>When the audio driver is compiled, this flag enables audio -monitoring of the input signal. For this purpose, the speaker volume -must be set before the driver is started.</dd> +monitoring of the input signal. For this purpose, the speaker +volume must be set before the driver is started.</dd> <dt><tt>flag4 0 | 1</tt></dt> -<dd>Enable verbose <tt>clockstats</tt> recording if set.</dd> +<dd>Enable verbose <tt>clockstats</tt> recording if set.</dd> </dl> <h4>Additional Information</h4> -<A HREF="refclock.htm">Reference Clock Drivers</A> -<br><A HREF="audio.htm">Reference Clock Audio Drivers</A> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<a href="refclock.htm">Reference Clock Drivers</a> <br> +<a href="audio.htm">Reference Clock Audio Drivers</a> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/driver9.htm b/contrib/ntp/html/driver9.htm index 8a11a02..def05f8 100644 --- a/contrib/ntp/html/driver9.htm +++ b/contrib/ntp/html/driver9.htm @@ -2,24 +2,21 @@ <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Magnavox MX4200 GPS Receiver -</TITLE> + <TITLE>Magnavox MX4200 GPS Receiver</TITLE> </HEAD> <BODY> -<H3> -Magnavox MX4200 GPS Receiver</H3> +<H3>Magnavox MX4200 GPS Receiver</H3> <HR> -<H4> -Synopsis</H4> +<H4>Synopsis</H4> Address: 127.127.9.<I>u</I> <BR>Reference ID: <TT>GPS</TT> <BR>Driver ID: <TT>GPS_MX4200</TT> <BR>Serial Port: <TT>/dev/gps<I>u</I></TT>; 4800 baud, 8-bits, no parity <BR>Features: <TT>ppsclock</TT> (required) -<H4> -Description</H4> + +<H4>Description</H4> This driver supports the Magnavox MX4200 Navigation Receiver adapted to precision timing applications. It requires the <TT>ppsclock</TT> line discipline or streams module described in the <A HREF="ldisc.htm">Line @@ -32,8 +29,9 @@ Interfacing</A> page. MX4200, MX4200D, and the 12-channel MX9212, MX9012R, MX9112. <P> -<A HREF="http://www.leica-gps.com/"> -<IMG SRC="pic/9400n.jpg" ALT="Leica MX9400N Navigator" ALIGN=LEFT></A> +<A HREF="http://www.leica-gps.com/"><IMG align=left HEIGHT=143 WIDTH=180 +SRC="pic/9400n.jpg" ALT="Leica MX9400N Navigator"></A> + <A HREF="http://www.leica-gps.com/">Leica Geosystems</A> acquired the Magnavox commercial GPS technology business in February of 1994. They now market and support former Magnavox GPS products such as the @@ -44,32 +42,30 @@ Leica MX9400N Navigator. <P> -<H4> -Operating Modes</H4> +<H4>Operating Modes</H4> This driver supports two modes of operation, static and mobile, controlled by clock flag 2. <P>In static mode (the default) the driver assumes that the GPS antenna is in a fixed location. The receiver is initially placed in a "Static, -3D Nav" mode, where latitude, longitude, elevation and time are calculated -for a fixed station. A DOP-weighted running average position is calculated -from this data. After 24 hours, the receiver is placed into a "Known Position" -mode, initialized with the calculated position, and then solves only for -time. +3D Nav" mode, where latitude, longitude, elevation and time are +calculated for a fixed station. An average position is calculated from +this data. After 24 hours, the receiver is placed into a "Known +Position" mode, initialized with the calculated position, and then +solves only for time. <P>In mobile mode, the driver assumes the GPS antenna is mounted on a moving platform such as a car, ship, or aircraft. The receiver is placed in "Dynamic, 3D Nav" mode and solves for position, altitude and time while moving. No position averaging is performed. -<H4> -Monitor Data</H4> + +<H4>Monitor Data</H4> The driver writes each timecode as received to the <TT>clockstats</TT> file. Documentation for the <CITE>NMEA-0183</CITE> proprietary sentences produced by the MX4200 can be found in <A HREF="mx4200data.htm">MX4200 Receiver Data Format</A>. -<H4> -Fudge Factors</H4> +<H4>Fudge Factors</H4> <DL> <DT> diff --git a/contrib/ntp/html/exec.htm b/contrib/ntp/html/exec.htm index 756d987..464b3af 100644 --- a/contrib/ntp/html/exec.htm +++ b/contrib/ntp/html/exec.htm @@ -1,292 +1,393 @@ -<html><head><title> -Executive Summary - Computer Network Time Synchronization -</title></head><body><H3> -Executive Summary - Computer Network Time Synchronization -</h3> - -<img align=left src=pic/alice12.gif> -from <i>Alice's Adventures in Wonderland</i>, by Lewis Carroll, -illustrations by Sir John Tenniel - -<p>The executive is the one on the left. - -<br clear=left><hr> - +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" &lt;html> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Executive Summary - Computer Network Time +Synchronization</title> +</head> +<body> +<h3>Executive Summary - Computer Network Time Synchronization</h3> + +<img align="left" src="pic/alice12.gif" alt="gif"><a href= +"pictures.htm">from <i>Alice's Adventures in Wonderland</i>, Lewis +Carroll</a> + +<p>The executive is the one on the left.<br clear="left"> +</p> + +<hr> <h4>Introduction</h4> -<p>The standard timescale used by most nations of the world is Universal -Coordinated Time (UTC), which is based on the Earth's rotation about its -axis, and the Gregorian Calendar, which is based on the Earth's rotation -about the Sun. The UTC timescale is disciplined with respect to -International Atomic Time (TAI) by inserting leap seconds at intervals -of about 18 months. UTC time is disseminated by various means, including -radio and satellite navigation systems, telephone modems and portable -clocks. - -<p>Special purpose receivers are available for many time-dissemination -services, including the Global Position System (GPS) and other services -operated by various national governments. For reasons of cost and -convenience, it is not possible to equip every computer with one of -these receivers. However, it is possible to equip some number of -computers acting as primary time servers to synchronize a much larger -number of secondary servers and clients connected by a common network. -In order to do this, a distributed network clock synchronization -protocol is required which can read a server clock, transmit the reading -to one or more clients and adjust each client clock as required. -Protocols that do this include the Network Time Protocol (NTP), Digital -Time Synchronization Protocol (DTSS) and others found in the literature -(See "Further Reading" at the end of this article.) +<p>The standard timescale used by most nations of the world is +Coordinated UniversalTime (UTC), which is based on the Earth's +rotation about its axis, and the Gregorian Calendar, which is based +on the Earth's rotation about the Sun. The UTC timescale is +disciplined with respect to International Atomic Time (TAI) by +inserting leap seconds at intervals of about 18 months. UTC time is +disseminated by various means, including radio and satellite +navigation systems, telephone modems and portable clocks.</p> + +<p>Special purpose receivers are available for many +time-dissemination services, including the Global Position System +(GPS) and other services operated by various national governments. +For reasons of cost and convenience, it is not possible to equip +every computer with one of these receivers. However, it is possible +to equip some number of computers acting as primary time servers to +synchronize a much larger number of secondary servers and clients +connected by a common network. In order to do this, a distributed +network clock synchronization protocol is required which can read a +server clock, transmit the reading to one or more clients and +adjust each client clock as required. Protocols that do this +include the Network Time Protocol (NTP), Digital Time +Synchronization Protocol (DTSS) and others found in the literature +(See "Further Reading" at the end of this article.)</p> <h4>Protocol Design Issues</h4> -<p>The synchronization protocol determines the time offset of the server -clock relative to the client clock. The various synchronization -protocols in use today provide different means to do this, but they all -follow the same general model. On request, the server sends a message -including its current clock value or <i>timestamp</i> and the client -records its own timestamp upon arrival of the message. For the best -accuracy, the client needs to measure the server-client propagation -delay to determine its clock offset relative to the server. Since it is -not possible to determine the one-way delays, unless the actual clock -offset is known, the protocol measures the total roundtrip delay and -assumes the propagation times are statistically equal in each direction. -In general, this is a useful approximation; however, in the Internet of -today, network paths and the associated delays can differ significantly -due to the individual service providers. +<p>The synchronization protocol determines the time offset of the +server clock relative to the client clock. The various +synchronization protocols in use today provide different means to +do this, but they all follow the same general model. On request, +the server sends a message including its current clock value or <i> +timestamp</i> and the client records its own timestamp upon arrival +of the message. For the best accuracy, the client needs to measure +the server-client propagation delay to determine its clock offset +relative to the server. Since it is not possible to determine the +one-way delays, unless the actual clock offset is known, the +protocol measures the total roundtrip delay and assumes the +propagation times are statistically equal in each direction. In +general, this is a useful approximation; however, in the Internet +of today, network paths and the associated delays can differ +significantly due to the individual service providers.</p> <p>The community served by the synchronization protocol can be very -large. For instance, the NTP community in the Internet of 1998 includes -over 230 primary time servers, synchronized by radio, satellite and -modem, and well over 100,000 secondary servers and clients. In addition, -there are many thousands of private communities in large government, -corporate and institution networks. Each community is organized as a -tree graph or <i>subnet</i>, with the primary servers at the root and -secondary servers and clients at increasing hop count, or stratum level, -in corporate, department and desktop networks. It is usually necessary -at each stratum level to employ redundant servers and diverse network -paths in order to protect against broken software, hardware and network -links. +large. For instance, the NTP community in the Internet of 1998 +includes over 230 primary time servers, synchronized by radio, +satellite and modem, and well over 100,000 secondary servers and +clients. In addition, there are many thousands of private +communities in large government, corporate and institution +networks. Each community is organized as a tree graph or <i> +subnet</i>, with the primary servers at the root and secondary +servers and clients at increasing hop count, or stratum level, in +corporate, department and desktop networks. It is usually necessary +at each stratum level to employ redundant servers and diverse +network paths in order to protect against broken software, hardware +and network links.</p> + <p>Synchronization protocols work in one or more association modes, depending on the protocol design. Client/server mode, also called -master/slave mode, is supported in both DTSS and NTP. In this mode, a -client synchronizes to a stateless server as in the conventional RPC -model. NTP also supports symmetric mode, which allows either of two peer -servers to synchronize to the other, in order to provide mutual backup. -DTSS and NTP support a broadcast mode which allows many clients to -synchronize to one or a few servers, reducing network traffic when large -numbers of clients are involved. In NTP, IP multicast can be used when -the subnet spans multiple networks. - -<p>Configuration management can be a serious problem in large subnets. -Various schemes which index public databases and network directory -services are used in DTSS and NTP to discover servers. Both protocols -use broadcast modes to support large client populations; but, since -listen-only clients cannot calibrate the delay, accuracy can suffer. In -NTP, clients determine the delay at the time a server is first -discovered by polling the server in client/server mode and then -reverting to listen-only mode. In addition, NTP clients can broadcast a -special "manycast" message to solicit responses from nearby servers and -continue in client/server mode with the respondents. +master/slave mode, is supported in both DTSS and NTP. In this mode, +a client synchronizes to a stateless server as in the conventional +RPC model. NTP also supports symmetric mode, which allows either of +two peer servers to synchronize to the other, in order to provide +mutual backup. DTSS and NTP support a broadcast mode which allows +many clients to synchronize to one or a few servers, reducing +network traffic when large numbers of clients are involved. In NTP, +IP multicast can be used when the subnet spans multiple +networks.</p> + +<p>Configuration management can be a serious problem in large +subnets. Various schemes which index public databases and network +directory services are used in DTSS and NTP to discover servers. +Both protocols use broadcast modes to support large client +populations; but, since listen-only clients cannot calibrate the +delay, accuracy can suffer. In NTP, clients determine the delay at +the time a server is first discovered by polling the server in +client/server mode and then reverting to listen-only mode. In +addition, NTP clients can broadcast a special "manycast" message to +solicit responses from nearby servers and continue in client/server +mode with the respondents.</p> + +<h4>Security Issues</h4> + +<p>A reliable network time service requires provisions to prevent +accidental or malicious attacks on the servers and clients in the +network. Reliability requires that clients can determine that +received messages are authentic; that is, were actually sent by the +intended server and not manufactured or modified by an intruder. +Ubiquity requires that any client can verify the authenticity of +any server using only public information. This is especially +important in such ubiquitous network services as directory +services, cryptographic key management and time +synchronization.</p> + +<p>NTP includes provisions to cryptographically authenticate +individual servers using symmetric-key cryptography in which +clients authenticate servers using shared secret keys. However, the +secret keys must be distributed in advance using secure means +beyond the scope of the protocol. This can be awkward and fragile +with a large population of potential clients, possibly intruding +hackers.</p> + +<p>Modern public-key cryptography provides means to reliably bind +the server identification credentials and related public values +using public directory services. However, these means carry a high +computing cost, especially when large numbers of time-critical +clients are involved as often the case with NTP servers. In +addition, there are problems unique to NTP in the interaction +between the authentication and synchronization functions, since +each requires the other for success.</p> + +<p>The recent NTP Version 4 includes a revised security model and +authentication scheme supporting both symmetric and public-key +cryptography. The public-key variant is specially crafted to reduce +the risk of intrusion, minimize the consumption of processor +resources and minimize the vulnerability to hacker attack.</p> <h4>Computer Clock Modelling and Error Analysis</h4> Most computers include a quartz resonator-stabilized oscillator and -hardware counter that interrupts the processor at intervals of a few -milliseconds. At each interrupt, a quantity called <i>tick</i> is added -to a system variable representing the clock time. The clock can be read -by system and application programs and set on occasion to an external -reference. Once set, the clock readings increment at a nominal rate, -depending on the value of <i>tick</i>. Typical Unix system kernels -provide a programmable mechanism to increase or decrease the value of -<i>tick</i> by a small, fixed amount in order to amortize a given time -adjustment smoothly over multiple <i>tick</i> intervals. - -<p>Clock errors are due to variations in network delay and latencies in -computer hardware and software (jitter), as well as clock oscillator -instability (wander). The time of a client relative to its server can be -expressed - -<p><center><i>T</i>(<i>t</i>) = <i>T</i>(<i>t</i><sub>0</sub>) + -<i>R</i>(<i>t - t</i><sub>0</sub>) + 1/2 <i>D</i>(<i>t - -T</i><sub>0</sub>)<sup>2</sup>,</center> - -<p>where <i>t</i> is the current time, <i>T</i> is the time offset at -the last measurement update <i>t</i><sub>0</sub>, <i>R</i> is the -frequency offset and <i>D</i> is the drift due to resonator ageing. All -three terms include systematic offsets that can be corrected and random -variations that cannot. Some protocols, including DTSS, estimate only -the first term in this expression, while others, including NTP, estimate -the first two terms. Errors due to the third term, while important to -model resonator aging in precision applications, are neglected, since -they are usually dominated by errors in the first two terms. - -<p>The synchronization protocol estimates <i>T</i>(<i>t</i><sub>0</sub>) -(and <i>R</i>(<i>t</i><sub>0</sub>), where relevant) at regular -intervals <font face="symbol">t</font> and adjusts the clock to minimize -<i>T</i>(<i>t</i>) in future. In common cases, <i>R</i> can have -systematic offsets of several hundred parts-per-million (PPM) with -random variations of several PPM due to ambient temperature changes. If -not corrected, the resulting errors can accumulate to seconds per day. -In order that these errors do not exceed a nominal specification, the -protocol must periodically re-estimate <i>T</i> and <i>R</i> and -compensate for variations by adjusting the clock at regular intervals. -As a practical matter, for nominal accuracies of tens of milliseconds, -this requires clients to exchange messages with servers at intervals in -the order of tens of minutes. - -<p>Analysis of quartz-resonator stabilized oscillators show that errors -are a function of the averaging time, which in turn depends on the -interval between corrections. At correction intervals less than a few -hundred seconds, errors are dominated by jitter, while, at intervals -greater than this, errors are dominated by wander. As explained later, -the characteristics of each regime determine the algorithm used to -discipline the clock. These errors accumulate at each stratum level from -the root to the leaves of the subnet tree. It is possible to quantify -these errors by statistical means, as in NTP. This allows real-time -applications to adjust audio or video playout delay, for example. -However, the required statistics may be different for various classes of -applications. Some applications need absolute error bounds guaranteed -never to exceeded, as provided by the following correctness principles. +hardware counter that interrupts the processor at intervals of a +few milliseconds. At each interrupt, a quantity called <i>tick</i> +is added to a system variable representing the clock time. The +clock can be read by system and application programs and set on +occasion to an external reference. Once set, the clock readings +increment at a nominal rate, depending on the value of <i>tick</i>. +Typical Unix system kernels provide a programmable mechanism to +increase or decrease the value of <i>tick</i> by a small, fixed +amount in order to amortize a given time adjustment smoothly over +multiple <i>tick</i> intervals. + +<p>Clock errors are due to variations in network delay and +latencies in computer hardware and software (jitter), as well as +clock oscillator instability (wander). The time of a client +relative to its server can be expressed</p> + +<center><i>T</i>(<i>t</i>) = <i>T</i>(<i>t</i><sub>0</sub>) + <i> +R</i>(<i>t - t</i><sub>0</sub>) + 1/2 <i>D</i>(<i>t - +t</i><sub>0</sub>)<sup>2</sup>,</center> + +<p>where <i>t</i> is the current time, <i>T</i> is the time offset +at the last measurement update <i>t</i><sub>0</sub>, <i>R</i> is +the frequency offset and <i>D</i> is the drift due to resonator +ageing. All three terms include systematic offsets that can be +corrected and random variations that cannot. Some protocols, +including DTSS, estimate only the first term in this expression, +while others, including NTP, estimate the first two terms. Errors +due to the third term, while important to model resonator aging in +precision applications, are neglected, since they are usually +dominated by errors in the first two terms.</p> + +<p>The synchronization protocol estimates <i> +T</i>(<i>t</i><sub>0</sub>) (and <i>R</i>(<i>t</i><sub>0</sub>), +where relevant) at regular intervals <font face="symbol">t</font> +and adjusts the clock to minimize <i>T</i>(<i>t</i>) in future. In +common cases, <i>R</i> can have systematic offsets of several +hundred parts-per-million (PPM) with random variations of several +PPM due to ambient temperature changes. If not corrected, the +resulting errors can accumulate to seconds per day. In order that +these errors do not exceed a nominal specification, the protocol +must periodically re-estimate <i>T</i> and <i>R</i> and compensate +for variations by adjusting the clock at regular intervals. As a +practical matter, for nominal accuracies of tens of milliseconds, +this requires clients to exchange messages with servers at +intervals in the order of tens of minutes.</p> + +<p>Analysis of quartz-resonator stabilized oscillators show that +errors are a function of the averaging time, which in turn depends +on the interval between corrections. At correction intervals less +than a few hundred seconds, errors are dominated by jitter, while, +at intervals greater than this, errors are dominated by wander. As +explained later, the characteristics of each regime determine the +algorithm used to discipline the clock. These errors accumulate at +each stratum level from the root to the leaves of the subnet tree. +It is possible to quantify these errors by statistical means, as in +NTP. This allows real-time applications to adjust audio or video +playout delay, for example. However, the required statistics may be +different for various classes of applications. Some applications +need absolute error bounds guaranteed never to exceeded, as +provided by the following correctness principles.</p> <h4>Correctness Principles</h4> <p>Applications requiring reliable time synchronization such as air -traffic control must have confidence that the local clock is correct -within some bound relative to a given timescale such as UTC. There is a -considerable body of literature that studies these issues with respect -to various failure models such as fail-stop and Byzantine disagreement. -While these models inspire much confidence in a theoretical setting, -most require multiple message rounds for each measurement and would be -impractical in a large computer network such as the Internet. However, -it can be shown that the worst-case error in reading a remote server -clock cannot exceed one-half the roundtrip delay measured by the client. -This is a valuable insight, since it permits strong statements about the -correctness of the timekeeping system. - -<p>In the Probabilistic Clock Synchronization (PCS) scheme devised by -Cristian, a maximum error tolerance is established in advance and time -value samples associated with roundtrip delays that exceed twice this -value are discarded. By the above argument, the remaining samples must -represent time values within the specified tolerance. As the tolerance -is decreased, more samples fail the test until a point where no samples -survive. The tolerance can be adjusted for the best compromise between -the highest accuracy consistent with acceptable sample survival rate. - -<p>In a scheme devised by Marzullo and exploited in NTP and DTSS, the -worst-case error determined for each server determines a correctness -interval. If each of a number of servers are in fact synchronized to a -common timescale, the actual time must be contained in the intersection -of their correctness intervals. If some intervals do not intersect, then -the clique containing the maximum number of intersections is assumed -correct <i>truechimers</i> and the others assumed incorrect -<i>false<i>tick</i>ers</i>. Only the truechimers are used to adjust the -system -clock. +traffic control must have confidence that the local clock is +correct within some bound relative to a given timescale such as +UTC. There is a considerable body of literature that studies these +issues with respect to various failure models such as fail-stop and +Byzantine disagreement. While these models inspire much confidence +in a theoretical setting, most require multiple message rounds for +each measurement and would be impractical in a large computer +network such as the Internet. However, it can be shown that the +worst-case error in reading a remote server clock cannot exceed +one-half the roundtrip delay measured by the client. This is a +valuable insight, since it permits strong statements about the +correctness of the timekeeping system.</p> + +<p>In the Probabilistic Clock Synchronization (PCS) scheme devised +by Cristian, a maximum error tolerance is established in advance +and time value samples associated with roundtrip delays that exceed +twice this value are discarded. By the above argument, the +remaining samples must represent time values within the specified +tolerance. As the tolerance is decreased, more samples fail the +test until a point where no samples survive. The tolerance can be +adjusted for the best compromise between the highest accuracy +consistent with acceptable sample survival rate.</p> + +<p>In a scheme devised by Marzullo and exploited in NTP and DTSS, +the worst-case error determined for each server determines a +correctness interval. If each of a number of servers are in fact +synchronized to a common timescale, the actual time must be +contained in the intersection of their correctness intervals. If +some intervals do not intersect, then the clique containing the +maximum number of intersections is assumed correct <i> +truechimers</i> and the others assumed incorrect <i> +falsetickers</i>. Only the truechimers are used to adjust the +system clock.</p> <h4>Data Grooming Algorithms</h4> By its very nature, clock synchronization is a continuous process, -resulting in a sequence of measurements with each of possibly several -servers and resulting in a clock adjustment. In some protocols, crafted -algorithms are used to improve the time and frequency estimates and -refine the clock adjustment. Algorithms described in the literature are -based on trimmed-mean and median filter methods. The clock filter -algorithm used in NTP is based on the above observation that the -correctness interval depends on the roundtrip delay. The algorithm -accumulates offset/delay samples in a window of several samples and -selects the offset sample associated with the minimum delay. In general, -larger window sizes provide better estimates; however, stability -considerations limit the window size to about eight. -<p>The same principle could be used when selecting the best subset of -servers and combining their offsets to determine the clock adjustment. -However, different servers often show different systematic offsets, so -the best statistic for the central tendency of the server population may -not be obvious. Various kinds of clustering algorithms have been found -useful for this purpose. The one used in NTP sorts the offsets by a -quality metric, then calculates the variance of all servers relative to -each server separately. The algorithm repeatedly discards the outlyer -with the largest variance until further discards will not improve the -residual variance or until a minimum number of servers remain. The final -clock adjustment is computed as a weighted average of the survivors. - -<p>At the heart of the synchronization protocol is the algorithm used to -adjust the system clock in accordance with the final adjustment -determined by the above algorithms. This is called the clock discipline -algorithm or simply the discipline. Such algorithms can be classed -according to whether they minimize the time offset or frequency offset -or both. For instance, the discipline used in DTSS minimizes only the -time offset, while the one used in NTP minimizes both time and frequency -offsets. While the DTSS algorithm cannot remove residual errors due to -systematic frequency errors, the NTP algorithm is more complicated and -less forgiving of design and implementation mistakes. +resulting in a sequence of measurements with each of possibly +several servers and resulting in a clock adjustment. In some +protocols, crafted algorithms are used to improve the time and +frequency estimates and refine the clock adjustment. Algorithms +described in the literature are based on trimmed-mean and median +filter methods. The clock filter algorithm used in NTP is based on +the above observation that the correctness interval depends on the +roundtrip delay. The algorithm accumulates offset/delay samples in +a window of several samples and selects the offset sample +associated with the minimum delay. In general, larger window sizes +provide better estimates; however, stability considerations limit +the window size to about eight. + +<p>The same principle could be used when selecting the best subset +of servers and combining their offsets to determine the clock +adjustment. However, different servers often show different +systematic offsets, so the best statistic for the central tendency +of the server population may not be obvious. Various kinds of +clustering algorithms have been found useful for this purpose. The +one used in NTP sorts the offsets by a quality metric, then +calculates the variance of all servers relative to each server +separately. The algorithm repeatedly discards the outlyer with the +largest variance until further discards will not improve the +residual variance or until a minimum number of servers remain. The +final clock adjustment is computed as a weighted average of the +survivors.</p> + +<p>At the heart of the synchronization protocol is the algorithm +used to adjust the system clock in accordance with the final +adjustment determined by the above algorithms. This is called the +clock discipline algorithm or simply the discipline. Such +algorithms can be classed according to whether they minimize the +time offset or frequency offset or both. For instance, the +discipline used in DTSS minimizes only the time offset, while the +one used in NTP minimizes both time and frequency offsets. While +the DTSS algorithm cannot remove residual errors due to systematic +frequency errors, the NTP algorithm is more complicated and less +forgiving of design and implementation mistakes.</p> <p>All clock disciplines function as a feedback loop, with measured -offsets used to adjust the clock oscillator phase and frequency to match -the external synchronization source. The behavior of feedback loops is -well understood and modelled by mathematical analysis. The significant -design parameter is the time constant, or responsiveness to external or -internal variations in time or frequency. Optimum selection of time -constant depends on the interval between update messages. In general, -the longer these intervals, the larger the time constant and vice versa. -In practice and with typical network configurations the optimal poll -intervals vary between one and twenty minutes for network paths to some -thousands of minutes for modem paths. +offsets used to adjust the clock oscillator phase and frequency to +match the external synchronization source. The behavior of feedback +loops is well understood and modelled by mathematical analysis. The +significant design parameter is the time constant, or +responsiveness to external or internal variations in time or +frequency. Optimum selection of time constant depends on the +interval between update messages. In general, the longer these +intervals, the larger the time constant and vice versa. In practice +and with typical network configurations the optimal poll intervals +vary between one and twenty minutes for network paths to some +thousands of minutes for modem paths.</p> <h4>Further Reading</h4> <ol> - -<p><li>Cristian, F. Probabilistic clock synchronization. In Distributed -Computing 3, Springer Verlag, 1989, 146-158.</li> - -<p><li>Digital Time Service Functional Specification Version T.1.0.5. -DigitalEquipment Corporation, 1989.</li> - -<p><li>Gusella, R., and S. Zatti. TEMPO - A network time controller for +<li> +<p>Cristian, F. Probabilistic clock synchronization. In Distributed +Computing 3, Springer Verlag, 1989, 146-158.</p> +</li> + +<li> +<p>Digital Time Service Functional Specification Version T.1.0.5. +DigitalEquipment Corporation, 1989.</p> +</li> + +<li> +<p>Gusella, R., and S. Zatti. TEMPO - A network time controller for a distributed Berkeley UNIX system. IEEE Distributed Processing -Technical Committee Newsletter 6, NoSI-2 (June 1984), 7-15. Also in: -Proc. Summer 1984 USENIX (Salt Lake City, June 1984).</li> - -<p><li>Kopetz, H., and W. Ochsenreiter. Clock synchronization in -distributed real-time systems. IEEE Trans. Computers C-36, 8 (August -1987), 933-939.</li> - -<p><li>Lamport, L., and P.M. Melliar-Smith. Synchronizing clocks in the -presence of faults. JACM 32, 1 (January 1985), 52-78.</li> - -<p><li>Marzullo, K., and S. Owicki. Maintaining the time in a -distributed system. ACM Operating Systems Review 19, 3 (July 1985), 44- -54.</li> - -<p><li>Mills, D.L. Internet time synchronization: the Network Time -Protocol. IEEE Trans. Communications COM-39, 10 (October 1991), 1482- -1493. Also in: Yang, Z., and T.A. Marsland (Eds.). Global States and -Time in Distributed Systems, IEEE Press, Los Alamitos, CA, 91-102.</li> -<p><li>Mills, D.L. Modelling and analysis of computer network clocks. -Electrical Engineering Department Report 92-5-2, University of Delaware, -May 1992, 29 pp.</li> - -<p><li>NIST Time and Frequency Dissemination Services. NBS Special +Technical Committee Newsletter 6, NoSI-2 (June 1984), 7-15. Also +in: Proc. Summer 1984 USENIX (Salt Lake City, June 1984).</p> +</li> + +<li> +<p>Kopetz, H., and W. Ochsenreiter. Clock synchronization in +distributed real-time systems. IEEE Trans. Computers C-36, 8 +(August 1987), 933-939.</p> +</li> + +<li> +<p>Lamport, L., and P.M. Melliar-Smith. Synchronizing clocks in the +presence of faults. JACM 32, 1 (January 1985), 52-78.</p> +</li> + +<li> +<p>Marzullo, K., and S. Owicki. Maintaining the time in a +distributed system. ACM Operating Systems Review 19, 3 (July 1985), +44-54.</p> +</li> + +<li> +<p>Mills, D.L. Adaptive hybrid clock discipline algorithm for the +Network Time Protocol. <i>IEEE/ACM Trans. Networking 6, 5</i> +(October 1998), 505-514.</p> +</li> + +<li> +<p>Mills, D.L. Improved algorithms for synchronizing computer +network clocks. <i>IEEE/ACM Trans. Networks 3, 3</i> (June 1995), +245-254.</p> +</li> + +<li> +<p>Mills, D.L. Internet time synchronization: the Network Time +Protocol. IEEE Trans. Communications COM-39, 10 (October 1991), +1482-1493. Also in: Yang, Z., and T.A. Marsland (Eds.). Global +States and Time in Distributed Systems, IEEE Press, Los Alamitos, +CA, 91-102.</p> +</li> + +<li> +<p>Mills, D.L. Modelling and analysis of computer network clocks. +Electrical Engineering Department Report 92-5-2, University of +Delaware, May 1992, 29 pp.</p> +</li> + +<li> +<p>NIST Time and Frequency Dissemination Services. NBS Special Publication432 (Revised 1990), National Institute of Science and -Technology, U.S. Department of Commerce, 1990.</li> +Technology, U.S. Department of Commerce, 1990.</p> +</li> -<p><li>Schneider, F.B. A paradigm for reliable clock synchronization. +<li> +<p>Schneider, F.B. A paradigm for reliable clock synchronization. Department of Computer Science Technical Report TR 86-735, Cornell -University, February 1986.</li> - -<p><li>Srikanth, T.K., and S. Toueg. Optimal clock synchronization. JACM -34, 3 (July 1987), 626-645.</li> +University, February 1986.</p> +</li> + +<li> +<p>Srikanth, T.K., and S. Toueg. Optimal clock synchronization. +JACM 34, 3 (July 1987), 626-645.</p> +</li> + +<li> +<p>Stein, S.R. Frequency and time - their measurement and +characterization (Chapter 12). In: E.A. Gerber and A. Ballato +(Eds.). Precision Frequency Control, Vol. 2, Academic Press, New +York 1985, 191-232, 399-416. Also in: Sullivan, D.B., D.W. Allan, +D.A. Howe and F.L. Walls (Eds.). Characterization of Clocks and +Oscillators. National Institute of Standards and Technology +Technical Note 1337, U.S. Government Printing Office (January, +1990), TN61-TN119.</p> +</li> +</ol> -<p><li>Stein, S.R. Frequency and time - their measurement and -characterization (Chapter 12). In: E.A. Gerber and A. Ballato (Eds.). -Precision Frequency Control, Vol. 2, Academic Press, New York 1985, 191- -232, 399-416. Also in: Sullivan, D.B., D.W. Allan, D.A. Howe and F.L. -Walls (Eds.). Characterization of Clocks and Oscillators. National -Institute of Standards and Technology Technical Note 1337, U.S. -Government Printing Office (January, 1990), TN61-TN119.</li> +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"home"></a> -</ol> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/extern.htm b/contrib/ntp/html/extern.htm index d44d243..01c0149 100644 --- a/contrib/ntp/html/extern.htm +++ b/contrib/ntp/html/extern.htm @@ -1,40 +1,108 @@ -<HTML><HEAD><TITLE> -External Clock Discipline and the Local Clock Driver -</TITLE></HEAD><BODY><H3> -External Clock Discipline and the Local Clock Driver -</H3><HR> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>External Clock Discipline and the Local Clock Driver</title> +</head> +<body> +<h3>External Clock Discipline and the Local Clock Driver</h3> + +<hr> +<p>The NTPv4 implementation includes provisions for an external +clock, where the system clock is implemented by some external +hardware device. One implementation might take the form of a bus +peripheral with a high resolution counter disciplined by a GPS +receiver, for example. Another implementation might involve another +synchronization protocol, such as the Digital Time Synchronization +Service (DTSS), where the system time is disciplined to this +protocol and NTP clients of the server obtain synchronization +indirectly via the server. A third implementation might be a +completely separate clock discipline algorithm and synchronization +protocol, such as the Lockclock algorithm used with NIST Automated +Computer Time Service (ACTS) modem synchronized time.</p> + +<p>When external clocks are used in conjunction with NTP service, +some way needs to be provided for the external clock driver and NTP +daemon <tt>ntpd</tt> to communicate and determine which discipline +is in control. This is necessary in order to provide backup, for +instance if the external clock or protocol were to fail and +synchronization service fall back to other means, such as a local +reference clock or another NTP server. In addition, when the +external clock and driver are in control, some means needs to be +provided for the clock driver to pass on status information and +error statistics to the NTP daemon.</p> + +<p>Control and monitoring functions for the external clock and +driver are implemented using the <a href="driver1.htm">Local Clock +(type 1) driver</a> and the <tt>ntp_adjtime()</tt> system call. +This system call is implemented by special kernel provisions +included in the kernel of several operating systems, including +Solaris, Tru64, FreeBSD and Linux, and possibly others. When the +external clock is disabled or not implemented, the system call is +used to pass time and frequency information, as well as error +statistics, to the kernel. Besides disciplining the system time, +the same interface can be used by other applications to determine +the operating parameters of the discipline.</p> + +<p>When the external clock is enabled, <tt>ntpd</tt> does not +discipline the system clock, nor does it maintain the error +statistics. In this case, the external clock and driver do this +using mechanisms unknown to <tt>ntpd</tt>; however, in this case +the kernel state variables are retrieved at 64-s intervals by the +Local Clock driver and used by the clock selection and mitigation +algorithms to determine the system variables presented to other NTP +clients and peers. In this way, downstream clients and servers in +the NTP subnet can make an intelligent choice when more than one +server is available.</p> + +<p>In order to implement a reliable mitigation between ordinary NTP +sources and the external clock source, a protocol is necessary +between the local clock driver and the external clock driver. This +is implemented using Boolean variables and certain bits in the +kernel clock status word. The Boolean variables include the +following:</p> + +<p>ntp__enable. set/reset by enable command. enables ntp clock +discipline</p> + +<p>ntp_control. set during initial configuration if kernel support +is available kern_enable Set/reset by enable commandexit If this +switch is set, the daemon computes the offset, frequency, maximum +error, estimated error, time constand and status bits, then +provides them to the kernel via ntp_adjtime(). If this switch is +set, these values are not passed to the kernel; however, the daemon +retrieves their present values and uses them in place of the values +computed by the daemon. pps_update set in the protocol routine if +the prefer peer has survived and has offset less than 128 ms; +otherwise set to zero. pps_control Updated to the current time by +kernel support if the PPS signal is enabled and working correctly. +Set to zero in the adjust routine if the interval since the last +update exceeds 120 s.</p> + +<p>The ntp_enable and kern_enable are set by the configuration +module. Normally, both switches default on, so the daemon can +control the time and the kernel discipline can be used, if +available. The pps_update switch is set by the protocol module when +it believes the PPS provider source is legitimate and operating +within nominals. The ntp_control switch is set during configuration +by interrogating the kernel. If both the kern_enable and +ntp_control siwitches are set, the daemon disciplines the clock via +the kernel and the internal daemon discipline is disabled.</p> + +<p>The external clock driver controls the system time and clock +selection in the following way. Normally, the driver adjusts the +kernel time using the ntp_adjtime() system call in the same way as +the daemon. In the case where the kernel discipline is to be used +intact, the clock offset is provided in this call and the loop +operates as specified. In the case where the driver steers only the +frequency, the offset is specified as zero.</p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<p>The NTPv4 implementation includes provisions for an external clock, where the system clock is implemented by some external hardware device. One implementation might take the form of a bus peripheral with a high resolution counter disciplined by a GPS receiver, for example. Another implementation might involve another synchronization protocol, such as the Digital Time Synchronization Service (DTSS), where the system time is disciplined to this protocol and NTP clients of the server obtain synchronization indirectly via the server. A third implementation might be a completely separate clock discipline algorithm and synchronization protocol, such as the Lockclock algorithm used with NIST Automated Computer Time Service (ACTS) modem synchronized time. - -<p>When external clocks are used in conjunction with NTP service, some way needs to be provided for the external clock driver and NTP daemon <tt>ntpd</tt> to communicate and determine which discipline is in control. This is necessary in order to provide backup, for instance if the external clock or protocol were to fail synchronization service fall back to other means, such as a local reference clock or another NTP server. In addition, when the external clock and driver are in control, some means needs to be provided for the clock driver to pass on status information and error statistics to the NTP daemon. - -<p>Control and monitoring functions for the external clock and driver are implemented using the Local Clock (type 1) driver and the <tt>ntp_adjtime()</tt> system call. This system call is implemented by special kernel provisions included in the kernel of several operating systems, including Solaris, Digital Unix, FreeBSD and Linux, and possibly others. When the external clock is disabled or not implemented, the system call is used to pass time and frequency information, as well as error statistics, to the kernel. Besides disciplining the system time, the same interface can be used by other applications to determine the operating parameters of the discipline. When the external clock is enabled, <tt>ntpd</tt> does not discipline the system clock, nor does it maintain the error statistics. In this case, the external clock and driver do this using mechanisms unknown to <tt>ntpd</tt>; however, in this case the kernel state variables are retrieved at 64-s intervals by the Local Clock driver and used by the clock selection and mitigation algorithms to determine the system variables presented to other NTP clients and peers. In this way, downstream clients and servers in the NTP subnet can make an intelligent choice when more than one server is available. - -<p>In order to implement a reliable mitigation between ordinary NTP sources and the external clock source, a protocol is necessary between the local clock driver and the external clock driver. This is implemented using Boolean variables and certain bits in the kernel clock status word. The Boolean variables include the following: - -<p>ntp__enable. set/reset by enable command. enables ntp clock discipline - -<p>ntp_control. set during initial configuration if kernel support is available - -kern_enable -Set/reset by enable commandexit - -If this switch is set, the daemon computes the offset, frequency, maximum error, estimated error, time constand and status bits, then provides them to the kernel via ntp_adjtime(). If this switch is set, these values are not passed to the kernel; however, the daemon retrieves their present values and uses them in place of the values computed by the daemon. - -pps_update -set in the protocol routine if the prefer peer has survived and has offset less than 128 ms; otherwise set to zero. - -pps_control -Updated to the current time by kernel support if the PPS signal is enabled and working correctly. Set to zero in the adjust routine if the interval since the last update exceeds 120 s. - - -<p>The ntp_enable and kern_enable are set by the configuration module. Normally, both switches default on, so the daemon can control the time and the kernel discipline can be used, if available. The pps_update switch is set by the protocol module when it believes the PPS provider source is legitimate and operating within nominals. The ntp_control switch is set during configuration by interrogating the kernel. If both the kern_enable and ntp_control siwitches are set, the daemon disciplines the clock via the kernel and the internal daemon discipline is disabled. - -<p>The external clock driver controls the system time and clock selection in the following way. Normally, the driver adjusts the kernel time using the ntp_adjtime() system call in the same way as the daemon. In the case where the kernel discipline is to be used intact, the clock offset is provided in this call and the loop operates as specified. In the case where the driver steers only the frequency, the offset is specified as zero - - -d PLL/ - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href="mailto:mills@udel.edu"> David L. Mills <mills@udel.edu></a> -</address></body></html> diff --git a/contrib/ntp/html/gadget.htm b/contrib/ntp/html/gadget.htm index 80274535..6bf64fc 100644 --- a/contrib/ntp/html/gadget.htm +++ b/contrib/ntp/html/gadget.htm @@ -8,104 +8,41 @@ Gadget Box PPS Level Converter and CHU Modem <br clear=left><hr> -<p><h4>Introduction</h4> - -<p>Many radio clocks used as a primary reference source for NTP servers -produce a pulse-per-second (PPS) signal that can be used to improve -accuracy to a high degree. However, the signals produced are usually -incompatible with the modem interface signals on the serial ports used -to connect the signal to the host. The gadget box consists of a handful -of electronic components assembled in a small aluminum box. It includes -level converters and a optional radio modem designed to decode the radio -timecode signals transmitted by the Canadian time and frequency station -CHU. A complete set of schematics, PCB artwork, drill templates can be -obrtained via the web as the distribution <a href= -"http://www.eecis.udel.edu/~mills/ntp/ntp">gadget.tar.Z</a>, or by -anonymous FTP from ftp.udel.edu in the <TT>pub/ntp</TT> directory. - -<p>The gadget box is assembled in a 5"x3"x2" aluminum -minibox containing the level converter and modem circuitry. It includes -two subcircuits. One of these converts a TTL positive edge into a fixed- -width pulse at EIA levels and is for use with a timecode receiver or -oscillator including a TTL PPS output. The other converts the timecode -modulation broadcast by Canadian time/frequency standard station CHU -into a 300-bps serial character stream at EIA levels and is for use with -the <code>tty_clk</code> and <code>chu_tty</code> line disciplines in -the ntp3 distribution. - -<p>This archive contains complete construction details for the gadget -box, including schematic, parts list and artwork for a two-sided, -printed-circuit board. All files are in PostScript, with the exception -of this file and an information file, which are in ASCII. The artwork is -in the 1:1 scale and is suitable for direct printing on photographic -resist for each side of the board. While a plated-through-holes process -is most convenient, it is possible to bridge the two sides using -soldered wires where necessary. - -<p><h4>Circuit Description</h4> - -<p>Following is a brief functional description of the device. See the -schematic diagram gadget.s01 for reference. The audio output of a -shortwave radio tuned to CHU at 3330, 7335 or 14670 kHz is connected to -J2. A level of at least 30 mV peak-peak is required, such as provided by -the recorder output on many receivers. The input level is adjusted by -potentiometer R8 so that the timecode modulation broadcast at 31-39 -seconds past the minute reliably lights green LED1, but the signals -broadcast during other seconds of the minute do not. - -<p>Opamp U4A provides low-impedance drive for the bridged-tee bandpass -filter U4B. The filter has a bandpass of about 600 Hz at the 6-dB points -and a center frequency of about 2150 Hz. It is designed to avoid -aliasing effects with receivers of relatively wide bandpass -characteristics. The modem itself is implemented by U2 and its -associated circuitry. Resistors R4 and R1 are a 40-dB pad which matches -the filter output to the modem input. U2 is a TTL/EIA level converter -with integral power supply for bipolar signals. The modem output is -available at pin 3 (receive data) of DB25 connector J1. - -<p>The TTL PPS signal is connected via J3 to a retriggerable one-shot -U3A, which generates a TTL pulse of width determined by potentiometer -R7. The pulse width is determined by the bit rate of the attached serial -port. In the common case the width is one bit-time, such as 26 us for -38.4 kbps, for example. This appears to the port as a single start bit -of zero followed by eight bits of ones and a stop bit of one. The second -one-shot U3B generates a 200-ms pulse suitable for driving the amber -LED3 as a visual monitor. The output of U3A is converted to EIA levels -by U1 and appears at pin 12 (secondary receive data) of J1. - -<p>If only the PPS circuit is required, U2 and U4 can be deleted and the -gadget box powered from the EIA modem-control signal at pin 20 (terminal -ready) of J1, assuming this signal is placed in the on (positive -voltage) condition by the computer program. J1 is wired to keep most -finicky UARTs and terminal-driver programs happy. If the CHU circuit is -required, an external 12-volt AC transformer or 9-12-volt DC supply -connected to J4 is required. Red LED2 indicates power is supplied to the -box. +<h4>Introduction</h4> + +<p>Many radio clocks used as a primary reference source for NTP servers produce a pulse-per-second (PPS) signal that can be used to improve accuracy to a high degree. However, the signals produced are usually incompatible with the modem interface signals on the serial ports used to connect the signal to the host. The gadget box consists of a handful of electronic components assembled in a small aluminum box. It includes level converters and a optional radio modem designed to decode the radio timecode signals transmitted by the Canadian time and frequency station CHU. A complete set of schematics, PCB artwork, drill templates can be obrtained via the web as the distribution <a href= "http://www.eecis.udel.edu/~mills/ntp/ntp">gadget.tar.Z</a>, or by anonymous FTP from ftp.udel.edu in the <TT>pub/ntp</TT> directory. + +<p>The gadget box is assembled in a 5"x3"x2" aluminum minibox containing the level converter and modem circuitry. It includes two subcircuits. One of these converts a TTL positive edge into a fixed-width pulse at EIA levels and is for use with a timecode receiver or oscillator including a TTL PPS output. The other converts the timecode modulation broadcast by Canadian time/frequency standard station CHU into a 300-bps serial character stream at EIA levels and is for use with the <a href=driver7.htm>Radio CHU Audio Demodulator/Decoder</a> driver. + +<p>This archive contains complete construction details for the gadget box, including schematic, parts list and artwork for a two-sided, printed-circuit board. All files are in PostScript, with the exception of this file and an information file, which are in ASCII. The artwork is in the 1:1 scale and is suitable for direct printing on photographic resist for each side of the board. While a plated-through-holes process is most convenient, it is possible to bridge the two sides using soldered wires where necessary. + +<h4>Circuit Description</h4> + +<p>Following is a brief functional description of the device. See the schematic diagram gadget.s01 for reference. The audio output of a shortwave radio tuned to CHU at 3330, 7335 or 14670 kHz is connected to J2. A level of at least 30 mV peak-peak is required, such as provided by the recorder output on many receivers. The input level is adjusted by potentiometer R8 so that the timecode modulation broadcast at 31-39 seconds past the minute reliably lights green LED1, but the signals broadcast during other seconds of the minute do not. + +<p>Opamp U4A provides low-impedance drive for the bridged-tee bandpass filter U4B. The filter has a bandpass of about 600 Hz at the 6-dB points and a center frequency of about 2150 Hz. It is designed to avoid aliasing effects with receivers of relatively wide bandpass characteristics. The modem itself is implemented by U2 and its associated circuitry. Resistors R4 and R1 are a 40-dB pad which matches the filter output to the modem input. U2 is a TTL/EIA level converter with integral power supply for bipolar signals. The modem output is available at pin 3 (receive data) of DB25 connector J1. + +<p>The TTL PPS signal is connected via J3 to a retriggerable one-shot U3A, which generates a TTL pulse of width determined by potentiometer R7. The pulse width is determined by the bit rate of the attached serial port. In the common case the width is one bit-time, such as 26 us for 38.4 kbps, for example. This appears to the port as a single start bit of zero followed by eight bits of ones and a stop bit of one. The second one-shot U3B generates a 200-ms pulse suitable for driving the amber LED3 as a visual monitor. The output of U3A is converted to EIA levels by U1 and appears at pin 12 (secondary receive data) of J1. + +<p>If only the PPS circuit is required, U2 and U4 can be deleted and the gadget box powered from the EIA modem-control signal at pin 20 (terminal ready) of J1, assuming this signal is placed in the on (positive voltage) condition by the computer program. J1 is wired to keep most finicky UARTs and terminal-driver programs happy. If the CHU circuit is required, an external 12-volt AC transformer or 9-12-volt DC supply +connected to J4 is required. Red LED2 indicates power is supplied to the box. <p>Files -<p>Following is a list of files included in this archive. All files are -in PostScript, except the <code>README</code> and -<code>gadget.lst</code> files, which are in ASCII. The files -<code>gadget.s01, gadget.s02</code> and <code>gadget.lst</code> were -generated using the Schema schematic-capture program from Omation. The -printed-circuit files <code>*.lpr</code> were generated using Schema- -PCB, also from Omation. +<p>Following is a list of files included in this archive. All files are in PostScript, except the <tt>README</tt> and <tt>gadget.lst</tt> files, which are in ASCII. The files <tt>gadget.s01, gadget.s02</tt> and <tt>gadget.lst</tt> were generated using the Schema schematic-capture program from Omation. The printed-circuit files <tt>*.lpr</tt> were generated using Schema-PCB, also from Omation. <p>Files -<p><code>README</code> - helpful information -<br><code>gadget.s01</code> - circuit schematic -<br><code>gadget.s02</code> - minibox assembly drawing -<br><code>gadget.lst</code> - net list, pin list, parts list, etc. -<br><code>gen0102.lpr</code> - pcb x-ray diagram -<br><code>art01.lpr</code> - pcb artword side 1 -<br><code>art02.lpr</code> - pcb artwork side 2 -<br><code>adt0127.lpr</code> - pcb assembly drawing -<br><code>dd0124.lpr</code> - pcb drill drawing -<br><code>sm0228.lpr</code> - pcb solder mask (side 2) -<br><code>sst0126.lpr</code> - pcb silkscreen mask (side 1) - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<p><tt>README</tt> - helpful information +<br><tt>gadget.s01</tt> - circuit schematic +<br><tt>gadget.s02</tt> - minibox assembly drawing +<br><tt>gadget.lst</tt> - net list, pin list, parts list, etc. +<br><tt>gen0102.lpr</tt> - pcb x-ray diagram +<br><tt>art01.lpr</tt> - pcb artword side 1 +<br><tt>art02.lpr</tt> - pcb artwork side 2 +<br><tt>adt0127.lpr</tt> - pcb assembly drawing +<br><tt>dd0124.lpr</tt> - pcb drill drawing +<br><tt>sm0228.lpr</tt> - pcb solder mask (side 2) +<br><tt>sst0126.lpr</tt> - pcb silkscreen mask (side 1) + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/genkeys.htm b/contrib/ntp/html/genkeys.htm new file mode 100644 index 0000000..33e99ef --- /dev/null +++ b/contrib/ntp/html/genkeys.htm @@ -0,0 +1,181 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntp-genkeys - generate public and private keys</title> +</head> +<body> +<h3><tt>ntp-genkeys</tt> - generate public and private keys</h3> + +<img align="left" src="pic/alice23.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>Alice holds the key.<br clear="left"> +</p> + +<hr> +<h4>Synopsis</h4> + +<tt>ntp-genkeys</tt> + +<h4>Description</h4> + +<p>This program generates random keys used by either or both the +NTPv3/NTPv4 symmetric key or the NTPv4 public key (Autokey) +cryptographic authentication schemes. By default the program +generates the <tt>ntp.keys</tt> file containing 16 random symmetric +keys. In addition, if the <tt>rsaref20</tt> package is configured +for the software build, the program generates cryptographic values +used by the Autokey scheme. These values are incorporated as a set +of three files, <tt>ntpkey</tt> containing the RSA private key, +<tt>ntpkey_<i>host</i></tt> containing the RSA public key, where +<tt><i>host</i></tt> is the DNS name of the generating machine, and +<tt>ntpkey_dh</tt> containing the parameters for the Diffie-Hellman +key-agreement algorithm. All files and are in printable ASCII +format. A timestamp in NTP seconds is appended to each. Since the +algorithms are seeded by the system clock, each run of this program +produces a different file and file name.</p> + +<p>The <tt>ntp.keys</tt> file contains 16 MD5 keys. Each key +consists of 16 characters randomized over the ASCII 95-character +printing subset. The file is read by the daemon at the location +specified by the <tt>keys</tt> configuration file command and made +visible only to root. An additional key consisting of a easily +remembered password should be added by hand for use with the <tt> +ntpq</tt> and <tt>ntpdc</tt> programs. The file must be distributed +by secure means to other servers and clients sharing the same +security compartment. While the key identifiers for MD5 and DES +keys must be in the range 1-65534, inclusive, the <tt> +ntp-genkeys</tt> program uses only the identifiers from 1 to 16. +The key identifier for each association is specified as the key +argument in the <tt>server</tt> or peer configuration file +command.</p> + +<p>The <tt>ntpkey</tt> file contains the RSA private key. It is +read by the daemon at the location specified by the <tt> +privatekey</tt> argument of the <tt>crypto</tt> configuration file +command and made visible only to root. This file is useful only to +the machine that generated it and never shared with any other +daemon or application program.</p> + +<p>The <tt>ntpkey_<i>host</i></tt> file contains the RSA public +key, where <tt><i>host</i></tt> is the DNS name of the host that +generated it. The file is read by the daemon at the location +specified by the <tt>publickey</tt> argument to the <tt>server</tt> +or <tt>peer</tt> configuration file command. This file can be +widely distributed and stored without using secure means, since the +data are public values.</p> + +<p>The <tt>ntp_dh</tt> file contains two Diffie-Hellman parameters: +the prime modulus and the generator. The file is read by the daemon +at the location specified by the <tt>dhparams</tt> argument of the +<tt>crypto</tt> configuration file command. The file can be +distributed by insecure means to other servers and clients sharing +the same key agreement compartment, since the data are public +values.</p> + +<p>The file formats begin with two lines, the first containing the +generating system DNS name and the second the datestamp. Lines +beginning with <tt>#</tt> are considered comments and ignored by +the daemon. In the <tt>ntp.keys</tt> file, the next 16 lines +contain the MD5 keys in order. If necessary, this file can be +further customized by an ordinary text editor. The format is +described in the following section. In the <tt>ntpkey</tt> and <tt> +ntpkey_<i>host</i></tt> files, the next line contains the modulus +length in bits followed by the key as a PEM encoded string. In the +<tt>ntpkey_dh</tt> file, the next line contains the prime length in +bytes followed by the prime as a PEM encoded string, and the next +and final line contains the generator length in bytes followed by +the generator as a PEM encoded string.</p> + +<p>Note: See the file <tt>./source/rsaref.h</tt> in the <tt> +rsaref20</tt> package for explanation of return values, if +necessary.</p> + +<h4>Symmetric Key File Format</h4> + +In the case of DES, the keys are 56 bits long with, depending on +type, a parity check on each byte. In the case of MD5, the keys are +64 bits (8 bytes). <tt>ntpd</tt> reads its keys from a file +specified using the <tt>-k</tt> command line option or the <tt> +keys</tt> statement in the configuration file. While key number 0 +is fixed by the NTP standard (as 56 zero bits) and may not be +changed, one or more of the keys numbered 1 through 15 may be +arbitrarily set in the keys file. + +<p>The key file uses the same comment conventions as the +configuration file. Key entries use a fixed format of the form</p> + +<p><i><tt>keyno type key</tt></i></p> + +<p>where <i><tt>keyno</tt></i> is a positive integer, <i><tt> +type</tt></i> is a single character which defines the key format, +and <i><tt>key</tt></i> is the key itself.</p> + +<p>The key may be given in one of three different formats, +controlled by the <i><tt>type</tt></i> character. The three key +types, and corresponding formats, are listed following.</p> + +<dl> +<dt><tt>S</tt></dt> + +<dd>The key is a 64-bit hexadecimal number in the format specified +in the DES specification; that is, the high order seven bits of +each octet are used to form the 56-bit key while the low order bit +of each octet is given a value such that odd parity is maintained +for the octet. Leading zeroes must be specified (i.e., the key must +be exactly 16 hex digits long) and odd parity must be maintained. +Hence a zero key, in standard format, would be given as <tt> +0101010101010101</tt>.</dd> + +<dt><tt>N</tt></dt> + +<dd>The key is a 64-bit hexadecimal number in the format specified +in the NTP standard. This is the same as the DES format, except the +bits in each octet have been rotated one bit right so that the +parity bit is now the high order bit of the octet. Leading zeroes +must be specified and odd parity must be maintained. A zero key in +NTP format would be specified as <tt>8080808080808080</tt>.</dd> + +<dt><tt>A</tt></dt> + +<dd>The key is a 1-to-8 character ASCII string. A key is formed +from this by using the low order 7 bits of each ASCII character in +the string, with zeroes added on the right when necessary to form a +full width 56-bit key, in the same way that encryption keys are +formed from Unix passwords.</dd> + +<dt><tt>M</tt></dt> + +<dd>The key is a 1-to-8 character ASCII string, using the MD5 +authentication scheme. Note that both the keys and the +authentication schemes (DES or MD5) must be identical between a set +of peers sharing the same key number.</dd> +</dl> + +<p>Note that the keys used by the <tt>ntpq</tt> and <tt>ntpdc</tt> +programs are checked against passwords requested by the programs +and entered by hand, so it is generally appropriate to specify +these keys in ASCII format.</p> + +<h4>Files</h4> + +The RSA Laboratories package <tt>rsaref20</tt> of cryptographic +routines is necessary in order to build and use this program. + +<h4>Bugs</h4> + +It can take quite a while to generate the RSA public/private key +pair and Diffie-Hellman parameters, from a few seconds on a modern +workstation to several minutes on older machines. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/hints.htm b/contrib/ntp/html/hints.htm index 066b4db..fcb533b 100644 --- a/contrib/ntp/html/hints.htm +++ b/contrib/ntp/html/hints.htm @@ -2,7 +2,13 @@ Hints and Kinks </title></head><body><h3> Hints and Kinks -</h3><hr> +</h3> + +<img align=left src=pic/alice35.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm> +from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>Mother in law has all the answers. +<br clear=left><hr> <p>This is an index for a set of troubleshooting notes contained in individual text files in the <tt>./hints</tt> directory. They were @@ -19,7 +25,7 @@ the computer manufacturer (and model numbers where appropriate), operating system (specific version(s) where appropriate), problem description, problem solution and submitter's name and electric address. If the submitter is willing to continue debate on the problem, please so -advise. Bash <a href=http:hints>here</a> for a directory listing. +advise. See the <a href=http:hints>directory listing</a>. <hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> diff --git a/contrib/ntp/html/hints/freebsd b/contrib/ntp/html/hints/freebsd new file mode 100644 index 0000000..ef84732 --- /dev/null +++ b/contrib/ntp/html/hints/freebsd @@ -0,0 +1,15 @@ +If you are compiling under FreeBSD and see messages in the syslogs that +indicate that the ntpd process is trying to use unavailable sched_ +calls, it means you are running a kernel that does not have the POSIX +scheduling calls enabled. + +You have two choices: + +- Ignore the messages + +- Generate a new kernel, where the kernel configuration file contains + the lines: + + options "P1003_1B" + options "_KPOSIX_PRIORITY_SCHEDULING" + options "_KPOSIX_VERSION=199309L" diff --git a/contrib/ntp/html/hints/vxworks.htm b/contrib/ntp/html/hints/vxworks.htm new file mode 100644 index 0000000..b6fae80 --- /dev/null +++ b/contrib/ntp/html/hints/vxworks.htm @@ -0,0 +1,153 @@ +<HTML> +<HEAD> + <TITLE>vxWorks Port of NTP</TITLE> +</HEAD> +<BODY LINK="#00008B" VLINK="#8B0000"> + +<H1>VxWorks port of NTP </H1> + +<P>Creating a port for vxWorks posed some problems. This port may help +as a starting point for similar ports to real-time OS's and other embeddable +kernels, particularly where main() is not allowed, and where the configure +scripts need to be altered. </P> + +<H1><B>Configuration issues</B></H1> + +<P>I decided to do as little invasive surgery as possible on the NTP code, +so I brought the vxWorks header tree in line with the standard unix tree. +The following changes were needed, as a side effect these changes will +allow for easy porting of other autoconfigure enabled code. </P> + +<P>Where I have 386 you will need to put in your target type. The vxWorks +tree entry point is /usr/wind. If these are the same for your system, you +should be able to cut and paste the changes. </P> + +<P><BLINK>WARNING: Check you are not overwriting files, before entering +the following: there should be no conflict, but check first... </BLINK></P> + +<P>export CC="cc386 -nostdlib -m486 -DCPU=I80486 -I/usr/wind/target/h" +<BR> +export RANLIB=ranlib386 <BR> +export AR=ar386 <BR> +export VX_KERNEL=/usr/wind/target/config/ims_std_bsp/vxWorks <BR> +cd /usr/wind/target/sys <BR> +ln -s ../signal.h <BR> +ln -s ../time.h <BR> +ln -s socket.h sockio.h <BR> +ln -s ../selectLib.h select.h <BR> +ln -s ../timers.h <BR> +touch file.h param.h resource.h utsname.h var.h ../netdb.h ../a.out.h ../termios.h +<BR> +echo " ******ADD #include \"sys/times.h\" to sys/time.h +" </P> + +<P>The configure script must be changed in the following way to get the +linking tests to work, once in the correct directory issue the following +commands: <BR> +sed -e 's%main.*()%vxmain()%' configure > configure.vxnew <BR> +mv configure.vxnew configure <BR> +chmod 755 configure </P> +<P>The new version 4 of NTP requires some maths functions so it links in the +maths library (-lm) in the ntpd <a href="../ntpd/Makefile.am">Makefile.am</a> +change the line "ntpd_LDADD = $(LDADD) -lm" by removing the "-lm".<BR> +You are now ready to compile</P> + + +<P><BR> +The <A HREF="../configure.in">configure.in </A>file needed to be altered +to allow for a host-target configuration to take place. </P> + +<UL> +<LI>The define SYS_VXWORKS was added to the compilation flags. </LI> + +<LI>Little endianess is set if the target is of type iX86. </LI> + +<LI>The size of char, integer, long values are all set. If Wind River ever +changes these values they will need to be updated. </LI> + +<LI>clock_settime() is defined to be used for setting the clock. </LI> + +<LI>The Linking flags have -r added to allow for relinking into the vxWorks +kernel </LI> +</UL> + +<P>Unfortunately I have had to make use of the <A HREF="../include/ntp_machine.h">ntp_machine.h +</A>file to add in the checks that would have been checked at linking stage +by autoconf, a better method should be devised. </P> + +<UL> +<LI>There is now a NO_MAIN_ALLOWED define that simulates command line args, +this allows the use of the normal startup sysntax. </LI> + +<LI>POSIX timers have been added. </LI> + +<LI>Structures normally found in netdb.h have been added with, the corresponding +code is in <A HREF="../libntp/machines.c">machines.c </A>. Where possible +the defines for these have been kept non-vxWorks specific.</LI> +</UL> + +<P>Unfortunately there are still quite a few SYS_VXWORKS type defines in +the source, but I have eliminated as many as possible. You have the choice +of using the usrtime.a library avaliable from the vxworks archives or forgoing +adjtime() and using the clock_[get|set]time().The <A HREF="../include/ntp_machine.h">ntp_machine.h +</A>file clearly marks how to do this. </P> + +<H1><B>Compilation issues</B> </H1> + +<P>You will need autoconf and automake ... available free from the gnu +archives worldwide. </P> + +<P>The variable arch is the target architecture (e.g. i486) </P> + +<P>mkdir A.vxworks (or whatever....) <BR> +cd A.vxworks <BR> +../configure --target=arch-wrs-vxworks [any other options] <BR> +make </P> + +<P>Options I normally use are the --disable-all-clocks --enable-LOCAL-CLOCK flags. +The program should proceed to compile without problem. The daemon ntpd, +ntpdate, ntptrace, ntpdc, ntpq programs and of course the libraries are +all fully ported. The other utilities are not, but they should be easy +to port. </P> + +<H1>Running the software </H1> + +<P>Load in the various files, call them in the normal vxWorks function +type manner. Here are some examples. Refer to the man pages for further +information. </P> + +<P>ld < ntpdate/ntpdate <BR> +ld < ntpd/ntpd <BR> +ld < ntptrace/ntptrace <BR> +ld < ntpq/ntpq <BR> +ld < ntpdc/ntpdc <BR> +ntpdate ("-b", "192.168.0.245") <BR> +sp(ntpd, "-c", "/export/home/casey/ntp/ntp.conf") +<BR> +ntpdc("-c", "monlist", "192.168.0.244") +<BR> +ntpq("-c", "peers", "192.168.0.244") <BR> +ntptrace("192.168.0.244") <BR> +</P> + +<H1>Bugs and such </H1> + +<P>Should you happen across any bugs, please let me know, or better yet +fix them and submit a patch. Remember to make you patch general for Vxworks, +not just for your particular architecture. +<A HREF="http://www.ccii.co.za">CCII Systems +(Pty) Ltd</A>, my ex employers, sponsored the time to this port. +Please let me know how it goes, I would be most interested in offsets +and configurations. </P> + +<P><BR> +</P> + +<P>Casey Crellin</A> <BR> +<A HREF="mailto:casey@csc.co.za">casey@csc.co.za</A> </P> + +<P><BR> +</P> + +</BODY> +</HTML> diff --git a/contrib/ntp/html/hints/winnt.htm b/contrib/ntp/html/hints/winnt.htm index 06c0e41..2b675ed 100644 --- a/contrib/ntp/html/hints/winnt.htm +++ b/contrib/ntp/html/hints/winnt.htm @@ -1,5 +1,8 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.7 [en] (WinNT; I) [Netscape]"> <title>NTP on Windows NT</title> </head> <body> @@ -8,10 +11,22 @@ NTP 4.x for Windows NT</h1> <h2> +Do not try to compile NTP-4.0.99i under WINNT, it will not work. +Fixed NTP-4.0.99i; look for next release to be functional. +Sven - May 11 2000 +</h2> + +<h2> +Download NTP-4.0.99g for the last stable WINNT port. +I am working on adapting the major changes starting with 99i +and getting things running again. Sven - April 25 2000 +</h2> + +<h2> Introduction</h2> The NTP 4 distribution runs as service on (i386) Windows NT 4.0 and Windows -2000. The binaries now work on all dual processor systems (mostly Dell) -that have been tested. This port has not been tested on the Alpha platform. +2000. The binaries work on dual processor systems. This port has not been +tested on the Alpha platform. <p>Refer to System Requirements and Instructions for how to compile the program. <h2> @@ -72,9 +87,6 @@ Compiling Requirements</h2> <tt>Microsoft Visual C++ 6.0</tt></li> <li> -<tt>Perl5 </tt><a href="http://www.perl.org">http://www.perl.org</a></li> - -<li> Some version of the archiving program <tt>ZIP</tt>.</li> </ul> @@ -83,10 +95,6 @@ Compiling Instructions</h2> <ol> <li> -Install Perl and set the PERL environment variable to your Perl directory -(e.g. C:\PERL)</li> - -<li> Unpack the NTP-4.x.tar.gz</li> <li> @@ -144,9 +152,9 @@ is no reason that the system clock should be that much off during bootup if 'ntpd' was running before, you may wish to override this default and/or pass other command line directives. <p>Use the registry editor to edit the value for the ntpd executable under -LocalMachine\System\CurrentControlSet\Services\NetworkTimeProtocol. -<p>Add the -g option behind "%INSTALLDIR>\ntpd". This will force NTP to -accept large time errors (including 1.1.1980 00:00) +LocalMachine\System\CurrentControlSet\Services\NTP. +<p>Add the -g option to the ImagePath key, behind "%INSTALLDIR>\ntpd.exe". +This will force NTP to accept large time errors (including 1.1.1980 00:00) <h2> Bug Reports</h2> Send bug reports to <a href="news://comp.protocols.time.ntp">news://comp.protocols.time.ntp</a> @@ -155,6 +163,17 @@ and Sven_Dietrich@Trimble.COM Change Log</h2> <h3> +Last revision 16 February 1999 Version 4.0.99e.</h3> +<b>by Sven Dietrich (sven_dietrich@trimble.com)</b> +<p><b>Significant Changes:</b> +<ul> +<li> +Perl 5 is no longer needed to compile NTP. The configuration script which +creates version.c with the current date and time was modified by Frederick +Czajka [w2k@austin.rr.com] so that Perl is no longer required.</li> +</ul> + +<h3> Last revision 15 November 1999 Version 4.0.98f.</h3> <b>by Sven Dietrich (sven_dietrich@trimble.com)</b> <p><b>Significant Changes:</b> diff --git a/contrib/ntp/html/howto.htm b/contrib/ntp/html/howto.htm index 7d03df9..6e08242 100644 --- a/contrib/ntp/html/howto.htm +++ b/contrib/ntp/html/howto.htm @@ -2,7 +2,12 @@ How to Write a Reference Clock Driver </title></head><body><h3> How to Write a Reference Clock Driver -</h3><hr> +</h3> + +<img align=left src=pic/pogo4.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>Pogo</i>, Walt Kelly</a> + +<p>You need a little magic. +<br clear=left><hr> <h4>Description</h4> diff --git a/contrib/ntp/html/index.htm b/contrib/ntp/html/index.htm index c5cca91..680cec8 100644 --- a/contrib/ntp/html/index.htm +++ b/contrib/ntp/html/index.htm @@ -1,201 +1,261 @@ -<html><head><title> -The Network Time Protocol (NTP) Distribution -</title></head><body><h3> -The Network Time Protocol (NTP) Distribution -</h3> - -<IMG align=left SRC=pic/barnstable.gif>From <i>pogo</i>, Walt Kelly - -<p>Pleased to meet you. -<BR clear=left><HR> - -<H4>Introduction</H4> - -Note: The software contained in this distribution is available without -charge under the conditions set forth in the <A -HREF=copyright.htm>Copyright Notice</A>. - -<P>The Network Time Protocol (NTP) is used to synchronize the time of a -computer client or server to another server or reference time source, -such as a radio or satellite receiver or modem. It provides client -accuracies typically within a millisecond on LANs and up to a few tens -of milliseconds on WANs relative to a primary server synchronized to -Coordinated Universal Time (UTC) via a Global Positioning Service (GPS) -receiver, for example. Typical NTP configurations utilize multiple -redundant servers and diverse network paths, in order to achieve high -accuracy and reliability. Some configurations include cryptographic -authentication to prevent accidental or malicious protocol attacks. - -<P>Background information on computer network time synchronization can -be found on the <A HREF=exec.htm>Executive Summary - Computer Network -Time Synchronization</A> page. Discussion on protocol conformance issues -and interoperability with previous NTP versions can be found in the <A -HREF=biblio.htm>Protocol Conformance Statement</A> page. Discussion on -year-2000 issues can be found in the <A HREF=y2k.htm>Year 2000 -Conformance Statement page</A>. Background information, bibliography and -briefing slides suitable for presentations can be found in the <A -HREF=http://www.eecis.udel.edu/~mills/ntp.htm> Network Time -Synchronization Project</A> page. - -<H4>Building and Installing NTP</H4> - -The <A HREF=build.htm>Building and Installing the Distribution -</A>page presents an overview of the procedures for compiling the -distribution and installing it on a typical client or server. The build -procedures inspect the system hardware and software environment and -automatically select the appropriate options for that environment. While -these procedures work with most computers and operating systems marketed -today, exceptions requiring manual intervention do exist, as documented -in the <A HREF=config.htm>Configuration Options </A>and <A -HREF=release.htm>Release Notes </A>pages. - -<P>Bringing up a NTP primary server requires a radio or satellite -receiver or modem. The distribution includes hardware drivers for over -two dozen radio clocks and modem services. A list of the particular -receivers and modem drivers supported in the distribution is given in -the <A HREF=refclock.htm>Reference Clock Drivers </A>page. For most -popular workstations marketed by Digital, Sun and Hewlett Packard, as -well as widely available Unix clones such as FreeBSD and Linux, the -automatic build procedures select all drivers that run on the target -machine. While this increases the size of the executable binary -somewhat, individual drivers can be included or excluded using the -configure utility documented in the Configuration Options page. - -<H4>Configuring Clients and Servers</H4> -<p>NTP is by its very nature a complex distributed network application -and can be configured and used for a great many widely divergent -timekeeping scenarios. The documentation presented on these pages -attempts to cover the entire suite of configuration, operation and -maintenance facilities which this distribution supports. However, most -applications will need only a few of these facilities. If this is the -case, the <a href=quick.htm>Quick Start</a> page may be useful to get a -simple workstation on the air with an existing server. - -<p>However, in order to participate in the existing NTP synchronization -subnet and obtain accurate, reliable time, it is usually necessary to -construct an appropriate configuration file, commonly called -<TT>ntp.conf</TT>, which establishes the servers and/or external -receivers or modems to be used by this particular machine. Directions -for constructing this file are in the <A HREF=notes.htm>Notes on -Configuring NTP and Setting up a NTP Subnet </A>page. However, in many -common cases involving simple network topologies and workstations, the -file data can be specified entirely on the command line. - -<P>The most important factor in providing accurate, reliable time is the -selection of modes and servers to be used in the configuration file. NTP -support for one or more computers is normally engineered as part of the -existing NTP synchronization subnet. The existing NTP subnet consists of -a multiply redundant hierarchy of servers and clients, with each level -in the hierarchy identified by stratum number. Primary servers operate -at stratum one and provide synchronization to secondary servers -operating at stratum two and so on to higher strata. In this hierarchy, -clients are simply servers that have no dependents. - -<P>The NTP subnet in early 1998 includes 70 public primary (stratum 1) -servers synchronized directly to UTC by radio, satellite or modem and -located in every continent of the globe, except Antarctica (soon). -Normally, client workstations and servers with a relatively small number -of clients do not synchronize to primary servers. There are 106 public -secondary (stratum 2) servers synchronized to the primary servers and -providing synchronization to a total in excess of 100,000 clients and -servers in the Internet. The current lists are maintained in the <A -HREF=http://www.eecis.udel.edu/~mills/ntp/index.htm>Information on Time -and Frequency Services</A> page, which is updated frequently. There are -numerous private primary and secondary servers not normally available to -the public as well. You are strongly discouraged from using these -servers, since they sometimes hide in little ghettos behind dinky links -to the outside world and your traffic can bring up expensive ISDN lines, -causing much grief and frustration. - -<H4>Resolving Problems</H4> - -Like other things Internet, the NTP synchronization subnets tend to be -large and devilishly intricate, with many opportunities for +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>The Network Time Protocol (NTP) Distribution</title> +</head> +<body> +<h3>The Network Time Protocol (NTP) Distribution</h3> + +<img align="left" src="pic/barnstable.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm"><i>P.T. Bridgeport +Bear</i>; from <i>Pogo</i>, Walt Kelly</a> + +<p>Pleased to meet you.<br clear="left"> +</p> + +<hr> +<h4>Introduction</h4> + +Note: The software contained in this distribution is available +without charge under the conditions set forth in the <a href= +"copyright.htm">Copyright Notice</a>. + +<p>The Network Time Protocol (NTP) is used to synchronize the time +of a computer client or server to another server or reference time +source, such as a radio or satellite receiver or modem. It provides +accuracies typically within a millisecond on LANs and up to a few +tens of milliseconds on WANs relative to Coordinated Universal Time +(UTC) via a Global Positioning Service (GPS) receiver, for example. +Typical NTP configurations utilize multiple redundant servers and +diverse network paths in order to achieve high accuracy and +reliability. Some configurations include cryptographic +authentication to prevent accidental or malicious protocol attacks +and some provide automatic server discovery using IP multicast.</p> + +<p>Background information on computer network time synchronization +can be found on the <a href="exec.htm">Executive Summary - Computer +Network Time Synchronization</a> page. Discussion on protocol +conformance issues and interoperability with previous NTP versions +can be found in the <a href="biblio.htm">Protocol Conformance +Statement</a> page. Discussion on how NTP reckons the time can be +found in the <a href="leap.htm">NTP Timescale and Leap Seconds</a> +page. Background information, bibliography and briefing slides +suitable for presentations can be found in the <a href= +"http://www.eecis.udel.edu/~mills/ntp.htm">Network Time +Synchronization Project</a> page. Additional information can be +found at the NTP web site <a href="http://www.ntp.org"> +www.ntp.org</a>. Please send bug reports to <a href= +"mailto:bugs@mail.ntp.org"><bugs@mail.ntp.org></a>.</p> + +<h4>Building and Installing NTP</h4> + +NTP supports Unix and Windows (NT4 and 2000) systems. The <a href= +"build.htm">Building and Installing the Distribution</a> page +presents an overview of the procedures for compiling the +distribution and installing it on a typical client or server. The +build procedures inspect the system hardware and software +environment and automatically select the appropriate options for +that environment. While these procedures work with most computers +and operating systems marketed today, exceptions requiring manual +intervention do exist, as documented in the <a href="config.htm"> +Configuration Options</a> and <a href="release.htm">Release +Notes</a> pages. Note that support for strong cryptography requires +cryptographic libraries not included in this distribution. + +<p>Bringing up a NTP primary server requires a radio or satellite +receiver or modem. It is also possible to configure a machine on an +isolated network with the local clock driver and have other +machines synchronize to it. The distribution includes hardware +drivers for the local clock and over three dozen radio clocks and +modem services. A list of supported drivers is given in the <a +href="refclock.htm">Reference Clock Drivers</a> page. For most +popular workstations marketed by Digital/Compaq, Sun and Hewlett +Packard, as well as widely available Unix clones such as FreeBSD +and Linux, the automatic build procedures select all drivers that +run on the target machine. While this increases the size of the +executable binary somewhat, individual drivers can be included or +excluded using the configure utility documented in the +Configuration Options page.</p> + +<h4>Configuring Clients and Servers</h4> + +<p>NTP is by its very nature a complex distributed network +application and can be configured and used for a great many widely +divergent timekeeping scenarios. The documentation presented on +these pages attempts to cover the entire suite of configuration, +operation and maintenance facilities which this distribution +supports. However, most applications will need only a few of these +facilities. If this is the case, the <a href="quick.htm">Quick +Start</a> page may be useful to get a simple workstation on the air +with an existing server.</p> + +<p>However, in order to participate in the existing NTP +synchronization subnet and obtain accurate, reliable time, it is +usually necessary to construct an appropriate configuration file, +commonly called <tt>ntp.conf</tt>, which establishes the servers +and/or external receivers or modems to be used by this particular +machine. Directions for constructing this file are in the <a href= +"notes.htm">Notes on Configuring NTP and Setting up a NTP +Subnet</a> page. However, in many common cases involving simple +network topologies and workstations, the configuration data can be +specified entirely on the command line for the <a href="ntpd.htm"> +<tt>ntpd</tt> - Network Time Protocol (NTP) daemon</a>.</p> + +<p>The most important factor in providing accurate, reliable time +is the selection of modes and servers to be used in the +configuration file. A discussion on the available modes is on the +<a href="assoc.htm">Association Management</a> page. NTP support +for one or more computers is normally engineered as part of the +existing NTP synchronization subnet. The existing NTP subnet +consists of a multiply redundant hierarchy of servers and clients, +with each level in the hierarchy identified by stratum number. +Primary servers operate at stratum one and provide synchronization +to secondary servers operating at stratum two and so on to higher +strata. In this hierarchy, clients are simply servers that have no +dependents.</p> + +<p>The NTP subnet in late 2000 includes over a hundred public +primary (stratum 1) servers synchronized directly to UTC by radio, +satellite or modem and located in every continent of the globe, +including Antarctica. Normally, client workstations and servers +with a relatively small number of clients do not synchronize to +primary servers. There are over a hundred public secondary (stratum +2) servers synchronized to the primary servers and providing +synchronization to a total in excess of 100,000 clients and servers +in the Internet. The current lists are maintained in the <a href= +"http://www.eecis.udel.edu/~mills/ntp/index.htm">Information on +Time and Frequency Services</a> page, which is updated frequently. +There are numerous private primary and secondary servers not +normally available to the public as well. You are strongly +discouraged from using these servers, since they sometimes hide in +little ghettos behind dinky links to the outside world and your +traffic can bring up expensive ISDN lines, causing much grief and +frustration.</p> + +<h4>Resolving Problems</h4> + +Like other things Internet, the NTP synchronization subnets tend to +be large and devilishly intricate, with many opportunities for misconfiguration and network problems. The NTP engineering model is -specifically designed to help isolate and repair such problems using an -integrated management protocol, together with a suite of monitoring and -debugging tools. There is an optional data recording facility which can -be used to record normal and aberrant operation, log problems to the -system log facility, and retain records of client access. The <A -HREF=debug.htm>NTP Debugging Techniques </A>and <A -HREF=hints.htm>Hints and Kinks </A>pages contain useful information -for identifying problems and devising solutions. - -<P>Users are requested to report bugs, offer suggestions and contribute -additions to this distribution. The <A HREF=patches.htm>Patching -Procedures </A>page suggests procedures which greatly simplify -distribution updates, while the <A HREF=porting.htm>Porting Hints -</A>page suggest ways to make porting this code to new hardware and -operating systems easier. Additional information on reference clock -driver construction and debugging can be found in the <A -HREF=refclock.htm>Reference Clock Drivers </A>page. Further -information on NTP in the Internet can be found in the <A -HREF=http://www.eecis.udel.edu/~ntp>NTP -web page</A>. - -<H4>Program Manual Pages</H4> +specifically designed to help isolate and repair such problems +using an integrated management protocol, together with a suite of +monitoring and debugging tools. There is an optional data recording +facility which can be used to record normal and aberrant operation, +log problems to the system log facility, and retain records of +client access. The <a href="debug.htm">NTP Debugging Techniques</a> +and <a href="hints.htm">Hints and Kinks</a> pages contain useful +information for identifying problems and devising solutions. + +<p>Users are requested to report bugs, offer suggestions and +contribute additions to this distribution. The <a href= +"patches.htm">Patching Procedures</a> page suggests procedures +which greatly simplify distribution updates, while the <a href= +"porting.htm">Porting Hints</a> page suggest ways to make porting +this code to new hardware and operating systems easier. Additional +information on reference clock driver construction and debugging +can be found in the <a href="refclock.htm">Reference Clock +Drivers</a> page. Further information on NTP in the Internet can be +found in the <a href="http://www.eecis.udel.edu/~ntp">NTP web +page</a>.</p> + +<h4>Program Manual Pages</h4> <ul> +<li><a href="ntpd.htm"><tt>ntpd</tt> - Network Time Protocol (NTP) +daemon</a></li> + +<li><a href="ntpq.htm"><tt>ntpq</tt> - standard NTP query +program</a></li> + +<li><a href="ntpdc.htm"><tt>ntpdc</tt> - special NTP query +program</a></li> + +<li><a href="ntpdate.htm"><tt>ntpdate</tt> - set the date and time +via NTP</a></li> -<li><A HREF=ntpd.htm><TT>ntpd</TT> - Network Time Protocol (NTP) -daemon</A></LI> -<LI><A HREF=ntpq.htm><TT>ntpq</TT> - standard NTP query -program</A></LI> -<LI><A HREF=ntpdc.htm><TT>ntpdc</TT> - special NTP query -program</A></LI> -<LI><A HREF=ntpdate.htm><TT>ntpdate</TT> - set the date and time via -NTP</A></LI> -<LI><A HREF=ntptrace.htm><TT>ntptrace</TT> - trace a chain of NTP -servers back to the primary source</A></LI> -<LI><A HREF=tickadj.htm><TT>tickadj</TT> - set time-related kernel -variables</A></LI> -<LI><A HREF=ntptime.htm><TT>ntptime</TT> - read kernel time -variables</A></LI> +<li><a href="ntptrace.htm"><tt>ntptrace</tt> - trace a chain of NTP +servers back to the primary source</a></li> +<li><a href="tickadj.htm"><tt>tickadj</tt> - set time-related +kernel variables</a></li> + +<li><a href="ntptime.htm"><tt>ntptime</tt> - read kernel time +variables</a></li> + +<li><a href="genkeys.htm"><tt>ntp-genkeys</tt> - generate public +and private keys</a></li> </ul> -<H4>Supporting Documentation</H4> +<h4>Supporting Documentation</h4> <ul> +<li><a href="http://www.eecis.udel.edu/~mills/ntp.htm">NTP Project +and Reference Library</a></li> + +<li><a href="copyright.htm">Copyright Notice</a></li> + +<li><a href="exec.htm">Executive Summary - Computer Network Time +Synchronization</a></li> + +<li><a href="biblio.htm">Protocol Conformance Statement</a></li> + +<li><a href="leap.htm">NTP Timescale and Leap Seconds</a></li> + +<li><a href="notes.htm">Notes on Configuring NTP and Setting up a +NTP Subnet</a></li> + +<li><a href="release.htm">NTP Version 4 Release Notes</a></li> + +<li><a href="build.htm">Building and Installing the +Distribution</a></li> + +<li><a href="config.htm">Configuration Options</a></li> -<LI<A HREF=ntp.htm>NTP Reference Library</A></LI> -<LI><A HREF=copyright.htm>Copyright Notice</A></LI> -<LI><A HREF=exec.htm>Executive Summary - Computer Network Time -Synchronization</A></LI> -<LI><A HREF=biblio.htm>Protocol Conformance Statement</A></LI> -<LI><A HREF=y2k.htm>Year 2000 Conformance Statement</A></LI> -<LI><A HREF=notes.htm>Notes on Configuring NTP and Setting up a NTP -Subnet</A></LI> -<LI><A HREF=release.htm>NTP Version 4 Release Notes</A></LI> -<LI><A HREF=build.htm>Building and Installing the -Distribution</A></LI> -<LI><A HREF=config.htm>Configuration Options</A></LI> -<LI><A HREF=debug.htm>NTP Debugging Techniques</A></LI> -<LI><A HREF=refclock.htm>Reference Clock Drivers</A></LI> -<LI><A HREF=patches.htm>Patching Procedures</A></LI> -<LI><A HREF=hints.htm>Hints and Kinks</A></LI> -<LI><A HREF=porting.htm>Porting Hints</A></LI> +<li><a href="debug.htm">NTP Debugging Techniques</a></li> +<li><a href="refclock.htm">Reference Clock Drivers</a></li> + +<li><a href="patches.htm">Patching Procedures</a></li> + +<li><a href="hints.htm">Hints and Kinks</a></li> + +<li><a href="porting.htm">Porting Hints</a></li> </ul> -<H4>Application Notes</H4> +<h4>Application Notes</h4> <ul> +<li><a href="prefer.htm">Mitigation Rules and the <tt>prefer</tt> +Keyword</a></li> + +<li><a href="assoc.htm">Association Management</a></li> + +<li><a href="pps.htm">Pulse-per-second (PPS) Signal +Interfacing</a></li> -<LI><A HREF=prefer.htm>Mitigation Rules and the <TT>prefer</TT> -Keyword</A></LI> -<LI><A HREF=assoc.htm>Association Management</A></LI> -<LI><A HREF=pps.htm>Pulse-per-second (PPS) Signal Interfacing</A></LI> -<LI><A HREF=gadget.htm>Gadget Box PPS Level Converter and CHU -Modem</A></LI> -<LI><A HREF=measure.htm>Time and Time Interval Measurement with -Application to Computer and Network Performance Evaluation</A></LI> -<LI><A HREF=kern.htm>A Kernel Model for Precision Timekeeping</A></LI> -<LI><A HREF=kernpps.htm>A Kernel Programming Interface for Precision -Time Signals</A></LI> +<li><a href="gadget.htm">Gadget Box PPS Level Converter and CHU +Modem</a></li> +<li><a href="measure.htm">Time and Time Interval Measurement with +Application to Computer and Network Performance Evaluation</a></li> + +<li><a href="kern.htm">Kernel Model for Precision +Timekeeping</a></li> + +<li><a href="kernpps.htm">Kernel Programming Interface for +Precision Time Signals</a></li> </ul> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<hr> +<center><img src="pic/pogo1a.gif" alt="gif"></center> + +<br> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/kern.htm b/contrib/ntp/html/kern.htm index b1ee383..4139fb2 100644 --- a/contrib/ntp/html/kern.htm +++ b/contrib/ntp/html/kern.htm @@ -1,51 +1,122 @@ -<HTML><HEAD><TITLE> -A Kernel Model for Precision Timekeeping -</TITLE></HEAD><BODY><H3> -A Kernel Model for Precision Timekeeping -</H3><HR> - -<P>The technical memorandum: <I>A Kernel Model for Precision -Timekeeping</I><A -HREF="http://www.eecis.udel.edu/~mills/database/memos/memo96b.ps"> -(PostScript) </A>describes an engineering model which implements a -precision time-of-day function for a generic operating system. The model -is based on the principles of disciplined oscillators using phase-lock -loops (PLL) and frequency-lock loops (FLL) often found in the -engineering literature. The model uses a hybrid PLL/FLL discipline -algorithm implemented in the kernel. The hybrid loop provides automatic -time and frequency steering with update intervals from a few seconds to -over one day. - -<P>The hybrid PLL/FLL has been implemented in the Unix kernels for -several workstations, including those made by Sun Microsystems, Digital -and Hewlett Packard. Currently, the modifications are in licensed -kernels for Digital Unix 4.0 and Sun Solaris 2.6. Since these specific -implementations involve modifications to licensed code, they cannot be -provided directly. Inquiries should be directed to the manufacturer's -representatives. In addition to the licensed kernels, the hybrid PLL/FLL -has been implemented in the nonlicensed kernels for Linux and FreeBSD. -The engineering model for these implementations, including a simulator -with code segments almost identical to the implementations, but not -involving licensed code, is available via the web at <A -HREF="http://www.eecis.udel.edu/~mills/ntp/ntp">kernel.tar.Z</A> or by -anonymous FTP from ftp.udel.edu in the <TT>pub/ntp</TT> directory. - -<P>The model changes the way the system clock is adjusted in time and -frequency, as well as provides mechanisms to discipline its time and -frequency to an external precision timing source, such as a pulse-per- -second (PPS) signal. The model incorporates a generic system-call -interface for use with the Network Time Protocol (NTP) or similar time -synchronization protocol. The NTP software daemons for Version 3 -<TT>xntpd</TT> and Version 4 <TT>ntpd</TT> operate with this model -to provide synchronization limited in principle only by the accuracy and -stability of the external timing source. There are two new system calls -defined in the model, <TT>ntp_gettime()</TT>, which returns a structure +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Kernel Model for Precision Timekeeping</title> +</head> +<body> +<h3>Kernel Model for Precision Timekeeping</h3> + +<hr> +<img align="left" src="pic/alice61.gif" alt="gif"> <a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>Exploding kernel<br clear="left"> +</p> + +<hr> +<p>The technical report [2], which is a major revision and update +of an earlier report [3], describes an engineering model for a +precision time-of-day function for a generic operating system. The +model is based on the principles of disciplined oscillators using +phase-lock loops (PLL) and frequency-lock loops (FLL) often found +in the engineering literature. The model uses a hybrid PLL/FLL +discipline algorithm implemented in the kernel. The hybrid loop +provides automatic time and frequency steering with update +intervals from a few seconds to over one day.</p> + +<p>The hybrid PLL/FLL has been implemented in the Unix kernels for +several operating systems, including FreeBSD and Linux and those +made by Sun Microsystems, Digital/Compaq and Hewlett Packard. The +modifications are currently included in the licensed kernels for +Digital Unix 4.0 (aka Tru64) and Sun Solaris 2.8. Since the +modifications involve proprietary kernel interface code, they +cannot be provided for other licensed kernels directly. Inquiries +should be directed to the manufacturer's representatives. The +software and documentation, including a simulator with code +segments almost identical to the implementations, but not involving +licensed code, is called <tt>nanokernel.tar.gz</tt> and available +via the web at <a href="http://www.ntp.org">www.ntp.org</a> or by +anonymous FTP from ftp.udel.edu in the <tt>pub/ntp/software</tt> +directory.</p> + +<p>Recently [1], the model has been re-implemented to support a +nanosecond system clock. The <tt>/usr/include/sys/timex.h</tt> +header file defines the applications programming interface (API) +routines and data structures. Implementations are available for +Linux, FreeBSD, SunOS and Tru64; however, only the Linux and +FreeBSD implementations, which are included in recent system +versions, are directly available. The software and documentation, +including a simulator with code segments almost identical to the +implementations, but not involving licensed code, is called <tt> +nanokernel.tar.gz</tt> and available via the web at <a href= +"http://www.ntp.org">www.ntp.org</a> or by anonymous FTP from +ftp.udel.edu in the <tt>pub/ntp/software</tt> directory.</p> + +<p>The model changes the way the system clock is adjusted in time +and frequency, as well as provides mechanisms to discipline its +time and frequency to an external precision timing source, such as +described in the <a href="pps.htm">Pulse-per-second (PPS) Signal +Interfacing</a> page. The model incorporates a generic system call +interface for use with the NTP or similar time synchronization +protocol. The NTP software daemons for Version 3 <tt>xntpd</tt> and +Version 4 <tt>ntpd</tt> use this API to provide synchronization +limited in principle only by the accuracy and stability of the +external timing source. There are two new system calls defined in +<tt>timex.h</tt>, <tt>ntp_gettime()</tt>, which returns a structure including the current time, estimated error and maximum error, and -<TT>ntp_adjtime()</TT>, which provides a means to adjust kernel -variables, including the current time and frequency offsets. Further -information on the calling sequences and variable definitions are in the -<TT>/usr/include/sys/timex.h</TT> file. - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<tt>ntp_adjtime()</tt>, which provides a means to adjust kernel +variables, including the current time and frequency offsets.</p> + +<p>These kernel modifications are normally used in conjunction with +a kernel hardware interface such as described in the <a href= +"kernpps.htm">Kernel Programming Interface for Precision Time +Signals</a> page.</p> + +<h4>References</h4> + +<ol> + +<li><p>Mills, D.L., and P.-H. Kamp. The nanokernel. <i>Proc. Precision +Time and Time Interval (PTTI) Applications and Planning Meeting</i> +(Reston VA, November 2000). Paper: <a href= +"database/papers/nano/nano2.ps">PostScript</a> | <a href= +"http://www.eecis.udel.edu/~mills/database/papers/nano/nano2.pdf"> +PDF</a>, Slides: <a href= +"http://www.eecis.udel.edu/~mills/database/brief/nano/nano.htm"> +HTML</a> | <a href= +"http://www.eecis.udel.edu/~mills/database/brief/nano/nano.ps"> +PostScript</a> | <a href= +"http://www.eecis.udel.edu/~mills/database/brief/nano/nano.pdf"> +PDF</a> | <a href= +"http://www.eecis.udel.edu/~mills/database/brief/nano/nano.ppt"> +PowerPoint</a></p></li> + +<li><p>Mills, D.L. Unix kernel modifications for precision time +synchronization. Electrical Engineering Department Report 94-10-1, +University of Delaware, October 1994, 24 pp. Abstract: <a href= +"http://www.eecis.udel.edu/~mills/database/reports/kern/kerna.ps"> +PostScript</a> | <a href="database/reports/kern/kerna.pdf">PDF</a>, +Body: <a href= +"http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.ps"> +PostScript</a> | <a href= +"http://www.eecis.udel.edu/~mills/database/reports/kern/kernb.pdf"> +PDF</a></p></li> + +<li><p>Mills, D.L. A kernel model for precision timekeeping. Network +Working Group Report RFC-1589, University of Delaware, March 1994. +31 pp. <a href= +"http://www.eecis.udel.edu/~mills/database/rfc/rfc1589.txt"> +ASCII</a></p></li> +</ol> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/kernpps.htm b/contrib/ntp/html/kernpps.htm index fe003f7..d9c9643 100644 --- a/contrib/ntp/html/kernpps.htm +++ b/contrib/ntp/html/kernpps.htm @@ -1,25 +1,23 @@ <html><head><title> -A Kernel Programming Interface for Precision Time Signals +Kernel Programming Interface for Precision Time Signals Network Performance Evaluation </title></head><body><h3> -A Kernel Programming Interface for Precision Time Signals +Kernel Programming Interface for Precision Time Signals </h3><hr> -<p>The technical memorandum: <cite>A Kernel Programming Interface for -Precision Time Signals</cite><a -href="http://www.eecis.udel.edu/~mills/database/memos/memo96c.ps"> -(PostScript) </a> describes a proposed programming interface for -external precision time signals, such as the pulse-per-second (PPS) -signal generated by some radio clocks and cesium oscillators. - -<p>The memorandum argues for a generic capability in the ubiquitous Unix -kernel, which could be used for a wide variety of measurement -applications, including network time synchronization and experiments -involving performance measurement and evaluation of computer networks -and transmission systems. The hardware to do this requires only a serial -port and a modem control lead, such as the data carrier detect (DCD) -lead, which can be driven by an external source via a level -converter/pulse generator. +<p>The technical report [1] describes a proposed application programming interface (API) for external precision time signals, such as the pulse-per-second (PPS) signal generated by some radio clocks and cesium oscillators. The report argues for a generic capability in the ubiquitous Unix kernel, which could be used for a wide variety of measurement applications, including network time synchronization and experiments involving performance measurement and evaluation of computer networks and transmission systems. The hardware to do this requires only a serial port and a modem control lead, such as the data carrier detect (DCD) lead, which can be driven by an external source via a level converter/pulse generator. + +<p>Support for this API has been implemented in the NTP Version 4 software distribution. The <tt>/usr/include/sys/timepps.h</tt> header file defines the API interface routines and data structures. The API obsoletes previous APIs based on the <tt>tty_clock</tt> and <tt>ppsclock</tt> line disciplines and streams modules, which are no longer supported. The API used by the <a href=driver22.htm>PPS Clock Discipline</a> driver (type 22) to support PPS signals via either a serial port or parallel port, depending on the operating system. The API is supported in stock FreeBSD from 3.4 and with the addition of the <tt>PPSkit</tt> kernel software in Linux. Limited support for Solaris from 2.8 is available using the <tt>timepps.h.solaris</tt> header file included in this distribution. Copy this file to <tt>/usr/include/sys</tt> before configuring the distributution. + +<p>The API is normally used in conjunction with the precision time kernel modifications described in the <a href=kern.htm>Kernel Model for Precision Timekeeping</a> page. + +<h4>Reference</h4> + +<ol> + +<p><li>Mogul, J., D. Mills, J. Brittenson, J. Stone and U. Windl. Pulse-per-second API for Unix-like operating systems, version 1. Request for Comments RFC-2783, Internet Engineering Task Force, March 2000, 31 pp. <a href=http://www.eecis.udel.edu/~mills/database/rfc/rfc2783.txt>ASCII</a> + +</ol> <hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> diff --git a/contrib/ntp/html/ldisc.htm b/contrib/ntp/html/ldisc.htm index 5dd7326..e6a026a 100644 --- a/contrib/ntp/html/ldisc.htm +++ b/contrib/ntp/html/ldisc.htm @@ -1,4 +1,3 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN"> <html><head><title> Line Disciplines and Streams Modules </title></head><body><h3> @@ -7,125 +6,66 @@ Line Disciplines and Streams Modules <p><h4>Description</h4> -<p>Most radio and modem clocks used for a primary (stratum-1) NTP server -utilize serial ports operating at speeds of 9600 baud or greater. The -timing jitter contributed by the serial port hardware and software -driver can accumulate to several milliseconds on a typical Unix -workstation. In order to reduce these errors, a set of special line -disciplines and stream modules can be configured in the Unix kernel. -These routines intercept special characters or signals provided by the -radio or modem clock and save a local timestamp for later processing. - -<p>The routines can be compiled in the kernel in older BSD-derived -systems, or installed as System V streams modules and either compiled in -the kernel or dynamically loaded when required. In either case, they -require minor changes in some kernel files and in the NTP daemon -<code>ntpd</code>. The streams modules can be pushed and popped from -the streams stack using conventional System V streams program -primitives. Note that not all Unix kernels support line disciplines and -of those that do, not all support System V streams. The disciplines here -are known to work correctly with SunOS 4.x kernels, but have not been -tested for other kernels. - -<p>There are two line disciplines and a special streams module included -in the distribution. Support for each in <code>ntpd</code> is enabled -by adding flags to the <code>DEFS_LOCAL</code> line of the -<code>ntpd</code> configuration file <code>./Config.local</code>. This -can be done automatically by the autoconfiguration build procedures, or -can be inserted/deleted after the process has completed. +<p>Most radio and modem clocks used for a primary (stratum-1) NTP server utilize serial ports operating at speeds of 9600 baud or greater. The intrinsic delay and jitter contributed by the serial port hardware and software driver can accumulate up to a millisecond in newer Unix systems and tens of milliseconds in older ones. In order to reduce the effects of delay and jitter, a set of special line disciplines, stream modules and operating system calls (ioctls) can be configured in some Unix kernels. These routines intercept special characters or signals provided by the radio or modem clock and save a timestamp for later processing. + +<p>The routines provide two important functions. Some insert a timestamp in the receive data stream upon occurance of a designated character or characters at the serial interface. This can be used to timestamp an on-time character produced by a radio clock, for example. Other routines support an application program interface for pulse-per-second (PPS) signals generated by some radio clocks and laboratory instruments. These routines are normally accessed through the PPSAPI application program interface described below. + +<p>The routines can be compiled in the kernel in older BSD-derived systems, or installed as System V streams modules and either compiled in the kernel or dynamically loaded when required. In either case, they require minor changes in some kernel files and in the NTP daemon <tt>ntpd</tt>. The streams modules can be pushed and popped from the streams stack using conventional System V streams program primitives. Note that some Unix kernels do not support line disciplines and some do not support System V streams. The routines described here are known to work correctly with the Unix kernels called out in the descriptions, but have not been tested for other kernels. + +<h4>PPSAPI Application Program Interface</h4> + +<p>Pulse-per-second (PPS) signals are normally processed as described in the <a href=pps.htm>Pulse-per-second (PPS) Signal Interfacing</a> page. The <a href=driver22.htm>PPS Clock Discipline</a> driver uses the PPSAPI application program interface to capture PPS signal transitions used to fine-tune the system clock. This interface, defined in RFC-2783, is the only PPS interface supported in NTP. While older PPS interfaces based on the ioctls described below continue to be supported, they are used only in the special header file <t>/usr/include/sys/timepps.h</tt>, which implements the PPSAPI specific to each archeticture and operating system. + +<p>It is the intent of the evolving design to remove all PPS support from the various clock drivers and utilize only the PPS driver for PPS support. This allows the required sanity checks and signal grooming to be provided and maintained in one place and avoids cluttering up the drivers with duplicate functionality. Since the PPS signal samples are processed by the entire suite of NTP grooming, selection and clustering algorithms, noisy PPS signals and signals outside specific time and frequency tolerances are excluded. + +<p>The PPSAPI interface provides the following functions: <dl> -<dt><code>tty_clk</code> -<dd>This routine intercepts characters received from the serial port and -passes unchanged all except a set of designated characters to the -generic serial port discipline. For each of the exception characters, -the character is inserted in the receiver buffer followed by a local -timestamp in Unix <code>timeval</code> format. Both -<code>select()</code> and <code>SIGIO</code> are supported by the -routine. The <code>-DTTYCLK</code> flag is used to compile support for -this discipline in <code>ntpd</code>. This flag is automatically -included if the <code>clkdefs.h</code> file is found in the -<code>/usr/include/sys</code> directory, or it can be added (or deleted) -manually. This module must be configured in the kernel during the kernel -build process, as described in the <code>README</code> file in the -<code>./kernel</code> directory. - -<p><dt><code>tty_chu</code> -<dd>This routine is a special purpose line discipline for receiving a -special timecode broadcast by Canadian time and frequency standard -station CHU. The radio signal is first demodulated by the 300-baud modem -included in the gadget box, then processed by the discipline and finally -processed by the CHU modem driver (type 7) described in the <a href = -"refclock.htm"> Reference Clock Drivers </a> page. This discipline -should be used in raw mode. The <code>-DCHUCLK</code> flag is used to -compile support for this discipline in <code>ntpd</code>. This flag is -automatically included if the <code>chudefs.h</code> file is found in -the <code>/usr/include/sys</code> directory, or it can be added (or -deleted) manually. This module must be configured in the kernel during -the kernel build process, as described in the <code>README</code> file -in the <code>./kernel</code> directory. -<p><dt><code>ppsclock</code> -<dd>This routine is a special purpose streams module which monitors the -state of the data carrier detect (DCD) modem interface signal. It is -normally used in connection with a pulse-per-second (PPS) signal -generated by some radio clocks, which requires a hardware level -converter/pulse generator, such as described in the <a href = -"gadget.htm"> Gadget Box PPS Level Converter and CHU Modem </a> page. -For each positive-going edge of the DCD signal, the -<code>ppsclock</code> module captures a timestamp in Unix -<code>timeval</code> format for later retrieval using a special -<code>ioctl()</code> system call. The <code>-DPPS</code> flag is used to -compile support for this module in <code>ntpd</code>. This flag is -automatically included if the <code>ppsclock.h</code> file is found in -the <code>/sys/sys</code> directory, or it can be added (or deleted) -manually. This module must also be configured in the kernel during the -kernel build process, as described in the <code>README</code> file in -the <code>./kernel</code> directory. +<dt><tt>time_pps_create</tt> +<dd>Creates a PPS interface instance and returns a handle to it.</dd> + +<dt><tt>time_pps_destroy</tt> +<dd>Destroys a PPS interface and returns the resources used.</dd> + +<dt><tt>time_pps_setparams</tt> +<dd>Sets the parameters associated with a PPS interface instance, including offsets to be automatically added to captured timestamps.</dd> + +<dt><tt>time_pps_getparams</tt> +<dd>Returns the parameters associated with a PPS interface instance.</dd> + +<dt><tt>time_pps_getcap</tt> +<dd>Returns the capabilities of the current interface and kernel implementation.</dd> + +<dt><tt>time_pps_fetch</tt> +<dd>Returns the current timestamps associated with a PPS interface instance in either nanoseconds and nanoseconds (Unix <tt>timespec</tt>) or seconds and fraction (NTP) format.</dd> + +<dt><tt>time_pps_kcbind</tt> +<dd>If kernel PPS processing is supported, this binds the support to the associated PPS interface instance.</dd> </dl> -<p>There are two versions of both the <code>tty_clk</code> and -<code>chu_clk</code> programs. The <code>tty_clk.c</code> and -<code>chu_clk.c</code> are designed for use with older BSD systems and -are compiled in the kernel. The <code>tty_clk_STREAMS.c</code> and -<code>chu_clk_STREAMS.c</code> are designed for use with System V -streams, in which case they can be either compiled in the kernel or -dynamically loaded. Since these programs are small, unobtrusive, and do -nothing unless specifically enabled by an application program, it -probably doesn't matter which version is chosen. Instructions on how to -configure and build a kernel supporting either or both of these line -disciplines is in the <code>README</code> file in the -<code>./kernel</code> directory. - -<p><h4>How to Use the <code>tty_clk</code> Line Discipline</h4> - -<p>The tty_clk line discipline defines a new <code>ioctl()</code>, -<code>CLK_SETSTR</code>, which takes a pointer to a string of no more -than 32 characters. Until the first <code>CLK_SETSTR</code> is -performed, the discipline will simply pass through characters. Once it -is passed a string by <code>CLK_SETSTR</code>, any character in that -string will be immediately followed by a timestamp in Unix -<code>timeval</code> format. You can change the string whenever you want -by doing another <code>CLK_SETSTR</code>. The character must be an -exact, 8 bit match. The character '\000' cannot, be used, as it is the -string terminator. Passing an empty string to <code>CLK_SETSTR</code> -turns off timestamping. Passing <code>NULL</code> will produce undefined -results. - -<p><h4>How to Use the <code>tty_chu</code> Line Discipline</h4> - -<p>The tty_chu line discipline translates data received from the CHU -modem and returns <code>chucode</code> structures, as defined in -chudefs.h, and expected by the Scratchbuilt CHU Receiver reference clock -driver. Depending on the settings of <code>PEDANTIC</code> and -<code>ANAL_RETENTIVE</code> used when compiling the kernel, some -checking of the data may or may not be necessary. - -<p><h4>How to Use the <code>ppsclock</code> Stream Module</h4> - -<p>The ppsclock streams module implements an <code>ioctl() -CIOGETEV</code>, which takes a pointer to the structure +<p>The entire PPS interface functionality is currently provided by inline code in the <tt>timepps.h</tt> header files implemented for SunOS, Solaris, FreeBSD, Linux and Tru64. While not all implementations support the full PPSAPI specification, they do support all the functions required for the PPS driver. The FreeBSD, Linux and Solaris implementations can be used with the stock kernels provided with those systems; however, the Tru64 and SunOS kernels require additional functions not provided in the stock kernels. Solaris users are cautioned that these ioctls function improperly in Solaris versions prior to 2.8 with patch Generic_108528-02. + +<h4><tt>tty_clk</tt> Line Discipline/Streams Module</h4> + +<p>This routine intercepts characters received from the serial port and passes unchanged all except a set of designated characters to the generic serial port discipline. For each of the exception characters, the character is inserted in the receiver buffer followed by a local timestamp in Unix <tt>timeval</tt> format. Both <tt>select()</tt> and <tt>SIGIO</tt> are supported by the routine. Support for this routine is automatically detected during the NTP build process and interface code compiled as necessary. + +<p>There are two versions of the <tt>tty_clk</tt> routine. The <tt>tty_clk.c</tt> line discipline is designed for older BSD systems and is compiled in the kernel. The <tt>tty_clk_STREAMS.c</tt> is designed for System V streams, in which case it can be either compiled in the kernel or dynamically loaded. Since these programs are small, unobtrusive, and do nothing unless specifically enabled by an application program, it probably doesn't matter which version is chosen. Instructions on how to configure and build a kernel supporting either of these routines is in the <tt>README</tt> file in the <tt>./kernel</tt> directory. + +<p>The <tt>tty_clk</tt> routine defines a new ioctl <tt>CLK_SETSTR</tt>, which takes a pointer to a string of no more than 32 characters. Until the first <tt>CLK_SETSTR</tt> is performed, the routine will simply pass through characters. Once it is passed a string by <tt>CLK_SETSTR</tt>, any character in that string will be immediately followed by a timestamp in Unix <tt>timeval</tt> format. You can change the string whenever you want by doing another <tt>CLK_SETSTR</tt>. The character must be an exact, 8 bit match. The character '\000' cannot, be used, as it is the string terminator. Passing an empty string to <tt>CLK_SETSTR</tt> turns off timestamping. Passing <tt>NULL</tt> may produce surprising results. + +<p><h4><tt>TIOCDCDTIMESTAMP</tt> ioctl in FreeBSD</h4> + +<p>This ioctl is included in FreeBSD 2.2 and later. It causes a timestamp to be inserted in the serial port receive data stream when the data carrier detect (DCD) signal is asserted. This is useful for those radio clocks that indicate the on-time epoch by means of a modem control signal. It is not recommended that this be used for PPS timestamps, as this function is available using the PPS application program interface included in FreeBSD 3.4 and later. + +<p>The <tt>TIOCDCDTIMESTAMP</tt> ioctl() is detected and compiled automatically on FreeBSD systems if available. With FreeBSD 2.2 the measured delay between activation of the DCD signal and the time the timestamp is captured on a 66MHz 486DX2 is 19 <font face=Symbol>m</font>s and on a 100MHz Pentium is 6 <font face=Symbol>m</font>s. + +<h4><tt>ppsclock</tt>Streams Module</h4> + +<p>This routine is a streams module which causes a timestamp to be captured when the DCD signal is asserted. It is normally used in connection with a PPS signal generated by some radio clocks. However, it is normally used only by the PPSAPI interface and should be avoided in other contexts. Instructions on how to configure and build a kernel supporting either of these routines is in the <tt>README</tt> file in the <tt>./kernel</tt> directory. + +<p>The ppsclock streams module implements the <tt>CIOGETEV</tt> ioctl, which takes a pointer to the structure <pre> struct ppsclockev { @@ -134,28 +74,16 @@ struct ppsclockev { }; </pre> -<p>The ppsclock module is pushed on the streams stack of the serial port -connected to the PPS signal. The port must be configured for local -operation, rather than remote (modem) operation. At each positive-going -edge of the DCD signal, the routine latches the current local timestamp -and increments a counter. At each <code>CIOGETEV ioctl()</code> call, -the current values of the timestamp and counter are returned in the -<code>ppsclockev</code> structure. - -<p><h4>TIOCDCDTIMESTAMP timestamping</h4> - -<p>On FreeBSD 2.2 and later systems the TIOCDCDTIMESTAMP ioctl is used -to read the timestamp when the DCD serial go active. To use this the -PPS signal must be tied to the serial port DCD signal through the -appropriate level converters and pulse stretch circuitry if necessary. -This enhances the accuracy of the driver to a few microseconds. Using -FreeBSD 2.2 the measured delay between activation of the PPS signal and -the time the timestamp is made on a 66MHz 486DX2 is 19us and on a -100MHz Pentium is 6us. The driver does NOT compensate for this. - -<p>The TIOCDCDTIMESTAMP timestamping ioctl() is used automatically -on FreeBSD systems if available. It is integrated into the -refclock_gtlin() function so any driver using it will benefit from -the enhanced accuracy. - -<hr><address>David L. Mills (mills@udel.edu)</address></body></html> +<p>The <tt>ppsclock</tt> module is pushed on the streams stack of the serial port connected to the DCD line. At each positive-going edge of the PPS signal, the routine latches the current local timestamp and increments a counter. At each <tt>CIOGETEV</tt> ioctl call, the current values of the timestamp and counter are returned in the <tt>ppsclockev</tt> structure. + +<p><h4><tt>TIOCSPPS</tt> and <tt>TIOCGETPPSEV</tt> ioctls in Solaris</h4> + +<p>These ioctls are included in Solaris 2.4 and later. They implement the same function as the <tt>ppsclock</tt> streams module, but are implemented as integrated system calls independent of the streams facility. They are normally used in connection with a pulse-per-second (PPS) signal generated by some radio clocks. However, these ioctls are normally used only by the PPSAPI interface and should be avoided in other contexts. See the Sun documentation for the calling sequence and return values. + +<p>Users are cautioned that these ioctls function improperly in Solaris versions prior to 2.8 with patch Generic_108528-02. + +<h4><tt>tty_chu</tt> Line Discipline/Streams Module (depredated)</h4> + +<p>This routine is a special purpose line discipline for receiving a special timecode broadcast by Canadian time and frequency standard station CHU. It has been removed from the distribution since its function has been replaced by the <a href=driver7.htm>Radio CHU Audio Demodulator/Decoder (type 7)</a> clock driver. + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/leap.htm b/contrib/ntp/html/leap.htm new file mode 100644 index 0000000..97bf8d4 --- /dev/null +++ b/contrib/ntp/html/leap.htm @@ -0,0 +1,250 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>NTP Timescale and Leap Seconds</title> +</head> +<body> +<h3>NTP Timescale and Leap Seconds</h3> + +<img align="left" src="pic/alice15.gif" alt="gif"><a href= +"pictures.htm">from <i>Alice's Adventures in Wonderland</i>, Lewis +Carroll</a> + +<p>The Mad Hatter and the March Hare are discussing whether the +Teapot serial number should have two or four digits.<br clear= +"left"> +</p> + +<hr> +<h4>Introduction</h4> + +<p>In the year 2001 the Network Time Protocol (NTP) has been in use +for over two decades and remains the longest running, continuously +operating application protocol in the Internet. There was some +concern, especially in government and financial institutions, that +NTP might cause Internet applications to misbehave in terrible ways +on the epoch of the new century, but this didn't happen. However, +how NTP reckons the time is important when considering the +relationship between NTP time and conventional civil time.</p> + +<p>This document presents an analysis of the NTP timescale, in +particular the metrication relative to the conventional civil +timescale and when the NTP timescale rolls over in 2036. These +issues are also important with respect to the Unix timescale, but +that rollover will not happen until 2038. This document does not +establish a standard, nor does it present specific algorithms which +metricate the NTP timescale with respect to other timescales.</p> + +<h4>The NTP Timescale</h4> + +<p>It will be helpful in understanding the issues raised in this +document to consider the concept of a universal timescale. The +conventional civil timescale used in most parts of the world is +based on Coordinated Universal Time (UTC) (sic), formerly known as +Greenwich Mean Time (GMT). UTC is based on International Atomic +Time (TAI sic), which is derived from hundreds of cesium clocks in +the national standards laboratories of many countries. Deviations +of UTC from TAI are implemented in the form of leap seconds, which +occur on average every eighteen months.</p> + +<p>For almost every computer application today, UTC represents the +universal timescale extending into the indefinite past and +indefinite future. We know of course that the UTC timescale did not +exist prior to 1972, the Gregorian calendar did not exist prior to +1582, the Julian calendar did not exist prior to 54 BC and we +cannot predict exactly when the next leap second will occur. +Nevertheless, most folks would prefer that, even if we can't get +future seconds numbering right beyond the next leap second, at +least we can get the days numbering right until the end of +reason.</p> + +<p>The universal timescale can be implemented using a binary +counter of indefinite width and with the unit seconds bit placed +somewhere in the middle. The counter is synchronized to UTC such +that it runs at the same rate (also the rate of TAI) and the units +increment coincides with the UTC seconds tick. The NTP timescale is +constructed from 64 bits of this counter, of which 32 bits number +the seconds and 32 bits represent the fraction. With this design, +the counter runs in 136-year cycles, called eras, the latest of +which began with a counter value of zero at 0h 1 January 1900. The +next era will begin when the seconds counter rolls over sometime in +2036. The design assumption is that further low order bits, if +required, are provided by local interpolation, while further high +order bits, when required, are provided by external means.</p> + +<p>The important point to be made here is that the high order bits +must ultimately be provided by astronomers and disseminated to the +population by international means. Ultimately, should a need exist +to align a particular NTP era to the current calendar, the +operating system in which NTP is embedded must provide the +necessary high order bits, most conveniently from the file system +or flash memory.</p> + +<p>With respect to the recent year 2000 issue, the most important +thing to observe about the NTP timescale is that it knows nothing +about days, years or centuries, only the seconds since the +beginning of the current era which began on 1 January 1900. On 1 +January 1970 when Unix life began, the NTP timescale showed +2,208,988,800 and on 1 January 1972 when UTC life began, it showed +2,272,060,800. On the last second of the year 1999, the NTP +timescale showed 3,155,673,599 and one second later on the first +second of the next century showed 3,155,673,600. Other than this +observation, the NTP timescale has no knowledge of or provision for +any of these eclectic seconds.</p> + +<h4>Conversion to Other Timescales</h4> + +<p>The NTP timescale is almost never used directly by system or +application programs. The generic Unix kernel keeps time in seconds +and microseconds (or nanoseconds) to provide both time of day and +interval timer functions. In order to synchronize the Unix clock, +NTP must convert to and from NTP representation and Unix +representation. Unix kernels implement the time of day function +using two 32-bit counters, one representing the signed seconds +since Unix life began and the other the microseconds or nanoseconds +of the second. In principle, the seconds counter will change sign +in 2038. How the particular Unix semantics interprets the counter +values is of concern, but is beyond the scope of discussion +here.</p> + +<p>While incorrect NTP time values are unlikely in a properly +configured subnet using strong cryptography, redundant sources and +diverse network paths, hazards remain due to incorrect software +external to NTP. These include the Unix kernel and library routines +which convert NTP time to and from Unix time and to and from +conventional civil time in seconds, minutes, hours, days and years. +Although NTP uses these routines to format monitoring data +displays, they are not used to read or set the NTP clock. They may +in fact cause problems with certain application programs, but this +is not an issue which concerns NTP correctness.</p> + +<p>It is possible that some external source to which NTP +synchronizes may produce a discontinuity which could then induce a +NTP discontinuity. The NTP primary (stratum 1) time servers, which +are the ultimate time references for the entire NTP population, +obtain time from various sources, including radio and satellite +receivers and telephone modems. Not all sources provide year +information and not all of these provide time in four-digit form. +In point of fact, the NTP reference implementation does not use the +year information, even if available. Instead, the year information +is provided from the file system, which itself depends on the Unix +clock.</p> + +<p>Most computers include a time-of-year (TOY) clock chip which +maintains the time when the power is off. When the operating system +is booted, the system clock is set from the chip. As the chip does +not record the year, this value is determined from the datestamp on +a system configuration file. For this to be correct, the filestamp must by updated at least once each year. The NTP protocol specification +requires the apparent NTP time derived from external servers to be +compared to the system time before the clock is set. If the +discrepancy is over 1000 seconds, an error alarm is raised +requiring manual intervention. This makes it very unlikely that +even a clique of seriously corrupted NTP servers will result in +grossly incorrect time values. When the system clock is synchronized to +NTP, the TOY chip is corrected to system time on a regular +basis.</p> + +<h4>Timescale Resolution and the Tick Interval</h4> + +<p>Modern computer clocks use a hardware counter to generate processor interrupts at tick intervals in the order of a few milliseconds. At each tick the processor increments the software system clock by the number of microseconds or nanoseconds in the tick. The software resolution of the system clock is defined as the tick interval. Most modern processors implement some kind of high resolution hardware counter that can be used to interpolate the interval between the most recent tick and the actual clock reading. The hardware resolution of the system clock is defined as the time between increments of this counter. However, the actual reading latency due to the kernel interface and interpolation code can range from a few tens of microseconds in older processors to under a microsecond in modern processors.</p> + +<p>System clock correctness principles require that clock readings must be always monotonically increasing, so that no two clock readings will be the same. As long as the reading latency exceeds the hardware resolution, this behavior is guaranteed. With reading latencies dropping below the microsecond in modern processors, the system clock in modern operating systems runs in nanoseconds, rather than the microseconds used in the original Unix kernel. With processor speeds exceeding 1 GHz, this assumption may be in jeopardy. + +<h4>Leap Seconds</h4> + +<p>The International Earth Rotation Service (IERS) uses +astronomical observations provided by USNO and other observatories +to determine UTC, which is syntonic (identical frequency) with TAI +but offset by a integral number of seconds. Starting from apparent +mean solar time as observed, the UT0 timescale is determined using +corrections for Earth orbit and inclination (the Equation of Time, +as used by sundials), the UT1 (navigator's) timescale by adding +corrections for polar migration and the UT2 timescale by adding +corrections for known periodicity variations. UTC is based on UT1, +which is presently fast relative to TAI by a fraction of a second +per year. Since the UTC timescale runs at the TAI rate, when the +magnitude of the UT1 correction approaches 0.5 second, a leap +second is inserted or deleted in the UTC timescale on the last day +of June or December.</p> + +<p>For the most precise coordination and timestamping of events +since 1972, it is necessary to know when leap seconds are +implemented in UTC and how the seconds are numbered. The insertion +of leap seconds into UTC is currently the responsibility of the +IERS, which is located at the Paris Observatory. As specified in +CCIR Report 517, a leap second is inserted following second +23:59:59 on the last day of June or December and becomes second +23:59:60 of that day. A leap second would be deleted by omitting +second 23:59:59 on one of these days, although this has never +happened. A table of historic leap seconds and the NTP time when +each occurred is available via FTP from any NIST NTP server.</p> + +<p>The UTC timescale thus ticks in standard (atomic) seconds and +was set to an initial offset of 10 seconds relative to TAI at 0h +MJD 41,318.0 according to the Julian calendar or 0h on 1 January +1972 according to the Gregorian calendar. This established the +first tick of the UTC era and its reckoning with these calendars. +Subsequently, the UTC timescale has marched backward relative to +the TAI timescale exactly one second on scheduled occasions +recorded in the institutional memory of our civilization. Note in +passing that leap second adjustments affect the number of seconds +per day and thus the number of seconds per year. Apparently, should +we choose to worry about it, the UTC clock, Gregorian calendar and +various cosmic oscillators will inexorably drift apart with time +until rationalized by some future papal bull.</p> + +<h4>Reckoning with NTP and UTC Leap seconds</h4> + +<p>The NTP timescale is based on the UTC timescale, but not +necessarily always coincident with it. At the first tick of the UTC +Era, which began at 0h on 1 January 1972 (MJD 41,318.0) the NTP +clock read 2,272,060,800, representing the number of standard +seconds since the beginning of the NTP era at 0h on 1 January 1900 +(MJD 15,021.0) according to the Gregorian calendar. The insertion +of leap seconds in UTC and subsequently into NTP does not affect +the UTC or NTP oscillator frequency, only the conversion between +NTP network time and UTC civil time. However, since the only +institutional memory available to NTP are the UTC broadcast +services, the NTP timescale is in effect reset to UTC as each +broadcast timecode is received. Thus, when a leap second is +inserted in UTC and subsequently in NTP, knowledge of all previous +leap seconds is lost.</p> + +<p>Another way to describe this is to say there are as many NTP +timescales as historic leap seconds. In effect, a new timescale is +established after each new leap second. Thus, all previous leap +seconds, not to mention the apparent origin of the timescale +itself, lurch forward one second as each new timescale is +established. If a clock synchronized to NTP in early 2001 was used +to establish the UTC epoch of an event that occurred in early 1972 +without correction, the event would appear 22 seconds late. +However, NTP primary time servers resolve the epoch using the +broadcast timecode, so that the NTP clock is set to the broadcast +value on the current timescale. As a result, for the most precise +determination of epoch relative to the historic Gregorian calendar +and UTC timescale, the user must subtract from the apparent NTP +epoch the offsets derived from the NIST table. This is a feature of +almost all present day time distribution mechanisms.</p> + +<p>The obvious question raised by this scenario is what happens +during the leap second when NTP time stops and the clock remains +unchanged. If the precision time kernel modifications have been +implemented, the kernel includes a state machine that implements +the actions required by the scenario. At the exact instant of the +leap, the logical clock is stepped backward one second. However, +the routine that actually reads the clock is constrained never to +step backwards, unless the step is significantly larger than one +second, which might occur due to explicit operator direction.</p> + +<p>In this design time stands still during the leap second, but is correct commencing with the next second. Since clock readings must be positive monotonic, the apparent time will increase by one nanosecond for each reading. At the end of the second the apparent time may be ahead of the actual time depending on how many times the clocks was read during the second. Eventually, the actual time will catch up with the apparent time and operation continues normally.</p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/measure.htm b/contrib/ntp/html/measure.htm index a06261d..11035d0 100644 --- a/contrib/ntp/html/measure.htm +++ b/contrib/ntp/html/measure.htm @@ -6,45 +6,12 @@ Time and Time Interval Measurement with Application to Computer and Network Performance Evaluation </h3><hr> -<p>The technical memorandum: <cite>Time and Time Interval Measurement -with Application to Computer and Network Performance Evaluation</cite><a -href="http://www.eecis.udel.edu/~mills/database/memos/memo96a.ps"> -(PostScript) </a> describes a number of techniques for conducting -experiments typical of computer network and transmission systems -engineering. +<p>The technical memorandum: <cite>Time and Time Interval Measurement with Application to Computer and Network Performance Evaluation</cite><a href="http://www.eecis.udel.edu/~mills/database/memos/memo96a.ps">(PostScript) </a> describes a number of techniques for conducting experiments typical of computer network and transmission systems engineering. -<p>In most experiments in which time is involved, it is necessary to -develop estimates of time, frequency and measurement errors from a -series of time measurements between the clocks of a number of computers -and ancillary devices interconnected by some kind of computer network. -However, time is not a physical quantity, such as mass, nor can it be -measured relative to an absolute frame of reference, such as velocity. -The only way to measure time in our universe is to compare the reading -of one clock, which runs according to its own timescale, with another -clock, which runs according to a given timescale, at some given instant -or epoch. The errors arise from the precision of time comparisons and -the accuracy of frequency estimates between the timescales involved. +<p>In most experiments in which time is involved, it is necessary to develop estimates of time, frequency and measurement errors from a series of time measurements between the clocks of a number of computers and ancillary devices interconnected by some kind of computer network. However, time is not a physical quantity, such as mass, nor can it be measured relative to an absolute frame of reference, such as velocity. The only way to measure time in our universe is to compare the reading of one clock, which runs according to its own timescale, with another clock, which runs according to a given timescale, at some given instant or epoch. The errors arise from the precision of time comparisons and the accuracy of frequency estimates between the timescales involved. -<p>The usual data collected during a performance run of some experiment -might include time offsets, time delays, frequency offsets and various -error statistics. While time offsets between two clocks can be measured -directly, frequency offsets can be estimated only from two or more time -offsets made over some time interval in the experiment. In practice, a -sequence of time comparisons can be performed over the lifetime of the -experiment and the instantaneous frequency estimated either in real time -with a recurrence relation, or retrospectively with a polynomial fit to -the data. +<p>The usual data collected during a performance run of some experiment might include time offsets, time delays, frequency offsets and various error statistics. While time offsets between two clocks can be measured directly, frequency offsets can be estimated only from two or more time offsets made over some time interval in the experiment. In practice, a sequence of time comparisons can be performed over the lifetime of the experiment and the instantaneous frequency estimated either in real time with a recurrence relation, or retrospectively with a polynomial fit to the data. -<p>Estimating time and frequency errors in real time has been studied by -a distinct subspecies of physicists who have made a career of the -technology involved. Various means including autoregressive models, -Kalman filters and simple weighted-average algorithms are used -extensively by national standards laboratories to model cesium-clock -ensembles. These techniques have been adapted to computer network and -transmission engineering problems as well. This memorandum explores -issues in performing experiments of this type and summarizes various -techniques found useful in practice. +<p>Estimating time and frequency errors in real time has been studied by a distinct subspecies of physicists who have made a career of the technology involved. Various means including autoregressive models, Kalman filters and simple weighted-average algorithms are used extensively by national standards laboratories to model cesium-clock ensembles. These techniques have been adapted to computer network and transmission engineering problems as well. This memorandum explores issues in performing experiments of this type and summarizes various techniques found useful in practice. -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/miscopt.htm b/contrib/ntp/html/miscopt.htm index af5ee3c..348bc3e 100644 --- a/contrib/ntp/html/miscopt.htm +++ b/contrib/ntp/html/miscopt.htm @@ -1,162 +1,279 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Miscellaneous Options -</TITLE> -</HEAD> -<BODY> - -<H3> -Miscellaneous Options</H3> - -<HR> -<DL> -<DT> -<TT>broadcastdelay <I>seconds</I></TT></DT> - -<DD> -The broadcast and multicast modes require a special calibration to determine -the network delay between the local and remote servers. Ordinarily, this -is done automatically by the initial protocol exchanges between the local -and remote servers. In some cases, the calibration procedure may fail due -to network or server access controls, for example. This command specifies -the default delay to be used under these circumstances. Typically (for -Ethernet), a number between 0.003 and 0.007 seconds is appropriate. The -default when this command is not used is 0.004 seconds.</DD> - -<DD> - </DD> - -<DT> -<TT>trap <I>host_address</I> [port <I>port_number</I>] [interface <I>interface_address</I>]</TT></DT> - -<DD> -This command configures a trap receiver at the given host address and port -number for sending messages with the specified local interface address. -If the port number is unspecified. a value of 18447 is used. If the interface -address is not specified, the message is sent with a source address of -the local interface the message is sent through. Note that on a multihomed -host the interface used may vary from time to time with routing changes.</DD> - -<DD> -The trap receiver will generally log event messages and other information -from the server in a log file. While such monitor programs may also request -their own trap dynamically, configuring a trap receiver will ensure that -no messages are lost when the server is started.</DD> - -<DD> - </DD> - -<DT> -<TT>setvar <I>variable</I> [default]</TT></DT> - -<DD> -This command adds an additional system variable. These variables can be -used to distribute additional information such as the access policy. If -the variable of the form <TT><I>name</I> = <I>value</I></TT> is followed -by the <TT>default</TT> keyword, the variable will be listed as part of -the default system variables (<TT>ntpq rv</TT> command). These additional -variables serve informational purposes only. They are not related to the -protocol other that they can be listed. The known protocol variables will -always override any variables defined via the <TT>setvar</TT> mechanism. -There are three special variables that contain the names of all variable -of the same group. The <TT>sys_var_list</TT> holds the names of all system -variables. The <TT>peer_var_list</TT> holds the names of all peer variables -and the <TT>clock_var_list</TT> holds the names of the reference clock -variables.</DD> - -<DD> - </DD> - -<DT> -<TT>logfile <I>logfile</I></TT></DT> - -<DD> -This command specifies the location of an alternate log file to be used -instead of the default system <TT>syslog</TT> facility.</DD> - -<DD> - </DD> - -<DT> -<TT>logconfig <I>configkeyword</I></TT></DT> - -<DD> -This command controls the amount and type of output written to the system -<TT>syslog</TT> facility or the alternate <TT>logfile</TT> log file. By -default, all output is turned on. All <I><TT>configkeyword</TT></I> keywords -can be prefixed with <TT>=</TT>, <TT>+</TT> and <TT>-</TT>, where <TT>=</TT> -sets the <TT>syslogmask</TT>, <TT>+</TT> adds and <TT>-</TT> removes messages. -<TT>syslog messages</TT> can be controlled in four classes (, <TT>peer</TT>, -<TT>sys</TT> and <TT>sync</TT>). Within these classes four types of messages -can be controlled.</DD> - -<DD> -Informational messages (<TT>info</TT>) control configuration information. -Event messages (<TT>events</TT>) control logging of events (reachability, -synchronization, alarm conditions). Statistical output is controlled with -the <TT>statistics</TT> keyword. The final message group is the status -messages. This describes mainly the synchronizations status. Configuration -keywords are formed by concatenating the message class with the event class. -The <TT>allprefix</TT> can be used instead of a message class. A message -class may also be followed by the <TT>all</TT> keyword to enable/disable -all messages of the respective message class.</DD> - -<DD> -Thus, a minimal log configuration could look like this:</DD> - -<DD> -<TT>logconfig = syncstatus +sysevents</TT></DD> - -<DD> -This would just list the synchronizations state of <TT>ntpd</TT> and the -major system events. For a simple reference server, the following minimum -message configuration could be useful:</DD> - -<DD> -<TT>logconfig = syncall +clockall</TT></DD> - -<DD> -This configuration will list all clock information and synchronization -information. All other events and messages about peers, system events and -so on is suppressed.</DD> -</DL> - -<H4> -Variables</H4> -Most variables used by the NTP protocol can be examined with the <TT>ntpdc</TT> -(mode 7 messages) and the <TT>ntpq</TT> (mode 6 messages). Currently, very -few variables can be modified via mode 6 messages. These variables are -either created with the <TT>setvar</TT> directive or the leap warning bits. -The leap warning bits can be set in the <TT>leapwarning</TT> variable up -to one month ahead. Both the <TT>leapwarning</TT> and <TT>leapindication</TT> -variables have a slightly different encoding than the usual leap bits interpretation: -<DL> -<DT> -<TT>00</TT></DT> - -<DD> -The daemon passes the leap bits of its synchronization source (usual mode -of operation).</DD> - -<DT> -<TT>01/10</TT></DT> - -<DD> -A leap second is added/deleted (operator forced leap second).</DD> - -<DT> -<TT>11</TT></DT> - -<DD> -Leap information from the synchronizations source is ignored (thus <TT>LEAP_NOWARNING</TT> -is passed on).</DD> -</DL> - -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Miscellaneous Options</title> +</head> +<body> +<h3>Miscellaneous Options</h3> + +<img align="left" src="pic/boom3.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>We have three, now looking for more.<br clear="left"> +</p> + +<hr> +<dl> +<dt><tt>broadcastdelay <i>seconds</i></tt></dt> + +<dd>The broadcast and multicast modes require a special calibration +to determine the network delay between the local and remote +servers. Ordinarily, this is done automatically by the initial +protocol exchanges between the client and server. In some cases, +the calibration procedure may fail due to network or server access +controls, for example. This command specifies the default delay to +be used under these circumstances. Typically (for Ethernet), a +number between 0.003 and 0.007 seconds is appropriate. The default +when this command is not used is 0.004 seconds.</dd> + +<dt><tt>driftfile <i>driftfile</i></tt></dt> + +<dd>This command specifies the name of the file used to record the +frequency offset of the local clock oscillator. If the file exists, +it is read at startup in order to set the initial frequency offset +and then updated once per hour with the current frequency offset +computed by the daemon. If the file does not exist or this command +is not given, the initial frequency offset is assumed zero. In this +case, it may take some hours for the frequency to stabilize and the +residual timing errors to subside. + +<p>The file format consists of a single line containing a single +floating point number, which records the frequency offset measured +in parts-per-million (PPM). The file is updated by first writing +the current drift value into a temporary file and then renaming +this file to replace the old version. This implies that <tt> +ntpd</tt> must have write permission for the directory the drift +file is located in, and that file system links, symbolic or +otherwise, should be avoided.</p> +</dd> + +<dt><tt>enable [auth | bclient | calibrate | kernel | monitor | ntp +| stats]</tt><br> +<tt>disable [auth | bclient | calibrate | kernel | monitor | ntp | +stats</tt></dt> + +<dd>Provides a way to enable or disable various server options. +Flags not mentioned are unaffected. Note that all of these flags +can be controlled remotely using the <a href="ntpdc.htm"><tt> +ntpdc</tt></a> utility program.</dd> + +<dd> +<dl> +<dt><tt>bclient</tt></dt> + +<dd>When enabled, this is identical to the <tt>broadcastclient</tt> +command. The default for this flag is <tt>disable</tt>.</dd> + +<dt><tt>calibrate</tt></dt> + +<dd>Enables the calibration facility, which automatically adjusts +the <tt>time1</tt> values for each clock driver to display the same +offset as the currently selected source or kernel discipline +signal. See the <a href="refclock.htm">Reference Clock Drivers</a> +for further information. The default for this flag is <tt> +disable</tt>.</dd> + +<dt><tt>kernel</tt></dt> + +<dd>Enables the precision-time kernel support for the <tt> +ntp_adjtime()</tt> system call, if implemented. Ordinarily, support +for this routine is detected automatically when the NTP daemon is +compiled, so it is not necessary for the user to worry about this +flag. It flag is provided primarily so that this support can be +disabled during kernel development. The default for this flag is +<tt>enable</tt>.</dd> + +<dt><tt>monitor</tt></dt> + +<dd>Enables the monitoring facility. See the <tt>ntpdc</tt> program +and the <tt>monlist</tt> command or further information. The +default for this flag is <tt>enable</tt>.</dd> + +<dt><tt>ntp</tt></dt> + +<dd>Enables the server to adjust its local clock by means of NTP. +If disabled, the local clock free-runs at its intrinsic time and +frequency offset. This flag is useful in case the local clock is +controlled by some other device or protocol and NTP is used only to +provide synchronization to other clients. In this case, the local +clock driver can be used to provide this function and also certain +time variables for error estimates and leap-indicators. See the <a +href="refclock.htm">Reference Clock Drivers</a> page for further +information. The default for this flag is <tt>enable</tt>.</dd> + +<dt><tt>stats</tt></dt> + +<dd>Enables the statistics facility. See the <a href="monopt.htm"> +Monitoring Options</a> page for further information. The default +for this flag is <tt>enable</tt>.</dd> +</dl> +</dd> + +<dt><tt>logconfig <i>configkeyword</i></tt></dt> + +<dd>This command controls the amount and type of output written to +the system <tt>syslog</tt> facility or the alternate <tt> +logfile</tt> log file. By default, all output is turned on. All <i> +<tt>configkeyword</tt></i> keywords can be prefixed with <tt> +=</tt>, <tt>+</tt> and <tt>-</tt>, where <tt>=</tt> sets the <tt> +syslogmask</tt>, <tt>+</tt> adds and <tt>-</tt> removes messages. +<tt>syslog messages</tt> can be controlled in four classes +(<tt>clock</tt>, <tt>peer</tt>, <tt>sys</tt> and <tt>sync</tt>). +Within these classes four types of messages can be controlled.</dd> + +<dd>Informational messages (<tt>info</tt>) control configuration +information. Event messages (<tt>events</tt>) control logging of +events (reachability, synchronization, alarm conditions). +Statistical output is controlled with the <tt>statistics</tt> +keyword. The final message group is the status messages. This +describes mainly the synchronizations status. Configuration +keywords are formed by concatenating the message class with the +event class. The <tt>all</tt> prefix can be used instead of a +message class. A message class may also be followed by the <tt> +all</tt> keyword to enable/disable all messages of the respective +message class.</dd> + +<dd>Thus, a minimal log configuration could look like this: + +<p><tt>logconfig=syncstatus +sysevents</tt></p> + +<p>This would just list the synchronizations state of <tt>ntpd</tt> +and the major system events. For a simple reference server, the +following minimum message configuration could be useful:</p> + +<p><tt>logconfig=syncall +clockall</tt></p> + +<p>This configuration will list all clock information and +synchronization information. All other events and messages about +peers, system events and so on is suppressed.</p> +</dd> + +<dt><tt>logfile <i>logfile</i></tt></dt> + +<dd>This command specifies the location of an alternate log file to +be used instead of the default system <tt>syslog</tt> +facility.</dd> + +<dt><tt>setvar <i>variable</i> [default]</tt></dt> + +<dd>This command adds an additional system variable. These +variables can be used to distribute additional information such as +the access policy. If the variable of the form <tt><i>name</i> = +<i>value</i></tt> is followed by the <tt>default</tt> keyword, the +variable will be listed as part of the default system variables +(<tt>ntpq rv</tt> command). These additional variables serve +informational purposes only. They are not related to the protocol +other that they can be listed. The known protocol variables will +always override any variables defined via the <tt>setvar</tt> +mechanism. There are three special variables that contain the names +of all variable of the same group. The <tt>sys_var_list</tt> holds +the names of all system variables. The <tt>peer_var_list</tt> holds +the names of all peer variables and the <tt>clock_var_list</tt> +holds the names of the reference clock variables.</dd> + +<dt><tt>tinker [ step <i>step</i> | panic <i>panic</i> | dispersion +<i>dispersion</i> | stepout <i>stepout</i> | minpoll <i>minpoll</i> +]</tt></dt> + +<dd>This command can be used to alter several system variables in +very exceptional circumstances. It should occur in the +configuration file before any other configuration options. The +default values of these variables have been carefully optimized for +a wide range of network speeds and reliability expectations. In +general, they interact in intricate ways that are hard to predict +and some combinations can result in some very nasty behavior. Very +rarely is it necessary to change the default values; but, some +folks can't resist twisting the knobs anyway and this command is +for them. Emphasis added: twisters are on their own and can expect +no help from the support group. + +<p>All arguments are in floating point seconds or seconds per +second. The <tt>minpoll</tt> argument is an integer in seconds to +the power of two. The variables operate as follows:</p> +</dd> + +<dd> +<dl> +<dt><tt>step <i>step</i></tt></dt> + +<dd>The argument becomes the new value for the step threshold, +normally 0.128 s. If set to zero, step adjustments will never +occur. In general, if the intent is only to avoid step adjustments, +the step threshold should be left alone and the <tt>-x</tt> command +line option be used instead.</dd> + +<dt><tt>panic <i>panic</i></tt></dt> + +<dd>The argument becomes the new value for the panic threshold, +normally 1000 s. If set to zero, the panic sanity check is disabled +and a clock offset of any value will be accepted.</dd> + +<dt><tt>dispersion <i>dispersion</i></tt></dt> + +<dd>The argument becomes the new value for the dispersion increase +rate, normally .000015.</dd> + +<dt><tt>stepout <i>stepout</i></tt></dt> + +<dd>The argument becomes the new value for the watchdog timeout, +normally 900 s.</dd> + +<dt><tt>minpoll <i>minpoll</i></tt></dt> + +<dd>The argument becomes the new value for the minimum poll +interval used when configuring multicast client, manycast client +and , symmetric passive mode association. The value defaults to 6 +(64 s) and has a lower limit of 4 (16 s).</dd> + +<dt><tt>allan <i>allan</i></tt></dt> + +<dd>The argument becomes the new value for the minimum Allan +intercept, which is a parameter of the PLL/FLL clock discipline +algorithm. The value defaults to 1024 s, which is also the lower +limit.</dd> + +<dt><tt>huffpuff <i>huffpuff</i></tt></dt> + +<dd>The argument becomes the new value for the experimental +huff-n'-puff filter span, which determines the most recent interval +the algorithm will search for a minimum delay. The lower limit is +900 s (15 m), but a more reasonable value is 7200 (2 hours). There +is no default, since the filter is not enabled unless this command +is given.</dd> +</dl> +</dd> + +<dt><tt>trap <i>host_address</i> [port <i>port_number</i>] +[interface <i>interface_address</i>]</tt></dt> + +<dd>This command configures a trap receiver at the given host +address and port number for sending messages with the specified +local interface address. If the port number is unspecified, a value +of 18447 is used. If the interface address is not specified, the +message is sent with a source address of the local interface the +message is sent through. Note that on a multihomed host the +interface used may vary from time to time with routing changes. + +<p>The trap receiver will generally log event messages and other +information from the server in a log file. While such monitor +programs may also request their own trap dynamically, configuring a +trap receiver will ensure that no messages are lost when the server +is started.</p> +</dd> +</dl> + +<h4>Files</h4> + +<tt>ntp.drift</tt> frequency compensation (PPM) + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/monopt.htm b/contrib/ntp/html/monopt.htm index 267bbcc..4ec8c23 100644 --- a/contrib/ntp/html/monopt.htm +++ b/contrib/ntp/html/monopt.htm @@ -2,7 +2,12 @@ Monitoring Options </title></head><body><h3> Monitoring Options -</h3><hr> +</h3> + +<img align=left src=pic/pogo8.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>Pogo</i>, Walt Kelly</a> + +<p>The pig watches the logs. +<br clear=left><hr> <h4>Monitoring Support</h4> @@ -117,7 +122,7 @@ running at a remote location.</dd> <dt><I><tt>name</tt></I></dt> <dd>This is the type of the statistics records, as shown in the -<tt>statististics</tt> command.</dd> +<tt>statistics</tt> command.</dd> </dl> diff --git a/contrib/ntp/html/mx4200data.htm b/contrib/ntp/html/mx4200data.htm index 2123607..bca0474 100644 --- a/contrib/ntp/html/mx4200data.htm +++ b/contrib/ntp/html/mx4200data.htm @@ -1,7 +1,8 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN"> <HTML> <HEAD> -<TITLE>MX4200 Receiver Data Format</TITLE> + <TITLE>MX4200 Receiver Data Format</TITLE> +</HEAD> <BODY> <h1>MX4200 Receiver Data Format</h1> @@ -10,23 +11,23 @@ <ul> <li><a href="#control">Control Port Sentences</a></li> - <li><a href="#input">Control Port Input Sentences</a> + <li><a href="#input">Control Port Input Sentences</a></li> <ul> - <li> <a href="#input_000">$PMVXG,000</a> Initialization/Mode Control - Part A</li> - <li> <a href="#input_001">$PMVXG,001</a> Initialization/Mode Control - Part B</li> - <li> <a href="#input_007">$PMVXG,007</a> Control Port Configuration</li> - <li> <a href="#input_023">$PMVXG,023</a> Time Recovery Configuration</li> - <li> <a href="#input_gpq">$CDGPQ,YYY</a> Query From a Remote Device / Request to Output a Sentence</li> + <li><a href="#input_000">$PMVXG,000</a> Initialization/Mode Control - Part A</li> + <li><a href="#input_001">$PMVXG,001</a> Initialization/Mode Control - Part B</li> + <li><a href="#input_007">$PMVXG,007</a> Control Port Configuration</li> + <li><a href="#input_023">$PMVXG,023</a> Time Recovery Configuration</li> + <li><a href="#input_gpq">$CDGPQ,YYY</a> Query From a Remote Device / Request to Output a Sentence</li> </ul> - <li><a href="#output">Control Port Output Sentences</a> + <li><a href="#output">Control Port Output Sentences</a></li> <ul> - <li> <a href="#output_000">$PMVXG,000</a> Receiver Status - <li> <a href="#output_021">$PMVXG,021</a> Position, Height, Velocity - <li> <a href="#output_022">$PMVXG,022</a> DOPs - <li> <a href="#output_030">$PMVXG,030</a> Software Configuration - <li> <a href="#output_101">$PMVXG,101</a> Control Sentence Accept/Reject - <li> <a href="#output_523">$PMVXG,523</a> Time Recovery Configuration - <li> <a href="#output_830">$PMVXG,830</a> Time Recovery Results + <li><a href="#output_000">$PMVXG,000</a> Receiver Status</li> + <li><a href="#output_021">$PMVXG,021</a> Position, Height, Velocity</li> + <li><a href="#output_022">$PMVXG,022</a> DOPs</li> + <li><a href="#output_030">$PMVXG,030</a> Software Configuration</li> + <li><a href="#output_101">$PMVXG,101</a> Control Sentence Accept/Reject</li> + <li><a href="#output_523">$PMVXG,523</a> Time Recovery Configuration</li> + <li><a href="#output_830">$PMVXG,830</a> Time Recovery Results</li> </ul> </ul> @@ -38,8 +39,8 @@ the receiver. The structure of the control port sentences is based on the <cite>NMEA-0183</cite> Standard for Interfacing Marine Electronics Navigation Devices (version 1.5). For more details, please refer to -the <cite>NMEA-0183</cite> Specification available from the <a -href="http://www.nmea.org/"> National Marine Electronics +the <cite>NMEA-0183</cite> Specification available from the +<a href="http://www.nmea.org/">National Marine Electronics Association</a>.</p> <p>Reserved characters are used to indicate the beginning and the end @@ -50,10 +51,7 @@ characters and defines their usage. <a href="#table_1">Table 1</a> illustrates the general Magnavox proprietary NMEA sentence format. </p> -<h4><a name="table_1">Table 1. Magnavox Proprietary NMEA Sentence -Format</a></h4> - -<p> +<h4><a name="table_1">Table 1. Magnavox Proprietary NMEA Sentence Format</a></h4> <code> $PMVXG,XXX,...................*CK </code> @@ -135,16 +133,16 @@ Initializes the time, position and antenna height of the MX4200. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Default <th>Range - <tr> <td>1 <td>Day <td> <td>Int <td> <td>1-31 - <tr> <td>2 <td>Month <td> <td>Int <td> <td>1-12 - <tr> <td>3 <td>Year <td> <td>Int <td> <td>1991-9999 - <tr> <td>4 <td>GMT Time <td>HHMMSS <td>Int <td> <td>000000-235959 + <tr> <td>1 <td>Day <td>  <td>Int <td>  <td>1-31 + <tr> <td>2 <td>Month <td>  <td>Int <td>  <td>1-12 + <tr> <td>3 <td>Year <td>  <td>Int <td>  <td>1991-9999 + <tr> <td>4 <td>GMT Time <td>HHMMSS <td>Int <td>  <td>000000-235959 <tr> <td>5 <td>WGS-84 Latitude <td>DDMM.MMMM<td>Float<td>0.0 <td>0 - 8959.9999 - <tr> <td>6 <td>North/South Indicator <td> <td>Char <td>N <td>N,S + <tr> <td>6 <td>North/South Indicator <td>  <td>Char <td>N <td>N,S <tr> <td>7 <td>WGS-84 Longitude <td>DDDMM.MMMM<td>Float<td>0.0 <td>0 - 17959.9999 - <tr> <td>8 <td>East/West Indicator <td> <td>Char <td>E <td>E,W + <tr> <td>8 <td>East/West Indicator <td>  <td>Char <td>E <td>E,W <tr> <td>9 <td>Altitude (height above Mean Sea Level) in meters (WGS-84) <td>Meters<td>Float<td>0.0<td>+/-99999.0 - <tr> <td>10 <td>Not Used <td> <td> <td> <td> + <tr> <td>10 <td>Not Used <td>  <td>  <td>  <td>  </table> Example:<br> <code>$PMVXG,000,,,,,,,,,,*48</code><br> @@ -160,14 +158,14 @@ DOP limits, and satellite elevation limits. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Default <th>Range - <tr> <td>*1 <td>Constrain Altitude <td> <td>Int <td>1 <td>0=3D Only<br>1=Auto<br>2=2D Only - <tr> <td>2 <td>Not Used <td> <td> <td> <td> + <tr> <td>*1 <td>Constrain Altitude <td>  <td>Int <td>1 <td>0=3D Only<br>1=Auto<br>2=2D Only + <tr> <td>2 <td>Not Used <td>  <td> <td>  <td>  <tr> <td>*3 <td>Horizontal Acceleration Factor<td>m/sec^2 <td>Float <td>1.0 <td>0.5-10.0 - <tr> <td>*4 <td>Not Used <td> <td> <td> <td> - <tr> <td>*5 <td>VDOP Limit <td> <td>Int <td>10 <td>1-9999 - <tr> <td>*6 <td>HDOP Limit <td> <td>Int <td>10 <td>1-9999 + <tr> <td>*4 <td>Not Used <td>  <td> <td>  <td>  + <tr> <td>*5 <td>VDOP Limit <td>  <td>Int <td>10 <td>1-9999 + <tr> <td>*6 <td>HDOP Limit <td>  <td>Int <td>10 <td>1-9999 <tr> <td>7 <td>Elevation Limit <td>Deg <td>Int <td>5 <td>0-90 - <tr> <td>8 <td>Time Output Mode <td> <td>Char <td>U <td>U=UTC<br>L=Local Time + <tr> <td>8 <td>Time Output Mode <td>  <td>Char <td>U <td>U=UTC<br>L=Local Time <tr> <td>9 <td>Local Time Offset <td>HHMM <td>Int <td>0 <td>+/- 0-2359 </table> Example:<br> @@ -185,14 +183,14 @@ that the receiver is to output. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Default <th>Range - <tr> <td>1 <td>Control Port Output Block Label<td> <td>Char <td> <td> - <tr> <td>2 <td>Clear Current Output List<td> <td>Int <td> <td>0=No<br>1=Yes - <tr> <td>3 <td>Add/Delete Sentence from List<td> <td>Int <td> <td>1=Append<br>2=Delete - <tr> <td>4 <td>Not Used <td> <td> <td> <td> - <tr> <td>5 <td>Sentence Output Rate <td>Sec <td>Int <td> <td>1-9999 - <tr> <td>6 <td># digits of Precision for CGA and GLL sentences<td> <td>Int <td>2 <td>2-4 - <tr> <td>7 <td>Not Used <td> <td> <td> <td> - <tr> <td>8 <td>Not Used <td> <td> <td> <td> + <tr> <td>1 <td>Control Port Output Block Label<td> <td>Char <td>  <td>  + <tr> <td>2 <td>Clear Current Output List<td> <td>Int <td>  <td>0=No<br>1=Yes + <tr> <td>3 <td>Add/Delete Sentence from List<td> <td>Int <td>  <td>1=Append<br>2=Delete + <tr> <td>4 <td>Not Used <td>  <td>  <td>  <td>  + <tr> <td>5 <td>Sentence Output Rate <td>Sec <td>Int <td>  <td>1-9999 + <tr> <td>6 <td># digits of Precision for CGA and GLL sentences<td>  <td>Int <td>2 <td>2-4 + <tr> <td>7 <td>Not Used <td>  <td>  <td>  <td>  + <tr> <td>8 <td>Not Used <td>  <td>  <td>  <td>  </table> Example:<br> <code>$PMVXG,007,022,0,1,,1,,,*4F</code> @@ -212,13 +210,13 @@ unit. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Default <th>Range - <tr> <td>*1 <td>Time Recovery Mode <td> <td>Char <td>D <td>D=Dynamic<br>S=Static<br>K=Known Position<br>N=No Time Recovery - <tr> <td>2 <td>Time Synchronization <td> <td>Char <td>G <td>U=UTC<br>G=GPS - <tr> <td>3 <td>Time Mark Mode <td> <td>Char <td>A <td>A=Always<br>V=Valid Pulses Only + <tr> <td>*1 <td>Time Recovery Mode <td>  <td>Char <td>D <td>D=Dynamic<br>S=Static<br>K=Known Position<br>N=No Time Recovery + <tr> <td>2 <td>Time Synchronization <td>  <td>Char <td>G <td>U=UTC<br>G=GPS + <tr> <td>3 <td>Time Mark Mode <td>  <td>Char <td>A <td>A=Always<br>V=Valid Pulses Only <tr> <td>4 <td>Maximum Time Error <td>Nsec <td>Int <td>100 <td>50-1000 <tr> <td>5 <td>User Time Bias <td>Nsec <td>Int <td>0 <td>+/- 99999 - <tr> <td>6 <td>ASCII Time Message Control<td> <td>Int <td>0 <td>0=No Output<br>1=830 to Control Port<br>2=830 to Equipment Port - <tr> <td>7 <td>Known Pos PRN <td> <td>Int <td>0 <td>1-32<br>0=Track All Sats + <tr> <td>6 <td>ASCII Time Message Control<td> <td>Int <td>0 <td>0=No Output<br>1=830 to Control Port<br>2=830 to Equipment Port + <tr> <td>7 <td>Known Pos PRN <td>  <td>Int <td>0 <td>1-32<br>0=Track All Sats </table> Example:<br> <code>$PMVXG,023,S,U,A,500,0,1,*16</code> @@ -235,10 +233,10 @@ sentence <a href="#input_007">$PMVXG,007</a>. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Default <th>Range - <tr> <td>1:CD <td>ID of Remote Device <td> <td>Char <td> <td>(See <cite>NMEA-0183</cite>) - <tr> <td>2:GP <td>GPS <td> <td>Char <td> <td>(See <cite>NMEA-0183</cite>) - <tr> <td>3:Q <td>Query <td> <td>Char <td> <td>(See <cite>NMEA-0183</cite>) - <tr> <td>4:YYY <td>Label of Desired Sentence<td> <td>Char <td> <td>Any Valid NMEA or Magnavox Sentence Type + <tr> <td>1:CD <td>ID of Remote Device <td>  <td>Char <td>  <td>(See <cite>NMEA-0183</cite>) + <tr> <td>2:GP <td>GPS <td>  <td>Char <td>  <td>(See <cite>NMEA-0183</cite>) + <tr> <td>3:Q <td>Query <td>  <td>Char <td>  <td>(See <cite>NMEA-0183</cite>) + <tr> <td>4:YYY <td>Label of Desired Sentence<td> <td>Char <td>  <td>Any Valid NMEA or Magnavox Sentence Type </table> Example:<br> <code>$CDGPQ,030*5E</code> @@ -261,11 +259,11 @@ tracked. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range - <tr> <td>1 <td>Current Receiver Status <td> <td>Char <td>ACQ=Reacquisition<br>ALT=Constellation Selection<br>IAC=Initial Acquisition<br>IDL=Idle, No Satellites<br>NAV=Navigating<br>STS=Search The Sky<br>TRK=Tracking - <tr> <td>2 <td>Number of Satellites that should be Visible <td> <td>Int <td>0-12 - <tr> <td>3 <td>Number of Satellites being Tracked <td> <td>Int <td>0-12 + <tr> <td>1 <td>Current Receiver Status <td>  <td>Char <td>ACQ=Reacquisition<br>ALT=Constellation Selection<br>IAC=Initial Acquisition<br>IDL=Idle, No Satellites<br>NAV=Navigating<br>STS=Search The Sky<br>TRK=Tracking + <tr> <td>2 <td>Number of Satellites that should be Visible <td> <td>Int <td>0-12 + <tr> <td>3 <td>Number of Satellites being Tracked <td>  <td>Int <td>0-12 <tr> <td>4 <td>Time since Last Navigation <td>HHMM <td>Int <td>0-2359 - <tr> <td>5 <td>Initialization Status <td> <td>Int <td>0=Waiting for Initialization<br>1=Initialization Complete + <tr> <td>5 <td>Initialization Status <td>  <td>Int <td>0=Waiting for Initialization<br>1=Initialization Complete </table> Example:<br> <code>$PMVXG,000,TRK,3,3,0122,1*19</code> @@ -283,14 +281,14 @@ applications.</em> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range <tr> <td>1 <td>UTC Measurement Time <td>Seconds into the week<td>Float<td>0-604800.00 <tr> <td>2 <td>WGS-84 Latitude <td>DDMM.MMMM<td>Float <td>0-89.9999 - <tr> <td>3 <td>North/South Indicator <td> <td>Char <td>N, S + <tr> <td>3 <td>North/South Indicator <td>  <td>Char <td>N, S <tr> <td>4 <td>WGS-84 Longitude <td>DDDMM.MMMM <td>Float <td>0-179.9999 - <tr> <td>5 <td>East/West Indicator <td> <td>Char <td>E, W - <tr> <td>6 <td>Altitude (MSL) <td>Meters <td>Float <td> - <tr> <td>7 <td>Geoidal Height <td>Meters <td>Float <td> - <tr> <td>8 <td>Velocity East <td>M/Sec <td>Float <td> - <tr> <td>9 <td>Velocity North <td>M/Sec <td>Float <td> - <tr> <td>10 <td>Navigation Mode <td> <td>Int <td><em>Navigating</em><br> + <tr> <td>5 <td>East/West Indicator <td>  <td>Char <td>E, W + <tr> <td>6 <td>Altitude (MSL) <td>Meters <td>Float <td>  + <tr> <td>7 <td>Geoidal Height <td>Meters <td>Float <td>  + <tr> <td>8 <td>Velocity East <td>M/Sec <td>Float <td>  + <tr> <td>9 <td>Velocity North <td>M/Sec <td>Float <td>  + <tr> <td>10 <td>Navigation Mode <td>  <td>Int <td><em>Navigating</em><br> 1=Position From a Remote Device<br> 2=2D<br> 3=3D<br> @@ -321,21 +319,21 @@ listed. The satellites are listed in receiver channel order. Fields <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range <tr> <td>1 <td>UTC Measurement Time <td>Seconds into the week<td>Float<td>0-604800.00 - <tr> <td>2 <td>East DOP (EDOP) <td> <td>Float <td> - <tr> <td>3 <td>North DOP (NDOP) <td> <td>Float <td> - <tr> <td>4 <td>Vertical DOP (VDOP) <td> <td>Float <td> - <tr> <td>5 <td>PRN on Channel #1 <td> <td>Int <td>1-32 - <tr> <td>6 <td>PRN on Channel #2 <td> <td>Int <td>1-32 - <tr> <td>7 <td>PRN on Channel #3 <td> <td>Int <td>1-32 - <tr> <td>8 <td>PRN on Channel #4 <td> <td>Int <td>1-32 - <tr> <td>9 <td>PRN on Channel #5 <td> <td>Int <td>1-32 - <tr> <td>10 <td>PRN on Channel #6 <td> <td>Int <td>1-32 - <tr> <td>11 <td>PRN on Channel #7 <td> <td>Int <td>1-32 - <tr> <td>12 <td>PRN on Channel #8 <td> <td>Int <td>1-32 - <tr> <td>13 <td>PRN on Channel #9 <td> <td>Int <td>1-32 - <tr> <td>14 <td>PRN on Channel #10 <td> <td>Int <td>1-32 - <tr> <td>15 <td>PRN on Channel #11 <td> <td>Int <td>1-32 - <tr> <td>16 <td>PRN on Channel #12 <td> <td>Int <td>1-32 + <tr> <td>2 <td>East DOP (EDOP) <td>  <td>Float <td>  + <tr> <td>3 <td>North DOP (NDOP) <td>  <td>Float <td>  + <tr> <td>4 <td>Vertical DOP (VDOP) <td>  <td>Float <td>  + <tr> <td>5 <td>PRN on Channel #1 <td>  <td>Int <td>1-32 + <tr> <td>6 <td>PRN on Channel #2 <td>  <td>Int <td>1-32 + <tr> <td>7 <td>PRN on Channel #3 <td>  <td>Int <td>1-32 + <tr> <td>8 <td>PRN on Channel #4 <td>  <td>Int <td>1-32 + <tr> <td>9 <td>PRN on Channel #5 <td>  <td>Int <td>1-32 + <tr> <td>10 <td>PRN on Channel #6 <td>  <td>Int <td>1-32 + <tr> <td>11 <td>PRN on Channel #7 <td>  <td>Int <td>1-32 + <tr> <td>12 <td>PRN on Channel #8 <td>  <td>Int <td>1-32 + <tr> <td>13 <td>PRN on Channel #9 <td>  <td>Int <td>1-32 + <tr> <td>14 <td>PRN on Channel #10 <td>  <td>Int <td>1-32 + <tr> <td>15 <td>PRN on Channel #11 <td>  <td>Int <td>1-32 + <tr> <td>16 <td>PRN on Channel #12 <td>  <td>Int <td>1-32 </table> Example:<br> <code>$PMVXG,022,142243.00,00.7,00.8,01.9,27,26,10,09,13,23*77</code> @@ -350,8 +348,8 @@ version numbers. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range - <tr> <td>1 <td>Nav Processor Version Number <td> <td>Char <td> - <tr> <td>2 <td>Baseband Firmware Version Number <td> <td>Char <td> + <tr> <td>1 <td>Nav Processor Version Number <td>  <td>Char <td>  + <tr> <td>2 <td>Baseband Firmware Version Number <td>  <td>Char <td>  </table> Example:<br> <code>$PMVXG,030,DA35,015</code> @@ -367,16 +365,16 @@ received. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range - <tr> <td>1 <td>Sentence ID <td> <td>Char <td> - <tr> <td>2 <td>Accept/Reject Status <td> <td>Int <td>0=Sentence Accepted<br> + <tr> <td>1 <td>Sentence ID <td>  <td>Char <td>  + <tr> <td>2 <td>Accept/Reject Status <td>  <td>Int <td>0=Sentence Accepted<br> 1=Bad Checksum<br> 2=Illegal Value<br> 3=Unrecognized ID<br> 4=Wrong # of fields<br> 5=Required Data Field Missing<br> 6=Requested Sentence Unavailable - <tr> <td>3 <td>Bad Field Index <td> <td>Int <td> - <tr> <td>4 <td>Requested Sentence ID (If field #1 = GPQ) <td> <td>Char <td> + <tr> <td>3 <td>Bad Field Index <td>  <td>Int <td>  + <tr> <td>4 <td>Requested Sentence ID (If field #1 = GPQ) <td>  <td>Char <td>  </table> Example:<br> <code>$PMVXG,101,GPQ,0,,030*0D</code> @@ -391,13 +389,13 @@ of the receiver. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range - <tr> <td>1 <td>Time Recovery Mode <td> <td>Char <td>D=Dynamic<br>S=Static<br>K=Known Position<br>N=No Time Recovery - <tr> <td>2 <td>Time Synchronization <td> <td>Char <td>U=UTC Time<br>G=GPS Time - <tr> <td>3 <td>Time Mark Mode <td> <td>Char <td>A=Always Output Time Pulse<br>V=Only when Valid - <tr> <td>4 <td>Maximum Time Error for which a time mark will be considered valid <td>Nsec <td>Int <td> - <tr> <td>5 <td>User Time Bias <td>Nsec <td>Int <td> - <tr> <td>6 <td>Time Message Control <td> <td>Int <td>0=No Message<br>1=830 to Control Port<br>2=830 to Equipment Port - <tr> <td>7 <td>Not Used <td> <td> <td> + <tr> <td>1 <td>Time Recovery Mode <td>  <td>Char <td>D=Dynamic<br>S=Static<br>K=Known Position<br>N=No Time Recovery + <tr> <td>2 <td>Time Synchronization <td>  <td>Char <td>U=UTC Time<br>G=GPS Time + <tr> <td>3 <td>Time Mark Mode <td>  <td>Char <td>A=Always Output Time Pulse<br>V=Only when Valid + <tr> <td>4 <td>Maximum Time Error for which a time mark will be considered valid <td>Nsec <td>Int <td>  + <tr> <td>5 <td>User Time Bias <td>Nsec <td>Int <td>  + <tr> <td>6 <td>Time Message Control <td>  <td>Int <td>0=No Message<br>1=830 to Control Port<br>2=830 to Equipment Port + <tr> <td>7 <td>Not Used <td>  <td>  <td>  </table> Example:<br> <code>$PMVXG,523,S,U,A,0500,000000,1,0*23</code> @@ -417,23 +415,23 @@ receivers. <p> <table border> <tr> <th>Field <th>Description <th>Units <th>Format <th>Range - <tr> <td>1 <td>Time Mark Valid <td> <td>Char <td>T=Valid<br>F=Not Valid - <tr> <td>2 <td>Year <td> <td>Int <td>1993- - <tr> <td>3 <td>Month <td> <td>Int <td>1-12 + <tr> <td>1 <td>Time Mark Valid <td>  <td>Char <td>T=Valid<br>F=Not Valid + <tr> <td>2 <td>Year <td>  <td>Int <td>1993- + <tr> <td>3 <td>Month <td>  <td>Int <td>1-12 <tr> <td>4 <td>Day <td>Nsec <td>Int <td>1-31 <tr> <td>5 <td>Time <td>HH:MM:SS<td>Int <td>00:00:00-23:59:59 - <tr> <td>6 <td>Time Synchronization <td> <td>Char <td>U=UTC<br>G=GPS - <tr> <td>7 <td>Operating Mode <td> <td>Char <td>D=Dynamic<br>S=Static<br>K=Known Position - <tr> <td>8 <td>Oscillator Offset - estimate of oscillator frequency error <td>PPB <td>Int <td> - <tr> <td>9 <td>Time Mark Error of last pulse <td>Nsec <td>Int <td> - <tr> <td>10 <td>User Time Bias <td>Nsec <td>Int <td> + <tr> <td>6 <td>Time Synchronization <td>  <td>Char <td>U=UTC<br>G=GPS + <tr> <td>7 <td>Operating Mode <td>  <td>Char <td>D=Dynamic<br>S=Static<br>K=Known Position + <tr> <td>8 <td>Oscillator Offset - estimate of oscillator frequency error <td>PPB <td>Int <td>  + <tr> <td>9 <td>Time Mark Error of last pulse <td>Nsec <td>Int <td>  + <tr> <td>10 <td>User Time Bias <td>Nsec <td>Int <td>  <tr> <td>11 <td>Leap Second Flag - indicates that a leap second will occur. This value is usually zero except during the week prior to a leap second occurence, when this value will be set to +/-1. A value of +1 indicates that GPS time will be 1 second further ahead of UTC time. - <td> <td>Int <td>-1,0,1 + <td>  <td>Int <td>-1,0,1 </table> Example:<br> <code>$PMVXG,830,T,1998,10,12,15:30:46,U,S,000298,00003,000000,01*02</code> diff --git a/contrib/ntp/html/notes.htm b/contrib/ntp/html/notes.htm index e9f648c..c3f1ee0 100644 --- a/contrib/ntp/html/notes.htm +++ b/contrib/ntp/html/notes.htm @@ -724,7 +724,7 @@ for the original NTP specification, once called NTP Version 0. <H4> Traffic Monitoring</H4> <TT>ntpd</TT> handles peers whose stratum is higher than the stratum of -the local server and pollers using client mode by a fast path which +the local server and polls using client mode by a fast path which minimizes the work done in responding to their polls, and normally retains no memory diff --git a/contrib/ntp/html/ntpd.htm b/contrib/ntp/html/ntpd.htm index 0ba0ac7..62aa26a 100644 --- a/contrib/ntp/html/ntpd.htm +++ b/contrib/ntp/html/ntpd.htm @@ -1,183 +1,457 @@ -<HTML><HEAD><TITLE> -<TT>ntpd</TT> - Network Time Protocol (NTP) daemon -</TITLE></HEAD><BODY><H3> -<TT>ntpd</TT> - Network Time Protocol (NTP) daemon -</H3><HR> - -<H4>Synopsis</H4> - -<TT>ntpd [ -aAbdm ] [ -c <I>conffile</I> ] [ -f <I>driftfile</I> ] [ -g -] [ -k <I>keyfile</I> ] [ -l <I>logfile</I> ] [ -p <I>pidfile</I> ] [ -r -<I>broadcastdelay</I> ] [ -s <I>statsdir</I> ] [ -t <I>key</I> ] [ -v -<I>variable</I> ] [ -V <I>variable</I> ] [ -x ]</TT> - -<H4>Description</H4> - -<TT>ntpd</TT> is an operating system daemon which sets and maintains the -system time-of-day in synchronism with Internet standard time servers. -<TT>ntpd</TT> is a complete implementation of the Network Time Protocol -(NTP) version 4, but also retains compatibility with version 3, as -defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and -RFC-1119, respectively. <TT>ntpd</TT> does most computations in 64-bit -floating point arithmetic and does relatively clumsy 64-bit fixed point -operations only when necessary to preserve the unltimate precision, -about 232 picoseconds. While the ultimate precision, is not achievable -with ordinary workstations and networks of today, it may be required -with future nanosecond CPU clocks and gigabit LANs. - -<P>The daemon can operate in any of several modes, including symmetric -active/passive, client/server broadcast/multicast and manycast. A +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntpd - Network Time Protocol (NTP) daemon</title> +</head> +<body> +<h3><tt>ntpd</tt> - Network Time Protocol (NTP) daemon</h3> + +<img align="left" src="pic/alice47.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>The mushroom knows all the command line options.<br clear= +"left"> +</p> + +<hr> +<h4>Synopsis</h4> + +<tt>ntpd [ -aAbdgLmNPqx ] [ -c <i>conffile</i> ] [ -f <i> +driftfile</i> ] [ -g ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] +[ -N high ] [ -p <i>pidfile</i> ] [ -r <i>broadcastdelay</i> ] [ -s +<i>statsdir</i> ] [ -t <i>key</i> ] [ -v <i>variable</i> ] [ -V <i> +variable</i> ] [ -x ]</tt> + +<h4>Description</h4> + +The <tt>ntpd</tt> program is an operating system daemon which sets +and maintains the system time of day in synchronism with Internet +standard time servers. It is a complete implementation of the +Network Time Protocol (NTP) version 4, but also retains +compatibility with version 3, as defined by RFC-1305, and version 1 +and 2, as defined by RFC-1059 and RFC-1119, respectively. <tt> +ntpd</tt> does most computations in 64-bit floating point +arithmetic and does relatively clumsy 64-bit fixed point operations +only when necessary to preserve the ultimate precision, about 232 +picoseconds. While the ultimate precision, is not achievable with +ordinary workstations and networks of today, it may be required +with future gigahertz CPU clocks and gigabit LANs. + +<h4>How NTP Operates</h4> + +<p>The <tt>ntpd</tt> program operates by exchanging messages with +one or more configured servers at designated poll intervals. When +started, whether for the first or subsequent times, the program +requires several exahanges from the majority of these servers so +the signal processing and mitigation algorithms can accumulate and +groom the data and set the clock. In order to protect the network +from bursts, the initial poll interval for each server is delayed +an interval randomized over 0-16s. At the default initial poll +interval of 64s, several minutes can elapse before the clock is +set. The initial delay to set the clock can be reduced using the +<tt>iburst</tt> keyword with the <tt>server</tt> configuration +command, as described on the <a href="confopt.htm">Configuration +Options</a> page.</p> + +<p>Most operating systems and hardware of today incorporate a +time-of-year (TOY) chip to maintain the time during periods when +the power is off. When the machine is booted, the chip is used to +initialize the operating system time. After the machine has +synchronized to a NTP server, the operating system corrects the +chip from time to time. In case there is no TOY chip or for some +reason its time is more than 1000s from the server time, <tt> +ntpd</tt> assumes something must be terribly wrong and the only +reliable action is for the operator to intervene and set the clock +by hand. This causes <tt>ntpd</tt> to exit with a panic message to +the system log. The <tt>-g</tt> option overrides this check and the +clock will be set to the server time regardless of the chip time. +However, and to protect against broken hardware, such as when the +CMOS battery fails or the clock counter becomes defective, once the +clock has been set, an error greater than 1000s will cause <tt> +ntpd</tt> to exit anyway.</p> + +<p>Under ordinariy conditions, <tt>ntpd</tt> adjusts the clock in +small steps so that the timescale is effectively continuous and +without discontinuities. Under conditions of extreme network +congestion, the roundtrip delay jitter can exceed three seconds and +the synchronization distance, which is equal to one-half the +roundtrip delay plus error budget terms, can become very large. The +<tt>ntpd</tt> algorithms discard sample offsets exceeding 128 ms, +unless the interval during which no sample offset is less than 128 +ms exceeds 900s. The first sample after that, no matter what the +offset, steps the clock to the indicated time. In practice this +reduces the false alarm rate where the clock is stepped in error to +a vanishingly low incidence.</p> + +<p>As the result of this behavior, once the clock has been set, it +very rarely strays more than 128 ms, even under extreme cases of +network path congestion and jitter. Sometimes, in particular when +<tt>ntpd</tt> is first started, the error might exceed 128 ms. This +may on occasion cause the clock to be set backwards if the local +clock time is more than 128 s in the future relative to the server. +In some applications, this behavior may be unacceptable. If the +<tt>-x</tt> option is included on the command line, the clock will +never be stepped and only slew corrections will be used.</p> + +<p>The issues should be carefully explored before deciding to use +the <tt>-x</tt> option. The maximum slew rate possible is limited +to 500 parts-per-million (PPM) as a consequence of the correctness +principles on which the NTP protocol and algorithm design are +based. As a result, the local clock can take a long time to +converge to an acceptable offset, about 2,000 s for each second the +clock is outside the acceptable range. During this interval the +local clock will not be consistent with any other network clock and +the system cannot be used for distributed applications that require +correctly synchronized network time.</p> + +<p>In spite of the above precautions, sometimes when large +frequency errors are present the resulting time offsets stray +outside the 128-ms range and an eventual step or slew time +correction is required. If following such a correction the +frequency error is so large that the first sample is outside the +acceptable range, <tt>ntpd</tt> enters the same state as when the +<tt>ntp.drift</tt> file is not present. The intent of this behavior +is to quickly correct the frequency and restore operation to the +normal tracking mode. In the most extreme cases +(<tt>time.ien.it</tt> comes to mind), there may be occasional +step/slew corrections and subsequent frequency corrections. It +helps in these cases to use the <tt>burst</tt> keyword when +configuring the server.</p> + +<h4>Frequency Discipline</h4> + +<p>The <tt>ntpd</tt> behavior at startup depends on whether the +frequency file, usually <tt>ntp.drift</tt>, exists. This file +contains the latest estimate of clock frequency error. When the +<tt>ntpd</tt> is started and the file does not exist, the <tt> +ntpd</tt> enters a special mode designed to quickly adapt to the +particular system clock oscillator time and frequency error. This +takes approximately 15 minutes, after which the time and frequency +are set to nominal values and the <tt>ntpd</tt> enters normal mode, +where the time and frequency are continuously tracked relative to +the server. After one hour the frequency file is created and the +current frequency offset written to it. When the <tt>ntpd</tt> is +started and the file does exist, the <tt>ntpd</tt> frequency is +initialized from the file and enters normal mode immediately. After +that the current frequency offset is written to the file at hourly +intervals.</p> + +<h4>Operating Modes</h4> + +<p><tt>ntpd</tt> can operate in any of several modes, including +symmetric active/passive, client/server broadcast/multicast and +manycast, as described in the <a href="assoc.htm">Association +Management</a> page. It normally operates continuously while +monitoring for small changes in frequency and trimming the clock +for the ultimate precision. However, it can operate in a one-time +mode where the time is set from an external server and frequency is +set from a previously recorded frequency file. A broadcast/multicast or manycast client can discover remote servers, -compute server-client propagation delay correction factors and configure -itself automatically. This makes it possible to deploy a fleet of -workstations without specifying configuration details specific to the -local environment. +compute server-client propagation delay correction factors and +configure itself automatically. This makes it possible to deploy a +fleet of workstations without specifying configuration details +specific to the local environment.</p> + +<p>By default, <tt>ntpd</tt> runs in continuous mode where each of +possibly several external servers is polled at intervals determined +by an intricate state machine. The state machine measures the +incidental roundtrip delay jitter and oscillator frequency wander +and determines the best poll interval using a heuristic algorithm. +Ordinarily, and in most operating environments, the state machine +will start with 64s intervals and eventually increase in steps to +1024s. A small amount of random variation is introduced in order to +avoid bunching at the servers. In addition, should a server become +unreachable for some time, the poll interval is increased in steps +to 1024s in order to reduce network overhead.</p> + +<p>In some cases it may not be practical for <tt>ntpd</tt> to run +continuously. A common workaround has been to run the <tt> +ntpdate</tt> program from a <tt>cron</tt> job at designated times. +However, this program does not have the crafted signal processing, +error checking and mitigation algorithms of <tt>ntpd</tt>. The <tt> +-q</tt> option is intended for this purpose. Setting this option +will cause <tt>ntpd</tt> to exit just after setting the clock for +the first time. The procedure for initially setting the clock is +the same as in continuous mode; most applications will probably +want to specify the <tt>iburst</tt> keyword with the <tt> +server</tt> configuration command. With this keyword a volley of +messages are exchanged to groom the data and the clock is set in +about a minute. If nothing is heard after a couple of minutes, the +daemon times out and exits. After a suitable period of mourning, +the <tt>ntpdate</tt> program may be retired.</p> + +<p>When kernel support is available to discipline the clock +frequency, which is the case for stock Solaris, Tru64, Linux and +FreeBSD, a useful feature is available to discipline the clock +frequency. First, <tt>ntpd</tt> is run in continuous mode with +selected servers in order to measure and record the intrinsic clock +frequency offset in the frequency file. It may take some hours for +the frequency and offset to settle down. Then the <tt>ntpd</tt> is +stopped and run in one-time mode as required. At each startup, the +frequency is read from the file and initializes the kernel +frequency.</p> + +<h4>Poll Interval Control</h4> + +<p>This version of NTP includes an intricate state machine to +reduce the network load while maintaining a quality of +synchronization consistent with the observed jitter and wander. +There are a number of ways to tailor the operation in order enhance +accuracy by reducing the interval or to reduce network overhead by +increasing it. However, the user is advised to carefully consider +the consequenses of changing the poll adjustment range from the +default minimum of 64 s to the default maximum of 1,024 s. The +default minimum can be changed with the <tt>tinker minpoll</tt> +command to a value not less than 16 s. This value is used for all +configured associations, unless overriden by the <tt>minpoll</tt> +option on the configuration command. Note that most device drivers +will not operate properly if the poll interval is less than 64 s +and that the broadcast server and manycast client associations will +also use the default, unless overriden.</p> + +<p>In some cases involving dial up or toll services, it may be +useful to increase the minimum interval to a few tens of minutes +and maximum interval to a day or so. Under normal operation +conditions, once the clock discipline loop has stabilized the +interval will be increased in steps from the minumum to the +maximum. However, this assumes the intrinsic clock frequency error +is small enough for the discipline loop correct it. The capture +range of the loop is 500 PPM at an interval of 64s decreasing by a +factor of two for each doubling of interval. At a minimum of 1,024 +s, for example, the capture range is only 31 PPM. If the intrinsic +error is greater than this, the drift file <tt>ntp.drift</tt> will +have to be specially tailored to reduce the residual error below +this limit. Once this is done, the drift file is automatically +updated once per hour and is available to initialize the frequency +on subsequent daemon restarts.</p> + +<h4>The huff-n'-puff filter</h4> + +<p>In scenarios where a considerable amount of data are to be +downloaded or uploaded over telephone modems, timekeeping quality +can be seriously degraded. This occurs because the differential +delays on the two directions of transmission can be quite large. In +many cases the apparent time errors are so large as to exceed the +step threshold and a step correction can occur during and after the +data transfer is in progress.</p> + +<p>The huff-n'-puff filter is designed to correct the apparent time +offset in these cases. It depends on knowledge of the propagation +delay when no other traffic is present. In common scenarios this +occurs during other than work hours. The filter maintains a shift +register that remembers the minimum delay over the most recent +interval measured usually in hours. Under conditions of severe +delay, the filter corrects the apparent offset using the sign of +the offset and the difference between the apparent delay and +minimum delay. The name of the filter reflects the negative (huff) +and positive (puff) correction, which depends on the sign of the +offset.</p> + +<p>The filter is activated by the <tt>tinker</tt> command and <tt> +huffpuff</tt> keyword, as described in the <a href="miscopt.htm"> +Miscellaneous Options</a> page.</p> + +<h4>Notes</h4> + +<p>If NetInfo support is built into <tt>ntpd</tt>, then <tt> +ntpd</tt> will attempt to read its configuration from the NetInfo +if the default ntp.conf file cannot be read and no file is +specified by the <tt>-c</tt> option.</p> + +<p>Various internal <tt>ntpd</tt> variables can be displayed and +configuration options altered while the <tt>ntpd</tt> is running +using the <tt><a href="ntpq.htm">ntpq</a></tt> and <tt><a href= +"ntpdc.htm">ntpdc</a></tt> utility programs.</p> + +<p>When <tt>ntpd</tt> starts it looks at the value of <tt> +umask</tt>, and if zero <tt>ntpd</tt> will set the <tt>umask</tt> +to <tt>022</tt>.</p> + +<h4>Command Line Options</h4> + +<dl> +<dt><tt>-a</tt></dt> + +<dd>Enable authentication mode (default).</dd> + +<dt><tt>-A</tt></dt> + +<dd>Disable authentication mode.</dd> + +<dt><tt>-b</tt></dt> + +<dd>Synchronize using NTP broadcast messages.</dd> + +<dt><tt>-c <i>conffile</i></tt></dt> + +<dd>Specify the name and path of the configuration file. (Disable +netinfo?)</dd> + +<dt><tt>-d</tt></dt> + +<dd>Specify debugging mode. This flag may occur multiple times, +with each occurrence indicating greater detail of display.</dd> + +<dt><tt>-D <i>level</i></tt></dt> + +<dd>Specify debugging level directly.</dd> + +<dt><tt>-f <i>driftfile</i></tt></dt> + +<dd>Specify the name and path of the drift file.</dd> + +<dt><tt>-g</tt></dt> + +<dd>Normally, <tt>ntpd</tt> exits if the offset exceeds the sanity +limit, which is 1000 s by default. If the sanity limit is set to +zero, no sanity checking is performed and any offset is acceptable. +This option overrides the limit and allows the time to be set to +any value without restriction; however, this can happen only once. +After that, <tt>ntpd</tt> will exit if the limit is exceeded. This +option can be used with the <tt>-q</tt> option.</dd> + +<dt><tt>-k <i>keyfile</i></tt></dt> + +<dd>Specify the name and path of the file containing the NTP +authentication keys.</dd> + +<dt><tt>-l <i>logfile</i></tt></dt> + +<dd>Specify the name and path of the log file. The default is the +system log facility.</dd> + +<dt><tt>-L</tt></dt> + +<dd>Listen to virtual IPs.</dd> + +<dt><tt>-m</tt></dt> + +<dd>Synchronize using NTP multicast messages on the IP multicast +group address 224.0.1.1 (requires multicast kernel).</dd> + +<dt><tt>-n</tt></dt> + +<dd>Don't fork.</dd> + +<dt><tt>-N <i>priority</i></tt></dt> + +<dd>To the extent permitted by the operating system, run the <tt> +ntpd</tt> at a high priority.</dd> + +<dt><tt>-p <i>pidfile</i></tt></dt> + +<dd>Specify the name and path to record the <tt>ntpd</tt>'s process +ID.</dd> + +<dt><tt>-P</tt></dt> + +<dd>Override the priority limit set by the operating system. Not +recommended for sissies.</dd> + +<dt><tt>-q</tt></dt> + +<dd>Exit the <tt>ntpd</tt> just after the first time the clock is +set. This behavior mimics that of the <tt>ntpdate</tt> program, +which is to be retired. The <tt>-g</tt> and <tt>-x</tt> options can +be used with this option.</dd> + +<dt><tt>-r <i>broadcastdelay</i></tt></dt> + +<dd>Specify the default propagation delay from the +broadcast/multicast server and this computer. This is necessary +only if the delay cannot be computed automatically by the +protocol.</dd> + +<dt><tt>-s <i>statsdir</i></tt></dt> + +<dd>Specify the directory path for files created by the statistics +facility.</dd> + +<dt><tt>-t <i>key</i></tt></dt> + +<dd>Add a key number to the trusted key list.</dd> + +<dt><tt>-v <i>variable</i></tt></dt> + +<dt><tt>-V <i>variable</i></tt></dt> + +<dd>Add a system variable listed by default.</dd> + +<dt><tt>-x</tt></dt> + +<dd>Normally, the time is slewed if the offset is less than the +step threshold, which is 128 ms by default, and stepped if above +the threshold. This option forces the time to be slewed in all +cases. If the step threshold is set to zero, all offsets are +stepped, regardless of value and regardless of the <tt>-x</tt> +option. In general, this is not a good idea, as it bypasses the +clock state machine which is designed to cope with large time and +frequency errors Note: Since the slew rate is limited to 0.5 ms/s, +each second of adjustment requires an amortization interval of 2000 +s. Thus, an adjustment of many seconds can take hours or days to +amortize. This option can be used with the <tt>-q</tt> option.</dd> +</dl> + +<h4>The Configuration File</h4> + +<p>Ordinarily, <tt>ntpd</tt> reads the <tt>ntp.conf</tt> +configuration file at startup time in order to determine the +synchronization sources and operating modes. It is also possible to +specify a working, although limited, configuration entirely on the +command line, obviating the need for a configuration file. This may +be particularly useful when the local host is to be configured as a +broadcast/multicast client, with all peers being determined by +listening to broadcasts at run time.</p> + +<p>Usually, the configuration file is installed in the <tt> +/etc</tt> directory, but could be installed elsewhere (see the <tt> +-c <i>conffile</i></tt> command line option). The file format is +similar to other Unix configuration files - comments begin with a +<tt>#</tt> character and extend to the end of the line; blank lines +are ignored.</p> + +<p>Configuration commands consist of an initial keyword followed by +a list of arguments, some of which may be optional, separated by +whitespace. Commands may not be continued over multiple lines. +Arguments may be host names, host addresses written in numeric, +dotted-quad form, integers, floating point numbers (when specifying +times in seconds) and text strings. Optional arguments are +delimited by <tt>[ ]</tt> in the following descriptions, while +alternatives are separated by <tt>|</tt>. The notation <tt>[ ... +]</tt> means an optional, indefinite repetition of the last item +before the <tt>[ ... ]</tt>.</p> + +<p><a href="confopt.htm">Configuration Options</a><br> +<a href="authopt.htm">Authentication Options</a><br> +<a href="monopt.htm">Monitoring Options</a><br> +<a href="accopt.htm">Access Control Options</a><br> +<a href="clockopt.htm">Reference Clock Options</a><br> +<a href="miscopt.htm">Miscellaneous Options</a></p> + +<h4>Files</h4> + +<tt>/etc/ntp.conf</tt> - the default name of the configuration file +<br> +<tt>/etc/ntp.drift</tt> - the default name of the drift file <br> +<tt>/etc/ntp.keys</tt> - the default name of the key file + +<h4>Bugs</h4> + +<tt>ntpd</tt> has gotten rather fat. While not huge, it has gotten +larger than might be desirable for an elevated-priority <tt> +ntpd</tt> running on a workstation, particularly since many of the +fancy features which consume the space were designed more with a +busy primary server, rather than a high stratum workstation in +mind. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<P>Ordinarily, <TT>ntpd</TT> reads the <TT>ntp.conf</TT> configuration -file at startup time in order to determine the synchronization sources -and operating modes. It is also possible to specify a working, although -limited, configuration entirely on the command line, obviating the need -for a configuration file. This may be particularly appropriate when the -local host is to be configured as a broadcast/multicast client or -manycast client, with all peers being determined by listening to -broadcasts at run time. - -<P>If NetInfo support is built into <TT>ntpd</TT>, then <TT>ntpd</TT> -will attempt to read its configuration from the NetInfo if the default -ntp.conf file cannot be read and no file is specified by the <TT>-c</TT> -option. - -<P>Various internal <TT>ntpd</TT> variables can be displayed and -configuration options altered while the daemon is running using the -<TT><A HREF="ntpq.htm">ntpq</A></TT> and <TT><A -HREF="ntpdc.htm">ntpdc</A></TT> utility programs. - -<P>When <TT>ntpd</TT> starts it looks at the value of <TT>umask</TT>, -and if it's zero <TT>ntpd</TT> will set the <TT>umask</TT> to -<TT>022</TT>. - -<H4>Command Line Options</H4> - -<DL> - -<DT><TT>-a</TT></DT> -<DD>Enable authentication mode (default).</DD> - -<DT><TT>-A</TT></DT> -<DD>Disable authentication mode.</DD> - -<DT><TT>-b</TT></DT> -<DD>Synchronize using NTP broadcast messages.</DD> - -<DT><TT>-c <I>conffile</I></TT></DT> -<DD>Specify the name and path of the configuration file.</DD> - -<DT><TT>-d</TT></DT> -<DD>Specify debugging mode. This flag may occur multiple times, with -each occurrence indicating greater detail of display.</DD> - -<DT><TT>-D <I>level</I></TT></DT> -<DD>Specify debugging level directly.</DD> - -<DT><TT>-f <I>driftfile</I></TT></DT> -<DD>Specify the name and path of the drift file.</DD> - -<DT><TT>-g</TT></DT> -<DD>Normally, the daemon exits if the offset exceeds a 1000-s sanity -limit. This option overrides this limit and allows the time to be set to -any value without restriction; however, this can happen only once. After -that, the daemon will exit of the limit is exceeded. - -<DT><TT>-k <I>keyfile</I></TT></DT> -<DD>Specify the name and path of the file containing the NTP -authentication keys.</DD> - -<DT><TT>-l <I>logfile</I></TT></DT> -<DD>Specify the name and path of the log file. The default is the system -log facility.</DD> - -<DT><TT>-m</TT></DT> -<DD>Synchronize using NTP multicast messages on the IP multicast group -address 224.0.1.1 (requires multicast kernel).</DD> - -<DT><TT>-p <I>pidfile</I></TT></DT> -<DD>Specify the name and path to record the daemon's process ID.</DD> - -<DT><TT>-P</TT></DT> -<DD>Override the priority limit set by the operating system. Not -recommended for sissies.</DD> - -<DT><TT>-r <I>broadcastdelay</I></TT></DT> -<DD>Specify the default propagation delay from the broadcast/multicast -server and this computer. This is necessary only if the delay cannot be -computed automatically by the protocol.</DD> - -<DT><TT>-s <I>statsdir</I></TT></DT> -<DD>Specify the directory path for files created by the statistics -facility.</DD> - -<DT><TT>-t <I>key</I></TT></DT> -<DD>Add a key number to the trusted key list.</DD> - -<DT><TT>-v <I>variable</I></TT></DT> -<DT><TT>-V <I>variable</I></TT></DT> -<DD>Add a system variable listed by default.</DD> - -<DT><TT>-x</TT></DT> -<DD>Ordinarily, if the time is to be adjusted more than 128 ms, it is -stepped, not gradually slewed. This option forces the time to be slewed -in all cases. Note: Since the slew rate is limited to 0.5 ms/s, each -second of adjustment requires an amortization interval of 2000 s. Thus, -an adjustment of many seconds can take hours or days to amortize.</DD> -</DL> - -<H4>The Configuration File</H4> - -The <TT>ntpd</TT> configuration file is read at initial startup in order -to specify the synchronization sources, modes and other related -information. Usually, it is installed in the <TT>/etc</TT> directory, -but could be installed elsewhere (see the <TT>-c <I>conffile</I></TT> -command line option). The file format is similar to other Unix -configuration files - comments begin with a <TT>#</TT> character and -extend to the end of the line; blank lines are ignored. Configuration -commands consist of an initial keyword followed by a list of arguments, -some of which may be optional, separated by whitespace. Commands may not -be continued over multiple lines. Arguments may be host names, host -addresses written in numeric, dotted-quad form, integers, floating -point numbers (when specifying times in seconds) and text strings. -Optional arguments are delimited by <TT>[ ]</TT> in the following -descriptions, while alternatives are separated by <TT>|</TT>. The -notation <TT>[ ... ]</TT> means an optional, indefinite repetition of -the last item before the <TT>[ ... ]</TT>. - -<P>See the following pages for configuration and control options. While -there is a rich set of options available, the only required option is -one or more <TT>server, peer,</TT> <TT>broadcast</TT> or -<TT>manycastclient </TT>commands described in the Configuration Options -page. The <A HREF="notes.htm">Notes on Configuring NTP and Setting up a -NTP Subnet </A>page contains an extended discussion of these options. - -<P><A HREF="confopt.htm">Configuration Options</A> -<BR><A HREF="authopt.htm">Authentication Options</A> -<BR><A HREF="monopt.htm">Monitoring Options</A> -<BR><A HREF="accopt.htm">Access Control Options</A> -<BR><A HREF="clockopt.htm">Reference Clock Options</A> -<BR><A HREF="miscopt.htm">Miscellaneous Options</A> - -<H4>Files</H4> - -<TT>/etc/ntp.conf</TT> - the default name of the configuration file -<BR><TT>/etc/ntp.drift</TT> - the default name of the drift file -<BR><TT>/etc/ntp.keys</TT> - the default name of the key file - -<H4>Bugs</H4> - -<TT>ntpd</TT> has gotten rather fat. While not huge, it has gotten -larger than might be desireable for an elevated-priority daemon running -on a workstation, particularly since many of the fancy features which -consume the space were designed more with a busy primary server, rather -than a high stratum workstation, in mind. - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/ntpdate.htm b/contrib/ntp/html/ntpdate.htm index a7f532f..c2d32bb 100644 --- a/contrib/ntp/html/ntpdate.htm +++ b/contrib/ntp/html/ntpdate.htm @@ -1,185 +1,186 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>ntpdate - set the date and time via NTP -</TITLE> -</HEAD> -<BODY> - -<H3> -<TT>ntpdate</TT> - set the date and time via NTP</H3> - -<HR> -<H4> -Synopsis</H4> -<TT>ntpdate [ -bBdoqsuv ] [ -a <I>key</I> ] [ -e <I>authdelay</I> ] [ -k -<I>keyfile</I> ] [ -o <I>version</I> ] [ -p <I>samples</I> ] [ -t <I>timeout</I> -] <I>server</I> [ ... ]</TT> -<H4> -Description</H4> -<TT>ntpdate</TT> sets the local date and time by polling the Network Time -Protocol (NTP) server(s) given as the <I>server</I> arguments to determine -the correct time. It must be run as root on the local host. A number of -samples are obtained from each of the servers specified and a subset of -the NTP clock filter and selection algorithms are applied to select the -best of these. Note that the accuracy and reliability of <TT>ntpdate</TT> -depends on the number of servers, the number of polls each time it is run -and the interval between runs. - -<P><TT>ntpdate</TT> can be run manually as necessary to set the host clock, -or it can be run from the host startup script to set the clock at boot -time. This is useful in some cases to set the clock initially before starting -the NTP daemon <TT>ntpd</TT>. It is also possible to run <TT>ntpdate</TT> -from a <TT>cron</TT> script. However, it is important to note that <TT>ntpdate</TT> -with contrived <TT>cron</TT> scripts is no substitute for the NTP daemon, -which uses sophisticated algorithms to maximize accuracy and reliability -while minimizing resource use. Finally, since <TT>ntpdate</TT> does not -discipline the host clock frequency as does <TT>ntpd</TT>, the accuracy -using <TT>ntpdate</TT> is limited. - -<P>Time adjustments are made by <TT>ntpdate</TT> in one of two ways. If -<TT>ntpdate</TT> determines the clock is in error more than 0.5 second -it will simply step the time by calling the system <TT>settimeofday()</TT> -routine. If the error is less than 0.5 seconds, it will slew the time by -calling the system <TT>adjtime()</TT> routine. The latter technique is -less disruptive and more accurate when the error is small, and works quite -well when <TT>ntpdate</TT> is run by <TT>cron</TT> every hour or two. - -<P><TT>ntpdate</TT> will decline to set the date if an NTP server daemon -(e.g., <TT>ntpd</TT>) is running on the same host. When running <TT>ntpdate</TT> -on a regular basis from <TT>cron</TT> as an alternative to running a daemon, -doing so once every hour or two will result in precise enough timekeeping -to avoid stepping the clock. - -<P>If NetInfo support is compiled into <TT>ntpdate</TT>, then the -<TT>server</TT> argument is optional if <TT>ntpdate</TT> can find a time -server in the NetInfo configuration for <TT>ntpd</TT>. - -<H4> -Command Line Options</H4> - -<DL> -<DT> -<TT>-a <I>key</I></TT></DT> - -<DD> -Enable the authentication function and specify the key identifier to be -used for authentication as the argument <I>key</I><TT>ntpdate</TT>. The -keys and key identifiers must match in both the client and server key files. -The default is to disable the authentication function.</DD> - -<DT> -<TT>-B</TT></DT> - -<DD> -Force the time to always be slewed using the adjtime() system call, even -if the measured offset is greater than +-128 ms. The default is to step -the time using settimeofday() if the offset is greater than +-128 ms. Note -that, if the offset is much greater than +-128 ms in this case, that it -can take a long time (hours) to slew the clock to the correct value. During -this time. the host should not be used to synchronize clients.</DD> - -<DT> -<TT>-b</TT></DT> - -<DD> -Force the time to be stepped using the settimeofday() system call, rather -than slewed (default) using the adjtime() system call. This option should -be used when called from a startup file at boot time.</DD> - -<DT> -<TT>-d</TT></DT> - -<DD> -Enable the debugging mode, in which <TT>ntpdate</TT> will go through all -the steps, but not adjust the local clock. Information useful for general -debugging will also be printed.</DD> - -<DT> -<TT>-e <I>authdelay</I></TT></DT> - -<DD> -Specify the processing delay to perform an authentication function as the -value <I>authdelay</I>, in seconds and fraction (see <TT>ntpd</TT> for -details). This number is usually small enough to be negligible for most -purposes, though specifying a value may improve timekeeping on very slow -CPU's.</DD> - -<DT> -<TT>-k <I>keyfile</I></TT></DT> - -<DD> -Specify the path for the authentication key file as the string <I>keyfile</I>. -The default is <TT>/etc/ntp.keys</TT>. This file should be in the format -described in <TT>ntpd</TT>.</DD> - -<DT> -<TT>-o <I>version</I></TT></DT> - -<DD> -Specify the NTP version for outgoint packets as the integer <I>version</I>, -which can be 1 or 2. The default is 3. This allows <TT>ntpdate</TT> to -be used with older NTP versions.</DD> - -<DT> -<TT>-p <I>samples</I></TT></DT> - -<DD> -Specify the number of samples to be acquired from each server as the integer -<I>samples</I>, with values from 1 to 8 inclusive. The default is 4.</DD> - -<DT> -<I><TT>-q</TT></I></DT> - -<DD> -Query only - don't set the clock.</DD> - -<DT> -<TT>-s</TT></DT> - -<DD> -Divert logging output from the standard output (default) to the system -<TT>syslog</TT> facility. This is designed primarily for convenience of -<TT>cron</TT> scripts.</DD> - -<DT> -<TT>-t <I>timeout</I></TT></DT> - -<DD> -Specify the maximum time waiting for a server response as the value <I>timeout</I>, -in seconds and fraction. The value is is rounded to a multiple of 0.2 seconds. -The default is 1 second, a value suitable for polling across a LAN.</DD> - -<DT> -<TT>-u</TT></DT> - -<DD> -Direct <TT>ntpdate</TT> to use an unprivileged port or outgoing packets. -This is most useful when behind a firewall that blocks incoming traffic -to privileged ports, and you want to synchronise with hosts beyond the -firewall. Note that the <TT>-d</TT> option always uses unprivileged ports.</DD> - -<DT> -<TT>-<I>v</I></TT></DT> - -<DD> -Be verbose. This option will cause <TT>ntpdate</TT>'s version identification -string to be logged.</DD> -</DL> - -<H4> -Files</H4> -<TT>/etc/ntp.keys</TT> - encryption keys used by <TT>ntpdate</TT>. -<H4> -Bugs</H4> -The slew adjustment is actually 50% larger than the measured offset, since -this (it is argued) will tend to keep a badly drifting clock more accurate. -This is probably not a good idea and may cause a troubling hunt for some -values of the kernel variables <TT>tick</TT> and <TT>tickadj</TT>. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntpdate - set the date and time via NTP</title> +</head> +<body> +<h3><tt>ntpdate</tt> - set the date and time via NTP</h3> + +<img align="left" src="pic/rabbit.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>I told you it was eyeball and wristwatch.<br clear="left"> +</p> + +<hr> +<p>Disclaimer: The functionality of this program is now available +in the <tt>ntpd</tt> program. See the <tt>-q</tt> command line +option in the <a href="ntpd.htm"><tt>ntpd</tt> - Network Time +Protocol (NTP) daemon</a> page. After a suitable period of +mourning, the <tt>ntpdate</tt> program is to be retired from this +distribution</p> + +<h4>Synopsis</h4> + +<tt>ntpdate [ -bBdoqsuv ] [ -a <i>key</i> ] [ -e <i>authdelay</i> ] +[ -k <i>keyfile</i> ] [ -o <i>version</i> ] [ -p <i>samples</i> ] [ +-t <i>timeout</i> ] <i>server</i> [ ... ]</tt> + +<h4>Description</h4> + +<tt>ntpdate</tt> sets the local date and time by polling the +Network Time Protocol (NTP) server(s) given as the <i>server</i> +arguments to determine the correct time. It must be run as root on +the local host. A number of samples are obtained from each of the +servers specified and a subset of the NTP clock filter and +selection algorithms are applied to select the best of these. Note +that the accuracy and reliability of <tt>ntpdate</tt> depends on +the number of servers, the number of polls each time it is run and +the interval between runs. + +<p><tt>ntpdate</tt> can be run manually as necessary to set the +host clock, or it can be run from the host startup script to set +the clock at boot time. This is useful in some cases to set the +clock initially before starting the NTP daemon <tt>ntpd</tt>. It is +also possible to run <tt>ntpdate</tt> from a <tt>cron</tt> script. +However, it is important to note that <tt>ntpdate</tt> with +contrived <tt>cron</tt> scripts is no substitute for the NTP +daemon, which uses sophisticated algorithms to maximize accuracy +and reliability while minimizing resource use. Finally, since <tt> +ntpdate</tt> does not discipline the host clock frequency as does +<tt>ntpd</tt>, the accuracy using <tt>ntpdate</tt> is limited.</p> + +<p>Time adjustments are made by <tt>ntpdate</tt> in one of two +ways. If <tt>ntpdate</tt> determines the clock is in error more +than 0.5 second it will simply step the time by calling the system +<tt>settimeofday()</tt> routine. If the error is less than 0.5 +seconds, it will slew the time by calling the system <tt> +adjtime()</tt> routine. The latter technique is less disruptive and +more accurate when the error is small, and works quite well when +<tt>ntpdate</tt> is run by <tt>cron</tt> every hour or two.</p> + +<p><tt>ntpdate</tt> will decline to set the date if an NTP server +daemon (e.g., <tt>ntpd</tt>) is running on the same host. When +running <tt>ntpdate</tt> on a regular basis from <tt>cron</tt> as +an alternative to running a daemon, doing so once every hour or two +will result in precise enough timekeeping to avoid stepping the +clock.</p> + +<p>If NetInfo support is compiled into <tt>ntpdate</tt>, then the +<tt>server</tt> argument is optional if <tt>ntpdate</tt> can find a +time server in the NetInfo configuration for <tt>ntpd</tt>.</p> + +<h4>Command Line Options</h4> + +<dl> +<dt><tt>-a <i>key</i></tt></dt> + +<dd>Enable the authentication function and specify the key +identifier to be used for authentication as the argument <i> +key</i><tt>ntpdate</tt>. The keys and key identifiers must match in +both the client and server key files. The default is to disable the +authentication function.</dd> + +<dt><tt>-B</tt></dt> + +<dd>Force the time to always be slewed using the adjtime() system +call, even if the measured offset is greater than +-128 ms. The +default is to step the time using settimeofday() if the offset is +greater than +-128 ms. Note that, if the offset is much greater +than +-128 ms in this case, that it can take a long time (hours) to +slew the clock to the correct value. During this time. the host +should not be used to synchronize clients.</dd> + +<dt><tt>-b</tt></dt> + +<dd>Force the time to be stepped using the settimeofday() system +call, rather than slewed (default) using the adjtime() system call. +This option should be used when called from a startup file at boot +time.</dd> + +<dt><tt>-d</tt></dt> + +<dd>Enable the debugging mode, in which <tt>ntpdate</tt> will go +through all the steps, but not adjust the local clock. Information +useful for general debugging will also be printed.</dd> + +<dt><tt>-e <i>authdelay</i></tt></dt> + +<dd>Specify the processing delay to perform an authentication +function as the value <i>authdelay</i>, in seconds and fraction +(see <tt>ntpd</tt> for details). This number is usually small +enough to be negligible for most purposes, though specifying a +value may improve timekeeping on very slow CPU's.</dd> + +<dt><tt>-k <i>keyfile</i></tt></dt> + +<dd>Specify the path for the authentication key file as the string +<i>keyfile</i>. The default is <tt>/etc/ntp.keys</tt>. This file +should be in the format described in <tt>ntpd</tt>.</dd> + +<dt><tt>-o <i>version</i></tt></dt> + +<dd>Specify the NTP version for outgoint packets as the integer <i> +version</i>, which can be 1 or 2. The default is 3. This allows +<tt>ntpdate</tt> to be used with older NTP versions.</dd> + +<dt><tt>-p <i>samples</i></tt></dt> + +<dd>Specify the number of samples to be acquired from each server +as the integer <i>samples</i>, with values from 1 to 8 inclusive. +The default is 4.</dd> + +<dt><i><tt>-q</tt></i></dt> + +<dd>Query only - don't set the clock.</dd> + +<dt><tt>-s</tt></dt> + +<dd>Divert logging output from the standard output (default) to the +system <tt>syslog</tt> facility. This is designed primarily for +convenience of <tt>cron</tt> scripts.</dd> + +<dt><tt>-t <i>timeout</i></tt></dt> + +<dd>Specify the maximum time waiting for a server response as the +value <i>timeout</i>, in seconds and fraction. The value is is +rounded to a multiple of 0.2 seconds. The default is 1 second, a +value suitable for polling across a LAN.</dd> + +<dt><tt>-u</tt></dt> + +<dd>Direct <tt>ntpdate</tt> to use an unprivileged port or outgoing +packets. This is most useful when behind a firewall that blocks +incoming traffic to privileged ports, and you want to synchronise +with hosts beyond the firewall. Note that the <tt>-d</tt> option +always uses unprivileged ports.</dd> + +<dt><tt>-<i>v</i></tt></dt> + +<dd>Be verbose. This option will cause <tt>ntpdate</tt>'s version +identification string to be logged.</dd> +</dl> + +<h4>Files</h4> + +<tt>/etc/ntp.keys</tt> - encryption keys used by <tt>ntpdate</tt>. + +<h4>Bugs</h4> + +The slew adjustment is actually 50% larger than the measured +offset, since this (it is argued) will tend to keep a badly +drifting clock more accurate. This is probably not a good idea and +may cause a troubling hunt for some values of the kernel variables +<tt>tick</tt> and <tt>tickadj</tt>. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/ntpdc.htm b/contrib/ntp/html/ntpdc.htm index 52d1fdf..ffb2cc0 100644 --- a/contrib/ntp/html/ntpdc.htm +++ b/contrib/ntp/html/ntpdc.htm @@ -1,620 +1,573 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>ntpdc - special NTP query program -</TITLE> -</HEAD> -<BODY> - -<H3> -<TT>ntpdc</TT> - special NTP query program</H3> - -<HR> -<H4> -Synopsis</H4> -<TT>ntpdc [ -ilnps ] [ -c <I>command</I> ] [ <I>host</I> ] [ ... ]</TT> -<H4> -Description</H4> -<TT>ntpdc</TT> is used to query the <TT>ntpd</TT> daemon about its current -state and to request changes in that state. The program may be run either -in interactive mode or controlled using command line arguments. Extensive -state and statistics information is available through the <TT>ntpdc</TT> -interface. In addition, nearly all the configuration options which can -be specified at start up using ntpd's configuration file may also be specified -at run time using <TT>ntpdc</TT>. - -<P>If one or more request options is included on the command line when -<TT>ntpdc</TT> is executed, each of the requests will be sent to the NTP -servers running on each of the hosts given as command line arguments, or -on localhost by default. If no request options are given, <TT>ntpdc</TT> -will attempt to read commands from the standard input and execute these -on the NTP server running on the first host given on the command line, -again defaulting to localhost when no other host is specified. <TT>ntpdc</TT> -will prompt for commands if the standard input is a terminal device. - -<P><TT>ntpdc</TT> uses NTP mode 7 packets to communicate with the NTP server, -and hence can be used to query any compatable server on the network which -permits it. Note that since NTP is a UDP protocol this communication will -be somewhat unreliable, especially over large distances in terms of network -topology. <TT>ntpdc</TT> makes no attempt to retransmit requests, and will -time requests out if the remote host is not heard from within a suitable -timeout time. - -<P>The operation of <TT>ntpdc</TT> are specific to the particular implementation -of the <TT>ntpd</TT> daemon and can be expected to work only with this -and maybe some previous versions of the daemon. Requests from a remote -<TT>ntpdc</TT> program which affect the state of the local server must -be authenticated, which requires both the remote program and local server -share a common key and key identifier. -<H4> -Command Line Options</H4> -Specifying a command line option other than <TT>-i</TT> or <TT>-n</TT> -will cause the specified query (queries) to be sent to the indicated host(s) -immediately. Otherwise, <TT>ntpdc</TT> will attempt to read interactive -format commands from the standard input. -<DL> -<DT> -<TT>-c <I>command</I></TT></DT> - -<DD> -The following argument is interpreted as an interactive format command -and is added to the list of commands to be executed on the specified host(s). -Multiple -c options may be given.</DD> - -<DT> -<TT>-i</TT></DT> - -<DD> -Force <TT>ntpdc</TT> to operate in interactive mode. Prompts will be written -to the standard output and commands read from the standard input.</DD> - -<DT> -<TT>-l</TT></DT> - -<DD> -Obtain a list of peers which are known to the server(s). This switch is -equivalent to <TT>-c listpeers</TT>.</DD> - -<DT> -<TT>-n</TT></DT> - -<DD> -Output all host addresses in dotted-quad numeric format rather than converting -to the canonical host names.</DD> - -<DT> -<TT>-p</TT></DT> - -<DD> -Print a list of the peers known to the server as well as a summary of their -state. This is equivalent to <TT>-c peers</TT>.</DD> - -<DT> -<TT>-s</TT></DT> - -<DD> -Print a list of the peers known to the server as well as a summary of their -state, but in a slightly different format than the -p switch. This is equivalent -to <TT>-c dmpeers</TT>.</DD> -</DL> - -<H4> -Interactive Commands</H4> -Interactive format commands consist of a keyword followed by zero to four -arguments. Only enough characters of the full keyword to uniquely identify -the command need be typed. The output of a command is normally sent to -the standard output, but optionally the output of individual commands may -be sent to a file by appending a <TT><</TT>, followed by a file name, -to the command line. - -<P>A number of interactive format commands are executed entirely within -the <TT>ntpdc</TT> program itself and do not result in NTP mode 7 requests -being sent to a server. These are described following. -<DL> -<DT> -<TT>? [ <I>command_keyword</I> ]</TT></DT> - -<BR><TT>helpl [ <I>command_keyword</I> ]</TT> -<DD> -A <TT>?</TT> by itself will print a list of all the command keywords known -to this incarnation of <TT>ntpq</TT>. A <TT>?</TT> followed by a command -keyword will print funcation and usage information about the command. This -command is probably a better source of information about <TT>ntpq</TT> -than this manual page.</DD> - -<DT> -<TT>delay <I>milliseconds</I></TT></DT> - -<DD> -Specify a time interval to be added to timestamps included in requests -which require authentication. This is used to enable (unreliable) server -reconfiguration over long delay network paths or between machines whose -clocks are unsynchronized. Actually the server does not now require timestamps -in authenticated requests, so this command may be obsolete.</DD> - -<DT> -<TT>host <I>hostname</I></TT></DT> - -<DD> -Set the host to which future queries will be sent. Hostname may be either -a host name or a numeric address.</DD> - -<DT> -<TT>hostnames [ yes | no ]</TT></DT> - -<DD> -If <TT>yes</TT> is specified, host names are printed in information displays. -If <TT>no</TT> is specified, numeric addresses are printed instead. The -default is <TT>yes</TT>, unless modified using the command line <TT>-n</TT> -switch.</DD> - -<DT> -<TT>keyid <I>keyid</I></TT></DT> - -<DD> -This command allows the specification of a key number to be used to authenticate -configuration requests. This must correspond to a key number the server -has been configured to use for this purpose.</DD> - -<DT> -<TT>quit</TT></DT> - -<DD> -Exit <TT>ntpdc</TT>.</DD> - -<DT> -<TT>passwd</TT></DT> - -<DD> -This command prompts you to type in a password (which will not be echoed) -which will be used to authenticate configuration requests. The password -must correspond to the key configured for use by the NTP server for this -purpose if such requests are to be successful.</DD> - -<DT> -<TT>timeout <I>millseconds</I></TT></DT> - -<DD> -Specify a timeout period for responses to server queries. The default is -about 8000 milliseconds. Note that since <TT>ntpdc</TT> retries each query -once after a timeout, the total waiting time for a timeout will be twice -the timeout value set.</DD> -</DL> - -<H4> -Control Message Commands</H4> -Query commands result in NTP mode 7 packets containing requests for information -being sent to the server. These are read-only commands in that they make -no modification of the server configuration state. -<DL> -<DT> -<TT>listpeers</TT></DT> - -<DD> -Obtains and prints a brief list of the peers for which the server is maintaining -state. These should include all configured peer associations as well as -those peers whose stratum is such that they are considered by the server -to be possible future synchonization candidates.</DD> - -<DT> -<TT>peers</TT></DT> - -<DD> -Obtains a list of peers for which the server is maintaining state, along -with a summary of that state. Summary information includes the address -of the remote peer, the local interface address (0.0.0.0 if a local address -has yet to be determined), the stratum of the remote peer (a stratum of -16 indicates the remote peer is unsynchronized), the polling interval, -in seconds, the reachability register, in octal, and the current estimated -delay, offset and dispersion of the peer, all in seconds. In addition, -the character in the left margin indicates the mode this peer entry is -operating in. A <TT>+</TT> denotes symmetric active, a <TT>-</TT> indicates -symmetric passive, a <TT>=</TT> means the remote server is being polled -in client mode, a <TT>^</TT> indicates that the server is broadcasting -to this address, a <TT>~</TT> denotes that the remote peer is sending broadcasts -and a <TT>*</TT> marks the peer the server is currently synchonizing to.</DD> - - -<P>The contents of the host field may be one of four forms. It may be a -host name, an IP address, a reference clock implementation name with its -parameter or <TT>REFCLK(<I>implementation number</I>, <I>parameter</I>)</TT>. -On <TT>hostnames no</TT> only IP-addresses will be displayed. -<DT> -<TT>dmpeers</TT></DT> - -<DD> -A slightly different peer summary list. Identical to the output of the -<TT>peers</TT> command, except for the character in the leftmost column. -Characters only appear beside peers which were included in the final stage -of the clock selection algorithm. A <TT>.</TT> indicates that this peer -was cast off in the falseticker detection, while a <TT>+</TT> indicates -that the peer made it through. A <TT>*</TT> denotes the peer the server -is currently synchronizing with.</DD> - -<DT> -<TT>showpeer <I>peer_address</I> [...]</TT></DT> - -<DD> -Shows a detailed display of the current peer variables for one or more -peers. Most of these values are described in the NTP Version 2 specification.</DD> - -<DT> -<TT>pstats <I>peer_address</I> [...]</TT></DT> - -<DD> -Show per-peer statistic counters associated with the specified peer(s).</DD> - -<DT> -<TT>clockinfo <I>clock_peer_address</I> [...]</TT></DT> - -<DD> -Obtain and print information concerning a peer clock. The values obtained -provide information on the setting of fudge factors and other clock performance -information.</DD> - -<DT> -<TT>kerninfo</TT></DT> - -<DD> -Obtain and print kernel phase-lock loop operating parameters. This information -is available only if the kernel has been specially modified for a precision -timekeeping function.</DD> - -<DT> -<TT>loopinfo [ oneline | multiline ]</TT></DT> - -<DD> -Print the values of selected loop filter variables. The loop filter is -the part of NTP which deals with adjusting the local system clock. The -<TT>offset</TT> is the last offset given to the loop filter by the packet -processing code. The <TT>frequency</TT> is the frequency error of the local -clock in parts-per-million (ppm). The <TT>time_const</TT> controls the -stiffness of the phase-lock loop and thus the speed at which it can adapt -to oscillator drift. The <TT>watchdog timer</TT> value is the number of -seconds which have elapsed since the last sample offset was given to the -loop filter. The <TT>oneline</TT> and <TT>multiline</TT> options specify -the format in which this information is to be printed, with <TT>multiline</TT> -as the default.</DD> - -<DT> -<TT>sysinfo</TT></DT> - -<DD> -Print a variety of system state variables, i.e., state related to the local -server. All except the last four lines are described in the NTP Version -3 specification, RFC-1305.</DD> - -<DL> -<DD> -The <TT>system flags</TT> show various system flags, some of which can -be set and cleared by the <TT>enable</TT> and <TT>disable</TT> configuration -commands, respectively. These are the <TT>auth</TT>, <TT>bclient</TT>, -<TT>monitor</TT>, <TT>pll</TT>, <TT>pps</TT> and <TT>stats</TT> flags. -See the <TT>ntpd</TT> documentation for the meaning of these flags. There -are two additional flags which are read only, the <TT>kernel_pll</TT> and -<TT>kernel_pps</TT>. These flags indicate the synchronization status when -the precision time kernel modifications are in use. The <TT>kernel_pll</TT> -indicates that the local clock is being disciplined by the kernel, while -the kernel_pps indicates the kernel discipline is provided by the PPS signal.</DD> - -<DD> -The <TT>stability</TT> is the residual frequency error remaining after -the system frequency correction is applied and is intended for maintenance -and debugging. In most architectures, this value will initially decrease -from as high as 500 ppm to a nominal value in the range .01 to 0.1 ppm. -If it remains high for some time after starting the daemon, something may -be wrong with the local clock, or the value of the kernel variable <TT>tick</TT> -may be incorrect.</DD> - -<DD> -The <TT>broadcastdelay</TT> shows the default broadcast delay, as set by -the <TT>broadcastdelay</TT> configuration command.</DD> - -<DD> -The <TT>authdelay</TT> shows the default authentication delay, as set by -the <TT>authdelay</TT> configuration command.</DD> -</DL> - -<DT> -<TT>sysstats</TT></DT> - -<DD> -Print statistics counters maintained in the protocol module.</DD> - -<DT> -<TT>memstats</TT></DT> - -<DD> -Print statistics counters related to memory allocation code.</DD> - -<DT> -<TT>iostats</TT></DT> - -<DD> -Print statistics counters maintained in the input-output module.</DD> - -<DT> -<TT>timerstats</TT></DT> - -<DD> -Print statistics counters maintained in the timer/event queue support code.</DD> - -<DT> -<TT>reslist</TT></DT> - -<DD> -Obtain and print the server's restriction list. This list is (usually) -printed in sorted order and may help to understand how the restrictions -are applied.</DD> - -<DT> -<TT>monlist [ <I>version</I> ]</TT></DT> - -<DD> -Obtain and print traffic counts collected and maintained by the monitor -facility. The version number should not normally need to be specified.</DD> - -<DT> -<TT>clkbug <I>clock_peer_address</I> [...]</TT></DT> - -<DD> -Obtain debugging information for a reference clock driver. This information -is provided only by some clock drivers and is mostly undecodable without -a copy of the driver source in hand.</DD> -</DL> - -<H4> -Runtime Configuration Requests</H4> -All requests which cause state changes in the server are authenticated -by the server using a configured NTP key (the facility can also be disabled -by the server by not configuring a key). The key number and the corresponding -key must also be made known to xtnpdc. This can be done using the keyid -and passwd commands, the latter of which will prompt at the terminal for -a password to use as the encryption key. You will also be prompted automatically -for both the key number and password the first time a command which would -result in an authenticated request to the server is given. Authentication -not only provides verification that the requester has permission to make -such changes, but also gives an extra degree of protection again transmission -errors. - -<P>Authenticated requests always include a timestamp in the packet data, -which is included in the computation of the authentication code. This timestamp -is compared by the server to its receive time stamp. If they differ by -more than a small amount the request is rejected. This is done for two -reasons. First, it makes simple replay attacks on the server, by someone -who might be able to overhear traffic on your LAN, much more difficult. -Second, it makes it more difficult to request configuration changes to -your server from topologically remote hosts. While the reconfiguration -facility will work well with a server on the local host, and may work adequately -between time-synchronized hosts on the same LAN, it will work very poorly -for more distant hosts. As such, if reasonable passwords are chosen, care -is taken in the distribution and protection of keys and appropriate source -address restrictions are applied, the run time reconfiguration facility -should provide an adequate level of security. - -<P>The following commands all make authenticated requests. -<DL> -<DT> -<TT>addpeer <I>peer_address</I> [ <I>keyid</I> ] [ <I>version</I> ] [ <I>prefer</I> -]</TT></DT> - -<DD> -Add a configured peer association at the given address and operating in -symmetric active mode. Note that an existing association with the same -peer may be deleted when this command is executed, or may simply be converted -to conform to the new configuration, as appropriate. If the optional <TT>keyid</TT> -is a nonzero integer, all outgoing packets to the remote server will have -an authentication field attached encrypted with this key. If the value -is 0 (or not given) no authentication will be done. The <TT>version#</TT> -can be 1, 2 or 3 and defaults to 3. The <TT>prefer</TT> keyword indicates -a preferred peer (and thus will be used primarily for clock synchronisation -if possible). The preferred peer also determines the validity of the PPS -signal - if the preferred peer is suitable for synchronisation so is the -PPS signal.</DD> - -<DT> -<TT>addserver <I>peer_address</I> [ <I>keyid</I> ] [ <I>version</I> ] [ -<I>prefer</I> ]</TT></DT> - -<DD> -Identical to the addpeer command, except that the operating mode is client.</DD> - -<DT> -<TT>broadcast <I>peer_address</I> [ <I>keyid</I> ] [ <I>version</I> ] [ -<I>prefer</I> ]</TT></DT> - -<DD> -Identical to the addpeer command, except that the operating mode is broadcast. -In this case a valid key identifier and key are required. The <TT>peer_address</TT> -parameter can be the broadcast address of the local network or a multicast -group address assigned to NTP. If a multicast address, a multicast-capable -kernel is required.</DD> - -<DT> -<TT>unconfig <I>peer_address</I> [...]</TT></DT> - -<DD> -This command causes the configured bit to be removed from the specified -peer(s). In many cases this will cause the peer association to be deleted. -When appropriate, however, the association may persist in an unconfigured -mode if the remote peer is willing to continue on in this fashion.</DD> - -<DT> -<TT>fudge <I>peer_address</I> [ <I>time1</I> ] [ <I>time2</I> ] [ <I>stratum</I> -] [ <I>refid</I> ]</TT></DT> - -<DD> -This command provides a way to set certain data for a reference clock. -See the source listing for further information.</DD> - -<DT> -<TT>enable [ <I>flag</I> ] [ ... ]</TT></DT> - -<BR><TT>disable [ <I>flag</I> ] [ ... ]</TT> -<DD> -These commands operate in the same way as the <TT>enable</TT> and <TT>disable</TT> -configuration file commands of <TT>ntpd</TT>. Following is a description -of the flags. Note that only the <TT>auth</TT>, <TT>bclient</TT>, <TT>monitor</TT>, -<TT>pll</TT>, <TT>pps</TT> and <TT>stats</TT> flags can be set by <TT>ntpdc</TT>; -the <TT>pll_kernel</TT> and <TT>pps_kernel</TT> flags are read-only.</DD> - -<DL> -<DT> -<TT>auth</TT></DT> - -<DD> -Enables the server to synchronize with unconfigured peers only if the peer -has been correctly authenticated using a trusted key and key identifier. -The default for this flag is enable.</DD> - -<DT> -<TT>bclient</TT></DT> - -<DD> -Enables the server to listen for a message from a broadcast or multicast -server, as in the <TT>multicastclient</TT> command with default address. -The default for this flag is disable.</DD> - -<DT> -<TT>monitor</TT></DT> - -<DD> -Enables the monitoring facility. See the <TT>ntpdc</TT> program and the -<TT>monlist</TT> command or further information. The default for this flag -is enable.</DD> - -<DT> -<TT>pll</TT></DT> - -<DD> -Enables the server to adjust its local clock by means of NTP. If disabled, -the local clock free-runs at its intrinsic time and frequency offset. This -flag is useful in case the local clock is controlled by some other device -or protocol and NTP is used only to provide synchronization to other clients. -In this case, the local clock driver is used. See the <A HREF="refclock.htm">Reference -Clock Drivers </A>page for further information. The default for this flag -is enable.</DD> - -<DT> -<TT>pps</TT></DT> - -<DD> -Enables the pulse-per-second (PPS) signal when frequency and time is disciplined -by the precision time kernel modifications. See the <A HREF="kern.htm">A -Kernel Model for Precision Timekeeping </A>page for further information. -The default for this flag is disable.</DD> - -<DT> -<TT>stats</TT></DT> - -<DD> -Enables the statistics facility. See the <A HREF="monopt.htm">Monitoring -Options </A>page for further information. The default for this flag is -enable.</DD> - -<DT> -<TT>pll_kernel</TT></DT> - -<DD> -When the precision time kernel modifications are installed, this indicates -the kernel controls the clock discipline; otherwise, the daemon controls -the clock discipline.</DD> - -<DT> -<TT>pps_kernel</TT></DT> - -<DD> -When the precision time kernel modifications are installed and a pulse-per-second -(PPS) signal is available, this indicates the PPS signal controls the clock -discipline; otherwise, the daemon or kernel controls the clock discipline, -as indicated by the <TT>pll_kernel</TT> flag.</DD> -</DL> - -<DT> -<TT>restrict <I>address mask flag</I> [ <I>flag</I> ]</TT></DT> - -<DD> -This command operates in the same way as the <TT>restrict</TT> configuration -file commands of <TT>ntpd</TT>.</DD> - -<DT> -<TT>unrestrict <I>address mask flag</I> [ <I>flag</I> ]</TT></DT> - -<DD> -Unrestrict the matching entry from the restrict list.</DD> - -<DT> -<TT>delrestrict <I>address mask [ ntpport ]</I></TT></DT> - -<DD> -Delete the matching entry from the restrict list.</DD> - -<DT> -<TT>readkeys</TT></DT> - -<DD> -Causes the current set of authentication keys to be purged and a new set -to be obtained by rereading the keys file (which must have been specified -in the <TT>ntpd</TT> configuration file). This allows encryption keys to -be changed without restarting the server.</DD> - -<DT> -<TT>trustkey <I>keyid</I> [...]</TT></DT> - -<DT> -<TT>untrustkey <I>keyid</I> [...]</TT></DT> - -<DD> -These commands operate in the same way as the <TT>trustedkey</TT> and <TT>untrustkey</TT> -configuration file commands of <TT>ntpd</TT>.</DD> - -<DT> -<TT>authinfo</TT></DT> - -<DD> -Returns information concerning the authentication module, including known -keys and counts of encryptions and decryptions which have been done.</DD> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntpdc - special NTP query program</title> +</head> +<body> +<h3><tt>ntpdc</tt> - special NTP query program</h3> + +<img align="left" src="pic/alice31.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>This program is a big puppy.<br clear="left"> +</p> + +<hr> +<h4>Synopsis</h4> + +<tt>ntpdc [ -ilnps ] [ -c <i>command</i> ] [ <i>host</i> ] [ ... +]</tt> + +<h4>Description</h4> + +<tt>ntpdc</tt> is used to query the <tt>ntpd</tt> daemon about its +current state and to request changes in that state. The program may +be run either in interactive mode or controlled using command line +arguments. Extensive state and statistics information is available +through the <tt>ntpdc</tt> interface. In addition, nearly all the +configuration options which can be specified at startup using +ntpd's configuration file may also be specified at run time using +<tt>ntpdc</tt>. + +<p>If one or more request options are included on the command line +when <tt>ntpdc</tt> is executed, each of the requests will be sent +to the NTP servers running on each of the hosts given as command +line arguments, or on localhost by default. If no request options +are given, <tt>ntpdc</tt> will attempt to read commands from the +standard input and execute these on the NTP server running on the +first host given on the command line, again defaulting to localhost +when no other host is specified. <tt>ntpdc</tt> will prompt for +commands if the standard input is a terminal device.</p> + +<p><tt>ntpdc</tt> uses NTP mode 7 packets to communicate with the +NTP server, and hence can be used to query any compatable server on +the network which permits it. Note that since NTP is a UDP protocol +this communication will be somewhat unreliable, especially over +large distances in terms of network topology. <tt>ntpdc</tt> makes +no attempt to retransmit requests, and will time requests out if +the remote host is not heard from within a suitable timeout +time.</p> + +<p>The operation of <tt>ntpdc</tt> are specific to the particular +implementation of the <tt>ntpd</tt> daemon and can be expected to +work only with this and maybe some previous versions of the daemon. +Requests from a remote <tt>ntpdc</tt> program which affect the +state of the local server must be authenticated, which requires +both the remote program and local server share a common key and key +identifier.</p> + +<h4>Command Line Options</h4> + +Specifying a command line option other than <tt>-i</tt> or <tt> +-n</tt> will cause the specified query (queries) to be sent to the +indicated host(s) immediately. Otherwise, <tt>ntpdc</tt> will +attempt to read interactive format commands from the standard +input. + +<dl> +<dt><tt>-c <i>command</i></tt></dt> -<DT> -<TT>traps</TT></DT> - -<DD> -Display the traps set in the server. See the source listing for further -information.</DD> - -<DT> -<TT>addtrap [ <I>address</I> [ <I>port</I> ] [ <I>interface</I> ]</TT></DT> - -<DD> -Set a trap for asynchronous messages. See the source listing for further -information.</DD> - -<DT> -<TT>clrtrap [ <I>address</I> [ <I>port</I> ] [ <I>interface</I>]</TT></DT> +<dd>The following argument is interpreted as an interactive format +command and is added to the list of commands to be executed on the +specified host(s). Multiple -c options may be given.</dd> + +<dt><tt>-i</tt></dt> + +<dd>Force <tt>ntpdc</tt> to operate in interactive mode. Prompts +will be written to the standard output and commands read from the +standard input.</dd> + +<dt><tt>-l</tt></dt> + +<dd>Obtain a list of peers which are known to the server(s). This +switch is equivalent to <tt>-c listpeers</tt>.</dd> + +<dt><tt>-n</tt></dt> + +<dd>Output all host addresses in dotted-quad numeric format rather +than converting to the canonical host names.</dd> + +<dt><tt>-p</tt></dt> + +<dd>Print a list of the peers known to the server as well as a +summary of their state. This is equivalent to <tt>-c +peers</tt>.</dd> + +<dt><tt>-s</tt></dt> + +<dd>Print a list of the peers known to the server as well as a +summary of their state, but in a slightly different format than the +-p switch. This is equivalent to <tt>-c dmpeers</tt>.</dd> +</dl> + +<h4>Interactive Commands</h4> + +Interactive format commands consist of a keyword followed by zero +to four arguments. Only enough characters of the full keyword to +uniquely identify the command need be typed. The output of a +command is normally sent to the standard output, but optionally the +output of individual commands may be sent to a file by appending a +<tt><</tt>, followed by a file name, to the command line. + +<p>A number of interactive format commands are executed entirely +within the <tt>ntpdc</tt> program itself and do not result in NTP +mode 7 requests being sent to a server. These are described +following.</p> + +<dl> +<dt><tt>? [ <i>command_keyword</i> ]</tt><br> +<tt>help [ <i>command_keyword</i> ]</tt></dt> + +<dd>A <tt>?</tt> by itself will print a list of all the command +keywords known to this incarnation of <tt>ntpq</tt>. A <tt>?</tt> +followed by a command keyword will print funcation and usage +information about the command. This command is probably a better +source of information about <tt>ntpq</tt> than this manual +page.</dd> + +<dt><tt>delay <i>milliseconds</i></tt></dt> + +<dd>Specify a time interval to be added to timestamps included in +requests which require authentication. This is used to enable +(unreliable) server reconfiguration over long delay network paths +or between machines whose clocks are unsynchronized. Actually the +server does not now require timestamps in authenticated requests, +so this command may be obsolete.</dd> + +<dt><tt>host <i>hostname</i></tt></dt> + +<dd>Set the host to which future queries will be sent. Hostname may +be either a host name or a numeric address.</dd> -<DD> -Clear a trap for asynchronous messages. See the source listing for further -information.</DD> +<dt><tt>hostnames [ yes | no ]</tt></dt> -<DT> -<TT>reset</TT></DT> +<dd>If <tt>yes</tt> is specified, host names are printed in +information displays. If <tt>no</tt> is specified, numeric +addresses are printed instead. The default is <tt>yes</tt>, unless +modified using the command line <tt>-n</tt> switch.</dd> -<DD> -Clear the statistics counters in various modules of the server. See the -source listing for further information.</DD> -</DL> +<dt><tt>keyid <i>keyid</i></tt></dt> -<H4> -Bugs</H4> -<TT>ntpdc</TT> is a crude hack. Much of the information it shows is deadly -boring and could only be loved by its implementer. The program was designed -so that new (and temporary) features were easy to hack in, at great expense -to the program's ease of use. Despite this, the program is occasionally -useful. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> +<dd>This command allows the specification of a key number to be +used to authenticate configuration requests. This must correspond +to a key number the server has been configured to use for this +purpose.</dd> + +<dt><tt>quit</tt></dt> + +<dd>Exit <tt>ntpdc</tt>.</dd> + +<dt><tt>passwd</tt></dt> + +<dd>This command prompts you to type in a password (which will not +be echoed) which will be used to authenticate configuration +requests. The password must correspond to the key configured for +use by the NTP server for this purpose if such requests are to be +successful.</dd> + +<dt><tt>timeout <i>millseconds</i></tt></dt> + +<dd>Specify a timeout period for responses to server queries. The +default is about 8000 milliseconds. Note that since <tt>ntpdc</tt> +retries each query once after a timeout, the total waiting time for +a timeout will be twice the timeout value set.</dd> +</dl> + +<h4>Control Message Commands</h4> + +Query commands result in NTP mode 7 packets containing requests for +information being sent to the server. These are read-only commands +in that they make no modification of the server configuration +state. + +<dl> +<dt><tt>listpeers</tt></dt> + +<dd>Obtains and prints a brief list of the peers for which the +server is maintaining state. These should include all configured +peer associations as well as those peers whose stratum is such that +they are considered by the server to be possible future +synchonization candidates.</dd> + +<dt><tt>peers</tt></dt> + +<dd>Obtains a list of peers for which the server is maintaining +state, along with a summary of that state. Summary information +includes the address of the remote peer, the local interface +address (0.0.0.0 if a local address has yet to be determined), the +stratum of the remote peer (a stratum of 16 indicates the remote +peer is unsynchronized), the polling interval, in seconds, the +reachability register, in octal, and the current estimated delay, +offset and dispersion of the peer, all in seconds. + +<p>The character in the left margin indicates the mode this peer +entry is operating in. A <tt>+</tt> denotes symmetric active, a +<tt>-</tt> indicates symmetric passive, a <tt>=</tt> means the +remote server is being polled in client mode, a <tt>^</tt> +indicates that the server is broadcasting to this address, a <tt> +~</tt> denotes that the remote peer is sending broadcasts and a +<tt>*</tt> marks the peer the server is currently synchonizing +to.</p> + +<p>The contents of the host field may be one of four forms. It may +be a host name, an IP address, a reference clock implementation +name with its parameter or <tt>REFCLK(<i>implementation number</i>, +<i>parameter</i>)</tt>. On <tt>hostnames no</tt> only IP-addresses +will be displayed.</p> +</dd> + +<dt><tt>dmpeers</tt></dt> + +<dd>A slightly different peer summary list. Identical to the output +of the <tt>peers</tt> command, except for the character in the +leftmost column. Characters only appear beside peers which were +included in the final stage of the clock selection algorithm. A +<tt>.</tt> indicates that this peer was cast off in the falseticker +detection, while a <tt>+</tt> indicates that the peer made it +through. A <tt>*</tt> denotes the peer the server is currently +synchronizing with.</dd> + +<dt><tt>showpeer <i>peer_address</i> [...]</tt></dt> + +<dd>Shows a detailed display of the current peer variables for one +or more peers. Most of these values are described in the NTP +Version 2 specification.</dd> + +<dt><tt>pstats <i>peer_address</i> [...]</tt></dt> + +<dd>Show per-peer statistic counters associated with the specified +peer(s).</dd> + +<dt><tt>clockinfo <i>clock_peer_address</i> [...]</tt></dt> + +<dd>Obtain and print information concerning a peer clock. The +values obtained provide information on the setting of fudge factors +and other clock performance information.</dd> + +<dt><tt>kerninfo</tt></dt> + +<dd>Obtain and print kernel phase-lock loop operating parameters. +This information is available only if the kernel has been specially +modified for a precision timekeeping function.</dd> + +<dt><tt>loopinfo [ oneline | multiline ]</tt></dt> + +<dd>Print the values of selected loop filter variables. The loop +filter is the part of NTP which deals with adjusting the local +system clock. The <tt>offset</tt> is the last offset given to the +loop filter by the packet processing code. The <tt>frequency</tt> +is the frequency error of the local clock in parts-per-million +(ppm). The <tt>time_const</tt> controls the stiffness of the +phase-lock loop and thus the speed at which it can adapt to +oscillator drift. The <tt>watchdog timer</tt> value is the number +of seconds which have elapsed since the last sample offset was +given to the loop filter. The <tt>oneline</tt> and <tt> +multiline</tt> options specify the format in which this information +is to be printed, with <tt>multiline</tt> as the default.</dd> + +<dt><tt>sysinfo</tt></dt> + +<dd>Print a variety of system state variables, i.e., state related +to the local server. All except the last four lines are described +in the NTP Version 3 specification, RFC-1305. + +<p>The <tt>system flags</tt> show various system flags, some of +which can be set and cleared by the <tt>enable</tt> and <tt> +disable</tt> configuration commands, respectively. These are the +<tt>auth</tt>, <tt>bclient</tt>, <tt>monitor</tt>, <tt>pll</tt>, +<tt>pps</tt> and <tt>stats</tt> flags. See the <tt>ntpd</tt> +documentation for the meaning of these flags. There are two +additional flags which are read only, the <tt>kernel_pll</tt> and +<tt>kernel_pps</tt>. These flags indicate the synchronization +status when the precision time kernel modifications are in use. The +<tt>kernel_pll</tt> indicates that the local clock is being +disciplined by the kernel, while the kernel_pps indicates the +kernel discipline is provided by the PPS signal.</p> + +<p>The <tt>stability</tt> is the residual frequency error remaining +afterthe system frequency correction is applied and is intended for +maintenance and debugging. In most architectures, this value will +initially decrease from as high as 500 ppm to a nominal value in +the range .01 to 0.1 ppm. If it remains high for some time after +starting the daemon, something may be wrong with the local clock, +or the value of the kernel variable <tt>tick</tt> may be +incorrect.</p> + +<p>The <tt>broadcastdelay</tt> shows the default broadcast delay, +as set by the <tt>broadcastdelay</tt> configuration command.</p> + +<p>The <tt>authdelay</tt> shows the default authentication delay, +as set by the <tt>authdelay</tt> configuration command.</p> +</dd> + +<dt><tt>sysstats</tt></dt> + +<dd>Print statistics counters maintained in the protocol +module.</dd> + +<dt><tt>memstats</tt></dt> + +<dd>Print statistics counters related to memory allocation +code.</dd> + +<dt><tt>iostats</tt></dt> + +<dd>Print statistics counters maintained in the input-output +module.</dd> + +<dt><tt>timerstats</tt></dt> + +<dd>Print statistics counters maintained in the timer/event queue +support code.</dd> + +<dt><tt>reslist</tt></dt> + +<dd>Obtain and print the server's restriction list. This list is +(usually) printed in sorted order and may help to understand how +the restrictions are applied.</dd> + +<dt><tt>monlist [ <i>version</i> ]</tt></dt> + +<dd>Obtain and print traffic counts collected and maintained by the +monitor facility. The version number should not normally need to be +specified.</dd> + +<dt><tt>clkbug <i>clock_peer_address</i> [...]</tt></dt> + +<dd>Obtain debugging information for a reference clock driver. This +information is provided only by some clock drivers and is mostly +undecodable without a copy of the driver source in hand.</dd> +</dl> + +<h4>Runtime Configuration Requests</h4> + +All requests which cause state changes in the server are +authenticated by the server using a configured NTP key (the +facility can also be disabled by the server by not configuring a +key). The key number and the corresponding key must also be made +known to xtnpdc. This can be done using the keyid and passwd +commands, the latter of which will prompt at the terminal for a +password to use as the encryption key. You will also be prompted +automatically for both the key number and password the first time a +command which would result in an authenticated request to the +server is given. Authentication not only provides verification that +the requester has permission to make such changes, but also gives +an extra degree of protection again transmission errors. + +<p>Authenticated requests always include a timestamp in the packet +data, which is included in the computation of the authentication +code. This timestamp is compared by the server to its receive time +stamp. If they differ by more than a small amount the request is +rejected. This is done for two reasons. First, it makes simple +replay attacks on the server, by someone who might be able to +overhear traffic on your LAN, much more difficult. Second, it makes +it more difficult to request configuration changes to your server +from topologically remote hosts. While the reconfiguration facility +will work well with a server on the local host, and may work +adequately between time-synchronized hosts on the same LAN, it will +work very poorly for more distant hosts. As such, if reasonable +passwords are chosen, care is taken in the distribution and +protection of keys and appropriate source address restrictions are +applied, the run time reconfiguration facility should provide an +adequate level of security.</p> + +<p>The following commands all make authenticated requests.</p> + +<dl> +<dt><tt>addpeer <i>peer_address</i> [ <i>keyid</i> ] [ <i> +version</i> ] [ <i>prefer</i> ]</tt></dt> + +<dd>Add a configured peer association at the given address and +operating in symmetric active mode. Note that an existing +association with the same peer may be deleted when this command is +executed, or may simply be converted to conform to the new +configuration, as appropriate. If the optional <tt>keyid</tt> is a +nonzero integer, all outgoing packets to the remote server will +have an authentication field attached encrypted with this key. If +the value is 0 (or not given) no authentication will be done. The +<tt>version#</tt> can be 1, 2 or 3 and defaults to 3. The <tt> +prefer</tt> keyword indicates a preferred peer (and thus will be +used primarily for clock synchronisation if possible). The +preferred peer also determines the validity of the PPS signal - if +the preferred peer is suitable for synchronisation so is the PPS +signal.</dd> + +<dt><tt>addserver <i>peer_address</i> [ <i>keyid</i> ] [ <i> +version</i> ] [ <i>prefer</i> ]</tt></dt> + +<dd>Identical to the addpeer command, except that the operating +mode is client.</dd> + +<dt><tt>broadcast <i>peer_address</i> [ <i>keyid</i> ] [ <i> +version</i> ] [ <i>prefer</i> ]</tt></dt> + +<dd>Identical to the addpeer command, except that the operating +mode is broadcast. In this case a valid key identifier and key are +required. The <tt>peer_address</tt> parameter can be the broadcast +address of the local network or a multicast group address assigned +to NTP. If a multicast address, a multicast-capable kernel is +required.</dd> + +<dt><tt>unconfig <i>peer_address</i> [...]</tt></dt> + +<dd>This command causes the configured bit to be removed from the +specified peer(s). In many cases this will cause the peer +association to be deleted. When appropriate, however, the +association may persist in an unconfigured mode if the remote peer +is willing to continue on in this fashion.</dd> + +<dt><tt>fudge <i>peer_address</i> [ <i>time1</i> ] [ <i>time2</i> ] +[ <i>stratum</i> ] [ <i>refid</i> ]</tt></dt> + +<dd>This command provides a way to set certain data for a reference +clock. See the source listing for further information.</dd> + +<dt><tt>enable [ <i>flag</i> ] [ ... ]</tt><br> +<tt>disable [ <i>flag</i> ] [ ... ]</tt></dt> + +<dd>These commands operate in the same way as the <tt>enable</tt> +and <tt>disable</tt> configuration file commands of <tt>ntpd</tt>. +Following is a description of the flags. Note that only the <tt> +auth</tt>, <tt>bclient</tt>, <tt>monitor</tt>, <tt>pll</tt>, <tt> +pps</tt> and <tt>stats</tt> flags can be set by <tt>ntpdc</tt>; the +<tt>pll_kernel</tt> and <tt>pps_kernel</tt> flags are +read-only.</dd> + +<dd> +<dl> +<dt><tt>auth</tt></dt> + +<dd>Enables the server to synchronize with unconfigured peers only +if the peer has been correctly authenticated using a trusted key +and key identifier. The default for this flag is enable.</dd> + +<dt><tt>bclient</tt></dt> + +<dd>Enables the server to listen for a message from a broadcast or +multicast server, as in the <tt>multicastclient</tt> command with +default address. The default for this flag is disable.</dd> + +<dt><tt>monitor</tt></dt> + +<dd>Enables the monitoring facility. See the <tt>ntpdc</tt> program +and the <tt>monlist</tt> command or further information. The +default for this flag is enable.</dd> + +<dt><tt>pll</tt></dt> + +<dd>Enables the server to adjust its local clock by means of NTP. +If disabled, the local clock free-runs at its intrinsic time and +frequency offset. This flag is useful in case the local clock is +controlled by some other device or protocol and NTP is used only to +provide synchronization to other clients. In this case, the local +clock driver is used. See the <a href="refclock.htm">Reference +Clock Drivers</a> page for further information. The default for +this flag is enable.</dd> + +<dt><tt>pps</tt></dt> + +<dd>Enables the pulse-per-second (PPS) signal when frequency and +time is disciplined by the precision time kernel modifications. See +the <a href="kern.htm">A Kernel Model for Precision Timekeeping</a> +page for further information. The default for this flag is +disable.</dd> + +<dt><tt>stats</tt></dt> + +<dd>Enables the statistics facility. See the <a href="monopt.htm"> +Monitoring Options</a> page for further information. The default +for this flag is enable.</dd> + +<dt><tt>pll_kernel</tt></dt> + +<dd>When the precision time kernel modifications are installed, +this indicates the kernel controls the clock discipline; otherwise, +the daemon controls the clock discipline.</dd> + +<dt><tt>pps_kernel</tt></dt> + +<dd>When the precision time kernel modifications are installed and +a pulse-per-second (PPS) signal is available, this indicates the +PPS signal controls the clock discipline; otherwise, the daemon or +kernel controls the clock discipline, as indicated by the <tt> +pll_kernel</tt> flag.</dd> +</dl> +</dd> + +<dt><tt>restrict <i>address mask flag</i> [ <i>flag</i> ]</tt></dt> + +<dd>This command operates in the same way as the <tt>restrict</tt> +configuration file commands of <tt>ntpd</tt>.</dd> + +<dt><tt>unrestrict <i>address mask flag</i> [ <i>flag</i> +]</tt></dt> + +<dd>Unrestrict the matching entry from the restrict list.</dd> + +<dt><tt>delrestrict <i>address mask [ ntpport ]</i></tt></dt> + +<dd>Delete the matching entry from the restrict list.</dd> + +<dt><tt>readkeys</tt></dt> + +<dd>Causes the current set of authentication keys to be purged and +a new set to be obtained by rereading the keys file (which must +have been specified in the <tt>ntpd</tt> configuration file). This +allows encryption keys to be changed without restarting the +server.</dd> + +<dt><tt>trustedkey <i>keyid</i> [...]</tt></dt> + +<dt><tt>untrustedkey <i>keyid</i> [...]</tt></dt> + +<dd>These commands operate in the same way as the <tt> +trustedkey</tt> and <tt>untrustedkey</tt> configuration file +commands of <tt>ntpd</tt>.</dd> + +<dt><tt>authinfo</tt></dt> + +<dd>Returns information concerning the authentication module, +including known keys and counts of encryptions and decryptions +which have been done.</dd> + +<dt><tt>traps</tt></dt> + +<dd>Display the traps set in the server. See the source listing for +further information.</dd> + +<dt><tt>addtrap [ <i>address</i> [ <i>port</i> ] [ <i>interface</i> +]</tt></dt> + +<dd>Set a trap for asynchronous messages. See the source listing +for further information.</dd> + +<dt><tt>clrtrap [ <i>address</i> [ <i>port</i> ] [ <i> +interface</i>]</tt></dt> + +<dd>Clear a trap for asynchronous messages. See the source listing +for further information.</dd> + +<dt><tt>reset</tt></dt> + +<dd>Clear the statistics counters in various modules of the server. +See the source listing for further information.</dd> +</dl> + +<h4>Bugs</h4> + +<tt>ntpdc</tt> is a crude hack. Much of the information it shows is +deadly boring and could only be loved by its implementer. The +program was designed so that new (and temporary) features were easy +to hack in, at great expense to the program's ease of use. Despite +this, the program is occasionally useful. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -</BODY> -</HTML> diff --git a/contrib/ntp/html/ntpq.htm b/contrib/ntp/html/ntpq.htm index 9308867..908eb5e 100644 --- a/contrib/ntp/html/ntpq.htm +++ b/contrib/ntp/html/ntpq.htm @@ -1,747 +1,658 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>ntpq - standard NTP query program -</TITLE> -</HEAD> -<BODY> - -<H3> -<TT>pq</TT> - standard NTP query program</H3> - -<HR> -<H4> -Synopsis</H4> -<TT>ntpq [-inp] [-c <I>command</I>] [<I>host</I>] [...]</TT> -<H4> -Description</H4> -<TT>ntpq</TT> is used to query NTP servers which implement the recommended -NTP mode 6 control message format about current state and to request changes -in that state. The program may be run either in interactive mode or controlled -using command line arguments. Requests to read and write arbitrary variables -can be assembled, with raw and pretty-printed output options being available. -<TT>ntpq</TT> can also obtain and print a list of peers in a common format -by sending multiple queries to the server. - -<P>If one or more request options is included on the command line when -<TT>ntpq</TT> is executed, each of the requests will be sent to the NTP -servers running on each of the hosts given as command line arguments, or -on localhost by default. If no request options are given, <TT>ntpq</TT> -will attempt to read commands from the standard input and execute these -on the NTP server running on the first host given on the command line, -again defaulting to localhost when no other host is specified. <TT>ntpq</TT> -will prompt for commands if the standard input is a terminal device. - -<P><TT>ntpq</TT> uses NTP mode 6 packets to communicate with the NTP server, -and hence can be used to query any compatable server on the network which -permits it. Note that since NTP is a UDP protocol this communication will -be somewhat unreliable, especially over large distances in terms of network -topology. <TT>ntpq</TT> makes one attempt to retransmit requests, and will -time requests out if the remote host is not heard from within a suitable -timeout time. - -<P>Command line options are described following. Specifying a command line -option other than -i or -n will cause the specified query (queries) to -be sent to the indicated host(s) immediately. Otherwise, <TT>ntpq</TT> -will attempt to read interactive format commands from the standard input. -<DL> -<DT> -<TT>-c</TT></DT> - -<DD> -The following argument is interpreted as an interactive format command -and is added to the list of commands to be executed on the specified host(s). -Multiple -c options may be given.</DD> - -<DT> -<TT>-i</TT></DT> - -<DD> -Force <TT>ntpq</TT> to operate in interactive mode. Prompts will be written -to the standard output and commands read from the standard input.</DD> - -<DT> -<TT>-n</TT></DT> - -<DD> -Output all host addresses in dotted-quad numeric format rather than converting -to the canonical host names.</DD> - -<DT> -<TT>-p</TT></DT> - -<DD> -Print a list of the peers known to the server as well as a summary of their -state. This is equivalent to the <TT>peers</TT> interactive command.</DD> -</DL> - -<H4> -Internal Commands</H4> -Interactive format commands consist of a keyword followed by zero to four -arguments. Only enough characters of the full keyword to uniquely identify -the command need be typed. The output of a command is normally sent to -the standard output, but optionally the output of individual commands may -be sent to a file by appending a "<", followed by a file name, to the -command line. A number of interactive format commands are executed entirely -within the <TT>ntpq</TT> program itself and do not result in NTP mode 6 -requests being sent to a server. These are described following. -<DL> -<DT> -<TT>? [<I>command_keyword</I>]</TT></DT> - -<BR><TT>helpl [ <I>command_keyword</I> ]</TT> -<DD> -A <TT>"?"</TT> by itself will print a list of all the command keywords -known to this incarnation of <TT>ntpq</TT>. A <TT>"?"</TT> followed by -a command keyword will print funcation and usage information about the -command. This command is probably a better source of information about -<TT>ntpq</TT> than this manual page.</DD> - -<DD> - </DD> - -<DT> -<TT>addvars <I>variable_name</I> [ = <I>value</I>] [...]</TT></DT> - -<BR><TT>rmvars <I>variable_name</I> [...]</TT> -<BR><TT>clearvars</TT> -<DD> -The data carried by NTP mode 6 messages consists of a list of items of -the form <TT><I>variable_name</I> = <I>value</I></TT>, where the <TT>" -= <I>value</I>"</TT> is ignored, and can be omitted, in requests to the -server to read variables. <TT>ntpq</TT> maintains an internal list in which -data to be included in control messages can be assembled, and sent using -the readlist and writelist commands described below. The addvars command -allows variables and their optional values to be added to the list. If -more than one variable is to be added, the list should be comma-separated -and not contain white space. The rmvars command can be used to remove individual -variables from the list, while the clearlist command removes all variables -from the list.</DD> - -<DD> - </DD> - -<DT> -<TT>authenticate yes | no</TT></DT> - -<DD> -Normally <TT>ntpq</TT> does not authenticate requests unless they are write -requests. The command authenticate yes causes <TT>ntpq</TT> to send authentication -with all requests it makes. Authenticated requests causes some servers -to handle requests slightly differently, and can occasionally melt the -CPU in fuzzballs if you turn authentication on before doing a peer display.</DD> - -<DD> - </DD> - -<DT> -<TT>cooked</TT></DT> - -<DD> -Causes output from query commands to be <TT>"cooked"</TT>. Variables which -are recognized by the server will have their values reformatted for human -consumption. Variables which <TT>ntpq</TT> thinks should have a decodeable -value but didn't are marked with a trailing <TT>"?"</TT>.</DD> - -<DD> - </DD> - -<DT> -<TT>debug more | less | off</TT></DT> - -<DD> -Turns internal query program debugging on and off.</DD> - -<DD> - </DD> - -<DT> -<TT>delay <I>milliseconds</I></TT></DT> - -<DD> -Specify a time interval to be added to timestamps included in requests -which require authentication. This is used to enable (unreliable) server -reconfiguration over long delay network paths or between machines whose -clocks are unsynchronized. Actually the server does not now require timestamps -in authenticated requests, so this command may be obsolete.</DD> - -<DD> - </DD> - -<DT> -<TT>host <I>hostname</I></TT></DT> - -<DD> -Set the host to which future queries will be sent. Hostname may be either -a host name or a numeric address.</DD> - -<DD> - </DD> - -<DT> -<TT>hostnames [yes | no]</TT></DT> - -<DD> -If <TT>"yes"</TT> is specified, host names are printed in information displays. -If <TT>"no"</TT> is specified, numeric addresses are printed instead. The -default is <TT>"yes"</TT>, unless modified using the command line <TT>-n</TT> -switch.</DD> - -<DD> - </DD> - -<DT> -<TT>keyid <I>keyid</I></TT></DT> - -<DD> -This command allows the specification of a key number to be used to authenticate -configuration requests. This must correspond to a key number the server -has been configured to use for this purpose.</DD> - -<DD> - </DD> - -<DT> -<TT>ntpversion 1 | 2 | 3 | 4</TT></DT> - -<DD> -Sets the NTP version number which <TT>ntpq</TT> claims in packets. Defaults -to 3, Note that mode 6 control messages (and modes, for that matter) didn't -exist in NTP version 1. There appear to be no servers left which demand -version 1.</DD> - -<DD> - </DD> - -<DT> -<TT>quit</TT></DT> - -<DD> -Exit <TT>ntpq</TT>.</DD> - -<DD> - </DD> - -<DT> -<TT>passwd</TT></DT> - -<DD> -This command prompts you to type in a password (which will not be echoed) -which will be used to authenticate configuration requests. The password -must correspond to the key configured for use by the NTP server for this -purpose if such requests are to be successful.</DD> - -<DD> - </DD> - -<DT> -<TT>raw</TT></DT> - -<DD> -Causes all output from query commands is printed as received from the remote -server. The only formating/intepretation done on the data is to transform -nonascii data into a printable (but barely understandable) form.</DD> - -<DD> - </DD> - -<DT> -<TT>timeout <I>millseconds</I></TT></DT> - -<DD> -Specify a timeout period for responses to server queries. The default is -about 5000 milliseconds. Note that since <TT>ntpq</TT> retries each query -once after a timeout, the total waiting time for a timeout will be twice -the timeout value set.</DD> -</DL> - -<H4> -Control Message Commands</H4> -Each peer known to an NTP server has a 16 bit integer association identifier -assigned to it. NTP control messages which carry peer variables must identify -the peer the values correspond to by including its association ID. An association -ID of 0 is special, and indicates the variables are system variables, whose -names are drawn from a separate name space. - -<P>Control message commands result in one or more NTP mode 6 messages being -sent to the server, and cause the data returned to be printed in some format. -Most commands currently implemented send a single message and expect a -single response. The current exceptions are the peers command, which will -send a preprogrammed series of messages to obtain the data it needs, and -the mreadlist and mreadvar commands, which will iterate over a range of -associations. -<DL> -<DT> -<TT>associations</TT></DT> - -<DD> -Obtains and prints a list of association identifiers and peer statuses -for in-spec peers of the server being queried. The list is printed in columns. -The first of these is an index numbering the associations from 1 for internal -use, the second the actual association identifier returned by the server -and the third the status word for the peer. This is followed by a number -of columns containing data decoded from the status word See the peers command -for a decode of the <TT>condition</TT> field. Note that the data returned -by the <TT>"associations"</TT> command is cached internally in <TT>ntpq</TT>. -The index is then of use when dealing with stupid servers which use association -identifiers which are hard for humans to type, in that for any subsequent -commands which require an association identifier as an argument, the form -and index may be used as an alternative.</DD> - -<DD> - </DD> - -<DT> -<TT>clockvar [<I>assocID</I>] [<I>variable_name</I> [ = <I>value</I> [...] -] [...]</TT></DT> - -<DT> -<TT>cv [<I>assocID</I>] [<I>variable_name</I> [ = <I>value</I> [...] ] -[...]</TT></DT> - -<DD> -Requests that a list of the server's clock variables be sent. Servers which -have a radio clock or other external synchronization will respond positively -to this. If the association identifier is omitted or zero the request is -for the variables of the <TT>"system clock"</TT> and will generally get -a positive response from all servers with a clock. If the server treats -clocks as pseudo-peers, and hence can possibly have more than one clock -connected at once, referencing the appropriate peer association ID will -show the variables of a particular clock. Omitting the variable list will -cause the server to return a default variable display.</DD> - -<DD> - </DD> - -<DT> -<TT>lassocations</TT></DT> - -<DD> -Obtains and prints a list of association identifiers and peer statuses -for all associations for which the server is maintaining state. This command -differs from the <TT>"associations"</TT> command only for servers which -retain state for out-of-spec client associations (i.e., fuzzballs). Such -associations are normally omitted from the display when the <TT>"associations"</TT> -command is used, but are included in the output of <TT>"lassociations"</TT>.</DD> - -<DD> - </DD> - -<DT> -<TT>lpassociations</TT></DT> - -<DD> -Print data for all associations, including out-of-spec client associations, -from the internally cached list of associations. This command differs from -<TT>"passociations"</TT> only when dealing with fuzzballs.</DD> - -<DD> - </DD> - -<DT> -<TT>lpeers</TT></DT> - -<DD> -Like R peers, except a summary of all associations for which the server -is maintaining state is printed. This can produce a much longer list of -peers from fuzzball servers.</DD> - -<DD> - </DD> - -<DT> -<TT>mreadlist <I>assocID</I> <I>assocID</I></TT></DT> - -<BR><TT>mrl <I>assocID</I> <I>assocID</I></TT> -<DD> -Like the <TT>readlist</TT> command, except the query is done for each of -a range of (nonzero) association IDs. This range is determined from the -association list cached by the most recent <TT>associations</TT> command.</DD> - -<DD> - </DD> - -<DT> -<TT>mreadvar <I>assocID</I> <I>assocID</I> [ <I>variable_name</I> [ = <I>value</I> -[ ... ]</TT></DT> - -<BR><TT>mrv <I>assocID</I> <I>assocID</I> [ <I>variable_name</I> [ = <I>value</I> -[ ... ]</TT> -<DD> -Like the <TT>readvar</TT> command, except the query is done for each of -a range of (nonzero) association IDs. This range is determined from the -association list cached by the most recent <TT>associations</TT> command.</DD> - -<DD> - </DD> - -<DT> -<TT>opeers</TT></DT> - -<DD> -An old form of the <TT>peers</TT> command with the reference ID replaced -by the local interface address.</DD> - -<DD> - </DD> - -<DT> -<TT>passociations</TT></DT> - -<DD> -Prints association data concerning in-spec peers from the internally cached -list of associations. This command performs identically to the <TT>"associations"</TT> -except that it displays the internally stored data rather than making a -new query.</DD> - -<DD> - </DD> - -<DT> -<TT>peers</TT></DT> - -<DD> -Obtains a current list peers of the server, along with a summary of each -peer's state. Summary information includes the address of the remote peer, -the reference ID (0.0.0.0 if this is unknown), the stratum of the remote -peer, the type of the peer (local, unicast, multicast or broadcast), when -the last packet was received, the polling interval, in seconds, the reachability -register, in octal, and the current estimated delay, offset and dispersion -of the peer, all in milliseconds.</DD> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntpq - standard NTP query program</title> +</head> +<body> +<h3><tt>ntpq</tt> - standard NTP query program</h3> + +<img align="left" src="pic/bustardfly.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> + +<p>A typical NTP monitoring packet.<br clear="left"> +</p> + +<hr> +<h4>Synopsis</h4> + +<tt>ntpq [-inp] [-c <i>command</i>] [<i>host</i>] [...]</tt> + +<h4>Description</h4> + +The <tt>ntpq</tt> utility program is used to query NTP servers +which implement the recommended NTP mode 6 control message format +about current state and to request changes in that state. The +program may be run either in interactive mode or controlled using +command line arguments. Requests to read and write arbitrary +variables can be assembled, with raw and pretty-printed output +options being available. <tt>ntpq</tt> can also obtain and print a +list of peers in a common format by sending multiple queries to the +server. + +<p>If one or more request options is included on the command line +when <tt>ntpq</tt> is executed, each of the requests will be sent +to the NTP servers running on each of the hosts given as command +line arguments, or on localhost by default. If no request options +are given, <tt>ntpq</tt> will attempt to read commands from the +standard input and execute these on the NTP server running on the +first host given on the command line, again defaulting to localhost +when no other host is specified. <tt>ntpq</tt>will prompt for +commands if the standard input is a terminal device.</p> + +<p><tt>ntpq</tt> uses NTP mode 6 packets to communicate with the +NTP server, and hence can be used to query any compatible server on +the network which permits it. Note that since NTP is a UDP protocol +this communication will be somewhat unreliable, especially over +large distances in terms of network topology. <tt>ntpq</tt> makes +one attempt to retransmit requests, and will time requests out if +the remote host is not heard from within a suitable timeout +time.</p> + +<p>For examples and usage, see the <a href="debug.htm">NTP +Debugging Techniques</a> page.</p> + +<p>Command line options are described following. Specifying a +command line option other than <tt>-i</tt> or <tt>-n</tt> will +cause the specified query (queries) to be sent to the indicated +host(s) immediately. Otherwise, <tt>ntpq</tt> will attempt to read +interactive format commands from the standard input.</p> + +<dl> +<dt><tt>-c</tt></dt> + +<dd>The following argument is interpreted as an interactive format +command and is added to the list of commands to be executed on the +specified host(s). Multiple <tt>-c</tt> options may be given.</dd> + +<dt><tt>-i</tt></dt> + +<dd>Force <tt>ntpq</tt> to operate in interactive mode. Prompts +will be written to the standard output and commands read from the +standard input.</dd> + +<dt><tt>-n</tt></dt> + +<dd>Output all host addresses in dotted-quad numeric format rather +than converting to the canonical host names.</dd> + +<dt><tt>-p</tt></dt> + +<dd>Print a list of the peers known to the server as well as a +summary of their state. This is equivalent to the <tt>peers</tt> +interactive command.</dd> +</dl> + +<h4>Internal Commands</h4> + +Interactive format commands consist of a keyword followed by zero +to four arguments. Only enough characters of the full keyword to +uniquely identify the command need be typed. The output of a +command is normally sent to the standard output, but optionally the +output of individual commands may be sent to a file by appending a +<tt><</tt>, followed by a file name, to the command line. A +number of interactive format commands are executed entirely within +the <tt>ntpq</tt> program itself and do not result in NTP mode 6 +requests being sent to a server. These are described following. + +<dl> +<dt><tt>? [<i>command_keyword</i>]</tt><br> +<tt>helpl [<i>command_keyword</i>]</tt></dt> + +<dd>A <tt>?</tt> by itself will print a list of all the command +keywords known to this incarnation of <tt>ntpq</tt>. A <tt>?</tt> +followed by a command keyword will print function and usage +information about the command. This command is probably a better +source of information about <tt>ntpq</tt> than this manual +page.</dd> + +<dt><tt>addvars <i>variable_name</i> [ = <i>value</i>] +[...]</tt><br> +<tt>rmvars <i>variable_name</i> [...]</tt><br> +<tt>clearvars</tt></dt> + +<dd>The data carried by NTP mode 6 messages consists of a list of +items of the form <tt><i>variable_name</i> = <i>value</i></tt>, +where the <tt>= <i>value</i></tt> is ignored, and can be omitted, +in requests to the server to read variables. <tt>ntpq</tt> +maintains an internal list in which data to be included in control +messages can be assembled, and sent using the <tt>readlist</tt> and +<tt>writelist</tt> commands described below. The <tt>addvars</tt> +command allows variables and their optional values to be added to +the list. If more than one variable is to be added, the list should +be comma-separated and not contain white space. The <tt>rmvars</tt> +command can be used to remove individual variables from the list, +while the <tt>clearlist</tt> command removes all variables from the +list.</dd> + +<dt><tt>authenticate yes | no</tt></dt> + +<dd>Normally <tt>ntpq</tt> does not authenticate requests unless +they are write requests. The command <tt>authenticate yes</tt> +causes <tt>ntpq</tt> to send authentication with all requests it +makes. Authenticated requests causes some servers to handle +requests slightly differently, and can occasionally melt the CPU in +fuzzballs if you turn authentication on before doing a <tt> +peer</tt> display. [I didn't know that - Ed.]</dd> + +<dt><tt>cooked</tt></dt> + +<dd>Causes output from query commands to be "cooked", so that +variables which are recognized by <tt>ntpq</tt> will have their +values reformatted for human consumption. Variables which <tt> +ntpq</tt> thinks should have a decodable value but didn't are +marked with a trailing <tt>?</tt>.</dd> + +<dt><tt>debug more | less | off</tt></dt> + +<dd>Turns internal query program debugging on and off.</dd> + +<dt><tt>delay <i>milliseconds</i></tt></dt> + +<dd>Specify a time interval to be added to timestamps included in +requests which require authentication. This is used to enable +(unreliable) server reconfiguration over long delay network paths +or between machines whose clocks are unsynchronized. Actually the +server does not now require timestamps in authenticated requests, +so this command may be obsolete.</dd> + +<dt><tt>host <i>hostname</i></tt></dt> + +<dd>Set the host to which future queries will be sent. Hostname may +be either a host name or a numeric address.</dd> + +<dt><tt>hostnames [yes | no]</tt></dt> + +<dd>If <tt>yes</tt> is specified, host names are printed in +information displays. If <tt>no</tt> is specified, numeric +addresses are printed instead. The default is <tt>yes</tt>, unless +modified using the command line <tt>-n</tt> switch.</dd> + +<dt><tt>keyid <i>keyid</i></tt></dt> + +<dd>This command allows the specification of a key number to be +used to authenticate configuration requests. This must correspond +to a key number the server has been configured to use for this +purpose.</dd> + +<dt><tt>ntpversion 1 | 2 | 3 | 4</tt></dt> + +<dd>Sets the NTP version number which <tt>ntpq</tt> claims in +packets. Defaults to 3, Note that mode 6 control messages (and +modes, for that matter) didn't exist in NTP version 1. There appear +to be no servers left which demand version 1.</dd> + +<dt><tt>quit</tt></dt> + +<dd>Exit <tt>ntpq</tt>.</dd> + +<dt><tt>passwd</tt></dt> + +<dd>This command prompts you to type in a password (which will not +be echoed) which will be used to authenticate configuration +requests. The password must correspond to the key configured for +use by the NTP server for this purpose if such requests are to be +successful.</dd> + +<dt><tt>raw</tt></dt> + +<dd>Causes all output from query commands is printed as received +from the remote server. The only formating/interpretation done on +the data is to transform nonascii data into a printable (but barely +understandable) form.</dd> + +<dt><tt>timeout <i>millseconds</i></tt></dt> + +<dd>Specify a timeout period for responses to server queries. The +default is about 5000 milliseconds. Note that since <tt>ntpq</tt> +retries each query once after a timeout, the total waiting time for +a timeout will be twice the timeout value set.</dd> +</dl> + +<h4>Control Message Commands</h4> + +Each peer known to an NTP server has a 16 bit integer association +identifier assigned to it. NTP control messages which carry peer +variables must identify the peer the values correspond to by +including its association ID. An association ID of 0 is special, +and indicates the variables are system variables, whose names are +drawn from a separate name space. + +<p>Control message commands result in one or more NTP mode 6 +messages being sent to the server, and cause the data returned to +be printed in some format. Most commands currently implemented send +a single message and expect a single response. The current +exceptions are the peers command, which will send a preprogrammed +series of messages to obtain the data it needs, and the mreadlist +and mreadvar commands, which will iterate over a range of +associations.</p> + +<dl> +<dt><tt>associations</tt></dt> + +<dd>Obtains and prints a list of association identifiers and peer +statuses for in-spec peers of the server being queried. The list is +printed in columns. The first of these is an index numbering the +associations from 1 for internal use, the second the actual +association identifier returned by the server and the third the +status word for the peer. This is followed by a number of columns +containing data decoded from the status word See the peers command +for a decode of the <tt>condition</tt> field. Note that the data +returned by the <tt>associations"</tt> command is cached internally +in <tt>ntpq</tt>. The index is then of use when dealing with stupid +servers which use association identifiers which are hard for humans +to type, in that for any subsequent commands which require an +association identifier as an argument, the form and index may be +used as an alternative.</dd> + +<dt><tt>clockvar [<i>assocID</i>] [<i>variable_name</i> [ = <i> +value</i> [...]] [...]</tt></dt> + +<dt><tt>cv [<i>assocID</i>] [<i>variable_name</i> [ = <i>value</i> +[...] ][...]</tt></dt> + +<dd>Requests that a list of the server's clock variables be sent. +Servers which have a radio clock or other external synchronization +will respond positively to this. If the association identifier is +omitted or zero the request is for the variables of the <tt>system +clock</tt> and will generally get a positive response from all +servers with a clock. If the server treats clocks as pseudo-peers, +and hence can possibly have more than one clock connected at once, +referencing the appropriate peer association ID will show the +variables of a particular clock. Omitting the variable list will +cause the server to return a default variable display.</dd> -<DD> - </DD> - -<DD> -The character in the left margin indicates the fate of this peer in the -clock selection process. Folowing is a list of these characters, the pidgeon -used in the <TT>rv</TT> command, and a short explanation of the condition -revealed.</DD> - -<DD> - </DD> - -<DD> -<TT>space reject</TT></DD> +<dt><tt>lassocations</tt></dt> + +<dd>Obtains and prints a list of association identifiers and peer +statuses for all associations for which the server is maintaining +state. This command differs from the <tt>associations</tt> command +only for servers which retain state for out-of-spec client +associations (i.e., fuzzballs). Such associations are normally +omitted from the display when the <tt>associations</tt> command is +used, but are included in the output of <tt> +lassociations</tt>.</dd> -<DL> -<DD> -The peer is discarded as unreachable, synchronized to this server (synch -loop) or outrageous synchronization distance.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>x falsetick</TT></DD> - -<DL> -<DD> -The peer is discarded by the intersection algorithm as a falseticker.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>. excess</TT></DD> - -<DL> -<DD> -The peer is discarded as not among the first ten peers sorted by synchronization -distance and so is probably a poor candidate for further consideration.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>- outlyer</TT></DD> - -<DL> -<DD> -The peer is discarded by the clustering algorithm as an outlyer.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>+ candidat</TT></DD> - -<DL> -<DD> -The peer is a survivor and a candidate for the combining algorithm.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT># selected</TT></DD> - -<DL> -<DD> -The peer is a survivor, but not among the first six peers sorted by synchronization -distance. If the assocation is ephemeral, it may be demobilized to conserve -resources.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>* sys.peer</TT></DD> - -<DL> -<DD> -The peer has been declared the system peer and lends its variables to the -system variables.</DD> -</DL> - -<DD> -<TT> </TT></DD> - -<DD> -<TT>o pps.peer</TT></DD> - -<DL> -<DD> -The peer has been declared the system peer and lends its variables to the -system variables. However, the actual system synchronization is derived -from a pulse-per-second (PPS) signal, either indirectly via the PPS reference -clock driver or directly via kernel interface.</DD> - -<DD> - </DD> -</DL> - -<DD> -The <TT>flash</TT> variable is not defined in the NTP specification, but -is included as a valuable debugging aid. It displays the results of the -packet sanity checks defined in the NTP specification <TT>TEST1</TT> through -<TT>TEST9</TT>. The bits for each test read in increasing sequency from -the least significant bit and are defined as follows.</DD> - -<DD> - </DD> - -<DD> -The following <TT>TEST1</TT> through <TT>TEST4</TT> enumerate procedure -errors. The packet timestamps may or may not be believed, but the remaining -header data are ignored.</DD> +<dt><tt>lpassociations</tt></dt> + +<dd>Print data for all associations, including out-of-spec client +associations, from the internally cached list of associations. This +command differs from <tt>passociations</tt> only when dealing with +fuzzballs.</dd> + +<dt><tt>lpeers</tt></dt> + +<dd>Like R peers, except a summary of all associations for which +the server is maintaining state is printed. This can produce a much +longer list of peers from fuzzball servers.</dd> + +<dt><tt>mreadlist <i>assocID</i> <i>assocID</i></tt><br> +<tt>mrl <i>assocID</i> <i>assocID</i></tt></dt> + +<dd>Like the <tt>readlist</tt> command, except the query is done +for each of a range of (nonzero) association IDs. This range is +determined from the association list cached by the most recent <tt> +associations</tt> command.</dd> + +<dt><tt>mreadvar <i>assocID</i> <i>assocID</i> [ <i> +variable_name</i> [ = <i>value</i>[ ... ]</tt><br> +<tt>mrv <i>assocID</i> <i>assocID</i> [ <i>variable_name</i> [ = +<i>value</i>[ ... ]</tt></dt> + +<dd>Like the <tt>readvar</tt> command, except the query is done for +each of a range of (nonzero) association IDs. This range is +determined from the association list cached by the most recent <tt> +associations</tt> command.</dd> + +<dt><tt>opeers</tt></dt> + +<dd>An old form of the <tt>peers</tt> command with the reference ID +replaced by the local interface address.</dd> + +<dt><tt>passociations</tt></dt> + +<dd>Displays association data concerning in-spec peers from the +internally cached list of associations. This command performs +identically to the <tt>associations</tt> except that it displays +the internally stored data rather than making a new query.</dd> + +<dt><tt>peers</tt></dt> + +<dd>Obtains a current list peers of the server, along with a +summary of each peer's state. Summary information includes the +address of the remote peer, the reference ID (0.0.0.0 if this is +unknown), the stratum of the remote peer, the type of the peer +(local, unicast, multicast or broadcast), when the last packet was +received, the polling interval, in seconds, the reachability +register, in octal, and the current estimated delay, offset and +dispersion of the peer, all in milliseconds.</dd> + +<dd>The character in the left margin indicates the fate of this +peer in the clock selection process. Following is a list of these +characters, the pigeon used in the <tt>rv</tt> command, and a short +explanation of the condition revealed.</dd> + +<dd> +<dl> +<dt><tt>space reject</tt></dt> + +<dd>The peer is discarded as unreachable, synchronized to this +server (synch loop) or outrageous synchronization distance.</dd> + +<dt><tt>x falsetick</tt></dt> + +<dd>The peer is discarded by the intersection algorithm as a +falseticker.</dd> + +<dt><tt>. excess</tt></dt> + +<dd>The peer is discarded as not among the first ten peers sorted +by synchronization distance and so is probably a poor candidate for +further consideration.</dd> + +<dt><tt>- outlyer</tt></dt> + +<dd>The peer is discarded by the clustering algorithm as an +outlyer.</dd> + +<dt><tt>+ candidat</tt></dt> + +<dd>The peer is a survivor and a candidate for the combining +algorithm.</dd> + +<dt><tt># selected</tt></dt> + +<dd>The peer is a survivor, but not among the first six peers +sorted by synchronization distance. If the assocation is ephemeral, +it may be demobilized to conserve resources.</dd> + +<dt><tt>* sys.peer</tt></dt> + +<dd>The peer has been declared the system peer and lends its +variables to the system variables.</dd> + +<dt><tt>o pps.peer</tt></dt> + +<dd>The peer has been declared the system peer and lends its +variables to thesystem variables. However, the actual system +synchronization is derived from a pulse-per-second (PPS) signal, +either indirectly via the PPS reference clock driver or directly +via kernel interface.</dd> +</dl> +</dd> + +<dd>The <tt>flash</tt> variable is a valuable debugging aid. It +displays the results of the original sanity checks defined in the +NTP specification RFC-1305 and additional ones added in NTP Version +4. There are eleven tests called <tt>TEST1</tt> through <tt> +TEST11</tt>. The tests are performed in a certain order designed to +gain maximum diagnostic information while protecting against +accidental or malicious errors. The <tt>flash</tt> variable is +first initialized to zero. If after each set of tests one or more +bits are set, the packet is discarded. + +<p>Tests <tt>TEST4</tt> and <tt>TEST5</tt> check the access +permissions and cryptographic message digest. If any bits are set +after that, the packet is discarded. Tests <tt>TEST10</tt> and <tt> +TEST11</tt> check the authentication state using Autokey public-key +cryptography, as described in the <a href="authopt.htm"> +Authentication Options</a> page. If any bits are set and the +association has previously been marked reachable, the packet is +discarded; otherwise, the originate and receive timestamps are +saved, as required by the NTP protocol, and processing +continues.</p> + +<p>Tests <tt>TEST1</tt> through <tt>TEST3</tt> check the packet +timestamps from which the offset and delay are calculated. If any +bits are set, the packet is discarded; otherwise, the packet header +variables are saved. Tests <tt>TEST6</tt> through <tt>TEST8</tt> +check the health of the server. If any bits are set, the packet is +discarded; otherwise, the offset and delay relative to the server +are calculated and saved. Test <tt>TEST9</tt> checks the health of +the association itself. If any bits are set, the packet is +discarded; otherwise, the saved variables are passed to the clock +filter and mitigation algorithms.</p> + +<p>The <tt>flash</tt> bits for each test read in increasing order +from the least significant bit are defined as follows.</p> +</dd> + +<dd> +<dl> +<dt><tt>TEST1</tt></dt> + +<dd>Duplicate packet. The packet is at best a casual retransmission +and at worst a malicious replay.</dd> + +<dt><tt>TEST2</tt></dt> + +<dd>Bogus packet. The packet is not a reply to a message previously +sent. This can happen when the NTP daemon is restarted and before +somebody else notices.</dd> + +<dt><tt>TEST3</tt></dt> + +<dd>Unsynchronized. One or more timestamp fields are invalid. This +normally happens when the first packet from a peer is +received.</dd> + +<dt><tt>TEST4</tt></dt> + +<dd>Access is denied. See the <a href="accopt.htm">Access Control +Options</a> page.</dd> + +<dt><tt>TEST5</tt></dt> + +<dd>Cryptographic authentication fails. See the <a href= +"authopt.htm">Authentication Options</a> page.</dd> + +<dt><tt>TEST6</tt></dt> + +<dd>The server is unsynchronized. Wind up its clock first.</dd> + +<dt><tt>TEST7</tt></dt> + +<dd>The server stratum is at the maximum than 15. It is probably +unsynchronized and its clock needs to be wound up.</dd> + +<dt><tt>TEST8</tt></dt> + +<dd>Either the root delay or dispersion is greater than one second, +which is highly unlikely unless the peer is synchronized to +Mars.</dd> + +<dt><tt>TEST9</tt></dt> + +<dd>Either the peer delay or dispersion is greater than one second, +which is higly unlikely unless the peer is on Mars.</dd> + +<dt><tt>TEST10</tt></dt> + +<dd>The autokey protocol has detected an authentication failure. +See the <a href="authopt.htm">Authentication Options</a> page.</dd> + +<dt><tt>TEST11</tt></dt> + +<dd>The autokey protocol has not verified the server or peer is +authentic and has valid public key credentials. See the <a href= +"authopt.htm">Authentication Options</a> page.</dd> + +<dt>Additional system variables used by the NTP Version 4 Autokey +support include the following:</dt> + +<dd> +<dl> +<dt><tt>certificate <i>filestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the certificate file was +created.</dd> + +<dt><tt>hostname <i>host</i></tt></dt> + +<dd>Shows the name of the host as returned by the Unix <tt> +gethostname()</tt> library function.</dd> + +<dt><tt>flags <i>hex</i></tt></dt> + +<dd>Shows the current flag bits, where the <tt><i>hex</i></tt> bits +are interpreted as follows:</dd> + +<dd> +<dl> +<dt><tt>0x01</tt></dt> + +<dd>autokey enabled</dd> + +<dt><tt>0x02</tt></dt> + +<dd>RSA public/private key files present</dd> + +<dt><tt>0x04</tt></dt> + +<dd>PKI certificate file present</dd> + +<dt><tt>0x08</tt></dt> + +<dd>Diffie-Hellman parameters file present</dd> + +<dt><tt>0x10</tt></dt> + +<dd>NIST leapseconds table file present</dd> +</dl> +</dd> + +<dt><tt>leapseconds <i>filestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the NIST leapseconds table file was +created.</dd> + +<dt><tt>params <i>filestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the Diffie-Hellman agreement +parameter file was created.</dd> + +<dt><tt>publickey <i>filestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the RSA public/private key files +were created.</dd> + +<dt><tt>refresh <i>timestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the public cryptographic values were +refreshed and signed.</dd> + +<dt><tt>tai <i>offset</i></tt></dt> + +<dd>Shows the TAI-UTC offset in seconds obtained from the NIST +leapseconds table.</dd> +</dl> +</dd> + +<dt>Additional peer variables used by the NTP Version 4 Autokey +support include the following:</dt> + +<dd> +<dl> +<dt><tt>certificate <i>filestamp</i></tt></dt> + +<dd>Shows the NTP seconds when the certificate file was +created.</dd> + +<dt><tt>flags <i>hex</i></tt></dt> + +<dd>Shows the current flag bits, where the <i>hex</i> bits are +interpreted as in the system variable of the same name. The bits +are set in the first autokey message received from the server and +then reset as the associated data are obtained from the server and +stored.</dd> + +<dt><tt>hcookie <i>hex</i></tt></dt> + +<dd>Shows the host cookie used in the key agreement algorithm.</dd> + +<dt><tt>initkey <i>key</i></tt></dt> + +<dd>Shows the initial key used by the key list generator in the +autokey protocol.</dd> + +<dt><tt>initsequence <i>index</i></tt></dt> + +<dd>Shows the initial index used by the key list generator in the +autokey protocol.</dd> + +<dt><tt>pcookie <i>hex</i></tt></dt> + +<dd>Specifies the peer cookie used in the key agreement +algorithm.</dd> + +<dt><tt>timestamp <i>time</i></tt></dt> + +<dd>Shows the NTP seconds when the last autokey key list was +generated and signed.</dd> +</dl> +</dd> +</dl> +</dd> + +<dt><tt>pstatus <i>assocID</i></tt></dt> + +<dd>Sends a read status request to the server for the given +association. The names and values of the peer variables returned +will be printed. Note that the status word from the header is +displayed preceding the variables, both in hexidecimal and in +pidgeon English.</dd> + +<dt><tt>readlist [ <i>assocID</i> ]</tt><br> +<tt>rl [ <i>assocID</i> ]</tt></dt> + +<dd>Requests that the values of the variables in the internal +variable list be returned by the server. If the association ID is +omitted or is 0 the variables are assumed to be system variables. +Otherwise they are treated as peer variables. If the internal +variable list is empty a request is sent without data, which should +induce the remote server to return a default display.</dd> + +<dt><tt>readvar <i>assocID</i> <i>variable_name</i> [ = <i> +value</i> ] [ ...]</tt><br> +<tt>rv <i>assocID</i> [ <i>variable_name</i> [ = <i>value</i> ] [ +...]</tt></dt> + +<dd>Requests that the values of the specified variables be returned +by the server by sending a read variables request. If the +association ID is omitted or is given as zero the variables are +system variables, otherwise they are peer variables and the values +returned will be those of the corresponding peer. Omitting the +variable list will send a request with no data which should induce +the server to return a default display.</dd> + +<dt><tt>writevar <i>assocID</i> <i>variable_name</i> [ = <i> +value</i> [ ...]</tt></dt> + +<dd>Like the readvar request, except the specified variables are +written instead of read.</dd> + +<dt><tt>writelist [ <i>assocID</i> ]</tt></dt> + +<dd>Like the readlist request, except the internal list variables +are written instead of read.</dd> +</dl> + +<h4>Bugs</h4> + +<p>The peers command is non-atomic and may occasionally result in +spurious error messages about invalid associations occurring and +terminating the command. The timeout time is a fixed constant, +which means you wait a long time for timeouts since it assumes sort +of a worst case. The program should improve the timeout estimate as +it sends queries to a particular host, but doesn't.</p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<DL> -<DD> - </DD> -</DL> - -<DD> -<TT>TEST1</TT></DD> - -<DL> -<DD> -Duplicate packet. A copy from somewhere.</DD> -</DL> - -<DL> -<DD> - </DD> -</DL> - -<DD> -<TT>TEST2</TT></DD> - -<DL> -<DD> -Bogus packet. It is not a reply to a message previously sent. This can -happen when the NTP daemon is restarted and before a peer notices.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST3</TT></DD> - -<DL> -<DD> -Unsynchronized. One or more timestamp fields are missing. This normally -happens when the first packet from a peer is received.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST4</TT></DD> - -<DL> -<DD> -Either peer delay or peer dispersion is greater than one second. Ya gotta -be kidding.</DD> - -<DD> - </DD> -</DL> - -<DD> -The following <TT>TEST5</TT> through <TT>TEST10</TT> ennumerate errors -in the packet header. The packet is discarded without inspecting its contents.</DD> - -<DL> -<DD> - </DD> -</DL> - -<DD> -<TT>TEST5</TT></DD> - -<DL> -<DD> -Cryptographic authentication fails. See the <A HREF="authopt.htm">Authentication -Options</A> page.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST6</TT></DD> - -<DL> -<DD> -Peer is unsynchronized. Wind up its clock first.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST7</TT></DD> - -<DL> -<DD> -Peer stratum is greater than 15. The peer is probably unsynchronized.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST8</TT></DD> - -<DL> -<DD> -Either root delay or root dispersion is greater than one second. Too far -from home.</DD> -</DL> - -<DL> -<DD> - </DD> -</DL> - -<DD> -<TT>TEST9</TT></DD> - -<DL> -<DD> -Peer cryptographic authentication fails. Either the key identifier or key -is wrong or somebody trashed our packet.</DD> - -<DD> - </DD> -</DL> - -<DD> -<TT>TEST10</TT></DD> - -<DL> -<DD> -Access is denied. See the <A HREF="accopt.htm">Access Control Options</A> -page.</DD> - -<DD> - </DD> -</DL> - -<DT> -<TT>pstatus <I>assocID</I></TT></DT> - -<DD> -Sends a read status request to the server for the given association. The -names and values of the peer variables returned will be printed. Note that -the status word from the header is displayed preceding the variables, both -in hexidecimal and in pidgeon English.</DD> - -<DD> - </DD> - -<DT> -<TT>readlist [ <I>assocID</I> ]</TT></DT> - -<BR><TT>rl [ <I>assocID</I> ]</TT> -<DD> -Requests that the values of the variables in the internal variable list -be returned by the server. If the association ID is omitted or is 0 the -variables are assumed to be system variables. Otherwise they are treated -as peer variables. If the internal variable list is empty a request is -sent without data, which should induce the remote server to return a default -display.</DD> - -<DD> - </DD> - -<DT> -<TT>readvar <I>assocID</I> <I>variable_name</I> [ = <I>value</I> ] [ ... -]</TT></DT> - -<BR><TT>rv <I>assocID</I> [ <I>variable_name</I> [ = <I>value</I> ] [ ... -]</TT> -<DD> -Requests that the values of the specified variables be returned by the -server by sending a read variables request. If the association ID is omitted -or is given as zero the variables are system variables, otherwise they -are peer variables and the values returned will be those of the corresponding -peer. Omitting the variable list will send a request with no data which -should induce the server to return a default display.</DD> - -<DD> - </DD> - -<DT> -<TT>writevar <I>assocID</I> <I>variable_name</I> [ = <I>value</I> [ ... -]</TT></DT> - -<DD> -Like the readvar request, except the specified variables are written instead -of read.</DD> - -<DD> - </DD> - -<DT> -<TT>writelist [ <I>assocID</I> ]</TT></DT> - -<DD> -Like the readlist request, except the internal list variables are written -instead of read.</DD> -</DL> - -<H4> -Bugs</H4> -The peers command is non-atomic and may occasionally result in spurious -error messages about invalid associations occurring and terminating the -command. The timeout time is a fixed constant, which means you wait a long -time for timeouts since it assumes sort of a worst case. The program should -improve the timeout estimate as it sends queries to a particular host, -but doesn't. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> diff --git a/contrib/ntp/html/ntptime.htm b/contrib/ntp/html/ntptime.htm index 3cc4544..c192c13 100644 --- a/contrib/ntp/html/ntptime.htm +++ b/contrib/ntp/html/ntptime.htm @@ -1,96 +1,80 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>ntptime - read kernel time variables -</TITLE> -</HEAD> -<BODY> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntptime - read kernel time variables</title> +</head> +<body> +<h3><tt>ntptime</tt> - read kernel time variables</h3> -<H3> -<TT>ntptime</TT> - read kernel time variables</H3> +<img align="left" src="pic/pogo5.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Pogo</i>, +Walt Kelly</a> -<HR> -<H4> -Synopsis</H4> -<TT>ntptime [ -chr ] [ -e <I>est_error</I> ] [ -f <I>frequency</I> ] [ --m <I>max_error</I> ] [ -o <I>offset</I> ] [ -s <I>status</I> ] [ -t <I>time_constant</I> -]</TT> -<H4> -Description</H4> -This program is useful only with special kernels described in the <A HREF="kern.htm">A -Kernel Model for Precision Timekeeping </A>page. It reads and displays -time-related kernel variables using the <TT>ntp_gettime()</TT> system call. -A similar display can be obtained using the <TT>ntpdc</TT> program and -<TT>kerninfo</TT> command. -<H4> -Options</H4> +<p>The turtle is been swimming in the kernel.<br clear="left"> +</p> -<DL> -<DT> -<TT>-c</TT></DT> +<hr> +<h4>Synopsis</h4> -<DD> -Display the execution time of <TT>ntptime</TT> itself.</DD> +<tt>ntptime [ -chr ] [ -e <i>est_error</i> ] [ -f <i>frequency</i> +] [ -m <i>max_error</i> ] [ -o <i>offset</i> ] [ -s <i>status</i> ] +[ -t <i>time_constant</i>]</tt> -<DT> -<TT>-e <I>est_error</I></TT></DT> +<h4>Description</h4> -<DD> -Specify estimated error, in microseconds.</DD> +This program is useful only with special kernels described in the +<a href="kern.htm">A Kernel Model for Precision Timekeeping</a> +page. It reads and displays time-related kernel variables using the +<tt>ntp_gettime()</tt> system call. A similar display can be +obtained using the <tt>ntpdc</tt> program and <tt>kerninfo</tt> +command. -<DT> -<TT>-f <I>frequency</I></TT></DT> +<h4>Options</h4> -<DD> -Specify frequency offset, in parts per million.</DD> +<dl> +<dt><tt>-c</tt></dt> -<DT> -<TT>-h</TT></DT> +<dd>Display the execution time of <tt>ntptime</tt> itself.</dd> -<DD> -Display times in Unix timeval format. Default is NTP format.</DD> +<dt><tt>-e <i>est_error</i></tt></dt> -<DT> -<TT>-l</TT></DT> +<dd>Specify estimated error, in microseconds.</dd> -<DD> -Specify the leap bits as a code from 0 to 3.</DD> +<dt><tt>-f <i>frequency</i></tt></dt> -<DT> -<TT>-m <I>max_error</I></TT></DT> +<dd>Specify frequency offset, in parts per million.</dd> -<DD> -Display help information.</DD> +<dt><tt>-h</tt></dt> -<DT> -<TT>-o <I>offset</I></TT></DT> +<dd>Display help information.</dd> -<DD> -Specify clock offset, in microseconds.</DD> +<dt><tt>-m <i>max_error</i></tt></dt> -<DT> -<TT>-r</TT></DT> +<dd>Specify max possible errors, in microseconds.</dd> -<DD> -Display Unix and NTP times in raw format.</DD> +<dt><tt>-o <i>offset</i></tt></dt> -<DT> -<TT>-s <I>status</I></TT></DT> +<dd>Specify clock offset, in microseconds.</dd> -<DD> -Specify clock status. Better know what you are doing.</DD> +<dt><tt>-r</tt></dt> -<DT> -<TT>-t <I>time_constant</I></TT></DT> +<dd>Display Unix and NTP times in raw format.</dd> -<DD> -Specify time constant, an integer in the range 0-4.</DD> -</DL> +<dt><tt>-s <i>status</i></tt></dt> -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> +<dd>Specify clock status. Better know what you are doing.</dd> + +<dt><tt>-t <i>time_constant</i></tt></dt> + +<dd>Specify time constant, an integer in the range 0-10.</dd> +</dl> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -</BODY> -</HTML> diff --git a/contrib/ntp/html/ntptrace.htm b/contrib/ntp/html/ntptrace.htm index 675c347..28313a5 100644 --- a/contrib/ntp/html/ntptrace.htm +++ b/contrib/ntp/html/ntptrace.htm @@ -1,82 +1,91 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>ntptrace - trace a chain of NTP servers back to the primary -source -</TITLE> -</HEAD> -<BODY> - -<H3> -<TT>ntptrace</TT> - trace a chain of NTP servers back to the primary source</H3> - -<HR> -<H4> -Synopsis</H4> -<TT>ntptrace [ -vdn ] [ -r <I>retries</I> ] [ -t <I>timeout</I> ] [ <I>server</I> -]</TT> -<H4> -Description</H4> -<TT>ntptrace</TT> determines where a given Network Time Protocol (NTP) -server gets its time from, and follows the chain of NTP servers back to -their master time source. If given no arguments, it starts with <TT>localhost</TT>. -Here is an example of the output from <TT>ntptrace</TT>: -<PRE>% ntptrace +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>ntptrace - trace a chain of NTP servers back to the primary +source</title> +</head> +<body> +<h3><tt>ntptrace</tt> - trace a chain of NTP servers back to the +primary source</h3> + +<img align="left" src="pic/alice13.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>The rabbit knows the way back.<br clear="left"> +</p> + +<hr> +<h4>Synopsis</h4> + +<tt>ntptrace [ -vdn ] [ -r <i>retries</i> ] [ -t <i>timeout</i> ] [ +<i>server</i> ]</tt> + +<h4>Description</h4> + +<p><tt>ntptrace</tt> determines where a given Network Time Protocol +(NTP) server gets its time from, and follows the chain of NTP +servers back to their master time source. If given no arguments, it +starts with <tt>localhost</tt>. Here is an example of the output +from <tt>ntptrace</tt>:</p> + +<pre> +% ntptrace localhost: stratum 4, offset 0.0019529, synch distance 0.144135 server2ozo.com: stratum 2, offset 0.0124263, synch distance 0.115784 usndh.edu: stratum 1, offset 0.0019298, synch distance 0.011993, refid -'WWVB'</PRE> -On each line, the fields are (left to right): the host name, the host stratum, -the time offset between that host and the local host (as measured by <TT>ntptrace</TT>; -this is why it is not always zero for "<TT>localhost</TT>"), the host synchronization -distance, and (only for stratum-1 servers) the reference clock ID. All -times are given in seconds. Note that the stratum is the server hop count -to the primary source, while the synchronization distance is the estimated -error relative to the primary source. These terms are precisely defined -in RFC-1305. -<H4> -Options</H4> - -<DL> -<DT> -<TT>-d</TT></DT> - -<DD> -Turns on some debugging output.</DD> - -<DT> -<TT>-n</TT></DT> - -<DD> -Turns off the printing of host names; instead, host IP addresses are given. -This may be useful if a nameserver is down.</DD> - -<DT> -<TT>-r <I>retries</I></TT></DT> - -<DD> -Sets the number of retransmission attempts for each host (default = 5).</DD> - -<DT> -<TT>-t <I>timeout</I></TT></DT> - -<DD> -Sets the retransmission timeout (in seconds) (default = 2).</DD> - -<DT> -<TT>-v</TT></DT> - -<DD> -Prints verbose information about the NTP servers.</DD> -</DL> - -<H4> -Bugs</H4> -This program makes no attempt to improve accuracy by doing multiple samples. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +'WWVB' +</pre> + +On each line, the fields are (left to right): the host name, the +host stratum, the time offset between that host and the local host +(as measured by <tt>ntptrace</tt>; this is why it is not always +zero for "<tt>localhost</tt>"), the host synchronization distance, +and (only for stratum-1 servers) the reference clock ID. All times +are given in seconds. Note that the stratum is the server hop count +to the primary source, while the synchronization distance is the +estimated error relative to the primary source. These terms are +precisely defined in RFC-1305. + +<h4>Options</h4> + +<dl> +<dt><tt>-d</tt></dt> + +<dd>Turns on some debugging output.</dd> + +<dt><tt>-n</tt></dt> + +<dd>Turns off the printing of host names; instead, host IP +addresses are given. This may be useful if a nameserver is +down.</dd> + +<dt><tt>-r <i>retries</i></tt></dt> + +<dd>Sets the number of retransmission attempts for each host +(default = 5).</dd> + +<dt><tt>-t <i>timeout</i></tt></dt> + +<dd>Sets the retransmission timeout (in seconds) (default = +2).</dd> + +<dt><tt>-v</tt></dt> + +<dd>Prints verbose information about the NTP servers.</dd> +</dl> + +<h4>Bugs</h4> + +This program makes no attempt to improve accuracy by doing multiple +samples. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/patches.htm b/contrib/ntp/html/patches.htm index 154d4b8..ed4c8dd 100644 --- a/contrib/ntp/html/patches.htm +++ b/contrib/ntp/html/patches.htm @@ -4,67 +4,39 @@ Patching Procedures Patching Procedures </h3> -<IMG align=left SRC=pic/rabbit.gif>From <i>pogo</i>, Walt Kelly +<img align=left src=pic/alice38.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm> +from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>The Mad Hatter needs patches. <br clear=left><hr> -<p>A distribution so widely used as this one eventually develops -numerous barnacles as the result of <a href=porting.htm>porting</a> -to new systems, idiosyncratic new features and just plain bugs. In order -to help keep order and make maintenance bearable, we ask that proposed -changes to the distribution be submitted in the following form. +<p>A distribution so widely used as this one eventually develops numerous barnacles as the result of <a href=porting.htm>porting</a> to new systems, idiosyncratic new features and just plain bugs. In order to help keep order and make maintenance bearable, we ask that proposed changes to the distribution be submitted in the following form. <ol> -<p><li>Please submit patches to <a href=mailto:mills@udel.edu>David L. -Mills <mills@udel.edu></a> in the form of either unified-diffs -(<tt>diff -u</tt>) or context-diffs (<tt>diff -c</tt>).</li> +<p><li>Please submit patches to <a href=mailto:bugs@mail.ntp.org>Bugs <bugs@mail.ntp.org></a> in the form of either unified-diffs (<tt>diff -u</tt>) or context-diffs (<tt>diff -c</tt>).</li> -<p><li>Please include the <strong>output</strong> from -<tt>config.guess</tt> in the description of your patch. If -<tt>config.guess</tt> does not produce any output for your machine, -please fix that, too!</li> +<p><li>Please include the <strong>output</strong> from <tt>config.guess</tt> in the description of your patch. If <tt>config.guess</tt> does not produce any output for your machine, please fix that, too!</li> -<p><li>Please base the patch on the root directory of the distribution. -The preferred procedure here is to copy your patch to the root directory -and mumble</li> +<p><li>Please base the patch on the root directory of the distribution. The preferred procedure here is to copy your patch to the root directory and mumble</li> <p><tt>patch -p <your_patch></tt></li> -<p><li>Please avoid patching the RCS subdirectories; better yet, clean -them out before submitting patches.</li> +<p><li>Please avoid patching the RCS subdirectories; better yet, clean them out before submitting patches.</li> -<p><li>If you have whole new files, as well as patches, wrap the files -and patches in a shell script. If you need to compress it, use either -GNU zip or the stock Unix compress utility.</li> +<p><li>If you have whole new files, as well as patches, wrap the files and patches in a shell script. If you need to compress it, use either GNU zip or the stock Unix <tt>compress</tt> utility.</li> -<p><li>Don't forget the documentation that may be affected by the patch. -Send us patches for the <tt>./html</tt> files as well. See the <a -href=htmlprimer.htm>A Beginner's Guide to HTML</a> page for a -tutorial.</li> +<p><li>Don't forget the documentation that may be affected by the patch. Send us patches for the <tt>./htm</tt> files as well. See the <a href=htmlprimer.htm>A Beginner's Guide to HTML</a> page for a tutorial.</li> -<p><li>We would be glad to include your name, electric address and -descriptive phrase in the <a href=copyright.htm>Copyright</a> page, -if you wish.</li> +<p><li>We would be glad to include your name, electric address and descriptive phrase in the <a href=copyright.htm>Copyright</a> page, if you wish.</li> </ol> -<p>Prior to ntp3-5.83 (releases up to and including ntp3.5f) a -complete patch history back to the dark ages was kept in the -<tt>./patches</tt> directory, which might have been helpful to see -if the same problem occured in another port, etc. Patches were saved in -that directory with file name in the form <tt>patch.<i>nnn</i></tt>, -where <i>nnn</i> was approaching 200. All patches in that directory have -been made; so, if yours was there, it was in the distribution. - -<p>Since we have been getting multple patches for some bugs, plus many -changes are implemented locally, no two maintainers here use the same -tools, and since we're not using any bug-tracking software or even -source code control, there is currently no tracking of specific changes. - -<p>The best way to see what's changed between two distributions is to -run a <tt>diff</tt> against them. +<p>Prior to ntp3-5.83 (releases up to and including ntp3.5f) a complete patch history back to the dark ages was kept in the <tt>./patches</tt> directory, which might have been helpful to see if the same problem occured in another port, etc. Patches were saved in that directory with file name in the form <tt>patch.<i>nnn</i></tt>, where <i>nnn</i> was approaching 200. All patches in that directory have been made; so, if yours was there, it was in the distribution. + +<p>Since we have been getting multple patches for some bugs, plus many changes are implemented locally, no two maintainers here use the same tools, and since we're not using any bug-tracking software or even source code control, there is currently no tracking of specific changes. +<p>The best way to see what's changed between two distributions is to run a <tt>diff</tt> against them. + <p>Thanks for your contribution and happy chime. -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/porting.htm b/contrib/ntp/html/porting.htm index d541d4e..4015d61 100644 --- a/contrib/ntp/html/porting.htm +++ b/contrib/ntp/html/porting.htm @@ -2,7 +2,13 @@ Porting Hints </title></head><body><h3> Porting Hints -</h3><hr> +</h3> + +<img align=left src=pic/wingdorothy.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>The +Wizard of Oz</i>, L. Frank Baum</a> + +<p>Porting Dorothy in Oz. +<br clear=left><hr> <p>NOTE: The following procedures have been replaced by GNU automake and autoconfigure. This page is to be updated in the next release. diff --git a/contrib/ntp/html/pps.htm b/contrib/ntp/html/pps.htm index 97850d7..a20dd4d 100644 --- a/contrib/ntp/html/pps.htm +++ b/contrib/ntp/html/pps.htm @@ -1,84 +1,106 @@ -<html><head><title> -Pulse-per-second (PPS) Signal Interfacing -</title></head><body><h3> -Pulse-per-second (PPS) Signal Interfacing -</h3><hr> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Pulse-per-second (PPS) Signal Interfacing</title> +</head> +<body> +<h3>Pulse-per-second (PPS) Signal Interfacing</h3> -<P>Some radio clocks and related timekeeping gear have a -pulse-per-second (PPS) signal that can be used to discipline the local -clock oscillator to a high degree of precision, typically to the order -less than 20 <font face=Symbol>m</font>s in time and 0.01 PPM in -frequency. The PPS signal can be connected in either of two ways: via -the data leads of a serial port or via the modem control leads. Either -way requires conversion of the PPS signal, usually at TTL levels, to -RS232 levels, which can be done using a circuit such as described in the -<A HREF=gadget.htm>Gadget Box PPS Level Converter and CHU Modem</A> -page. +<img align="left" src="pic/alice32.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> -<P>The data leads interface requires regenerating the PPS pulse and -converting to RS232 signal levels, so that the pulse looks like a -legitimate ASCII character to a serial port. The <TT>tty_clk</TT> line -discipline/streams module inserts a timestamp following this character -in the input data stream. The <A HREF=driver22.htm>PPS Clock -Discipline</A> driver uses this timestamp to determine the time of -arrival of the PPS pulse to within 26 us at 38.4 kbps while eliminating -error due to operating system queues and service times. +<p>Alice is trying to find the PPS signal connector.<br clear= +"left"> +</p> -<P>The modem control leads interface requires converting to RS232 levels -and connecting to the data carrier detect (DCD) lead of a serial port. -The <TT>ppsclock</TT> and <TT>ppsapi</TT> streams modules capture a -timestamp upon transition of the DCD signal. Note that the -<TT>ppsclock</TT> module functionality has been subsumed by the new -<TT>ppsapi</TT> interface specification, which is supported by the NTP -daemon. As the latter is expected to become an IETF cross-platform -standard, it should be used in new configurations. The PPS Clock -Discipline driver reads the latest timestamp with a designated system -call or interface routine to determine the time of arrival of the PPS -pulse to within a few microseconds. Alternatively, if provisions have -been made in the kernel for PPS signals, the signal is captured directly -by the kernel serial driver without using the PPS driver. +<hr> +<p>Some radio clocks and related timekeeping gear have a +pulse-per-second (PPS) signal that can be used to discipline the +local clock oscillator to a high degree of precision, typically to +the order less than 10 <font face="Symbol">m</font>s in time and +0.01 parts-per-million (PPM) in frequency. The PPS signal can be +connected in either of two ways: via the data carrier detector +(DCD) pin of a serial port or via the acknowledge (ACK) pin of a +parallel port, depending on the hardware and operating system. +Connection via a serial port may require signal conversion and +regeneration to RS232 levels, which can be done using a circuit +such as described in the <a href="gadget.htm">Gadget Box PPS Level +Converter and CHU Modem</a> page. Note that NTP no longer supports +connection via the data leads of a serial port.</p> -<P>The <TT>tty_clk</TT> module is included in the NTP software -distribution, while the <A -HREF=http://www.eecis.udel.edu/~mills/ntp/ntp/ppsclock.tar.Z><TT> -ppsclock</TT></A> module can be obtained via the web at that link or by -anonymous FTP from ftp.udel.edu in the <TT>pub/ntp</TT> directory. Both -the <TT>tty_clk</TT> and <TT>ppsclock</TT> modules are described in the -<A HREF=ldisc.htm>Line Disciplines and Streams Drivers</A> page. -Directions for building the modules themselves are in the -<TT>./kernel</TT> directory. Directions on how to configure -<TT>ntpd</TT> to operate with these modules is described in <A -HREF=build.htm>Building and Installing the Distribution </A>page. +<p>Both the serial and parallel port connection require operating +system support, which is available in only a few operating systems, +including Linux, FreeBSD and latest Solaris beginning with 2.7. +Support on an experimental basis is available for several older +systems, including SunOS, Digital Ultrix and HP-UX, and in current +Digital Tru64 (Alpha). The PPS application program interface +defined in RFC-2783 (PPSAPI) is the only interface currently +supported. Older PPS interfaces based on the <tt>ppsclock</tt> and +<tt>tty_clk</tt> streams modules are no longer supported. As the +PPSAPI is expected to become an IETF cross-platform standard, it +should be used by new applications.</p> -<P>The PPS driver is operates in conjunction with another reference -clock driver that produces the PPS pulse, as described in the <A -HREF=prefer.htm>Mitigation Rules and the <TT>prefer</TT> Keyword -</A>page. One of the drivers described in the <A -HREF=refclock.htm>Reference Clock Drivers</A> page furnishes -the coarse timecode used to disambiguate the seconds numbering of the -PPS pulse itself. The NTP daemon mitigates between the radio clock -driver and <TT>PPS</TT> driver as described in that page in order to -provide the most accurate time, while respecting the various types of -equipment failures that could happen. +<p>The PPSAPI inerface requires a <tt> +/usr/include/sys/ppstime.h</tt> header file. This file is included +in Linux and FreeBSD distributions, but not in other distributions +or standard workstation products at this time. Header files for +other systems, including Solaris, can be found in the <tt> +nanokernel.tar.gz</tt> distribution, which can be found via the +Collaboration Resources link at www.ntp.org. The top level +directory contains a number of subdirectories for each +architecture, including Solaris. The <tt>ppstime.h</tt> file for +each architecture can be found in the subdirectory of the same +name.</p> -<P>For the utmost time quality, some Unix system kernels support a PPS -signal directly, as described in the <A HREF=kern.htm>A Kernel Model -for Precision Timekeeping </A>page. Specifically, the ppsclock module -can be used to interface the PPS signal directly to the kernel for use -as discipline sources for both time and frequency. These sources can be -separately enabled and monitored using the <TT>ntp_adjtime()</TT> system -call described in that page and the <TT>/usr/include/sys/timex.h</TT> -header file. The presence of these kernel provisions is automatically -detected and supporting code compiled. +<p>In the preferred mode of operation, PPS signals are processed by +the <a href="driver22.htm">PPS Clock Discipline</a> driver and +other clock drivers which might be involved need not know or care +about them. In some cases where there is no other driver, time +might be obtained from remote NTP servers via the network and local +PPS signals, for instance from a calibrated cesium oscillator, used +to stabilize the frequency and remove network jitter. Note that the +<tt>pps</tt> configuration command has been obsoleted by this +driver.</p> -<P>In some configurations may have multiple radio clocks, each with PPS -outputs, as well as a kernel provisions for the PPS signal. In order to -provide the highest degree of redundancy and survivability, the kernel -PPS discipline, <TT>tty_clk</TT> module, <TT>ppsclock</TT> module and -kernel modifications may all be in use at the same time, each backing up -the other. The sometimes complicated mitigation rules are described in -the Mitigation Rules and the <TT>prefer</TT> Keyword page. +<p>The PPS driver operates in conjunction with a preferred peer, as +described in the <a href="prefer.htm">Mitigation Rules and the <tt> +prefer</tt> Keyword</a> page. One of the drivers described in the +<a href="refclock.htm">Reference Clock Drivers</a> page or another +NTP server furnishes the coarse timing and disambiguates the +seconds numbering of the PPS signal itself. The NTP daemon +mitigates between the clock driver or NTP server and the PPS driver +as described in that page in order to provide the most accurate +time, while respecting the various types of equipment failures that +could happen.</p> + +<p>Some Unix system kernels support a PPS signal directly, as +described in the <a href="kern.htm">A Kernel Model for Precision +Timekeeping</a> page. Specifically, the PPS driver can be used to +direct the PPS signal to the kernel for use as a discipline source +for both time and frequency. The presence of the kernel support is +automatically detected during the NTP build process and supporting +code automatically compiled. Note that the PPS driver does not +normally enable the PPS kernel code, since performance is generally +better without it. However, this code can be enabled by a driver +fudge flag if necessary.</p> + +<p>Some configurations may include multiple radio clocks with +individual PPS outputs. In some PPSAPI designs multiple PPS signals +can be connected to multiple instances of the PPS driver. In such +cases the NTP mitigation and grooming algorithms operate with all +the radio timecodes and PPS signals to develop the highest degree +of redundancy and survivability.</p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a><br> +<br> + + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/prefer.htm b/contrib/ntp/html/prefer.htm index edb5152..57a047a 100644 --- a/contrib/ntp/html/prefer.htm +++ b/contrib/ntp/html/prefer.htm @@ -1,332 +1,93 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>Mitigation Rules and the ``prefer'' Keyword -</TITLE> -</HEAD> -<BODY> - -<H3> -Mitigation Rules and the <TT>prefer</TT> Keyword</H3> - -<HR> -<H4> -Introduction</H4> -The mechanics of the NTP algorithms which select the best data sample from -each available peer and the best subset of the peer population have been -finely crafted to resist network jitter, faults in the network or peer -operations, and to deliver the best possible accuracy. Most of the time -these algorithms do a good job without requiring explicit manual tailoring -of the configuration file. However, there are times when the accuracy can -be improved by some careful tailoring. The following sections explain how -to do this using explicit configuration items and special signals, when -available, that are generated by some radio clocks. - -<P>In order to provide robust backup sources, primary (stratum-1) servers -are usually operated in a diversity configuration, in which the server -operates with a number of remote peers in addition to one or more radio -or modem clocks operating as local peers. In these configurations the suite -of algorithms used in NTP to refine the data from each peer separately -and to select and weight the data from a number of peers are used with -the entire ensemble of remote peers and local peers. As the result of these -algorithms, a set of <I>survivors</I> are identified which can presumably -provide the most reliable and accurate time. Ordinarily, the individual -clock offsets of the survivors are combined on a weighted average basis -to produce an offset used to control the system clock. - -<P>However, because of small but significant systematic time offsets between -the survivors, it is in general not possible to achieve the lowest jitter -and highest stability in these configurations. This happens because the -selection algorithm tends to <I>clockhop</I> between survivors of substantially -the same quality, but showing small systematic offsets between them. In -addition, there are a number of configurations involving pulse-per-second -(PPS) signals, modem backup services and other special cases, so that a -set of mitigation rules becomes necessary to select a single peer from -among the survivors. These rules are based on a set of special characteristics -of the various peers and reference clock drivers specified in the configuration -file. -<H4> -The <TT>prefer</TT> Peer</H4> -The mitigation rules are designed to provide an intelligent selection between -various peers of substantially the same statistical quality. They is designed -to provide the best quality time without compromising the normal operation -of the NTP algorithms. The mitigation scheme in its present form is not -an integral component of the NTP Version 3 specification RFC- 1305. but -is to be included in the version 4 specification when it is published. -The scheme is based on the concept of <I>prefer peer</I>, which is specified -by including the <TT>prefer</TT> keyword with the associated <TT>server</TT> -or <TT>peer</TT> command in the configuration file. This keyword can be -used with any peer or server, but is most commonly used with a radio clock. -While the scheme does not forbid it, it does not seem useful to designate -more than one peer as preferred, since the additional complexities to mitigate -among them do not seem justified from on-air experience. - -<P>The prefer scheme works on the set of peers that have survived the sanity -checks and intersection algorithms of the clock selection procedures. Ordinarily, -the members of this set can be considered <I>truechimers</I> and any one -of them could in principle provide correct time; however, due to various -error contributions, not all can provide the most accurate and stable time. -The job of the clustering algorithm, which is invoked at this point, is -to select the best subset of the survivors providing the least variance -in the combined ensemble average, compared to the variance in each member -of the subset separately. The detailed operation of the clustering algorithm, -which is given in the specification, is not important here, other than -to point out it operates in rounds, where a survivor, presumably the worst -of the lot, is discarded in each round until one of several termination -conditions is met. - -<P>In the prefer scheme the clustering algorithm is modified so that the -prefer peer is never discarded; on the contrary, its potential removal -becomes a termination condition. If the original algorithm were about to -toss out the prefer peer, the algorithm terminates right there. The prefer -peer can still be discarded by the sanity checks and intersection algorithms, -of course, but it will always survive the clustering algorithm. If it does -not survive or for some reason it fails to provide updates, it will eventually -become unreachable and the clock selection will remitigate to select the -next best source. - -<P>Along with this behavior, the clock selection procedures are modified -so that the combining algorithm is not used when a prefer peer is present. -Instead, the offset of the prefer peer is used exclusively as the synchronization -source. In the usual case involving a radio clock and a flock of remote -stratum-1 peers, and with the radio clock designated a prefer peer, the -result is that the high quality radio time disciplines the server clock -as long as the radio itself remains operational and with valid time, as -determined from the remote peers, sanity checks and intersection algorithm. -<H4> -Peer Classification</H4> -In order to understand the effects of the various intricate schemes involved, -it is necessary to understand some arcane details on how the algorithms -decide on a synchronization source, when more than one source is available. -This is done on the basis of a set of explicit mitigation rules, which -define special classes of remote and local peers as a function of configuration -declarations and reference clock driver type: -<OL> -<LI> -The prefer peer is designated using the <TT>prefer</TT> keyword with the -<TT>server</TT> or <TT>peer</TT> commands. All other things being equal, -this peer will be selected for synchronization over all other survivors -of the clock selection procedures.</LI> - -<BR> -<LI> -When a PPS signal is connected via the PPS Clock Discipline driver (type -22), this is called the <I>PPS peer</I>. This driver provides precision -clock corrections only within one second, so is always operated in conjunction -with another peer or reference clock driver, which provides the seconds -numbering. The PPS peer is active only under conditions explained below.</LI> - -<BR> -<LI> -When the Undisciplined Local Clock driver (type 1) is configured, this -is called the <I>local clock peer</I>. This is used either as a backup -reference source (stratum greater than zero), should all other synchronization -sources fail, or as the primary reference source (stratum zero) in cases -where the kernel time is disciplined by some other means of synchronization, -such as the NIST <TT>lockclock</TT> scheme, or another synchronization -protocol, such as the Digital Time Synchronization Service (DTSS).</LI> - -<BR> -<LI> -When a modem driver such as the Automated Computer Time Service driver -(type 18) is configured, this is called the <I>modem peer</I>. This is -used either as a backup reference source, should all other primary sources -fail, or as the (only) primary reference source.</LI> - -<BR> -<LI> -Where support is available, the PPS signal may be processed directly by -the kernel, as described in the <A HREF="kern.htm">A Kernel Model for Precision -Timekeeping</A> page. This is called the <I>kernel discipline</I>. The -PPS signal can discipline the kernel in both frequency and time. The frequency -discipline is active as long as the PPS interface device and signal itself -is operating correctly, as determined by the kernel algorithms. The time -discipline is active only under conditions explained below.</LI> -</OL> -Reference clock drivers operate in the manner described in the <A HREF="refclock.htm">Reference -Clock Drivers</A> page and its dependencies. The drivers are ordinarily -operated at stratum zero, so that as the result of ordinary NTP operations, -the server itself operates at stratum one, as required by the NTP specification. -In some cases described below, the driver is intentionally operated at -an elevated stratum, so that it will be selected only if no other survivor -is present with a lower stratum. In the case of the PPS peer or kernel -time discipline, these sources appear active only if the prefer peer has -survived the intersection and clustering algorithms, as described below, -and its clock offset relative to the current local clock is less than a -specified value, currently 128 ms. - -<P>The modem clock drivers are a special case. Ordinarily, the update interval -between modem calls to synchronize the system clock is many times longer -than the interval between polls of either the remote or local peers. In -order to provide the best stability, the operation of the clock discipline -algorithm changes gradually from a phase-lock mode at the shorter update -intervals to a frequency-lock mode at the longer update intervals. If both -remote or local peers together with a modem peer are operated in the same -configuration, what can happen is that first the clock selection algorithm -can select one or more remote/local peers and the clock discipline algorithm -will optimize for the shorter update intervals. Then, the selection algorithm -can select the modem peer, which requires a much different optimization. -The intent in the design is to allow the modem peer to control the system -clock either when no other source is available or, if the modem peer happens -to be marked as prefer, then it always controls the clock, as long as it -passes the sanity checks and intersection algorithm. There still is room -for suboptimal operation in this scheme, since a noise spike can still -cause a clockhop either way. Nevertheless, the optimization function is -slow to adapt, so that a clockhop or two does not cause much harm. - -<P>The local clock driver is another special case. Normally, this driver -is eligible for selection only if no other source is available. When selected, -vernier adjustments introduced via the configuration file or remotely using -the <TT><A HREF="ntpdc.htm">ntpdc</A> </TT>program can be used to trim -the local clock frequency and time. However, if the local clock driver -is designated the prefer peer, this driver is always selected and all other -sources are ignored. This behavior is intended for use when the kernel -time is controlled by some means external to NTP, such as the NIST <TT>lockclock</TT> -algorithm or another time synchronization protocol such as DTSS. -In this case the only way to disable the local clock driver is to mark -it unsynchronized using the leap indicator bits. In the case of modified -kernels with the <TT>ntp_adjtime()</TT> system call, this can be done automatically -if the external synchronization protocol uses it to discipline the kernel -time. -<H4> -Mitigation Rules</H4> -The mitigation rules apply in the intersection and clustering algorithms -described in the NTP specification. The intersection algorithm first scans -all peers with a persistent association and includes only those that satisfy -specified sanity checks. In addition to the checks required by the specification, -the mitigation rules require either the local-clock peer or modem peer -to be included only if marked as the prefer peer. The intersection algorithm -operates on the included population to select only those peers believed -to represent the correct time. If one or more peers survive the operation, -processing continues in the clustering algorithm. Otherwise, if there is -a modem peer, it is declared the only survivor; otherwise, if there is -a local-clock peer, it is declared the only survivor. Processing then continues -in the clustering algorithm. - -<P>The clustering algorithm repeatedly discards outlyers in order to reduce -the residual jitter in the survivor population. As required by the NTP -specification, these operations continue until either a specified minimum -number of survivors remain or the minimum select dispersion of the population -is greater than the maximum peer dispersion of any member. The mitigation -rules require an additional terminating condition which stops these operations -at the point where the prefer peer is about to be discarded. - -<P>The mitigation rules establish the choice of <I>system peer</I>, which -determine the stratum, reference identifier and several other system variables -which are visible to clients of the local server. In addition, they establish -which source or combination of sources control the local clock. -<OL> -<LI> -If there is a prefer peer and it is the local-clock peer or the modem peer; -or, if there is a prefer peer and the kernel time discipline is active, -choose the prefer peer as the system peer and its offset as the system -clock offset. If the prefer peer is the local-clock peer, an offset can -be calculated by the driver to produce a frequency offset in order to correct -for systematic frequency errors. In case a source other than NTP is controlling -the system clock, corrections determined by NTP can be ignored by using -the <TT>disable pll</TT> in the configuration file. If the prefer peer -is the modem peer, it must be the primary source for the reasons noted -above. If the kernel time discipline is active, the system clock offset -is ignored and the corrections handled directly by the kernel.</LI> - -<LI> -If the above is not the case and there is a PPS peer, then choose it as -the system peer and its offset as the system clock offset.</LI> - -<LI> -If the above is not the case and there is a prefer peer (not the local-clock -or modem peer in this case), then choose it as the system peer and its -offset as the system clock offset.</LI> - -<LI> -If the above is not the case and the peer previously chosen as the system -peer is in the surviving population, then choose it as the system peer -and average its offset along with the other survivors to determine the -system clock offset. This behavior is designed to avoid excess jitter due -to clockhopping, when switching the system peer would not materially improve -the time accuracy.</LI> - -<LI> -If the above is not the case, then choose the first candidate in the list -of survivors ranked in order of synchronization distance and average its -offset along with the other survivors to determine the system clock offset. -This is the default case and the only case considered in the current NTP -specification.</LI> -</OL> - -<H4> -Using the Pulse-per-Second (PPS) Signal</H4> -Most radio clocks are connected using a serial port operating at speeds -of 9600 bps or higher. The accuracy using typical timecode formats, where -the on-time epoch is indicated by a designated ASCII character, like carriage-return -<TT><cr></TT>, is limited to a millisecond at best and a few milliseconds -in typical cases. However, some radios produce a PPS signal which can be -used to improve the accuracy with typical workstation servers to the order -of a few tens of microseconds. The details of how this can be accomplished -are discussed in the <A HREF="pps.htm">Pulse-per-second (PPS) Signal Interfacing</A> -page. The following paragraphs discuss how the PPS signal is affected by -the mitigation rules. - -<P>First, it should be pointed out that the PPS signal is inherently ambiguous, -in that it provides a precise seconds epoch, but does not provide a way -to number the seconds. In principle and most commonly, another source of -synchronization, either the timecode from an associated radio clock, or -even one or more remote NTP servers, is available to perform that function. -In all cases, a specific, configured peer or server must be designated -as associated with the PPS signal. This is done using the <TT>prefer</TT> -keyword as described previously. The PPS signal can be associated in this -way with any peer, but is most commonly used with the radio clock generating -the PPS signal. - -<P>The PPS signal can be used in two ways to discipline the local clock, -one using a special PPS driver described in the <A HREF="driver22.htm">PPS -Clock Discipline</A> page, the other using PPS signal support in the kernel, -as described in the <A HREF="kern.htm">A Kernel Model for Precision Timekeeping</A> -page. In either case, the signal must be present and within nominal jitter -and wander error tolerances. In addition, the associated prefer peer must -have survived the sanity checks and intersection algorithms and the dispersion -settled below 1 s. This insures that the radio clock hardware is operating -correctly and that, presumably, the PPS signal is operating correctly as -well. Second, the absolute offset of the local clock from that peer must -be less than 128 ms, or well within the 0.5-s unambiguous range of the -PPS signal itself. In the case of the PPS driver, the time offsets generated -from the PPS signal are propagated via the clock filter to the clock selection -procedures just like any other peer. Should these pass the sanity checks -and intersection algorithms, they will show up along with the offsets of -the prefer peer itself. Note that, unlike the prefer peer, the PPS peer -samples are not protected from discard by the clustering algorithm. These -complicated procedures insure that the PPS offsets developed in this way -are the most accurate, reliable available for synchronization. - -<P>The PPS peer remains active as long as it survives the intersection -algorithm and the prefer peer is reachable; however, like any other clock -driver, it runs a reachability algorithm on the PPS signal itself. If for -some reason the signal fails or displays gross errors, the PPS peer will -either become unreachable or stray out of the survivor population. In this -case the clock selection remitigates as described above. - -<P>When kernel support for the PPS signal is available, the PPS signal -is interfaced to the kernel serial driver code via a modem control lead. -As the PPS signal is derived from external equipment, cables, etc., which -sometimes fail, a good deal of error checking is done in the kernel to -detect signal failure and excessive noise. The way in which the mitigation -rules affect the kernel discipline is as follows. - -<P>In order to operate, the kernel support must be enabled by the <TT>enable -pll </TT>command in the configuration file and the signal must be present -and within nominal jitter and wander error tolerances. In the NTP daemon, -the PPS discipline is active only when the prefer peer is among the survivors -of the clustering algorithm, and its absolute offset is within 128 ms, -as in the PPS driver. Under these conditions the kernel disregards updates -produced by the NTP daemon and uses its internal PPS source instead. The -kernel maintains a watchdog timer for the PPS signal; if the signal has -not been heard or is out of tolerance for more than some interval, currently -two minutes, the kernel discipline is declared inoperable and operation -continues as if it were not present. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +<html><head><title> +Mitigation Rules and the <tt>prefer</tt> Keyword +</title></head><body><h3> +Mitigation Rules and the <tt>prefer</tt> Keyword +</h3> + +<img align=left src=pic/alice11.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm> +from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>Listen carefully to what I say; it is very complicated. +<br clear=left><hr> + +<h4>Introduction</h4> + +The mechanics of the NTP algorithms which select the best data sample from each available server and the best subset of the server population have been finely crafted to resist network jitter, faults in the network or server operations, and to deliver the best possible accuracy. Most of the time these algorithms do a good job without requiring explicit manual tailoring of the configuration file. However, there are times when the accuracy can be improved by some careful tailoring. The following sections explain how to do this using explicit configuration items and special signals, when available, that are generated by some radio clocks and laboratory instruments. + +<p>In order to provide robust backup sources, primary (stratum-1) servers are usually operated in a diversity configuration, in which the server operates with a number of remote servers in addition to one or more radio or modem clocks. In these configurations the suite of algorithms used in NTP to refine the data from each peer separately and to select and combine the data from a number of servers and clocks. As the result of these algorithms, a set of <i>survivors</i> are identified which can presumably provide the most reliable and accurate time. Ordinarily, the individual clock offsets of the survivors are combined on a weighted average basis to produce an offset used to control the system clock. + +<p>However, because of small but significant systematic time offsets between the survivors, it is in general not possible to achieve the lowest jitter and highest stability in these configurations. This happens because the selection algorithm tends to <i>clockhop</i> between survivors of substantially the same quality, but showing small systematic offsets between them. In addition, there are a number of configurations involving pulse-per-second (PPS) signals, modem backup services and other special cases, so that a set of mitigation rules becomes necessary to select a single peer from among the survivors. These rules are based on a set of special characteristics of the various remote servers and reference clock drivers specified in the configuration file. + +<h4>The <tt>prefer</tt> Peer</h4> + +The mitigation rules are designed to provide an intelligent selection between various sources of substantially the same statistical quality without compromising the normal operation of the NTP algorithms. While they have been implemented in NTP Version 4 and will be incorporated in the NTP Version 4 specification when published, they are not in the NTP Version 3 specification RFC-1305. The rules are based on the concept of <i>prefer peer</i>, which is specified by including the <tt>prefer</tt> keyword with the associated <tt>server</tt> or <tt>peer</tt> command in the configuration file. This keyword can be used with any server or peer, but is most commonly used with a radio clock. While the rules do not forbid it, it does not seem useful to designate more than one peer as preferred, since the additional complexities to mitigate among them do not seem justified from on-air experience. + +<p>The prefer scheme works on the set of peers that have survived the sanity checks and intersection algorithms of the clock selection procedures. Ordinarily, the members of this set can be considered <i>truechimers</i> and any one of them could in principle provide correct time; however, due to various error contributions, not all can provide the most accurate and stable time. The job of the clustering algorithm, which is invoked at this point, is to select the best subset of the survivors providing the least variance in the combined ensemble average, compared to the variance in each member of the subset separately. The detailed operation of the clustering algorithm, which is given in the RFC-1305, is beyond the scope of discussion here. It operates in rounds, where a survivor, presumably the worst of the lot, is discarded in each round until one of several termination conditions is met. An example terminating condition is when the number of survivors is about to be reduced below three. + +<p>In the prefer scheme the clustering algorithm is modified so that the prefer peer is never discarded; on the contrary, its potential removal becomes a termination condition. If the original algorithm were about to toss out the prefer peer, the algorithm terminates immediately. The prefer peer can still be discarded by the sanity checks and intersection algorithms, of course, but it will always survive the clustering algorithm. If it does not survive or for some reason it fails to provide updates, it will eventually become unreachable and the clock selection will remitigate to select the next best source. + +<p>Along with this behavior, the clock selection procedures are modified so that the combining algorithm is not used when a prefer peer is present. Instead, the offset of the prefer peer is used exclusively as the synchronization source. In the usual case involving a radio clock and a flock of remote stratum-1 peers, and with the radio clock designated a prefer peer, the result is that the high quality radio time disciplines the server clock as long as the radio itself remains operational and with valid time, as determined from the remote peers, sanity checks and intersection algorithm. + +<h4>Peer Classification</h4> + +In order to understand the effects of the various intricate schemes involved, it is necessary to understand some arcane details on how the algorithms decide on a synchronization source when more than one source is available. This is done on the basis of a set of explicit mitigation rules, which define special classes of remote serves and local radio clocks as a function of configuration declarations and clock driver type: + +<ol> + +<li>The prefer peer is designated using the <tt>prefer</tt> keyword with the <tt>server</tt> or <tt>peer</tt> commands. All other things being equal, this peer will be selected for synchronization over all other survivors of the clock selection procedures.</li> + +<li>When a PPS signal is connected via the PPS Clock Discipline driver (type 22), this is called the <i>PPS peer</i>. This driver provides precision clock corrections only within one second, so is always operated in conjunction with another server or radio clock driver, which provides the seconds numbering. The PPS peer is active only under conditions explained below.</li> + +<li>When the Undisciplined Local Clock driver (type 1) is configured, this is called the <i>local clock peer</i>. This is used either as a backup reference source (stratum greater than zero), should all other synchronization sources fail, or as the primary reference source (stratum zero) in cases where the kernel time is disciplined by some other means of synchronization, such as the NIST <tt>lockclock</tt> scheme, or another synchronization protocol, such as the Digital Time Synchronization Service (DTSS).</li> + +<li>When a modem driver such as the Automated Computer Time Service driver (type 18) is configured, this is called the <i>modem peer</i>. This is used either as a backup reference source, should all other primary sources fail, or as the (only) primary reference source.</li> + +<li>Where support is available, the PPS signal may be processed directly by the kernel, as described in the <A HREF="kern.htm">A Kernel Model for Precision Timekeeping</A> page. This is called the <i>kernel discipline</i>. The PPS signal can discipline the kernel in both frequency and time. The frequency discipline is active as long as the PPS interface device and signal itself is operating correctly, as determined by the kernel algorithms. The time discipline is active only under conditions explained below.</li> + +</ol> + +<p>Reference clock drivers operate in the manner described in the <A HREF="refclock.htm">Reference Clock Drivers</A> page and its dependencies. The drivers are ordinarily operated at stratum zero, so that as the result of ordinary NTP operations, the server itself operates at stratum one, as required by the NTP specification. In some cases described below, the driver is intentionally operated at an elevated stratum, so that it will be selected only if no other survivor is present with a lower stratum. In the case of the PPS peer or kernel time discipline, these sources appear active only if the prefer peer has survived the intersection and clustering algorithms, as described below, and its clock offset relative to the current local clock is less than a specified value, currently 128 ms. + +<p>The modem clock drivers are a special case. Ordinarily, the update interval between modem calls to synchronize the system clock is many times longer than the interval between polls of either a remote server or local radio clock. In order to provide the best stability, the operation of the clock discipline algorithm changes gradually from a phase-lock mode at the shorter update intervals to a frequency-lock mode at the longer update intervals. If remote servers or local radio clocks together with a modem peer operate in the same client, the following things can happen. + +<p>First the clock selection algorithm can select one or more remote servers or radio clocks and the clock discipline algorithm will optimize for the shorter update intervals. Then, the selection algorithm can select the modem peer, which requires a much different optimization. The intent in the design is to allow the modem peer to control the system clock either when no other source is available or, if the modem peer happens to be marked as prefer, then it always controls the clock, as long as it passes the sanity checks and intersection algorithm. There still is room for suboptimal operation in this scheme, since a noise spike can still cause a clockhop either way. Nevertheless, the optimization function is slow to adapt, so that a clockhop or two does not cause much harm. + +<p>The local clock driver is another special case. Normally, this driver is eligible for selection only if no other source is available. When selected, vernier adjustments introduced via the configuration file or remotely using the <tt><a href="ntpdc.htm">ntpdc</a> </tt>program can be used to trim the local clock frequency and time. However, if the local clock driver is designated the prefer peer, this driver is always selected and all other sources are ignored. This behavior is intended for use when the kernel time is controlled by some means external to NTP, such as the NIST <tt>lockclock</tt> algorithm or another time synchronization protocol such as DTSS. In this case the only way to disable the local clock driver is to mark it unsynchronized using the leap indicator bits. In the case of modified kernels with the <tt>ntp_adjtime()</tt> system call, this can be done automatically if the external synchronization protocol uses it to discipline the kernel time. + +<h4>Mitigation Rules</h4> + +The mitigation rules apply in the intersection and clustering algorithms described in the NTP specification. The intersection algorithm first scans all peers with a persistent association and includes only those that satisfy specified sanity checks. In addition to the checks required by the specification, the mitigation rules require either the local-clock peer or modem peer to be included only if marked as the prefer peer. The intersection algorithm operates on the included population to select only those peers believed to represent the correct time. If one or more peers survive the operation, processing continues in the clustering algorithm. Otherwise, if there is a modem peer, it is declared the only survivor; otherwise, if there is a local-clock peer, it is declared the only survivor. Processing then continues in the clustering algorithm. + +<p>The clustering algorithm repeatedly discards outlyers in order to reduce the residual jitter in the survivor population. As required by the NTP specification, these operations continue until either a specified minimum number of survivors remain or the minimum select dispersion of the population is greater than the maximum peer dispersion of any member. The mitigation rules require an additional terminating condition which stops these operations at the point where the prefer peer is about to be discarded. + +<p>The mitigation rules establish the choice of <i>system peer</i>, which determine the stratum, reference identifier and several other system variables which are visible to clients of the local server. In addition, they establish which source or combination of sources control the local clock. + +<ol> + +<li>If there is a prefer peer and it is the local-clock peer or the modem peer; or, if there is a prefer peer and the kernel time discipline is active, choose the prefer peer as the system peer and its offset as the system clock offset. If the prefer peer is the local-clock peer, an offset can be calculated by the driver to produce a frequency offset in order to correct for systematic frequency errors. In case a source other than NTP is controlling the system clock, corrections determined by NTP can be ignored by using the <tt>disable pll</tt> in the configuration file. If the prefer peer is the modem peer, it must be the primary source for the reasons noted above. If the kernel time discipline is active, the system clock offset is ignored and the corrections handled directly by the kernel.</li> + +<li>If the above is not the case and there is a PPS peer, then choose it as the system peer and its offset as the system clock offset.</li> + +<li>If the above is not the case and there is a prefer peer (not the local-clock or modem peer in this case), then choose it as the system peer and its offset as the system clock offset.</li> + +<li>If the above is not the case and the peer previously chosen as the system peer is in the surviving population, then choose it as the system peer and average its offset along with the other survivors to determine the system clock offset. This behavior is designed to avoid excess jitter due to clockhopping, when switching the system peer would not materially improve the time accuracy.</li> + +<li>If the above is not the case, then choose the first candidate in the list of survivors ranked in order of synchronization distance and average its offset along with the other survivors to determine the system clock offset. This is the default case and the only case considered in the current NTP specification.</li> + +</ol> + +<h4>Using the Pulse-per-Second (PPS) Signal</h4> + +Most radio clocks are connected using a serial port operating at speeds of 9600 bps or higher. The accuracy using typical timecode formats, where the on-time epoch is indicated by a designated ASCII character, like carriage-return <tt><cr></tt>, is limited to a millisecond at best and a few milliseconds in typical cases. However, some radios produce a PPS signal which can be used to improve the accuracy with typical workstation servers to the order of a few tens of microseconds. The details of how this can be accomplished are discussed in the <A HREF="pps.htm">Pulse-per-second (PPS) Signal Interfacing</A> page. The following paragraphs discuss how the PPS signal is affected by the mitigation rules. + +<p>First, it should be pointed out that the PPS signal is inherently ambiguous, in that it provides a precise seconds epoch, but does not provide a way to number the seconds. In principle and most commonly, another source of synchronization, either the timecode from an associated radio clock, or even one or more remote NTP servers, is available to perform that function. In all cases, a specific, configured peer or server must be designated as associated with the PPS signal. This is done using the <tt>prefer</tt> keyword as described previously. The PPS signal can be associated in this way with any peer, but is most commonly used with the radio clock generating the PPS signal. + +<p>The PPS signal can be used in two ways to discipline the local clock, one using a special PPS driver described in the <A HREF="driver22.htm">PPS Clock Discipline</A> page, the other using PPS signal support in the kernel, as described in the <A HREF="kern.htm">A Kernel Model for Precision Timekeeping</A> page. In either case, the signal must be present and within nominal jitter and wander error tolerances. In addition, the associated prefer peer must have survived the sanity checks and intersection algorithms and the dispersion settled below 1 s. This insures that the radio clock hardware is operating correctly and that, presumably, the PPS signal is operating correctly as well. Second, the absolute offset of the local clock from that peer must be less than 128 ms, or well within the 0.5-s unambiguous range of the PPS signal itself. In the case of the PPS driver, the time offsets generated from the PPS signal are propagated via the clock filter to the clock selection procedures just like any other peer. Should these pass the sanity checks and intersection algorithms, they will show up along with the offsets of the prefer peer itself. Note that, unlike the prefer peer, the PPS peer samples are not protected from discard by the clustering algorithm. These complicated procedures insure that the PPS offsets developed in this way are the most accurate, reliable available for synchronization. + +<p>The PPS peer remains active as long as it survives the intersection algorithm and the prefer peer is reachable; however, like any other clock driver, it runs a reachability algorithm on the PPS signal itself. If for some reason the signal fails or displays gross errors, the PPS peer will either become unreachable or stray out of the survivor population. In this case the clock selection remitigates as described above. + +<p>When kernel support for the PPS signal is available, the PPS signal is interfaced to the kernel serial driver code via a modem control lead. As the PPS signal is derived from external equipment, cables, etc., which sometimes fail, a good deal of error checking is done in the kernel to detect signal failure and excessive noise. The way in which the mitigation rules affect the kernel discipline is as follows. + +<p>PPS support requires the PPS driver (type 22) and PPSAPI interface described in the <a href=pps.htm>Pulse-per-second (PPS) Signal Interfacing></a> page. In order to operate, the prefer peer must be designated and the kernel support enabled by the <tt>enable pps</tt> command in the configuration file and the signal must be present and within nominal jitter and wander error tolerances. In the NTP daemon, the PPS discipline is active only when the prefer peer is among the survivors of the clustering algorithm, and its absolute offset is within 128 ms, as determined by the PPS driver. Under these conditions the kernel disregards updates produced by the NTP daemon and uses its internal PPS source instead. The kernel maintains a watchdog timer for the PPS signal; if the signal has not been heard or is out of tolerance for more than some interval, currently two minutes, the kernel discipline is declared inoperable and operation continues as if it were not present. + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/quick.htm b/contrib/ntp/html/quick.htm index 5ce0099..4eecf82 100644 --- a/contrib/ntp/html/quick.htm +++ b/contrib/ntp/html/quick.htm @@ -1,99 +1,100 @@ -<HTML><HEAD><TITLE> -Quick Start -</TITLE></HEAD><BODY><H3> -Quick Start -</H3> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Quick Start</title> +</head> +<body> +<h3>Quick Start</h3> -<img align=left src=pic/panda.gif>FAX test image for SATNET (1979). +<img align="left" src="pic/panda.gif" alt="gif">FAX test image for +SATNET (1979). <p>The baby panda was scanned at University College London and used as a FAX test image for a demonstration of the DARPA Atlantic -SATNET Program and the first transatlantic Internet connection in 1978. -The computing system used for that demonstration was called the <A -HREF="http://www.eecis.udel.edu/~mills/database/papers/fuzz.ps">Fuzzball -</A>. As it happened, this was also the first Internet multimedia -presentation and the first to use NTP in regular operation. The image -was widely copied and used for testing purpose throughout much of the -1980s. -<br clear=left> +SATNET Program and the first transatlantic Internet connection in +1978. The computing system used for that demonstration was called +the <a href= +"http://www.eecis.udel.edu/~mills/database/papers/fuzz.ps"> +Fuzzball</a> . As it happened, this was also the first Internet +multimedia presentation and the first to use NTP in regular +operation. The image was widely copied and used for testing purpose +throughout much of the 1980s.<br clear="left"> +</p> -<H4>Introduction</H4> +<hr> +<p>For the rank amateur the sheer volume of the documentation +collection must be intimidating. However, it doesn't take much to +fly the <tt>ntpd</tt> daemon with a simple configuration where a +workstation needs to synchronize to some server elsewhere in the +Internet. The first thing that needs to be done is to build the +distribution for the particular workstation and install in the +usual place. The <a href="build.htm">Building and Installing the +Distribution</a> page describes how to do this.</p> -<p>This page describes what to expect when the NTP daemon <tt>ntpd</tt> -is started for the first time. The discussion presumes the programs in -this distribution have been compiled and installed as described in the -<a href=build.htm>Building and Installing the Distribution</a> page. +<p>While it is possible that certain configurations do not need a +configuration file, most do require one. Strictly speaking, the +file need only contain one line specifying a remote server, for +instance</p> -<p>When the daemon is started, whether for the first or subsequent -times, a number of roundtrip samples are required to accumulate reliable -measurements of network path delay and clock offset relative to the -server. Normally, this takes about four minutes, after which the local -clock is synchronized to the server. The daemon behavior at startup -depends on whether a drift file <tt>ntp.drift</tt> exists. This file -contains the latest estimate of local clock frequency error. When the -daemon is started for the first time, it is created after about one hour -of operation and updated once each hour after that. When the daemon is -started and the file does not exist, the daemon enters a special mode -designed to quickly adapt to the particular system clock oscillator time -and frequency error. This takes approximately 15 minutes, after which -the time and frequency are set to nominal values and the daemon enters -normal mode, where the time and frequency are continuously tracked -relative to the server. +<p><tt>server foo.bar.com</tt></p> -<p>As a practical matter, once the local clock has been set, it very -rarely strays more than 128 ms relative to the server, even under -extreme cases of network path congestion and jitter. Sometimes, in -particular when the daemon is first started, the relative clock offset -exceeds 128 ms. In such cases the normal behavior of the daemon is to -set the clock directly, rather than rely on gradual corrections. This -may cause the clock to be set backwards, if the local clock time is more -than 128 s in the future relative to the server. In some applications, -this behavior may be unacceptable. If the <tt>-x</tt> option is included -on the command line that starts the daemon, the clock will never be -stepped and only slew corrections will be used. +<p>Choosing an appropriate remote server is somewhat of a black +art, but a suboptimal choice is seldom a problem. Links to public +time servers operated by National Institutes of Science and +Technology (NIST), US Naval Observatory (USNO), Canadian Metrology +Centre (CMC) and many others are given in the home page of this +document collection. The lists are sorted by country and, in the +case of the US, by state. Usually, the best choice is the nearest +in geographical terms, but the terms of engagement specified in +each list entry should be carefully respected.</p> -<p>The issues should be carefully explored before deciding to use the -<tt>-x</tt> option. The maximum slew rate possible is limited to 500 -parts-per-million (PPM) as a consequence of the correctness principles -on which the NTP protocol and algorithm design are based. As a result, -the local clock can take a long time to converge to an acceptable -offset, about 2000 s for each second the clock is outside the acceptable -range. During this interval the local clock will not be consistent with -any other network clock and the system cannot be used for distributed -applications that require correctly synchronized network time. +<p>During operation <tt>ntpd</tt> measures and corrects for +incidental clock frequency error and writes the current value to a +file if enabled. If the <tt>ntpd</tt> is stopped and restarted, it +initializes the frequency from this file. In this way the +potentially lengthy interval to relearn the frequency error is +avoided. Thus, for most applications an additional line should be +added to the file of the form</p> -<p>There may be an occasional outlyer, where an individual measurement -exceeds 128 ms. When the frequency of occurrence of these outlyers is -low, the measurement is discarded and operation continues with the next -one. However, if the outlyers persist for an interval longer than about -15 minutes, the next value is believed and the clock stepped or slewed -as determined by the <tt>-x</tt> option. The usual reason for this -behavior is when a leap second has occurred, but the reference clock -receiver has not synchronized to it. When leap second support is -implemented in the kernel, the kernel implements it as directed by the -NTP daemon. If this happens and the reference clock source -resynchronizes correctly within 15 minutes, the transient misbehavior of -the source is transparent. +<p><tt>driftfile /etc/ntp.drift</tt></p> -<p>It has been observed that, as the result of extreme network -congestion, the roundtrip delays can exceed three seconds and the -synchronization distance, which is equal to one-half the roundtrip delay -plus the error budget terms, can become very large. When the -synchronization distance exceeds one second, the offset measurement is -discarded. If this condition persists for several poll intervals, the -server may be declared unreachable. Sometimes the large jitter results -in large frequency errors which result in straying outside the -acceptable offset range and an eventual step or slew time correction. If -following such a correction the frequency error is so large that the -first sample is outside the acceptable range, the daemon enters the same -state as when the <tt>ntp.drift</tt> file is not present. The intent of -this behavior is to quickly correct the frequency and restore operation -to the normal tracking mode. In the most extreme cases -(<tt>time.ien.it</tt> comes to mind), there may be occasional step/slew -corrections and subsequent frequency corrections. It helps in these -cases to use burst mode when configuring the server. +<p>That's all there is to it, unless some problem in network +connectivity or local operating system configuration occurs. The +most common problem is some firewall between the workstation and +server. System administrators should understand NTP uses UDP port +123 as both the source and destination port and that NTP does not +involve any operating system interaction other than to set the +system clock. While almost all modern Unix systems have included +NTP and UDP port 123 defined in the services file, this should be +checked if <tt>ntpd</tt> fails to come up at all.</p> -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +<p>The best way to confirm NTP is working is using the <a href= +"ntpq.htm"><tt>ntpq</tt></a> utility, although the <a href= +"ntpdc.htm"><tt>ntpdc</tt></a> utility may be useful in extreme +cases. See the documentation pages for further information. In the +most extreme cases the <tt>-d</tt> option on the <tt>ntpd</tt> +command line results in a blow-by-blow trace of the daemon +operations. While the trace output can be cryptic, to say the +least, it gives a general idea of what the program is doing and, in +particular, details the arriving and departing packets and detected +errors, if present.</p> + +<p>Sometimes the <tt>ntpd</tt>. behavior may seem to violate the +Principle of Least Astonishment, but there are good reasons for +this. See the <a href="ntpd.htm">Network Time Protocol (NTP) +daemon</a> page for revealing insights. See this page and its +dependencies for additional configuration and control options. The +<a href="notes.htm">Notes on Configuring NTP and Setting up a NTP +Subnet</a> page contains an extended discussion of these +options.</p> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> diff --git a/contrib/ntp/html/rdebug.htm b/contrib/ntp/html/rdebug.htm index 472b09f..bc998ca 100644 --- a/contrib/ntp/html/rdebug.htm +++ b/contrib/ntp/html/rdebug.htm @@ -1,67 +1,25 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN"> <html><head><title> Debugging Hints for Reference Clock Drivers </title></head><body><h3> Debugging Hints for Reference Clock Drivers -</h3><hr> +</h3> -<p>The <a href = "ntpq.htm"> <code>ntpq</code></a> and <a href = -"ntpdc.htm"> <code>ntpdc</code> </a>utility programs can be used to -debug reference clocks, either on the server itself or from another -machine elsewhere in the network. The server is compiled, installed and -started using the command-line switches described in the <a href = -"ntpd.htm"> <code>ntpd</code> </a> page. The first thing to look for -are error messages on the system log. If none occur, the daemon has -started, opened the devices specified and waiting for peers and radios -to come up. +<img align=left src=pic/oz2.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>The +Wizard of Oz</i>, L. Frank Baum</a> -<p>The next step is to be sure the RS232 messages, if used, are getting -to and from the clock. The most reliable way to do this is with an RS232 -tester and to look for data flashes as the driver polls the clock and/or -as data arrive from the clock. Our experience is that the overwhelming -fraction of problems occurring during installation are due to problems -such as miswired connectors or improperly configured device links at -this stage. +<p>Call the girls and the'll sweep your bugs. +<br clear=left><hr> -<p>If RS232 messages are getting to and from the clock, the variables of -interest can be inspected using the <code>ntpq</code> program and -various commands described on the documentation page. First, use the -<code>pe</code> and <code>as</code> commands to display billboards -showing the peer configuration and association IDs for all peers, -including the radio clock peers. The assigned clock address should -appear in the <code>pe</code> billboard and the association ID for it at -the same relative line position in the <code>as</code> billboard. If -things are operating correctly, after a minute or two samples should -show up in the <code>pe</code> display line for the clock. +<p>The <a href=ntpq.htm><tt>ntpq</tt></a> and <a href=ntpdc.htm><tt>ntpdc</tt></a> utility programs can be used to debug reference clocks, either on the server itself or from another machine elsewhere in the network. The server is compiled, installed and started using the configuration file described in the <a href=ntpd.htm><tt>ntpd</tt></a> page and its dependencies. If the clock appears in the <tt>ntpq</tt> utility and <tt>pe</tt> command, no errors have occured and the daemon has started, opened the devices specified and waiting for peers and radios to come up. If not, the first thing to look for are error messages on the system log. These are usually due to improper configuration, missing links or multiple instances of the daemon. -<p>Additional information is available with the <code>rv</code> and -<code>clockvar</code> commands, which take as argument the association -ID shown in the <code>as</code> billboard. The <code>rv</code> command -with no argument shows the system variables, while the <code>rv</code> -command with association ID argument shows the peer variables for the -clock, as well as any other peers of interest. The <code>clockvar</code> -command with argument shows the peer variables specific to reference -clock peers, including the clock status, device name, last received -timecode (if relevant), and various event counters. In addition, a -subset of the <code>fudge</code> parameters is included. +<p>It normally takes a minute or so for evidence to appear that the clock is running and the driver is operating correctly. The first indication is a nonzero value in the <tt>reach</tt> column in the <tt>pe</tt> billboard. If nothing appears after a few minutes, the next step is to be sure the RS232 messages, if used, are getting to and from the clock. The most reliable way to do this is with an RS232 tester and to look for data flashes as the driver polls the clock and/or as data arrive from the clock. Our experience is that the overwhelming fraction of problems occurring during installation are due to problems such as miswired connectors or improperly configured device links at this stage. -<p>The <code>ntpdc</code> utility program can be used for detailed -inspection of the clock driver status. The most useful are the -<code>clockstat</code> and <code>clkbug</code> commands described in the -document page. While these commands permit getting quite personal with -the particular driver involved, their use is seldom necessary, unless an -implementation bug shows up. +<p>If RS232 messages are getting to and from the clock, the variables of interest can be inspected using the <tt>ntpq</tt> program and various commands described on the documentation page. First, use the <tt>pe</tt> and <tt>as</tt> commands to display billboards showing the peer configuration and association IDs for all peers, including the radio clock. The assigned clock address should appear in the <tt>pe</tt> billboard and the association ID for it at the same relative line position in the <tt>as</tt> billboard. -<p>Most drivers write a message to the <code>clockstats</code> file as -each timecode or surrogate is received from the radio clock. By -convention, this is the last ASCII timecode (or ASCII gloss of a binary- -coded one) received from the radio clock. This file is managed by the -<code>filegen</code> facility described in the <code>ntpd</code> page -and requires specific commands in the configuration file. This forms a -highly useful record to discover anomalies during regular operation of -the clock. The scripts included in the <code>./scripts/stats</code> -directory can be run from a <code>cron</code> job to collect and -summarize these data on a daily or weekly basis. The summary files have -proven invaluable to detect infrequent misbehavior due to clock -implementation bugs in some radios. -<hr><address>David L. Mills (mills@udel.edu)</address></body></html> +<p>Additional information is available with the <tt>rv</tt> and <tt>clockvar</tt> commands, which take as argument the association ID shown in the <tt>as</tt> billboard. The <tt>rv</tt> command with no argument shows the system variables, while the <tt>rv</tt> command with association ID argument shows the peer variables for the clock, as well as other peers of interest. The <tt>clockvar</tt> command with argument shows the peer variables specific to reference clock peers, including the clock status, device name, last received timecode (if relevant), and various event counters. In addition, a subset of the <tt>fudge</tt> parameters is included. The poll and error counters in the <tt>clockvar</tt> billboard are useful debugging aids. The <tt>poll</tt> counts the poll messages sent to the clock, while the <tt>noreply</tt>, <tt>badformat</tt> and <tt>baddate</tt> count various errors. Check the timecode to be sure it matches what the driver expects. This may require consulting the clock hardware reference manual, which is probably pretty dusty at this stage. + +<p>The <tt>ntpdc</tt> utility program can be used for detailed inspection of the clock driver status. The most useful are the <tt>clockstat</tt> and <tt>clkbug</tt> commands described in the document page. While these commands permit getting quite personal with the particular driver involved, their use is seldom necessary, unless an implementation bug shows up. If all else fails, turn on the debugging trace using two <tt>-d</tt> flags in the <tt>ntpd</tt> startup command line. Most drivers will dump status at every received message in this case. While the displayed trace can be intimidating, this provides the most detailed and revealing indicator of how the driver and clock are performing and where bugs might lurk. + +<p>Most drivers write a message to the <tt>clockstats</tt> file as each timecode or surrogate is received from the radio clock. By convention, this is the last ASCII timecode (or ASCII gloss of a binary-coded one) received from the radio clock. This file is managed by the <tt>filegen</tt> facility described in the <tt>ntpd</tt> page and requires specific commands in the configuration file. This forms a highly useful record to discover anomalies during regular operation of the clock. The scripts included in the <tt>./scripts/stats</tt> directory can be run from a <tt>cron</tt> job to collect and summarize these data on a daily or weekly basis. The summary files have proven inspirational to detect infrequent misbehavior due to clock implementation bugs in some radios. + +<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a href=mailto:mills@udel.edu>David L. Mills <mills@udel.edu></a></address></a></body></html> diff --git a/contrib/ntp/html/refclock.htm b/contrib/ntp/html/refclock.htm index 80c62a2..4b2611d 100644 --- a/contrib/ntp/html/refclock.htm +++ b/contrib/ntp/html/refclock.htm @@ -1,157 +1,250 @@ -<html><head><title> -Reference Clock Drivers -</title></head><body><h3> -Reference Clock Drivers -</H3> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>Reference Clock Drivers</title> +</head> +<body> +<h3>Reference Clock Drivers</h3> -<IMG ALIGN=LEFT SRC=pic/tardisa.gif>From top: +<img align="left" src="pic/stack1a.jpg" alt="gif">Master Time +Facility at the <a href="http://www.eecis.udel.edu/~mills/lab.htm"> +UDel Internet Research Laboratory</a>: <br clear="left"> +<hr> +<p>Support for most of the commonly available radio and modem +reference clocks is included in the default configuration of the +NTP daemon for Unix <tt>ntpd</tt>. Individual clocks can be +activated by configuration file commands, specifically the <tt> +server</tt> and <tt>fudge</tt> commands described in the <a href= +"ntpd.htm"><tt>ntpd</tt> program manual page</a>. The following +discussion presents Information on how to select and configure the +device drivers in a running Unix system.</p> + +<p>Many radio reference clocks can be set to display local time as +adjusted for timezone and daylight saving mode. For use with NTP +the clock must be set for Coordinated Universal Time (UTC) only. +Ordinarily, these adjustments are performed by the kernel, so the +fact that the clock runs on UTC will be transparent to the +user.</p> + +<p>Radio and modem clocks by convention have addresses in the form +127.127.<i>t.u</i>, where <i>t</i> is the clock type and <i>u</i> +is a unit number in the range 0-3 used to distinguish multiple +instances of clocks of the same type. Most of these clocks require +support in the form of a serial port or special bus peripheral, but +some can work directly from the audio codec found in some +workstations. The particular device is normally specified by adding +a soft link <tt>/dev/device<i>u</i></tt> to the particular hardware +device involved, where <i><tt>u</tt></i> correspond to the unit +number above.</p> + +<p>Most clock drivers communicate with the reference clock using a +serial port, usually at 9600 bps. There are several application +program interfaces (API) used in the various Unix and NT systems, +most of which can be detected at configuration time. Thus, it is +important that the NTP daemon and utilities be compiled on the +target system or clone. In some cases special features are +available, such as timestamping in the kernel or pulse-per-second +(PPS) interface. In most cases these features can be detected at +configuration time as well; however, the kernel may have to be +recompiled in order for them to work.</p> + +<p>The audio drivers are a special case. These include support for +the NIST time/frequency stations WWV and WWVH, the Canadian +time/frequency station CHU and generic IRIG signals. Currently, +support for the Solaris and SunOS audio API is included in the +distribution. It is left to the volunteer corps to extend this +support to other systems. Further information on hookup, debugging +and monitoring is given in the <a href="audio.htm">Audio +Drivers</a> page.</p> + +<p>The local clock driver is also a special case. A server +configured with this driver can operate as a primary server to +synchronize other clients when no other external synchronization +sources are available. If the server is connected directly or +indirectly to the public Internet, there is some danger that it can +adversely affect the operation of unrelated clients. Carefully read +the <a href="driver1.htm">Undisciplined Local Clock</a> page and +respect the stratum limit.</p> + +<p>The local clock driver also supports an external synchronization +source such as a high resolution counter disciplined by a GPS +receiver, for example. Further information is on the <a href= +"extern.htm">External Clock Discipline and the Local Clock +Driver</a> page.</p> + +<h4>Driver Calibration</h4> + +<p>Some drivers depending on longwave and shortwave radio services +need to know the radio propagation time from the transmitter to the +receiver, which can amount to some tens of milliseconds. This must +be calculated for each specific receiver location and requires the +geographic coordinates of both the transmitter and receiver. The +transmitter coordinates for various radio services are given in the +<a href="qth.htm">Stations, Frequencies and Geographic +Coordinates</a> page. Receiver coordinates can be obtained or +estimated from various sources. The actual calculations are beyond +the scope of this document.</p> -<UL> +<p>When more than one clock driver is supported, it is often the +case that each shows small systematic offset differences relative +to the rest. To reduce the effects of jitter when switching from +one driver to the another, it is useful to calibrate the drivers to +a common ensemble offset. The <tt>enable calibrate</tt> +configuration command in the <a href="miscopt.htm">Miscellaneous +Options</a> page is useful for this purpose. The calibration +function can also be enabled and disabled using the <tt>ntpdc</tt> +program utility.</p> -<LI>Austron 2100A GPS Receiver with LORAN-C assist</LI> -<LI>Austron 2000 LORAN-C Receiver></LI> -<LI>Spectracom 8170 WWVB Receiver</LI> -<LI>Hewlett Packard 5061A Cesium Beam Standard</LI> +<p>Most clock drivers use the <tt>time1</tt> value specified in the +<tt>fudge</tt> configuration command to provide the calibration +correction when this cannot be provided by the clock or interface. +When the calibration function is enabled, the <tt>time1</tt> value +is automatically adjusted to match the offset of the remote server +or local clock driver selected for synchronization. Ordinarily, the +NTP selection algorithm chooses the best from among all sources, +usually the best radio clock determined on the basis of stratum, +synchronization distance and jitter. The calibration function +adjusts the <tt>time1</tt> values for all clock drivers except this +source so that their indicated offsets tend to zero. If the +selected source is the kernel PPS discipline, the <tt>fudge +time1</tt> values for all clock drivers are adjusted.</p> -</UL> +<p>The adjustment function is an exponential average designed to +improve accuracy, so the function takes some time to converge. The +recommended procedure is to enable the function, let it run for an +hour or so, then edit the configuration file using the <tt> +time1</tt> values displayed by the <tt>ntpq</tt> utility and <tt> +clockvar</tt> command. Finally, disable the calibration function to +avoid possible future disruptions due to misbehaving clocks or +drivers.</p> + +<h4>Performance Enhancements</h4> + +<p>In general, performance can be improved, especially when more +than one clock driver is supported, to use the prefer peer function +described in the <a href="prefer.htm">Mitigation Rules and the <tt> +prefer</tt> Keyword</a> page. The prefer peer is ordinarily +designated the remote peer or local clock driver which provides the +best quality time. All other things equal, only the prefer peer +source is used to discipline the system clock and jitter-producing +"clockhopping" between sources is avoided. This is valuable when +more than one clock driver is present and especially valuable when +the PPS clock driver (type 22) is used. Support for PPS signals is +summarized in the <a href="pps.htm">Pulse-per-second (PPS) Signal +Interfacing</a> page.</p> + +<p>Where the highest performance is required, generally better than +one millisecond, additional hardware and/or software functions may +be required. Kernel modifications for precision time are described +in the <a href="kern.htm">A Kernel Model for Precision +Timekeeping</a> page. Special line discipline and streams modules +for use in capturing precision timestamps are described in the <a +href="ldisc.htm">Line Disciplines and Streams Drivers</a> page.</p> + +<h4>Comprehensive List of Clock Drivers</h4> + +<p>Following is a list showing the type and title of each driver +currently implemented. The compile-time identifier for each is +shown in parentheses. Click on a selected type for specific +description and configuration documentation, including the clock +address, reference ID, driver ID, device name and serial line +speed, and features (line disciplines, etc.). For those drivers +without specific documentation, please contact the author listed in +the <a href="copyright.htm">Copyright Notice</a> page.</p> + +<p><a href="driver1.htm">Type 1</a> Undisciplined Local Clock +(<tt>LOCAL</tt>)<br> +<a href="driver2.htm">Type 2</a> Trak 8820 GPS Receiver +(<tt>GPS_TRAK</tt>)<br> +<a href="driver3.htm">Type 3</a> PSTI/Traconex 1020 WWV/WWVH +Receiver (<tt>WWV_PST</tt>)<br> +<a href="driver4.htm">Type 4</a> Spectracom WWVB and GPS Receivers +(<tt>WWVB_SPEC</tt>)<br> +<a href="driver5.htm">Type 5</a> TrueTime GPS/GOES/OMEGA Receivers +(<tt>TRUETIME</tt>)<br> +<a href="driver6.htm">Type 6</a> IRIG Audio Decoder +(<tt>IRIG_AUDIO</tt>)<br> +<a href="driver7.htm">Type 7</a> Radio CHU Audio +Demodulator/Decoder (<tt>CHU</tt>)<br> +<a href="driver8.htm">Type 8</a> Generic Reference Driver +(<tt>PARSE</tt>)<br> +<a href="driver9.htm">Type 9</a> Magnavox MX4200 GPS Receiver +(<tt>GPS_MX4200</tt>)<br> +<a href="driver10.htm">Type 10</a> Austron 2200A/2201A GPS +Receivers (<tt>GPS_AS2201</tt>)<br> +<a href="driver11.htm">Type 11</a> Arbiter 1088A/B GPS Receiver +(<tt>GPS_ARBITER</tt>)<br> +<a href="driver12.htm">Type 12</a> KSI/Odetics TPRO/S IRIG +Interface (<tt>IRIG_TPRO</tt>)<br> +Type 13 Leitch CSD 5300 Master Clock Controller +(<tt>ATOM_LEITCH</tt>)<br> +Type 14 EES M201 MSF Receiver (<tt>MSF_EES</tt>)<br> +<a href="driver5.htm">Type 15</a> * TrueTime generic receivers<br> +<a href="driver16">Type 16</a> Bancomm GPS/IRIG Receiver +(<tt>GPS_BANCOMM</tt>)<br> +Type 17 Datum Precision Time System (<tt>GPS_DATUM</tt>)<br> +<a href="driver18.htm">Type 18</a> NIST Modem Time Service +(<tt>ACTS_NIST</tt>)<br> +<a href="driver19.htm">Type 19</a> Heath WWV/WWVH Receiver +(<tt>WWV_HEATH</tt>)<br> +<a href="driver20.htm">Type 20</a> Generic NMEA GPS Receiver +(<tt>NMEA</tt>)<br> +Type 21 TrueTime GPS-VME Interface (<tt>GPS_VME</tt>)<br> +<a href="driver22.htm">Type 22</a> PPS Clock Discipline +(<tt>PPS</tt>)<br> +<a href="driver23.htm">Type 23</a> PTB Modem Time Service +(<tt>ACTS_PTB</tt>)<br> +<a href="driver24.htm">Type 24</a> USNO Modem Time Service +(<tt>ACTS_USNO</tt>)<br> +<a href="driver5.htm">Type 25</a> * TrueTime generic receivers<br> +<a href="driver26.htm">Type 26</a> Hewlett Packard 58503A GPS +Receiver (<tt>GPS_HP</tt>)<br> +<a href="driver27.htm">Type 27</a> Arcron MSF Receiver +(<tt>MSF_ARCRON</tt>)<br> +<a href="driver28.htm">Type 28</a> Shared Memory Driver +(<tt>SHM</tt>)<br> +<a href="driver29.htm">Type 29</a> Trimble Navigation Palisade GPS +(<tt>GPS_PALISADE</tt>)<br> +<a href="driver30.htm">Type 30</a> Motorola UT Oncore GPS +(<tt>GPS_ONCORE</tt>)<br> +Type 31 Rockwell Jupiter GPS (<tt>GPS_JUPITER</tt>)<br> +<a href="driver32.htm">Type 32</a> Chrono-log K-series WWVB +receiver <a href="driver33.htm">Type 33</a> Dumb Clock <a href= +"driver34.htm">Type 34</a> Ultralink WWVB Receivers<br> +<a href="driver35.htm">Type 35</a> Conrad Parallel Port Radio Clock +(<tt>PCF</tt>)<br> +<a href="driver36.htm">Type 36</a> Radio WWV/H Audio +Demodulator/Decoder(<tt>WWV</tt>)<br> +<a href="driver37.htm">Type 37</a> Forum Graphic GPS Dating station +(<tt>FG</tt>)<br> +<a href="driver38.htm">Type 38</a> hopf GPS/DCF77 6021/komp for +Serial Line (<tt>HOPF_S</tt>)<br> +<a href="driver39.htm">Type 39</a> hopf GPS/DCF77 6039 for PCI-Bus +(<tt>HOPF_P</tt>)</p> + +<p>* All TrueTime receivers are now supported by one driver, type +5. Types 15 and 25 will be retained only for a limited time and may +be reassigned in future.</p> + +<p>Additional Information</p> + +<p><a href="prefer.htm">Mitigation Rules and the <tt>prefer</tt> +Keyword</a><br> +<a href="rdebug.htm">Debugging Hints for Reference Clock +Drivers</a><br> +<a href="kern.htm">A Kernel Model for Precision Timekeeping</a><br> +<a href="ldisc.htm">Line Disciplines and Streams Drivers</a><br> +<a href="audio.htm">Reference Clock Audio Drivers</a><br> +<a href="pps.htm">Pulse-per-second (PPS) Signal Interfacing</a><br> +<a href="howto.htm">How To Write a Reference Clock Driver</a></p> -<br clear=left> -The Tardis <hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> -Support for most of the commonly available radio and modem reference -clocks is included in the default configuration of the NTP daemon for -Unix <TT>ntpd</TT>. Individual clocks can be activated by configuration -file commands, specifically the <TT>server</TT> and <TT>fudge</TT> -commands described in the <A HREF=ntpd.htm><TT>ntpd</TT> program manual -page</A>. The following discussion presents Information on how to select -and configure the device drivers in a running Unix system. - -<P>Radio and modem clocks by convention have addresses in the form -127.127.<I>t.u</I>, where <I>t</I> is the clock type and <I>u</I> is a -unit number in the range 0-3 used to distinguish multiple instances of -clocks of the same type. Most of these clocks require support in the -form of a serial port or special bus peripheral, but some can work -directly from the audio codec found in some workstations. The particular -device is normally specified by adding a soft link -<TT>/dev/device<I>u</I></TT> to the particular hardware device involved, -where <I><TT>u</TT></I> correspond to the unit number above. +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> -<p>Most clock drivers communicate with the reference clock using a -serial port, usually at 9600 bps. There are several application program -interfaces (API) used in the various Unix and NT systems, most of which -can be detected at configuration time. Thus, it is important that the -NTP daemon and utilities be compiled on the target system or clone. In -some cases special features are available, such as timestamping in the -kernel or pulse-per-second (PPS) interface. In most cases these features -can be detected at configuration time as well; however, the kernel may -have to be recompiled in order for them to work. - -<p>The audio drivers are a special case. These include support for the -NIST time/frequency stations WWV and WWVH, the Canadian time/frequency -station CHU and generic IRIG signals. Currently, support for the Solaris -and SunOS audio API is included in the distribution. It is left to the -volunteer corps to extend this support to other systems. Further -information on hookup, debugging and monitoring is given in the <a -href=audio.htm>Audio Drivers</a> page. - -<p>Some drivers depending on longwave and shortwave radio services need -to know the radio propagation time from the transmitter to the receiver, -which can amount to some tens of milliseconds. This must be calculated -for each specific receiver location and requires the geographic -coordinates of both the transmitter and receiver. The transmitter -coordinates for various radio services are given in the <a -href=qth.htm>Stations, Frequencies and Geographic Coordinates</a> page. -Receiver coordinates can be obtained or estimated from various sources. -The actual calculations are beyond the scope of this document. - -<P>Following is a list showing the type and title of each driver -currently implemented. The compile-time identifier for each is shown in -parentheses. Click on a selected type for specific description and -configuration documentation, including the clock address, reference ID, -driver ID, device name and serial line speed, and features (line -disciplines, etc.). For those drivers without specific documentation, -please contact the author listed in the <A HREF=copyright.htm>Copyright -Notice</A> page. - -<P><A HREF=driver1.htm>Type 1</A> Undisciplined Local Clock -(<TT>LOCAL</TT>) -<BR><A HREF=driver2.htm>Type 2</A> Trak 8820 GPS Receiver -(<TT>GPS_TRAK</TT>) -<BR><A HREF=driver3.htm>Type 3</A> PSTI/Traconex 1020 WWV/WWVH -Receiver -(<TT>WWV_PST</TT>) -<BR><A HREF=driver4.htm>Type 4</A> Spectracom WWVB and GPS Receivers -(<TT>WWVB_SPEC</TT>) -<BR><A HREF=driver5.htm>Type 5</A> TrueTime GPS/GOES/OMEGA Receivers -(<TT>TRUETIME</TT>) -<BR><A HREF=driver6.htm>Type 6</A> IRIG Audio Decoder -(<TT>IRIG_AUDIO</TT>) -<BR><A HREF=driver7.htm>Type 7</A> Radio CHU Audio Demodulator/Decoder -(<TT>CHU</TT>) -<BR><A HREF=driver8.htm>Type 8</A> Generic Reference Driver -(<TT>PARSE</TT>) -<BR><A HREF=driver9.htm>Type 9</A> Magnavox MX4200 GPS Receiver -(<TT>GPS_MX4200</TT>) -<BR><A HREF=driver10.htm>Type 10</A> Austron 2200A/2201A GPS Receivers -(<TT>GPS_AS2201</TT>) -<BR><A HREF=driver11.htm>Type 11</A> Arbiter 1088A/B GPS Receiver -(<TT>GPS_ARBITER</TT>) -<BR><A HREF=driver12.htm>Type 12</A> KSI/Odetics TPRO/S IRIG Interface -(<TT>IRIG_TPRO</TT>) -<BR>Type 13 Leitch CSD 5300 Master Clock Controller -(<TT>ATOM_LEITCH</TT>) -<BR>Type 14 EES M201 MSF Receiver (<TT>MSF_EES</TT>) -<BR><A HREF=driver5.htm>Type 15</A> * TrueTime generic receivers -<BR>Type 16 Bancomm GPS/IRIG Receiver (<TT>GPS_BANCOMM</TT>) -<BR>Type 17 Datum Precision Time System (<TT>GPS_DATUM</TT>) -<BR><A HREF=driver18.htm>Type 18</A> NIST Modem Time Service -(<TT>ACTS_NIST</TT>) -<BR><A HREF=driver19.htm>Type 19</A> Heath WWV/WWVH Receiver -(<TT>WWV_HEATH</TT>) -<BR><A HREF=driver20.htm>Type 20</A> Generic NMEA GPS Receiver -(<TT>NMEA</TT>) -<BR>Type 21 TrueTime GPS-VME Interface (<TT>GPS_VME</TT>) -<BR><A HREF=driver22.htm>Type 22</A> PPS Clock Discipline -(<TT>PPS</TT>) -<BR><A HREF=driver23.htm>Type 23</A> PTB Modem Time Service -(<TT>ACTS_PTB</TT>) -<BR><A HREF=driver24.htm>Type 24</A> USNO Modem Time Service -(<TT>ACTS_USNO</TT>) -<BR><A HREF=driver5.htm>Type 25</A> * TrueTime generic receivers -<BR><A HREF=driver26.htm>Type 26</A> Hewlett Packard 58503A GPS -Receiver (<TT>GPS_HP</TT>) -<BR><A HREF=driver27.htm>Type 27</A> Arcron MSF Receiver -(<TT>MSF_ARCRON</TT>) -<BR><A HREF=driver28.htm>Type 28</A> Shared Memory Driver -(<TT>SHM</TT>) -<BR><A HREF=driver29.htm>Type 29</A> Trimble Navigation Palisade GPS -(<TT>GPS_PALISADE</TT>) -<BR><A HREF=driver30.htm>Type 30</A> Motorola UT Oncore GPS -(<TT>GPS_ONCORE</TT>) -<BR>Type 31 Rockwell Jupiter GPS (<TT>GPS_JUPITER</TT>) -<BR><A HREF=driver34.htm>Type 34</A> Ultralink WWVB Receivers -<BR><A HREF=driver35.htm>Type 35</A> Conrad Parallel Port Radio Clock -(<TT>PCF</TT>) -<BR><A HREF=driver36.htm>Type 36</A> Radio WWV/H Audio -Demodulator/Decoder(<TT>WWV</TT>) -<BR><A HREF=driver37.htm>Type 37</A> Forum Graphic GPS Dating station -(<TT>FG</TT>) - -<P>* All TrueTime receivers are now supported by one driver, type 5. -Types 15 and 25 will be retained only for a limited time and may be -reassigned in future. -<P>Additional Information -<P><A HREF=prefer.htm>Mitigation Rules and the <TT>prefer</TT> -Keyword</A> -<BR><A HREF=rdebug.htm>Debugging Hints for Reference Clock Drivers</A> -<BR><A HREF=ldisc.htm>Line Disciplines and Streams Drivers</A> -<BR><A HREF=audio.htm>Reference Clock Audio Drivers</A> -<BR><A HREF=pps.htm>Pulse-per-second (PPS) Signal Interfacing</A> -<BR><A HREF=howto.htm>How To Write a Reference Clock Driver</A> -<BR><A HREF=index.htm>The Network Time Protocol (NTP) -Distribution </A> - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> diff --git a/contrib/ntp/html/release.htm b/contrib/ntp/html/release.htm index 8b29cb9..9dcef7c 100644 --- a/contrib/ntp/html/release.htm +++ b/contrib/ntp/html/release.htm @@ -1,199 +1,290 @@ -<HTML><HEAD><TITLE> -NTP Version 4 Release Notes -</TITLE></HEAD><BODY><H3> -NTP Version 4 Release Notes -</H3> - -<IMG align=left SRC=pic/hornraba.gif> <i>Alice's Adventures in -Wonderland</i>, by Lewis Carroll, illustrations by Sir John Tenniel -<BR clear=left><HR> - -<H4>NTP Version 4 Release Notes</H4> - -This release of the NTP Version 4 (NTPv4) daemon for Unix incorporates -new features and refinements to the NTP Version 3 (NTPv3) algorithms. -However, it continues the tradition of retaining backwards compatibility -with older versions. The NTPv4 version has been under development for -quite a while and isn't finished yet. In fact, quite a number of NTPv4 -features have already been implemented in the current NTPv3. The primary -purpose of this release is to verify the remaining new code compiles and -runs in the various architectures, operating systems and hardware -complement that can't be verified here. Of particular interest are -Windows NT, VMS and various reference clock drivers. As always, -corrections and bugfixes are warmly received, especially in the form of -context diffs. - -<P>This note summarizes the differences between this software release of -NTPv4, called ntp-4.x.x, and the previous NTPv3 version, called -xntp3-5.x.x - -<OL> - -<P><LI>Most of the extensive calculations are now done using 64-bit -floating-point format, rather than 64-bit fixed-point format. The -motivation for this is to reduce size, improve speed and avoid messy -bounds checking. Workstations of today are much faster than when the -original NTP version was designed in the early 1980s, and it is rare to -find a processor architecture that does not support it. The fixed-point -format is still used with raw timestamps, in order to retain the full -precision of about 212 picoseconds. However, the algorithms which -process raw timestamps all produce fixed-point differences before -converting to double. The differences are ordinarily quite small -so can be expressed without loss of accuracy in double format.</LI> - -<P><LI>The clock discipline algorithm has been redesigned to improve -accuracy, reduce the impact of network jitter and allow an increase in -poll intervals to well over one day with only moderate sacrifice in -accuracy. The NTPv4 design allows servers to increase the poll intervals -even when synchronized directly to the peer. In NTPv3 the poll interval -in such cases was clamped to the minimum, usually 64 s. For those -servers with hundreds of clients, the new design can dramatically reduce -the network load.</LI> - -<P><LI>A <A HREF=assoc.htm>burst-mode</A> feature is available which -results in good accuracy with intermittent connections typical of PPP -and ISDN services. When enabled, at each poll interval the server sends -eight messages over the next 30-s interval and processes them in a -batch. Outlyers due to initial dial-up delays, etc., are avoided and the -server synchronizes with its peer generally within 30 s.</LI> - -<P><LI>In addition to the NTPv3 authentication scheme, which uses -private-key cryptography, a new NTPv4 <A HREF=authopt.htm>autokey -</A>authentication scheme is available. Autokey uses public-key -technology and avoids the need to distribute keys by separate means. The -design is such that full accuracy is available without degradation due -to processing demands of the public-key routines. It can be used in any -of the NTP association modes, but is most useful in broadcast/multicast -modes.</LI> - -<P><LI>NTPv4 includes two new association modes which in most -applications can avoid per-host configuration altogether. Both of these -are based on multicast technology. They provide for automatic discovery -and configuration of servers and clients. In <A HREF=assoc.htm>multicast -</A>mode, a server sends a message at fixed intervals using specified -multicast addresses, while clients listen on these addresses. Upon -receiving the message, a client exchanges several messages with the -server in order to calibrate the multicast propagation delay between the -client and server. In <A HREF=assoc.htm>manycast </A>mode, a client -sends a message and expects one or more servers to reply. Using -engineered algorithms, the client selects an appropriate subset of -servers from the messages received and continues in ordinary -client/server operation with them. The manycast scheme can provide +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>NTP Version 4 Release Notes</title> +</head> +<body> +<h3>NTP Version 4 Release Notes</h3> + +<img align="left" src="pic/hornraba.gif" alt="gif"><a href= +"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's +Adventures in Wonderland</i>, Lewis Carroll</a> + +<p>The rabbit toots to make sure you read this.<br clear="left"> +</p> + +<hr> +<p>This document was last updated 4 May 2001</p> + +<h4>NTP Version 4 Release Notes</h4> + +<p>This release of the NTP Version 4 (NTPv4) daemon for Unix, VMS +and Windows (NT4 and 2000) incorporates new features and +refinements to the NTP Version 3 (NTPv3) algorithms. However, it +continues the tradition of retaining backwards compatibility with +older versions, except for symmetric mode in NTPv1. Client/server +mode continues to be supported in NTPv1. The NTPv4 version has been +under development for quite a while and isn't finished yet. In +fact, quite a number of NTPv4 features have already been +retrofitted in the current NTPv3, although this version is not +actively maintained by the NTPv4 developer's group.</p> + +<p>The primary purpose of this release is to verify the remaining +new code compiles and runs in the various architectures, operating +systems and hardware complement that can't be verified here. Of +particular interest are Windows 2000, VMS and various reference +clock drivers. As always, corrections and bugfixes are warmly +received, especially in the form of context diffs.</p> + +<p>This note summarizes the differences between this software +release of NTPv4, called ntp-4.x.x, and the previous NTPv3 version, +called xntp3-5.x.x. Additional information on protocol +compatibility details is in the <a href="biblio.htm">Protocol +Conformance Statement</a> page.</p> + +<ol> +<li> +<p>Most calculations are now done using 64-bit floating double +format, rather than 64-bit fixed point format. The motivation for +this is to reduce size, improve speed and avoid messy bounds +checking. Workstations of today are much faster than when the +original NTP version was designed in the early 1980s, and it is +rare to find a processor architecture that does not support +floating double. The fixed point format is still used with raw +timestamps, in order to retain the full precision of about 212 +picoseconds. However, the algorithms which process raw timestamps +all produce fixed point differences before converting to floating +double. The differences are ordinarily quite small so can be +expressed without loss of accuracy in this format.</p> +</li> + +<li> +<p>The clock discipline algorithm has been redesigned to improve +accuracy, reduce the impact of network jitter and allow an increase +in poll intervals to well over one day with only moderate sacrifice +in accuracy. The NTPv4 design allows servers to increase the poll +intervals even when synchronized directly to the peer. In NTPv3 the +poll interval in such cases was clamped to the minimum, usually 64 +s. For those servers with hundreds of clients, the new design can +dramatically reduce the network load.</p> +</li> + +<li> +<p>This release includes support for the <a href= +"http://www.eecis.udel.edu/~mills/resource.htm"><i> +nanokernel</i></a> precision time kernel support, which is now in +stock Linux and FreeBSD kernels. If a precision time source such as +a GPS timing receiver or cesium clock is available, kernel +timekeeping can be improved to the order less than one microsecond. +The older precision time kernel for the Alpha continues to be +supported.</p> +</li> + +<li> +<p>This release includes support for Autokey public-key +cryptography, which is the preferred scheme for authenticating +servers to clients. It uses NTP header extensions fields documented +in: Mills, D.L. Public-Key cryptography for the Network Time +Protocol. Internet Draft draft-ietf-stime-ntpauth-00.txt, +University of Delaware, June 2000, 36 pp. <a href= +"http://www.eecis.udel.edu/~mills/database/memos/draft-ietf-stime-ntpauth-00.txt"> +ASCII</a> and implemented in this release. The design provides for +orderly key refreshment and does not require public keys and +related media to be copied from one machine to another. Specific +information about Autokey cryptography is contained in the <a href= +"authopt.htm">Authentication Options</a> page and links from +there.</p> +</li> + +<li> +<p>NTPv4 includes two new association modes which in most +applications can avoid per-host configuration altogether. Both of +these are based on IP multicast technology and Autokey +cryptography. They provide for automatic discovery and +configuration of servers and clients without identifying servers or +clients in advance. In multicast mode a server sends a message at +fixed intervals using specified multicast group addresses, while +clients listen on these addresses. Upon receiving the message, a +client exchanges several messages with the server in order to +calibrate the multicast propagation delay between the client and +server. In manycast mode a client sends a message to a specified +multicast group address and expects one or more servers to reply. +Using engineered algorithms, the client selects an appropriate +subset of servers from the messages received and continues in +ordinary client/server operation. The manycast scheme can provide somewhat better accuracy than the multicast scheme at the price of -additional network overhead.</LI> - -<P><LI>The reference clock driver interface is smaller, more rational -and moreaccurate. Support for pulse-per-second (PPS) signals has been -extended to all drivers as an intrinsic function. Most of the drivers in -NTPv3 have been converted to this interface, but some, including the -PARSE subinterface, have yet to be overhauled. New drivers have been -added for several GPS receivers now on the market. Drivers for the -Canadian standard time and frequency station CHU and for audio IRIG -signals have been updated and capabilites added to allow direct -connection of these signals to the Sun audio port -<TT>/dev/audio</TT>.</LI> - -<P><LI>In all except a very few cases, all timing intervals are -randomized, so that the tendency for NTPv3 to bunch messages, especially -with a large number of configured associations, is minimized.</LI> - -<P><LI>In NTPv3 a large number of weeds and useless code had grown over -the years since the original NTPv1 code was implemented almost ten years -ago. Using a powerful weedwacker, much of the shrubbery has been -removed, with effect a substantial reduction in size of almost 40 -percent.</LI> - -<P><LI>The entire distribution has been converted to <TT>gnu -automake</TT>, which should greatly ease the task of porting to new and -different programming environments, as well as reduce the incidence of -bugs due to improper handling of idiosyncratic kernel functions.</LI> -</OL> - -<H4>Nasty Surprises</H4> - -There are a few things different about this release that have changed -since the latest NTP Version 3 release. Following are a few things to -worry about: - -<OL> - -<P><LI>As required by Defense Trade Regulations (DTR), the cryptographic -routines supporting the Data Encryption Standard (DES) has been removed -from the export version of the distribtution. These routines are readily -available in most countries from RSA Laboratories. Directions for their -use are in the <A HREF=build.htm>Building and Installing the -Distribution</A> page.</LI> - -<P><LI>As the result of the above, the <TT>./authstuff</TT> directory, +additional network overhead. See the <a href="assoc.htm"> +Association Management</a> page for further information.</p> +</li> + +<li> +<p>There are two burst mode features available where special +conditions apply. One of these is enabled by the <tt>iburst</tt> +keyword in the <tt>server</tt> configuration command. It is +intended for cases where it is important to set the clock quickly +when an association is first mobilized. The other is enabled by the +<tt>burst</tt> keyword in the <tt>server</tt> configuration +command. It is intended for cases where the network attachment +requires an initial calling or training procedure. See the <a href= +"assoc.htm">Association Management</a> page for further +information.</p> +</li> + +<li> +<p>The reference clock driver interface is smaller, more rational +and more accurate. Support for pulse-per-second (PPS) signals has +been extended to all drivers as an intrinsic function. Most of the +drivers in NTPv3 have been converted to this interface, but some, +including the PARSE subinterface, have yet to be overhauled. New +drivers have been added for several GPS receivers now on the market +for a total of 39 drivers. Drivers for the Canadian standard time +and frequency station CHU, the US standard time and frequency +stations WWV/H and for IRIG signals have been updated and +capabilities added to allow direct connection of these signals to +the Sun audio port <tt>/dev/audio</tt>.</p> +</li> + +<li> +<p>In all except a very few cases, all timing intervals are +randomized, so that the tendency for NTPv3 to self-synchronize and +bunch messages, especially with a large number of configured +associations, is minimized.</p> +</li> + +<li> +<p>In NTPv3 a large number of weeds and useless code had grown over +the years since the original NTPv1 code was implemented almost +twenty years ago. Using a powerful weedwacker, much of the +shrubbery has been removed, with effect a substantial reduction in +size of almost 40 percent.</p> +</li> + +<li> +<p>The entire distribution has been converted to gnu <tt> +automake</tt>, which should greatly ease the task of porting to new +and different programming environments, as well as reduce the +incidence of bugs due to improper handling of idiosyncratic kernel +functions.</p> +</li> +</ol> + +<h4>Nasty Surprises</h4> + +<p>There are a few things different about this release that have +changed since the latest NTP Version 3 release. Following are a few +things to worry about:</p> + +<ol> +<li> +<p>As required by Defense Trade Regulations (DTR), the +cryptographic routines supporting the Data Encryption Standard +(DES) have been removed from the base distribution. These routines +are readily available in most countries from RSA Laboratories. +Directions for their use are in the <a href="build.htm">Building +and Installing the Distribution</a> page.</p> +</li> + +<li> +<p>As the result of the above, the <tt>./authstuff</tt> directory, intended as a development and testing aid for porting cryptographic -routines to exotic architectures, has been removed. Developers should -note the NTP authentication routines use the interface defined in the -<TT>rsaref2.0</TT> package available from RSA laboratories.</LI> - -<P><LI>The enable and disable commands have a few changes in their -arguments see the <TT>ntpd</TT> <A HREF=confopt.htm>Configuration -Options</A> page for details.</LI> - -<P><LI>The scheme for enabling the <TT>ppsclock</TT> line -discipline/streams module has changed. Formerly, it was enabled by -setting f<TT>udge flag3</TT> for the serial port connected to the PPS -signal. Now, there is an explicit command <TT>pps</TT> used to designate -the device name. See the <A HREF=clockopt.htm>Reference Clock -Options</A> page for details.</LI> - -<P><LI>While in fact not a new problem, some obscure option combinations -require the <TT>server</TT> and <TT>peer</TT> commands to follow the -others; in particular, the <TT>enable</TT> and <TT>pps</TT> commands -should preceed these commands.</LI> - -</OL> - -<H4>Caveats</H4> - -This release has been compiled and tested on several systems, including -SunOS 4.1.3, Solaris 2.5.1 and 2.6, Alpha 4.0, Ultrix 4.4, Linux, -FreeBSD and HP-UX 10.02. It has not been compiled for Windows NT or VMS. -We are relying on the NTP volunteer brigade to do that. Known problems -are summarized below: - -<OL> - -<P><LI>To work properly in all cases, the <TT>enable</TT> and -<TT>pps</TT> commands, if used, should appear before the <TT>server</TT> -and <TT>fudge</TT> commands in the configuration file.</LI> - -<P><LI>The precision time kernel modifications now in stock Solaris 2.6 -have bugs. The kernel discipline has been disabled by default. For -testing, the kernel can be enabled using the <TT>enable kernel</TT> -command either in the configuration file or via <TT>ntpdc</TT>.</LI> - -<P><LI>On Alpha 4.0 with reference clocks configured, debugging with the -<TT>-d</TT> options doesn't work.</LI> - -<P><LI>The autokey function requires an NTP header extensions field, -which is documented in an internet draft and implemented in this -release. This field holds the public-key signature and certificate; -however, the detailed format for these data have not yet been -determined. It is expected this will happen in the near future and that -implementation of the required algorithms will quickly follow using -available cryptographic algorithms.</LI> - -<P><LI>The manycast function still needs some work. Ideally, the -existing I/O routines would be enhanced to include the capability to -determine the source address on every multicast packet sent, so that the -autokey function could reliably construct the correct cryptosum. -Meanwhile, the utility of manycast in conjunction with autokey is -limited to clients with only a single network -interface.</LI> - -<P><LI>The HTML documentation has been partially updated. However, most -of the NTPv3 documentation continues to apply to NTPv4. Until the update -happens, what you see is what you get. We are always happy to accept -comments, corrections and bug reports. However, we are most thrilled -upon receipt of patches to fix the dang bugs.</LI> - -</OL> - -<hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a -href=mailto:mills@udel.edu> David L. Mills <mills@udel.edu></a> -</address></a></body></html> +routines to exotic architectures, has been removed. Developers +should note the NTP authentication routines use the interface +defined in the <tt>rsaref2.0</tt> package available from RSA +laboratories.</p> +</li> + +<li> +<p>The enable and disable commands have a few changes in their +arguments see the <tt>ntpd</tt> <a href="confopt.htm">Configuration +Options</a> page for details. Note that the <tt>authenticate</tt> +command has been removed.</p> +</li> + +<li> +<p>The <tt>ppsclock</tt> line discipline/streams module is no +longer supported. This function is now handled by the <a href= +"driver22.htm">PPS Clock Discipline</a> driver, which uses the new +PPSAPI application program interface proposed by the IETF. Note +that the <tt>pps</tt> configuration file command has been obsoleted +by the driver. See the <a href="pps.htm">Pulse-per-second (PPS) +Signal Interfacing</a> page for further information.</p> +</li> + +<li> +<p>Several new options have been added for the <tt>ntpd</tt> +command line. For the inveterate knob twiddlers several of the more +important performance variables can be changed to fit actual or +perceived special conditions. It is possible to operate the daemon +in a one-time mode similar to <tt>ntpdate</tt>, which program is +headed for retirement. See the <a href="ntpd.htm"><tt>ntpd</tt> - +Network Time Protocol (NTP) daemon</a> page for the new +features.</p> +</li> + +<li> +<p>To help reduce the level of spurious network traffic due to +obsolete configuration files, a special control message called the +kiss-of-death packet has been implemented. If enabled and a packet +is denied service or exceeds the client limie, a compliant server +will send this message to the client. A compliant client will cease +further transmission and send a message to the system log. See the +<a href="accopt.htm">Authentication Options</a> page for further +information.</p> +</li> + +<li> +<p>An experimental filter algorithm called huff-n'-puff has been +implemented to reduce errors under conditions of severe assymetric +delays characteristic of <tt>ppp</tt> connections with telephone +modems and downloading or uploading considerable traffic. See the +<a href="ntpd.htm">ntpd - Network Time Protocol (NTP) daemon</a> +page for further information.</p> +</li> +</ol> + +<h4>Caveats</h4> + +<p>This release has been compiled and tested on several systems, +including SunOS 4.1.3, Solaris 2.5.1-2.8, Alpha 4.0, Ultrix 4.4, +Linux, FreeBSD and HP-UX 10.02. It has been compiled and tested on +Windows NT, but not yet on any other Windows version or for VMS. We +are relying on the NTP volunteer corps to do that. Known problems +are summarized below:</p> + +<ol> +<li> +<p>The latest NTPv4 <tt>ntpdc</tt> does not work with previous +versions of <tt>ntpd</tt> and previous versions of <tt>ntpdc</tt> +do not work with latest <tt>ntpd</tt>. This situation is +regrettable and may be fixed in future; however, it is necessary in +order for the autokey function to retrieve canonical names and +certificates from directory services such as Secure DNS.</p> +</li> + +<li> +<p>The precision time support in stock Solaris 2.6 has bugs that +were fixed in 2.7. A patch is available that fixes the 2.6 bugs. +The 2.6 kernel discipline has been disabled by default. For +testing, the kernel can be enabled using the <tt>enable kernel</tt> +command either in the configuration file or via <tt>ntpdc</tt>.</p> +</li> + +<li> +<p>The HTML documentation has been partially updated. However, most +of the NTPv3 documentation continues to apply to NTPv4. Until the +update happens, what you see is what you get. We are always happy +to accept comments, corrections and bug reports. However, we are +most thrilled upon receipt of patches to fix the dang bugs.</p> +</li> +</ol> + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> + +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/html/tickadj.htm b/contrib/ntp/html/tickadj.htm index 7dc11c0..3d9745e 100644 --- a/contrib/ntp/html/tickadj.htm +++ b/contrib/ntp/html/tickadj.htm @@ -1,107 +1,105 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]"> - <TITLE>tickadj - set time-related kernel variables -</TITLE> -</HEAD> -<BODY> - -<H3> -<TT>tickadj</TT> - set time-related kernel variables</H3> - -<HR> -<H4> -Synopsis</H4> -<TT>tickadj [ -Aqs ] [ -a <I>tickadj</I> ] [ -t <I>tick</I> ]</TT> -<H4> -Description</H4> -The <TT>tickadj</TT> program reads, and optionally modifies, several timekeeping-related -variables in the running kernel, via <TT>/dev/kmem</TT>. The particular -variables it is concerned with are <TT>tick</TT>, which is the number of -microseconds added to the system time during a clock interrupt, <TT>tickadj</TT>, -which sets the slew rate and resolution used by the <TT>adjtime</TT> system -call, and <TT>dosynctodr</TT>, which indicates to the kernels on some machines -whether they should internally adjust the system clock to keep it in line -with time-of-day clock or not. - -<P>We have a report that says starting with Solaris 2.6 we should -leave <I>dosynctodr</I> alone. -<A HREF="solaris-dosynctodr.html">Here is the report</A>. - -<P>By default, with no arguments, <TT>tickadj</TT> reads the variables -of interest in the kernel and displays them. At the same time, it determines -an "optimal" value for the value of the <TT>tickadj</TT> variable if the -intent is to run the <TT>ntpd</TT> Network Time Protocol (NTP) daemon, -and prints this as well. Since the operation of <TT>tickadj</TT> when reading -the kernel mimics the operation of similar parts of the <TT>ntpd</TT> program -fairly closely, this can be useful when debugging problems with <TT>ntpd</TT>. - -<P>Note that <TT>tickadj</TT> should be run with some caution when being -used for the first time on different types of machines. The operations -which <TT>tickadj</TT> tries to perform are not guaranteed to work on all -Unix machines and may in rare cases cause the kernel to crash. -<H4> -Command Line Options</H4> - -<DL> -<DT> -<TT>-a <I>tickadj</I></TT></DT> - -<DD> -Set the kernel variable <TT>tickadj</TT> to the value <I><TT>tickadj</TT></I> -specified.</DD> - -<DT> -<TT>-A</TT></DT> - -<DD> -Set the kernel variable <TT>tickadj</TT> to an internally computed "optimal" -value.</DD> - -<DT> -<TT>-t <I>tick</I></TT></DT> - -<DD> -Set the kernel variable <TT>tick</TT> to the value <I><TT>tick</TT></I> -specified.</DD> - -<DT> -<TT>-s</TT></DT> - -<DD> -Set the kernel variable <TT>dosynctodr</TT> to zero, which disables the -hardware time-of-year clock, a prerequisite for running the <TT>ntpd</TT> -daemon under SunOS4.</DD> - -<DT> -<TT>-q</TT></DT> - -<DD> -Normally, <TT>tickadj</TT> is quite verbose about what it is doing. The -<TT>-q</TT> flag tells it to shut up about everything except errors.</DD> -</DL> - -<H4> -Files</H4> - -<PRE> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<html> +<head> +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<title>tickadj - set time-related kernel variables</title> +</head> +<body> +<h3><tt>tickadj</tt> - set time-related kernel variables</h3> + +<hr> +<h4>Synopsis</h4> + +<tt>tickadj [ -Aqs ] [ -a <i>tickadj</i> ] [ -t <i>tick</i> ]</tt> + +<h4>Description</h4> + +The <tt>tickadj</tt> program reads, and optionally modifies, +several timekeeping-related variables in the running kernel in some +machines, via <tt>/dev/kmem</tt>. The particular variables it is +concerned with are <tt>tick</tt>, which is the number of +microseconds added to the system time during a clock interrupt, +<tt>tickadj</tt>, which sets the slew rate and resolution used by +the <tt>adjtime</tt> system call, and <tt>dosynctodr</tt>, which +indicates to the kernels on some machines whether they should +internally adjust the system clock to keep it in line with +time-of-day clock or not. + +<p>Note that this program does NOT work in some kernels, in +particular Solaris 2.6 or later. See the <a href= +"solaris-dosynctodr.html">report</a>.</p> + +<p>By default, with no arguments, <tt>tickadj</tt> reads the +variables of interest in the kernel and displays them. At the same +time, it determines an "optimal" value for the value of the <tt> +tickadj</tt> variable if the intent is to run the <tt>ntpd</tt> +Network Time Protocol (NTP) daemon, and prints this as well. Since +the operation of <tt>tickadj</tt> when reading the kernel mimics +the operation of similar parts of the <tt>ntpd</tt> program fairly +closely, this can be useful when debugging problems with <tt> +ntpd</tt>.</p> + +<p>Note that <tt>tickadj</tt> should be run with some caution when +being used for the first time on different types of machines. The +operations which <tt>tickadj</tt> tries to perform are not +guaranteed to work on all Unix machines and may in rare cases cause +the kernel to crash.</p> + +<h4>Command Line Options</h4> + +<dl> +<dt><tt>-a <i>tickadj</i></tt></dt> + +<dd>Set the kernel variable <tt>tickadj</tt> to the value <i><tt> +tickadj</tt></i>specified.</dd> + +<dt><tt>-A</tt></dt> + +<dd>Set the kernel variable <tt>tickadj</tt> to an internally +computed "optimal" value.</dd> + +<dt><tt>-t <i>tick</i></tt></dt> + +<dd>Set the kernel variable <tt>tick</tt> to the value <i><tt> +tick</tt></i> specified.</dd> + +<dt><tt>-s</tt></dt> + +<dd>Set the kernel variable <tt>dosynctodr</tt> to zero, which +disables the hardware time-of-year clock, a prerequisite for +running the <tt>ntpd</tt> daemon under SunOS4.</dd> + +<dt><tt>-q</tt></dt> + +<dd>Normally, <tt>tickadj</tt> is quite verbose about what it is +doing. The <tt>-q</tt> flag tells it to shut up about everything +except errors.</dd> +</dl> + +<h4>Files</h4> + +<pre> /vmunix /unix -/dev/kmem</PRE> - -<H4> -Bugs</H4> -Fiddling with kernel variables at run time as a part of ordinary operations -is a hideous practice which is only necessary to make up for deficiencies -in the implementation of <TT>adjtime</TT> in many kernels and/or brokenness -of the system clock in some vendors' kernels. It would be much better if -the kernels were fixed and the <TT>tickadj</TT> program went away. -<HR> -<ADDRESS> -David L. Mills (mills@udel.edu)</ADDRESS> - -</BODY> -</HTML> +/dev/kmem +</pre> + +<h4>Bugs</h4> + +Fiddling with kernel variables at run time as a part of ordinary +operations is a hideous practice which is only necessary to make up +for deficiencies in the implementation of <tt>adjtime</tt> in many +kernels and/or brokenness of the system clock in some vendors' +kernels. It would be much better if the kernels were fixed and the +<tt>tickadj</tt> program went away. + +<hr> +<a href="index.htm"><img align="left" src="pic/home.gif" alt= +"gif"></a> +<address><a href="mailto:mills@udel.edu">David L. Mills +<mills@udel.edu></a></address> +</body> +</html> + diff --git a/contrib/ntp/include/Makefile.am b/contrib/ntp/include/Makefile.am index d7f28f6..44301ee 100644 --- a/contrib/ntp/include/Makefile.am +++ b/contrib/ntp/include/Makefile.am @@ -5,11 +5,13 @@ ETAGS_ARGS = $(srcdir)/Makefile.am noinst_HEADERS = \ adjtime.h \ + audio.h \ ascii.h \ audio.h \ binio.h \ global.h \ gps.h \ + hopf6039.h \ icom.h \ ieee754io.h \ iosignal.h \ @@ -20,7 +22,10 @@ noinst_HEADERS = \ ntif.h \ ntp.h \ ntp_calendar.h \ + ntp_cmdargs.h \ + ntp_config.h \ ntp_control.h \ + ntp_crypto.h \ ntp_datum.h \ ntp_filegen.h \ ntp_fp.h \ @@ -36,6 +41,7 @@ noinst_HEADERS = \ ntp_string.h \ ntp_syscall.h \ ntp_syslog.h \ + ntp_tty.h \ ntp_types.h \ ntp_unixtime.h \ ntpd.h \ @@ -44,3 +50,4 @@ noinst_HEADERS = \ recvbuff.h \ trimble.h + diff --git a/contrib/ntp/include/Makefile.in b/contrib/ntp/include/Makefile.in index c1557c0..e034ae1 100644 --- a/contrib/ntp/include/Makefile.in +++ b/contrib/ntp/include/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -107,11 +123,13 @@ ETAGS_ARGS = $(srcdir)/Makefile.am noinst_HEADERS = \ adjtime.h \ + audio.h \ ascii.h \ audio.h \ binio.h \ global.h \ gps.h \ + hopf6039.h \ icom.h \ ieee754io.h \ iosignal.h \ @@ -122,7 +140,10 @@ noinst_HEADERS = \ ntif.h \ ntp.h \ ntp_calendar.h \ + ntp_cmdargs.h \ + ntp_config.h \ ntp_control.h \ + ntp_crypto.h \ ntp_datum.h \ ntp_filegen.h \ ntp_fp.h \ @@ -138,6 +159,7 @@ noinst_HEADERS = \ ntp_string.h \ ntp_syscall.h \ ntp_syslog.h \ + ntp_tty.h \ ntp_types.h \ ntp_unixtime.h \ ntpd.h \ @@ -146,28 +168,29 @@ noinst_HEADERS = \ recvbuff.h \ trimble.h +EXEEXT = +OBJEXT = o subdir = include mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(noinst_HEADERS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +all: all-am -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status tags: TAGS @@ -178,9 +201,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -193,53 +216,50 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ else \ test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ fi; \ done -info-am: -info: info-am -dvi-am: -dvi: dvi-am check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(HEADERS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -250,33 +270,50 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-tags mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic mostlyclean-am -clean-am: clean-tags clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-generic distclean-tags -distclean-am: distclean-tags distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/ntp/include/audio.h b/contrib/ntp/include/audio.h index 284411c..9f728dd 100644 --- a/contrib/ntp/include/audio.h +++ b/contrib/ntp/include/audio.h @@ -8,6 +8,6 @@ /* * Function prototypes */ -int audio_init P((void)); +int audio_init P((char *)); int audio_gain P((int, int)); void audio_show P((void)); diff --git a/contrib/ntp/include/global.h b/contrib/ntp/include/global.h index 4695724..742f84c 100644 --- a/contrib/ntp/include/global.h +++ b/contrib/ntp/include/global.h @@ -30,6 +30,9 @@ typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ typedef u_int32 UINT4; /* local modification */ +/* BYTE defines a unsigned character */ +typedef unsigned char BYTE; /* local modification for RSAEuro */ + #ifndef NULL_PTR #define NULL_PTR ((POINTER)0) #endif diff --git a/contrib/ntp/include/hopf6039.h b/contrib/ntp/include/hopf6039.h new file mode 100644 index 0000000..8532099 --- /dev/null +++ b/contrib/ntp/include/hopf6039.h @@ -0,0 +1,144 @@ +/****************************************************************************/ +/* hopf6039.h */ +/* hopf Elektronik 6039 PCI radio clock header */ +/* (c) 1999, 2000 Bernd Altmeier <altmeier@ATLSoft.de> */ +/* Rev. 1.00 Date 25.03.2000 */ +/* History: */ +/****************************************************************************/ + +#ifndef _hopf6039_H_ +#define _hopf6039_H_ + +#define HOPF_MAXVERSION 8 +#define HOPF_CNTR_MEM_LEN 0x7f +#define HOPF_DATA_MEM_LEN 0x3ff /* this is our memory size */ + +/* macros and definition for 32 to 16 to 8 bit conversion */ + +typedef unsigned long DWORD; +typedef unsigned char BYTE; +typedef unsigned short WORD; + +#define LOWORD(l) ((WORD)(l)) +#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) + +/* iocntl codes for driver access */ + +#define HOPF_CLOCK_CMD_MASK 0xff000 + +#define HOPF_CLOCK_GET_LOCAL 0x10000 +#define HOPF_CLOCK_GET_UTC 0x20000 +#define HOPF_CLOCK_GET_ANTENNA 0x30000 +#define HOPF_CLOCK_GET_DIFFERENCE 0x40000 +#define HOPF_CLOCK_GET_VERSION 0x50000 +#define HOPF_CLOCK_GET_POSITION 0x60000 +#define HOPF_CLOCK_GET_SATDATA 0x70000 +#define HOPF_CLOCK_GET_SYSTEMBYTE 0x80000 +#define HOPF_CLOCK_GET_IRIG 0x90000 + +#define HOPF_CLOCK_SET_DIFFERENCE 0x01000 +#define HOPF_CLOCK_SET_ANTENNA 0x02000 +#define HOPF_CLOCK_SET_TIME 0x03000 +#define HOPF_CLOCK_SET_POSITION 0x04000 +#define HOPF_CLOCK_SET_SATMODE 0x05000 +#define HOPF_CLOCK_SET_SYSTEMBYTE 0x06000 +#define HOPF_CLOCK_SET_RESET 0x07000 +#define HOPF_CLOCK_SET_IRIG 0x08000 + +/* clock command codes */ + +#define HOPF_CLOCK_HARDRESET 0x00008000 +#define HOPF_CLOCK_SOFTRESET 0x00004000 + +/* sat-information */ + +typedef struct SatStat{ + BYTE wVisible; + BYTE wMode; + BYTE wSat0; + BYTE wRat0; + BYTE wSat1; + BYTE wRat1; + BYTE wSat2; + BYTE wRat2; + BYTE wSat3; + BYTE wRat3; + BYTE wSat4; + BYTE wRat4; + BYTE wSat5; + BYTE wRat5; + BYTE wSat6; + BYTE wRat6; + BYTE wSat7; + BYTE wRat7; +} SatStat; + +/* GPS position */ + +typedef struct GPSPos { /* Position */ + long wAltitude; + long wLongitude; + long wLatitude; +} GPSPos; + +/* clock hardware version */ + +typedef struct ClockVersion { + char cVersion[255]; /* Hardware Version like " DCF-RECEIVER, VERSION 01.01, DAT: 23.NOV.1999" */ + char dVersion[255]; /* Driver Version */ +} ClockVersion; + +/* hopftime what you think */ + +typedef struct HOPFTIME { + unsigned int wYear; + unsigned int wMonth; + unsigned int wDayOfWeek; + unsigned int wDay; + unsigned int wHour; + unsigned int wMinute; + unsigned int wSecond; + unsigned int wMilliseconds; + unsigned int wStatus; +} HOPFTIME; + +/* DCF77 antenna alignment */ + +typedef struct DcfAntenne { + BYTE bStatus; + BYTE bStatus1; + WORD wAntValue; +} DcfAntenne; + +/* hopf PCI clock */ + +typedef struct hopfCard { + char name[32]; + unsigned irq; + unsigned long membase; /* without mmap */ + unsigned int port; + + int versionlen; + char versionbuf[1024]; + char *version[HOPF_MAXVERSION]; + char cardname[32]; + int interrupt; + void *mbase; /* this will be our memory base address */ + +} hopfCard; + +typedef struct cardparams { + unsigned int port; + unsigned irq; + int cardtype; + int cardnr; + unsigned int membase; +} cardparams; + + +#define WRITE_REGISTER 0x00 +#define READ_REGISTER 0x01 + +#endif /* _hopf6039_H_ */ diff --git a/contrib/ntp/include/l_stdlib.h b/contrib/ntp/include/l_stdlib.h index 949cf8f..ca47af8 100644 --- a/contrib/ntp/include/l_stdlib.h +++ b/contrib/ntp/include/l_stdlib.h @@ -57,6 +57,10 @@ extern int cfsetospeed P((struct termios *, speed_t)); extern char * getpass P((const char *)); +#ifdef DECL_HSTRERROR_0 +extern const char * hstrerror P((int)); +#endif + #ifdef DECL_INET_NTOA_0 struct in_addr; extern char * inet_ntoa P((struct in_addr)); @@ -136,6 +140,11 @@ struct sigvec; extern int sigvec P((int, struct sigvec *, struct sigvec *)); #endif +#ifndef HAVE_SNPRINTF +/* PRINTFLIKE3 */ +extern int snprintf P((char *, size_t, const char *, ...)); +#endif + #ifdef DECL_SRAND48_0 extern void srand48 P((long)); #endif diff --git a/contrib/ntp/include/ntp.h b/contrib/ntp/include/ntp.h index f4d01de..f7ade0d 100644 --- a/contrib/ntp/include/ntp.h +++ b/contrib/ntp/include/ntp.h @@ -8,58 +8,64 @@ #include "ntp_types.h" #include <math.h> - /* common definitions for Y2K repairs [ Y2KFixes */ - - /* (this might better be put in ntp_calendar.h) */ -#define YEAR_BREAK 500 /* assume years < this are tm_year values: */ - /* Break < AnyFourDigitYear - && Break > Anytm_yearYear */ -#define YEAR_PIVOT 98 /* 97/98: assume years < this are year 2000+ */ - /* FYI: official UNIX pivot year is 68/69 */ - - /* Number of Days since (mythical) 1.BC Gregorian to 1 January of given year*/ -#define julian0(year) \ - ( \ - ( (year) * 365 ) + ( (year) > 0 \ - ? ( ((year)+3) / 4 - ((year-1) / 100) + ((year-1) / 400) ) \ - : 0 ) \ - ) - - /* Number of days since start of NTP time to 1 January of given year */ -#define ntp0(year) ( julian0(year) - julian0(1900) ) - - /* Number of days since start of UNIX time to 1 January of given year */ -#define unix0(year) ( julian0(year) - julian0(1970) ) - - /* LEAP YEAR test for full 4-digit years (e.g, 1999, 2010) */ -#define isleap_4(y) /* a TRUE and PROPER leap year test */ \ - ((y)%4 == 0 && !((y)%100 == 0 && !(y%400 == 0))) - /* NOTE: year 2000 TRULY IS A LEAP YEAR!!! */ - - /* LEAP YEAR test for tm_year (struct tm) years (e.g, 99, 110) */ -#define isleap_tm(y) /* a TRUE and PROPER leap year test */ \ - ((y)%4 == 0 && !((y)%100 == 0 && !(((y)+1900)%400 == 0))) - - /* to convert simple two-digit years to tm_year style years: - if ( year < YEAR_PIVOT ) year += 100; - - * to convert either two-digit OR tm_year years to four-digit years: - if ( year < YEAR_PIVOT ) year += 100; - if ( year < YEAR_BREAK ) year += 1900; - - CALL TO STANDARD: - * As the Internet is an INTERNATIONAL network, it makes SENSE to use - the international standard ISO 8601 to format dates and times. - Basically this is yyyy-mm-dd for years and hh:mm:ss for times - (joining the two togeather in computer readable media calls for - yyyy-mm-ddThh:mm:ss, though yyyy-mm-dd hh:mm:ss is often used - for human readable forms even though it is not not strictly - valid ISO 8601). Standard time-zone offsets ([+-]hh:mm) are allowed. - ghealton ] Y2KFixes */ +/* + * Calendar arithmetic - contributed by G. Healton + */ +#define YEAR_BREAK 500 /* years < this are tm_year values: + * Break < AnyFourDigitYear && Break > + * Anytm_yearYear */ + +#define YEAR_PIVOT 98 /* 97/98: years < this are year 2000+ + * FYI: official UNIX pivot year is + * 68/69 */ + +/* + * Number of Days since 1 BC Gregorian to 1 January of given year + */ +#define julian0(year) (((year) * 365 ) + ((year) > 0 ? (((year) + 3) \ + / 4 - ((year - 1) / 100) + ((year - 1) / \ + 400)) : 0)) + +/* + * Number of days since start of NTP time to 1 January of given year + */ +#define ntp0(year) (julian0(year) - julian0(1900)) + +/* + * Number of days since start of UNIX time to 1 January of given year + */ +#define unix0(year) (julian0(year) - julian0(1970)) + +/* + * LEAP YEAR test for full 4-digit years (e.g, 1999, 2010) + */ +#define isleap_4(y) ((y) % 4 == 0 && !((y) % 100 == 0 && !(y % \ + 400 == 0))) + +/* + * LEAP YEAR test for tm_year (struct tm) years (e.g, 99, 110) + */ +#define isleap_tm(y) ((y) % 4 == 0 && !((y) % 100 == 0 && !(((y) \ + + 1900) % 400 == 0))) + +/* + * to convert simple two-digit years to tm_year style years: + * + * if (year < YEAR_PIVOT) + * year += 100; + * + * to convert either two-digit OR tm_year years to four-digit years: + * + * if (year < YEAR_PIVOT) + * year += 100; + * + * if (year < YEAR_BREAK) + * year += 1900; + */ /* * How to get signed characters. On machines where signed char works, - * use it. On machines where signed char doesn't work, char had better + * use it. On machines where signed char doesn't work, char had better * be signed. */ #ifdef NEED_S_CHAR_TYPEDEF @@ -87,37 +93,34 @@ typedef char s_char; #define NTP_VERSION ((u_char)4) /* current version number */ #define NTP_OLDVERSION ((u_char)1) /* oldest credible version */ #define NTP_PORT 123 /* included for sake of non-unix machines */ -#define NTP_MAXSTRATUM ((u_char)15) /* max stratum, infinity a la Bellman-Ford */ -#define NTP_MAXAGE 86400 /* one day in seconds */ #define NTP_UNREACH 16 /* poll interval backoff count */ #define NTP_MINDPOLL 6 /* log2 default min poll interval (64 s) */ #define NTP_MAXDPOLL 10 /* log2 default max poll interval (~17 m) */ #define NTP_MINPOLL 4 /* log2 min poll interval (16 s) */ #define NTP_MAXPOLL 17 /* log2 max poll interval (~4.5 h) */ #define NTP_MINCLOCK 3 /* minimum survivors */ -#define NTP_CANCLOCK 6 /* minimum candidates */ #define NTP_MAXCLOCK 10 /* maximum candidates */ -#define NTP_WINDOW 8 /* reachability register size */ #define NTP_SHIFT 8 /* 8 suitable for crystal time base */ #define NTP_MAXKEY 65535 /* maximum authentication key number */ -#define NTP_MAXSESSION 100 /* maximum entries on session key list */ -#define NTP_AUTOMAX 12 /* log2 default max session key lifetime */ +#define NTP_MAXSESSION 100 /* maximum session key list entries */ +#define NTP_AUTOMAX 13 /* log2 default max session key lifetime */ #define KEY_REVOKE 16 /* log2 default key revoke timeout */ #define NTP_FWEIGHT .5 /* clock filter weight */ -#define NTP_SWEIGHT .75 /* select weight */ -#define CLOCK_SGATE 10. /* popcorn spike gate */ +#define CLOCK_SGATE 4. /* popcorn spike gate */ #define BURST_INTERVAL1 4 /* first interburst interval (log2) */ #define BURST_INTERVAL2 1 /* succeeding interburst intervals (log2) */ - +#define HUFFPUFF 900 /* huff-n'-puff sample interval (s) */ + /* - * Operations for jitter (variance) calculations (these use doubles). - * Note that we carefully separate the jitter component from the dispersion - * component (frequency error plus precision). The frequency error - * component is computed as CLOCK_PHI times the difference between the epoch - * of the time measurement and the reference time. The precision componen - * is computed as the square root of the mean of the squares of a zero- - * mean, uniform distribution of unit maximum amplitude. Whether this - * makes statistical sense may be arguable. + * Operations for jitter calculations (these use doubles). + * + * Note that we carefully separate the jitter component from the + * dispersion component (frequency error plus precision). The frequency + * error component is computed as CLOCK_PHI times the difference between + * the epoch of the time measurement and the reference time. The + * precision componen is computed as the square root of the mean of the + * squares of a zero-mean, uniform distribution of unit maximum + * amplitude. Whether this makes statistical sense may be arguable. */ #define SQUARE(x) ((x) * (x)) #define SQRT(x) (sqrt(x)) @@ -130,16 +133,49 @@ typedef char s_char; #define MINDISPERSE .01 /* min dispersion */ #define MAXDISTANCE 1. /* max root distance */ +#define EVENT_TIMEOUT 0 /* one second, that is */ + +#ifdef AUTOKEY /* - * Loop filter parameters. See section 5.1 of the specification. + * The following structures are used in the autokey protocol. * - * Note that these are appropriate for a crystal time base. If your - * system clock is line frequency controlled you should read the - * specification for appropriate modifications. + * The autokey structure holds the values used to authenticate key IDs. + */ +struct autokey { /* network byte order */ + tstamp_t tstamp; /* timestamp */ + keyid_t key; /* key ID */ + int32 seq; /* key number */ + u_int32 siglen; /* signature length */ + u_int32 pkt[1]; /* start of signature field */ + u_char *sig; /* signature */ +}; + +/* + * The cookie structure holds the current private value used to + * construct session keys. */ -#define CLOCK_PHI 15e-6 /* max frequency wander */ +struct cookie { /* network byte order */ + tstamp_t tstamp; /* timestamp */ + keyid_t key; /* key ID */ + u_int32 siglen; /* signature length */ + u_int32 pkt[1]; /* start of signature field */ + u_char *sig; /* signature */ +}; -#define EVENT_TIMEOUT 0 /* one second, that is */ +/* + * The value structure holds variable length data such as public + * key, agreement parameters, public valule and leapsecond table. + */ +struct value { /* network byte order */ + tstamp_t tstamp; /* timestamp */ + tstamp_t fstamp; /* filestamp */ + u_int32 vallen; /* value length */ + u_int32 pkt[1]; /* start of value field */ + u_char *ptr; /* data pointer */ + u_int32 siglen; /* signature length */ + u_char *sig; /* signature */ +}; +#endif /* AUTOKEY */ /* * The interface structure is used to hold the addresses and socket @@ -149,8 +185,8 @@ struct interface { int fd; /* socket this is opened on */ int bfd; /* socket for receiving broadcasts */ struct sockaddr_in sin; /* interface address */ - struct sockaddr_in bcast; /* broadcast address */ - struct sockaddr_in mask; /* interface mask */ + struct sockaddr_in bcast; /* broadcast address */ + struct sockaddr_in mask; /* interface mask */ char name[8]; /* name of interface */ int flags; /* interface flags */ int last_ttl; /* last TTL specified */ @@ -168,7 +204,7 @@ struct interface { #define INT_MULTICAST 8 /* multicasting enabled */ /* - * Define flasher bits (tests 1 through 8 in packet procedure) + * Define flasher bits (tests 1 through 11 in packet procedure) * These reveal the state at the last grumble from the peer and are * most handy for diagnosing problems, even if not strictly a state * variable in the spec. These are recorded in the peer structure. @@ -176,102 +212,141 @@ struct interface { #define TEST1 0x0001 /* duplicate packet received */ #define TEST2 0x0002 /* bogus packet received */ #define TEST3 0x0004 /* protocol unsynchronized */ -#define TEST4 0x0008 /* peer delay/dispersion bounds check */ -#define TEST5 0x0010 /* peer authentication failed */ +#define TEST4 0x0008 /* access denied */ +#define TEST5 0x0010 /* authentication failed */ #define TEST6 0x0020 /* peer clock unsynchronized */ #define TEST7 0x0040 /* peer stratum out of bounds */ -#define TEST8 0x0080 /* root delay/dispersion bounds check */ -#define TEST9 0x0100 /* peer not authenticated */ -#define TEST10 0x0200 /* access denied */ +#define TEST8 0x0080 /* root delay/dispersion bounds check */ +#define TEST9 0x0100 /* peer delay/dispersion bounds check */ +#define TEST10 0x0200 /* autokey failed */ +#define TEST11 0x0400 /* proventic not confirmed */ /* - * The peer structure. Holds state information relating to the guys - * we are peering with. Most of this stuff is from section 3.2 of the + * The peer structure. Holds state information relating to the guys + * we are peering with. Most of this stuff is from section 3.2 of the * spec. */ struct peer { - struct peer *next; - struct peer *ass_next; /* link pointer in associd hash */ - struct sockaddr_in srcadr; /* address of remote host */ - struct interface *dstadr; /* pointer to address on local host */ - struct refclockproc *procptr; /* pointer to reference clock stuff */ - u_char leap; /* leap indicator */ - u_char hmode; /* association mode with this peer */ - u_char pmode; /* peer's association mode */ - u_char stratum; /* stratum of remote peer */ - s_char precision; /* peer's clock precision */ - u_char ppoll; /* peer poll interval */ - u_char hpoll; /* local host poll interval */ - u_char minpoll; /* min local host poll interval */ - u_char maxpoll; /* max local host poll interval */ - u_char burst; /* packets remaining in burst */ - u_char version; /* version number */ - u_int flags; /* peer flags */ - u_char cast_flags; /* flags MDF_?CAST */ - u_int flash; /* protocol error tally bits */ - u_char refclktype; /* reference clock type */ - u_char refclkunit; /* reference clock unit number */ - u_char sstclktype; /* clock type for system status word */ - u_int32 refid; /* peer reference ID */ - l_fp reftime; /* update epoch */ - u_long keyid; /* current key ID */ - u_long pkeyid; /* previous key ID (autokey) */ - u_long *keylist; /* session key identifier list */ - int keynumber; /* session key identifier number */ - u_short associd; /* association ID, a unique integer */ - u_char ttl; /* time to live (multicast) */ - -/* **Start of clear-to-zero area.*** */ -/* Everything that is cleared to zero goes below here */ - u_char valid; /* valid counter */ -#define clear_to_zero valid - double estbdelay; /* broadcast offset */ - u_char status; /* peer status */ - u_char pollsw; /* what it says */ - u_char reach; /* reachability, NTP_WINDOW bits */ - u_char unreach; /* unreachable count */ - u_short filter_nextpt; /* index into filter shift register */ - double filter_delay[NTP_SHIFT]; /* delay part of shift register */ - double filter_offset[NTP_SHIFT]; /* offset part of shift register */ - double filter_disp[NTP_SHIFT]; /* dispersion part of shift register */ - u_long filter_epoch[NTP_SHIFT]; /* epoch part of shift register */ - u_char filter_order[NTP_SHIFT]; /* we keep the filter sorted here */ - l_fp org; /* originate time stamp */ - l_fp rec; /* receive time stamp */ - l_fp xmt; /* transmit time stamp */ - double offset; /* peer clock offset */ - double delay; /* peer roundtrip delay */ - double variance; /* peer variance (jitter) */ - double disp; /* peer dispersion */ - double rootdelay; /* roundtrip delay to primary clock */ - double rootdispersion; /* dispersion to primary clock */ - u_long epoch; /* reference epoch */ - -/* ***End of clear-to-zero area.*** */ -/* Everything that is cleared to zero goes above here */ - u_long update; /* receive epoch */ + struct peer *next; /* pointer to next association */ + struct peer *ass_next; /* link pointer in associd hash */ + struct sockaddr_in srcadr; /* address of remote host */ + struct interface *dstadr; /* pointer to address on local host */ + associd_t associd; /* association ID */ + u_char version; /* version number */ + u_char hmode; /* local association mode */ + u_char hpoll; /* local poll interval */ + u_char kpoll; /* last poll interval */ + u_char minpoll; /* min poll interval */ + u_char maxpoll; /* max poll interval */ + u_char burst; /* packets remaining in burst */ + u_int flags; /* association flags */ + u_char cast_flags; /* additional flags */ + u_int flash; /* protocol error test tally bits */ + u_char last_event; /* last peer error code */ + u_char num_events; /* number of error events */ + u_char ttlmax; /* max ttl/refclock mode */ + + /* + * Variables used by reference clock support + */ + struct refclockproc *procptr; /* refclock structure pointer */ + u_char refclktype; /* reference clock type */ + u_char refclkunit; /* reference clock unit number */ + u_char sstclktype; /* clock type for system status word */ + + /* + * Variables set by received packet + */ + u_char leap; /* local leap indicator */ + u_char pmode; /* remote association mode */ + u_char stratum; /* remote stratum */ + s_char precision; /* remote clock precision */ + u_char ppoll; /* remote poll interval */ + u_int32 refid; /* remote reference ID */ + l_fp reftime; /* update epoch */ + + /* + * Variables used by authenticated client + */ + keyid_t keyid; /* current key ID */ +#ifdef AUTOKEY +#define clear_to_zero assoc + associd_t assoc; /* peer association ID */ + u_int32 crypto; /* peer status word */ +#ifdef PUBKEY + struct value pubkey; /* public key */ + struct value certif; /* certificate */ + u_char *keystr; /* host name */ +#endif /* PUBKEY */ + keyid_t pkeyid; /* previous key ID */ + keyid_t hcookie; /* host cookie */ + struct cookie pcookie; /* peer cookie */ + struct autokey recauto; /* autokey */ + u_int32 cmmd; /* peer command */ + /* + * Variables used by authenticated server + */ + keyid_t *keylist; /* session key ID list */ + int keynumber; /* current key number */ + struct autokey sndauto; /* autokey */ +#else /* AUTOKEY */ +#define clear_to_zero status +#endif /* AUTOKEY */ + + /* + * Ephemeral state variables + */ + u_char status; /* peer status */ + u_char pollsw; /* what it says */ + u_char ttl; /* ttl for manycast mode */ + u_char reach; /* reachability register */ + u_char unreach; /* unreachable count */ + u_long epoch; /* reference epoch */ + u_short filter_nextpt; /* index into filter shift register */ + double filter_delay[NTP_SHIFT]; /* delay shift register */ + double filter_offset[NTP_SHIFT]; /* offset shift register */ + double filter_disp[NTP_SHIFT]; /* dispersion shift register */ + u_long filter_epoch[NTP_SHIFT]; /* epoch shift register */ + u_char filter_order[NTP_SHIFT]; /* filter sort index */ + l_fp org; /* originate time stamp */ + l_fp rec; /* receive time stamp */ + l_fp xmt; /* transmit time stamp */ + double offset; /* peer clock offset */ + double delay; /* peer roundtrip delay */ + double jitter; /* peer jitter (squares) */ + double disp; /* peer dispersion */ + double estbdelay; /* clock offset to broadcast server */ + + /* + * Variables set by received packet + */ + double rootdelay; /* roundtrip delay to primary clock */ + double rootdispersion; /* dispersion to primary clock */ + + /* + * End of clear-to-zero area + */ + u_long update; /* receive epoch */ #define end_clear_to_zero update - u_long outdate; /* send time last packet */ - u_long nextdate; /* send time next packet */ - u_long nextaction; /* peer local activity timeout (refclocks mainly) */ - void (*action) P((struct peer *));/* action timeout function */ + u_long outdate; /* send time last packet */ + u_long nextdate; /* send time next packet */ + u_long nextaction; /* peer local activity timeout (refclocks mainly) */ + void (*action) P((struct peer *)); /* action timeout function */ /* - * statistic counters + * Statistic counters */ - u_long timereset; /* time stat counters were reset */ - u_long sent; /* number of updates sent */ - u_long received; /* number of frames received */ - u_long timereceived; /* last time a frame received */ - u_long timereachable; /* last reachable/unreachable event */ - u_long processed; /* processed by the protocol */ - u_long badauth; /* bad credentials detected */ - u_long bogusorg; /* rejected due to bogus origin */ - u_long oldpkt; /* rejected as duplicate packet */ - u_long seldisptoolarge; /* too much dispersion for selection */ - u_long selbroken; /* broken NTP detected in selection */ - u_long seltooold; /* too long since sync in selection */ - u_char last_event; /* set to code for last peer error */ - u_char num_events; /* num. of events which have occurred */ + u_long timereset; /* time stat counters were reset */ + u_long timereceived; /* last packet received time */ + u_long timereachable; /* last reachable/unreachable time */ + + u_long sent; /* packets sent */ + u_long received; /* packets received */ + u_long processed; /* packets processed by the protocol */ + u_long badauth; /* packets cryptosum failed */ + u_long bogusorg; /* packets bogus origin */ + u_long oldpkt; /* packets duplicate packet */ + u_long seldisptoolarge; /* packets dispersion to large*/ + u_long selbroken; /* not used */ }; /* @@ -293,34 +368,33 @@ struct peer { #define MODE_BROADCAST 5 /* broadcast mode */ #define MODE_CONTROL 6 /* control mode packet */ #define MODE_PRIVATE 7 /* implementation defined function */ - -#define MODE_BCLIENT 8 /* a pseudo mode, used internally */ -#define MODE_MCLIENT 9 /* multicast mode, used internally */ +#define MODE_BCLIENT 8 /* broadcast client mode */ /* * Values for peer.stratum, sys_stratum */ #define STRATUM_REFCLOCK ((u_char)0) /* stratum claimed by primary clock */ -#define STRATUM_PRIMARY ((u_char)1) /* host has a primary clock */ -#define STRATUM_INFIN ((u_char)NTP_MAXSTRATUM) /* infinity a la Bellman-Ford */ /* A stratum of 0 in the packet is mapped to 16 internally */ #define STRATUM_PKT_UNSPEC ((u_char)0) /* unspecified in packet */ -#define STRATUM_UNSPEC ((u_char)(NTP_MAXSTRATUM+(u_char)1)) /* unspecified */ +#define STRATUM_UNSPEC ((u_char)16) /* unspecified */ /* * Values for peer.flags */ -#define FLAG_CONFIG 0x1 /* association was configured */ -#define FLAG_AUTHENABLE 0x2 /* this guy needs authentication */ -#define FLAG_MCAST1 0x4 /* multicast client/server mode */ -#define FLAG_MCAST2 0x8 /* multicast client mode */ -#define FLAG_AUTHENTIC 0x10 /* last message was authentic */ -#define FLAG_REFCLOCK 0x20 /* this is actually a reference clock */ -#define FLAG_SYSPEER 0x40 /* this is one of the selected peers */ -#define FLAG_PREFER 0x80 /* this is the preferred peer */ -#define FLAG_BURST 0x100 /* burst mode */ -#define FLAG_SKEY 0x200 /* autokey authentication */ -#define FLAG_NOSELECT 0x400 /* this is a "noselect" peer */ +#define FLAG_CONFIG 0x0001 /* association was configured */ +#define FLAG_AUTHENABLE 0x0002 /* authentication required */ +#define FLAG_AUTHENTIC 0x0004 /* last message was authentic */ +#define FLAG_SKEY 0x0008 /* autokey authentication */ +#define FLAG_MCAST 0x0010 /* multicast client mode */ +#define FLAG_REFCLOCK 0x0020 /* this is actually a reference clock */ +#define FLAG_SYSPEER 0x0040 /* this is one of the selected peers */ +#define FLAG_PREFER 0x0080 /* this is the preferred peer */ +#define FLAG_BURST 0x0100 /* burst mode */ +#define FLAG_IBURST 0x0200 /* initial burst mode */ +#define FLAG_NOSELECT 0x0400 /* this is a "noselect" peer */ +#define FLAG_AUTOKEY 0x0800 /* autokey confirmed */ +#define FLAG_ASSOC 0x1000 /* autokey reqeust */ +#define FLAG_PROVEN 0x2000 /* proventic confirmed */ /* * Definitions for the clear() routine. We use memset() to clear @@ -331,6 +405,11 @@ struct peer { #define END_CLEAR_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero)) #define LEN_CLEAR_TO_ZERO (END_CLEAR_TO_ZERO((struct peer *)0) \ - CLEAR_TO_ZERO((struct peer *)0)) +#define CRYPTO_TO_ZERO(p) ((char *)&((p)->clear_to_zero)) +#define END_CRYPTO_TO_ZERO(p) ((char *)&((p)->end_clear_to_zero)) +#define LEN_CRYPTO_TO_ZERO (END_CRYPTO_TO_ZERO((struct peer *)0) \ + - CRYPTO_TO_ZERO((struct peer *)0)) + /* * Reference clock identifiers (for pps signal) */ @@ -376,7 +455,9 @@ struct peer { #define REFCLK_PCF 35 /* Conrad parallel port radio clock */ #define REFCLK_WWV_AUDIO 36 /* WWV/H audio demodulator/decoder */ #define REFCLK_FG 37 /* Forum Graphic GPS */ -#define REFCLK_MAX 37 /* Grow as needed... */ +#define REFCLK_HOPF_SERIAL 38 /* hopf DCF77/GPS serial line receiver */ +#define REFCLK_HOPF_PCI 39 /* hopf DCF77/GPS PCI receiver */ +#define REFCLK_MAX 39 /* Grow as needed... */ /* * We tell reference clocks from real peers by giving the reference @@ -420,45 +501,46 @@ struct peer { * and must be converted (except the mac, which isn't, really). */ struct pkt { - u_char li_vn_mode; /* contains leap indicator, version and mode */ - u_char stratum; /* peer's stratum */ - u_char ppoll; /* the peer polling interval */ - s_char precision; /* peer clock precision */ - u_fp rootdelay; /* distance to primary clock */ - u_fp rootdispersion; /* clock dispersion */ - u_int32 refid; /* reference clock ID */ - l_fp reftime; /* time peer clock was last updated */ - l_fp org; /* originate time stamp */ - l_fp rec; /* receive time stamp */ - l_fp xmt; /* transmit time stamp */ - -#define MIN_MAC_LEN (sizeof(u_int32) + 8) /* DES */ -#define MAX_MAC_LEN (sizeof(u_int32) + 16) /* MD5 */ + u_char li_vn_mode; /* leap indicator, version and mode */ + u_char stratum; /* peer stratum */ + u_char ppoll; /* peer poll interval */ + s_char precision; /* peer clock precision */ + u_fp rootdelay; /* distance to primary clock */ + u_fp rootdispersion; /* clock dispersion */ + u_int32 refid; /* reference clock ID */ + l_fp reftime; /* time peer clock was last updated */ + l_fp org; /* originate time stamp */ + l_fp rec; /* receive time stamp */ + l_fp xmt; /* transmit time stamp */ + +#define LEN_PKT_NOMAC 12 * sizeof(u_int32) /* min header length */ +#define LEN_PKT_MAC LEN_PKT_NOMAC + sizeof(u_int32) +#define MIN_MAC_LEN 3 * sizeof(u_int32) /* DES */ +#define MAX_MAC_LEN 5 * sizeof(u_int32) /* MD5 */ /* * The length of the packet less MAC must be a multiple of 64 - * bits. For normal private-key cryptography, the cryptosum - * covers only the raw NTP header. For autokey cryptography, - * the heade is incresed by 64 bits to contain the field length - * and private value. + * with an RSA modulus and Diffie-Hellman prime of 64 octets + * and maximum host name of 128 octets, the maximum autokey + * command is 152 octets and maximum autokey response is 460 + * octets. A packet can contain no more than one command and one + * response, so the maximum total extension field length is 672 + * octets. But, to handle humungus certificates, the bank must + * be broke. */ - u_int32 keyid1; /* key identifier 1 */ - u_int32 keyid2; /* key identifier 2 */ - u_int32 keyid3; /* key identifier 3 */ - u_char mac[MAX_MAC_LEN]; /* mac */ +#ifdef AUTOKEY +#ifdef PUBKEY + u_int32 exten[5000 / 4]; /* max extension field */ +#else + u_int32 exten[672 / 4]; /* max extension field */ +#endif /* PUBKEY */ +#else /* AUTOKEY */ + u_int32 exten[1]; /* misused */ +#endif /* AUTOKEY */ + u_char mac[MAX_MAC_LEN]; /* mac */ }; /* - * Packets can come in two flavours, one with a mac and one without. - */ -#define LEN_PKT_NOMAC (sizeof(struct pkt) - MAX_MAC_LEN - 3 * sizeof(u_int32)) - -/* - * Minimum size of packet with a MAC: has to include at least a key number. - */ -#define LEN_PKT_MAC (LEN_PKT_NOMAC + sizeof(u_int32)) - -/* * Stuff for extracting things from li_vn_mode */ #define PKT_MODE(li_vn_mode) ((u_char)((li_vn_mode) & 0x7)) @@ -482,37 +564,42 @@ struct pkt { #define STRATUM_TO_PKT(s) ((u_char)(((s) == (STRATUM_UNSPEC)) ?\ (STRATUM_PKT_UNSPEC) : (s))) - /* - * Event codes. Used for reporting errors/events to the control module + * Event codes. Used for reporting errors/events to the control module */ -#define PEER_EVENT 0x80 /* this is a peer event */ +#define PEER_EVENT 0x80 /* this is a peer event */ -#define EVNT_UNSPEC 0 -#define EVNT_SYSRESTART 1 -#define EVNT_SYSFAULT 2 -#define EVNT_SYNCCHG 3 -#define EVNT_PEERSTCHG 4 -#define EVNT_CLOCKRESET 5 -#define EVNT_BADDATETIM 6 -#define EVNT_CLOCKEXCPT 7 +/* + * System event codes + */ +#define EVNT_UNSPEC 0 /* unspecified */ +#define EVNT_SYSRESTART 1 /* system restart */ +#define EVNT_SYSFAULT 2 /* wsystem or hardware fault */ +#define EVNT_SYNCCHG 3 /* new leap or synch change */ +#define EVNT_PEERSTCHG 4 /* new source or stratum */ +#define EVNT_CLOCKRESET 5 /* clock reset */ +#define EVNT_BADDATETIM 6 /* invalid time or date */ +#define EVNT_CLOCKEXCPT 7 /* reference clock exception */ -#define EVNT_PEERIPERR (1|PEER_EVENT) -#define EVNT_PEERAUTH (2|PEER_EVENT) -#define EVNT_UNREACH (3|PEER_EVENT) -#define EVNT_REACH (4|PEER_EVENT) -#define EVNT_PEERCLOCK (5|PEER_EVENT) +/* + * Peer event codes + */ +#define EVNT_PEERIPERR (1 | PEER_EVENT) /* IP error */ +#define EVNT_PEERAUTH (2 | PEER_EVENT) /* authentication failure */ +#define EVNT_UNREACH (3 | PEER_EVENT) /* change to unreachable */ +#define EVNT_REACH (4 | PEER_EVENT) /* change to reachable */ +#define EVNT_PEERCLOCK (5 | PEER_EVENT) /* clock exception */ /* * Clock event codes */ -#define CEVNT_NOMINAL 0 -#define CEVNT_TIMEOUT 1 -#define CEVNT_BADREPLY 2 -#define CEVNT_FAULT 3 -#define CEVNT_PROP 4 -#define CEVNT_BADDATE 5 -#define CEVNT_BADTIME 6 +#define CEVNT_NOMINAL 0 /* unspecified */ +#define CEVNT_TIMEOUT 1 /* poll timeout */ +#define CEVNT_BADREPLY 2 /* bad reply format */ +#define CEVNT_FAULT 3 /* hardware or software fault */ +#define CEVNT_PROP 4 /* propagation failure */ +#define CEVNT_BADDATE 5 /* bad date format or value */ +#define CEVNT_BADTIME 6 /* bad time format or value */ #define CEVNT_MAX CEVNT_BADTIME /* @@ -522,8 +609,8 @@ struct pkt { /* - * To speed lookups, peers are hashed by the low order bits of the remote - * IP address. These definitions relate to that. + * To speed lookups, peers are hashed by the low order bits of the + * remote IP address. These definitions relate to that. */ #define HASH_SIZE 32 #define HASH_MASK (HASH_SIZE-1) @@ -538,14 +625,11 @@ struct pkt { * is shifted by EVENT_TIMEOUT and added to the base value. */ #if defined(HAVE_MRAND48) -#define RANDOM (mrand48()) -#define SRANDOM(x) (srand48(x)) -#elif defined(HAVE_RANDOM) -#define RANDOM (random()) -#define SRANDOM(x) (srandom(x)) +# define RANDOM (mrand48()) +# define SRANDOM(x) (srand48(x)) #else -#define RANDOM (0) -#define SRANDOM(x) (0) +# define RANDOM (random()) +# define SRANDOM(x) (srandom(x)) #endif #define RANDPOLL(x) ((1 << (x)) - 1 + (RANDOM & 0x3)) @@ -575,14 +659,21 @@ struct pkt { #define PROTO_KERNEL 9 #define PROTO_MONITOR 10 #define PROTO_FILEGEN 11 +#define PROTO_PPS 12 +#define PROTO_CAL 13 /* * Configuration items for the loop filter */ #define LOOP_DRIFTINIT 1 /* set initial frequency offset */ #define LOOP_DRIFTCOMP 2 /* set frequency offset */ -#define LOOP_PPSDELAY 3 /* set pps delay */ -#define LOOP_PPSBAUD 4 /* set pps baud rate */ +#define LOOP_MAX 3 /* set step offset */ +#define LOOP_PANIC 4 /* set panic offseet */ +#define LOOP_PHI 5 /* set dispersion rate */ +#define LOOP_MINSTEP 6 /* set step timeout */ +#define LOOP_MINPOLL 7 /* set min poll interval (log2 s) */ +#define LOOP_ALLAN 8 /* set minimum Allan intercept */ +#define LOOP_HUFFPUFF 9 /* set huff-n'-puff filter length */ /* * Configuration items for the stats printer @@ -598,6 +689,7 @@ struct pkt { */ #define DEFBROADDELAY 4e-3 /* default broadcast offset */ #define INADDR_NTP 0xe0000101 /* NTP multicast address 224.0.1.1 */ + /* * Structure used optionally for monitoring when this is turned on. */ @@ -619,11 +711,15 @@ struct mon_data { u_char cast_flags; /* flags MDF_?CAST */ }; -#define MDF_UCAST 0x1 /* unicast packet */ -#define MDF_MCAST 0x2 /* multicast packet */ -#define MDF_BCAST 0x4 /* broadcast packet */ -#define MDF_LCAST 0x8 /* local packet */ -#define MDF_ACAST 0x10 /* manycast packet */ +/* + * Values for cast_flags + */ +#define MDF_UCAST 0x01 /* unicast */ +#define MDF_MCAST 0x02 /* multicast */ +#define MDF_BCAST 0x04 /* broadcast */ +#define MDF_LCAST 0x08 /* localcast */ +#define MDF_ACAST 0x10 /* manycast */ +#define MDF_BCLNT 0x20 /* broadcast client */ /* * Values used with mon_enabled to indicate reason for enabling monitoring @@ -646,19 +742,22 @@ struct restrictlist { /* * Access flags */ -#define RES_IGNORE 0x1 /* ignore if matched */ -#define RES_DONTSERVE 0x2 /* don't give him any time */ -#define RES_DONTTRUST 0x4 /* don't trust if matched */ -#define RES_NOQUERY 0x8 /* don't allow queries if matched */ -#define RES_NOMODIFY 0x10 /* don't allow him to modify server */ -#define RES_NOPEER 0x20 /* don't allocate memory resources */ -#define RES_NOTRAP 0x40 /* don't allow him to set traps */ -#define RES_LPTRAP 0x80 /* traps set by him are low priority */ +#define RES_IGNORE 0x001 /* ignore if matched */ +#define RES_DONTSERVE 0x002 /* don't give him any time */ +#define RES_DONTTRUST 0x004 /* don't trust if matched */ +#define RES_NOQUERY 0x008 /* don't allow queries if matched */ +#define RES_NOMODIFY 0x010 /* don't allow him to modify server */ +#define RES_NOPEER 0x020 /* don't allocate memory resources */ +#define RES_NOTRAP 0x040 /* don't allow him to set traps */ +#define RES_LPTRAP 0x080 /* traps set by him are low priority */ #define RES_LIMITED 0x100 /* limit per net number of clients */ +#define RES_VERSION 0x200 /* serve only current version */ +#define RES_DEMOBILIZE 0x400 /* demobilize association */ #define RES_ALLFLAGS \ - (RES_IGNORE|RES_DONTSERVE|RES_DONTTRUST|RES_NOQUERY\ - |RES_NOMODIFY|RES_NOPEER|RES_NOTRAP|RES_LPTRAP|RES_LIMITED) + (RES_IGNORE | RES_DONTSERVE | RES_DONTTRUST | RES_NOQUERY | \ + RES_NOMODIFY | RES_NOPEER | RES_NOTRAP | RES_LPTRAP | \ + RES_LIMITED | RES_VERSION | RES_DEMOBILIZE) /* * Match flags diff --git a/contrib/ntp/include/ntp_cmdargs.h b/contrib/ntp/include/ntp_cmdargs.h new file mode 100644 index 0000000..e9ab9b1 --- /dev/null +++ b/contrib/ntp/include/ntp_cmdargs.h @@ -0,0 +1,4 @@ +#include "ntp_types.h" + +extern void getstartup P((int, char **)); +extern void getCmdOpts P((int, char **)); diff --git a/contrib/ntp/include/ntp_config.h b/contrib/ntp/include/ntp_config.h new file mode 100644 index 0000000..92f5cd1 --- /dev/null +++ b/contrib/ntp/include/ntp_config.h @@ -0,0 +1,151 @@ +/* + * Configuration file name + */ +#ifndef CONFIG_FILE +# ifndef SYS_WINNT +# define CONFIG_FILE "/etc/ntp.conf" +# else /* SYS_WINNT */ +# define CONFIG_FILE "%windir%\\system32\\drivers\\etc\\ntp.conf" +# define ALT_CONFIG_FILE "%windir%\\ntp.conf" +# endif /* SYS_WINNT */ +#endif /* not CONFIG_FILE */ + +/* + * Types of entries we understand. + */ +#define CONFIG_UNKNOWN 0 + +/* + * Command keywords + */ +#define CONFIG_PEER 1 +#define CONFIG_SERVER 2 +#define CONFIG_AUTOMAX 3 +#define CONFIG_DRIFTFILE 4 +#define CONFIG_BROADCAST 5 +#define CONFIG_BROADCASTCLIENT 6 +#define CONFIG_AUTHENTICATE 7 +#define CONFIG_KEYS 8 +#define CONFIG_REVOKE 9 +#define CONFIG_PPS 10 +#define CONFIG_RESTRICT 11 +#define CONFIG_BDELAY 12 +#define CONFIG_TRUSTEDKEY 13 +#define CONFIG_REQUESTKEY 14 +#define CONFIG_CONTROLKEY 15 +#define CONFIG_TRAP 16 +#define CONFIG_FUDGE 17 +#define CONFIG_TINKER 18 +#define CONFIG_STATSDIR 19 +#define CONFIG_FILEGEN 20 +#define CONFIG_STATISTICS 21 +#define CONFIG_PIDFILE 22 +#define CONFIG_SETVAR 23 +#define CONFIG_CLIENTLIMIT 24 +#define CONFIG_CLIENTPERIOD 25 +#define CONFIG_MULTICASTCLIENT 26 +#define CONFIG_ENABLE 27 +#define CONFIG_DISABLE 28 +#define CONFIG_PHONE 29 +#define CONFIG_LOGFILE 30 +#define CONFIG_LOGCONFIG 31 +#define CONFIG_MANYCASTCLIENT 32 +#define CONFIG_MANYCASTSERVER 33 +#ifdef PUBKEY +#define CONFIG_CRYPTO 34 +#define CONFIG_KEYSDIR 35 +#endif /* PUBKEY */ +#define CONFIG_INCLUDEFILE 36 + +/* + * "peer", "server", "broadcast" modifier keywords + */ +#define CONF_MOD_VERSION 1 +#define CONF_MOD_KEY 2 +#define CONF_MOD_MINPOLL 3 +#define CONF_MOD_MAXPOLL 4 +#define CONF_MOD_PREFER 5 +#define CONF_MOD_BURST 6 +#define CONF_MOD_IBURST 7 +#define CONF_MOD_SKEY 8 +#define CONF_MOD_TTL 9 +#define CONF_MOD_MODE 10 +#define CONF_MOD_NOSELECT 11 +#ifdef PUBKEY +#define CONF_MOD_PUBLICKEY 12 +#endif /* PUBKEY */ + +/* + * "restrict" modifier keywords + */ +#define CONF_RES_MASK 1 +#define CONF_RES_IGNORE 2 +#define CONF_RES_NOSERVE 3 +#define CONF_RES_NOTRUST 4 +#define CONF_RES_NOQUERY 5 +#define CONF_RES_NOMODIFY 6 +#define CONF_RES_NOPEER 7 +#define CONF_RES_NOTRAP 8 +#define CONF_RES_LPTRAP 9 +#define CONF_RES_NTPPORT 10 +#define CONF_RES_LIMITED 11 +#define CONF_RES_VERSION 12 +#define CONF_RES_DEMOBILIZE 13 + +/* + * "trap" modifier keywords + */ +#define CONF_TRAP_PORT 1 +#define CONF_TRAP_INTERFACE 2 + +/* + * "fudge" modifier keywords + */ +#define CONF_FDG_TIME1 1 +#define CONF_FDG_TIME2 2 +#define CONF_FDG_STRATUM 3 +#define CONF_FDG_REFID 4 +#define CONF_FDG_FLAG1 5 +#define CONF_FDG_FLAG2 6 +#define CONF_FDG_FLAG3 7 +#define CONF_FDG_FLAG4 8 + +/* + * "filegen" modifier keywords + */ +#define CONF_FGEN_FILE 1 +#define CONF_FGEN_TYPE 2 +#define CONF_FGEN_FLAG_LINK 3 +#define CONF_FGEN_FLAG_NOLINK 4 +#define CONF_FGEN_FLAG_ENABLE 5 +#define CONF_FGEN_FLAG_DISABLE 6 + +/* + * "pps" modifier keywords + */ +#define CONF_PPS_ASSERT 1 +#define CONF_PPS_CLEAR 2 +#define CONF_PPS_HARDPPS 3 + +/* + * "tinker" modifier keywords + */ +#define CONF_CLOCK_MAX 1 +#define CONF_CLOCK_PANIC 2 +#define CONF_CLOCK_PHI 3 +#define CONF_CLOCK_MINSTEP 4 +#define CONF_CLOCK_MINPOLL 5 +#define CONF_CLOCK_ALLAN 6 +#define CONF_CLOCK_HUFFPUFF 7 + +#ifdef PUBKEY +/* + * "crypto" modifier keywords + */ +#define CONF_CRYPTO_DH 1 +#define CONF_CRYPTO_PRIVATEKEY 2 +#define CONF_CRYPTO_PUBLICKEY 3 +#define CONF_CRYPTO_LEAP 4 +#define CONF_CRYPTO_FLAGS 5 +#define CONF_CRYPTO_CERT 6 +#endif /* PUBKEY */ diff --git a/contrib/ntp/include/ntp_control.h b/contrib/ntp/include/ntp_control.h index dbcc2c6..e31a2fd 100644 --- a/contrib/ntp/include/ntp_control.h +++ b/contrib/ntp/include/ntp_control.h @@ -9,7 +9,7 @@ struct ntp_control { u_char r_m_e_op; /* response, more, error, opcode */ u_short sequence; /* sequence number of request */ u_short status; /* status word for association */ - u_short associd; /* association ID */ + associd_t associd; /* association ID */ u_short offset; /* offset of this batch of data */ u_short count; /* count of data in this packet */ u_char data[(480 + MAX_MAC_LEN)]; /* data + auth */ @@ -157,14 +157,26 @@ struct ntp_control { #define CS_STATE 10 #define CS_OFFSET 11 #define CS_DRIFT 12 -#define CS_COMPLIANCE 13 +#define CS_JITTER 13 #define CS_CLOCK 14 #define CS_PROCESSOR 15 #define CS_SYSTEM 16 -#define CS_STABIL 17 -#define CS_VARLIST 18 - +#define CS_VERSION 17 +#define CS_STABIL 18 +#define CS_VARLIST 19 +#ifdef PUBKEY +#define CS_FLAGS 20 +#define CS_HOST 21 +#define CS_PUBLIC 22 +#define CS_CERTIF 23 +#define CS_DHPARAMS 24 +#define CS_REVTIME 25 +#define CS_LEAPTAB 26 +#define CS_TAI 27 +#define CS_MAXCODE CS_TAI +#else #define CS_MAXCODE CS_VARLIST +#endif /* PUBKEY */ /* * Peer variables we understand @@ -204,10 +216,23 @@ struct ntp_control { #define CP_SENT 33 #define CP_FILTERROR 34 #define CP_FLASH 35 -#define CP_DISP 36 -#define CP_VARLIST 37 - +#define CP_TTL 36 +#define CP_TTLMAX 37 +#define CP_VARLIST 38 +#ifdef PUBKEY +#define CP_FLAGS 39 +#define CP_HOST 40 +#define CP_PUBLIC 41 +#define CP_CERTIF 42 +#define CP_SESKEY 43 +#define CP_SASKEY 44 +#define CP_INITSEQ 45 +#define CP_INITKEY 46 +#define CP_INITTSP 47 +#define CP_MAXCODE CP_INITTSP +#else #define CP_MAXCODE CP_VARLIST +#endif /* PUBKEY */ /* * Clock variables we understand diff --git a/contrib/ntp/include/ntp_crypto.h b/contrib/ntp/include/ntp_crypto.h new file mode 100644 index 0000000..a4e6d70 --- /dev/null +++ b/contrib/ntp/include/ntp_crypto.h @@ -0,0 +1,93 @@ +/* + * ntp_crypto.h - definitions for cryptographic operations + */ +#ifdef AUTOKEY +#include "global.h" +#include "md5.h" +#ifdef RSAREF +#include "rsaref.h" +#include "rsa.h" + +#define EVP_SignInit(a, b) R_SignInit(a, b) +#define EVP_SignUpdate(a, b, c) R_SignUpdate(a, b, c); +#define EVP_SignFinal(a, b, c, d) R_SignFinal(a, b, c, d); +#define EVP_VerifyInit(a, b) R_VerifyInit(a, b) +#define EVP_VerifyUpdate(a, b, c) R_VerifyUpdate(a, b, c); +#define EVP_VerifyFinal(a, b, c, d) R_VerifyFinal(a, b, c, d); + +#endif /* RSAREF */ + +/* + * Cryptostatus word + */ +#define CRYPTO_FLAG_ENAB 0x01 /* crypto enable */ +#define CRYPTO_FLAG_RSA 0x02 /* public/private keys */ +#define CRYPTO_FLAG_CERT 0x04 /* certificate */ +#define CRYPTO_FLAG_DH 0x08 /* agreement parameters */ +#define CRYPTO_FLAG_TAI 0x10 /* leapseconds table */ + +/* + * Extension field definitions + */ +#define CRYPTO_VN 1 /* current protocol version number */ + +#define CRYPTO_NULL ((CRYPTO_VN << 8) | 0) /* no operation */ +#define CRYPTO_STAT ((CRYPTO_VN << 8) | 1) /* status */ +#define CRYPTO_ASSOC ((CRYPTO_VN << 8) | 2) /* association ID */ +#define CRYPTO_AUTO ((CRYPTO_VN << 8) | 3) /* autokey values */ +#define CRYPTO_PRIV ((CRYPTO_VN << 8) | 4) /* cookie value */ +#define CRYPTO_DHPAR ((CRYPTO_VN << 8) | 5) /* agreement params */ +#define CRYPTO_DH ((CRYPTO_VN << 8) | 6) /* public value */ +#define CRYPTO_NAME ((CRYPTO_VN << 8) | 7) /* host name/pub key */ +#define CRYPTO_CERT ((CRYPTO_VN << 8) | 8) /* PKI certificate */ +#define CRYPTO_TAI ((CRYPTO_VN << 8) | 9) /* leapseconds table */ +#define CRYPTO_RESP 0x8000 /* response */ +#define CRYPTO_ERROR 0x4000 /* error */ + +#ifdef PUBKEY +/* + * Configuration codes + */ +#define CRYPTO_CONF_NONE 0 /* nothing doing */ +#define CRYPTO_CONF_FLAGS 1 /* initialize flags */ +#define CRYPTO_CONF_PRIV 2 /* load private key from file */ +#define CRYPTO_CONF_PUBL 3 /* load public key from file */ +#define CRYPTO_CONF_DH 4 /* load Diffie_Hellman pars from file */ +#define CRYPTO_CONF_LEAP 5 /* load leapsecond table */ +#define CRYPTO_CONF_KEYS 6 /* set keys directory path */ +#define CRYPTO_CONF_CERT 7 /* load PKI certificate from file */ +#endif /* PUBKEY */ + +/* + * Function prototypes + */ +extern void crypto_recv P((struct peer *, struct recvbuf *)); +extern int crypto_xmit P((u_int32 *, int, u_int, keyid_t, + u_int)); +extern keyid_t session_key P((struct sockaddr_in *, struct + sockaddr_in *, keyid_t, keyid_t, + u_long)); +extern void make_keylist P((struct peer *, struct interface *)); +extern void key_expire P((struct peer *)); +extern void crypto_agree P((void)); +#ifdef PUBKEY +extern void crypto_config P((int, char *)); +extern void crypto_setup P((void)); +extern int crypto_public P((struct peer *, u_char *, u_int)); +#endif /* PUBKEY */ + +/* + * Cryptographic values + */ +extern u_int crypto_flags; /* status word */ +#ifdef PUBKEY +extern R_DH_PARAMS dh_params; +extern struct value host; /* host name/public key */ +extern struct value certif; /* certificate */ +extern struct value dhparam; /* agreement parameters */ +extern struct value dhpub; /* public value */ +extern struct value tai_leap; /* leapseconds table */ +extern u_int crypto_flags; /* status word */ +extern u_int sys_tai; /* current UTC offset from TAI */ +#endif /* PUBKEY */ +#endif /* AUTOKEY */ diff --git a/contrib/ntp/include/ntp_if.h b/contrib/ntp/include/ntp_if.h index 0be0156..91362d8 100644 --- a/contrib/ntp/include/ntp_if.h +++ b/contrib/ntp/include/ntp_if.h @@ -8,12 +8,6 @@ # include "/sys/sync/sema.h" #endif -/* was: defined(SYS_AIX) */ -#if defined(TIME_WITH_SYS_TIME) -# include <sys/time.h> -# include <time.h> -#endif - /* was: (defined(SYS_SOLARIS) && !defined(bsd)) || defined(SYS_SUNOS4) */ /* was: defined(SYS_UNIXWARE1) */ #ifdef HAVE_SYS_SOCKIO_H diff --git a/contrib/ntp/include/ntp_machine.h b/contrib/ntp/include/ntp_machine.h index 4f7f345..d14f5c1 100644 --- a/contrib/ntp/include/ntp_machine.h +++ b/contrib/ntp/include/ntp_machine.h @@ -6,11 +6,18 @@ #define __ntp_machine #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> +#ifdef TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif #endif #include "ntp_proto.h" @@ -235,18 +242,18 @@ typedef unsigned long u_long; error "NT requires config.h to be included" # endif /* HAVE_CONFIG_H) */ -#if defined SYS_WINNT # define ifreq _INTERFACE_INFO # define ifr_flags iiFlags # define ifr_addr iiAddress.AddressIn # define ifr_broadaddr iiBroadcastAddress.AddressIn # define ifr_mask iiNetmask.AddressIn -#endif /* SYS_WINNT */ # define isascii __isascii # define isatty _isatty # define mktemp _mktemp -# define getpid GetCurrentProcessId +# if 0 +# define getpid GetCurrentProcessId +# endif # include <windows.h> # include <ws2tcpip.h> # undef interface diff --git a/contrib/ntp/include/ntp_proto.h b/contrib/ntp/include/ntp_proto.h index 2a888c2..e6e7855 100644 --- a/contrib/ntp/include/ntp_proto.h +++ b/contrib/ntp/include/ntp_proto.h @@ -5,4 +5,6 @@ #include <config.h> #endif +#define NTP_MAXFREQ 500e-6 + #endif /* __ntp_proto_h */ diff --git a/contrib/ntp/include/ntp_refclock.h b/contrib/ntp/include/ntp_refclock.h index fd1d080..3995e9a 100644 --- a/contrib/ntp/include/ntp_refclock.h +++ b/contrib/ntp/include/ntp_refclock.h @@ -29,12 +29,14 @@ #include <sys/modem.h> #endif +#if 0 /* If you need that, include ntp_io.h instead */ #if defined(STREAM) #include <stropts.h> -#if defined(CLK) +#if defined(CLK) /* This is never defined, except perhaps by a system header file */ #include <sys/clkdefs.h> #endif /* CLK */ #endif /* STREAM */ +#endif #include "recvbuff.h" @@ -42,10 +44,9 @@ #define BSD_TTYS #endif /* SYSV_TTYS STREAM BSD_TTYS */ -#define SAMPLE(x) if ((pp->coderecv + 1) % MAXSTAGE != \ - pp->codeproc % MAXSTAGE) \ - pp->filter[pp->coderecv++ % MAXSTAGE] = \ - (x); +#define SAMPLE(x) pp->filter[pp->coderecv++ % MAXSTAGE] = (x); \ + if (pp->coderecv % MAXSTAGE == pp->codeproc % MAXSTAGE) \ + pp->codeproc++; /* * Macros to determine the clock type and unit numbers from a @@ -195,7 +196,7 @@ struct refclockproc { l_fp lastrec; /* local timestamp */ double offset; /* mean offset */ double disp; /* sample dispersion */ - double variance; /* sample variance */ + double jitter; /* jitter (mean squares) */ double filter[MAXSTAGE]; /* median filter */ /* diff --git a/contrib/ntp/include/ntp_request.h b/contrib/ntp/include/ntp_request.h index 87dba88..a64094a 100644 --- a/contrib/ntp/include/ntp_request.h +++ b/contrib/ntp/include/ntp_request.h @@ -111,6 +111,10 @@ /* * A request packet. These are almost a fixed length. */ + +#define MAXFILENAME 128 /* max key file name length */ + /* NOTE: also in ntp.h */ + struct req_pkt { u_char rm_vn_mode; /* response, more, version, mode */ u_char auth_seq; /* key, sequence number */ @@ -118,9 +122,9 @@ struct req_pkt { u_char request; /* request number */ u_short err_nitems; /* error code/number of data items */ u_short mbz_itemsize; /* item size */ - char data[32]; /* data area */ + char data[MAXFILENAME + 16]; /* data area [32 prev](144 byte max) */ l_fp tstamp; /* time stamp, for authentication */ - u_int32 keyid; /* encryption key */ + keyid_t keyid; /* encryption key */ char mac[MAX_MAC_LEN-sizeof(u_int32)]; /* (optional) 8 byte auth code */ }; @@ -257,7 +261,8 @@ struct resp_pkt { #define REQ_GET_KERNEL 38 /* get kernel pll/pps information */ #define REQ_GET_CLKBUGINFO 39 /* get clock debugging info */ #define REQ_SET_PRECISION 41 /* (not used) */ -#define REQ_MON_GETLIST_1 42 /* return data collected by monitor v1 */ +#define REQ_MON_GETLIST_1 42 /* return collected v1 monitor data */ +#define REQ_HOSTNAME_ASSOCID 43 /* Here is a hostname + assoc_id */ /* * Flags in the peer information returns @@ -286,6 +291,7 @@ struct resp_pkt { /* * Peer list structure. Used to return raw lists of peers. It goes * without saying that everything returned is in network byte order. + * Well, it *would* have gone without saying, but somebody said it. */ struct info_peer_list { u_int32 address; /* address of peer */ @@ -330,14 +336,14 @@ struct info_peer { u_char hpoll; /* peer.hpoll */ s_char precision; /* peer.precision */ u_char version; /* peer.version */ - u_char valid; /* peer.valid */ + u_char unused8; u_char reach; /* peer.reach */ u_char unreach; /* peer.unreach */ u_char flash; /* old peer.flash */ u_char ttl; /* peer.ttl */ u_short flash2; /* new peer.flash */ - u_short associd; /* association ID */ - u_int32 keyid; /* peer.keyid */ + associd_t associd; /* association ID */ + keyid_t keyid; /* peer.keyid */ u_int32 pkeyid; /* unused */ u_int32 refid; /* peer.refid */ u_int32 timer; /* peer.timer */ @@ -524,14 +530,16 @@ struct conf_peer { u_char flags; /* flags for this request */ u_char ttl; /* time to live (multicast) or refclock mode */ u_short unused; /* unused */ - u_int32 keyid; /* key to use for this association */ + keyid_t keyid; /* key to use for this association */ + char keystr[MAXFILENAME]; /* public key file name*/ }; -#define CONF_FLAG_AUTHENABLE 0x1 -#define CONF_FLAG_PREFER 0x2 -#define CONF_FLAG_BURST 0x4 -#define CONF_FLAG_NOSELECT 0x8 -#define CONF_FLAG_SKEY 0x10 +#define CONF_FLAG_AUTHENABLE 0x01 +#define CONF_FLAG_PREFER 0x02 +#define CONF_FLAG_BURST 0x04 +#define CONF_FLAG_IBURST 0x08 +#define CONF_FLAG_NOSELECT 0x10 +#define CONF_FLAG_SKEY 0x20 /* * Structure for passing peer deletion information. Currently @@ -553,7 +561,7 @@ struct conf_sys_flags { * System flags we can set/clear */ #define SYS_FLAG_BCLIENT 0x1 -#define SYS_FLAG_AUTHENTICATE 0x2 +#define SYS_FLAG_PPS 0x2 #define SYS_FLAG_NTP 0x4 #define SYS_FLAG_KERNEL 0x8 #define SYS_FLAG_MONITOR 0x10 @@ -788,3 +796,14 @@ struct info_kernel { int32 errcnt; int32 stbcnt; }; + +/* + * Info returned with IP -> hostname lookup + */ +/* 144 might need to become 32, matching data[] member of req_pkt */ +#define NTP_MAXHOSTNAME (32 - sizeof(u_int32) - sizeof(u_short)) +struct info_dns_assoc { + u_int32 peeraddr; /* peer address (HMS: being careful...) */ + associd_t associd; /* association ID */ + char hostname[NTP_MAXHOSTNAME]; /* hostname */ +}; diff --git a/contrib/ntp/include/ntp_stdlib.h b/contrib/ntp/include/ntp_stdlib.h index 6a2a852..d10f679 100644 --- a/contrib/ntp/include/ntp_stdlib.h +++ b/contrib/ntp/include/ntp_stdlib.h @@ -32,25 +32,15 @@ extern void msyslog P((int, const char *, ...)) extern void msyslog P(()); #endif -#if 0 /* HMS: These seem to be unused now */ -extern void auth_des P((u_long *, u_char *)); extern void auth_delkeys P((void)); -extern int auth_parity P((u_long *)); -extern void auth_setkey P((u_long, u_long *)); -extern void auth_subkeys P((u_long *, u_char *, u_char *)); -#endif - -extern void auth1crypt P((u_long, u_int32 *, int)); -extern int auth2crypt P((u_long, u_int32 *, int)); -extern void auth_delkeys P((void)); -extern int auth_havekey P((u_long)); -extern int authdecrypt P((u_long, u_int32 *, int, int)); -extern int authencrypt P((u_long, u_int32 *, int)); -extern int authhavekey P((u_long)); -extern int authistrusted P((u_long)); +extern int auth_havekey P((keyid_t)); +extern int authdecrypt P((keyid_t, u_int32 *, int, int)); +extern int authencrypt P((keyid_t, u_int32 *, int)); +extern int authhavekey P((keyid_t)); +extern int authistrusted P((keyid_t)); extern int authreadkeys P((const char *)); -extern void authtrust P((u_long, int)); -extern int authusekey P((u_long, int, const u_char *)); +extern void authtrust P((keyid_t, u_long)); +extern int authusekey P((keyid_t, int, const u_char *)); extern u_long calleapwhen P((u_long)); extern u_long calyearstart P((u_long)); @@ -66,25 +56,22 @@ extern int ntp_getopt P((int, char **, const char *)); extern void init_auth P((void)); extern void init_lib P((void)); extern void init_random P((void)); -extern struct savekey *auth_findkey P((u_long)); +extern struct savekey *auth_findkey P((keyid_t)); extern int auth_moremem P((void)); extern int ymd2yd P((int, int, int)); #ifdef DES extern int DESauthdecrypt P((u_char *, u_int32 *, int, int)); extern int DESauthencrypt P((u_char *, u_int32 *, int)); -extern void DESauth_setkey P((u_long, const u_int32 *)); +extern void DESauth_setkey P((keyid_t, const u_int32 *)); extern void DESauth_subkeys P((const u_int32 *, u_char *, u_char *)); extern void DESauth_des P((u_int32 *, u_char *)); extern int DESauth_parity P((u_int32 *)); #endif /* DES */ -#ifdef MD5 extern int MD5authdecrypt P((u_char *, u_int32 *, int, int)); extern int MD5authencrypt P((u_char *, u_int32 *, int)); -extern void MD5auth_setkey P((u_long, const u_char *, const int)); -extern u_long session_key P((u_int32, u_int32, u_long, u_long)); -#endif /* MD5 */ +extern void MD5auth_setkey P((keyid_t, const u_char *, const int)); extern int atoint P((const char *, long *)); extern int atouint P((const char *, u_long *)); @@ -143,7 +130,7 @@ extern int authnumfreekeys; /* * The key cache. We cache the last key we looked at here. */ -extern u_long cache_keyid; /* key identifier */ +extern keyid_t cache_keyid; /* key identifier */ extern u_char * cache_key; /* key pointer */ extern u_int cache_keylen; /* key length */ @@ -166,7 +153,5 @@ extern HANDLE hServDoneEvent; /* systime.c */ extern int systime_10ms_ticks; /* adj sysclock in 10ms increments */ -extern double sys_maxfreq; /* max frequency correction */ - /* version.c */ extern const char *Version; /* version declaration */ diff --git a/contrib/ntp/include/ntp_syscall.h b/contrib/ntp/include/ntp_syscall.h index ff649c9..29dff91 100644 --- a/contrib/ntp/include/ntp_syscall.h +++ b/contrib/ntp/include/ntp_syscall.h @@ -36,6 +36,11 @@ ntp_gettime( ntv->time = tntx.time; ntv->maxerror = tntx.maxerror; ntv->esterror = tntx.esterror; +#ifdef NTP_API +# if NTP_API > 3 + ntv->tai = tntx.tai; +# endif +#endif return(result); } # else /* !HAVE__ADJTIMEX */ diff --git a/contrib/ntp/include/ntp_syslog.h b/contrib/ntp/include/ntp_syslog.h index 8e47c56..38021e2 100644 --- a/contrib/ntp/include/ntp_syslog.h +++ b/contrib/ntp/include/ntp_syslog.h @@ -5,10 +5,6 @@ #ifndef NTP_SYSLOG_H #define NTP_SYSLOG_H -#ifdef GIZMO -# include "gizmo_syslog.h" -#else /* !GIZMO */ - # ifdef VMS extern void msyslog(); # else @@ -16,11 +12,8 @@ extern void msyslog(); # include <syslog.h> # endif # endif /* VMS */ - # include <stdio.h> -#endif /* GIZMO */ - extern int syslogit; extern FILE *syslog_file; diff --git a/contrib/ntp/include/ntp_tty.h b/contrib/ntp/include/ntp_tty.h new file mode 100644 index 0000000..3e12c8d --- /dev/null +++ b/contrib/ntp/include/ntp_tty.h @@ -0,0 +1,68 @@ +/* + * ntp_tty.h - header file for serial lines handling + */ + +#ifndef NTP_TTY_H +#define NTP_TTY_H + +#if defined(HAVE_BSD_TTYS) +#include <sgtty.h> +#define TTY struct sgttyb +#endif /* HAVE_BSD_TTYS */ + +#if defined(HAVE_SYSV_TTYS) +#include <termio.h> +#define TTY struct termio +#ifndef tcsetattr +#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) +#endif +#ifndef TCSANOW +#define TCSANOW TCSETA +#endif +#ifndef TCIFLUSH +#define TCIFLUSH 0 +#endif +#ifndef TCOFLUSH +#define TCOFLUSH 1 +#endif +#ifndef TCIOFLUSH +#define TCIOFLUSH 2 +#endif +#ifndef tcflush +#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) +#endif +#endif /* HAVE_SYSV_TTYS */ + +#if defined(HAVE_TERMIOS) +# ifdef TERMIOS_NEEDS__SVID3 +# define _SVID3 +# endif +# include <termios.h> +# ifdef TERMIOS_NEEDS__SVID3 +# undef _SVID3 +# endif +#define TTY struct termios +#endif + +#if defined(HAVE_SYS_MODEM_H) +#include <sys/modem.h> +#endif + +#if !defined(SYSV_TTYS) && !defined(STREAM) & !defined(BSD_TTYS) +#define BSD_TTYS +#endif /* SYSV_TTYS STREAM BSD_TTYS */ + +/* + * Line discipline flags. These require line discipline or streams + * modules to be installed/loaded in the kernel. If specified, but not + * installed, the code runs as if unspecified. + */ +#define LDISC_STD 0x0 /* standard */ +#define LDISC_CLK 0x1 /* tty_clk \n intercept */ +#define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */ +#define LDISC_ACTS 0x4 /* tty_clk #* intercept */ +#define LDISC_CHU 0x8 /* depredated */ +#define LDISC_PPS 0x10 /* ppsclock, ppsapi */ +#define LDISC_RAW 0x20 /* raw binary */ + +#endif /* NTP_TTY_H */ diff --git a/contrib/ntp/include/ntp_types.h b/contrib/ntp/include/ntp_types.h index 820c72a..348e95e 100644 --- a/contrib/ntp/include/ntp_types.h +++ b/contrib/ntp/include/ntp_types.h @@ -65,5 +65,9 @@ typedef unsigned int u_int; # include "Bletch: what's 32 bits on this machine?" #endif /* not sizeof(int) == 4 */ +typedef unsigned short associd_t; /* association ID */ +typedef u_int32 keyid_t; /* cryptographic key ID */ +typedef u_int32 tstamp_t; /* NTP seconds timestamp */ + #endif /* _NTP_TYPES_ */ diff --git a/contrib/ntp/include/ntp_unixtime.h b/contrib/ntp/include/ntp_unixtime.h index 9dd23f0..bdc080e 100644 --- a/contrib/ntp/include/ntp_unixtime.h +++ b/contrib/ntp/include/ntp_unixtime.h @@ -5,8 +5,6 @@ #include "ntp_types.h" -#include <sys/time.h> - /* gettimeofday() takes two args in BSD and only one in SYSV */ # if defined(HAVE_SYS_TIMERS_H) && defined(HAVE_GETCLOCK) # include <sys/timers.h> diff --git a/contrib/ntp/include/ntpd.h b/contrib/ntp/include/ntpd.h index 1a83d6e..d3db2fb 100644 --- a/contrib/ntp/include/ntpd.h +++ b/contrib/ntp/include/ntpd.h @@ -11,6 +11,7 @@ #include "recvbuff.h" #define MAXINTERFACES 512 +#define MAXFILENAME 128 /* maximum length of a file name */ #ifdef SYS_WINNT #define exit service_exit @@ -25,7 +26,6 @@ void worker_thread (void *); #endif /* SYS_WINNT */ /* ntp_config.c */ -extern void getstartup P((int, char **)); extern void getconfig P((int, char **)); /* ntp_config.c */ @@ -71,11 +71,13 @@ extern void set_var P((struct ctl_var **, const char *, unsigned long, int)) extern void set_sys_var P((char *, unsigned long, int)); /* ntp_intres.c */ +extern void ntp_res_name P((u_int32, u_short)); +extern void ntp_res_recv P((void)); extern void ntp_intres P((void)); /* ntp_io.c */ -extern struct interface *findbcastinter P((struct sockaddr_in *)); extern struct interface *findinterface P((struct sockaddr_in *)); +extern struct interface *findbcastinter P((struct sockaddr_in *)); extern void init_io P((void)); extern void input_handler P((l_fp *)); @@ -110,6 +112,7 @@ extern void init_loopfilter P((void)); extern int local_clock P((struct peer *, double, double)); extern void adj_host_clock P((void)); extern void loop_config P((int, double)); +extern void huffpuff P((void)); /* ntp_monitor.c */ extern void init_mon P((void)); @@ -121,23 +124,26 @@ extern void ntp_monitor P((struct recvbuf *)); extern void init_peer P((void)); extern struct peer *findexistingpeer P((struct sockaddr_in *, struct peer *, int)); extern struct peer *findpeer P((struct sockaddr_in *, struct interface *, int, int, int *)); -extern struct peer *findpeerbyassoc P((int)); -extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, int, u_long)); +extern struct peer *findpeerbyassoc P((u_int)); +extern struct peer *newpeer P((struct sockaddr_in *, struct interface *, int, int, int, int, u_int, u_int, int, keyid_t)); extern void peer_all_reset P((void)); extern void peer_clr_stats P((void)); -extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, int, int, u_long)); +extern struct peer *peer_config P((struct sockaddr_in *, struct interface *, int, int, int, int, u_int, int, keyid_t, u_char *)); extern void peer_reset P((struct peer *)); extern int peer_unconfig P((struct sockaddr_in *, struct interface *, int)); extern void unpeer P((struct peer *)); -extern void key_expire_all P((void)); -extern struct peer *findmanycastpeer P((l_fp *)); -extern void peer_config_manycast P((struct peer *, struct peer *)); +extern void clear_all P((void)); +#ifdef AUTOKEY +extern void expire_all P((void)); +#endif /* AUTOKEY */ +extern struct peer *findmanycastpeer P((struct recvbuf *)); +extern void resetmanycast P((void)); /* ntp_proto.c */ extern void transmit P((struct peer *)); extern void receive P((struct recvbuf *)); extern void peer_clear P((struct peer *)); -extern int process_packet P((struct peer *, struct pkt *, l_fp *)); +extern void process_packet P((struct peer *, struct pkt *, l_fp *)); extern void clock_select P((void)); /* @@ -176,13 +182,17 @@ extern void hack_restrict P((int, struct sockaddr_in *, struct sockaddr_in *, in extern void init_timer P((void)); extern void timer P((void)); extern void timer_clr_stats P((void)); +#ifdef AUTOKEY +extern char *sys_hostname; +extern l_fp sys_revoketime; +#endif /* AUTOKEY */ /* ntp_util.c */ extern void init_util P((void)); extern void hourly_stats P((void)); extern void stats_config P((int, char *)); extern void record_peer_stats P((struct sockaddr_in *, int, double, double, double, double)); -extern void record_loop_stats P((void)); +extern void record_loop_stats P((double, double, double, double, int)); extern void record_clock_stats P((struct sockaddr_in *, const char *)); extern void record_raw_stats P((struct sockaddr_in *, struct sockaddr_in *, l_fp *, l_fp *, l_fp *, l_fp *)); @@ -203,7 +213,7 @@ extern int config_priority; struct ctl_trap; extern struct ctl_trap ctl_trap[]; extern int num_ctl_traps; -extern u_long ctl_auth_keyid; /* keyid used for authenticating write requests */ +extern keyid_t ctl_auth_keyid; /* keyid used for authenticating write requests */ /* * Statistic counters to keep track of requests and responses. @@ -225,7 +235,7 @@ extern u_long numctlbadop; /* bad op code found in packet */ extern u_long numasyncmsgs; /* number of async messages we've sent */ /* ntp_intres.c */ -extern u_long req_keyid; /* request keyid */ +extern keyid_t req_keyid; /* request keyid */ extern char * req_file; /* name of the file with configuration info */ /* @@ -244,8 +254,8 @@ extern u_long io_timereset; /* time counters were reset */ /* * Interface stuff */ -extern struct interface *any_interface; /* pointer to default interface */ -extern struct interface *loopback_interface; /* point to loopback interface */ +extern struct interface *any_interface; /* default interface */ +extern struct interface *loopback_interface; /* loopback interface */ /* * File descriptor masks etc. for call to select @@ -254,10 +264,16 @@ extern fd_set activefds; extern int maxactivefd; /* ntp_loopfilter.c */ -extern double drift_comp; /* clock frequency (ppm) */ -extern double clock_stability; /* clock stability (ppm) */ -extern double clock_max; /* max offset allowed before step (s) */ +extern double drift_comp; /* clock frequency (s/s) */ +extern double clock_stability; /* clock stability (s/s) */ +extern double clock_max; /* max offset before step (s) */ +extern double clock_panic; /* max offset before panic (s) */ +extern double clock_phi; /* dispersion rate (s/s) */ +extern double clock_minstep; /* step timeout (s) */ extern u_long pps_control; /* last pps sample time */ +#ifdef KERNEL_PLL +extern int pll_status; /* status bits for kernel pll */ +#endif /* KERNEL_PLL */ /* * Clock state machine control flags @@ -265,21 +281,26 @@ extern u_long pps_control; /* last pps sample time */ extern int ntp_enable; /* clock discipline enabled */ extern int pll_control; /* kernel support available */ extern int kern_enable; /* kernel support enabled */ +extern int pps_enable; /* kernel PPS discipline enabled */ extern int ext_enable; /* external clock enabled */ -extern int pps_update; /* pps update valid */ -extern int allow_set_backward; /* step corrections allowed */ -extern int correct_any; /* corrections > 1000 s allowed */ +extern int cal_enable; /* refclock calibrate enable */ +extern int allow_step; /* allow step correction */ +extern int allow_panic; /* allow panic correction */ +extern int mode_ntpdate; /* exit on first clock set */ +extern int peer_ntpdate; /* count of ntpdate peers */ /* * Clock state machine variables */ -extern u_char sys_poll; /* log2 of system poll interval */ +extern u_char sys_poll; /* system poll interval (log2 s) */ +extern u_char sys_minpoll; /* min system poll interval (log2 s) */ extern int state; /* clock discipline state */ extern int tc_counter; /* poll-adjust counter */ extern u_long last_time; /* time of last clock update (s) */ extern double last_offset; /* last clock offset (s) */ extern double allan_xpt; /* Allan intercept (s) */ -extern double sys_error; /* system standard error (s) */ +extern double sys_error; /* system RMS error (s) */ +extern double sys_jitter; /* system RMS jitter (s) */ /* ntp_monitor.c */ extern struct mon_data mon_mru_list; @@ -317,6 +338,7 @@ extern double sys_rootdispersion; /* dispersion of system clock */ extern u_int32 sys_refid; /* reference source for local clock */ extern l_fp sys_reftime; /* time we were last updated */ extern struct peer *sys_peer; /* our current peer */ +extern struct peer *sys_prefer; /* our cherished peer */ extern u_long sys_automax; /* maximum session key lifetime */ /* @@ -326,7 +348,7 @@ extern int sys_bclient; /* we set our time to broadcasts */ extern double sys_bdelay; /* broadcast client default delay */ extern int sys_authenticate; /* requre authentication for config */ extern l_fp sys_authdelay; /* authentication delay */ -extern u_long sys_private; /* private value for session seed */ +extern keyid_t sys_private; /* private value for session seed */ extern int sys_manycastserver; /* 1 => respond to manycast client pkts */ /* @@ -350,7 +372,7 @@ extern int fdpps; /* pps file descriptor */ #endif /* ntp_request.c */ -extern u_long info_auth_keyid; /* keyid used to authenticate requests */ +extern keyid_t info_auth_keyid; /* keyid used to authenticate requests */ /* ntp_restrict.c */ extern struct restrictlist *restrictlist; /* the restriction list */ diff --git a/contrib/ntp/kernel/Makefile.in b/contrib/ntp/kernel/Makefile.in index d3836b0..0b8beb2 100644 --- a/contrib/ntp/kernel/Makefile.in +++ b/contrib/ntp/kernel/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -105,26 +121,28 @@ AUTOMAKE_OPTIONS = ../util/ansi2knr SUBDIRS = sys ETAGS_ARGS = Makefile.am EXTRA_DIST = chuinit.c clkinit.c tty_chu.c tty_chu_STREAMS.c tty_clk.c tty_clk_STREAMS.c +EXEEXT = +OBJEXT = o subdir = kernel mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = README Makefile.am Makefile.in +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = README Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu kernel/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -132,11 +150,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +install-info-recursive uninstall-info-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ @@ -160,11 +176,16 @@ mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - if test "$$subdir" = "."; then dot_seen=yes; else :; fi; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ @@ -190,7 +211,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -210,26 +231,29 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ else \ test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ fi; \ done for subdir in $(SUBDIRS); do \ @@ -237,36 +261,34 @@ distdir: $(DISTFILES) test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ || exit 1; \ fi; \ done -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive check-am: all-am check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-exec-am: -install-exec: install-exec-recursive +all-am: Makefile -install-data-am: +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile -all-redirect: all-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: installdirs-recursive -installdirs-am: +installcheck: installcheck-recursive + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -277,39 +299,56 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-tags mostlyclean-generic +clean: clean-recursive -mostlyclean: mostlyclean-recursive +clean-am: clean-generic mostlyclean-am -clean-am: clean-tags clean-generic mostlyclean-am +distclean: distclean-recursive -clean: clean-recursive +distclean-am: clean-am distclean-generic distclean-tags -distclean-am: distclean-tags distclean-generic clean-am +dvi: -distclean: distclean-recursive +dvi-am: -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-recursive -.PHONY: install-recursive uninstall-recursive install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs-am installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +.PHONY: all all-am all-recursive check check-am check-recursive clean \ + clean-generic clean-recursive distclean distclean-generic \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installcheck-recursive installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive tags tags-recursive uninstall \ + uninstall-am uninstall-info-recursive uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/ntp/kernel/sys/Makefile.in b/contrib/ntp/kernel/sys/Makefile.in index 7bd669f..54f9ac9 100644 --- a/contrib/ntp/kernel/sys/Makefile.in +++ b/contrib/ntp/kernel/sys/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../../util/ansi2knr no-dependencies @@ -109,28 +125,29 @@ pcl720.h ppsclock.h timex.h tpro.h # HMS: Avoid bug in automake #ETAGS_ARGS = "" ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = kernel/sys mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(noinst_HEADERS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +all: all-am -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu kernel/sys/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu kernel/sys/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status tags: TAGS @@ -141,9 +158,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -156,53 +173,50 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ else \ test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ fi; \ done -info-am: -info: info-am -dvi-am: -dvi: dvi-am check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(HEADERS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -213,33 +227,50 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-tags mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic mostlyclean-am -clean-am: clean-tags clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-generic distclean-tags -distclean-am: distclean-tags distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/ntp/kernel/sys/pcl720.h b/contrib/ntp/kernel/sys/pcl720.h index e8638ae..cf4eccd 100644 --- a/contrib/ntp/kernel/sys/pcl720.h +++ b/contrib/ntp/kernel/sys/pcl720.h @@ -61,7 +61,7 @@ static void pcl720_outb(int addr, unsigned char x) { }) #define pcl720_read(Base,Cntr) \ - ({ register unsigned int b = Base, c = Cntr, v; \ + ({ register unsigned int b = Base, v; \ i8253_ctrl ctrl; \ \ ctrl.s.rl = i8253_latch; \ diff --git a/contrib/ntp/libntp/Makefile.am b/contrib/ntp/libntp/Makefile.am index c984c89..654981b 100644 --- a/contrib/ntp/libntp/Makefile.am +++ b/contrib/ntp/libntp/Makefile.am @@ -13,9 +13,11 @@ libntp_a_SOURCES = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \ tstotv.c tvtoa.c tvtots.c uglydate.c uinttoa.c utvtoa.c ymd2yd.c \ mfp_mul.c binio.c ieee754io.c gpstolfp.c recvbuff.c iosignal.c \ icom.c audio.c +EXTRA_libntp_a_SOURCES = adjtimex.c log.c mktime.c random.c snprintf.c \ + strdup.c strerror.c libntp_a_LIBADD = @LIBOBJS@ libntp_a_DEPENDENCIES = @LIBOBJS@ -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref ETAGS_ARGS = Makefile.am noinst_HEADERS = lib_strbuf.h log.h @@ -23,7 +25,7 @@ noinst_HEADERS = lib_strbuf.h log.h ../include/des.h: touch ../include/des.h -EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c +EXTRA_DIST = README #mktime_.c: mktime.c $(ANSI2KNR) # $(ANSI2KNR) $< mktime_.c diff --git a/contrib/ntp/libntp/Makefile.in b/contrib/ntp/libntp/Makefile.in index c89e8f9..d88ab32 100644 --- a/contrib/ntp/libntp/Makefile.in +++ b/contrib/ntp/libntp/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies @@ -116,128 +132,137 @@ libntp_a_SOURCES = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \ mfp_mul.c binio.c ieee754io.c gpstolfp.c recvbuff.c iosignal.c \ icom.c audio.c +EXTRA_libntp_a_SOURCES = adjtimex.c log.c mktime.c random.c snprintf.c \ + strdup.c strerror.c + libntp_a_LIBADD = @LIBOBJS@ libntp_a_DEPENDENCIES = @LIBOBJS@ -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref ETAGS_ARGS = Makefile.am noinst_HEADERS = lib_strbuf.h log.h -EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c +EXTRA_DIST = README +EXEEXT = +OBJEXT = o subdir = libntp mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr libntp_a_AR = $(AR) cru -am_libntp_a_OBJECTS = a_md5encrypt$U.o adjtime$U.o atoint$U.o \ -atolfp$U.o atouint$U.o authencrypt$U.o authkeys$U.o authparity$U.o \ -authreadkeys$U.o authusekey$U.o buftvtots$U.o caljulian$U.o \ -calleapwhen$U.o caltontp$U.o calyearstart$U.o clocktime$U.o \ -clocktypes$U.o decodenetnum$U.o dofptoa$U.o dolfptoa$U.o emalloc$U.o \ -findconfig$U.o fptoa$U.o fptoms$U.o getopt$U.o hextoint$U.o \ -hextolfp$U.o humandate$U.o inttoa$U.o lib_strbuf$U.o machines$U.o \ -md5c$U.o memmove$U.o mfptoa$U.o mfptoms$U.o modetoa$U.o mstolfp$U.o \ -msutotsf$U.o msyslog$U.o netof$U.o numtoa$U.o numtohost$U.o \ -octtoint$U.o prettydate$U.o ranny$U.o refnumtoa$U.o statestr$U.o \ -syssignal$U.o systime$U.o tsftomsu$U.o tstotv$U.o tvtoa$U.o tvtots$U.o \ -uglydate$U.o uinttoa$U.o utvtoa$U.o ymd2yd$U.o mfp_mul$U.o binio$U.o \ -ieee754io$U.o gpstolfp$U.o recvbuff$U.o iosignal$U.o icom$U.o audio$U.o -libntp_a_OBJECTS = $(am_libntp_a_OBJECTS) +am_libntp_a_OBJECTS = a_md5encrypt$U.$(OBJEXT) adjtime$U.$(OBJEXT) \ +atoint$U.$(OBJEXT) atolfp$U.$(OBJEXT) atouint$U.$(OBJEXT) \ +authencrypt$U.$(OBJEXT) authkeys$U.$(OBJEXT) authparity$U.$(OBJEXT) \ +authreadkeys$U.$(OBJEXT) authusekey$U.$(OBJEXT) buftvtots$U.$(OBJEXT) \ +caljulian$U.$(OBJEXT) calleapwhen$U.$(OBJEXT) caltontp$U.$(OBJEXT) \ +calyearstart$U.$(OBJEXT) clocktime$U.$(OBJEXT) clocktypes$U.$(OBJEXT) \ +decodenetnum$U.$(OBJEXT) dofptoa$U.$(OBJEXT) dolfptoa$U.$(OBJEXT) \ +emalloc$U.$(OBJEXT) findconfig$U.$(OBJEXT) fptoa$U.$(OBJEXT) \ +fptoms$U.$(OBJEXT) getopt$U.$(OBJEXT) hextoint$U.$(OBJEXT) \ +hextolfp$U.$(OBJEXT) humandate$U.$(OBJEXT) inttoa$U.$(OBJEXT) \ +lib_strbuf$U.$(OBJEXT) machines$U.$(OBJEXT) md5c$U.$(OBJEXT) \ +memmove$U.$(OBJEXT) mfptoa$U.$(OBJEXT) mfptoms$U.$(OBJEXT) \ +modetoa$U.$(OBJEXT) mstolfp$U.$(OBJEXT) msutotsf$U.$(OBJEXT) \ +msyslog$U.$(OBJEXT) netof$U.$(OBJEXT) numtoa$U.$(OBJEXT) \ +numtohost$U.$(OBJEXT) octtoint$U.$(OBJEXT) prettydate$U.$(OBJEXT) \ +ranny$U.$(OBJEXT) refnumtoa$U.$(OBJEXT) statestr$U.$(OBJEXT) \ +syssignal$U.$(OBJEXT) systime$U.$(OBJEXT) tsftomsu$U.$(OBJEXT) \ +tstotv$U.$(OBJEXT) tvtoa$U.$(OBJEXT) tvtots$U.$(OBJEXT) \ +uglydate$U.$(OBJEXT) uinttoa$U.$(OBJEXT) utvtoa$U.$(OBJEXT) \ +ymd2yd$U.$(OBJEXT) mfp_mul$U.$(OBJEXT) binio$U.$(OBJEXT) \ +ieee754io$U.$(OBJEXT) gpstolfp$U.$(OBJEXT) recvbuff$U.$(OBJEXT) \ +iosignal$U.$(OBJEXT) icom$U.$(OBJEXT) audio$U.$(OBJEXT) +libntp_a_OBJECTS = $(am_libntp_a_OBJECTS) AR = ar COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libntp_a_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in mktime.c \ -strerror.c - +DIST_SOURCES = $(libntp_a_SOURCES) $(EXTRA_libntp_a_SOURCES) +HEADERS = $(noinst_HEADERS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/a_md5encrypt$U.Po $(DEPDIR)/adjtime$U.Po \ -$(DEPDIR)/atoint$U.Po $(DEPDIR)/atolfp$U.Po $(DEPDIR)/atouint$U.Po \ -$(DEPDIR)/audio$U.Po $(DEPDIR)/authencrypt$U.Po $(DEPDIR)/authkeys$U.Po \ -$(DEPDIR)/authparity$U.Po $(DEPDIR)/authreadkeys$U.Po \ -$(DEPDIR)/authusekey$U.Po $(DEPDIR)/binio$U.Po $(DEPDIR)/buftvtots$U.Po \ -$(DEPDIR)/caljulian$U.Po $(DEPDIR)/calleapwhen$U.Po \ -$(DEPDIR)/caltontp$U.Po $(DEPDIR)/calyearstart$U.Po \ -$(DEPDIR)/clocktime$U.Po $(DEPDIR)/clocktypes$U.Po \ -$(DEPDIR)/decodenetnum$U.Po $(DEPDIR)/dofptoa$U.Po \ -$(DEPDIR)/dolfptoa$U.Po $(DEPDIR)/emalloc$U.Po \ -$(DEPDIR)/findconfig$U.Po $(DEPDIR)/fptoa$U.Po $(DEPDIR)/fptoms$U.Po \ -$(DEPDIR)/getopt$U.Po $(DEPDIR)/gpstolfp$U.Po $(DEPDIR)/hextoint$U.Po \ -$(DEPDIR)/hextolfp$U.Po $(DEPDIR)/humandate$U.Po $(DEPDIR)/icom$U.Po \ -$(DEPDIR)/ieee754io$U.Po $(DEPDIR)/inttoa$U.Po $(DEPDIR)/iosignal$U.Po \ -$(DEPDIR)/lib_strbuf$U.Po $(DEPDIR)/machines$U.Po $(DEPDIR)/md5c$U.Po \ -$(DEPDIR)/memmove$U.Po $(DEPDIR)/mfp_mul$U.Po $(DEPDIR)/mfptoa$U.Po \ -$(DEPDIR)/mfptoms$U.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modetoa$U.Po \ -$(DEPDIR)/mstolfp$U.Po $(DEPDIR)/msutotsf$U.Po $(DEPDIR)/msyslog$U.Po \ -$(DEPDIR)/netof$U.Po $(DEPDIR)/numtoa$U.Po $(DEPDIR)/numtohost$U.Po \ -$(DEPDIR)/octtoint$U.Po $(DEPDIR)/prettydate$U.Po $(DEPDIR)/ranny$U.Po \ -$(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po \ -$(DEPDIR)/statestr$U.Po $(DEPDIR)/strerror.Po $(DEPDIR)/syssignal$U.Po \ -$(DEPDIR)/systime$U.Po $(DEPDIR)/tsftomsu$U.Po $(DEPDIR)/tstotv$U.Po \ -$(DEPDIR)/tvtoa$U.Po $(DEPDIR)/tvtots$U.Po $(DEPDIR)/uglydate$U.Po \ -$(DEPDIR)/uinttoa$U.Po $(DEPDIR)/utvtoa$U.Po $(DEPDIR)/ymd2yd$U.Po -SOURCES = $(libntp_a_SOURCES) +@AMDEP@DEP_FILES = $(DEPDIR)/*.Po $(DEPDIR)/a_md5encrypt$U.Po \ +@AMDEP@ $(DEPDIR)/adjtime$U.Po $(DEPDIR)/adjtimex$U.Po \ +@AMDEP@ $(DEPDIR)/atoint$U.Po $(DEPDIR)/atolfp$U.Po \ +@AMDEP@ $(DEPDIR)/atouint$U.Po $(DEPDIR)/audio$U.Po \ +@AMDEP@ $(DEPDIR)/authencrypt$U.Po $(DEPDIR)/authkeys$U.Po \ +@AMDEP@ $(DEPDIR)/authparity$U.Po $(DEPDIR)/authreadkeys$U.Po \ +@AMDEP@ $(DEPDIR)/authusekey$U.Po $(DEPDIR)/binio$U.Po \ +@AMDEP@ $(DEPDIR)/buftvtots$U.Po $(DEPDIR)/caljulian$U.Po \ +@AMDEP@ $(DEPDIR)/calleapwhen$U.Po $(DEPDIR)/caltontp$U.Po \ +@AMDEP@ $(DEPDIR)/calyearstart$U.Po $(DEPDIR)/clocktime$U.Po \ +@AMDEP@ $(DEPDIR)/clocktypes$U.Po $(DEPDIR)/decodenetnum$U.Po \ +@AMDEP@ $(DEPDIR)/dofptoa$U.Po $(DEPDIR)/dolfptoa$U.Po \ +@AMDEP@ $(DEPDIR)/emalloc$U.Po $(DEPDIR)/findconfig$U.Po \ +@AMDEP@ $(DEPDIR)/fptoa$U.Po $(DEPDIR)/fptoms$U.Po $(DEPDIR)/getopt$U.Po \ +@AMDEP@ $(DEPDIR)/gpstolfp$U.Po $(DEPDIR)/hextoint$U.Po \ +@AMDEP@ $(DEPDIR)/hextolfp$U.Po $(DEPDIR)/humandate$U.Po \ +@AMDEP@ $(DEPDIR)/icom$U.Po $(DEPDIR)/ieee754io$U.Po \ +@AMDEP@ $(DEPDIR)/inttoa$U.Po $(DEPDIR)/iosignal$U.Po \ +@AMDEP@ $(DEPDIR)/lib_strbuf$U.Po $(DEPDIR)/log$U.Po \ +@AMDEP@ $(DEPDIR)/machines$U.Po $(DEPDIR)/md5c$U.Po \ +@AMDEP@ $(DEPDIR)/memmove$U.Po $(DEPDIR)/mfp_mul$U.Po \ +@AMDEP@ $(DEPDIR)/mfptoa$U.Po $(DEPDIR)/mfptoms$U.Po \ +@AMDEP@ $(DEPDIR)/mktime$U.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modetoa$U.Po \ +@AMDEP@ $(DEPDIR)/mstolfp$U.Po $(DEPDIR)/msutotsf$U.Po \ +@AMDEP@ $(DEPDIR)/msyslog$U.Po $(DEPDIR)/netof$U.Po \ +@AMDEP@ $(DEPDIR)/numtoa$U.Po $(DEPDIR)/numtohost$U.Po \ +@AMDEP@ $(DEPDIR)/octtoint$U.Po $(DEPDIR)/prettydate$U.Po \ +@AMDEP@ $(DEPDIR)/random$U.Po $(DEPDIR)/ranny$U.Po \ +@AMDEP@ $(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po \ +@AMDEP@ $(DEPDIR)/snprintf$U.Po $(DEPDIR)/snprintf.Po \ +@AMDEP@ $(DEPDIR)/statestr$U.Po $(DEPDIR)/strdup$U.Po \ +@AMDEP@ $(DEPDIR)/strdup.Po $(DEPDIR)/strerror$U.Po \ +@AMDEP@ $(DEPDIR)/strerror.Po $(DEPDIR)/syssignal$U.Po \ +@AMDEP@ $(DEPDIR)/systime$U.Po $(DEPDIR)/tsftomsu$U.Po \ +@AMDEP@ $(DEPDIR)/tstotv$U.Po $(DEPDIR)/tvtoa$U.Po $(DEPDIR)/tvtots$U.Po \ +@AMDEP@ $(DEPDIR)/uglydate$U.Po $(DEPDIR)/uinttoa$U.Po \ +@AMDEP@ $(DEPDIR)/utvtoa$U.Po $(DEPDIR)/ymd2yd$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in mktime.c \ +snprintf.c strdup.c strerror.c + +SOURCES = $(libntp_a_SOURCES) $(EXTRA_libntp_a_SOURCES) OBJECTS = $(am_libntp_a_OBJECTS) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu libntp/Makefile +all: all-am -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libntp/Makefile -mostlyclean-noinstLIBRARIES: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - libntp.a: $(libntp_a_OBJECTS) $(libntp_a_DEPENDENCIES) -rm -f libntp.a $(libntp_a_AR) libntp.a $(libntp_a_OBJECTS) $(libntp_a_LIBADD) @@ -246,6 +271,8 @@ a_md5encrypt_.c: a_md5encrypt.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/a_md5encrypt.c; then echo $(srcdir)/a_md5encrypt.c; else echo a_md5encrypt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > a_md5encrypt_.c adjtime_.c: adjtime.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/adjtime.c; then echo $(srcdir)/adjtime.c; else echo adjtime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > adjtime_.c +adjtimex_.c: adjtimex.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/adjtimex.c; then echo $(srcdir)/adjtimex.c; else echo adjtimex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > adjtimex_.c atoint_.c: atoint.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/atoint.c; then echo $(srcdir)/atoint.c; else echo atoint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > atoint_.c atolfp_.c: atolfp.c $(ANSI2KNR) @@ -314,6 +341,8 @@ iosignal_.c: iosignal.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iosignal.c; then echo $(srcdir)/iosignal.c; else echo iosignal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > iosignal_.c lib_strbuf_.c: lib_strbuf.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lib_strbuf.c; then echo $(srcdir)/lib_strbuf.c; else echo lib_strbuf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lib_strbuf_.c +log_.c: log.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/log.c; then echo $(srcdir)/log.c; else echo log.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > log_.c machines_.c: machines.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/machines.c; then echo $(srcdir)/machines.c; else echo machines.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > machines_.c md5c_.c: md5c.c $(ANSI2KNR) @@ -346,14 +375,20 @@ octtoint_.c: octtoint.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/octtoint.c; then echo $(srcdir)/octtoint.c; else echo octtoint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > octtoint_.c prettydate_.c: prettydate.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/prettydate.c; then echo $(srcdir)/prettydate.c; else echo prettydate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > prettydate_.c +random_.c: random.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > random_.c ranny_.c: ranny.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ranny.c; then echo $(srcdir)/ranny.c; else echo ranny.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ranny_.c recvbuff_.c: recvbuff.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/recvbuff.c; then echo $(srcdir)/recvbuff.c; else echo recvbuff.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > recvbuff_.c refnumtoa_.c: refnumtoa.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refnumtoa.c; then echo $(srcdir)/refnumtoa.c; else echo refnumtoa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refnumtoa_.c +snprintf_.c: snprintf.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprintf.c; then echo $(srcdir)/snprintf.c; else echo snprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > snprintf_.c statestr_.c: statestr.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/statestr.c; then echo $(srcdir)/statestr.c; else echo statestr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > statestr_.c +strdup_.c: strdup.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strdup_.c strerror_.c: strerror.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strerror.c; then echo $(srcdir)/strerror.c; else echo strerror.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strerror_.c syssignal_.c: syssignal.c $(ANSI2KNR) @@ -376,18 +411,30 @@ utvtoa_.c: utvtoa.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/utvtoa.c; then echo $(srcdir)/utvtoa.c; else echo utvtoa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > utvtoa_.c ymd2yd_.c: ymd2yd.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ymd2yd.c; then echo $(srcdir)/ymd2yd.c; else echo ymd2yd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ymd2yd_.c -a_md5encrypt_.o adjtime_.o atoint_.o atolfp_.o atouint_.o audio_.o \ -authencrypt_.o authkeys_.o authparity_.o authreadkeys_.o authusekey_.o \ -binio_.o buftvtots_.o caljulian_.o calleapwhen_.o caltontp_.o \ -calyearstart_.o clocktime_.o clocktypes_.o decodenetnum_.o dofptoa_.o \ -dolfptoa_.o emalloc_.o findconfig_.o fptoa_.o fptoms_.o getopt_.o \ -gpstolfp_.o hextoint_.o hextolfp_.o humandate_.o icom_.o ieee754io_.o \ -inttoa_.o iosignal_.o lib_strbuf_.o machines_.o md5c_.o memmove_.o \ -mfp_mul_.o mfptoa_.o mfptoms_.o mktime_.o modetoa_.o mstolfp_.o \ -msutotsf_.o msyslog_.o netof_.o numtoa_.o numtohost_.o octtoint_.o \ -prettydate_.o ranny_.o recvbuff_.o refnumtoa_.o statestr_.o strerror_.o \ -syssignal_.o systime_.o tsftomsu_.o tstotv_.o tvtoa_.o tvtots_.o \ -uglydate_.o uinttoa_.o utvtoa_.o ymd2yd_.o : $(ANSI2KNR) +a_md5encrypt_.$(OBJEXT) adjtime_.$(OBJEXT) adjtimex_.$(OBJEXT) \ +atoint_.$(OBJEXT) atolfp_.$(OBJEXT) atouint_.$(OBJEXT) audio_.$(OBJEXT) \ +authencrypt_.$(OBJEXT) authkeys_.$(OBJEXT) authparity_.$(OBJEXT) \ +authreadkeys_.$(OBJEXT) authusekey_.$(OBJEXT) binio_.$(OBJEXT) \ +buftvtots_.$(OBJEXT) caljulian_.$(OBJEXT) calleapwhen_.$(OBJEXT) \ +caltontp_.$(OBJEXT) calyearstart_.$(OBJEXT) clocktime_.$(OBJEXT) \ +clocktypes_.$(OBJEXT) decodenetnum_.$(OBJEXT) dofptoa_.$(OBJEXT) \ +dolfptoa_.$(OBJEXT) emalloc_.$(OBJEXT) findconfig_.$(OBJEXT) \ +fptoa_.$(OBJEXT) fptoms_.$(OBJEXT) getopt_.$(OBJEXT) \ +gpstolfp_.$(OBJEXT) hextoint_.$(OBJEXT) hextolfp_.$(OBJEXT) \ +humandate_.$(OBJEXT) icom_.$(OBJEXT) ieee754io_.$(OBJEXT) \ +inttoa_.$(OBJEXT) iosignal_.$(OBJEXT) lib_strbuf_.$(OBJEXT) \ +log_.$(OBJEXT) machines_.$(OBJEXT) md5c_.$(OBJEXT) memmove_.$(OBJEXT) \ +mfp_mul_.$(OBJEXT) mfptoa_.$(OBJEXT) mfptoms_.$(OBJEXT) \ +mktime_.$(OBJEXT) modetoa_.$(OBJEXT) mstolfp_.$(OBJEXT) \ +msutotsf_.$(OBJEXT) msyslog_.$(OBJEXT) netof_.$(OBJEXT) \ +numtoa_.$(OBJEXT) numtohost_.$(OBJEXT) octtoint_.$(OBJEXT) \ +prettydate_.$(OBJEXT) random_.$(OBJEXT) ranny_.$(OBJEXT) \ +recvbuff_.$(OBJEXT) refnumtoa_.$(OBJEXT) snprintf_.$(OBJEXT) \ +statestr_.$(OBJEXT) strdup_.$(OBJEXT) strerror_.$(OBJEXT) \ +syssignal_.$(OBJEXT) systime_.$(OBJEXT) tsftomsu_.$(OBJEXT) \ +tstotv_.$(OBJEXT) tvtoa_.$(OBJEXT) tvtots_.$(OBJEXT) \ +uglydate_.$(OBJEXT) uinttoa_.$(OBJEXT) utvtoa_.$(OBJEXT) \ +ymd2yd_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -398,9 +445,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -413,139 +460,146 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/a_md5encrypt$U.Po -@AMDEP@include $(DEPDIR)/adjtime$U.Po -@AMDEP@include $(DEPDIR)/atoint$U.Po -@AMDEP@include $(DEPDIR)/atolfp$U.Po -@AMDEP@include $(DEPDIR)/atouint$U.Po -@AMDEP@include $(DEPDIR)/audio$U.Po -@AMDEP@include $(DEPDIR)/authencrypt$U.Po -@AMDEP@include $(DEPDIR)/authkeys$U.Po -@AMDEP@include $(DEPDIR)/authparity$U.Po -@AMDEP@include $(DEPDIR)/authreadkeys$U.Po -@AMDEP@include $(DEPDIR)/authusekey$U.Po -@AMDEP@include $(DEPDIR)/binio$U.Po -@AMDEP@include $(DEPDIR)/buftvtots$U.Po -@AMDEP@include $(DEPDIR)/caljulian$U.Po -@AMDEP@include $(DEPDIR)/calleapwhen$U.Po -@AMDEP@include $(DEPDIR)/caltontp$U.Po -@AMDEP@include $(DEPDIR)/calyearstart$U.Po -@AMDEP@include $(DEPDIR)/clocktime$U.Po -@AMDEP@include $(DEPDIR)/clocktypes$U.Po -@AMDEP@include $(DEPDIR)/decodenetnum$U.Po -@AMDEP@include $(DEPDIR)/dofptoa$U.Po -@AMDEP@include $(DEPDIR)/dolfptoa$U.Po -@AMDEP@include $(DEPDIR)/emalloc$U.Po -@AMDEP@include $(DEPDIR)/findconfig$U.Po -@AMDEP@include $(DEPDIR)/fptoa$U.Po -@AMDEP@include $(DEPDIR)/fptoms$U.Po -@AMDEP@include $(DEPDIR)/getopt$U.Po -@AMDEP@include $(DEPDIR)/gpstolfp$U.Po -@AMDEP@include $(DEPDIR)/hextoint$U.Po -@AMDEP@include $(DEPDIR)/hextolfp$U.Po -@AMDEP@include $(DEPDIR)/humandate$U.Po -@AMDEP@include $(DEPDIR)/icom$U.Po -@AMDEP@include $(DEPDIR)/ieee754io$U.Po -@AMDEP@include $(DEPDIR)/inttoa$U.Po -@AMDEP@include $(DEPDIR)/iosignal$U.Po -@AMDEP@include $(DEPDIR)/lib_strbuf$U.Po -@AMDEP@include $(DEPDIR)/machines$U.Po -@AMDEP@include $(DEPDIR)/md5c$U.Po -@AMDEP@include $(DEPDIR)/memmove$U.Po -@AMDEP@include $(DEPDIR)/mfp_mul$U.Po -@AMDEP@include $(DEPDIR)/mfptoa$U.Po -@AMDEP@include $(DEPDIR)/mfptoms$U.Po -@AMDEP@include $(DEPDIR)/mktime.Po -@AMDEP@include $(DEPDIR)/modetoa$U.Po -@AMDEP@include $(DEPDIR)/mstolfp$U.Po -@AMDEP@include $(DEPDIR)/msutotsf$U.Po -@AMDEP@include $(DEPDIR)/msyslog$U.Po -@AMDEP@include $(DEPDIR)/netof$U.Po -@AMDEP@include $(DEPDIR)/numtoa$U.Po -@AMDEP@include $(DEPDIR)/numtohost$U.Po -@AMDEP@include $(DEPDIR)/octtoint$U.Po -@AMDEP@include $(DEPDIR)/prettydate$U.Po -@AMDEP@include $(DEPDIR)/ranny$U.Po -@AMDEP@include $(DEPDIR)/recvbuff$U.Po -@AMDEP@include $(DEPDIR)/refnumtoa$U.Po -@AMDEP@include $(DEPDIR)/statestr$U.Po -@AMDEP@include $(DEPDIR)/strerror.Po -@AMDEP@include $(DEPDIR)/syssignal$U.Po -@AMDEP@include $(DEPDIR)/systime$U.Po -@AMDEP@include $(DEPDIR)/tsftomsu$U.Po -@AMDEP@include $(DEPDIR)/tstotv$U.Po -@AMDEP@include $(DEPDIR)/tvtoa$U.Po -@AMDEP@include $(DEPDIR)/tvtots$U.Po -@AMDEP@include $(DEPDIR)/uglydate$U.Po -@AMDEP@include $(DEPDIR)/uinttoa$U.Po -@AMDEP@include $(DEPDIR)/utvtoa$U.Po -@AMDEP@include $(DEPDIR)/ymd2yd$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/*.Po +@AMDEP@@_am_include@ $(DEPDIR)/a_md5encrypt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/adjtime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/adjtimex$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atouint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/audio$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authencrypt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authkeys$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authparity$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authreadkeys$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authusekey$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/binio$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/buftvtots$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/caljulian$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/calleapwhen$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/caltontp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/calyearstart$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clocktime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clocktypes$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/decodenetnum$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/dofptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/dolfptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/emalloc$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/findconfig$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/fptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/fptoms$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/getopt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/gpstolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/hextoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/hextolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/humandate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/icom$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ieee754io$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/inttoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/iosignal$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/lib_strbuf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/log$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/machines$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/md5c$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/memmove$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfp_mul$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfptoms$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mktime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mktime.Po +@AMDEP@@_am_include@ $(DEPDIR)/modetoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mstolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/msutotsf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/msyslog$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/netof$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/numtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/numtohost$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/octtoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/prettydate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/random$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ranny$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/recvbuff$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refnumtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/snprintf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/snprintf.Po +@AMDEP@@_am_include@ $(DEPDIR)/statestr$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strdup$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strdup.Po +@AMDEP@@_am_include@ $(DEPDIR)/strerror$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strerror.Po +@AMDEP@@_am_include@ $(DEPDIR)/syssignal$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/systime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tsftomsu$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tstotv$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tvtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tvtots$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/uglydate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/uinttoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/utvtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ymd2yd$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(LIBRARIES) $(HEADERS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -556,45 +610,53 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am -clean-am: clean-noinstLIBRARIES clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstLIBRARIES distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-kr tags uninstall uninstall-am ../include/des.h: diff --git a/contrib/ntp/libntp/a_md5encrypt.c b/contrib/ntp/libntp/a_md5encrypt.c index 76f9c4f..b7f2322 100644 --- a/contrib/ntp/libntp/a_md5encrypt.c +++ b/contrib/ntp/libntp/a_md5encrypt.c @@ -14,18 +14,15 @@ #include <config.h> #endif -#ifdef MD5 #include <stdio.h> #include "ntp_types.h" -#include "ntp_fp.h" #include "ntp_string.h" #include "global.h" #include "md5.h" #include "ntp_stdlib.h" #define BLOCK_OCTETS 16 /* message digest size */ -#define NTP_MAXKEY 65535 /* max identifier from ntp.h */ /* @@ -85,48 +82,3 @@ MD5authdecrypt( return (!memcmp((char *)digest, (char *)pkt + length + 4, BLOCK_OCTETS)); } - - -/* - * session_key - generate session key from supplied plaintext. - * - * Returns hashed session key for validation. - */ -u_long -session_key( - u_int32 srcadr, /* source address */ - u_int32 dstadr, /* destination address */ - u_long keyno, /* key identifier */ - u_long lifetime /* key lifetime */ - ) -{ - MD5_CTX ctx; - u_int32 header[3]; - u_long keyid; - u_char digest[BLOCK_OCTETS]; - - /* - * Generate the session key and retrieve the hash for later. If - * the lifetime is greater than zero, call the key trusted. - */ - header[0] = htonl(srcadr); - header[1] = htonl(dstadr); - header[2] = htonl(keyno); - MD5Init(&ctx); - MD5Update(&ctx, (u_char *)header, sizeof(header)); - MD5Final(digest, &ctx); - memcpy(&keyid, digest, 4); - if (lifetime != 0) { - MD5auth_setkey(keyno, digest, BLOCK_OCTETS); - authtrust(keyno, (int)lifetime); - } -#ifdef DEBUG - if (debug > 1) - printf( - "session_key: from %s to %s keyid %08lx hash %08lx life %ld\n", - numtoa(htonl(srcadr)), numtoa(htonl(dstadr)), keyno, - keyid, lifetime); -#endif - return (keyid); -} -#endif /* MD5 */ diff --git a/contrib/ntp/libntp/audio.c b/contrib/ntp/libntp/audio.c index 3228bba..1fedb3e 100644 --- a/contrib/ntp/libntp/audio.c +++ b/contrib/ntp/libntp/audio.c @@ -5,16 +5,26 @@ #include <config.h> #endif +#if defined(HAVE_SYS_AUDIOIO_H) || defined(HAVE_SUN_AUDIOIO_H) + #include "audio.h" -#include <unistd.h> +#include "ntp_stdlib.h" +#include "ntp_syslog.h" +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif #include <stdio.h> +#include "ntp_string.h" #ifdef HAVE_SYS_AUDIOIO_H #include <sys/audioio.h> #endif /* HAVE_SYS_AUDIOIO_H */ + #ifdef HAVE_SUN_AUDIOIO_H +#include <sys/ioccom.h> #include <sun/audioio.h> #endif /* HAVE_SUN_AUDIOIO_H */ + #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif /* HAVE_SYS_IOCTL_H */ @@ -26,9 +36,9 @@ */ #ifdef HAVE_SYS_AUDIOIO_H static struct audio_device device; /* audio device ident */ +#endif /* HAVE_SYS_AUDIOIO_H */ static struct audio_info info; /* audio device info */ static int ctl_fd; /* audio control file descriptor */ -#endif /* HAVE_SYS_AUDIOIO_H */ /* @@ -43,29 +53,26 @@ static int ctl_fd; /* audio control file descriptor */ * default. */ int -audio_init(void) +audio_init( + char *dname /* device name */ + ) { int fd; -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ /* - * Open audio device + * Open audio device. Do not complain if not there. */ - fd = open("/dev/audio", O_RDWR | O_NONBLOCK, 0777); - if (fd < 0) { - perror("audio:"); + fd = open(dname, O_RDWR | O_NONBLOCK, 0777); + if (fd < 0) return (fd); - } -#ifdef HAVE_SYS_AUDIOIO_H /* - * Open audio control device + * Open audio control device. */ ctl_fd = open("/dev/audioctl", O_RDWR); if (ctl_fd < 0) { - perror("audioctl:"); + msyslog(LOG_ERR, "audio: invalid control device\n"); close(fd); return(ctl_fd); } @@ -76,11 +83,11 @@ audio_init(void) rval = audio_gain((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) / 2, AUDIO_MICROPHONE); if (rval < 0) { + msyslog(LOG_ERR, "audio: invalid control device parameters\n"); close(ctl_fd); close(fd); return(rval); } -#endif /* HAVE_SYS_AUDIOIO_H */ return (fd); } @@ -94,25 +101,21 @@ audio_gain( int port /* port */ ) { -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ -#ifdef HAVE_SYS_AUDIOIO_H AUDIO_INITINFO(&info); +#ifdef HAVE_SYS_AUDIOIO_H info.record.buffer_size = AUDIO_BUFSIZ; +#endif /* HAVE_SYS_AUDIOIO_H */ info.record.gain = gain; info.record.port = port; info.record.error = 0; rval = ioctl(ctl_fd, (int)AUDIO_SETINFO, &info); if (rval < 0) { - perror("audio:"); + msyslog(LOG_ERR, "audio_gain: %m"); return (rval); } return (info.record.error); -#else - return (0); -#endif /* HAVE_SYS_AUDIOIO_H */ } @@ -129,26 +132,19 @@ audio_show(void) ioctl(ctl_fd, (int)AUDIO_GETDEV, &device); printf("audio: name %s, version %s, config %s\n", device.name, device.version, device.config); +#endif /* HAVE_SYS_AUDIOIO_H */ ioctl(ctl_fd, (int)AUDIO_GETINFO, &info); printf( - "audio: samples %d, channels %d, precision %d, encoding %d\n", + "audio: samples %d, channels %d, precision %d, encoding %d, gain %d, port %d\n", info.record.sample_rate, info.record.channels, - info.record.precision, info.record.encoding); - printf("audio: gain %d, port %d, buffer %d\n", - info.record.gain, info.record.port, - info.record.buffer_size); - printf("audio: gain %d, port %d\n", + info.record.precision, info.record.encoding, info.record.gain, info.record.port); printf( "audio: samples %d, eof %d, pause %d, error %d, waiting %d, balance %d\n", info.record.samples, info.record.eof, info.record.pause, info.record.error, info.record.waiting, info.record.balance); - printf("audio: monitor %d, muted %d\n", - info.monitor_gain, info.output_muted); -#endif /* HAVE_SYS_AUDIOIO_H */ -#ifdef __NetBSD__ - printf("audio: monitor %d, blocksize %d, hiwat %d, lowat %d, mode %d\n", - info.monitor_gain, info.blocksize, info.hiwat, info.lowat, info.mode); -#endif /* __NetBSD__ */ } +#else +int audio_bs; +#endif /* HAVE_SYS_AUDIOIO_H HAVE_SUN_AUDIOIO_H */ diff --git a/contrib/ntp/libntp/authencrypt.c b/contrib/ntp/libntp/authencrypt.c index 22f910c..075afe0 100644 --- a/contrib/ntp/libntp/authencrypt.c +++ b/contrib/ntp/libntp/authencrypt.c @@ -67,7 +67,7 @@ int DESauthdecrypt( u_char *key, /* key pointer */ u_int32 *pkt, /* packet pointer */ - int length, /* packet length */ + int length, /* packet length */ int size /* size of MAC field */ ) { diff --git a/contrib/ntp/libntp/authkeys.c b/contrib/ntp/libntp/authkeys.c index 578688b..f35d91c 100644 --- a/contrib/ntp/libntp/authkeys.c +++ b/contrib/ntp/libntp/authkeys.c @@ -26,16 +26,12 @@ struct savekey { #ifdef DES u_int32 DES_key[2]; /* DES key */ #endif -#ifdef MD5 u_char MD5_key[32]; /* MD5 key */ -#endif } k; - u_long keyid; /* key identifier */ + keyid_t keyid; /* key identifier */ u_short flags; /* flags that wave */ u_long lifetime; /* remaining lifetime */ -#ifdef MD5 int keylen; /* key length */ -#endif }; #define KEY_TRUSTED 0x001 /* this key is trusted */ @@ -73,7 +69,7 @@ int authnumfreekeys; /* * The key cache. We cache the last key we looked at here. */ -u_long cache_keyid; /* key identifier */ +keyid_t cache_keyid; /* key identifier */ u_char *cache_key; /* key pointer */ u_int cache_keylen; /* key length */ u_short cache_flags; /* flags that wave */ @@ -97,7 +93,7 @@ init_auth(void) */ struct savekey * auth_findkey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -118,7 +114,7 @@ auth_findkey( */ int auth_havekey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -142,7 +138,7 @@ auth_havekey( */ int authhavekey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -167,13 +163,11 @@ authhavekey( } cache_keyid = sk->keyid; cache_flags = sk->flags; -#ifdef MD5 if (sk->flags & KEY_MD5) { cache_key = sk->k.MD5_key; cache_keylen = sk->keylen; return (1); } -#endif #ifdef DES if (sk->flags & KEY_DES) { cache_key = (u_char *)sk->k.DES_key; @@ -211,15 +205,15 @@ auth_moremem(void) */ void authtrust( - u_long keyno, - int trust + keyid_t keyno, + u_long trust ) { struct savekey *sk; #ifdef DEBUG - if (debug > 1) - printf("authtrust: keyid %08lx life %d\n", (u_long)keyno, trust); + if (debug > 2) + printf("authtrust: keyid %08x life %lu\n", keyno, trust); #endif sk = key_hash[KEYHASH(keyno)]; while (sk != 0) { @@ -288,7 +282,7 @@ authtrust( */ int authistrusted( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -321,7 +315,7 @@ authistrusted( */ void DESauth_setkey( - u_long keyno, + keyid_t keyno, const u_int32 *key ) { @@ -368,10 +362,9 @@ DESauth_setkey( } #endif -#ifdef MD5 void MD5auth_setkey( - u_long keyno, + keyid_t keyno, const u_char *key, const int len ) @@ -425,7 +418,6 @@ MD5auth_setkey( authnumkeys++; return; } -#endif /* * auth_delkeys - delete all known keys, in preparation for rereading @@ -451,9 +443,7 @@ auth_delkeys(void) if (sk->flags & KEY_TRUSTED) { memset(&sk->k, 0, sizeof(sk->k)); sk->lifetime = 0; -#ifdef MD5 sk->keylen = 0; -#endif sk = sk->next; } else { *skp = sk->next; @@ -503,7 +493,7 @@ auth_agekeys(void) */ int authencrypt( - u_long keyno, + keyid_t keyno, u_int32 *pkt, int length ) @@ -515,7 +505,7 @@ authencrypt( * consists of a single word with value zero. */ authencryptions++; - pkt[length / 4] = (u_long)htonl(keyno); + pkt[length / 4] = htonl(keyno); if (keyno == 0) { return (4); } @@ -527,10 +517,9 @@ authencrypt( return (DESauthencrypt(cache_key, pkt, length)); #endif -#ifdef MD5 if (cache_flags & KEY_MD5) return (MD5authencrypt(cache_key, pkt, length)); -#endif + return (0); } @@ -541,7 +530,7 @@ authencrypt( */ int authdecrypt( - u_long keyno, + keyid_t keyno, u_int32 *pkt, int length, int size @@ -555,7 +544,7 @@ authdecrypt( */ authdecryptions++; if (keyno == 0) - return (1); + return (0); if (!authhavekey(keyno) || size < 4) return (0); @@ -565,10 +554,8 @@ authdecrypt( return (DESauthdecrypt(cache_key, pkt, length, size)); #endif -#ifdef MD5 if (cache_flags & KEY_MD5) return (MD5authdecrypt(cache_key, pkt, length, size)); -#endif return (0); } diff --git a/contrib/ntp/libntp/authparity.c b/contrib/ntp/libntp/authparity.c index 32fde58..ea5eac0 100644 --- a/contrib/ntp/libntp/authparity.c +++ b/contrib/ntp/libntp/authparity.c @@ -1,6 +1,12 @@ /* * auth_parity - set parity on a key/check for odd parity */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef DES #include "ntp_stdlib.h" int @@ -55,3 +61,6 @@ DESauth_parity( */ return (parity_err == 0); } +#else +int authparity_bs; +#endif /* DES */ diff --git a/contrib/ntp/libntp/authreadkeys.c b/contrib/ntp/libntp/authreadkeys.c index 18ac0dd..ce5cefb 100644 --- a/contrib/ntp/libntp/authreadkeys.c +++ b/contrib/ntp/libntp/authreadkeys.c @@ -6,8 +6,8 @@ #include "ntp_fp.h" #include "ntp.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #ifdef DES /* @@ -22,12 +22,10 @@ #define KEY_TYPE_ASCII 3 #endif -#ifdef MD5 /* * Arbitrary long string of ASCII characters. */ #define KEY_TYPE_MD5 4 -#endif /* Forwards */ static char *nexttok P((char **)); @@ -155,11 +153,9 @@ authreadkeys( case 'a': keytype = KEY_TYPE_ASCII; break; #endif -#ifdef MD5 case 'M': case 'm': keytype = KEY_TYPE_MD5; break; -#endif default: msyslog(LOG_ERR, "invalid key type for key number %ld, entry ignored", @@ -188,7 +184,6 @@ authreadkeys( keyno); break; #endif -#ifdef MD5 case KEY_TYPE_MD5: if (!authusekey(keyno, keytype, (u_char *)token)) @@ -196,7 +191,6 @@ authreadkeys( "format/parity error for MD5 key %ld, not used", keyno); break; -#endif } } } diff --git a/contrib/ntp/libntp/authusekey.c b/contrib/ntp/libntp/authusekey.c index a399a48..18b8ba0 100644 --- a/contrib/ntp/libntp/authusekey.c +++ b/contrib/ntp/libntp/authusekey.c @@ -24,13 +24,11 @@ #endif -#ifdef MD5 #define KEY_TYPE_MD5 4 -#endif int authusekey( - u_long keyno, + keyid_t keyno, int keytype, const u_char *str ) @@ -119,11 +117,9 @@ authusekey( break; #endif -#ifdef MD5 case KEY_TYPE_MD5: MD5auth_setkey(keyno, str, (int)strlen((const char *)str)); break; -#endif default: /* Oh, well */ diff --git a/contrib/ntp/libntp/buftvtots.c b/contrib/ntp/libntp/buftvtots.c index 96338bc..1944233 100644 --- a/contrib/ntp/libntp/buftvtots.c +++ b/contrib/ntp/libntp/buftvtots.c @@ -19,6 +19,7 @@ buftvtots( register const u_char *bp; register u_long sec; register u_long usec; + struct timeval tv; #ifdef WORDS_BIGENDIAN bp = (const u_char *)bufp; @@ -31,13 +32,33 @@ buftvtots( sec <<= 8; sec += (u_long)*bp++ & 0xff; + if (sizeof(tv.tv_sec) == 8) { + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + } + usec = (u_long)*bp++ & 0xff; usec <<= 8; usec += (u_long)*bp++ & 0xff; usec <<= 8; usec += (u_long)*bp++ & 0xff; usec <<= 8; - usec += (u_long)*bp & 0xff; + usec += (u_long)*bp++ & 0xff; + + if (sizeof(tv.tv_usec) == 8) { + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp & 0xff; + } #else bp = (const u_char *)bufp + 7; @@ -49,13 +70,33 @@ buftvtots( usec <<= 8; usec += (u_long)*bp-- & 0xff; + if (sizeof(tv.tv_usec) == 8) { + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + } + sec = (u_long)*bp-- & 0xff; sec <<= 8; sec += (u_long)*bp-- & 0xff; sec <<= 8; sec += (u_long)*bp-- & 0xff; sec <<= 8; - sec += (u_long)*bp & 0xff; + sec += (u_long)*bp-- & 0xff; + + if (sizeof (tv.tv_sec) == 8) { + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp & 0xff; + } #endif ts->l_ui = sec + (u_long)JAN_1970; if (usec > 999999) diff --git a/contrib/ntp/libntp/clocktypes.c b/contrib/ntp/libntp/clocktypes.c index 520dce4..cdfe356 100644 --- a/contrib/ntp/libntp/clocktypes.c +++ b/contrib/ntp/libntp/clocktypes.c @@ -86,6 +86,10 @@ struct clktype clktypes[] = { "WWV_AUDIO"}, { REFCLK_FG, "Forum Graphic GPS Dating Station (37)", "GPS_FG"}, + { REFCLK_HOPF_SERIAL, "hopf Elektronic serial line receiver (38)", + "HOPF_S"}, + { REFCLK_HOPF_PCI, "hopf Elektronic PCI receiver (39)", + "HOPF_P"}, { -1, "", "" } }; diff --git a/contrib/ntp/libntp/emalloc.c b/contrib/ntp/libntp/emalloc.c index 0918c9c..2fe4c38 100644 --- a/contrib/ntp/libntp/emalloc.c +++ b/contrib/ntp/libntp/emalloc.c @@ -3,8 +3,8 @@ */ #include "ntp_types.h" #include "ntp_malloc.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #if defined SYS_WINNT && defined DEBUG #include <crtdbg.h> @@ -22,7 +22,7 @@ debug_emalloc( char *mem; if ((mem = (char *)_malloc_dbg(size, _NORMAL_BLOCK, filename, line)) == 0) { - msyslog(LOG_ERR, "No more memory!"); + msyslog(LOG_ERR, "Exiting: No more memory!"); exit(1); } return mem; @@ -38,7 +38,7 @@ emalloc( char *mem; if ((mem = (char *)malloc(size)) == 0) { - msyslog(LOG_ERR, "No more memory!"); + msyslog(LOG_ERR, "Exiting: No more memory!"); exit(1); } return mem; diff --git a/contrib/ntp/libntp/gpstolfp.c b/contrib/ntp/libntp/gpstolfp.c index cf7b80c..c424784 100644 --- a/contrib/ntp/libntp/gpstolfp.c +++ b/contrib/ntp/libntp/gpstolfp.c @@ -7,7 +7,7 @@ */ #include "ntp_fp.h" -#define GPSORIGIN (unsigned)(2524953600L) /* NTP origin - GPS origin in seconds */ +#define GPSORIGIN ULONG_CONST(2524953600) /* NTP origin - GPS origin in seconds */ #define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */ #define GPSWRAP 990 /* assume week count less than this in the previous epoch */ diff --git a/contrib/ntp/libntp/humandate.c b/contrib/ntp/libntp/humandate.c index f663c9e..7995633 100644 --- a/contrib/ntp/libntp/humandate.c +++ b/contrib/ntp/libntp/humandate.c @@ -2,16 +2,11 @@ * humandate - convert an NTP (or the current) time to something readable */ #include <stdio.h> -#include "time.h" #include "ntp_fp.h" -#include "ntp_unixtime.h" /* includes <sys/time.h> */ +#include "ntp_unixtime.h" /* includes <sys/time.h> and <time.h> */ #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifdef TIME_WITH_SYS_TIME -#include <time.h> -#endif - static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" diff --git a/contrib/ntp/libntp/icom.c b/contrib/ntp/libntp/icom.c index 4d6efc5..3b9a9a5 100644 --- a/contrib/ntp/libntp/icom.c +++ b/contrib/ntp/libntp/icom.c @@ -8,17 +8,11 @@ #include "icom.h" #include <unistd.h> #include <stdio.h> - -#ifdef HAVE_TERMIOS_H -# include <termios.h> -#endif /* HAVE_TERMIOS_H */ -#ifdef HAVE_SYS_TERMIOS_H -# include <sys/termios.h> -#endif /* HAVE_SYS_TERMIOS_H */ - #include <fcntl.h> #include <errno.h> +#include "ntp_tty.h" + /* * Scraps */ @@ -142,7 +136,7 @@ icom_init( int speed, /* line speed */ int trace /* trace flags */ ) { - struct termios ttyb; + TTY ttyb; int fd; flags = trace; diff --git a/contrib/ntp/libntp/iosignal.c b/contrib/ntp/libntp/iosignal.c index c8ec949..3c78d48 100644 --- a/contrib/ntp/libntp/iosignal.c +++ b/contrib/ntp/libntp/iosignal.c @@ -3,40 +3,27 @@ * was shamelessly stolen from ntpd. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_if.h" +#include "ntp_stdlib.h" +#include "iosignal.h" #include <stdio.h> #include <signal.h> -#include <sys/types.h> #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif /* HAVE_SYS_PARAM_H */ -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif -#ifdef HAVE_SYS_SOCKIO_H /* UXPV: SIOC* #defines (Frank Vance <fvance@waii.com>) */ -# include <sys/sockio.h> -#endif + #include <arpa/inet.h> #if _BSDI_VERSION >= 199510 # include <ifaddrs.h> #endif -/* 98/06/01 */ -#include "ntp_machine.h" /* 98/06/01 */ -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_if.h" -#include "ntp_stdlib.h" -#include "iosignal.h" #if defined(HAVE_SIGNALED_IO) static int sigio_block_count = 0; diff --git a/contrib/ntp/libntp/lib_strbuf.c b/contrib/ntp/libntp/lib_strbuf.c index 690f1ad..315070f 100644 --- a/contrib/ntp/libntp/lib_strbuf.c +++ b/contrib/ntp/libntp/lib_strbuf.c @@ -2,6 +2,7 @@ * lib_strbuf - library string storage */ +#include "ntp_stdlib.h" #include "lib_strbuf.h" /* diff --git a/contrib/ntp/libntp/machines.c b/contrib/ntp/libntp/machines.c index bbcfd54..a3dcf2f 100644 --- a/contrib/ntp/libntp/machines.c +++ b/contrib/ntp/libntp/machines.c @@ -13,10 +13,6 @@ #include "ntp_stdlib.h" #include "ntp_unixtime.h" -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -195,7 +191,7 @@ getpass(const char * prompt) fprintf(stderr, "%s", prompt); fflush(stderr); #endif - for (i=0; i<sizeof(password)-1 && ((c=_getch())!='\n'); i++) { + for (i=0; i<sizeof(password)-1 && ((c=_getch())!='\n' && c!='\r'); i++) { password[i] = (char) c; } password[i] = '\0'; diff --git a/contrib/ntp/libntp/mktime.c b/contrib/ntp/libntp/mktime.c index c752690..b9cd42e 100644 --- a/contrib/ntp/libntp/mktime.c +++ b/contrib/ntp/libntp/mktime.c @@ -60,9 +60,7 @@ * by hand. Sorry about that. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "ntp_machine.h" #ifndef DSTMINUTES #define DSTMINUTES 60 @@ -84,12 +82,6 @@ #define TM_YEAR_BASE 1900 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#include <time.h> - extern time_t time(); static int mon_lengths[2][MONSPERYEAR] = { diff --git a/contrib/ntp/libntp/msyslog.c b/contrib/ntp/libntp/msyslog.c index dfb1627..9864881 100644 --- a/contrib/ntp/libntp/msyslog.c +++ b/contrib/ntp/libntp/msyslog.c @@ -20,8 +20,8 @@ #include "ntp_types.h" #include "ntp_string.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #ifdef SYS_WINNT # include "..\ports\winnt\libntp\log.h" @@ -60,16 +60,12 @@ void msyslog(int level, const char *fmt, ...) #endif va_list ap; char buf[1025], nfmt[256]; -#if !defined(VMS) +#if defined(SYS_WINNT) char xerr[50]; #endif register int c; register char *n, *prog; register const char *f; -#ifdef CHAR_SYS_ERRLIST - extern int sys_nerr; - extern char *sys_errlist[]; -#endif int olderrno; char *err; @@ -96,12 +92,7 @@ void msyslog(int level, const char *fmt, ...) continue; } err = 0; -#if !defined(VMS) && !defined(SYS_WINNT) && !defined (SYS_VXWORKS) - if ((unsigned)olderrno > sys_nerr) - sprintf((char *)(err = xerr), "error %d", olderrno); - else - err = (char*)sys_errlist[olderrno]; -#elif defined(VMS) || defined (SYS_VXWORKS) +#if !defined(SYS_WINNT) err = strerror(olderrno); #else /* SYS_WINNT */ err = xerr; @@ -114,7 +105,7 @@ void msyslog(int level, const char *fmt, ...) sizeof(xerr), NULL); -#endif /* VMS && SYS_WINNT */ +#endif /* SYS_WINNT */ if ((n + strlen(err)) < &nfmt[254]) { strcpy(n, err); n += strlen(err); diff --git a/contrib/ntp/libntp/prettydate.c b/contrib/ntp/libntp/prettydate.c index 291c17c..9710c84 100644 --- a/contrib/ntp/libntp/prettydate.c +++ b/contrib/ntp/libntp/prettydate.c @@ -8,10 +8,6 @@ #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifndef TM_IN_SYS_TIME -#include <time.h> -#endif - static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" diff --git a/contrib/ntp/libntp/random.c b/contrib/ntp/libntp/random.c new file mode 100644 index 0000000..7136857 --- /dev/null +++ b/contrib/ntp/libntp/random.c @@ -0,0 +1,482 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; +#endif /* LIBC_SCCS and not lint */ + +#include "config.h" +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <stdio.h> + +#include <ntp_types.h> + +/* + * random.c: + * + * An improved random number generation package. In addition to the standard + * rand()/srand() like interface, this package also has a special state info + * interface. The initstate() routine is called with a seed, an array of + * bytes, and a count of how many bytes are being passed in; this array is + * then initialized to contain information for random number generation with + * that much state information. Good sizes for the amount of state + * information are 32, 64, 128, and 256 bytes. The state can be switched by + * calling the setstate() routine with the same array as was initiallized + * with initstate(). By default, the package runs with 128 bytes of state + * information and generates far better random numbers than a linear + * congruential generator. If the amount of state information is less than + * 32 bytes, a simple linear congruential R.N.G. is used. + * + * Internally, the state information is treated as an array of longs; the + * zeroeth element of the array is the type of R.N.G. being used (small + * integer); the remainder of the array is the state information for the + * R.N.G. Thus, 32 bytes of state information will give 7 longs worth of + * state information, which will allow a degree seven polynomial. (Note: + * the zeroeth word of state information also has some other information + * stored in it -- see setstate() for details). + * + * The random number generation technique is a linear feedback shift register + * approach, employing trinomials (since there are fewer terms to sum up that + * way). In this approach, the least significant bit of all the numbers in + * the state table will act as a linear feedback shift register, and will + * have period 2^deg - 1 (where deg is the degree of the polynomial being + * used, assuming that the polynomial is irreducible and primitive). The + * higher order bits will have longer periods, since their values are also + * influenced by pseudo-random carries out of the lower bits. The total + * period of the generator is approximately deg*(2**deg - 1); thus doubling + * the amount of state information has a vast influence on the period of the + * generator. Note: the deg*(2**deg - 1) is an approximation only good for + * large deg, when the period of the shift register is the dominant factor. + * With deg equal to seven, the period is actually much longer than the + * 7*(2**7 - 1) predicted by this formula. + * + * Modified 28 December 1994 by Jacob S. Rosenberg. + * The following changes have been made: + * All references to the type u_int have been changed to unsigned long. + * All references to type int have been changed to type long. Other + * cleanups have been made as well. A warning for both initstate and + * setstate has been inserted to the effect that on Sparc platforms + * the 'arg_state' variable must be forced to begin on word boundaries. + * This can be easily done by casting a long integer array to char *. + * The overall logic has been left STRICTLY alone. This software was + * tested on both a VAX and Sun SpacsStation with exactly the same + * results. The new version and the original give IDENTICAL results. + * The new version is somewhat faster than the original. As the + * documentation says: "By default, the package runs with 128 bytes of + * state information and generates far better random numbers than a linear + * congruential generator. If the amount of state information is less than + * 32 bytes, a simple linear congruential R.N.G. is used." For a buffer of + * 128 bytes, this new version runs about 19 percent faster and for a 16 + * byte buffer it is about 5 percent faster. + */ + +/* + * For each of the currently supported random number generators, we have a + * break value on the amount of state information (you need at least this + * many bytes of state info to support this random number generator), a degree + * for the polynomial (actually a trinomial) that the R.N.G. is based on, and + * the separation between the two lower order coefficients of the trinomial. + */ +#define TYPE_0 0 /* linear congruential */ +#define BREAK_0 8 +#define DEG_0 0 +#define SEP_0 0 + +#define TYPE_1 1 /* x**7 + x**3 + 1 */ +#define BREAK_1 32 +#define DEG_1 7 +#define SEP_1 3 + +#define TYPE_2 2 /* x**15 + x + 1 */ +#define BREAK_2 64 +#define DEG_2 15 +#define SEP_2 1 + +#define TYPE_3 3 /* x**31 + x**3 + 1 */ +#define BREAK_3 128 +#define DEG_3 31 +#define SEP_3 3 + +#define TYPE_4 4 /* x**63 + x + 1 */ +#define BREAK_4 256 +#define DEG_4 63 +#define SEP_4 1 + +/* + * Array versions of the above information to make code run faster -- + * relies on fact that TYPE_i == i. + */ +#define MAX_TYPES 5 /* max number of types above */ + +static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; +static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; + +/* + * Initially, everything is set up as if from: + * + * initstate(1, randtbl, 128); + * + * Note that this initialization takes advantage of the fact that srandom() + * advances the front and rear pointers 10*rand_deg times, and hence the + * rear pointer which starts at 0 will also end up at zero; thus the zeroeth + * element of the state information, which contains info about the current + * position of the rear pointer is just + * + * MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3. + */ + +static long randtbl[DEG_3 + 1] = { + TYPE_3, +#ifdef USE_WEAK_SEEDING +/* Historic implementation compatibility */ +/* The random sequences do not vary much with the seed */ + 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5, + 0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd, + 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, + 0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc, + 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b, + 0x27fb47b9, +#else /* !USE_WEAK_SEEDING */ + 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05, + 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454, + 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471, + 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1, + 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41, + 0xf3bec5da +#endif /* !USE_WEAK_SEEDING */ +}; + +/* + * fptr and rptr are two pointers into the state info, a front and a rear + * pointer. These two pointers are always rand_sep places aparts, as they + * cycle cyclically through the state information. (Yes, this does mean we + * could get away with just one pointer, but the code for random() is more + * efficient this way). The pointers are left positioned as they would be + * from the call + * + * initstate(1, randtbl, 128); + * + * (The position of the rear pointer, rptr, is really 0 (as explained above + * in the initialization of randtbl) because the state table pointer is set + * to point to randtbl[1] (as explained below). + */ +static long *fptr = &randtbl[SEP_3 + 1]; +static long *rptr = &randtbl[1]; + +/* + * The following things are the pointer to the state information table, the + * type of the current generator, the degree of the current polynomial being + * used, and the separation between the two pointers. Note that for efficiency + * of random(), we remember the first location of the state information, not + * the zeroeth. Hence it is valid to access state[-1], which is used to + * store the type of the R.N.G. Also, we remember the last location, since + * this is more efficient than indexing every time to find the address of + * the last element to see if the front and rear pointers have wrapped. + */ +static long *state = &randtbl[1]; +static long rand_type = TYPE_3; +static long rand_deg = DEG_3; +static long rand_sep = SEP_3; +static long *end_ptr = &randtbl[DEG_3 + 1]; + +static inline long good_rand P((long)); +long random P((void)); + +static inline long +good_rand ( + register long x + ) +{ +#ifdef USE_WEAK_SEEDING +/* + * Historic implementation compatibility. + * The random sequences do not vary much with the seed, + * even with overflowing. + */ + return (1103515245 * x + 12345); +#else /* !USE_WEAK_SEEDING */ +/* + * Compute x = (7^5 * x) mod (2^31 - 1) + * wihout overflowing 31 bits: + * (2^31 - 1) = 127773 * (7^5) + 2836 + * From "Random number generators: good ones are hard to find", + * Park and Miller, Communications of the ACM, vol. 31, no. 10, + * October 1988, p. 1195. + */ + register long hi, lo; + + hi = x / 127773; + lo = x % 127773; + x = 16807 * lo - 2836 * hi; + if (x <= 0) + x += 0x7fffffff; + return (x); +#endif /* !USE_WEAK_SEEDING */ +} + +/* + * srandom: + * + * Initialize the random number generator based on the given seed. If the + * type is the trivial no-state-information type, just remember the seed. + * Otherwise, initializes state[] based on the given "seed" via a linear + * congruential generator. Then, the pointers are set to known locations + * that are exactly rand_sep places apart. Lastly, it cycles the state + * information a given number of times to get rid of any initial dependencies + * introduced by the L.C.R.N.G. Note that the initialization of randtbl[] + * for default usage relies on values produced by this routine. + */ +void +srandom( + unsigned long x + ) +{ + register long i; + + if (rand_type == TYPE_0) + state[0] = x; + else { + state[0] = x; + for (i = 1; i < rand_deg; i++) + state[i] = good_rand(state[i - 1]); + fptr = &state[rand_sep]; + rptr = &state[0]; + for (i = 0; i < 10 * rand_deg; i++) + (void)random(); + } +} + +/* + * srandomdev: + * + * Many programs choose the seed value in a totally predictable manner. + * This often causes problems. We seed the generator using the much more + * secure urandom(4) interface. Note that this particular seeding + * procedure can generate states which are impossible to reproduce by + * calling srandom() with any value, since the succeeding terms in the + * state buffer are no longer derived from the LC algorithm applied to + * a fixed seed. + */ +void +srandomdev( void ) +{ + struct timeval tv; + unsigned long junk; /* Purposely used uninitialized */ + + gettimeofday(&tv, NULL); + srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk); + return; +} + +/* + * initstate: + * + * Initialize the state information in the given array of n bytes for future + * random number generation. Based on the number of bytes we are given, and + * the break values for the different R.N.G.'s, we choose the best (largest) + * one we can and set things up for it. srandom() is then called to + * initialize the state information. + * + * Note that on return from srandom(), we set state[-1] to be the type + * multiplexed with the current value of the rear pointer; this is so + * successive calls to initstate() won't lose this information and will be + * able to restart with setstate(). + * + * Note: the first thing we do is save the current state, if any, just like + * setstate() so that it doesn't matter when initstate is called. + * + * Returns a pointer to the old state. + * + * Note: The Sparc platform requires that arg_state begin on a long + * word boundary; otherwise a bus error will occur. Even so, lint will + * complain about mis-alignment, but you should disregard these messages. + */ +char * +initstate( + unsigned long seed, /* seed for R.N.G. */ + char *arg_state, /* pointer to state array */ + long n /* # bytes of state info */ + ) +{ + register char *ostate = (char *)(&state[-1]); + register long *long_arg_state = (long *) arg_state; + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = MAX_TYPES * (rptr - state) + rand_type; + if (n < BREAK_0) { + (void)fprintf(stderr, + "random: not enough state (%ld bytes); ignored.\n", n); + return(0); + } + if (n < BREAK_1) { + rand_type = TYPE_0; + rand_deg = DEG_0; + rand_sep = SEP_0; + } else if (n < BREAK_2) { + rand_type = TYPE_1; + rand_deg = DEG_1; + rand_sep = SEP_1; + } else if (n < BREAK_3) { + rand_type = TYPE_2; + rand_deg = DEG_2; + rand_sep = SEP_2; + } else if (n < BREAK_4) { + rand_type = TYPE_3; + rand_deg = DEG_3; + rand_sep = SEP_3; + } else { + rand_type = TYPE_4; + rand_deg = DEG_4; + rand_sep = SEP_4; + } + state = (long *) (long_arg_state + 1); /* first location */ + end_ptr = &state[rand_deg]; /* must set end_ptr before srandom */ + srandom(seed); + if (rand_type == TYPE_0) + long_arg_state[0] = rand_type; + else + long_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type; + return(ostate); +} + +/* + * setstate: + * + * Restore the state from the given state array. + * + * Note: it is important that we also remember the locations of the pointers + * in the current state information, and restore the locations of the pointers + * from the old state information. This is done by multiplexing the pointer + * location into the zeroeth word of the state information. + * + * Note that due to the order in which things are done, it is OK to call + * setstate() with the same state as the current state. + * + * Returns a pointer to the old state information. + * + * Note: The Sparc platform requires that arg_state begin on a long + * word boundary; otherwise a bus error will occur. Even so, lint will + * complain about mis-alignment, but you should disregard these messages. + */ +char * +setstate( + char *arg_state /* pointer to state array */ + ) +{ + register long *new_state = (long *) arg_state; + register long type = new_state[0] % MAX_TYPES; + register long rear = new_state[0] / MAX_TYPES; + char *ostate = (char *)(&state[-1]); + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = MAX_TYPES * (rptr - state) + rand_type; + switch(type) { + case TYPE_0: + case TYPE_1: + case TYPE_2: + case TYPE_3: + case TYPE_4: + rand_type = type; + rand_deg = degrees[type]; + rand_sep = seps[type]; + break; + default: + (void)fprintf(stderr, + "random: state info corrupted; not changed.\n"); + } + state = (long *) (new_state + 1); + if (rand_type != TYPE_0) { + rptr = &state[rear]; + fptr = &state[(rear + rand_sep) % rand_deg]; + } + end_ptr = &state[rand_deg]; /* set end_ptr too */ + return(ostate); +} + +/* + * random: + * + * If we are using the trivial TYPE_0 R.N.G., just do the old linear + * congruential bit. Otherwise, we do our fancy trinomial stuff, which is + * the same in all the other cases due to all the global variables that have + * been set up. The basic operation is to add the number at the rear pointer + * into the one at the front pointer. Then both pointers are advanced to + * the next location cyclically in the table. The value returned is the sum + * generated, reduced to 31 bits by throwing away the "least random" low bit. + * + * Note: the code takes advantage of the fact that both the front and + * rear pointers can't wrap on the same call by not testing the rear + * pointer if the front one has wrapped. + * + * Returns a 31-bit random number. + */ +long +random( void ) +{ + register long i; + register long *f, *r; + + if (rand_type == TYPE_0) { + i = state[0]; + state[0] = i = (good_rand(i)) & 0x7fffffff; + } else { + /* + * Use local variables rather than static variables for speed. + */ + f = fptr; r = rptr; + *f += *r; + i = (*f >> 1) & 0x7fffffff; /* chucking least random bit */ + if (++f >= end_ptr) { + f = state; + ++r; + } + else if (++r >= end_ptr) { + r = state; + } + + fptr = f; rptr = r; + } + return(i); +} diff --git a/contrib/ntp/libntp/recvbuff.c b/contrib/ntp/libntp/recvbuff.c index 96d212d..35c7e23 100644 --- a/contrib/ntp/libntp/recvbuff.c +++ b/contrib/ntp/libntp/recvbuff.c @@ -5,8 +5,8 @@ #include <stdio.h> #include "ntp_machine.h" #include "ntp_fp.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #include "ntp_io.h" #include "recvbuff.h" #include "iosignal.h" diff --git a/contrib/ntp/libntp/snprintf.c b/contrib/ntp/libntp/snprintf.c new file mode 100644 index 0000000..d65f6a9 --- /dev/null +++ b/contrib/ntp/libntp/snprintf.c @@ -0,0 +1,55 @@ +#include <config.h> + +#include <sys/types.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdio.h> + +#ifdef __STDC__ +int snprintf(char *str, size_t n, const char *fmt, ...) +#else +int snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int rval; +#ifdef VSPRINTF_CHARSTAR + char *rp; +#endif +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif +#ifdef VSPRINTF_CHARSTAR + rp = vsprintf(str, fmt, ap); + va_end(ap); + return (strlen(rp)); +#else + rval = vsprintf(str, fmt, ap); + va_end(ap); + return (rval); +#endif +} + +int +vsnprintf(str, n, fmt, ap) + char *str; + size_t n; + const char *fmt; + va_list ap; +{ +#ifdef VSPRINTF_CHARSTAR + return (strlen(vsprintf(str, fmt, ap))); +#else + return (vsprintf(str, fmt, ap)); +#endif +} diff --git a/contrib/ntp/libntp/strdup.c b/contrib/ntp/libntp/strdup.c new file mode 100644 index 0000000..08ffc2f --- /dev/null +++ b/contrib/ntp/libntp/strdup.c @@ -0,0 +1,20 @@ + +#define NULL 0 + +char * +strdup( + const char *s + ) +{ + char *cp; + + if (s) { + cp = (char *) malloc((unsigned) (strlen(s)+1)); + if (cp) { + (void) strcpy(cp, s); + } + } else { + cp = (char *) NULL; + } + return(cp); +} diff --git a/contrib/ntp/libntp/systime.c b/contrib/ntp/libntp/systime.c index 2ef6ef9..e14a4d8 100644 --- a/contrib/ntp/libntp/systime.c +++ b/contrib/ntp/libntp/systime.c @@ -2,13 +2,13 @@ * systime -- routines to fiddle a UNIX clock. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "ntp_proto.h" /* for MAX_FREQ */ +#include "ntp_machine.h" +#include "ntp_fp.h" +#include "ntp_syslog.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" -#include <stdio.h> -#include <sys/types.h> -#include <sys/time.h> #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif @@ -19,16 +19,8 @@ # include <utmpx.h> #endif /* HAVE_UTMPX_H */ -#include "ntp_machine.h" -#include "ntp_fp.h" -#include "ntp_syslog.h" -#include "ntp_unixtime.h" -#include "ntp_stdlib.h" - int systime_10ms_ticks = 0; /* adj sysclock in 10ms increments */ -#define MAXFREQ 500e-6 - /* * These routines (init_systime, get_systime, step_systime, adj_systime) * implement an interface between the (more or less) system independent @@ -36,7 +28,6 @@ int systime_10ms_ticks = 0; /* adj sysclock in 10ms increments */ * clock. */ double sys_residual = 0; /* residual from previous adjustment */ -double sys_maxfreq = MAXFREQ; /* max frequency correction */ /* @@ -140,8 +131,8 @@ adj_systime( } } else #endif - if (dtemp > sys_maxfreq) - dtemp = sys_maxfreq; + if (dtemp > NTP_MAXFREQ) + dtemp = NTP_MAXFREQ; dtemp = dtemp * 1e6 + .5; @@ -159,7 +150,8 @@ adj_systime( /* casey - we need a posix type thang here */ if (adjtime(&adjtv, &oadjtv) < 0) { - msyslog(LOG_ERR, "Can't adjust time: %m"); + msyslog(LOG_ERR, "Can't adjust time (%ld sec, %ld usec): %m", + (long)adjtv.tv_sec, (long)adjtv.tv_usec); return 0; } else { diff --git a/contrib/ntp/libntp/tvtoa.c b/contrib/ntp/libntp/tvtoa.c index 6bc72ac..19d4a94 100644 --- a/contrib/ntp/libntp/tvtoa.c +++ b/contrib/ntp/libntp/tvtoa.c @@ -1,16 +1,17 @@ /* * tvtoa - return an asciized representation of a struct timeval */ -#include <stdio.h> -#include <sys/time.h> #include "lib_strbuf.h" + #if defined(VMS) -#include "ntp_fp.h" +# include "ntp_fp.h" #endif /* VMS */ #include "ntp_stdlib.h" #include "ntp_unixtime.h" +#include <stdio.h> + char * tvtoa( const struct timeval *tv diff --git a/contrib/ntp/libntp/uglydate.c b/contrib/ntp/libntp/uglydate.c index fcd3d9f..676a5fd 100644 --- a/contrib/ntp/libntp/uglydate.c +++ b/contrib/ntp/libntp/uglydate.c @@ -8,9 +8,7 @@ #include "ntp_unixtime.h" #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifndef TM_IN_SYS_TIME -#include <time.h> -#endif + char * uglydate( diff --git a/contrib/ntp/libntp/utvtoa.c b/contrib/ntp/libntp/utvtoa.c index 79d14ef..a441c49 100644 --- a/contrib/ntp/libntp/utvtoa.c +++ b/contrib/ntp/libntp/utvtoa.c @@ -2,11 +2,11 @@ * utvtoa - return an asciized representation of an unsigned struct timeval */ #include <stdio.h> -#include <sys/time.h> #include "lib_strbuf.h" + #if defined(VMS) -#include "ntp_fp.h" +# include "ntp_fp.h" #endif #include "ntp_stdlib.h" #include "ntp_unixtime.h" diff --git a/contrib/ntp/libparse/Makefile.am b/contrib/ntp/libparse/Makefile.am index d7479e7..c972004 100644 --- a/contrib/ntp/libparse/Makefile.am +++ b/contrib/ntp/libparse/Makefile.am @@ -6,6 +6,8 @@ EXTRA_PROGRAMS = parsestreams parsesolaris noinst_PROGRAMS = @MAKE_PARSEKMODULE@ CLEANFILES = libparse.a libparse_kernel.a +K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS + libparse_a_SOURCES = parse.c \ parse_conf.c \ clk_meinberg.c \ @@ -48,47 +50,86 @@ EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_ # info_trimble.c: $(top_srcdir)/include/trimble.h mkinfo_rcmd.sed mkinfo_scmd.sed @rm -f info_trimble.c - sed -n -f mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.c || rm -f info_trimble.c - sed -n -f mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.c || rm -f info_trimble.c + sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.c || rm -f info_trimble.c + sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.c || rm -f info_trimble.c + +kclk_computime.o: clk_computime.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_computime.c -o $@ + +kclk_computime_.o: clk_computime_.c + $(COMPILE) $(K_CFLAGS) -c clk_computime_.c -o $@ + +kclk_dcf7000.o: clk_dcf7000.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_dcf7000.c -o $@ + +kclk_dcf7000_.o: clk_dcf7000_.c + $(COMPILE) $(K_CFLAGS) -c clk_dcf7000_.c -o $@ + +kclk_hopf6021.o: clk_hopf6021.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_hopf6021.c -o $@ + +kclk_hopf6021_.o: clk_hopf6021_.c + $(COMPILE) $(K_CFLAGS) -c clk_hopf6021_.c -o $@ + +kclk_meinberg.o: clk_meinberg.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_meinberg.c -o $@ + +kclk_meinberg_.o: clk_meinberg_.c + $(COMPILE) $(K_CFLAGS) -c clk_meinberg_.c -o $@ + +kclk_rawdcf.o: clk_rawdcf.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_rawdcf.c -o $@ + +kclk_rawdcf_.o: clk_rawdcf_.c + $(COMPILE) $(K_CFLAGS) -c clk_rawdcf_.c -o $@ + +kclk_rcc8000.o: clk_rcc8000.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_rcc8000.c -o $@ + +kclk_rcc8000_.o: clk_rcc8000_.c + $(COMPILE) $(K_CFLAGS) -c clk_rcc8000_.c -o $@ + +kclk_schmid.o: clk_schmid.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_schmid.c -o $@ -kclk_computime$U.o: clk_computime$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_schmid_.o: clk_schmid_.c + $(COMPILE) $(K_CFLAGS) -c clk_schmid_.c -o $@ -kclk_dcf7000$U.o: clk_dcf7000$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtaip.o: clk_trimtaip.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_trimtaip.c -o $@ -kclk_hopf6021$U.o: clk_hopf6021$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtaip_.o: clk_trimtaip_.c + $(COMPILE) $(K_CFLAGS) -c clk_trimtaip_.c -o $@ -kclk_meinberg$U.o: clk_meinberg$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtsip.o: clk_trimtsip.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_trimtsip.c -o $@ -kclk_rawdcf$U.o: clk_rawdcf$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtsip_.o: clk_trimtsip_.c + $(COMPILE) $(K_CFLAGS) -c clk_trimtsip_.c -o $@ -kclk_rcc8000$U.o: clk_rcc8000$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_varitext.o: clk_varitext.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_varitext.c -o $@ -kclk_schmid$U.o: clk_schmid$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_varitext_.o: clk_varitext_.c + $(COMPILE) $(K_CFLAGS) -c clk_varitext_.c -o $@ -kclk_trimtaip$U.o: clk_trimtaip$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_wharton.o: clk_wharton.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_wharton.c -o $@ -kclk_trimtsip$U.o: clk_trimtsip$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_wharton_.o: clk_wharton_.c + $(COMPILE) $(K_CFLAGS) -c clk_wharton_.c -o $@ -kclk_varitext$U.o: clk_varitext$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse.o: parse.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/parse.c -o $@ -kclk_wharton$U.o: clk_wharton$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_.o: parse_.c + $(COMPILE) $(K_CFLAGS) -c parse_.c -o $@ -kparse$U.o: parse$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_conf.o: parse_conf.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/parse_conf.c -o $@ -kparse_conf$U.o: parse_conf$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_conf_.o: parse_conf_.c + $(COMPILE) $(K_CFLAGS) -c parse_conf_.c -o $@ parsestreams.loadable_module.o: $(parsestreams_OBJECTS) libparse_kernel.a ../libntp/libntp.a $(LD) -r -o $@ $(parsestreams_OBJECTS) libparse_kernel.a ../libntp/libntp.a diff --git a/contrib/ntp/libparse/Makefile.in b/contrib/ntp/libparse/Makefile.in index 8682c2b..4ad2d3e 100644 --- a/contrib/ntp/libparse/Makefile.in +++ b/contrib/ntp/libparse/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -108,6 +124,8 @@ EXTRA_PROGRAMS = parsestreams parsesolaris noinst_PROGRAMS = @MAKE_PARSEKMODULE@ CLEANFILES = libparse.a libparse_kernel.a +K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS + libparse_a_SOURCES = parse.c \ parse_conf.c \ clk_meinberg.c \ @@ -146,114 +164,103 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/kernel ETAGS_ARGS = Makefile.am EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_trimble.c +EXEEXT = +OBJEXT = o subdir = libparse mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr libparse_a_AR = $(AR) cru libparse_a_LIBADD = -am_libparse_a_OBJECTS = parse$U.o parse_conf$U.o clk_meinberg$U.o \ -clk_schmid$U.o clk_rawdcf$U.o clk_trimtsip$U.o clk_dcf7000$U.o \ -clk_trimtaip$U.o clk_rcc8000$U.o clk_hopf6021$U.o clk_computime$U.o \ -clk_wharton$U.o clk_varitext$U.o data_mbg$U.o info_trimble$U.o \ -trim_info$U.o -libparse_a_OBJECTS = $(am_libparse_a_OBJECTS) +am_libparse_a_OBJECTS = parse$U.$(OBJEXT) parse_conf$U.$(OBJEXT) \ +clk_meinberg$U.$(OBJEXT) clk_schmid$U.$(OBJEXT) clk_rawdcf$U.$(OBJEXT) \ +clk_trimtsip$U.$(OBJEXT) clk_dcf7000$U.$(OBJEXT) \ +clk_trimtaip$U.$(OBJEXT) clk_rcc8000$U.$(OBJEXT) \ +clk_hopf6021$U.$(OBJEXT) clk_computime$U.$(OBJEXT) \ +clk_wharton$U.$(OBJEXT) clk_varitext$U.$(OBJEXT) data_mbg$U.$(OBJEXT) \ +info_trimble$U.$(OBJEXT) trim_info$U.$(OBJEXT) +libparse_a_OBJECTS = $(am_libparse_a_OBJECTS) libparse_kernel_a_AR = $(AR) cru -libparse_kernel_a_DEPENDENCIES = kparse$U.o kparse_conf$U.o \ +libparse_kernel_a_DEPENDENCIES = kparse$U.o kparse_conf$U.o \ kclk_computime$U.o kclk_dcf7000$U.o kclk_hopf6021$U.o kclk_meinberg$U.o \ kclk_rawdcf$U.o kclk_rcc8000$U.o kclk_schmid$U.o kclk_trimtaip$U.o \ kclk_trimtsip$U.o kclk_varitext$U.o kclk_wharton$U.o -libparse_kernel_a_OBJECTS = $(am_libparse_kernel_a_OBJECTS) +libparse_kernel_a_OBJECTS = $(am_libparse_kernel_a_OBJECTS) AR = ar -PROGRAMS = $(noinst_PROGRAMS) +EXTRA_PROGRAMS = parsestreams$(EXEEXT) parsesolaris$(EXEEXT) +noinst_PROGRAMS = @MAKE_PARSEKMODULE@ +PROGRAMS = $(noinst_PROGRAMS) parsesolaris_SOURCES = parsesolaris.c -parsesolaris_OBJECTS = parsesolaris$U.o +parsesolaris_OBJECTS = parsesolaris$U.$(OBJEXT) parsesolaris_LDADD = $(LDADD) parsesolaris_DEPENDENCIES = parsesolaris_LDFLAGS = parsestreams_SOURCES = parsestreams.c -parsestreams_OBJECTS = parsestreams$U.o +parsestreams_OBJECTS = parsestreams$U.$(OBJEXT) parsestreams_LDADD = $(LDADD) parsestreams_DEPENDENCIES = parsestreams_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libparse_a_SOURCES) $(libparse_kernel_a_SOURCES) \ +DIST_SOURCES = $(libparse_a_SOURCES) $(libparse_kernel_a_SOURCES) \ parsesolaris.c parsestreams.c -DIST_COMMON = README Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/clk_computime$U.Po \ -$(DEPDIR)/clk_dcf7000$U.Po $(DEPDIR)/clk_hopf6021$U.Po \ -$(DEPDIR)/clk_meinberg$U.Po $(DEPDIR)/clk_rawdcf$U.Po \ -$(DEPDIR)/clk_rcc8000$U.Po $(DEPDIR)/clk_schmid$U.Po \ -$(DEPDIR)/clk_trimtaip$U.Po $(DEPDIR)/clk_trimtsip$U.Po \ -$(DEPDIR)/clk_varitext$U.Po $(DEPDIR)/clk_wharton$U.Po \ -$(DEPDIR)/data_mbg$U.Po $(DEPDIR)/info_trimble$U.Po \ -$(DEPDIR)/parse$U.Po $(DEPDIR)/parse_conf$U.Po \ -$(DEPDIR)/parsesolaris$U.Po $(DEPDIR)/parsestreams$U.Po \ -$(DEPDIR)/trim_info$U.Po +@AMDEP@DEP_FILES = $(DEPDIR)/clk_computime$U.Po \ +@AMDEP@ $(DEPDIR)/clk_dcf7000$U.Po $(DEPDIR)/clk_hopf6021$U.Po \ +@AMDEP@ $(DEPDIR)/clk_meinberg$U.Po $(DEPDIR)/clk_rawdcf$U.Po \ +@AMDEP@ $(DEPDIR)/clk_rcc8000$U.Po $(DEPDIR)/clk_schmid$U.Po \ +@AMDEP@ $(DEPDIR)/clk_trimtaip$U.Po $(DEPDIR)/clk_trimtsip$U.Po \ +@AMDEP@ $(DEPDIR)/clk_varitext$U.Po $(DEPDIR)/clk_wharton$U.Po \ +@AMDEP@ $(DEPDIR)/data_mbg$U.Po $(DEPDIR)/info_trimble$U.Po \ +@AMDEP@ $(DEPDIR)/parse$U.Po $(DEPDIR)/parse_conf$U.Po \ +@AMDEP@ $(DEPDIR)/parsesolaris$U.Po $(DEPDIR)/parsestreams$U.Po \ +@AMDEP@ $(DEPDIR)/trim_info$U.Po +DIST_COMMON = README Makefile.am Makefile.in + SOURCES = $(libparse_a_SOURCES) $(libparse_kernel_a_SOURCES) parsesolaris.c parsestreams.c -OBJECTS = $(am_libparse_a_OBJECTS) $(am_libparse_kernel_a_OBJECTS) parsesolaris$U.o parsestreams$U.o +OBJECTS = $(am_libparse_a_OBJECTS) $(am_libparse_kernel_a_OBJECTS) parsesolaris$U.$(OBJEXT) parsestreams$U.$(OBJEXT) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu libparse/Makefile +all: all-am -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libparse/Makefile -mostlyclean-noinstLIBRARIES: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - libparse.a: $(libparse_a_OBJECTS) $(libparse_a_DEPENDENCIES) -rm -f libparse.a $(libparse_a_AR) libparse.a $(libparse_a_OBJECTS) $(libparse_a_LIBADD) @@ -264,15 +271,9 @@ libparse_kernel.a: $(libparse_kernel_a_OBJECTS) $(libparse_kernel_a_DEPENDENCIES $(libparse_kernel_a_AR) libparse_kernel.a $(libparse_kernel_a_OBJECTS) $(libparse_kernel_a_LIBADD) $(RANLIB) libparse_kernel.a -mostlyclean-noinstPROGRAMS: - clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - parsesolaris: $(parsesolaris_OBJECTS) $(parsesolaris_DEPENDENCIES) @rm -f parsesolaris $(LINK) $(parsesolaris_LDFLAGS) $(parsesolaris_OBJECTS) $(parsesolaris_LDADD) $(LIBS) @@ -316,11 +317,13 @@ parsestreams_.c: parsestreams.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/parsestreams.c; then echo $(srcdir)/parsestreams.c; else echo parsestreams.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > parsestreams_.c trim_info_.c: trim_info.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trim_info.c; then echo $(srcdir)/trim_info.c; else echo trim_info.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > trim_info_.c -clk_computime_.o clk_dcf7000_.o clk_hopf6021_.o clk_meinberg_.o \ -clk_rawdcf_.o clk_rcc8000_.o clk_schmid_.o clk_trimtaip_.o \ -clk_trimtsip_.o clk_varitext_.o clk_wharton_.o data_mbg_.o \ -info_trimble_.o parse_.o parse_conf_.o parsesolaris_.o parsestreams_.o \ -trim_info_.o : $(ANSI2KNR) +clk_computime_.$(OBJEXT) clk_dcf7000_.$(OBJEXT) clk_hopf6021_.$(OBJEXT) \ +clk_meinberg_.$(OBJEXT) clk_rawdcf_.$(OBJEXT) clk_rcc8000_.$(OBJEXT) \ +clk_schmid_.$(OBJEXT) clk_trimtaip_.$(OBJEXT) clk_trimtsip_.$(OBJEXT) \ +clk_varitext_.$(OBJEXT) clk_wharton_.$(OBJEXT) data_mbg_.$(OBJEXT) \ +info_trimble_.$(OBJEXT) parse_.$(OBJEXT) parse_conf_.$(OBJEXT) \ +parsesolaris_.$(OBJEXT) parsestreams_.$(OBJEXT) trim_info_.$(OBJEXT) : \ +$(ANSI2KNR) tags: TAGS @@ -331,9 +334,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -346,90 +349,87 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/clk_computime$U.Po -@AMDEP@include $(DEPDIR)/clk_dcf7000$U.Po -@AMDEP@include $(DEPDIR)/clk_hopf6021$U.Po -@AMDEP@include $(DEPDIR)/clk_meinberg$U.Po -@AMDEP@include $(DEPDIR)/clk_rawdcf$U.Po -@AMDEP@include $(DEPDIR)/clk_rcc8000$U.Po -@AMDEP@include $(DEPDIR)/clk_schmid$U.Po -@AMDEP@include $(DEPDIR)/clk_trimtaip$U.Po -@AMDEP@include $(DEPDIR)/clk_trimtsip$U.Po -@AMDEP@include $(DEPDIR)/clk_varitext$U.Po -@AMDEP@include $(DEPDIR)/clk_wharton$U.Po -@AMDEP@include $(DEPDIR)/data_mbg$U.Po -@AMDEP@include $(DEPDIR)/info_trimble$U.Po -@AMDEP@include $(DEPDIR)/parse$U.Po -@AMDEP@include $(DEPDIR)/parse_conf$U.Po -@AMDEP@include $(DEPDIR)/parsesolaris$U.Po -@AMDEP@include $(DEPDIR)/parsestreams$U.Po -@AMDEP@include $(DEPDIR)/trim_info$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/clk_computime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_dcf7000$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_hopf6021$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_meinberg$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_rawdcf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_rcc8000$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_schmid$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_trimtaip$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_trimtsip$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_varitext$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clk_wharton$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/data_mbg$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/info_trimble$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/parse$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/parse_conf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/parsesolaris$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/parsestreams$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/trim_info$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -441,49 +441,54 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-kr mostlyclean-noinstPROGRAMS \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am -clean-am: clean-noinstLIBRARIES clean-compile clean-kr \ - clean-noinstPROGRAMS clean-tags clean-depend \ - clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstLIBRARIES distclean-compile distclean-kr \ - distclean-noinstPROGRAMS distclean-tags \ - distclean-depend distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS tags \ -mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ -distdir mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am # @@ -491,47 +496,86 @@ mostlyclean distclean maintainer-clean # info_trimble.c: $(top_srcdir)/include/trimble.h mkinfo_rcmd.sed mkinfo_scmd.sed @rm -f info_trimble.c - sed -n -f mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.c || rm -f info_trimble.c - sed -n -f mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.c || rm -f info_trimble.c + sed -n -f $(srcdir)/mkinfo_scmd.sed $(top_srcdir)/include/trimble.h > info_trimble.c || rm -f info_trimble.c + sed -n -f $(srcdir)/mkinfo_rcmd.sed $(top_srcdir)/include/trimble.h >> info_trimble.c || rm -f info_trimble.c + +kclk_computime.o: clk_computime.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_computime.c -o $@ + +kclk_computime_.o: clk_computime_.c + $(COMPILE) $(K_CFLAGS) -c clk_computime_.c -o $@ + +kclk_dcf7000.o: clk_dcf7000.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_dcf7000.c -o $@ + +kclk_dcf7000_.o: clk_dcf7000_.c + $(COMPILE) $(K_CFLAGS) -c clk_dcf7000_.c -o $@ + +kclk_hopf6021.o: clk_hopf6021.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_hopf6021.c -o $@ + +kclk_hopf6021_.o: clk_hopf6021_.c + $(COMPILE) $(K_CFLAGS) -c clk_hopf6021_.c -o $@ + +kclk_meinberg.o: clk_meinberg.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_meinberg.c -o $@ + +kclk_meinberg_.o: clk_meinberg_.c + $(COMPILE) $(K_CFLAGS) -c clk_meinberg_.c -o $@ + +kclk_rawdcf.o: clk_rawdcf.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_rawdcf.c -o $@ + +kclk_rawdcf_.o: clk_rawdcf_.c + $(COMPILE) $(K_CFLAGS) -c clk_rawdcf_.c -o $@ + +kclk_rcc8000.o: clk_rcc8000.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_rcc8000.c -o $@ + +kclk_rcc8000_.o: clk_rcc8000_.c + $(COMPILE) $(K_CFLAGS) -c clk_rcc8000_.c -o $@ + +kclk_schmid.o: clk_schmid.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_schmid.c -o $@ -kclk_computime$U.o: clk_computime$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_schmid_.o: clk_schmid_.c + $(COMPILE) $(K_CFLAGS) -c clk_schmid_.c -o $@ -kclk_dcf7000$U.o: clk_dcf7000$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtaip.o: clk_trimtaip.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_trimtaip.c -o $@ -kclk_hopf6021$U.o: clk_hopf6021$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtaip_.o: clk_trimtaip_.c + $(COMPILE) $(K_CFLAGS) -c clk_trimtaip_.c -o $@ -kclk_meinberg$U.o: clk_meinberg$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtsip.o: clk_trimtsip.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_trimtsip.c -o $@ -kclk_rawdcf$U.o: clk_rawdcf$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_trimtsip_.o: clk_trimtsip_.c + $(COMPILE) $(K_CFLAGS) -c clk_trimtsip_.c -o $@ -kclk_rcc8000$U.o: clk_rcc8000$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_varitext.o: clk_varitext.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_varitext.c -o $@ -kclk_schmid$U.o: clk_schmid$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_varitext_.o: clk_varitext_.c + $(COMPILE) $(K_CFLAGS) -c clk_varitext_.c -o $@ -kclk_trimtaip$U.o: clk_trimtaip$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_wharton.o: clk_wharton.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/clk_wharton.c -o $@ -kclk_trimtsip$U.o: clk_trimtsip$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kclk_wharton_.o: clk_wharton_.c + $(COMPILE) $(K_CFLAGS) -c clk_wharton_.c -o $@ -kclk_varitext$U.o: clk_varitext$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse.o: parse.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/parse.c -o $@ -kclk_wharton$U.o: clk_wharton$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_.o: parse_.c + $(COMPILE) $(K_CFLAGS) -c parse_.c -o $@ -kparse$U.o: parse$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_conf.o: parse_conf.c + $(COMPILE) $(K_CFLAGS) -c $(srcdir)/parse_conf.c -o $@ -kparse_conf$U.o: parse_conf$U.c - $(COMPILE) -DPARSESTREAM -c $< -o $@ +kparse_conf_.o: parse_conf_.c + $(COMPILE) $(K_CFLAGS) -c parse_conf_.c -o $@ parsestreams.loadable_module.o: $(parsestreams_OBJECTS) libparse_kernel.a ../libntp/libntp.a $(LD) -r -o $@ $(parsestreams_OBJECTS) libparse_kernel.a ../libntp/libntp.a diff --git a/contrib/ntp/libparse/clk_computime.c b/contrib/ntp/libparse/clk_computime.c index 2b19392..3312b3f 100644 --- a/contrib/ntp/libparse/clk_computime.c +++ b/contrib/ntp/libparse/clk_computime.c @@ -23,10 +23,6 @@ * */ - -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -141,7 +137,7 @@ inp_computime( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_computime(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_dcf7000.c b/contrib/ntp/libparse/clk_dcf7000.c index c113ec7..30506c5 100644 --- a/contrib/ntp/libparse/clk_dcf7000.c +++ b/contrib/ntp/libparse/clk_dcf7000.c @@ -20,9 +20,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_DCF7000) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -140,7 +137,7 @@ inp_dcf7000( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_dcf7000(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_hopf6021.c b/contrib/ntp/libparse/clk_hopf6021.c index d55c111..b2d53cd 100644 --- a/contrib/ntp/libparse/clk_hopf6021.c +++ b/contrib/ntp/libparse/clk_hopf6021.c @@ -22,9 +22,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_HOPF6021) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -229,7 +226,7 @@ inp_hopf6021( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_hopf6021(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_meinberg.c b/contrib/ntp/libparse/clk_meinberg.c index 2e58cf6..87c7fde 100644 --- a/contrib/ntp/libparse/clk_meinberg.c +++ b/contrib/ntp/libparse/clk_meinberg.c @@ -20,9 +20,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_MEINBERG) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -412,7 +409,7 @@ mbg_input( { unsigned int rtc; - parseprintf(DD_PARSE, ("mbg_input(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { @@ -580,7 +577,7 @@ gps_input( msg_buf = (struct msg_buf *)parseio->parse_pdata; - parseprintf(DD_PARSE, ("gps_input(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); if (!msg_buf) return PARSE_INP_SKIP; diff --git a/contrib/ntp/libparse/clk_rawdcf.c b/contrib/ntp/libparse/clk_rawdcf.c index c4df5b5..40ec8ad 100644 --- a/contrib/ntp/libparse/clk_rawdcf.c +++ b/contrib/ntp/libparse/clk_rawdcf.c @@ -20,9 +20,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_RAWDCF) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -549,7 +546,7 @@ inp_rawdcf( { static struct timeval timeout = { 1, 500000 }; /* 1.5 secongs denote second #60 */ - parseprintf(DD_PARSE, ("inp_rawdcf(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_rawdcf(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */ diff --git a/contrib/ntp/libparse/clk_rcc8000.c b/contrib/ntp/libparse/clk_rcc8000.c index ecafbde..23e6763 100644 --- a/contrib/ntp/libparse/clk_rcc8000.c +++ b/contrib/ntp/libparse/clk_rcc8000.c @@ -19,9 +19,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_RCC8000) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -143,7 +140,7 @@ inp_rcc8000( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_rcc8000(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_schmid.c b/contrib/ntp/libparse/clk_schmid.c index 5fb4268..52c0ef4 100644 --- a/contrib/ntp/libparse/clk_schmid.c +++ b/contrib/ntp/libparse/clk_schmid.c @@ -20,9 +20,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_SCHMID) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -187,7 +184,7 @@ inp_schmid( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_schmid(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_trimtaip.c b/contrib/ntp/libparse/clk_trimtaip.c index f18aaa0..4453e2b 100644 --- a/contrib/ntp/libparse/clk_trimtaip.c +++ b/contrib/ntp/libparse/clk_trimtaip.c @@ -11,8 +11,6 @@ #endif #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_TRIMTAIP) -#include <sys/types.h> -#include <sys/time.h> #include "ntp_fp.h" #include "ntp_unixtime.h" @@ -128,7 +126,7 @@ inp_trimtaip( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_trimtaip(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/clk_trimtsip.c b/contrib/ntp/libparse/clk_trimtsip.c index 54367f8..4e1d983 100644 --- a/contrib/ntp/libparse/clk_trimtsip.c +++ b/contrib/ntp/libparse/clk_trimtsip.c @@ -12,9 +12,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) && defined(CLOCK_TRIMTSIP) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_syslog.h" #include "ntp_types.h" #include "ntp_fp.h" @@ -26,10 +23,10 @@ #include "parse.h" #ifndef PARSESTREAM -#include <stdio.h> +# include <stdio.h> #else -#include "sys/parsestreams.h" -# endif +# include "sys/parsestreams.h" +#endif #include "ascii.h" #include "binio.h" diff --git a/contrib/ntp/libparse/clk_varitext.c b/contrib/ntp/libparse/clk_varitext.c index 9236bb4..8019e0e 100644 --- a/contrib/ntp/libparse/clk_varitext.c +++ b/contrib/ntp/libparse/clk_varitext.c @@ -19,9 +19,6 @@ * */ -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -29,10 +26,10 @@ #include "parse.h" #ifndef PARSESTREAM -#include "ntp_stdlib.h" -#include <stdio.h> +# include "ntp_stdlib.h" +# include <stdio.h> #else -#include "sys/parsestreams.h" +# include "sys/parsestreams.h" extern void printf P((const char *, ...)); #endif @@ -172,7 +169,7 @@ inp_varitext( struct varitext *t = (struct varitext *)parseio->parse_pdata; int rtc; - parseprintf(DD_PARSE, ("inp_varitext(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); if (!t) return PARSE_INP_SKIP; /* local data not allocated - sigh! */ diff --git a/contrib/ntp/libparse/clk_wharton.c b/contrib/ntp/libparse/clk_wharton.c index 2a243a5..6dfc971 100644 --- a/contrib/ntp/libparse/clk_wharton.c +++ b/contrib/ntp/libparse/clk_wharton.c @@ -13,7 +13,7 @@ /* * Support for WHARTON 400A Series clock + 404.2 serial interface. * - * Copyright (C) 1999 by Philippe De Muyter <phdm@macqel.be> + * Copyright (C) 1999, 2000 by Philippe De Muyter <phdm@macqel.be> * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -91,9 +91,10 @@ cvt_wharton_400a( int i; /* The given `size' includes a terminating null-character. */ - if (size != 16 || buffer[0] != STX || buffer[14] != ETX) + if (size != 16 || buffer[0] != STX || buffer[14] != ETX + || buffer[13] < '0' || buffer[13] > ('0' + 0xf)) return CVT_NONE; - for (i = 1; i < 14; i += 1) + for (i = 1; i < 13; i += 1) if (buffer[i] < '0' || buffer[i] > '9') return CVT_NONE; clock_time->second = (buffer[2] - '0') * 10 + buffer[1] - '0'; @@ -133,7 +134,7 @@ inp_wharton_400a( { unsigned int rtc; - parseprintf(DD_PARSE, ("inp_wharton_400a(0x%x, 0x%x, ...)\n", (int)parseio, (int)ch)); + parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); switch (ch) { diff --git a/contrib/ntp/libparse/parse.c b/contrib/ntp/libparse/parse.c index 869b70f8..d3712b6 100644 --- a/contrib/ntp/libparse/parse.c +++ b/contrib/ntp/libparse/parse.c @@ -30,9 +30,6 @@ static char rcsid[] = "parse.c,v 4.14 1999/11/28 09:13:52 kardel RELEASE_19991128_A"; #endif -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" @@ -43,9 +40,9 @@ static char rcsid[] = "parse.c,v 4.14 1999/11/28 09:13:52 kardel RELEASE_1999112 #include "parse.h" #ifndef PARSESTREAM -#include <stdio.h> +# include <stdio.h> #else -#include "sys/parsestreams.h" +# include "sys/parsestreams.h" #endif extern clockformat_t *clockformats[]; diff --git a/contrib/ntp/libparse/parse_conf.c b/contrib/ntp/libparse/parse_conf.c index 353775d..5dc267b 100644 --- a/contrib/ntp/libparse/parse_conf.c +++ b/contrib/ntp/libparse/parse_conf.c @@ -26,9 +26,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PARSE) -#include <sys/types.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" diff --git a/contrib/ntp/libparse/parsesolaris.c b/contrib/ntp/libparse/parsesolaris.c index ef56da5..896f9f0 100644 --- a/contrib/ntp/libparse/parsesolaris.c +++ b/contrib/ntp/libparse/parsesolaris.c @@ -585,7 +585,7 @@ rdchar( freeb(mmp); } } - return (unsigned)~0; + return (unsigned long)~0; } /* diff --git a/contrib/ntp/librsaref/Makefile.am b/contrib/ntp/librsaref/Makefile.am index 32fd457..889251e 100644 --- a/contrib/ntp/librsaref/Makefile.am +++ b/contrib/ntp/librsaref/Makefile.am @@ -6,45 +6,55 @@ CLEANFILES = $(EXTRA_LIBRARIES) # NOTES: # don't use RSAREF's global.h - we use ours. -# We already have a copy of des.h -librsaref_a_SOURCES = \ +nodist_librsaref_a_SOURCES = \ desc.c \ - digit.c \ - digit.h \ - md2.h \ md2c.c \ - md5.h \ md5c.c \ nn.c \ - nn.h \ prime.c \ - prime.h \ r_dh.c \ r_encode.c \ r_enhanc.c \ r_keygen.c \ r_random.c \ - r_random.h \ r_stdlib.c \ rsa.c \ + des.h \ + md2.h \ + md5.h \ + nn.h \ + prime.h \ + r_random.h \ rsa.h \ - rsaref.h + rsaref.h @RSASRCS@ -BUILT_SOURCES = $(librsaref_a_SOURCES) +librsaref_a_LIBADD = @RSAOBJS@ +librsaref_a_DEPENDENCIES = $(librsaref_a_LIBADD) + +BUILT_SOURCES = $(nodist_librsaref_a_SOURCES) INCLUDES = -I$(top_srcdir)/include ETAGS_ARGS = Makefile.am +DISTCLEANFILES = $(nodist_librsaref_a_SOURCES) stamp-rsaref + #EXTRA_DIST = -$(librsaref_a_SOURCES): stamp-rsaref - for i in $(librsaref_a_SOURCES); do \ +$(nodist_librsaref_a_SOURCES): stamp-rsaref + +stamp-rsaref: + @rm -f stamp-rsaref stamp-rsarefT + @echo timestamp > stamp-rsarefT 2> /dev/null + for i in $(nodist_librsaref_a_SOURCES); do \ case "@MAKE_LIBRSAREF@" in \ '') touch $$i ;; \ - *) cmp -s $(srcdir)/$$i $(srcdir)/../rsaref2/source/$$i 2>/dev/null \ - || cp $(srcdir)/../rsaref2/source/$$i $(srcdir)/$$i ;; \ + *) case "$$i" in \ + *.h) r_dst=$(srcdir)/$$i ;; \ + *) r_dst=$$i ;; \ + esac ; \ + cmp -s $${r_dst} $(srcdir)/../@RSADIR@/source/$$i 2>/dev/null \ + || cp $(srcdir)/../@RSADIR@/source/$$i $${r_dst} ;; \ esac ; \ done - -stamp-rsaref: - touch stamp-rsaref + @echo timestamp > stamp-rsarefT 2> /dev/null + @mv stamp-rsarefT stamp-rsaref diff --git a/contrib/ntp/librsaref/Makefile.in b/contrib/ntp/librsaref/Makefile.in index 70b69fc..3faba02 100644 --- a/contrib/ntp/librsaref/Makefile.in +++ b/contrib/ntp/librsaref/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -108,100 +124,96 @@ CLEANFILES = $(EXTRA_LIBRARIES) # NOTES: # don't use RSAREF's global.h - we use ours. -# We already have a copy of des.h -librsaref_a_SOURCES = \ +nodist_librsaref_a_SOURCES = \ desc.c \ - digit.c \ - digit.h \ - md2.h \ md2c.c \ - md5.h \ md5c.c \ nn.c \ - nn.h \ prime.c \ - prime.h \ r_dh.c \ r_encode.c \ r_enhanc.c \ r_keygen.c \ r_random.c \ - r_random.h \ r_stdlib.c \ rsa.c \ + des.h \ + md2.h \ + md5.h \ + nn.h \ + prime.h \ + r_random.h \ rsa.h \ - rsaref.h + rsaref.h @RSASRCS@ -BUILT_SOURCES = $(librsaref_a_SOURCES) +librsaref_a_LIBADD = @RSAOBJS@ +librsaref_a_DEPENDENCIES = $(librsaref_a_LIBADD) + +BUILT_SOURCES = $(nodist_librsaref_a_SOURCES) INCLUDES = -I$(top_srcdir)/include ETAGS_ARGS = Makefile.am + +DISTCLEANFILES = $(nodist_librsaref_a_SOURCES) stamp-rsaref +EXEEXT = +OBJEXT = o subdir = librsaref mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ librsaref_a_AR = $(AR) cru -librsaref_a_LIBADD = -am_librsaref_a_OBJECTS = desc.o digit.o md2c.o md5c.o nn.o prime.o \ -r_dh.o r_encode.o r_enhanc.o r_keygen.o r_random.o r_stdlib.o rsa.o -librsaref_a_OBJECTS = $(am_librsaref_a_OBJECTS) +nodist_librsaref_a_OBJECTS = desc.$(OBJEXT) md2c.$(OBJEXT) \ +md5c.$(OBJEXT) nn.$(OBJEXT) prime.$(OBJEXT) r_dh.$(OBJEXT) \ +r_encode.$(OBJEXT) r_enhanc.$(OBJEXT) r_keygen.$(OBJEXT) \ +r_random.$(OBJEXT) r_stdlib.$(OBJEXT) rsa.$(OBJEXT) +librsaref_a_OBJECTS = $(nodist_librsaref_a_OBJECTS) AR = ar COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(librsaref_a_SOURCES) -DIST_COMMON = Makefile.am Makefile.in +DIST_SOURCES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP@DEP_FILES = $(DEPDIR)/desc.Po $(DEPDIR)/md2c.Po $(DEPDIR)/md5c.Po \ +@AMDEP@ $(DEPDIR)/nn.Po $(DEPDIR)/prime.Po $(DEPDIR)/r_dh.Po \ +@AMDEP@ $(DEPDIR)/r_encode.Po $(DEPDIR)/r_enhanc.Po \ +@AMDEP@ $(DEPDIR)/r_keygen.Po $(DEPDIR)/r_random.Po \ +@AMDEP@ $(DEPDIR)/r_stdlib.Po $(DEPDIR)/rsa.Po +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(nodist_librsaref_a_SOURCES) +OBJECTS = $(nodist_librsaref_a_OBJECTS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am -GZIP_ENV = --best -depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/desc.Po $(DEPDIR)/digit.Po \ -$(DEPDIR)/md2c.Po $(DEPDIR)/md5c.Po $(DEPDIR)/nn.Po $(DEPDIR)/prime.Po \ -$(DEPDIR)/r_dh.Po $(DEPDIR)/r_encode.Po $(DEPDIR)/r_enhanc.Po \ -$(DEPDIR)/r_keygen.Po $(DEPDIR)/r_random.Po $(DEPDIR)/r_stdlib.Po \ -$(DEPDIR)/rsa.Po -SOURCES = $(librsaref_a_SOURCES) -OBJECTS = $(am_librsaref_a_OBJECTS) - -all: all-redirect .SUFFIXES: -.SUFFIXES: .c .h .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu librsaref/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: .c .h .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu librsaref/Makefile -mostlyclean-noinstLIBRARIES: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: - librsaref.a: $(librsaref_a_OBJECTS) $(librsaref_a_DEPENDENCIES) -rm -f librsaref.a $(librsaref_a_AR) librsaref.a $(librsaref_a_OBJECTS) $(librsaref_a_LIBADD) @@ -216,9 +228,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -231,85 +243,81 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/desc.Po -@AMDEP@include $(DEPDIR)/digit.Po -@AMDEP@include $(DEPDIR)/md2c.Po -@AMDEP@include $(DEPDIR)/md5c.Po -@AMDEP@include $(DEPDIR)/nn.Po -@AMDEP@include $(DEPDIR)/prime.Po -@AMDEP@include $(DEPDIR)/r_dh.Po -@AMDEP@include $(DEPDIR)/r_encode.Po -@AMDEP@include $(DEPDIR)/r_enhanc.Po -@AMDEP@include $(DEPDIR)/r_keygen.Po -@AMDEP@include $(DEPDIR)/r_random.Po -@AMDEP@include $(DEPDIR)/r_stdlib.Po -@AMDEP@include $(DEPDIR)/rsa.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/desc.Po +@AMDEP@@_am_include@ $(DEPDIR)/md2c.Po +@AMDEP@@_am_include@ $(DEPDIR)/md5c.Po +@AMDEP@@_am_include@ $(DEPDIR)/nn.Po +@AMDEP@@_am_include@ $(DEPDIR)/prime.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_dh.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_encode.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_enhanc.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_keygen.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_random.Po +@AMDEP@@_am_include@ $(DEPDIR)/r_stdlib.Po +@AMDEP@@_am_include@ $(DEPDIR)/rsa.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(LIBRARIES) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -319,61 +327,79 @@ clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am -clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ - clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir mostlyclean-depend \ -distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic tags \ + uninstall uninstall-am #EXTRA_DIST = -$(librsaref_a_SOURCES): stamp-rsaref - for i in $(librsaref_a_SOURCES); do \ +$(nodist_librsaref_a_SOURCES): stamp-rsaref + +stamp-rsaref: + @rm -f stamp-rsaref stamp-rsarefT + @echo timestamp > stamp-rsarefT 2> /dev/null + for i in $(nodist_librsaref_a_SOURCES); do \ case "@MAKE_LIBRSAREF@" in \ '') touch $$i ;; \ - *) cmp -s $(srcdir)/$$i $(srcdir)/../rsaref2/source/$$i 2>/dev/null \ - || cp $(srcdir)/../rsaref2/source/$$i $(srcdir)/$$i ;; \ + *) case "$$i" in \ + *.h) r_dst=$(srcdir)/$$i ;; \ + *) r_dst=$$i ;; \ + esac ; \ + cmp -s $${r_dst} $(srcdir)/../@RSADIR@/source/$$i 2>/dev/null \ + || cp $(srcdir)/../@RSADIR@/source/$$i $${r_dst} ;; \ esac ; \ done - -stamp-rsaref: - touch stamp-rsaref + @echo timestamp > stamp-rsarefT 2> /dev/null + @mv stamp-rsarefT stamp-rsaref # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/contrib/ntp/missing b/contrib/ntp/missing index c60e9d7..5f9da90 100755 --- a/contrib/ntp/missing +++ b/contrib/ntp/missing @@ -1,6 +1,6 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -57,6 +57,7 @@ Supported PROGRAM values: automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags @@ -64,7 +65,7 @@ Supported PROGRAM values: ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.2 - GNU automake" + echo "missing 0.3 - GNU automake" ;; -*) @@ -174,6 +175,26 @@ WARNING: \`$1' is missing on your system. You should only need it if fi ;; + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if diff --git a/contrib/ntp/mkinstalldirs b/contrib/ntp/mkinstalldirs index b8d650a..ffc77c6 100755 --- a/contrib/ntp/mkinstalldirs +++ b/contrib/ntp/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.2 1999/12/20 04:14:36 stenn Exp $ +# $Id: mkinstalldirs,v 1.3 2001/04/23 03:27:24 stenn Exp $ errstatus=0 diff --git a/contrib/ntp/ntp_update b/contrib/ntp/ntp_update new file mode 100755 index 0000000..599ca29 --- /dev/null +++ b/contrib/ntp/ntp_update @@ -0,0 +1,69 @@ +#! /bin/sh +# +# (hacked from egcs_update and pikt_update) +# +# Update a local CVS tree from the NTP repository, with an emphasis +# on treating generated files correctly, so that autoconf, bison et +# al are not required for the ``end'' user. +# +# By default all command-line options are passed to `cvs update` in +# addition to $UPDATE_OPTIONS (defined below). If the first parameter +# reads --nostdflags, $UPDATE_OPTIONS as well as this parameter itself +# are omitted. +# +# Examples: +# +# ntp_update -r ntp_latest_snapshot +# ntp_update -A +# ntp_update --nostdflags -P -r ntp_1_1_branch foo/bar +# +# +# (C) 1998 Free Software Foundation +# Originally by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, August 1998. +# +# This script is Free Software, and it can be copied, distributed and +# modified as defined in the GNU General Public License. A copy of +# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html + + +UPDATE_OPTIONS="-P -d" +# Add -d to create any directories that exist in the repository but not +# locally. +# Add -A to reset any sticky tags, dates, or `-k' options. + + +echo "Current directory is `pwd`." + +# First of all, check whether this indeed looks like a local CVS of ntp. +if [ ! -d CVS ] || [ ! -f ntpd/ntpd.c ]; then + echo "This does not seem to be an ntp CVS tree!" + exit +fi + +# Check command-line options + +if [ x"${1}"x = x"--nostdflags"x ]; then + shift +else + set -- $UPDATE_OPTIONS ${1+"$@"} +fi + +echo "Pass 1: Updating autoconf and bison source files" +find . -name configure.in -o -name '*.y' -o -name copyright.htm | grep -v '^\./A\.'| xargs cvs -q update + +echo "Pass 2: Updating full tree" +cvs -q update ${1+"$@"} + +echo "Pass 3: Fixing local tree" +touch `find . -name aclocal.m4 -print` +touch `find . -name configure -print` +touch `find . -name Makefile.in -print` +#touch `find texinfo -name \*.pot -print` +#touch `find texinfo -name \*.gmo -print` +# The following code should also touch the generated lex/yacc/rpc files +for f in \ + stamp-h.in \ + COPYRIGHT +do + touch $f +done diff --git a/contrib/ntp/ntpd/Makefile.am b/contrib/ntp/ntpd/Makefile.am index 2fd16c4..718d996 100644 --- a/contrib/ntp/ntpd/Makefile.am +++ b/contrib/ntp/ntpd/Makefile.am @@ -1,9 +1,14 @@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies AUTOMAKE_OPTIONS = ../util/ansi2knr bin_PROGRAMS = ntpd -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref # LDADD might need RESLIB and ADJLIB LDADD = version.o @LIBPARSE@ ../libntp/libntp.a @LIBRSAREF@ +# ntpd may need: +# log10 refclock_wwv.o +# sqrt ntp_control.o +# floor refclock_wwv.o +# which are (usually) provided by -lm. ntpd_LDADD = $(LDADD) -lm DISTCLEANFILES = .version version.c #EXTRA_DIST = ntpd.mak @@ -13,15 +18,18 @@ check_PROGRAMS = @MAKE_CHECK_Y2K@ EXTRA_PROGRAMS = check_y2k check-local: @MAKE_CHECK_Y2K@ - [ -z "@MAKE_CHECK_Y2K@" ] || ./@MAKE_CHECK_Y2K@ + test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@ -ntpd_SOURCES = jupiter.h map_vme.c ntp_config.c ntp_control.c ntp_filegen.c \ +ntpd_SOURCES = cmd_args.c jupiter.h map_vme.c ntp_config.c ntp_control.c \ + ntp_crypto.c ntp_filegen.c \ ntp_intres.c ntp_io.c ntp_loopfilter.c ntp_monitor.c ntp_peer.c \ - ntp_proto.c ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \ + ntp_proto.c ntp_refclock.c ntp_request.c ntp_resolver.c \ + ntp_restrict.c ntp_timer.c \ ntp_util.c ntpd.c refclock_acts.c refclock_arbiter.c refclock_arc.c \ refclock_as2201.c refclock_atom.c refclock_bancomm.c \ refclock_chronolog.c refclock_chu.c refclock_conf.c refclock_datum.c \ refclock_dumbclock.c refclock_fg.c refclock_gpsvme.c refclock_heath.c \ + refclock_hopfser.c refclock_hopfpci.c \ refclock_hpgps.c refclock_irig.c refclock_jupiter.c refclock_leitch.c \ refclock_local.c refclock_msfees.c refclock_mx4200.c refclock_nmea.c \ refclock_oncore.c refclock_palisade.c refclock_palisade.h \ diff --git a/contrib/ntp/ntpd/Makefile.in b/contrib/ntp/ntpd/Makefile.in index d12a343..0e3ad1c 100644 --- a/contrib/ntp/ntpd/Makefile.in +++ b/contrib/ntp/ntpd/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -103,9 +119,14 @@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = ../util/ansi2knr bin_PROGRAMS = ntpd -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref # LDADD might need RESLIB and ADJLIB LDADD = version.o @LIBPARSE@ ../libntp/libntp.a @LIBRSAREF@ +# ntpd may need: +# log10 refclock_wwv.o +# sqrt ntp_control.o +# floor refclock_wwv.o +# which are (usually) provided by -lm. ntpd_LDADD = $(LDADD) -lm DISTCLEANFILES = .version version.c #EXTRA_DIST = ntpd.mak @@ -114,13 +135,16 @@ ETAGS_ARGS = Makefile.am check_PROGRAMS = @MAKE_CHECK_Y2K@ EXTRA_PROGRAMS = check_y2k -ntpd_SOURCES = jupiter.h map_vme.c ntp_config.c ntp_control.c ntp_filegen.c \ +ntpd_SOURCES = cmd_args.c jupiter.h map_vme.c ntp_config.c ntp_control.c \ + ntp_crypto.c ntp_filegen.c \ ntp_intres.c ntp_io.c ntp_loopfilter.c ntp_monitor.c ntp_peer.c \ - ntp_proto.c ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \ + ntp_proto.c ntp_refclock.c ntp_request.c ntp_resolver.c \ + ntp_restrict.c ntp_timer.c \ ntp_util.c ntpd.c refclock_acts.c refclock_arbiter.c refclock_arc.c \ refclock_as2201.c refclock_atom.c refclock_bancomm.c \ refclock_chronolog.c refclock_chu.c refclock_conf.c refclock_datum.c \ refclock_dumbclock.c refclock_fg.c refclock_gpsvme.c refclock_heath.c \ + refclock_hopfser.c refclock_hopfpci.c \ refclock_hpgps.c refclock_irig.c refclock_jupiter.c refclock_leitch.c \ refclock_local.c refclock_msfees.c refclock_mx4200.c refclock_nmea.c \ refclock_oncore.c refclock_palisade.c refclock_palisade.h \ @@ -128,154 +152,148 @@ ntpd_SOURCES = jupiter.h map_vme.c ntp_config.c ntp_control.c ntp_filegen.c \ refclock_shm.c refclock_tpro.c refclock_trak.c refclock_true.c \ refclock_ulink.c refclock_usno.c refclock_wwv.c refclock_wwvb.c +EXEEXT = +OBJEXT = o subdir = ntpd mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = check_y2k$(EXEEXT) +bin_PROGRAMS = ntpd$(EXEEXT) +check_PROGRAMS = @MAKE_CHECK_Y2K@ +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr check_y2k_SOURCES = check_y2k.c -check_y2k_OBJECTS = check_y2k$U.o +check_y2k_OBJECTS = check_y2k$U.$(OBJEXT) check_y2k_LDADD = $(LDADD) -check_y2k_DEPENDENCIES = version.o ../libntp/libntp.a +check_y2k_DEPENDENCIES = version.o ../libntp/libntp.a check_y2k_LDFLAGS = -am_ntpd_OBJECTS = map_vme$U.o ntp_config$U.o ntp_control$U.o \ -ntp_filegen$U.o ntp_intres$U.o ntp_io$U.o ntp_loopfilter$U.o \ -ntp_monitor$U.o ntp_peer$U.o ntp_proto$U.o ntp_refclock$U.o \ -ntp_request$U.o ntp_restrict$U.o ntp_timer$U.o ntp_util$U.o ntpd$U.o \ -refclock_acts$U.o refclock_arbiter$U.o refclock_arc$U.o \ -refclock_as2201$U.o refclock_atom$U.o refclock_bancomm$U.o \ -refclock_chronolog$U.o refclock_chu$U.o refclock_conf$U.o \ -refclock_datum$U.o refclock_dumbclock$U.o refclock_fg$U.o \ -refclock_gpsvme$U.o refclock_heath$U.o refclock_hpgps$U.o \ -refclock_irig$U.o refclock_jupiter$U.o refclock_leitch$U.o \ -refclock_local$U.o refclock_msfees$U.o refclock_mx4200$U.o \ -refclock_nmea$U.o refclock_oncore$U.o refclock_palisade$U.o \ -refclock_parse$U.o refclock_pcf$U.o refclock_pst$U.o \ -refclock_ptbacts$U.o refclock_shm$U.o refclock_tpro$U.o \ -refclock_trak$U.o refclock_true$U.o refclock_ulink$U.o \ -refclock_usno$U.o refclock_wwv$U.o refclock_wwvb$U.o -ntpd_OBJECTS = $(am_ntpd_OBJECTS) -ntpd_DEPENDENCIES = version.o ../libntp/libntp.a +am_ntpd_OBJECTS = cmd_args$U.$(OBJEXT) map_vme$U.$(OBJEXT) \ +ntp_config$U.$(OBJEXT) ntp_control$U.$(OBJEXT) ntp_crypto$U.$(OBJEXT) \ +ntp_filegen$U.$(OBJEXT) ntp_intres$U.$(OBJEXT) ntp_io$U.$(OBJEXT) \ +ntp_loopfilter$U.$(OBJEXT) ntp_monitor$U.$(OBJEXT) ntp_peer$U.$(OBJEXT) \ +ntp_proto$U.$(OBJEXT) ntp_refclock$U.$(OBJEXT) ntp_request$U.$(OBJEXT) \ +ntp_resolver$U.$(OBJEXT) ntp_restrict$U.$(OBJEXT) ntp_timer$U.$(OBJEXT) \ +ntp_util$U.$(OBJEXT) ntpd$U.$(OBJEXT) refclock_acts$U.$(OBJEXT) \ +refclock_arbiter$U.$(OBJEXT) refclock_arc$U.$(OBJEXT) \ +refclock_as2201$U.$(OBJEXT) refclock_atom$U.$(OBJEXT) \ +refclock_bancomm$U.$(OBJEXT) refclock_chronolog$U.$(OBJEXT) \ +refclock_chu$U.$(OBJEXT) refclock_conf$U.$(OBJEXT) \ +refclock_datum$U.$(OBJEXT) refclock_dumbclock$U.$(OBJEXT) \ +refclock_fg$U.$(OBJEXT) refclock_gpsvme$U.$(OBJEXT) \ +refclock_heath$U.$(OBJEXT) refclock_hopfser$U.$(OBJEXT) \ +refclock_hopfpci$U.$(OBJEXT) refclock_hpgps$U.$(OBJEXT) \ +refclock_irig$U.$(OBJEXT) refclock_jupiter$U.$(OBJEXT) \ +refclock_leitch$U.$(OBJEXT) refclock_local$U.$(OBJEXT) \ +refclock_msfees$U.$(OBJEXT) refclock_mx4200$U.$(OBJEXT) \ +refclock_nmea$U.$(OBJEXT) refclock_oncore$U.$(OBJEXT) \ +refclock_palisade$U.$(OBJEXT) refclock_parse$U.$(OBJEXT) \ +refclock_pcf$U.$(OBJEXT) refclock_pst$U.$(OBJEXT) \ +refclock_ptbacts$U.$(OBJEXT) refclock_shm$U.$(OBJEXT) \ +refclock_tpro$U.$(OBJEXT) refclock_trak$U.$(OBJEXT) \ +refclock_true$U.$(OBJEXT) refclock_ulink$U.$(OBJEXT) \ +refclock_usno$U.$(OBJEXT) refclock_wwv$U.$(OBJEXT) \ +refclock_wwvb$U.$(OBJEXT) +ntpd_OBJECTS = $(am_ntpd_OBJECTS) +ntpd_DEPENDENCIES = version.o ../libntp/libntp.a ntpd_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = check_y2k.c $(ntpd_SOURCES) -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best +DIST_SOURCES = check_y2k.c $(ntpd_SOURCES) depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/check_y2k$U.Po $(DEPDIR)/map_vme$U.Po \ -$(DEPDIR)/ntp_config$U.Po $(DEPDIR)/ntp_control$U.Po \ -$(DEPDIR)/ntp_filegen$U.Po $(DEPDIR)/ntp_intres$U.Po \ -$(DEPDIR)/ntp_io$U.Po $(DEPDIR)/ntp_loopfilter$U.Po \ -$(DEPDIR)/ntp_monitor$U.Po $(DEPDIR)/ntp_peer$U.Po \ -$(DEPDIR)/ntp_proto$U.Po $(DEPDIR)/ntp_refclock$U.Po \ -$(DEPDIR)/ntp_request$U.Po $(DEPDIR)/ntp_restrict$U.Po \ -$(DEPDIR)/ntp_timer$U.Po $(DEPDIR)/ntp_util$U.Po $(DEPDIR)/ntpd$U.Po \ -$(DEPDIR)/refclock_acts$U.Po $(DEPDIR)/refclock_arbiter$U.Po \ -$(DEPDIR)/refclock_arc$U.Po $(DEPDIR)/refclock_as2201$U.Po \ -$(DEPDIR)/refclock_atom$U.Po $(DEPDIR)/refclock_bancomm$U.Po \ -$(DEPDIR)/refclock_chronolog$U.Po $(DEPDIR)/refclock_chu$U.Po \ -$(DEPDIR)/refclock_conf$U.Po $(DEPDIR)/refclock_datum$U.Po \ -$(DEPDIR)/refclock_dumbclock$U.Po $(DEPDIR)/refclock_fg$U.Po \ -$(DEPDIR)/refclock_gpsvme$U.Po $(DEPDIR)/refclock_heath$U.Po \ -$(DEPDIR)/refclock_hpgps$U.Po $(DEPDIR)/refclock_irig$U.Po \ -$(DEPDIR)/refclock_jupiter$U.Po $(DEPDIR)/refclock_leitch$U.Po \ -$(DEPDIR)/refclock_local$U.Po $(DEPDIR)/refclock_msfees$U.Po \ -$(DEPDIR)/refclock_mx4200$U.Po $(DEPDIR)/refclock_nmea$U.Po \ -$(DEPDIR)/refclock_oncore$U.Po $(DEPDIR)/refclock_palisade$U.Po \ -$(DEPDIR)/refclock_parse$U.Po $(DEPDIR)/refclock_pcf$U.Po \ -$(DEPDIR)/refclock_pst$U.Po $(DEPDIR)/refclock_ptbacts$U.Po \ -$(DEPDIR)/refclock_shm$U.Po $(DEPDIR)/refclock_tpro$U.Po \ -$(DEPDIR)/refclock_trak$U.Po $(DEPDIR)/refclock_true$U.Po \ -$(DEPDIR)/refclock_ulink$U.Po $(DEPDIR)/refclock_usno$U.Po \ -$(DEPDIR)/refclock_wwv$U.Po $(DEPDIR)/refclock_wwvb$U.Po -SOURCES = check_y2k.c $(ntpd_SOURCES) -OBJECTS = check_y2k$U.o $(am_ntpd_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .h .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpd/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - +@AMDEP@DEP_FILES = $(DEPDIR)/check_y2k$U.Po $(DEPDIR)/cmd_args$U.Po \ +@AMDEP@ $(DEPDIR)/map_vme$U.Po $(DEPDIR)/ntp_config$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_control$U.Po $(DEPDIR)/ntp_crypto$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_filegen$U.Po $(DEPDIR)/ntp_intres$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_io$U.Po $(DEPDIR)/ntp_loopfilter$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_monitor$U.Po $(DEPDIR)/ntp_peer$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_proto$U.Po $(DEPDIR)/ntp_refclock$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_request$U.Po $(DEPDIR)/ntp_resolver$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_restrict$U.Po $(DEPDIR)/ntp_timer$U.Po \ +@AMDEP@ $(DEPDIR)/ntp_util$U.Po $(DEPDIR)/ntpd$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_acts$U.Po $(DEPDIR)/refclock_arbiter$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_arc$U.Po $(DEPDIR)/refclock_as2201$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_atom$U.Po $(DEPDIR)/refclock_bancomm$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_chronolog$U.Po $(DEPDIR)/refclock_chu$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_conf$U.Po $(DEPDIR)/refclock_datum$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_dumbclock$U.Po $(DEPDIR)/refclock_fg$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_gpsvme$U.Po $(DEPDIR)/refclock_heath$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_hopfpci$U.Po $(DEPDIR)/refclock_hopfser$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_hpgps$U.Po $(DEPDIR)/refclock_irig$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_jupiter$U.Po $(DEPDIR)/refclock_leitch$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_local$U.Po $(DEPDIR)/refclock_msfees$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_mx4200$U.Po $(DEPDIR)/refclock_nmea$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_oncore$U.Po $(DEPDIR)/refclock_palisade$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_parse$U.Po $(DEPDIR)/refclock_pcf$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_pst$U.Po $(DEPDIR)/refclock_ptbacts$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_shm$U.Po $(DEPDIR)/refclock_tpro$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_trak$U.Po $(DEPDIR)/refclock_true$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_ulink$U.Po $(DEPDIR)/refclock_usno$U.Po \ +@AMDEP@ $(DEPDIR)/refclock_wwv$U.Po $(DEPDIR)/refclock_wwvb$U.Po +DIST_COMMON = Makefile.am Makefile.in -mostlyclean-binPROGRAMS: +SOURCES = check_y2k.c $(ntpd_SOURCES) +OBJECTS = check_y2k$U.$(OBJEXT) $(am_ntpd_OBJECTS) -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .h .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntpd/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-checkPROGRAMS: +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) -distclean-checkPROGRAMS: - -maintainer-clean-checkPROGRAMS: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - check_y2k: $(check_y2k_OBJECTS) $(check_y2k_DEPENDENCIES) @rm -f check_y2k $(LINK) $(check_y2k_LDFLAGS) $(check_y2k_OBJECTS) $(check_y2k_LDADD) $(LIBS) @@ -285,12 +303,16 @@ ntpd: $(ntpd_OBJECTS) $(ntpd_DEPENDENCIES) $(LINK) $(ntpd_LDFLAGS) $(ntpd_OBJECTS) $(ntpd_LDADD) $(LIBS) check_y2k_.c: check_y2k.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/check_y2k.c; then echo $(srcdir)/check_y2k.c; else echo check_y2k.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > check_y2k_.c +cmd_args_.c: cmd_args.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmd_args.c; then echo $(srcdir)/cmd_args.c; else echo cmd_args.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > cmd_args_.c map_vme_.c: map_vme.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/map_vme.c; then echo $(srcdir)/map_vme.c; else echo map_vme.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > map_vme_.c ntp_config_.c: ntp_config.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_config.c; then echo $(srcdir)/ntp_config.c; else echo ntp_config.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_config_.c ntp_control_.c: ntp_control.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_control.c; then echo $(srcdir)/ntp_control.c; else echo ntp_control.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_control_.c +ntp_crypto_.c: ntp_crypto.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_crypto.c; then echo $(srcdir)/ntp_crypto.c; else echo ntp_crypto.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_crypto_.c ntp_filegen_.c: ntp_filegen.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_filegen.c; then echo $(srcdir)/ntp_filegen.c; else echo ntp_filegen.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_filegen_.c ntp_intres_.c: ntp_intres.c $(ANSI2KNR) @@ -309,6 +331,8 @@ ntp_refclock_.c: ntp_refclock.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_refclock.c; then echo $(srcdir)/ntp_refclock.c; else echo ntp_refclock.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_refclock_.c ntp_request_.c: ntp_request.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_request.c; then echo $(srcdir)/ntp_request.c; else echo ntp_request.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_request_.c +ntp_resolver_.c: ntp_resolver.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_resolver.c; then echo $(srcdir)/ntp_resolver.c; else echo ntp_resolver.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_resolver_.c ntp_restrict_.c: ntp_restrict.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp_restrict.c; then echo $(srcdir)/ntp_restrict.c; else echo ntp_restrict.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp_restrict_.c ntp_timer_.c: ntp_timer.c $(ANSI2KNR) @@ -345,6 +369,10 @@ refclock_gpsvme_.c: refclock_gpsvme.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_gpsvme.c; then echo $(srcdir)/refclock_gpsvme.c; else echo refclock_gpsvme.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_gpsvme_.c refclock_heath_.c: refclock_heath.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_heath.c; then echo $(srcdir)/refclock_heath.c; else echo refclock_heath.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_heath_.c +refclock_hopfpci_.c: refclock_hopfpci.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_hopfpci.c; then echo $(srcdir)/refclock_hopfpci.c; else echo refclock_hopfpci.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_hopfpci_.c +refclock_hopfser_.c: refclock_hopfser.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_hopfser.c; then echo $(srcdir)/refclock_hopfser.c; else echo refclock_hopfser.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_hopfser_.c refclock_hpgps_.c: refclock_hpgps.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_hpgps.c; then echo $(srcdir)/refclock_hpgps.c; else echo refclock_hpgps.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_hpgps_.c refclock_irig_.c: refclock_irig.c $(ANSI2KNR) @@ -389,20 +417,32 @@ refclock_wwv_.c: refclock_wwv.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_wwv.c; then echo $(srcdir)/refclock_wwv.c; else echo refclock_wwv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_wwv_.c refclock_wwvb_.c: refclock_wwvb.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refclock_wwvb.c; then echo $(srcdir)/refclock_wwvb.c; else echo refclock_wwvb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refclock_wwvb_.c -check_y2k_.o map_vme_.o ntp_config_.o ntp_control_.o ntp_filegen_.o \ -ntp_intres_.o ntp_io_.o ntp_loopfilter_.o ntp_monitor_.o ntp_peer_.o \ -ntp_proto_.o ntp_refclock_.o ntp_request_.o ntp_restrict_.o \ -ntp_timer_.o ntp_util_.o ntpd_.o refclock_acts_.o refclock_arbiter_.o \ -refclock_arc_.o refclock_as2201_.o refclock_atom_.o refclock_bancomm_.o \ -refclock_chronolog_.o refclock_chu_.o refclock_conf_.o \ -refclock_datum_.o refclock_dumbclock_.o refclock_fg_.o \ -refclock_gpsvme_.o refclock_heath_.o refclock_hpgps_.o refclock_irig_.o \ -refclock_jupiter_.o refclock_leitch_.o refclock_local_.o \ -refclock_msfees_.o refclock_mx4200_.o refclock_nmea_.o \ -refclock_oncore_.o refclock_palisade_.o refclock_parse_.o \ -refclock_pcf_.o refclock_pst_.o refclock_ptbacts_.o refclock_shm_.o \ -refclock_tpro_.o refclock_trak_.o refclock_true_.o refclock_ulink_.o \ -refclock_usno_.o refclock_wwv_.o refclock_wwvb_.o : $(ANSI2KNR) +check_y2k_.$(OBJEXT) cmd_args_.$(OBJEXT) map_vme_.$(OBJEXT) \ +ntp_config_.$(OBJEXT) ntp_control_.$(OBJEXT) ntp_crypto_.$(OBJEXT) \ +ntp_filegen_.$(OBJEXT) ntp_intres_.$(OBJEXT) ntp_io_.$(OBJEXT) \ +ntp_loopfilter_.$(OBJEXT) ntp_monitor_.$(OBJEXT) ntp_peer_.$(OBJEXT) \ +ntp_proto_.$(OBJEXT) ntp_refclock_.$(OBJEXT) ntp_request_.$(OBJEXT) \ +ntp_resolver_.$(OBJEXT) ntp_restrict_.$(OBJEXT) ntp_timer_.$(OBJEXT) \ +ntp_util_.$(OBJEXT) ntpd_.$(OBJEXT) refclock_acts_.$(OBJEXT) \ +refclock_arbiter_.$(OBJEXT) refclock_arc_.$(OBJEXT) \ +refclock_as2201_.$(OBJEXT) refclock_atom_.$(OBJEXT) \ +refclock_bancomm_.$(OBJEXT) refclock_chronolog_.$(OBJEXT) \ +refclock_chu_.$(OBJEXT) refclock_conf_.$(OBJEXT) \ +refclock_datum_.$(OBJEXT) refclock_dumbclock_.$(OBJEXT) \ +refclock_fg_.$(OBJEXT) refclock_gpsvme_.$(OBJEXT) \ +refclock_heath_.$(OBJEXT) refclock_hopfpci_.$(OBJEXT) \ +refclock_hopfser_.$(OBJEXT) refclock_hpgps_.$(OBJEXT) \ +refclock_irig_.$(OBJEXT) refclock_jupiter_.$(OBJEXT) \ +refclock_leitch_.$(OBJEXT) refclock_local_.$(OBJEXT) \ +refclock_msfees_.$(OBJEXT) refclock_mx4200_.$(OBJEXT) \ +refclock_nmea_.$(OBJEXT) refclock_oncore_.$(OBJEXT) \ +refclock_palisade_.$(OBJEXT) refclock_parse_.$(OBJEXT) \ +refclock_pcf_.$(OBJEXT) refclock_pst_.$(OBJEXT) \ +refclock_ptbacts_.$(OBJEXT) refclock_shm_.$(OBJEXT) \ +refclock_tpro_.$(OBJEXT) refclock_trak_.$(OBJEXT) \ +refclock_true_.$(OBJEXT) refclock_ulink_.$(OBJEXT) \ +refclock_usno_.$(OBJEXT) refclock_wwv_.$(OBJEXT) \ +refclock_wwvb_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -413,9 +453,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -428,128 +468,130 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/check_y2k$U.Po -@AMDEP@include $(DEPDIR)/map_vme$U.Po -@AMDEP@include $(DEPDIR)/ntp_config$U.Po -@AMDEP@include $(DEPDIR)/ntp_control$U.Po -@AMDEP@include $(DEPDIR)/ntp_filegen$U.Po -@AMDEP@include $(DEPDIR)/ntp_intres$U.Po -@AMDEP@include $(DEPDIR)/ntp_io$U.Po -@AMDEP@include $(DEPDIR)/ntp_loopfilter$U.Po -@AMDEP@include $(DEPDIR)/ntp_monitor$U.Po -@AMDEP@include $(DEPDIR)/ntp_peer$U.Po -@AMDEP@include $(DEPDIR)/ntp_proto$U.Po -@AMDEP@include $(DEPDIR)/ntp_refclock$U.Po -@AMDEP@include $(DEPDIR)/ntp_request$U.Po -@AMDEP@include $(DEPDIR)/ntp_restrict$U.Po -@AMDEP@include $(DEPDIR)/ntp_timer$U.Po -@AMDEP@include $(DEPDIR)/ntp_util$U.Po -@AMDEP@include $(DEPDIR)/ntpd$U.Po -@AMDEP@include $(DEPDIR)/refclock_acts$U.Po -@AMDEP@include $(DEPDIR)/refclock_arbiter$U.Po -@AMDEP@include $(DEPDIR)/refclock_arc$U.Po -@AMDEP@include $(DEPDIR)/refclock_as2201$U.Po -@AMDEP@include $(DEPDIR)/refclock_atom$U.Po -@AMDEP@include $(DEPDIR)/refclock_bancomm$U.Po -@AMDEP@include $(DEPDIR)/refclock_chronolog$U.Po -@AMDEP@include $(DEPDIR)/refclock_chu$U.Po -@AMDEP@include $(DEPDIR)/refclock_conf$U.Po -@AMDEP@include $(DEPDIR)/refclock_datum$U.Po -@AMDEP@include $(DEPDIR)/refclock_dumbclock$U.Po -@AMDEP@include $(DEPDIR)/refclock_fg$U.Po -@AMDEP@include $(DEPDIR)/refclock_gpsvme$U.Po -@AMDEP@include $(DEPDIR)/refclock_heath$U.Po -@AMDEP@include $(DEPDIR)/refclock_hpgps$U.Po -@AMDEP@include $(DEPDIR)/refclock_irig$U.Po -@AMDEP@include $(DEPDIR)/refclock_jupiter$U.Po -@AMDEP@include $(DEPDIR)/refclock_leitch$U.Po -@AMDEP@include $(DEPDIR)/refclock_local$U.Po -@AMDEP@include $(DEPDIR)/refclock_msfees$U.Po -@AMDEP@include $(DEPDIR)/refclock_mx4200$U.Po -@AMDEP@include $(DEPDIR)/refclock_nmea$U.Po -@AMDEP@include $(DEPDIR)/refclock_oncore$U.Po -@AMDEP@include $(DEPDIR)/refclock_palisade$U.Po -@AMDEP@include $(DEPDIR)/refclock_parse$U.Po -@AMDEP@include $(DEPDIR)/refclock_pcf$U.Po -@AMDEP@include $(DEPDIR)/refclock_pst$U.Po -@AMDEP@include $(DEPDIR)/refclock_ptbacts$U.Po -@AMDEP@include $(DEPDIR)/refclock_shm$U.Po -@AMDEP@include $(DEPDIR)/refclock_tpro$U.Po -@AMDEP@include $(DEPDIR)/refclock_trak$U.Po -@AMDEP@include $(DEPDIR)/refclock_true$U.Po -@AMDEP@include $(DEPDIR)/refclock_ulink$U.Po -@AMDEP@include $(DEPDIR)/refclock_usno$U.Po -@AMDEP@include $(DEPDIR)/refclock_wwv$U.Po -@AMDEP@include $(DEPDIR)/refclock_wwvb$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/check_y2k$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/cmd_args$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/map_vme$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_config$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_control$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_crypto$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_filegen$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_intres$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_io$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_loopfilter$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_monitor$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_peer$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_proto$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_refclock$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_request$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_resolver$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_restrict$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_timer$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp_util$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntpd$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_acts$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_arbiter$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_arc$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_as2201$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_atom$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_bancomm$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_chronolog$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_chu$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_conf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_datum$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_dumbclock$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_fg$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_gpsvme$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_heath$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_hopfpci$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_hopfser$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_hpgps$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_irig$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_jupiter$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_leitch$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_local$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_msfees$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_mx4200$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_nmea$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_oncore$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_palisade$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_parse$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_pcf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_pst$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_ptbacts$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_shm$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_tpro$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_trak$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_true$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_ulink$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_usno$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_wwv$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refclock_wwvb$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -561,51 +603,61 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-checkPROGRAMS \ - mostlyclean-compile mostlyclean-kr mostlyclean-tags \ - mostlyclean-depend mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + mostlyclean-am -clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-compile clean-kr \ - clean-tags clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-checkPROGRAMS \ - distclean-compile distclean-kr distclean-tags \ - distclean-depend distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-checkPROGRAMS maintainer-clean-compile \ - maintainer-clean-kr maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-checkPROGRAMS distclean-checkPROGRAMS clean-checkPROGRAMS \ -maintainer-clean-checkPROGRAMS mostlyclean-compile distclean-compile \ -clean-compile maintainer-clean-compile mostlyclean-kr distclean-kr \ -clean-kr maintainer-clean-kr tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir mostlyclean-depend \ -distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check-local check check-am installcheck-am installcheck \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am check-local clean clean-binPROGRAMS \ + clean-checkPROGRAMS clean-generic distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am \ + uninstall-binPROGRAMS check-local: @MAKE_CHECK_Y2K@ - [ -z "@MAKE_CHECK_Y2K@" ] || ./@MAKE_CHECK_Y2K@ + test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@ $(PROGRAMS): $(LDADD) diff --git a/contrib/ntp/ntpd/check_y2k.c b/contrib/ntp/ntpd/check_y2k.c index 3cc05fc..f0f4480 100644 --- a/contrib/ntp/ntpd/check_y2k.c +++ b/contrib/ntp/ntpd/check_y2k.c @@ -31,7 +31,8 @@ # include <config.h> #endif -#include <sys/types.h> +#include "ntpd.h" + #ifdef HAVE_UNISTD_H # include <unistd.h> #endif @@ -48,7 +49,6 @@ # ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> # endif /* HAVE_SYS_IOCTL_H */ -# include <sys/time.h> # if !defined(VMS) /*wjm*/ # include <sys/resource.h> # endif /* VMS */ @@ -94,8 +94,6 @@ # include <apollo/base.h> #endif /* SYS_DOMAINOS */ -#include "ntpd.h" - /* } end definitions lifted from ntpd.c */ #include "ntp_calendar.h" @@ -103,10 +101,11 @@ #define GoodLeap(Year) (((Year)%4 || (!((Year)%100) && (Year)%400)) ? 0 : 13 ) -int debug = 0; /* debugging requests for parse stuff */ +volatile int debug = 0; /* debugging requests for parse stuff */ char const *progname = "check_y2k"; -long Days ( int Year ) /* return number of days since year "0" */ +long +Days ( int Year ) /* return number of days since year "0" */ { long Return; /* this is a known to be good algorithm */ @@ -137,7 +136,8 @@ static struct tm LocalTime; #define Error(year) if ( (year)>=2036 && LocalTime.tm_year < 110 ) \ Warnings++; else Fatals++ -int main( void ) +int +main( void ) { int Fatals; int Warnings; diff --git a/contrib/ntp/ntpd/cmd_args.c b/contrib/ntp/ntpd/cmd_args.c new file mode 100644 index 0000000..9f61b4a --- /dev/null +++ b/contrib/ntp/ntpd/cmd_args.c @@ -0,0 +1,313 @@ +/* + * cmd_args.c = command-line argument processing + */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "ntpd.h" +#include "ntp_stdlib.h" +#include "ntp_cmdargs.h" + +/* + * Definitions of things either imported from or exported to outside + */ +extern char const *progname; +int listen_to_virtual_ips = 0; + +static const char *ntp_options = "aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:x"; + +#ifdef HAVE_NETINFO +extern int check_netinfo; +#endif + + +/* + * getstartup - search through the options looking for a debugging flag + */ +void +getstartup( + int argc, + char *argv[] + ) +{ + int errflg; + extern int priority_done; + int c; + +#ifdef DEBUG + debug = 0; /* no debugging by default */ +#endif + + /* + * This is a big hack. We don't really want to read command line + * configuration until everything else is initialized, since + * the ability to configure the system may depend on storage + * and the like having been initialized. Except that we also + * don't want to initialize anything until after detaching from + * the terminal, but we won't know to do that until we've + * parsed the command line. Do that now, crudely, and do it + * again later. Our ntp_getopt() is explicitly reusable, by the + * way. Your own mileage may vary. + * + * This hack is even called twice (to allow complete logging to file) + */ + errflg = 0; + progname = argv[0]; + + /* + * Decode argument list + */ + while ((c = ntp_getopt(argc, argv, ntp_options)) != EOF) + switch (c) { +#ifdef DEBUG + case 'd': + ++debug; + break; + case 'D': + debug = (int)atol(ntp_optarg); + printf("Debug1: %s -> %x = %d\n", ntp_optarg, debug, debug); + break; +#else + case 'd': + case 'D': + msyslog(LOG_ERR, "ntpd not compiled with -DDEBUG option - no DEBUG support"); + fprintf(stderr, "ntpd not compiled with -DDEBUG option - no DEBUG support"); + ++errflg; + break; +#endif + case 'L': + listen_to_virtual_ips = 1; + break; + case 'l': + { + FILE *new_file; + + new_file = fopen(ntp_optarg, "a"); + if (new_file != NULL) { + NLOG(NLOG_SYSINFO) + msyslog(LOG_NOTICE, "logging to file %s", ntp_optarg); + if (syslog_file != NULL && + fileno(syslog_file) != fileno(new_file)) + (void)fclose(syslog_file); + + syslog_file = new_file; + syslogit = 0; + } + else + msyslog(LOG_ERR, + "Cannot open log file %s", + ntp_optarg); + } + break; + + case 'n': + case 'q': + ++nofork; + break; + + case 'N': + priority_done = strcmp(ntp_optarg, "high"); + break; + + case '?': + ++errflg; + break; + + default: + break; + } + + if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, "usage: %s [ -abdgmnqx ] [ -c config_file ] [ -e e_delay ]\n", progname); + (void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n"); + (void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n"); + (void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n"); +#if defined(HAVE_SCHED_SETSCHEDULER) + (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n"); +#endif + exit(2); + } + ntp_optind = 0; /* reset ntp_optind to restart ntp_getopt */ + +#ifdef DEBUG + if (debug) { +#ifdef HAVE_SETVBUF + static char buf[BUFSIZ]; + setvbuf(stdout, buf, _IOLBF, BUFSIZ); +#else + setlinebuf(stdout); +#endif + } +#endif +} + +/* + * getCmdOpts - get command line options + */ +void +getCmdOpts( + int argc, + char *argv[] + ) +{ + extern char *config_file; + int errflg; + int c; + + /* + * Initialize, initialize + */ + errflg = 0; +#ifdef DEBUG + debug = 0; +#endif /* DEBUG */ + + progname = argv[0]; + + /* + * Decode argument list + */ + while ((c = ntp_getopt(argc, argv, ntp_options)) != EOF) { + switch (c) { + case 'a': + proto_config(PROTO_AUTHENTICATE, 1, 0.); + break; + + case 'A': + proto_config(PROTO_AUTHENTICATE, 0, 0.); + break; + + case 'b': + proto_config(PROTO_BROADCLIENT, 1, 0.); + break; + + case 'c': + config_file = ntp_optarg; +#ifdef HAVE_NETINFO + check_netinfo = 0; +#endif + break; + + case 'd': +#ifdef DEBUG + debug++; +#else + errflg++; +#endif /* DEBUG */ + break; + + case 'D': +#ifdef DEBUG + debug = (int)atol(ntp_optarg); + printf("Debug2: %s -> %x = %d\n", ntp_optarg, debug, debug); +#else + errflg++; +#endif /* DEBUG */ + break; + + case 'f': + stats_config(STATS_FREQ_FILE, ntp_optarg); + break; + + case 'g': + allow_panic = TRUE; + break; + + case 'k': + getauthkeys(ntp_optarg); + break; + + case 'L': /* already done at pre-scan */ + case 'l': /* already done at pre-scan */ + break; + + case 'm': + proto_config(PROTO_MULTICAST_ADD, htonl(INADDR_NTP), 0.); + sys_bclient = 1; + break; + + case 'n': /* already done at pre-scan */ + break; + + case 'N': /* already done at pre-scan */ + break; + + case 'p': + stats_config(STATS_PID_FILE, ntp_optarg); + break; + + case 'P': +#if defined(HAVE_SCHED_SETSCHEDULER) + config_priority = (int)atol(ntp_optarg); + config_priority_override = 1; +#else + errflg++; +#endif + break; + + case 'q': + mode_ntpdate = TRUE; + break; + + case 'r': + do { + double tmp; + + if (sscanf(ntp_optarg, "%lf", &tmp) != 1) { + msyslog(LOG_ERR, + "command line broadcast delay value %s undecodable", + ntp_optarg); + } else { + proto_config(PROTO_BROADDELAY, 0, tmp); + } + } while (0); + break; + + case 's': + stats_config(STATS_STATSDIR, ntp_optarg); + break; + + case 't': + do { + u_long tkey; + + tkey = (int)atol(ntp_optarg); + if (tkey <= 0 || tkey > NTP_MAXKEY) { + msyslog(LOG_ERR, + "command line trusted key %s is invalid", + ntp_optarg); + } else { + authtrust(tkey, 1); + } + } while (0); + break; + + case 'v': + case 'V': + set_sys_var(ntp_optarg, strlen(ntp_optarg)+1, + RW | ((c == 'V') ? DEF : 0)); + break; + + case 'x': + allow_step = FALSE; + break; + + default: + errflg++; + break; + } + } + + if (errflg || ntp_optind != argc) { + (void) fprintf(stderr, "usage: %s [ -abdgmnx ] [ -c config_file ] [ -e e_delay ]\n", progname); + (void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n"); + (void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n"); + (void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n"); +#if defined(HAVE_SCHED_SETSCHEDULER) + (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n"); +#endif + exit(2); + } + return; +} diff --git a/contrib/ntp/ntpd/ntp_config.c b/contrib/ntp/ntpd/ntp_config.c index e21f5b0..208b257 100644 --- a/contrib/ntp/ntpd/ntp_config.c +++ b/contrib/ntp/ntpd/ntp_config.c @@ -1,28 +1,12 @@ /* * ntp_config.c - read and apply configuration information */ - #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include <stdio.h> -#include <ctype.h> -#include <sys/param.h> -#include <sys/types.h> -#include <signal.h> -#ifndef SIGCHLD -#define SIGCHLD SIGCLD -#endif -#if !defined(VMS) -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif -#endif /* VMS */ -#include <sys/time.h> - #ifdef HAVE_NETINFO -#include <netinfo/ni.h> +# include <netinfo/ni.h> #endif #include "ntpd.h" @@ -31,12 +15,33 @@ #include "ntp_refclock.h" #include "ntp_filegen.h" #include "ntp_stdlib.h" +#include "ntp_config.h" +#include "ntp_cmdargs.h" + +#ifdef PUBKEY +# include "ntp_crypto.h" +#endif /* PUBKEY */ + +#include <stdio.h> +#include <ctype.h> +#include <sys/param.h> +#include <signal.h> +#ifndef SIGCHLD +# define SIGCHLD SIGCLD +#endif +#if !defined(VMS) +# ifdef HAVE_SYS_WAIT_H +# include <sys/wait.h> +# endif +#endif /* VMS */ #ifdef SYS_WINNT -#include <io.h> +# include <io.h> extern HANDLE ResolverThreadHandle; #endif /* SYS_WINNT */ +extern int priority_done; + /* * These routines are used to read the configuration file at * startup time. An entry in the file must fit on a single line. @@ -46,18 +51,6 @@ extern HANDLE ResolverThreadHandle; */ /* - * Configuration file name - */ -#ifndef CONFIG_FILE -# ifndef SYS_WINNT -# define CONFIG_FILE "/etc/ntp.conf" -# else /* SYS_WINNT */ -# define CONFIG_FILE "%windir%\\system32\\drivers\\etc\\ntp.conf" -# define ALT_CONFIG_FILE "%windir%\\ntp.conf" -# endif /* SYS_WINNT */ -#endif /* not CONFIG_FILE */ - -/* * We understand the following configuration entries and defaults. * * peer [ addr ] [ version 3 ] [ key 0 ] [ minpoll 6 ] [ maxpoll 10 ] @@ -71,6 +64,8 @@ extern HANDLE ResolverThreadHandle; * restrict [ addr ] [ mask 255.255.255.0 ] ignore|noserve|notrust|noquery * driftfile file_name * keys file_name + * publickey file_name + * privatekey file_name * statsdir /var/NTP/ * filegen peerstats [ file peerstats ] [ type day ] [ link ] * clientlimit [ n ] @@ -88,94 +83,10 @@ extern HANDLE ResolverThreadHandle; * disable auth|bclient|pll|kernel|monitor|stats * phone ... * pps device [assert|clear] [hardpps] + * priority high|normal */ /* - * Types of entries we understand. - */ -#define CONFIG_UNKNOWN 0 - -#define CONFIG_PEER 1 -#define CONFIG_SERVER 2 -#define CONFIG_AUTOMAX 3 -#define CONFIG_DRIFTFILE 4 -#define CONFIG_BROADCAST 5 -#define CONFIG_BROADCASTCLIENT 6 -#define CONFIG_AUTHENTICATE 7 -#define CONFIG_KEYS 8 -#define CONFIG_REVOKE 9 -#define CONFIG_PPS 10 -#define CONFIG_RESTRICT 11 -#define CONFIG_BDELAY 12 -#define CONFIG_TRUSTEDKEY 13 -#define CONFIG_REQUESTKEY 14 -#define CONFIG_CONTROLKEY 15 -#define CONFIG_TRAP 16 -#define CONFIG_FUDGE 17 -#define CONFIG_18 18 /* unused */ -#define CONFIG_STATSDIR 19 -#define CONFIG_FILEGEN 20 -#define CONFIG_STATISTICS 21 -#define CONFIG_PIDFILE 22 -#define CONFIG_SETVAR 23 -#define CONFIG_CLIENTLIMIT 24 -#define CONFIG_CLIENTPERIOD 25 -#define CONFIG_MULTICASTCLIENT 26 -#define CONFIG_ENABLE 27 -#define CONFIG_DISABLE 28 -#define CONFIG_PHONE 29 -#define CONFIG_LOGFILE 30 -#define CONFIG_LOGCONFIG 31 -#define CONFIG_MANYCASTCLIENT 32 -#define CONFIG_MANYCASTSERVER 33 - -#define CONF_MOD_VERSION 1 -#define CONF_MOD_KEY 2 -#define CONF_MOD_MINPOLL 3 -#define CONF_MOD_MAXPOLL 4 -#define CONF_MOD_PREFER 5 -#define CONF_MOD_BURST 6 -#define CONF_MOD_SKEY 7 -#define CONF_MOD_TTL 8 -#define CONF_MOD_MODE 9 -#define CONF_MOD_NOSELECT 10 - -#define CONF_RES_MASK 1 -#define CONF_RES_IGNORE 2 -#define CONF_RES_NOSERVE 3 -#define CONF_RES_NOTRUST 4 -#define CONF_RES_NOQUERY 5 -#define CONF_RES_NOMODIFY 6 -#define CONF_RES_NOPEER 7 -#define CONF_RES_NOTRAP 8 -#define CONF_RES_LPTRAP 9 -#define CONF_RES_NTPPORT 10 -#define CONF_RES_LIMITED 11 - -#define CONF_TRAP_PORT 1 -#define CONF_TRAP_INTERFACE 2 - -#define CONF_FDG_TIME1 1 -#define CONF_FDG_TIME2 2 -#define CONF_FDG_STRATUM 3 -#define CONF_FDG_REFID 4 -#define CONF_FDG_FLAG1 5 -#define CONF_FDG_FLAG2 6 -#define CONF_FDG_FLAG3 7 -#define CONF_FDG_FLAG4 8 - -#define CONF_FGEN_FILE 1 -#define CONF_FGEN_TYPE 2 -#define CONF_FGEN_FLAG_LINK 3 -#define CONF_FGEN_FLAG_NOLINK 4 -#define CONF_FGEN_FLAG_ENABLE 5 -#define CONF_FGEN_FLAG_DISABLE 6 - -#define CONF_PPS_ASSERT 1 -#define CONF_PPS_CLEAR 2 -#define CONF_PPS_HARDPPS 3 - -/* * Translation table - keywords to function index */ struct keyword { @@ -187,38 +98,46 @@ struct keyword { * Command keywords */ static struct keyword keywords[] = { - { "peer", CONFIG_PEER }, - { "server", CONFIG_SERVER }, - { "driftfile", CONFIG_DRIFTFILE }, - { "broadcast", CONFIG_BROADCAST }, - { "broadcastclient", CONFIG_BROADCASTCLIENT }, - { "multicastclient", CONFIG_MULTICASTCLIENT }, - { "manycastclient", CONFIG_MANYCASTCLIENT }, - { "manycastserver", CONFIG_MANYCASTSERVER }, { "authenticate", CONFIG_AUTHENTICATE }, - { "keys", CONFIG_KEYS }, - { "revoke", CONFIG_REVOKE }, - { "pps", CONFIG_PPS }, { "automax", CONFIG_AUTOMAX }, - { "restrict", CONFIG_RESTRICT }, + { "broadcast", CONFIG_BROADCAST }, + { "broadcastclient", CONFIG_BROADCASTCLIENT }, { "broadcastdelay", CONFIG_BDELAY }, - { "trustedkey", CONFIG_TRUSTEDKEY }, - { "requestkey", CONFIG_REQUESTKEY }, - { "controlkey", CONFIG_CONTROLKEY }, - { "trap", CONFIG_TRAP }, - { "fudge", CONFIG_FUDGE }, - { "statsdir", CONFIG_STATSDIR }, - { "filegen", CONFIG_FILEGEN }, - { "statistics", CONFIG_STATISTICS }, - { "pidfile", CONFIG_PIDFILE }, - { "setvar", CONFIG_SETVAR }, { "clientlimit", CONFIG_CLIENTLIMIT }, { "clientperiod", CONFIG_CLIENTPERIOD }, - { "enable", CONFIG_ENABLE }, +#ifdef PUBKEY + { "crypto", CONFIG_CRYPTO }, +#endif /* PUBKEY */ + { "controlkey", CONFIG_CONTROLKEY }, { "disable", CONFIG_DISABLE }, - { "phone", CONFIG_PHONE }, - { "logfile", CONFIG_LOGFILE }, + { "driftfile", CONFIG_DRIFTFILE }, + { "enable", CONFIG_ENABLE }, + { "filegen", CONFIG_FILEGEN }, + { "fudge", CONFIG_FUDGE }, + { "includefile", CONFIG_INCLUDEFILE }, + { "keys", CONFIG_KEYS }, +#ifdef PUBKEY + { "keysdir", CONFIG_KEYSDIR }, +#endif /* PUBKEY */ { "logconfig", CONFIG_LOGCONFIG }, + { "logfile", CONFIG_LOGFILE }, + { "manycastclient", CONFIG_MANYCASTCLIENT }, + { "manycastserver", CONFIG_MANYCASTSERVER }, + { "multicastclient", CONFIG_MULTICASTCLIENT }, + { "peer", CONFIG_PEER }, + { "phone", CONFIG_PHONE }, + { "pidfile", CONFIG_PIDFILE }, + { "pps", CONFIG_PPS }, + { "requestkey", CONFIG_REQUESTKEY }, + { "restrict", CONFIG_RESTRICT }, + { "revoke", CONFIG_REVOKE }, + { "server", CONFIG_SERVER }, + { "setvar", CONFIG_SETVAR }, + { "statistics", CONFIG_STATISTICS }, + { "statsdir", CONFIG_STATSDIR }, + { "tinker", CONFIG_TINKER }, + { "trap", CONFIG_TRAP }, + { "trustedkey", CONFIG_TRUSTEDKEY }, { "", CONFIG_UNKNOWN } }; @@ -226,16 +145,20 @@ static struct keyword keywords[] = { * "peer", "server", "broadcast" modifier keywords */ static struct keyword mod_keywords[] = { - { "version", CONF_MOD_VERSION }, + { "autokey", CONF_MOD_SKEY }, + { "burst", CONF_MOD_BURST }, + { "iburst", CONF_MOD_IBURST }, { "key", CONF_MOD_KEY }, - { "minpoll", CONF_MOD_MINPOLL }, { "maxpoll", CONF_MOD_MAXPOLL }, - { "prefer", CONF_MOD_PREFER }, + { "minpoll", CONF_MOD_MINPOLL }, + { "mode", CONF_MOD_MODE }, /* refclocks */ { "noselect", CONF_MOD_NOSELECT }, - { "burst", CONF_MOD_BURST }, - { "autokey", CONF_MOD_SKEY }, - { "mode", CONF_MOD_MODE }, /* reference clocks */ + { "prefer", CONF_MOD_PREFER }, +#ifdef PUBKEY + { "publickey", CONF_MOD_PUBLICKEY }, +#endif /* PUBKEY */ { "ttl", CONF_MOD_TTL }, /* NTP peers */ + { "version", CONF_MOD_VERSION }, { "", CONFIG_UNKNOWN } }; @@ -243,17 +166,19 @@ static struct keyword mod_keywords[] = { * "restrict" modifier keywords */ static struct keyword res_keywords[] = { - { "mask", CONF_RES_MASK }, { "ignore", CONF_RES_IGNORE }, - { "noserve", CONF_RES_NOSERVE }, - { "notrust", CONF_RES_NOTRUST }, - { "noquery", CONF_RES_NOQUERY }, + { "limited", CONF_RES_LIMITED }, + { "kod", CONF_RES_DEMOBILIZE }, + { "lowpriotrap", CONF_RES_LPTRAP }, + { "mask", CONF_RES_MASK }, { "nomodify", CONF_RES_NOMODIFY }, { "nopeer", CONF_RES_NOPEER }, + { "noquery", CONF_RES_NOQUERY }, + { "noserve", CONF_RES_NOSERVE }, { "notrap", CONF_RES_NOTRAP }, - { "lowpriotrap", CONF_RES_LPTRAP }, + { "notrust", CONF_RES_NOTRUST }, { "ntpport", CONF_RES_NTPPORT }, - { "limited", CONF_RES_LIMITED }, + { "version", CONF_RES_VERSION }, { "", CONFIG_UNKNOWN } }; @@ -266,19 +191,18 @@ static struct keyword trap_keywords[] = { { "", CONFIG_UNKNOWN } }; - /* * "fudge" modifier keywords */ static struct keyword fudge_keywords[] = { - { "time1", CONF_FDG_TIME1 }, - { "time2", CONF_FDG_TIME2 }, - { "stratum", CONF_FDG_STRATUM }, - { "refid", CONF_FDG_REFID }, { "flag1", CONF_FDG_FLAG1 }, { "flag2", CONF_FDG_FLAG2 }, { "flag3", CONF_FDG_FLAG3 }, { "flag4", CONF_FDG_FLAG4 }, + { "refid", CONF_FDG_REFID }, + { "stratum", CONF_FDG_STRATUM }, + { "time1", CONF_FDG_TIME1 }, + { "time2", CONF_FDG_TIME2 }, { "", CONFIG_UNKNOWN } }; @@ -287,12 +211,12 @@ static struct keyword fudge_keywords[] = { * "filegen" modifier keywords */ static struct keyword filegen_keywords[] = { + { "disable", CONF_FGEN_FLAG_DISABLE }, + { "enable", CONF_FGEN_FLAG_ENABLE }, { "file", CONF_FGEN_FILE }, - { "type", CONF_FGEN_TYPE }, { "link", CONF_FGEN_FLAG_LINK }, { "nolink", CONF_FGEN_FLAG_NOLINK }, - { "enable", CONF_FGEN_FLAG_ENABLE }, - { "disable", CONF_FGEN_FLAG_DISABLE }, + { "type", CONF_FGEN_TYPE }, { "", CONFIG_UNKNOWN } }; @@ -300,13 +224,13 @@ static struct keyword filegen_keywords[] = { * "type" modifier keywords */ static struct keyword fgen_types[] = { + { "age", FILEGEN_AGE }, + { "day", FILEGEN_DAY }, + { "month", FILEGEN_MONTH }, { "none", FILEGEN_NONE }, { "pid", FILEGEN_PID }, - { "day", FILEGEN_DAY }, { "week", FILEGEN_WEEK }, - { "month", FILEGEN_MONTH }, { "year", FILEGEN_YEAR }, - { "age", FILEGEN_AGE }, { "", CONFIG_UNKNOWN} }; @@ -316,15 +240,17 @@ static struct keyword fgen_types[] = { static struct keyword flags_keywords[] = { { "auth", PROTO_AUTHENTICATE }, { "bclient", PROTO_BROADCLIENT }, - { "ntp", PROTO_NTP }, { "kernel", PROTO_KERNEL }, { "monitor", PROTO_MONITOR }, + { "ntp", PROTO_NTP }, { "stats", PROTO_FILEGEN }, + { "pps", PROTO_PPS }, + { "calibrate", PROTO_CAL }, { "", CONFIG_UNKNOWN } }; /* - * pps modifier keywords + * "pps" modifier keywords */ static struct keyword pps_keywords[] = { { "assert", CONF_PPS_ASSERT }, @@ -334,6 +260,34 @@ static struct keyword pps_keywords[] = { }; /* + * "tinker" modifier keywords + */ +static struct keyword tinker_keywords[] = { + { "step", CONF_CLOCK_MAX }, + { "panic", CONF_CLOCK_PANIC }, + { "dispersion", CONF_CLOCK_PHI }, + { "stepout", CONF_CLOCK_MINSTEP }, + { "minpoll", CONF_CLOCK_MINPOLL }, + { "allan", CONF_CLOCK_ALLAN }, + { "huffpuff", CONF_CLOCK_HUFFPUFF }, + { "", CONFIG_UNKNOWN } +}; + +#ifdef PUBKEY +/* + * "crypto" modifier keywords + */ +static struct keyword crypto_keywords[] = { + { "dh", CONF_CRYPTO_DH }, + { "flags", CONF_CRYPTO_FLAGS }, + { "leap", CONF_CRYPTO_LEAP }, + { "privatekey", CONF_CRYPTO_PRIVATEKEY }, + { "publickey", CONF_CRYPTO_PUBLICKEY }, + { "", CONFIG_UNKNOWN } +}; +#endif /* PUBKEY */ + +/* * "logconfig" building blocks */ struct masks { @@ -342,10 +296,10 @@ struct masks { }; static struct masks logcfg_class[] = { - { "sys", NLOG_OSYS }, - { "peer", NLOG_OPEER }, { "clock", NLOG_OCLOCK }, + { "peer", NLOG_OPEER }, { "sync", NLOG_OSYNC }, + { "sys", NLOG_OSYS }, { (char *)0, 0 } }; @@ -373,8 +327,7 @@ static struct masks logcfg_item[] = { #define MAXLINE 1024 /* maximum length of line */ #define MAXPHONE 5 /* maximum number of phone strings */ #define MAXPPS 20 /* maximum length of PPS device string */ -#define MAXFILENAME 128 /* maximum length of a file name (alloca()?) */ - +#define MAXINCLUDELEVEL 5 /* maximum include file levels */ /* * Miscellaneous macros @@ -384,6 +337,8 @@ static struct masks logcfg_item[] = { #define ISSPACE(c) ((c) == ' ' || (c) == '\t') #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) +#define KEY_TYPE_MD5 4 + /* * File descriptor used by the resolver save routines, and temporary file * name. @@ -402,15 +357,24 @@ static char res_file[MAX_PATH]; char const *progname; char sys_phone[MAXPHONE][MAXDIAL]; /* ACTS phone numbers */ char pps_device[MAXPPS + 1]; /* PPS device name */ -int pps_assert = 1; +int pps_assert; int pps_hardpps; -int listen_to_virtual_ips = 0; #if defined(HAVE_SCHED_SETSCHEDULER) int config_priority_override = 0; int config_priority; #endif -static const char *ntp_options = "aAbc:dD:f:gk:l:Lmnp:P:r:s:t:v:V:x"; +const char *config_file; +#ifdef HAVE_NETINFO + struct netinfo_config_state *config_netinfo = NULL; + int check_netinfo = 1; +#endif /* HAVE_NETINFO */ +#ifdef SYS_WINNT + char *alt_config_file; + LPTSTR temp; + char config_file_storage[MAX_PATH]; + char alt_config_file_storage[MAX_PATH]; +#endif /* SYS_WINNT */ #ifdef HAVE_NETINFO /* @@ -439,7 +403,8 @@ static int gettokens_netinfo P((struct netinfo_config_state *, char **, int *)); static int gettokens P((FILE *, char *, char **, int *)); static int matchkey P((char *, struct keyword *)); static int getnetnum P((const char *, struct sockaddr_in *, int)); -static void save_resolve P((char *, int, int, int, int, int, int, u_long)); +static void save_resolve P((char *, int, int, int, int, u_int, int, + keyid_t, u_char *)); static void do_resolve_internal P((void)); static void abort_resolve P((void)); #if !defined(VMS) @@ -510,119 +475,6 @@ get_logmask( return 0; } -/* - * getstartup - search through the options looking for a debugging flag - */ -void -getstartup( - int argc, - char *argv[] - ) -{ - int errflg; - int c; - -#ifdef DEBUG - debug = 0; /* no debugging by default */ -#endif - - /* - * This is a big hack. We don't really want to read command line - * configuration until everything else is initialized, since - * the ability to configure the system may depend on storage - * and the like having been initialized. Except that we also - * don't want to initialize anything until after detaching from - * the terminal, but we won't know to do that until we've - * parsed the command line. Do that now, crudely, and do it - * again later. Our ntp_getopt() is explicitly reusable, by the - * way. Your own mileage may vary. - * - * This hack is even called twice (to allow complete logging to file) - */ - errflg = 0; - progname = argv[0]; - - /* - * Decode argument list - */ - while ((c = ntp_getopt(argc, argv, ntp_options)) != EOF) - switch (c) { -#ifdef DEBUG - case 'd': - ++debug; - break; - case 'D': - debug = (int)atol(ntp_optarg); - printf("Debug1: %s -> %x = %d\n", ntp_optarg, debug, debug); - break; -#else - case 'd': - case 'D': - msyslog(LOG_ERR, "ntpd not compiled with -DDEBUG option - no DEBUG support"); - fprintf(stderr, "ntpd not compiled with -DDEBUG option - no DEBUG support"); - ++errflg; - break; -#endif - case 'L': - listen_to_virtual_ips = 1; - break; - case 'l': - { - FILE *new_file; - - new_file = fopen(ntp_optarg, "a"); - if (new_file != NULL) { - NLOG(NLOG_SYSINFO) - msyslog(LOG_NOTICE, "logging to file %s", ntp_optarg); - if (syslog_file != NULL && - fileno(syslog_file) != fileno(new_file)) - (void)fclose(syslog_file); - - syslog_file = new_file; - syslogit = 0; - } - else - msyslog(LOG_ERR, - "Cannot open log file %s", - ntp_optarg); - } - break; - - case 'n': - ++nofork; - break; - - case '?': - ++errflg; - break; - - default: - break; - } - - if (errflg || ntp_optind != argc) { - (void) fprintf(stderr, "usage: %s [ -abdgmnx ] [ -c config_file ] [ -e e_delay ]\n", progname); - (void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n"); - (void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n"); - (void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n"); -#if defined(HAVE_SCHED_SETSCHEDULER) - (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n"); -#endif - exit(2); - } - ntp_optind = 0; /* reset ntp_optind to restart ntp_getopt */ - -#ifdef DEBUG - if (debug) { -#ifdef HAVE_SETVBUF - static char buf[BUFSIZ]; - setvbuf(stdout, buf, _IOLBF, BUFSIZ); -#else - setlinebuf(stdout); -#endif - } -#endif -} /* * getconfig - get command line options and read the configuration file @@ -640,29 +492,23 @@ getconfig( int minpoll; int maxpoll; int ttl; - u_long peerkey; - u_long lpeerkey; - int peerflags; + long stratum; + unsigned long ul; + keyid_t peerkey; + u_char *peerkeystr; + u_long fudgeflag; + u_int peerflags; int hmode; struct sockaddr_in peeraddr; struct sockaddr_in maskaddr; - FILE *fp; + FILE *fp[MAXINCLUDELEVEL+1]; + FILE *includefile; + int includelevel = 0; char line[MAXLINE]; char *(tokens[MAXTOKENS]); int ntokens; int tok = CONFIG_UNKNOWN; struct interface *localaddr; - const char *config_file; -#ifdef HAVE_NETINFO - struct netinfo_config_state *config_netinfo = NULL; - int check_netinfo = 1; -#endif /* HAVE_NETINFO */ -#ifdef SYS_WINNT - char *alt_config_file; - LPTSTR temp; - char config_file_storage[MAX_PATH]; - char alt_config_file_storage[MAX_PATH]; -#endif /* SYS_WINNT */ struct refclockstat clock_stat; FILEGEN *filegen; @@ -670,9 +516,7 @@ getconfig( * Initialize, initialize */ errflg = 0; -#ifdef DEBUG - debug = 0; -#endif /* DEBUG */ + /* HMS: don't initialize debug to 0 here! */ #ifndef SYS_WINNT config_file = CONFIG_FILE; #else @@ -713,146 +557,10 @@ getconfig( */ loop_config(LOOP_DRIFTINIT, 0.); - /* - * Decode argument list - */ - while ((c = ntp_getopt(argc, argv, ntp_options)) != EOF) { - switch (c) { - case 'a': - proto_config(PROTO_AUTHENTICATE, 1, 0.); - break; - - case 'A': - proto_config(PROTO_AUTHENTICATE, 0, 0.); - break; - - case 'b': - proto_config(PROTO_BROADCLIENT, 1, 0.); - break; - - case 'c': - config_file = ntp_optarg; -#ifdef HAVE_NETINFO - check_netinfo = 0; -#endif - break; - - case 'd': -#ifdef DEBUG - debug++; -#else - errflg++; -#endif /* DEBUG */ - break; - - case 'D': -#ifdef DEBUG - debug = (int)atol(ntp_optarg); - printf("Debug2: %s -> %x = %d\n", ntp_optarg, debug, debug); -#else - errflg++; -#endif /* DEBUG */ - break; - - case 'f': - stats_config(STATS_FREQ_FILE, ntp_optarg); - break; - - case 'g': - correct_any = TRUE; - break; - - case 'k': - getauthkeys(ntp_optarg); - break; - - case 'L': /* already done at pre-scan */ - case 'l': /* already done at pre-scan */ - break; - - case 'm': - proto_config(PROTO_MULTICAST_ADD, htonl(INADDR_NTP), 0.); - sys_bclient = 1; - break; - - case 'n': /* already done at pre-scan */ - break; - - case 'p': - stats_config(STATS_PID_FILE, ntp_optarg); - break; - - case 'P': -#if defined(HAVE_SCHED_SETSCHEDULER) - config_priority = (int)atol(ntp_optarg); - config_priority_override = 1; -#else - errflg++; -#endif - break; - - case 'r': - do { - double tmp; - - if (sscanf(ntp_optarg, "%lf", &tmp) != 1) { - msyslog(LOG_ERR, - "command line broadcast delay value %s undecodable", - ntp_optarg); - } else { - proto_config(PROTO_BROADDELAY, 0, tmp); - } - } while (0); - break; - - case 's': - stats_config(STATS_STATSDIR, ntp_optarg); - break; - - case 't': - do { - u_long tkey; - - tkey = (int)atol(ntp_optarg); - if (tkey <= 0 || tkey > NTP_MAXKEY) { - msyslog(LOG_ERR, - "command line trusted key %s is invalid", - ntp_optarg); - } else { - authtrust(tkey, 1); - } - } while (0); - break; - - case 'v': - case 'V': - set_sys_var(ntp_optarg, strlen(ntp_optarg)+1, - RW | ((c == 'V') ? DEF : 0)); - break; - - case 'x': - allow_set_backward = FALSE; - break; - - default: - errflg++; - break; - } - } - - if (errflg || ntp_optind != argc) { - (void) fprintf(stderr, "usage: %s [ -abdgmnx ] [ -c config_file ] [ -e e_delay ]\n", progname); - (void) fprintf(stderr, "\t\t[ -f freq_file ] [ -k key_file ] [ -l log_file ]\n"); - (void) fprintf(stderr, "\t\t[ -p pid_file ] [ -r broad_delay ] [ -s statdir ]\n"); - (void) fprintf(stderr, "\t\t[ -t trust_key ] [ -v sys_var ] [ -V default_sysvar ]\n"); -#if defined(HAVE_SCHED_SETSCHEDULER) - (void) fprintf(stderr, "\t\t[ -P fixed_process_priority ]\n"); -#endif - exit(2); - } + getCmdOpts(argc, argv); if ( - (fp = fopen(FindConfig(config_file), "r")) == NULL + (fp[0] = fopen(FindConfig(config_file), "r")) == NULL #ifdef HAVE_NETINFO /* If there is no config_file, try NetInfo. */ && check_netinfo && !(config_netinfo = get_netinfo_config()) @@ -863,7 +571,7 @@ getconfig( #ifdef SYS_WINNT /* Under WinNT try alternate_config_file name, first NTP.CONF, then NTP.INI */ - if ((fp = fopen(FindConfig(alt_config_file), "r")) == NULL) { + if ((fp[0] = fopen(FindConfig(alt_config_file), "r")) == NULL) { /* * Broadcast clients can sometimes run without @@ -880,14 +588,21 @@ getconfig( } for (;;) { - if (fp) - tok = gettokens(fp, line, tokens, &ntokens); + if (fp[includelevel]) + tok = gettokens(fp[includelevel], line, tokens, &ntokens); #ifdef HAVE_NETINFO else tok = gettokens_netinfo(config_netinfo, tokens, &ntokens); #endif /* HAVE_NETINFO */ - if (tok == CONFIG_UNKNOWN) break; + if (tok == CONFIG_UNKNOWN) { + if (includelevel > 0) { + fclose(fp[includelevel--]); + continue; + } else { + break; + } + } switch(tok) { case CONFIG_PEER: @@ -954,6 +669,7 @@ getconfig( minpoll = NTP_MINDPOLL; maxpoll = NTP_MAXDPOLL; peerkey = 0; + peerkeystr = "*"; peerflags = 0; ttl = 0; for (i = 2; i < ntokens; i++) @@ -994,8 +710,12 @@ getconfig( break; } minpoll = atoi(tokens[++i]); - if (minpoll < NTP_MINPOLL) + if (minpoll < NTP_MINPOLL) { + msyslog(LOG_INFO, + "minpoll: provided value (%d) is below minimum (%d)", + minpoll, NTP_MINPOLL); minpoll = NTP_MINPOLL; + } break; case CONF_MOD_MAXPOLL: @@ -1007,8 +727,12 @@ getconfig( break; } maxpoll = atoi(tokens[++i]); - if (maxpoll > NTP_MAXPOLL) + if (maxpoll > NTP_MAXPOLL) { + msyslog(LOG_INFO, + "maxpoll: provided value (%d) is above maximum (%d)", + maxpoll, NTP_MAXPOLL); maxpoll = NTP_MAXPOLL; + } break; case CONF_MOD_PREFER: @@ -1023,10 +747,30 @@ getconfig( peerflags |= FLAG_BURST; break; + case CONF_MOD_IBURST: + peerflags |= FLAG_IBURST; + break; +#ifdef AUTOKEY case CONF_MOD_SKEY: - peerflags |= FLAG_SKEY | FLAG_AUTHENABLE; + peerflags |= FLAG_SKEY | + FLAG_AUTHENABLE; break; +#ifdef PUBKEY + case CONF_MOD_PUBLICKEY: + if (i >= ntokens - 1) { + msyslog(LOG_ERR, + "Public key file name required"); + errflg = 1; + break; + } + peerflags |= FLAG_SKEY | + FLAG_AUTHENABLE; + peerkeystr = tokens[++i]; + break; +#endif /* PUBKEY */ +#endif /* AUTOKEY */ + case CONF_MOD_TTL: if (i >= ntokens-1) { msyslog(LOG_ERR, @@ -1056,19 +800,18 @@ getconfig( errflg = 1; } if (errflg == 0) { - if (peer_config(&peeraddr, - (struct interface *)0, hmode, - peerversion, minpoll, maxpoll, - peerflags, ttl, peerkey) - == 0) { + if (peer_config(&peeraddr, any_interface, hmode, + peerversion, minpoll, maxpoll, peerflags, + ttl, peerkey, peerkeystr) == 0) { msyslog(LOG_ERR, "configuration of %s failed", ntoa(&peeraddr)); - } + } + } else if (errflg == -1) { save_resolve(tokens[1], hmode, peerversion, - minpoll, maxpoll, peerflags, ttl, - peerkey); + minpoll, maxpoll, peerflags, ttl, + peerkey, peerkeystr); } break; @@ -1086,9 +829,29 @@ getconfig( stats_config(STATS_PID_FILE, (char *)0); break; + case CONFIG_INCLUDEFILE: + if (ntokens < 2) { + msyslog(LOG_ERR, "includefile needs one argument"); + break; + } + if (includelevel >= MAXINCLUDELEVEL) { + fprintf(stderr, "getconfig: Maximum include file level exceeded.\n"); + msyslog(LOG_INFO, "getconfig: Maximum include file level exceeded."); + break; + } + includefile = fopen(FindConfig(tokens[1]), "r"); + if (includefile == NULL) { + fprintf(stderr, "getconfig: Couldn't open <%s>\n", FindConfig(tokens[1])); + msyslog(LOG_INFO, "getconfig: Couldn't open <%s>", FindConfig(tokens[1])); + break; + } + fp[++includelevel] = includefile; + break; + case CONFIG_LOGFILE: if (ntokens >= 2) { FILE *new_file; + new_file = fopen(tokens[1], "a"); if (new_file != NULL) { NLOG(NLOG_SYSINFO) /* conditional if clause for conditional syslog */ @@ -1159,20 +922,10 @@ getconfig( } else proto_config(PROTO_MULTICAST_ADD, htonl(INADDR_NTP), 0.); - if (tok == CONFIG_MULTICASTCLIENT) { + if (tok == CONFIG_MULTICASTCLIENT) sys_bclient = 1; -#ifdef DEBUG - if (debug) - printf("sys_bclient\n"); -#endif /* DEBUG */ - } - else if (tok == CONFIG_MANYCASTSERVER) { + else if (tok == CONFIG_MANYCASTSERVER) sys_manycastserver = 1; -#ifdef DEBUG - if (debug) - printf("sys_manycastserver\n"); -#endif /* DEBUG */ - } break; case CONFIG_AUTHENTICATE: @@ -1199,17 +952,121 @@ getconfig( } break; - case CONFIG_REVOKE: - if (ntokens >= 2) { - sys_revoke = 1 << max(atoi(tokens[1]), 10); + case CONFIG_TINKER: + for (i = 1; i < ntokens; i++) { + int temp; + double ftemp; + + temp = matchkey(tokens[i++], + tinker_keywords); + if (i > ntokens - 1) { + msyslog(LOG_ERR, + "tinker: missing argument"); + errflg++; + break; + } + sscanf(tokens[i], "%lf", &ftemp); + switch(temp) { + case CONF_CLOCK_MAX: + loop_config(LOOP_MAX, ftemp); + break; + + case CONF_CLOCK_PANIC: + loop_config(LOOP_PANIC, ftemp); + break; + + case CONF_CLOCK_PHI: + loop_config(LOOP_PHI, ftemp); + break; + + case CONF_CLOCK_MINSTEP: + loop_config(LOOP_MINSTEP, ftemp); + break; + + case CONF_CLOCK_MINPOLL: + loop_config(LOOP_MINPOLL, ftemp); + break; + + case CONF_CLOCK_ALLAN: + loop_config(LOOP_ALLAN, ftemp); + break; + + case CONF_CLOCK_HUFFPUFF: + loop_config(LOOP_HUFFPUFF, ftemp); + break; + } } break; +#ifdef AUTOKEY + case CONFIG_REVOKE: + if (ntokens >= 2) + sys_revoke = 1 << max(atoi(tokens[1]), 10); + break; + case CONFIG_AUTOMAX: - if (ntokens >= 2) { - sys_automax = 1 << max(atoi(tokens[1]), 10); + if (ntokens >= 2) + sys_automax = 1 << max(atoi(tokens[1]), 10); + break; + +#ifdef PUBKEY + case CONFIG_KEYSDIR: + if (ntokens < 2) { + msyslog(LOG_ERR, + "Keys directory name required"); + break; + } + crypto_config(CRYPTO_CONF_KEYS, tokens[1]); + break; + + case CONFIG_CRYPTO: + if (ntokens == 1) { + crypto_config(CRYPTO_CONF_FLAGS , "0"); + break; + } + for (i = 1; i < ntokens; i++) { + int temp; + + temp = matchkey(tokens[i++], crypto_keywords); + if (i > ntokens - 1) { + msyslog(LOG_ERR, + "crypto: missing argument"); + errflg++; + break; + } + switch(temp) { + case CONF_CRYPTO_FLAGS: + crypto_config(CRYPTO_CONF_FLAGS, tokens[i]); + break; + + case CONF_CRYPTO_LEAP: + crypto_config(CRYPTO_CONF_LEAP, tokens[i]); + break; + + case CONF_CRYPTO_DH: + crypto_config(CRYPTO_CONF_DH, tokens[i]); + break; + + case CONF_CRYPTO_PRIVATEKEY: + crypto_config(CRYPTO_CONF_PRIV, tokens[i]); + break; + + case CONF_CRYPTO_PUBLICKEY: + crypto_config(CRYPTO_CONF_PUBL, tokens[i]); + break; + + case CONF_CRYPTO_CERT: + crypto_config(CRYPTO_CONF_CERT, tokens[i]); + break; + + default: + msyslog(LOG_ERR, "crypto: unknown keyword"); + break; + } } break; +#endif /* PUBKEY */ +#endif /* AUTOKEY */ case CONFIG_RESTRICT: if (ntokens < 2) { @@ -1278,6 +1135,14 @@ getconfig( peerkey |= RESM_NTPONLY; break; + case CONF_RES_VERSION: + peerversion |= RES_VERSION; + break; + + case CONF_RES_DEMOBILIZE: + peerversion |= RES_DEMOBILIZE; + break; + case CONF_RES_LIMITED: peerversion |= RES_LIMITED; break; @@ -1310,7 +1175,7 @@ getconfig( case CONFIG_TRUSTEDKEY: for (i = 1; i < ntokens; i++) { - u_long tkey; + keyid_t tkey; tkey = atol(tokens[i]); if (tkey == 0) { @@ -1325,13 +1190,11 @@ getconfig( case CONFIG_REQUESTKEY: if (ntokens >= 2) { - u_long rkey; - - if (!atouint(tokens[1], &rkey)) { + if (!atouint(tokens[1], &ul)) { msyslog(LOG_ERR, "%s is undecodable as request key", tokens[1]); - } else if (rkey == 0) { + } else if (ul == 0) { msyslog(LOG_ERR, "%s makes a poor request keyid", tokens[1]); @@ -1339,16 +1202,16 @@ getconfig( #ifdef DEBUG if (debug > 3) printf( - "set info_auth_key to %lu\n", rkey); + "set info_auth_key to %08lx\n", ul); #endif - info_auth_keyid = rkey; + info_auth_keyid = (keyid_t)ul; } } break; case CONFIG_CONTROLKEY: if (ntokens >= 2) { - u_long ckey; + keyid_t ckey; ckey = atol(tokens[1]); if (ckey == 0) { @@ -1455,6 +1318,7 @@ getconfig( } memset((void *)&clock_stat, 0, sizeof clock_stat); + fudgeflag = 0; errflg = 0; for (i = 2; i < ntokens-1; i++) { switch (c = matchkey(tokens[i], @@ -1485,9 +1349,7 @@ getconfig( case CONF_FDG_STRATUM: - /* HMS: the (long *)_ may be trouble */ - if (!atoint(tokens[++i], - (long *)&clock_stat.fudgeval1)) + if (!atoint(tokens[++i], &stratum)) { msyslog(LOG_ERR, "fudge %s stratum value in error", @@ -1495,6 +1357,7 @@ getconfig( errflg = i; break; } + clock_stat.fudgeval1 = stratum; clock_stat.haveflags |= CLK_HAVEVAL1; break; @@ -1510,16 +1373,14 @@ getconfig( case CONF_FDG_FLAG2: case CONF_FDG_FLAG3: case CONF_FDG_FLAG4: - if (!atouint(tokens[++i], &lpeerkey) - || lpeerkey > 1) { + if (!atouint(tokens[++i], &fudgeflag) + || fudgeflag > 1) { msyslog(LOG_ERR, "fudge %s flag value in error", ntoa(&peeraddr)); - peerkey = lpeerkey; errflg = i; break; } - peerkey = lpeerkey; switch(c) { case CONF_FDG_FLAG1: c = CLK_FLAG1; @@ -1538,7 +1399,7 @@ getconfig( clock_stat.haveflags|=CLK_HAVEFLAG4; break; } - if (peerkey == 0) + if (fudgeflag == 0) clock_stat.flags &= ~c; else clock_stat.flags |= c; @@ -1558,15 +1419,14 @@ getconfig( */ if (!errflg) { refclock_control(&peeraddr, &clock_stat, - (struct refclockstat *)0); + (struct refclockstat *)0); } #endif break; case CONFIG_STATSDIR: - if (ntokens >= 2) { + if (ntokens >= 2) stats_config(STATS_STATSDIR,tokens[1]); - } break; case CONFIG_STATISTICS: @@ -1659,10 +1519,9 @@ getconfig( break; } } - if (!errflg) { + if (!errflg) filegen_config(filegen, tokens[peerversion], - (u_char)peerkey, (u_char)peerflags); - } + (u_char)peerkey, (u_char)peerflags); break; case CONFIG_SETVAR: @@ -1776,10 +1635,10 @@ getconfig( flag = matchkey(tokens[i], pps_keywords); switch(flag) { case CONF_PPS_ASSERT: - pps_assert = 1; + pps_assert = 0; break; case CONF_PPS_CLEAR: - pps_assert = 0; + pps_assert = 1; break; case CONF_PPS_HARDPPS: pps_hardpps = 1; @@ -1797,11 +1656,44 @@ getconfig( break; } } - if (fp) (void)fclose(fp); + if (fp[0]) + (void)fclose(fp[0]); + #ifdef HAVE_NETINFO - if (config_netinfo) free_netinfo_config(config_netinfo); + if (config_netinfo) + free_netinfo_config(config_netinfo); #endif /* HAVE_NETINFO */ +#if !defined(VMS) && !defined(SYS_VXWORKS) + /* find a keyid */ + if (info_auth_keyid == 0) + req_keyid = 65535; + else + req_keyid = info_auth_keyid; + + /* if doesn't exist, make up one at random */ + if (!authhavekey(req_keyid)) { + char rankey[9]; + int j; + + for (i = 0; i < 8; i++) + for (j = 1; j < 100; ++j) { + rankey[i] = RANDOM & 0xff; + if (rankey[i] != 0) break; + } + rankey[8] = 0; + authusekey(req_keyid, KEY_TYPE_MD5, (u_char *)rankey); + authtrust(req_keyid, 1); + if (!authhavekey(req_keyid)) { + msyslog(LOG_ERR, "getconfig: Couldn't generate a valid random key!"); + /* HMS: Should this be fatal? */ + } + } + + /* save keyid so we will accept config requests with it */ + info_auth_keyid = req_keyid; +#endif /* !defined(VMS) && !defined(SYS_VXWORKS) */ + if (res_fp != NULL) { /* * Need name resolution @@ -2165,9 +2057,10 @@ save_resolve( int version, int minpoll, int maxpoll, - int flags, + u_int flags, int ttl, - u_long keyid + keyid_t keyid, + u_char *keystr ) { #ifndef SYS_VXWORKS @@ -2191,7 +2084,7 @@ save_resolve( res_fp = NULL; if ((fd = mkstemp(res_file)) != -1) - res_fp = fdopen(fd, "w"); + res_fp = fdopen(fd, "r+"); } #else (void) mktemp(res_file); @@ -2208,8 +2101,14 @@ save_resolve( } #endif - (void) fprintf(res_fp, "%s %d %d %d %d %d %d %lu\n", name, mode, - version, minpoll, maxpoll, flags, ttl, keyid); + (void)fprintf(res_fp, "%s %d %d %d %d %d %d %d %s\n", name, + mode, version, minpoll, maxpoll, flags, ttl, keyid, keystr); +#ifdef DEBUG + if (debug > 1) + printf("config: %s %d %d %d %d %x %d %08x %s\n", name, mode, + version, minpoll, maxpoll, flags, ttl, keyid, keystr); +#endif + #else /* SYS_VXWORKS */ /* save resolve info to a struct */ #endif /* SYS_VXWORKS */ @@ -2242,8 +2141,6 @@ abort_resolve(void) } -#define KEY_TYPE_MD5 4 - /* * do_resolve_internal - start up the resolver function (not program) */ @@ -2262,7 +2159,7 @@ do_resolve_internal(void) if (res_fp == NULL) { /* belch */ msyslog(LOG_ERR, - "internal error in do_resolve_internal: res_fp == NULL"); + "do_resolve_internal: Fatal: res_fp == NULL"); exit(1); } @@ -2271,24 +2168,6 @@ do_resolve_internal(void) res_fp = NULL; #if !defined(VMS) && !defined (SYS_VXWORKS) - /* find a keyid */ - if (info_auth_keyid == 0) - req_keyid = 65535; - else - req_keyid = info_auth_keyid; - - /* if doesn't exist, make up one at random */ - if (!authhavekey(req_keyid)) { - char rankey[8]; - - for (i = 0; i < 8; i++) - rankey[i] = RANDOM & 0xff; - authusekey(req_keyid, KEY_TYPE_MD5, (u_char *)rankey); - authtrust(req_keyid, 1); - } - - /* save keyid so we will accept config requests with it */ - info_auth_keyid = req_keyid; req_file = res_file; /* set up pointer to res file */ #ifndef SYS_WINNT (void) signal_no_reset(SIGCHLD, catchchild); @@ -2317,10 +2196,10 @@ do_resolve_internal(void) * async io information causes it to process requests from * all file decriptor causing a race between the NTP daemon * and the resolver. which then eats data when it wins 8-(. - * It is absolutly necessary to kill ane io associations - * shared with the NTP daemon. I currently don't want + * It is absolutly necessary to kill any IO associations + * shared with the NTP daemon. * - * we also block SIGIO (currently no portes means to + * We also block SIGIO (currently no ports means to * disable the signal handle for IO). * * Thanks to wgstuken@informatik.uni-erlangen.de to notice diff --git a/contrib/ntp/ntpd/ntp_control.c b/contrib/ntp/ntpd/ntp_control.c index e2fb039..570e2f9 100644 --- a/contrib/ntp/ntpd/ntp_control.c +++ b/contrib/ntp/ntpd/ntp_control.c @@ -5,18 +5,23 @@ #include <config.h> #endif -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <signal.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_control.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> +#include <signal.h> + +#include <netinet/in.h> +#include <arpa/inet.h> + +#ifdef PUBKEY +#include "ntp_crypto.h" +#endif /* PUBKEY */ + /* * Structure to hold request procedure information */ @@ -26,9 +31,9 @@ #define NO_REQUEST (-1) struct ctl_proc { - short control_code; /* defined request code */ - u_short flags; /* flags word */ - void (*handler) P((struct recvbuf *, int)); /* routine to handle request */ + short control_code; /* defined request code */ + u_short flags; /* flags word */ + void (*handler) P((struct recvbuf *, int)); /* handle request */ }; /* @@ -44,9 +49,10 @@ static void ctl_error P((int)); static u_short ctlclkstatus P((struct refclockstat *)); static void ctl_flushpkt P((int)); static void ctl_putdata P((const char *, unsigned int, int)); -static void ctl_putstr P((const char *, const char *, unsigned int)); +static void ctl_putstr P((const char *, const char *, + unsigned int)); static void ctl_putdbl P((const char *, double)); -static void ctl_putuint P((const char *, u_long)); +static void ctl_putuint P((const char *, u_long)); static void ctl_puthex P((const char *, u_long)); static void ctl_putint P((const char *, long)); static void ctl_putts P((const char *, l_fp *)); @@ -54,21 +60,22 @@ static void ctl_putadr P((const char *, u_int32)); static void ctl_putid P((const char *, char *)); static void ctl_putarray P((const char *, double *, int)); static void ctl_putsys P((int)); -static void ctl_putpeer P((int, struct peer *)); +static void ctl_putpeer P((int, struct peer *)); #ifdef REFCLOCK static void ctl_putclock P((int, struct refclockstat *, int)); #endif /* REFCLOCK */ static struct ctl_var *ctl_getitem P((struct ctl_var *, char **)); -static u_long count_var P((struct ctl_var *)); +static u_long count_var P((struct ctl_var *)); static void control_unspec P((struct recvbuf *, int)); -static void read_status P((struct recvbuf *, int)); +static void read_status P((struct recvbuf *, int)); static void read_variables P((struct recvbuf *, int)); static void write_variables P((struct recvbuf *, int)); -static void read_clock_status P((struct recvbuf *, int)); -static void write_clock_status P((struct recvbuf *, int)); +static void read_clock_status P((struct recvbuf *, int)); +static void write_clock_status P((struct recvbuf *, int)); static void set_trap P((struct recvbuf *, int)); static void unset_trap P((struct recvbuf *, int)); -static struct ctl_trap *ctlfindtrap P((struct sockaddr_in *, struct interface *)); +static struct ctl_trap *ctlfindtrap P((struct sockaddr_in *, + struct interface *)); static struct ctl_proc control_codes[] = { { CTL_OP_UNSPEC, NOAUTH, control_unspec }, @@ -83,10 +90,10 @@ static struct ctl_proc control_codes[] = { }; /* - * System variable values. The array can be indexed by - * the variable index to find the textual name. + * System variable values. The array can be indexed by the variable + * index to find the textual name. */ -static struct ctl_var sys_var[] = { +static struct ctl_var sys_var[] = { { 0, PADDING, "" }, /* 0 */ { CS_LEAP, RW, "leap" }, /* 1 */ { CS_STRATUM, RO, "stratum" }, /* 2 */ @@ -98,23 +105,36 @@ static struct ctl_var sys_var[] = { { CS_POLL, RO, "poll" }, /* 8 */ { CS_PEERID, RO, "peer" }, /* 9 */ { CS_STATE, RO, "state" }, /* 10 */ - { CS_OFFSET, RO, "phase" }, /* 11 */ + { CS_OFFSET, RO, "offset" }, /* 11 */ { CS_DRIFT, RO, "frequency" }, /* 12 */ - { CS_COMPLIANCE, RO, "jitter" }, /* 13 */ + { CS_JITTER, RO, "jitter" }, /* 13 */ { CS_CLOCK, RO, "clock" }, /* 14 */ { CS_PROCESSOR, RO, "processor" }, /* 15 */ { CS_SYSTEM, RO, "system" }, /* 16 */ - { CS_STABIL, RO, "stability" }, /* 17 */ - { CS_VARLIST, RO, "sys_var_list" }, /* 18 */ - { 0, EOV, "" } + { CS_VERSION, RO, "version" }, /* 17 */ + { CS_STABIL, RO, "stability" }, /* 18 */ + { CS_VARLIST, RO, "sys_var_list" }, /* 19 */ +#ifdef PUBKEY + { CS_FLAGS, RO, "flags" }, /* 20 */ + { CS_HOST, RO, "hostname" }, /* 21 */ + { CS_PUBLIC, RO, "publickey" }, /* 22 */ + { CS_CERTIF, RO, "certificate" }, /* 23 */ + { CS_DHPARAMS, RO, "params" }, /* 24 */ + { CS_REVTIME, RO, "refresh" }, /* 25 */ + { CS_LEAPTAB, RO, "leapseconds" }, /* 26 */ + { CS_TAI, RO, "tai"}, /* 27 */ +#endif /* PUBKEY */ + { 0, EOV, "" } /* 28 */ }; -static struct ctl_var *ext_sys_var = (struct ctl_var *)0; +static struct ctl_var *ext_sys_var = (struct ctl_var *)0; /* - * System variables we print by default (in fuzzball order, more-or-less) + * System variables we print by default (in fuzzball order, + * more-or-less) */ static u_char def_sys_var[] = { + CS_VERSION, CS_PROCESSOR, CS_SYSTEM, CS_LEAP, @@ -130,8 +150,16 @@ static u_char def_sys_var[] = { CS_STATE, CS_OFFSET, CS_DRIFT, - CS_COMPLIANCE, + CS_JITTER, CS_STABIL, +#ifdef PUBKEY + CS_FLAGS, + CS_HOST, + CS_CERTIF, + CS_DHPARAMS, + CS_REVTIME, + CS_LEAPTAB, +#endif /* PUBKEY */ 0 }; @@ -139,82 +167,103 @@ static u_char def_sys_var[] = { /* * Peer variable list */ -static struct ctl_var peer_var[] = { - { 0, PADDING, "" }, /* 0 */ - { CP_CONFIG, RO, "config" }, /* 1 */ - { CP_AUTHENABLE, RO, "authenable" }, /* 2 */ - { CP_AUTHENTIC, RO, "authentic" }, /* 3 */ - { CP_SRCADR, RO, "srcadr" }, /* 4 */ - { CP_SRCPORT, RO, "srcport" }, /* 5 */ - { CP_DSTADR, RO, "dstadr" }, /* 6 */ - { CP_DSTPORT, RO, "dstport" }, /* 7 */ - { CP_LEAP, RO, "leap" }, /* 8 */ - { CP_HMODE, RO, "hmode" }, /* 9 */ - { CP_STRATUM, RO, "stratum" }, /* 10 */ - { CP_PPOLL, RO, "ppoll" }, /* 11 */ - { CP_HPOLL, RO, "hpoll" }, /* 12 */ - { CP_PRECISION, RO, "precision" }, /* 13 */ - { CP_ROOTDELAY, RO, "rootdelay" }, /* 14 */ +static struct ctl_var peer_var[] = { + { 0, PADDING, "" }, /* 0 */ + { CP_CONFIG, RO, "config" }, /* 1 */ + { CP_AUTHENABLE, RO, "authenable" }, /* 2 */ + { CP_AUTHENTIC, RO, "authentic" }, /* 3 */ + { CP_SRCADR, RO, "srcadr" }, /* 4 */ + { CP_SRCPORT, RO, "srcport" }, /* 5 */ + { CP_DSTADR, RO, "dstadr" }, /* 6 */ + { CP_DSTPORT, RO, "dstport" }, /* 7 */ + { CP_LEAP, RO, "leap" }, /* 8 */ + { CP_HMODE, RO, "hmode" }, /* 9 */ + { CP_STRATUM, RO, "stratum" }, /* 10 */ + { CP_PPOLL, RO, "ppoll" }, /* 11 */ + { CP_HPOLL, RO, "hpoll" }, /* 12 */ + { CP_PRECISION, RO, "precision" }, /* 13 */ + { CP_ROOTDELAY, RO, "rootdelay" }, /* 14 */ { CP_ROOTDISPERSION, RO, "rootdispersion" }, /* 15 */ - { CP_REFID, RO, "refid" }, /* 16 */ - { CP_REFTIME, RO, "reftime" }, /* 17 */ - { CP_ORG, RO, "org" }, /* 18 */ - { CP_REC, RO, "rec" }, /* 19 */ - { CP_XMT, RO, "xmt" }, /* 20 */ - { CP_REACH, RO, "reach" }, /* 21 */ - { CP_VALID, RO, "valid" }, /* 22 */ - { CP_TIMER, RO, "timer" }, /* 23 */ - { CP_DELAY, RO, "delay" }, /* 24 */ - { CP_OFFSET, RO, "offset" }, /* 25 */ - { CP_JITTER, RO, "jitter" }, /* 26 */ - { CP_DISPERSION,RO, "dispersion" }, /* 27 */ - { CP_KEYID, RO, "keyid" }, /* 28 */ - { CP_FILTDELAY, RO, "filtdelay=" }, /* 29 */ - { CP_FILTOFFSET, RO, "filtoffset=" }, /* 30 */ - { CP_PMODE, RO, "pmode" }, /* 31 */ - { CP_RECEIVED, RO, "received"}, /* 32 */ - { CP_SENT, RO, "sent" }, /* 33 */ - { CP_FILTERROR, RO, "filtdisp=" }, /* 34 */ - { CP_FLASH, RO, "flash" }, /* 35 */ - { CP_DISP, PADDING,"" }, /* 36 */ - { CP_VARLIST, RO, "peer_var_list" }, /* 37 */ - { 0, EOV, "" } + { CP_REFID, RO, "refid" }, /* 16 */ + { CP_REFTIME, RO, "reftime" }, /* 17 */ + { CP_ORG, RO, "org" }, /* 18 */ + { CP_REC, RO, "rec" }, /* 19 */ + { CP_XMT, RO, "xmt" }, /* 20 */ + { CP_REACH, RO, "reach" }, /* 21 */ + { CP_VALID, RO, "unreach" }, /* 22 */ + { CP_TIMER, RO, "timer" }, /* 23 */ + { CP_DELAY, RO, "delay" }, /* 24 */ + { CP_OFFSET, RO, "offset" }, /* 25 */ + { CP_JITTER, RO, "jitter" }, /* 26 */ + { CP_DISPERSION, RO, "dispersion" }, /* 27 */ + { CP_KEYID, RO, "keyid" }, /* 28 */ + { CP_FILTDELAY, RO, "filtdelay=" }, /* 29 */ + { CP_FILTOFFSET, RO, "filtoffset=" }, /* 30 */ + { CP_PMODE, RO, "pmode" }, /* 31 */ + { CP_RECEIVED, RO, "received"}, /* 32 */ + { CP_SENT, RO, "sent" }, /* 33 */ + { CP_FILTERROR, RO, "filtdisp=" }, /* 34 */ + { CP_FLASH, RO, "flash" }, /* 35 */ + { CP_TTL, RO, "ttl" }, /* 36 */ + { CP_TTLMAX, RO, "ttlmax" }, /* 37 */ + { CP_VARLIST, RO, "peer_var_list" }, /* 38 */ +#ifdef PUBKEY + { CP_FLAGS, RO, "flags" }, /* 38 */ + { CP_HOST, RO, "hostname" }, /* 39 */ + { CP_PUBLIC, RO, "publickey" }, /* 40 */ + { CP_CERTIF, RO, "certificate" }, /* 41 */ + { CP_SESKEY, RO, "pcookie" }, /* 42 */ + { CP_SASKEY, RO, "hcookie" }, /* 43 */ + { CP_INITSEQ, RO, "initsequence" }, /* 44 */ + { CP_INITKEY, RO, "initkey" }, /* 45 */ + { CP_INITTSP, RO, "timestamp" }, /* 46 */ +#endif /* PUBKEY */ + { 0, EOV, "" } /* 47 */ }; /* * Peer variables we print by default */ -static u_char def_peer_var[] = { +static u_char def_peer_var[] = { CP_SRCADR, CP_SRCPORT, CP_DSTADR, CP_DSTPORT, - CP_KEYID, + CP_LEAP, CP_STRATUM, CP_PRECISION, CP_ROOTDELAY, CP_ROOTDISPERSION, CP_REFID, - CP_REFTIME, - CP_DELAY, - CP_OFFSET, - CP_JITTER, - CP_DISPERSION, CP_REACH, CP_VALID, CP_HMODE, CP_PMODE, CP_HPOLL, CP_PPOLL, - CP_LEAP, CP_FLASH, + CP_KEYID, + CP_TTL, + CP_TTLMAX, + CP_OFFSET, + CP_DELAY, + CP_DISPERSION, + CP_JITTER, + CP_REFTIME, CP_ORG, CP_REC, CP_XMT, CP_FILTDELAY, CP_FILTOFFSET, CP_FILTERROR, +#ifdef PUBKEY + CP_FLAGS, + CP_HOST, + CP_CERTIF, + CP_SESKEY, + CP_INITSEQ, +#endif /* PUBKEY */ 0 }; @@ -223,31 +272,31 @@ static u_char def_peer_var[] = { /* * Clock variable list */ -static struct ctl_var clock_var[] = { - { 0, PADDING, "" }, /* 0 */ - { CC_TYPE, RO, "type" }, /* 1 */ - { CC_TIMECODE, RO, "timecode" }, /* 2 */ - { CC_POLL, RO, "poll" }, /* 3 */ - { CC_NOREPLY, RO, "noreply" }, /* 4 */ - { CC_BADFORMAT, RO, "badformat" }, /* 5 */ - { CC_BADDATA, RO, "baddata" }, /* 6 */ - { CC_FUDGETIME1, RO, "fudgetime1" }, /* 7 */ - { CC_FUDGETIME2, RO, "fudgetime2" }, /* 8 */ - { CC_FUDGEVAL1, RO, "stratum" }, /* 9 */ - { CC_FUDGEVAL2, RO, "refid" }, /* 10 */ - { CC_FLAGS, RO, "flags" }, /* 11 */ - { CC_DEVICE, RO, "device" }, /* 12 */ - { CC_VARLIST, RO, "clock_var_list" },/* 13 */ - { 0, EOV, "" } +static struct ctl_var clock_var[] = { + { 0, PADDING, "" }, /* 0 */ + { CC_TYPE, RO, "type" }, /* 1 */ + { CC_TIMECODE, RO, "timecode" }, /* 2 */ + { CC_POLL, RO, "poll" }, /* 3 */ + { CC_NOREPLY, RO, "noreply" }, /* 4 */ + { CC_BADFORMAT, RO, "badformat" }, /* 5 */ + { CC_BADDATA, RO, "baddata" }, /* 6 */ + { CC_FUDGETIME1, RO, "fudgetime1" }, /* 7 */ + { CC_FUDGETIME2, RO, "fudgetime2" }, /* 8 */ + { CC_FUDGEVAL1, RO, "stratum" }, /* 9 */ + { CC_FUDGEVAL2, RO, "refid" }, /* 10 */ + { CC_FLAGS, RO, "flags" }, /* 11 */ + { CC_DEVICE, RO, "device" }, /* 12 */ + { CC_VARLIST, RO, "clock_var_list" }, /* 13 */ + { 0, EOV, "" } /* 14 */ }; /* * Clock variables printed by default */ -static u_char def_clock_var[] = { +static u_char def_clock_var[] = { CC_DEVICE, - CC_TYPE, /* won't be output if device= known */ + CC_TYPE, /* won't be output if device = known */ CC_TIMECODE, CC_POLL, CC_NOREPLY, @@ -264,14 +313,14 @@ static u_char def_clock_var[] = { /* - * System and processor definitions. These will change for the gizmo board. + * System and processor definitions. */ #ifndef HAVE_UNAME # ifndef STR_SYSTEM -# define STR_SYSTEM "UNIX" +# define STR_SYSTEM "UNIX" # endif # ifndef STR_PROCESSOR -# define STR_PROCESSOR "unknown" +# define STR_PROCESSOR "unknown" # endif static char str_system[] = STR_SYSTEM; @@ -282,10 +331,10 @@ static struct utsname utsnamebuf; #endif /* HAVE_UNAME */ /* - * Trap structures. We only allow a few of these, and send - * a copy of each async message to each live one. Traps time - * out after an hour, it is up to the trap receipient to - * keep resetting it to avoid being timed out. + * Trap structures. We only allow a few of these, and send a copy of + * each async message to each live one. Traps time out after an hour, it + * is up to the trap receipient to keep resetting it to avoid being + * timed out. */ /* ntp_request.c */ struct ctl_trap ctl_trap[CTL_MAXTRAPS]; @@ -301,9 +350,9 @@ int num_ctl_traps; /* * List relating reference clock types to control message time sources. - * Index by the reference clock type. - * This list will only be used iff the reference clock driver doesn't - * set peer->sstclktype to something different than CTL_SST_TS_UNSPEC. + * Index by the reference clock type. This list will only be used iff + * the reference clock driver doesn't set peer->sstclktype to something + * different than CTL_SST_TS_UNSPEC. */ static u_char clocktypes[] = { CTL_SST_TS_NTP, /* REFCLK_NONE (0) */ @@ -342,15 +391,17 @@ static u_char clocktypes[] = { CTL_SST_TS_LF, /* REFCLK_DUMBCLOCK (32) */ CTL_SST_TS_LF, /* REFCLK_ULINK (33) */ CTL_SST_TS_LF, /* REFCLK_PCF (35) */ - CTL_SST_TS_LF, /* REFCLK_WWW (36) */ + CTL_SST_TS_LF, /* REFCLK_WWV (36) */ CTL_SST_TS_LF, /* REFCLK_FG (37) */ + CTL_SST_TS_UHF, /* REFCLK_HOPF_SERIAL (38) */ + CTL_SST_TS_UHF, /* REFCLK_HOPF_PCI (39) */ }; /* * Keyid used for authenticating write requests. */ -u_long ctl_auth_keyid; +keyid_t ctl_auth_keyid; /* * We keep track of the last error reported by the system internally @@ -366,7 +417,7 @@ u_long ctltimereset; /* time stats reset */ u_long numctlreq; /* number of requests we've received */ u_long numctlbadpkts; /* number of bad control packets */ u_long numctlresponses; /* number of resp packets sent with data */ -u_long numctlfrags; /* number of fragments sent */ +u_long numctlfrags; /* number of fragments sent */ u_long numctlerrors; /* number of error responses sent */ u_long numctltooshort; /* number of too short input packets */ u_long numctlinputresp; /* number of responses on input */ @@ -375,11 +426,11 @@ u_long numctlinputerr; /* number of input pkts with err bit set */ u_long numctlbadoffset; /* number of input pkts with nonzero offset */ u_long numctlbadversion; /* number of input pkts with unknown version */ u_long numctldatatooshort; /* data too short for count */ -u_long numctlbadop; /* bad op code found in packet */ +u_long numctlbadop; /* bad op code found in packet */ u_long numasyncmsgs; /* number of async messages we've sent */ /* - * Response packet used by these routines. Also some state information + * Response packet used by these routines. Also some state information * so that we can handle packet formatting within a common set of * subroutines. Note we try to enter data in place whenever possible, * but the need to set the more bit correctly means we occasionally @@ -388,7 +439,7 @@ u_long numasyncmsgs; /* number of async messages we've sent */ static struct ntp_control rpkt; static u_char res_version; static u_char res_opcode; -static u_short res_associd; +static associd_t res_associd; static int res_offset; static u_char * datapt; static u_char * dataend; @@ -399,7 +450,7 @@ static struct interface *lcl_inter; static u_char res_authenticate; static u_char res_authokay; -static u_long res_keyid; +static keyid_t res_keyid; #define MAXDATALINELEN (72) @@ -448,10 +499,11 @@ ctl_error( printf("sending control error %d\n", errcode); #endif /* - * fill in the fields. We assume rpkt.sequence and rpkt.associd + * Fill in the fields. We assume rpkt.sequence and rpkt.associd * have already been filled in. */ - rpkt.r_m_e_op = (u_char) (CTL_RESPONSE|CTL_ERROR|(res_opcode & CTL_OP_MASK)); + rpkt.r_m_e_op = (u_char) (CTL_RESPONSE|CTL_ERROR|(res_opcode & + CTL_OP_MASK)); rpkt.status = htons((u_short) ((errcode<<8) & 0xff00)); rpkt.count = 0; @@ -461,15 +513,15 @@ ctl_error( if (res_authenticate && sys_authenticate) { int maclen; - *(u_int32 *)((u_char *)&rpkt + CTL_HEADER_LEN) - = htonl(res_keyid); + *(u_int32 *)((u_char *)&rpkt + CTL_HEADER_LEN) = + htonl(res_keyid); maclen = authencrypt(res_keyid, (u_int32 *)&rpkt, - CTL_HEADER_LEN); + CTL_HEADER_LEN); sendpkt(rmt_addr, lcl_inter, -2, (struct pkt *)&rpkt, - CTL_HEADER_LEN + maclen); + CTL_HEADER_LEN + maclen); } else { sendpkt(rmt_addr, lcl_inter, -3, (struct pkt *)&rpkt, - CTL_HEADER_LEN); + CTL_HEADER_LEN); } numctlerrors++; } @@ -492,7 +544,7 @@ process_control( int maclen; #ifdef DEBUG - if (debug > 1) + if (debug > 2) printf("in process_control()\n"); #endif @@ -509,8 +561,8 @@ process_control( * it is a response or a fragment, ignore this. */ if (rbufp->recv_length < CTL_HEADER_LEN - || pkt->r_m_e_op & (CTL_RESPONSE|CTL_MORE|CTL_ERROR) - || pkt->offset != 0) { + || pkt->r_m_e_op & (CTL_RESPONSE|CTL_MORE|CTL_ERROR) + || pkt->offset != 0) { #ifdef DEBUG if (debug) printf("invalid format in control packet\n"); @@ -539,9 +591,11 @@ process_control( } /* - * Pull enough data from the packet to make intelligent responses + * Pull enough data from the packet to make intelligent + * responses */ - rpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, res_version, MODE_CONTROL); + rpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, res_version, + MODE_CONTROL); res_opcode = pkt->r_m_e_op; rpkt.sequence = pkt->sequence; rpkt.associd = pkt->associd; @@ -559,8 +613,8 @@ process_control( dataend = &(rpkt.data[CTL_MAX_DATA_LEN]); /* - * We're set up now. Make sure we've got at least - * enough incoming data space to match the count. + * We're set up now. Make sure we've got at least enough + * incoming data space to match the count. */ req_data = rbufp->recv_length - CTL_HEADER_LEN; if (req_data < req_count || rbufp->recv_length & 0x3) { @@ -571,40 +625,43 @@ process_control( properlen = req_count + CTL_HEADER_LEN; #ifdef DEBUG - if (debug >= 2 && (rbufp->recv_length & 0x3) != 0) - printf("Packet length %d unrounded\n", rbufp->recv_length); + if (debug > 2 && (rbufp->recv_length & 0x3) != 0) + printf("Packet length %d unrounded\n", + rbufp->recv_length); #endif /* round up proper len to a 8 octet boundary */ properlen = (properlen + 7) & ~7; maclen = rbufp->recv_length - properlen; if ((rbufp->recv_length & (sizeof(u_long) - 1)) == 0 && - maclen >= MIN_MAC_LEN && maclen <= MAX_MAC_LEN && - sys_authenticate) { + maclen >= MIN_MAC_LEN && maclen <= MAX_MAC_LEN && + sys_authenticate) { res_authenticate = 1; - res_keyid = ntohl(*(u_int32 *)((u_char *)pkt + properlen)); + res_keyid = ntohl(*(u_int32 *)((u_char *)pkt + + properlen)); #ifdef DEBUG - if (debug >= 3) + if (debug > 2) printf( - "recv_len %d, properlen %d, wants auth with keyid %ld, MAC length=%d\n", - rbufp->recv_length, properlen, res_keyid, maclen); + "recv_len %d, properlen %d, wants auth with keyid %08x, MAC length=%d\n", + rbufp->recv_length, properlen, res_keyid, maclen); #endif if (!authistrusted(res_keyid)) { #ifdef DEBUG - if (debug >= 2) - printf("invalid keyid %lu\n", res_keyid); + if (debug > 2) + printf("invalid keyid %08x\n", + res_keyid); #endif } else if (authdecrypt(res_keyid, (u_int32 *)pkt, - rbufp->recv_length - maclen, maclen)) { + rbufp->recv_length - maclen, maclen)) { #ifdef DEBUG - if (debug >= 3) + if (debug > 2) printf("authenticated okay\n"); #endif res_authokay = 1; } else { #ifdef DEBUG - if (debug >= 3) + if (debug > 2) printf("authentication failed\n"); #endif res_keyid = 0; @@ -623,12 +680,12 @@ process_control( for (cc = control_codes; cc->control_code != NO_REQUEST; cc++) { if (cc->control_code == res_opcode) { #ifdef DEBUG - if (debug >= 2) + if (debug > 2) printf("opcode %d, found command handler\n", - res_opcode); + res_opcode); #endif - if (cc->flags == AUTH && (!res_authokay - || res_keyid != ctl_auth_keyid)) { + if (cc->flags == AUTH && (!res_authokay || + res_keyid != ctl_auth_keyid)) { ctl_error(CERR_PERMISSION); return; } @@ -666,7 +723,7 @@ ctlpeerstatus( if (peer->reach != 0) status |= CTL_PST_REACH; return (u_short)CTL_PEER_STATUS(status, peer->num_events, - peer->last_event); + peer->last_event); } @@ -678,12 +735,11 @@ ctlclkstatus( struct refclockstat *this_clock ) { - return ((u_short)(this_clock->currentstatus) << 8) - | (u_short)(this_clock->lastevent); + return ((u_short)(this_clock->currentstatus) << 8) | + (u_short)(this_clock->lastevent); } - /* * ctlsysstatus - return the system status word */ @@ -700,17 +756,17 @@ ctlsysstatus(void) this_clock |= CTL_SST_TS_PPS; } else { if (sys_peer->refclktype < sizeof(clocktypes)) - this_clock = clocktypes[sys_peer->refclktype]; + this_clock = + clocktypes[sys_peer->refclktype]; if (pps_control) this_clock |= CTL_SST_TS_PPS; } } return (u_short)CTL_SYS_STATUS(sys_leap, this_clock, - ctl_sys_num_events, ctl_sys_last_event); + ctl_sys_num_events, ctl_sys_last_event); } - /* * ctl_flushpkt - write out the current packet and prepare * another if necessary. @@ -744,7 +800,8 @@ ctl_flushpkt( /* * Fill in the packet with the current info */ - rpkt.r_m_e_op = (u_char)(CTL_RESPONSE|more|(res_opcode & CTL_OP_MASK)); + rpkt.r_m_e_op = (u_char)(CTL_RESPONSE|more|(res_opcode & + CTL_OP_MASK)); rpkt.count = htons((u_short) dlen); rpkt.offset = htons( (u_short) res_offset); if (res_async) { @@ -752,12 +809,14 @@ ctl_flushpkt( for (i = 0; i < CTL_MAXTRAPS; i++) { if (ctl_trap[i].tr_flags & TRAP_INUSE) { - rpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, - ctl_trap[i].tr_version, MODE_CONTROL); - rpkt.sequence = htons(ctl_trap[i].tr_sequence); + rpkt.li_vn_mode = + PKT_LI_VN_MODE(sys_leap, + ctl_trap[i].tr_version, + MODE_CONTROL); + rpkt.sequence = + htons(ctl_trap[i].tr_sequence); sendpkt(&ctl_trap[i].tr_addr, - ctl_trap[i].tr_localaddr, - -4, + ctl_trap[i].tr_localaddr, -4, (struct pkt *)&rpkt, sendlen); if (!more) ctl_trap[i].tr_sequence++; @@ -768,25 +827,25 @@ ctl_flushpkt( if (res_authenticate && sys_authenticate) { int maclen; int totlen = sendlen; - u_long keyid = htonl(res_keyid); + keyid_t keyid = htonl(res_keyid); /* - * If we are going to authenticate, then there is - * an additional requirement that the MAC begin on - * a 64 bit boundary. + * If we are going to authenticate, then there + * is an additional requirement that the MAC + * begin on a 64 bit boundary. */ while (totlen & 7) { *datapt++ = '\0'; totlen++; } memcpy(datapt, &keyid, sizeof keyid); - maclen = authencrypt(res_keyid, (u_int32 *)&rpkt, - totlen); - sendpkt(rmt_addr, lcl_inter, -5, (struct pkt *)&rpkt, - totlen + maclen); + maclen = authencrypt(res_keyid, + (u_int32 *)&rpkt, totlen); + sendpkt(rmt_addr, lcl_inter, -5, + (struct pkt *)&rpkt, totlen + maclen); } else { - sendpkt(rmt_addr, lcl_inter, -6, (struct pkt *)&rpkt, - sendlen); + sendpkt(rmt_addr, lcl_inter, -6, + (struct pkt *)&rpkt, sendlen); } if (more) numctlfrags++; @@ -803,8 +862,8 @@ ctl_flushpkt( /* - * ctl_putdata - write data into the packet, fragmenting and - * starting another if this one is full. + * ctl_putdata - write data into the packet, fragmenting and starting + * another if this one is full. */ static void ctl_putdata( @@ -822,7 +881,8 @@ ctl_putdata( if (datapt != rpkt.data) { *datapt++ = ','; datalinelen++; - if ((dlen + datalinelen + 1) >= MAXDATALINELEN) { + if ((dlen + datalinelen + 1) >= MAXDATALINELEN) + { *datapt++ = '\r'; *datapt++ = '\n'; datalinelen = 0; @@ -842,7 +902,6 @@ ctl_putdata( */ ctl_flushpkt(CTL_MORE); } - memmove((char *)datapt, dp, (unsigned)dlen); datapt += dlen; datalinelen += dlen; @@ -867,7 +926,6 @@ ctl_putstr( cq = tag; while (*cq != '\0') *cp++ = *cq++; - if (len > 0) { *cp++ = '='; *cp++ = '"'; @@ -877,7 +935,6 @@ ctl_putstr( cp += len; *cp++ = '"'; } - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -928,7 +985,6 @@ ctl_putuint( (void) sprintf(cp, "%lu", uval); while (*cp != '\0') cp++; - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -955,7 +1011,6 @@ ctl_puthex( (void) sprintf(cp, "0x%lx", uval); while (*cp != '\0') cp++; - ctl_putdata(buffer,(unsigned)( cp - buffer ), 0); } @@ -982,7 +1037,6 @@ ctl_putint( (void) sprintf(cp, "%ld", ival); while (*cp != '\0') cp++; - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -1010,7 +1064,6 @@ ctl_putts( ts->l_uf & 0xffffffffL); while (*cp != '\0') cp++; - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -1037,7 +1090,6 @@ ctl_putadr( cq = numtoa(addr); while (*cq != '\0') *cp++ = *cq++; - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -1064,7 +1116,6 @@ ctl_putid( cq = id; while (*cq != '\0' && (cq - id) < 4) *cp++ = *cq++; - ctl_putdata(buffer, (unsigned)( cp - buffer ), 0); } @@ -1111,145 +1162,213 @@ ctl_putsys( { l_fp tmp; #ifdef HAVE_UNAME - char str[50]; + char str[256]; #endif switch (varid) { - case CS_LEAP: + + case CS_LEAP: ctl_putuint(sys_var[CS_LEAP].text, sys_leap); break; - case CS_STRATUM: + + case CS_STRATUM: ctl_putuint(sys_var[CS_STRATUM].text, sys_stratum); break; - case CS_PRECISION: + + case CS_PRECISION: ctl_putint(sys_var[CS_PRECISION].text, sys_precision); break; - case CS_ROOTDELAY: - ctl_putdbl(sys_var[CS_ROOTDELAY].text, sys_rootdelay * 1e3); + + case CS_ROOTDELAY: + ctl_putdbl(sys_var[CS_ROOTDELAY].text, sys_rootdelay * + 1e3); break; - case CS_ROOTDISPERSION: + + case CS_ROOTDISPERSION: ctl_putdbl(sys_var[CS_ROOTDISPERSION].text, sys_rootdispersion * 1e3); break; - case CS_REFID: + + case CS_REFID: if (sys_stratum > 1) ctl_putadr(sys_var[CS_REFID].text, sys_refid); else - ctl_putid(sys_var[CS_REFID].text, (char *)&sys_refid); + ctl_putid(sys_var[CS_REFID].text, + (char *)&sys_refid); break; - case CS_REFTIME: + + case CS_REFTIME: ctl_putts(sys_var[CS_REFTIME].text, &sys_reftime); break; - case CS_POLL: + + case CS_POLL: ctl_putuint(sys_var[CS_POLL].text, sys_poll); break; - case CS_PEERID: + + case CS_PEERID: if (sys_peer == NULL) ctl_putuint(sys_var[CS_PEERID].text, 0); else ctl_putuint(sys_var[CS_PEERID].text, sys_peer->associd); break; - case CS_STATE: + + case CS_STATE: ctl_putuint(sys_var[CS_STATE].text, (unsigned)state); break; - case CS_OFFSET: + + case CS_OFFSET: ctl_putdbl(sys_var[CS_OFFSET].text, last_offset * 1e3); break; - case CS_DRIFT: + + case CS_DRIFT: ctl_putdbl(sys_var[CS_DRIFT].text, drift_comp * 1e6); break; - case CS_COMPLIANCE: - ctl_putdbl(sys_var[CS_COMPLIANCE].text, sys_error * 1e3); + + case CS_JITTER: + ctl_putdbl(sys_var[CS_JITTER].text, sys_jitter * 1e3); break; - case CS_CLOCK: + + case CS_CLOCK: get_systime(&tmp); ctl_putts(sys_var[CS_CLOCK].text, &tmp); break; - case CS_PROCESSOR: + + case CS_PROCESSOR: #ifndef HAVE_UNAME ctl_putstr(sys_var[CS_PROCESSOR].text, str_processor, - sizeof(str_processor) - 1); + sizeof(str_processor) - 1); #else - ctl_putstr(sys_var[CS_PROCESSOR].text, utsnamebuf.machine, - strlen(utsnamebuf.machine)); + ctl_putstr(sys_var[CS_PROCESSOR].text, + utsnamebuf.machine, strlen(utsnamebuf.machine)); #endif /* HAVE_UNAME */ break; - case CS_SYSTEM: + + case CS_SYSTEM: #ifndef HAVE_UNAME ctl_putstr(sys_var[CS_SYSTEM].text, str_system, - sizeof(str_system) - 1); + sizeof(str_system) - 1); #else (void)strcpy(str, utsnamebuf.sysname); (void)strcat(str, utsnamebuf.release); ctl_putstr(sys_var[CS_SYSTEM].text, str, strlen(str)); #endif /* HAVE_UNAME */ break; - case CS_STABIL: - ctl_putdbl(sys_var[CS_STABIL].text, clock_stability * 1e6); - break; - case CS_VARLIST: - { - char buf[CTL_MAX_DATA_LEN]; - register char *s, *t, *be; - register const char *ss; - register int i; - register struct ctl_var *k; - - s = buf; - be = buf + sizeof(buf) - strlen(sys_var[CS_VARLIST].text) - 4; - if (s > be) - break; /* really long var name 8-( - Killer */ - - strcpy(s, sys_var[CS_VARLIST].text); - strcat(s, "=\""); - s += strlen(s); - t = s; - - for (k = sys_var; !(k->flags &EOV); k++) - { - if (k->flags & PADDING) + + case CS_VERSION: + ctl_putstr(sys_var[CS_VERSION].text, Version, + strlen(Version)); + break; + + case CS_STABIL: + ctl_putdbl(sys_var[CS_STABIL].text, clock_stability * + 1e6); + break; + + case CS_VARLIST: + { + char buf[CTL_MAX_DATA_LEN]; + register char *s, *t, *be; + register const char *ss; + register int i; + register struct ctl_var *k; + + s = buf; + be = buf + sizeof(buf) - + strlen(sys_var[CS_VARLIST].text) - 4; + if (s > be) + break; /* really long var name */ + + strcpy(s, sys_var[CS_VARLIST].text); + strcat(s, "=\""); + s += strlen(s); + t = s; + for (k = sys_var; !(k->flags &EOV); k++) { + if (k->flags & PADDING) continue; + i = strlen(k->text); + if (s+i+1 >= be) + break; - i = strlen(k->text); - if (s+i+1 >= be) - break; - if (s != t) - *s++ = ','; - strcpy(s, k->text); - s += i; - } + if (s != t) + *s++ = ','; + strcpy(s, k->text); + s += i; + } - for (k = ext_sys_var; k && !(k->flags &EOV); k++) - { - if (k->flags & PADDING) + for (k = ext_sys_var; k && !(k->flags &EOV); + k++) { + if (k->flags & PADDING) continue; - ss = k->text; - if (!ss) + ss = k->text; + if (!ss) continue; - while (*ss && *ss != '=') + while (*ss && *ss != '=') ss++; - - i = ss - k->text; - if (s+i+1 >= be) + i = ss - k->text; + if (s + i + 1 >= be) break; - if (s != t) - *s++ = ','; - strncpy(s, k->text, (unsigned)i); - s += i; - } - if (s+2 >= be) + if (s != t) + *s++ = ','; + strncpy(s, k->text, + (unsigned)i); + s += i; + } + if (s+2 >= be) break; - *s++ = '"'; - *s = '\0'; + *s++ = '"'; + *s = '\0'; - ctl_putdata(buf, (unsigned)( s - buf ), 0); - } - break; + ctl_putdata(buf, (unsigned)( s - buf ), + 0); + } + break; + +#ifdef PUBKEY + case CS_FLAGS: + if (crypto_flags) + ctl_puthex(sys_var[CS_FLAGS].text, + crypto_flags); + break; + + case CS_HOST: + ctl_putstr(sys_var[CS_HOST].text, sys_hostname, + strlen(sys_hostname)); + if (host.fstamp != 0) + ctl_putuint(sys_var[CS_PUBLIC].text, + ntohl(host.fstamp)); + break; + + case CS_CERTIF: + if (certif.fstamp != 0) + ctl_putuint(sys_var[CS_CERTIF].text, + ntohl(certif.fstamp)); + break; + + case CS_DHPARAMS: + if (dhparam.fstamp != 0) + ctl_putuint(sys_var[CS_DHPARAMS].text, + ntohl(dhparam.fstamp)); + break; + + case CS_REVTIME: + if (host.tstamp != 0) + ctl_putuint(sys_var[CS_REVTIME].text, + ntohl(host.tstamp)); + break; + + case CS_LEAPTAB: + if (tai_leap.fstamp != 0) + ctl_putuint(sys_var[CS_LEAPTAB].text, + ntohl(tai_leap.fstamp)); + if (sys_tai != 0) + ctl_putuint(sys_var[CS_TAI].text, sys_tai); + break; +#endif /* PUBKEY */ } } @@ -1264,186 +1383,266 @@ ctl_putpeer( ) { switch (varid) { - case CP_CONFIG: + + case CP_CONFIG: ctl_putuint(peer_var[CP_CONFIG].text, - (unsigned)((peer->flags & FLAG_CONFIG) != 0)); + (unsigned)((peer->flags & FLAG_CONFIG) != 0)); break; - case CP_AUTHENABLE: + + case CP_AUTHENABLE: ctl_putuint(peer_var[CP_AUTHENABLE].text, - (unsigned)((peer->flags & FLAG_AUTHENABLE) != 0)); + (unsigned)((peer->flags & FLAG_AUTHENABLE) != 0)); break; - case CP_AUTHENTIC: + + case CP_AUTHENTIC: ctl_putuint(peer_var[CP_AUTHENTIC].text, - (unsigned)((peer->flags & FLAG_AUTHENTIC) != 0)); + (unsigned)((peer->flags & FLAG_AUTHENTIC) != 0)); break; - case CP_SRCADR: + + case CP_SRCADR: ctl_putadr(peer_var[CP_SRCADR].text, - peer->srcadr.sin_addr.s_addr); + peer->srcadr.sin_addr.s_addr); break; - case CP_SRCPORT: + + case CP_SRCPORT: ctl_putuint(peer_var[CP_SRCPORT].text, - ntohs(peer->srcadr.sin_port)); + ntohs(peer->srcadr.sin_port)); break; - case CP_DSTADR: + + case CP_DSTADR: ctl_putadr(peer_var[CP_DSTADR].text, - peer->processed ? - peer->cast_flags & MDF_BCAST ? - peer->dstadr->bcast.sin_addr.s_addr: - peer->cast_flags ? - peer->dstadr->sin.sin_addr.s_addr ? - peer->dstadr->sin.sin_addr.s_addr: - peer->dstadr->bcast.sin_addr.s_addr: - 8 : 12); - break; - case CP_DSTPORT: + peer->dstadr->sin.sin_addr.s_addr); + break; + + case CP_DSTPORT: ctl_putuint(peer_var[CP_DSTPORT].text, - (u_long)(peer->dstadr - ? ntohs(peer->dstadr->sin.sin_port) - : 0 - ) - ); + (u_long)(peer->dstadr ? + ntohs(peer->dstadr->sin.sin_port) : 0)); break; - case CP_LEAP: + + case CP_LEAP: ctl_putuint(peer_var[CP_LEAP].text, peer->leap); break; - case CP_HMODE: + + case CP_HMODE: ctl_putuint(peer_var[CP_HMODE].text, peer->hmode); break; - case CP_STRATUM: + + case CP_STRATUM: ctl_putuint(peer_var[CP_STRATUM].text, peer->stratum); break; - case CP_PPOLL: + + case CP_PPOLL: ctl_putuint(peer_var[CP_PPOLL].text, peer->ppoll); break; - case CP_HPOLL: + + case CP_HPOLL: ctl_putuint(peer_var[CP_HPOLL].text, peer->hpoll); break; - case CP_PRECISION: - ctl_putint(peer_var[CP_PRECISION].text, peer->precision); + + case CP_PRECISION: + ctl_putint(peer_var[CP_PRECISION].text, + peer->precision); break; - case CP_ROOTDELAY: - ctl_putdbl(peer_var[CP_ROOTDELAY].text, peer->rootdelay * 1e3); + + case CP_ROOTDELAY: + ctl_putdbl(peer_var[CP_ROOTDELAY].text, + peer->rootdelay * 1e3); break; - case CP_ROOTDISPERSION: + + case CP_ROOTDISPERSION: ctl_putdbl(peer_var[CP_ROOTDISPERSION].text, - peer->rootdispersion * 1e3); + peer->rootdispersion * 1e3); break; - case CP_REFID: - if (peer->stratum > 1) - { + + case CP_REFID: + if (peer->stratum > 1) { if (peer->flags & FLAG_REFCLOCK) ctl_putadr(peer_var[CP_REFID].text, - peer->srcadr.sin_addr.s_addr); + peer->srcadr.sin_addr.s_addr); else ctl_putadr(peer_var[CP_REFID].text, - peer->refid); - } - else + peer->refid); + } else { ctl_putid(peer_var[CP_REFID].text, - (char *)&peer->refid); + (char *)&peer->refid); + } break; - case CP_REFTIME: + + case CP_REFTIME: ctl_putts(peer_var[CP_REFTIME].text, &peer->reftime); break; - case CP_ORG: + + case CP_ORG: ctl_putts(peer_var[CP_ORG].text, &peer->org); break; - case CP_REC: + + case CP_REC: ctl_putts(peer_var[CP_REC].text, &peer->rec); break; - case CP_XMT: + + case CP_XMT: ctl_putts(peer_var[CP_XMT].text, &peer->xmt); break; - case CP_REACH: + + case CP_REACH: ctl_puthex(peer_var[CP_REACH].text, peer->reach); break; - case CP_FLASH: + + case CP_FLASH: ctl_puthex(peer_var[CP_FLASH].text, peer->flash); break; - case CP_VALID: - ctl_putuint(peer_var[CP_VALID].text, peer->valid); + + case CP_TTL: + if (!(peer->cast_flags & MDF_ACAST)) + break; + ctl_putint(peer_var[CP_TTL].text, peer->ttl); break; - case CP_TIMER: + + case CP_TTLMAX: + if (!(peer->cast_flags & (MDF_MCAST | MDF_ACAST))) + break; + ctl_putint(peer_var[CP_TTLMAX].text, peer->ttlmax); + break; + + case CP_VALID: + ctl_putuint(peer_var[CP_VALID].text, peer->unreach); + break; + + case CP_TIMER: ctl_putuint(peer_var[CP_TIMER].text, peer->nextdate - current_time); break; - case CP_DELAY: + + case CP_DELAY: ctl_putdbl(peer_var[CP_DELAY].text, peer->delay * 1e3); break; - case CP_OFFSET: - ctl_putdbl(peer_var[CP_OFFSET].text, peer->offset * 1e3); + + case CP_OFFSET: + ctl_putdbl(peer_var[CP_OFFSET].text, peer->offset * + 1e3); break; - case CP_JITTER: + + case CP_JITTER: ctl_putdbl(peer_var[CP_JITTER].text, - SQRT(peer->variance) * 1e3); + SQRT(peer->jitter) * 1e3); break; - case CP_DISPERSION: - ctl_putdbl(peer_var[CP_DISPERSION].text, peer->disp * 1e3); + + case CP_DISPERSION: + ctl_putdbl(peer_var[CP_DISPERSION].text, peer->disp * + 1e3); break; - case CP_KEYID: + + case CP_KEYID: ctl_putuint(peer_var[CP_KEYID].text, peer->keyid); break; - case CP_FILTDELAY: + + case CP_FILTDELAY: ctl_putarray(peer_var[CP_FILTDELAY].text, peer->filter_delay, (int)peer->filter_nextpt); break; - case CP_FILTOFFSET: + + case CP_FILTOFFSET: ctl_putarray(peer_var[CP_FILTOFFSET].text, peer->filter_offset, (int)peer->filter_nextpt); break; - case CP_FILTERROR: + + case CP_FILTERROR: ctl_putarray(peer_var[CP_FILTERROR].text, peer->filter_disp, (int)peer->filter_nextpt); break; - case CP_PMODE: + + case CP_PMODE: ctl_putuint(peer_var[CP_PMODE].text, peer->pmode); break; - case CP_RECEIVED: + + case CP_RECEIVED: ctl_putuint(peer_var[CP_RECEIVED].text, peer->received); break; - case CP_SENT: + + case CP_SENT: ctl_putuint(peer_var[CP_SENT].text, peer->sent); break; - case CP_VARLIST: - { - char buf[CTL_MAX_DATA_LEN]; - register char *s, *t, *be; - register int i; - register struct ctl_var *k; - - s = buf; - be = buf + sizeof(buf) - strlen(peer_var[CP_VARLIST].text) - 4; - if (s > be) - break; /* really long var name 8-( - Killer */ - - strcpy(s, peer_var[CP_VARLIST].text); - strcat(s, "=\""); - s += strlen(s); - t = s; - - for (k = peer_var; !(k->flags &EOV); k++) - { - if (k->flags & PADDING) + + case CP_VARLIST: + { + char buf[CTL_MAX_DATA_LEN]; + register char *s, *t, *be; + register int i; + register struct ctl_var *k; + + s = buf; + be = buf + sizeof(buf) - + strlen(peer_var[CP_VARLIST].text) - 4; + if (s > be) + break; /* really long var name */ + + strcpy(s, peer_var[CP_VARLIST].text); + strcat(s, "=\""); + s += strlen(s); + t = s; + for (k = peer_var; !(k->flags &EOV); k++) { + if (k->flags & PADDING) continue; - i = strlen(k->text); - if (s+i+1 >= be) - break; - if (s != t) - *s++ = ','; - strcpy(s, k->text); - s += i; - } + i = strlen(k->text); + if (s + i + 1 >= be) + break; - if (s+2 >= be) + if (s != t) + *s++ = ','; + strcpy(s, k->text); + s += i; + } + if (s+2 >= be) break; - *s++ = '"'; - *s = '\0'; + *s++ = '"'; + *s = '\0'; + ctl_putdata(buf, (unsigned)(s - buf), 0); + } + break; +#ifdef PUBKEY + case CP_FLAGS: + if (peer->crypto) + ctl_puthex(peer_var[CP_FLAGS].text, peer->crypto); + break; - ctl_putdata(buf, (unsigned)(s - buf), 0); - } + case CP_HOST: + if (peer->keystr != NULL) + ctl_putstr(peer_var[CP_HOST].text, peer->keystr, + strlen(peer->keystr)); + if (peer->pubkey.fstamp != 0) + ctl_putuint(peer_var[CP_PUBLIC].text, + peer->pubkey.fstamp); + break; + + case CP_CERTIF: + if (peer->certif.fstamp != 0) + ctl_putuint(peer_var[CP_CERTIF].text, + peer->certif.fstamp); + break; + + case CP_SESKEY: + if (peer->pcookie.key != 0) + ctl_puthex(peer_var[CP_SESKEY].text, + peer->pcookie.key); + if (peer->hcookie != 0) + ctl_puthex(peer_var[CP_SASKEY].text, + peer->hcookie); + break; + + case CP_INITSEQ: + if (peer->recauto.key == 0) break; + ctl_putint(peer_var[CP_INITSEQ].text, + peer->recauto.seq); + ctl_puthex(peer_var[CP_INITKEY].text, + peer->recauto.key); + ctl_putuint(peer_var[CP_INITTSP].text, + peer->recauto.tstamp); + break; +#endif /* PUBKEY */ } } @@ -1460,132 +1659,148 @@ ctl_putclock( ) { switch(varid) { - case CC_TYPE: + + case CC_TYPE: if (mustput || clock_stat->clockdesc == NULL || *(clock_stat->clockdesc) == '\0') { ctl_putuint(clock_var[CC_TYPE].text, clock_stat->type); } break; - case CC_TIMECODE: - ctl_putstr(clock_var[CC_TIMECODE].text, clock_stat->p_lastcode, - (unsigned)clock_stat->lencode); + case CC_TIMECODE: + ctl_putstr(clock_var[CC_TIMECODE].text, + clock_stat->p_lastcode, + (unsigned)clock_stat->lencode); break; - case CC_POLL: + + case CC_POLL: ctl_putuint(clock_var[CC_POLL].text, clock_stat->polls); break; - case CC_NOREPLY: - ctl_putuint(clock_var[CC_NOREPLY].text, clock_stat->noresponse); + + case CC_NOREPLY: + ctl_putuint(clock_var[CC_NOREPLY].text, + clock_stat->noresponse); break; - case CC_BADFORMAT: - ctl_putuint(clock_var[CC_BADFORMAT].text, clock_stat->badformat); + + case CC_BADFORMAT: + ctl_putuint(clock_var[CC_BADFORMAT].text, + clock_stat->badformat); break; - case CC_BADDATA: - ctl_putuint(clock_var[CC_BADDATA].text, clock_stat->baddata); + + case CC_BADDATA: + ctl_putuint(clock_var[CC_BADDATA].text, + clock_stat->baddata); break; - case CC_FUDGETIME1: - if (mustput || (clock_stat->haveflags & CLK_HAVETIME1)) { + + case CC_FUDGETIME1: + if (mustput || (clock_stat->haveflags & CLK_HAVETIME1)) ctl_putdbl(clock_var[CC_FUDGETIME1].text, - clock_stat->fudgetime1 * 1e3); - } + clock_stat->fudgetime1 * 1e3); break; - case CC_FUDGETIME2: - if (mustput || (clock_stat->haveflags & CLK_HAVETIME2)) { - ctl_putdbl(clock_var[CC_FUDGETIME2].text, - clock_stat->fudgetime2 * 1e3); - } + + case CC_FUDGETIME2: + if (mustput || (clock_stat->haveflags & CLK_HAVETIME2)) ctl_putdbl(clock_var[CC_FUDGETIME2].text, + clock_stat->fudgetime2 * 1e3); break; - case CC_FUDGEVAL1: + + case CC_FUDGEVAL1: if (mustput || (clock_stat->haveflags & CLK_HAVEVAL1)) ctl_putint(clock_var[CC_FUDGEVAL1].text, - clock_stat->fudgeval1); + clock_stat->fudgeval1); break; - case CC_FUDGEVAL2: + + case CC_FUDGEVAL2: if (mustput || (clock_stat->haveflags & CLK_HAVEVAL2)) { if (clock_stat->fudgeval1 > 1) - ctl_putadr(clock_var[CC_FUDGEVAL2].text, - (u_int32)clock_stat->fudgeval2); + ctl_putadr(clock_var[CC_FUDGEVAL2].text, + (u_int32)clock_stat->fudgeval2); else - ctl_putid(clock_var[CC_FUDGEVAL2].text, - (char *)&clock_stat->fudgeval2); + ctl_putid(clock_var[CC_FUDGEVAL2].text, + (char *)&clock_stat->fudgeval2); } break; - case CC_FLAGS: - if (mustput || (clock_stat->haveflags & - (CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3|CLK_HAVEFLAG4))) - ctl_putuint(clock_var[CC_FLAGS].text, clock_stat->flags); + + case CC_FLAGS: + if (mustput || (clock_stat->haveflags & (CLK_HAVEFLAG1 | + CLK_HAVEFLAG2 | CLK_HAVEFLAG3 | CLK_HAVEFLAG4))) + ctl_putuint(clock_var[CC_FLAGS].text, + clock_stat->flags); break; - case CC_DEVICE: - if (clock_stat->clockdesc == NULL || *(clock_stat->clockdesc) == '\0') { + + case CC_DEVICE: + if (clock_stat->clockdesc == NULL || + *(clock_stat->clockdesc) == '\0') { if (mustput) - ctl_putstr(clock_var[CC_DEVICE].text, "", 0); + ctl_putstr(clock_var[CC_DEVICE].text, + "", 0); } else { - ctl_putstr(clock_var[CC_DEVICE].text, clock_stat->clockdesc, - strlen(clock_stat->clockdesc)); + ctl_putstr(clock_var[CC_DEVICE].text, + clock_stat->clockdesc, + strlen(clock_stat->clockdesc)); } break; - case CC_VARLIST: - { - char buf[CTL_MAX_DATA_LEN]; - register char *s, *t, *be; - register const char *ss; - register int i; - register struct ctl_var *k; - - s = buf; - be = buf + sizeof(buf); - if (s + strlen(clock_var[CC_VARLIST].text) + 4 > be) - break; /* really long var name 8-( - Killer */ - - strcpy(s, clock_var[CC_VARLIST].text); - strcat(s, "=\""); - s += strlen(s); - t = s; - - for (k = clock_var; !(k->flags &EOV); k++) - { - if (k->flags & PADDING) + + case CC_VARLIST: + { + char buf[CTL_MAX_DATA_LEN]; + register char *s, *t, *be; + register const char *ss; + register int i; + register struct ctl_var *k; + + s = buf; + be = buf + sizeof(buf); + if (s + strlen(clock_var[CC_VARLIST].text) + 4 > + be) + break; /* really long var name */ + + strcpy(s, clock_var[CC_VARLIST].text); + strcat(s, "=\""); + s += strlen(s); + t = s; + + for (k = clock_var; !(k->flags &EOV); k++) { + if (k->flags & PADDING) continue; - i = strlen(k->text); - if (s+i+1 >= be) + i = strlen(k->text); + if (s + i + 1 >= be) break; - if (s != t) - *s++ = ','; - strcpy(s, k->text); - s += i; - } - for (k = clock_stat->kv_list; k && !(k->flags &EOV); k++) - { - if (k->flags & PADDING) + if (s != t) + *s++ = ','; + strcpy(s, k->text); + s += i; + } + + for (k = clock_stat->kv_list; k && !(k->flags & + EOV); k++) { + if (k->flags & PADDING) continue; - ss = k->text; - if (!ss) + ss = k->text; + if (!ss) continue; - while (*ss && *ss != '=') + while (*ss && *ss != '=') ss++; - - i = ss - k->text; - if (s+i+1 >= be) + i = ss - k->text; + if (s+i+1 >= be) break; - if (s != t) - *s++ = ','; - strncpy(s, k->text, (unsigned)i); - s += i; - *s = '\0'; - } - - if (s+2 >= be) - break; - *s++ = '"'; + if (s != t) + *s++ = ','; + strncpy(s, k->text, (unsigned)i); + s += i; *s = '\0'; - - ctl_putdata(buf, (unsigned)( s - buf ), 0); } - break; + if (s+2 >= be) + break; + + *s++ = '"'; + *s = '\0'; + ctl_putdata(buf, (unsigned)( s - buf ), 0); + } + break; } } #endif @@ -1610,15 +1825,14 @@ ctl_getitem( /* * Delete leading commas and white space */ - while (reqpt < reqend && (*reqpt == ',' || isspace((int)*reqpt))) { + while (reqpt < reqend && (*reqpt == ',' || + isspace((int)*reqpt))) reqpt++; - } - if (reqpt >= reqend) - return 0; + return (0); if (var_list == (struct ctl_var *)0) - return &eol; + return (&eol); /* * Look for a first character match on the tag. If we find @@ -1629,7 +1843,8 @@ ctl_getitem( while (!(v->flags & EOV)) { if (!(v->flags & PADDING) && *cp == *(v->text)) { tp = v->text; - while (*tp != '\0' && *tp != '=' && cp < reqend && *cp == *tp) { + while (*tp != '\0' && *tp != '=' && cp < + reqend && *cp == *tp) { cp++; tp++; } @@ -1649,16 +1864,29 @@ ctl_getitem( tp = buf; while (cp < reqend && isspace((int)*cp)) cp++; - while (cp < reqend && *cp != ',') + while (cp < reqend && *cp != ',') { *tp++ = *cp++; + if (tp >= buf + sizeof(buf)) { + ctl_error(CERR_BADFMT); + numctlbadpkts++; + msyslog(LOG_WARNING, + "Possible 'ntpdx' exploit from %s:%d (possibly spoofed)\n", + inet_ntoa(rmt_addr->sin_addr), ntohs(rmt_addr->sin_port) + ); + return (0); + } + } if (cp < reqend) cp++; - *tp = '\0'; - while (isspace((int)(*(tp-1)))) - *(--tp) = '\0'; + *tp-- = '\0'; + while (tp > buf) { + *tp-- = '\0'; + if (!isspace((int)(*tp))) + break; + } reqpt = cp; *data = buf; - return v; + return (v); } } cp = reqpt; @@ -1687,7 +1915,7 @@ control_unspec( * doesn't exist. */ if (res_associd != 0) { - if ((peer = findpeerbyassoc((int)res_associd)) == 0) { + if ((peer = findpeerbyassoc(res_associd)) == 0) { ctl_error(CERR_BADASSOC); return; } @@ -1701,7 +1929,7 @@ control_unspec( /* * read_status - return either a list of associd's, or a particular - * peer's status. + * peer's status. */ /*ARGSUSED*/ static void @@ -1712,14 +1940,14 @@ read_status( { register int i; register struct peer *peer; - u_short ass_stat[CTL_MAX_DATA_LEN/sizeof(u_short)]; + u_short ass_stat[CTL_MAX_DATA_LEN / sizeof(u_short)]; #ifdef DEBUG - if (debug >= 2) + if (debug > 2) printf("read_status: ID %d\n", res_associd); #endif /* - * Two choices here. If the specified association ID is + * Two choices here. If the specified association ID is * zero we return all known assocation ID's. Otherwise * we return a bunch of stuff about the particular peer. */ @@ -1730,22 +1958,25 @@ read_status( rpkt.status = htons(ctlsysstatus()); for (i = 0; i < HASH_SIZE; i++) { for (peer = assoc_hash[i]; peer != 0; - peer = peer->ass_next) { + peer = peer->ass_next) { ass_stat[n++] = htons(peer->associd); - ass_stat[n++] = htons(ctlpeerstatus(peer)); - if (n == CTL_MAX_DATA_LEN/sizeof(u_short)) { + ass_stat[n++] = + htons(ctlpeerstatus(peer)); + if (n == + CTL_MAX_DATA_LEN/sizeof(u_short)) { ctl_putdata((char *)ass_stat, - n * sizeof(u_short), 1); + n * sizeof(u_short), 1); n = 0; } } } if (n != 0) - ctl_putdata((char *)ass_stat, n * sizeof(u_short), 1); + ctl_putdata((char *)ass_stat, n * + sizeof(u_short), 1); ctl_flushpkt(0); } else { - peer = findpeerbyassoc((int)res_associd); + peer = findpeerbyassoc(res_associd); if (peer == 0) { ctl_error(CERR_BADASSOC); } else { @@ -1755,8 +1986,8 @@ read_status( if (res_authokay) peer->num_events = 0; /* - * For now, output everything we know about the peer. - * May be more selective later. + * For now, output everything we know about the + * peer. May be more selective later. */ for (cp = def_peer_var; *cp != 0; cp++) ctl_putpeer((int)*cp, peer); @@ -1780,11 +2011,11 @@ read_variables( register int i; char *valuep; u_char *wants; - unsigned int gotvar = (CS_MAXCODE>CP_MAXCODE) ? (CS_MAXCODE+1) : (CP_MAXCODE+1); - + unsigned int gotvar = (CS_MAXCODE > CP_MAXCODE) ? (CS_MAXCODE + + 1) : (CP_MAXCODE + 1); if (res_associd == 0) { /* - * Wants system variables. Figure out which he wants + * Wants system variables. Figure out which he wants * and give them to him. */ rpkt.status = htons(ctlsysstatus()); @@ -1796,13 +2027,15 @@ read_variables( gotvar = 0; while ((v = ctl_getitem(sys_var, &valuep)) != 0) { if (v->flags & EOV) { - if ((v = ctl_getitem(ext_sys_var, &valuep)) != 0) { + if ((v = ctl_getitem(ext_sys_var, + &valuep)) != 0) { if (v->flags & EOV) { ctl_error(CERR_UNKNOWNVAR); free((char *)wants); return; } - wants[CS_MAXCODE+1+v->code] = 1; + wants[CS_MAXCODE + 1 + + v->code] = 1; gotvar = 1; continue; } else { @@ -1815,35 +2048,38 @@ read_variables( if (gotvar) { for (i = 1; i <= CS_MAXCODE; i++) if (wants[i]) - ctl_putsys(i); - for (i = 0; ext_sys_var && !(ext_sys_var[i].flags & EOV); i++) - if (wants[i+CS_MAXCODE+1]) - ctl_putdata(ext_sys_var[i].text, - strlen(ext_sys_var[i].text), 0); + ctl_putsys(i); + for (i = 0; ext_sys_var && + !(ext_sys_var[i].flags & EOV); i++) + if (wants[i + CS_MAXCODE + 1]) + ctl_putdata(ext_sys_var[i].text, + strlen(ext_sys_var[i].text), + 0); } else { register u_char *cs; register struct ctl_var *kv; for (cs = def_sys_var; *cs != 0; cs++) ctl_putsys((int)*cs); - for (kv = ext_sys_var; kv && !(kv->flags & EOV); kv++) + for (kv = ext_sys_var; kv && !(kv->flags & EOV); + kv++) if (kv->flags & DEF) - ctl_putdata(kv->text, strlen(kv->text), 0); + ctl_putdata(kv->text, + strlen(kv->text), 0); } free((char *)wants); } else { register struct peer *peer; /* - * Wants info for a particular peer. See if we know + * Wants info for a particular peer. See if we know * the guy. */ - peer = findpeerbyassoc((int)res_associd); + peer = findpeerbyassoc(res_associd); if (peer == 0) { ctl_error(CERR_BADASSOC); return; } - rpkt.status = htons(ctlpeerstatus(peer)); if (res_authokay) peer->num_events = 0; @@ -1862,7 +2098,7 @@ read_variables( if (gotvar) { for (i = 1; i <= CP_MAXCODE; i++) if (wants[i]) - ctl_putpeer(i, peer); + ctl_putpeer(i, peer); } else { register u_char *cp; @@ -1876,8 +2112,8 @@ read_variables( /* - * write_variables - write into variables. We only allow leap bit writing - * this way. + * write_variables - write into variables. We only allow leap bit + * writing this way. */ /*ARGSUSED*/ static void @@ -1890,7 +2126,6 @@ write_variables( register int ext_var; char *valuep; long val; - /*int leapind, leapwarn;*/ /* * If he's trying to write into a peer tell him no way @@ -1906,20 +2141,14 @@ write_variables( rpkt.status = htons(ctlsysstatus()); /* - * Set flags to not-in-sync so we can tell when we get something. - */ - /* - leapind = ~0; - leapwarn = ~0; - */ - - /* - * Look through the variables. Dump out at the first sign of trouble. + * Look through the variables. Dump out at the first sign of + * trouble. */ while ((v = ctl_getitem(sys_var, &valuep)) != 0) { ext_var = 0; if (v->flags & EOV) { - if ((v = ctl_getitem(ext_sys_var, &valuep)) != 0) { + if ((v = ctl_getitem(ext_sys_var, &valuep)) != + 0) { if (v->flags & EOV) { ctl_error(CERR_UNKNOWNVAR); return; @@ -1933,7 +2162,8 @@ write_variables( ctl_error(CERR_PERMISSION); return; } - if (!ext_var && (*valuep == '\0' || !atoint(valuep, &val))) { + if (!ext_var && (*valuep == '\0' || !atoint(valuep, + &val))) { ctl_error(CERR_BADFMT); return; } @@ -1943,7 +2173,8 @@ write_variables( } if (ext_var) { - char *s = (char *)emalloc(strlen(v->text)+strlen(valuep)+2); + char *s = (char *)emalloc(strlen(v->text) + + strlen(valuep) + 2); const char *t; char *tt = s; @@ -1953,24 +2184,24 @@ write_variables( *tt++ = '='; strcat(tt, valuep); - set_sys_var(s, strlen(s)+1, v->flags); free(s); } else { /* - * This one seems sane. Save it. + * This one seems sane. Save it. */ switch(v->code) { - case CS_LEAP: - default: - ctl_error(CERR_UNSPEC); /* our fault, really */ + + case CS_LEAP: + default: + ctl_error(CERR_UNSPEC); /* really */ return; } } } /* - * If we got anything, do it. + * If we got anything, do it. xxx nothing to do *** */ /* if (leapind != ~0 || leapwarn != ~0) { @@ -2009,18 +2240,20 @@ read_clock_status( struct refclockstat clock_stat; if (res_associd == 0) { + /* * Find a clock for this jerk. If the system peer * is a clock use it, else search the hash tables * for one. */ - if (sys_peer != 0 && (sys_peer->flags & FLAG_REFCLOCK)) { + if (sys_peer != 0 && (sys_peer->flags & FLAG_REFCLOCK)) + { peer = sys_peer; } else { peer = 0; for (i = 0; peer == 0 && i < HASH_SIZE; i++) { for (peer = assoc_hash[i]; peer != 0; - peer = peer->ass_next) { + peer = peer->ass_next) { if (peer->flags & FLAG_REFCLOCK) break; } @@ -2031,7 +2264,7 @@ read_clock_status( } } } else { - peer = findpeerbyassoc((int)res_associd); + peer = findpeerbyassoc(res_associd); if (peer == 0 || !(peer->flags & FLAG_REFCLOCK)) { ctl_error(CERR_BADASSOC); return; @@ -2039,30 +2272,32 @@ read_clock_status( } /* - * If we got here we have a peer which is a clock. Get his status. + * If we got here we have a peer which is a clock. Get his + * status. */ clock_stat.kv_list = (struct ctl_var *)0; - - refclock_control(&peer->srcadr, (struct refclockstat *)0, &clock_stat); + refclock_control(&peer->srcadr, (struct refclockstat *)0, + &clock_stat); /* * Look for variables in the packet. */ rpkt.status = htons(ctlclkstatus(&clock_stat)); - gotvar = CC_MAXCODE+1+count_var(clock_stat.kv_list); + gotvar = CC_MAXCODE + 1 + count_var(clock_stat.kv_list); wants = (u_char *)emalloc(gotvar); memset((char*)wants, 0, gotvar); gotvar = 0; while ((v = ctl_getitem(clock_var, &valuep)) != 0) { if (v->flags & EOV) { - if ((v = ctl_getitem(clock_stat.kv_list, &valuep)) != 0) { + if ((v = ctl_getitem(clock_stat.kv_list, + &valuep)) != 0) { if (v->flags & EOV) { ctl_error(CERR_UNKNOWNVAR); free((char*)wants); free_varlist(clock_stat.kv_list); return; } - wants[CC_MAXCODE+1+v->code] = 1; + wants[CC_MAXCODE + 1 + v->code] = 1; gotvar = 1; continue; } else { @@ -2077,19 +2312,23 @@ read_clock_status( for (i = 1; i <= CC_MAXCODE; i++) if (wants[i]) ctl_putclock(i, &clock_stat, 1); - for (i = 0; clock_stat.kv_list && !(clock_stat.kv_list[i].flags & EOV); i++) - if (wants[i+CC_MAXCODE+1]) - ctl_putdata(clock_stat.kv_list[i].text, - strlen(clock_stat.kv_list[i].text), 0); + for (i = 0; clock_stat.kv_list && + !(clock_stat.kv_list[i].flags & EOV); i++) + if (wants[i + CC_MAXCODE + 1]) + ctl_putdata(clock_stat.kv_list[i].text, + strlen(clock_stat.kv_list[i].text), + 0); } else { register u_char *cc; register struct ctl_var *kv; for (cc = def_clock_var; *cc != 0; cc++) ctl_putclock((int)*cc, &clock_stat, 0); - for (kv = clock_stat.kv_list; kv && !(kv->flags & EOV); kv++) + for (kv = clock_stat.kv_list; kv && !(kv->flags & EOV); + kv++) if (kv->flags & DEF) - ctl_putdata(kv->text, strlen(kv->text), 0); + ctl_putdata(kv->text, strlen(kv->text), + 0); } free((char*)wants); @@ -2114,11 +2353,10 @@ write_clock_status( } /* - * Trap support from here on down. We send async trap messages when the - * upper levels report trouble. Traps can by set either by control + * Trap support from here on down. We send async trap messages when the + * upper levels report trouble. Traps can by set either by control * messages or by configuration. */ - /* * set_trap - set a trap in response to a control message */ @@ -2150,7 +2388,7 @@ set_trap( * an error if it can't assign the trap. */ if (!ctlsettrap(&rbufp->recv_srcadr, rbufp->dstadr, traptype, - (int)res_version)) + (int)res_version)) ctl_error(CERR_NORESOURCE); ctl_flushpkt(0); } @@ -2168,11 +2406,10 @@ unset_trap( int traptype; /* - * We don't prevent anyone from removing his own - * trap unless the trap is configured. Note we also - * must be aware of the possibility that restriction - * flags were changed since this guy last set his trap. - * Set the trap type based on this. + * We don't prevent anyone from removing his own trap unless the + * trap is configured. Note we also must be aware of the + * possibility that restriction flags were changed since this + * guy last set his trap. Set the trap type based on this. */ traptype = TRAP_TYPE_PRIO; if (restrict_mask & RES_LPTRAP) @@ -2207,69 +2444,77 @@ ctlsettrap( */ if ((tp = ctlfindtrap(raddr, linter)) != NULL) { switch (traptype) { - case TRAP_TYPE_CONFIG: + + case TRAP_TYPE_CONFIG: tp->tr_flags = TRAP_INUSE|TRAP_CONFIGURED; break; - case TRAP_TYPE_PRIO: + + case TRAP_TYPE_PRIO: if (tp->tr_flags & TRAP_CONFIGURED) - return 1; /* don't change anything */ + return (1); /* don't change anything */ tp->tr_flags = TRAP_INUSE; break; - case TRAP_TYPE_NONPRIO: + + case TRAP_TYPE_NONPRIO: if (tp->tr_flags & TRAP_CONFIGURED) - return 1; /* don't change anything */ + return (1); /* don't change anything */ tp->tr_flags = TRAP_INUSE|TRAP_NONPRIO; break; } tp->tr_settime = current_time; tp->tr_resets++; - return 1; + return (1); } /* * First we heard of this guy. Try to find a trap structure * for him to use, clearing out lesser priority guys if we - * have to. Clear out anyone who's expired while we're at it. + * have to. Clear out anyone who's expired while we're at it. */ tptouse = NULL; for (tp = ctl_trap; tp < &ctl_trap[CTL_MAXTRAPS]; tp++) { if ((tp->tr_flags & TRAP_INUSE) && - !(tp->tr_flags & TRAP_CONFIGURED) && - ((tp->tr_settime + CTL_TRAPTIME) > current_time)) { + !(tp->tr_flags & TRAP_CONFIGURED) && + ((tp->tr_settime + CTL_TRAPTIME) > current_time)) { tp->tr_flags = 0; num_ctl_traps--; } - if (!(tp->tr_flags & TRAP_INUSE)) { tptouse = tp; } else if (!(tp->tr_flags & TRAP_CONFIGURED)) { switch (traptype) { - case TRAP_TYPE_CONFIG: + + case TRAP_TYPE_CONFIG: if (tptouse == NULL) { tptouse = tp; break; } - if (tptouse->tr_flags & TRAP_NONPRIO - && !(tp->tr_flags & TRAP_NONPRIO)) + if (tptouse->tr_flags & TRAP_NONPRIO && + !(tp->tr_flags & TRAP_NONPRIO)) break; + if (!(tptouse->tr_flags & TRAP_NONPRIO) - && tp->tr_flags & TRAP_NONPRIO) { + && tp->tr_flags & TRAP_NONPRIO) { tptouse = tp; break; } - if (tptouse->tr_origtime < tp->tr_origtime) + if (tptouse->tr_origtime < + tp->tr_origtime) tptouse = tp; break; - case TRAP_TYPE_PRIO: + + case TRAP_TYPE_PRIO: if (tp->tr_flags & TRAP_NONPRIO) { if (tptouse == NULL || - (tptouse->tr_flags & TRAP_INUSE - && tptouse->tr_origtime - < tp->tr_origtime)) + (tptouse->tr_flags & + TRAP_INUSE && + tptouse->tr_origtime < + tp->tr_origtime)) tptouse = tp; } break; - case TRAP_TYPE_NONPRIO: + + case TRAP_TYPE_NONPRIO: break; } } @@ -2279,7 +2524,7 @@ ctlsettrap( * If we don't have room for him return an error. */ if (tptouse == NULL) - return 0; + return (0); /* * Set up this structure for him. @@ -2290,19 +2535,18 @@ ctlsettrap( tptouse->tr_addr = *raddr; tptouse->tr_localaddr = linter; tptouse->tr_version = version; - tptouse->tr_flags = TRAP_INUSE; if (traptype == TRAP_TYPE_CONFIG) tptouse->tr_flags |= TRAP_CONFIGURED; else if (traptype == TRAP_TYPE_NONPRIO) tptouse->tr_flags |= TRAP_NONPRIO; num_ctl_traps++; - return 1; + return (1); } /* - * ctlclrtrap - called to clr a trap + * ctlclrtrap - called to clear a trap */ int ctlclrtrap( @@ -2314,15 +2558,15 @@ ctlclrtrap( register struct ctl_trap *tp; if ((tp = ctlfindtrap(raddr, linter)) == NULL) - return 0; + return (0); if (tp->tr_flags & TRAP_CONFIGURED && traptype != TRAP_TYPE_CONFIG) - return 0; + return (0); tp->tr_flags = 0; num_ctl_traps--; - return 1; + return (1); } @@ -2338,11 +2582,11 @@ ctlfindtrap( register struct ctl_trap *tp; for (tp = ctl_trap; tp < &ctl_trap[CTL_MAXTRAPS]; tp++) { - if (tp->tr_flags & TRAP_INUSE - && NSRCADR(raddr) == NSRCADR(&tp->tr_addr) - && NSRCPORT(raddr) == NSRCPORT(&tp->tr_addr) - && linter == tp->tr_localaddr) - return tp; + if (tp->tr_flags & TRAP_INUSE && NSRCADR(raddr) == + NSRCADR(&tp->tr_addr) && NSRCPORT(raddr) == + NSRCPORT(&tp->tr_addr) && linter == + tp->tr_localaddr) + return (tp); } return (struct ctl_trap *)NULL; } @@ -2368,14 +2612,15 @@ report_event( ctl_sys_num_events++; if (ctl_sys_last_event != (u_char)err) { NLOG(NLOG_SYSEVENT) - msyslog(LOG_INFO, "system event '%s' (0x%02x) status '%s' (0x%02x)", - eventstr(err), err, - sysstatstr(ctlsysstatus()), ctlsysstatus()); + msyslog(LOG_INFO, "system event '%s' (0x%02x) status '%s' (0x%02x)", + eventstr(err), err, + sysstatstr(ctlsysstatus()), ctlsysstatus()); #ifdef DEBUG if (debug) printf("report_event: system event '%s' (0x%02x) status '%s' (0x%02x)\n", - eventstr(err), err, - sysstatstr(ctlsysstatus()), ctlsysstatus()); + eventstr(err), err, + sysstatstr(ctlsysstatus()), + ctlsysstatus()); #endif ctl_sys_last_event = (u_char)err; } @@ -2393,19 +2638,25 @@ report_event( if (peer->num_events < CTL_PEER_MAXEVENTS) peer->num_events++; NLOG(NLOG_PEEREVENT) - msyslog(LOG_INFO, "peer %s event '%s' (0x%02x) status '%s' (0x%02x)", - src, eventstr(err), err, - peerstatstr(ctlpeerstatus(peer)), ctlpeerstatus(peer)); + msyslog(LOG_INFO, "peer %s event '%s' (0x%02x) status '%s' (0x%02x)", + src, eventstr(err), err, + peerstatstr(ctlpeerstatus(peer)), + ctlpeerstatus(peer)); #ifdef DEBUG if (debug) printf( "peer %s event '%s' (0x%02x) status '%s' (0x%02x)\n", - src, eventstr(err), err, - peerstatstr(ctlpeerstatus(peer)), ctlpeerstatus(peer)); + src, eventstr(err), err, + peerstatstr(ctlpeerstatus(peer)), + ctlpeerstatus(peer)); #endif } else { - msyslog(LOG_ERR, "report_event: err '%s' (0x%02x), no peer", eventstr(err), err); + msyslog(LOG_ERR, + "report_event: err '%s' (0x%02x), no peer", + eventstr(err), err); #ifdef DEBUG - printf("report_event: peer event '%s' (0x%02x), no peer\n", eventstr(err), err); + printf( + "report_event: peer event '%s' (0x%02x), no peer\n", + eventstr(err), err); #endif return; } @@ -2425,38 +2676,42 @@ report_event( res_authenticate = 0; datapt = rpkt.data; dataend = &(rpkt.data[CTL_MAX_DATA_LEN]); - if (!(err & PEER_EVENT)) { rpkt.associd = 0; rpkt.status = htons(ctlsysstatus()); /* * For now, put everything we know about system - * variables. Maybe more selective later + * variables. Don't send crypto strings. */ - for (i = 1; i <= CS_MAXCODE; i++) + for (i = 1; i <= CS_MAXCODE; i++) { +#ifdef PUBKEY + if (i > CS_VARLIST) + continue; +#endif /* PUBKEY */ ctl_putsys(i); + } #ifdef REFCLOCK /* - * for clock exception events: - * add clock variables to reflect info on exception + * for clock exception events: add clock variables to + * reflect info on exception */ if (err == EVNT_CLOCKEXCPT) { struct refclockstat clock_stat; struct ctl_var *kv; clock_stat.kv_list = (struct ctl_var *)0; - refclock_control(&peer->srcadr, - (struct refclockstat *)0, &clock_stat); - ctl_puthex("refclockstatus", ctlclkstatus(&clock_stat)); - + (struct refclockstat *)0, &clock_stat); + ctl_puthex("refclockstatus", + ctlclkstatus(&clock_stat)); for (i = 1; i <= CC_MAXCODE; i++) ctl_putclock(i, &clock_stat, 0); - for (kv = clock_stat.kv_list; kv && !(kv->flags & EOV); kv++) + for (kv = clock_stat.kv_list; kv && + !(kv->flags & EOV); kv++) if (kv->flags & DEF) - ctl_putdata(kv->text, strlen(kv->text), 0); - + ctl_putdata(kv->text, + strlen(kv->text), 0); free_varlist(clock_stat.kv_list); } #endif /*REFCLOCK*/ @@ -2465,34 +2720,37 @@ report_event( rpkt.status = htons(ctlpeerstatus(peer)); /* - * Dump it all. Later, maybe less. + * Dump it all. Later, maybe less. */ for (i = 1; i <= CP_MAXCODE; i++) +#ifdef PUBKEY + if (i > CP_VARLIST) + continue; +#endif /* PUBKEY */ ctl_putpeer(i, peer); #ifdef REFCLOCK /* - * for clock exception events: - * add clock variables to reflect info on exception + * for clock exception events: add clock variables to + * reflect info on exception */ if (err == EVNT_PEERCLOCK) { struct refclockstat clock_stat; struct ctl_var *kv; clock_stat.kv_list = (struct ctl_var *)0; - refclock_control(&peer->srcadr, - (struct refclockstat *)0, - &clock_stat); + (struct refclockstat *)0, &clock_stat); ctl_puthex("refclockstatus", - ctlclkstatus(&clock_stat)); + ctlclkstatus(&clock_stat)); for (i = 1; i <= CC_MAXCODE; i++) ctl_putclock(i, &clock_stat, 0); - for (kv = clock_stat.kv_list; kv && !(kv->flags & EOV); kv++) + for (kv = clock_stat.kv_list; kv && + !(kv->flags & EOV); kv++) if (kv->flags & DEF) - ctl_putdata(kv->text, strlen(kv->text), 0); - + ctl_putdata(kv->text, + strlen(kv->text), 0); free_varlist(clock_stat.kv_list); } #endif /*REFCLOCK*/ @@ -2537,14 +2795,12 @@ count_var( register u_long c; if (!k) - return 0; + return (0); c = 0; - while (!(k++->flags & EOV)) - c++; - - return c; + c++; + return (c); } char * @@ -2561,12 +2817,11 @@ add_var( k = *kv; *kv = (struct ctl_var *)emalloc((c+2)*sizeof(struct ctl_var)); - if (k) - { - memmove((char *)*kv, (char *)k, sizeof(struct ctl_var)*c); + if (k) { + memmove((char *)*kv, (char *)k, + sizeof(struct ctl_var)*c); free((char *)k); } - (*kv)[c].code = (u_short) c; (*kv)[c].text = (char *)emalloc(size); (*kv)[c].flags = def; @@ -2592,21 +2847,16 @@ set_var( if (!data || !size) return; - if ((k = *kv)) - { - while (!(k->flags & EOV)) - { + if ((k = *kv)) { + while (!(k->flags & EOV)) { s = data; t = k->text; - if (t) - { - while (*t != '=' && *s - *t == 0) - { + if (t) { + while (*t != '=' && *s - *t == 0) { s++; t++; } - if (*s == *t && ((*t == '=') || !*t)) - { + if (*s == *t && ((*t == '=') || !*t)) { free((void *)k->text); td = (char *)emalloc(size); memmove(td, data, size); @@ -2614,9 +2864,7 @@ set_var( k->flags = def; return; } - } - else - { + } else { td = (char *)emalloc(size); memmove(td, data, size); k->text = td; @@ -2646,10 +2894,9 @@ free_varlist( ) { struct ctl_var *k; - if (kv) - { + if (kv) { for (k = kv; !(k->flags & EOV); k++) - free((void *)k->text); + free((void *)k->text); free((void *)kv); } } diff --git a/contrib/ntp/ntpd/ntp_crypto.c b/contrib/ntp/ntpd/ntp_crypto.c new file mode 100644 index 0000000..d8516b5 --- /dev/null +++ b/contrib/ntp/ntpd/ntp_crypto.c @@ -0,0 +1,2060 @@ +/* + * ntp_crypto.c - NTP version 4 public key routines + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef AUTOKEY +#include <stdio.h> +#include <sys/types.h> +#include <unistd.h> +#include <fcntl.h> + +#include "ntpd.h" +#include "ntp_stdlib.h" +#include "ntp_string.h" +#include "ntp_crypto.h" + +#ifdef KERNEL_PLL +#include "ntp_syscall.h" +#endif /* KERNEL_PLL */ + +/* + * Extension field message formats + * + * +-------+-------+ +-------+-------+ +-------+-------+ + * 0 | 3 | len | | 2,4 | len | | 5-9 | len | + * +-------+-------+ +-------+-------+ +-------+-------+ + * 1 | assocID | | assocID | | assocID | + * +---------------+ +---------------+ +---------------+ + * 2 | timestamp | | timestamp | | timestamp | + * +---------------+ +---------------+ +---------------+ + * 3 | final seq | | cookie/flags | | filestamp | + * +---------------+ +---------------+ +---------------+ + * 4 | final key | | signature len | | value len | + * +---------------+ +---------------+ +---------------+ + * 5 | signature len | | | | | + * +---------------+ = signature = = value = + * 6 | | | | | | + * = signature = +---------------+ +---------------+ + * 7 | | CRYPTO_ASSOC rsp | signature len | + * +---------------+ CRYPTO_PRIV rsp +---------------+ + * CRYPTO_AUTO rsp | | + * = signature = + * | | + * +---------------+ + * CRYPTO_DHPAR rsp + * CRYPTO_DH rsp + * CRYPTO_NAME rsp + * CRYPTO_CERT rsp + * CRYPTO_TAI rsp + * + * CRYPTO_STAT 1 - offer/select + * CRYPTO_ASSOC 2 20 association ID + * CRYPTO_AUTO 3 88 autokey values + * CRYPTO_PRIV 4 84 cookie value + * CRYPTO_DHPAR 5 220 agreement parameters + * CRYPTO_DH 6 152 public value + * CRYPTO_NAME 7 460 host name/public key + * CRYPTO_CERT 8 ? certificate + * CRYPTO_TAI 9 144 leapseconds table + * + * Note: requests carry the association ID of the receiver; responses + * carry the association ID of the sender. + */ +/* + * Minimum sizes of fields + */ +#define COOKIE_LEN (5 * 4) +#define AUTOKEY_LEN (6 * 4) +#define VALUE_LEN (6 * 4) + +/* + * Global cryptodata in host byte order. + */ +u_int crypto_flags; /* status word */ +u_int sys_tai; /* current UTC offset from TAI */ + +#ifdef PUBKEY +/* + * Cryptodefines + */ +#define TAI_1972 10 /* initial TAI offset */ +#define MAX_LEAP 100 /* max UTC leapseconds */ +#define MAX_LINLEN 1024 /* max line */ +#define MAX_KEYLEN 1024 /* max key */ +#define MAX_ENCLEN (ENCODED_CONTENT_LEN(1024)) /* max enc key */ + +/* + * Private cryptodata in network byte order. + */ +static R_RSA_PRIVATE_KEY private_key; /* private key */ +static R_RSA_PUBLIC_KEY public_key; /* public key */ +static R_DH_PARAMS dh_params; /* agreement parameters */ +static u_char *dh_private; /* private value */ +static u_int dh_keyLen; /* private value length */ +static char *keysdir = NTP_KEYSDIR; /* crypto keys directory */ +static char *private_key_file = NULL; /* private key file */ +static char *public_key_file = NULL; /* public key file */ +static char *certif_file = NULL; /* certificate file */ +static char *dh_params_file = NULL; /* agreement parameters file */ +static char *tai_leap_file = NULL; /* leapseconds file */ + +/* + * Global cryptodata in network byte order + */ +struct value host; /* host name/public key */ +struct value certif; /* certificate */ +struct value dhparam; /* agreement parameters */ +struct value dhpub; /* public value */ +struct value tai_leap; /* leapseconds table */ + +/* + * Cryptotypes + */ +static u_int crypto_rsa P((char *, u_char *, u_int)); +static void crypto_cert P((char *)); +static void crypto_dh P((char *)); +static void crypto_tai P((char *)); +#endif /* PUBKEY */ + +/* + * Autokey protocol status codes + */ +#define RV_OK 0 /* success */ +#define RV_LEN 1 /* invalid field length */ +#define RV_TSP 2 /* invalid timestamp */ +#define RV_FSP 3 /* invalid filestamp */ +#define RV_PUB 4 /* missing public key */ +#define RV_KEY 5 /* invalid RSA modulus */ +#define RV_SIG 6 /* invalid signature length */ +#define RV_DH 7 /* invalid agreement parameters */ +#define RV_FIL 8 /* missing or corrupted key file */ +#define RV_DAT 9 /* missing or corrupted data */ +#define RV_DEC 10 /* PEM decoding error */ +#define RV_DUP 11 /* duplicate flags */ +#define RV_VN 12 /* incorrect version */ + +/* + * session_key - generate session key + * + * This routine generates a session key from the source address, + * destination address, key ID and private value. The value of the + * session key is the MD5 hash of these values, while the next key ID is + * the first four octets of the hash. + */ +keyid_t /* returns next key ID */ +session_key( + struct sockaddr_in *srcadr, /* source address */ + struct sockaddr_in *dstadr, /* destination address */ + keyid_t keyno, /* key ID */ + keyid_t private, /* private value */ + u_long lifetime /* key lifetime */ + ) +{ + MD5_CTX ctx; /* MD5 context */ + keyid_t keyid; /* key identifer */ + u_int32 header[4]; /* data in network byte order */ + u_char digest[16]; /* message digest */ + + /* + * Generate the session key and key ID. If the lifetime is + * greater than zero, install the key and call it trusted. + */ + header[0] = srcadr->sin_addr.s_addr; + header[1] = dstadr->sin_addr.s_addr; + header[2] = htonl(keyno); + header[3] = htonl(private); + MD5Init(&ctx); + MD5Update(&ctx, (u_char *)header, sizeof(header)); + MD5Final(digest, &ctx); + memcpy(&keyid, digest, 4); + keyid = ntohl(keyid); + if (lifetime != 0) { + MD5auth_setkey(keyno, digest, 16); + authtrust(keyno, lifetime); + } +#ifdef DEBUG + if (debug > 1) + printf( + "session_key: %s > %s %08x %08x hash %08x life %lu\n", + numtoa(header[0]), numtoa(header[1]), keyno, + private, keyid, lifetime); +#endif + return (keyid); +} + + +/* + * make_keylist - generate key list + * + * This routine constructs a pseudo-random sequence by repeatedly + * hashing the session key starting from a given source address, + * destination address, private value and the next key ID of the + * preceeding session key. The last entry on the list is saved along + * with its sequence number and public signature. + */ +void +make_keylist( + struct peer *peer, /* peer structure pointer */ + struct interface *dstadr /* interface */ + ) +{ + struct autokey *ap; /* autokey pointer */ + keyid_t keyid; /* next key ID */ + keyid_t cookie; /* private value */ + l_fp tstamp; /* NTP timestamp */ + u_long ltemp; + int i; +#ifdef PUBKEY + R_SIGNATURE_CTX ctx; /* signature context */ + int rval; /* return value */ + u_int len; +#endif /* PUBKEY */ + + /* + * Allocate the key list if necessary. + */ + L_CLR(&tstamp); + if (sys_leap != LEAP_NOTINSYNC) + get_systime(&tstamp); + if (peer->keylist == NULL) + peer->keylist = (keyid_t *)emalloc(sizeof(keyid_t) * + NTP_MAXSESSION); + + /* + * Generate an initial key ID which is unique and greater than + * NTP_MAXKEY. + */ + while (1) { + keyid = (u_long)RANDOM & 0xffffffff; + if (keyid <= NTP_MAXKEY) + continue; + if (authhavekey(keyid)) + continue; + break; + } + + /* + * Generate up to NTP_MAXSESSION session keys. Stop if the + * next one would not be unique or not a session key ID or if + * it would expire before the next poll. The private value + * included in the hash is zero if broadcast mode, the peer + * cookie if client mode or the host cookie if symmetric modes. + */ + ltemp = min(sys_automax, NTP_MAXSESSION * (1 << (peer->kpoll))); + peer->hcookie = session_key(&dstadr->sin, &peer->srcadr, 0, + sys_private, 0); + if (peer->hmode == MODE_BROADCAST) + cookie = 0; + else + cookie = peer->pcookie.key; + for (i = 0; i < NTP_MAXSESSION; i++) { + peer->keylist[i] = keyid; + peer->keynumber = i; + keyid = session_key(&dstadr->sin, &peer->srcadr, keyid, + cookie, ltemp); + ltemp -= 1 << peer->kpoll; + if (auth_havekey(keyid) || keyid <= NTP_MAXKEY || + ltemp <= (1 << (peer->kpoll))) + break; + } + + /* + * Save the last session key ID, sequence number and timestamp, + * then sign these values for later retrieval by the clients. Be + * careful not to use invalid key media. + */ + ap = &peer->sndauto; + ap->tstamp = htonl(tstamp.l_ui); + ap->seq = htonl(peer->keynumber); + ap->key = htonl(keyid); + ap->siglen = 0; +#if DEBUG + if (debug) + printf("make_keys: %d %08x %08x ts %u poll %d\n", + ntohl(ap->seq), ntohl(ap->key), cookie, + ntohl(ap->tstamp), peer->kpoll); +#endif +#ifdef PUBKEY + if(!crypto_flags) + return; + if (ap->sig == NULL) + ap->sig = emalloc(private_key.bits / 8); + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)ap, 12); + rval = EVP_SignFinal(&ctx, ap->sig, &len, &private_key); + if (rval != RV_OK) + msyslog(LOG_ERR, "crypto: keylist signature fails %x", + rval); + else + ap->siglen = htonl(len); + peer->flags |= FLAG_ASSOC; +#endif /* PUBKEY */ +} + + +/* + * crypto_recv - parse extension fields + * + * This routine is called when the packet has been matched to an + * association and passed sanity, format and MAC checks. We believe the + * extension field values only if the field has proper format and + * length, the timestamp and filestamp are valid and the signature has + * valid length and is verified. There are a few cases where some values + * are believed even if the signature fails, but only if the authentic + * bit is not set. + */ +void +crypto_recv( + struct peer *peer, /* peer structure pointer */ + struct recvbuf *rbufp /* packet buffer pointer */ + ) +{ + u_int32 *pkt; /* packet pointer */ + struct autokey *ap; /* autokey pointer */ + struct cookie *cp; /* cookie pointer */ + int has_mac; /* length of MAC field */ + int authlen; /* offset of MAC field */ + int len; /* extension field length */ + u_int code; /* extension field opcode */ + tstamp_t tstamp; /* timestamp */ + int i, rval; + u_int temp; +#ifdef PUBKEY + R_SIGNATURE_CTX ctx; /* signature context */ + struct value *vp; /* value pointer */ + u_char dh_key[MAX_KEYLEN]; /* agreed key */ + R_RSA_PUBLIC_KEY *kp; /* temporary public key pointer */ + tstamp_t fstamp; /* filestamp */ + u_int32 *pp; /* packet pointer */ + u_int rsalen = sizeof(R_RSA_PUBLIC_KEY) - sizeof(u_int) + 4; + u_int bits; + int j; +#ifdef KERNEL_PLL +#if NTP_API > 3 + struct timex ntv; /* kernel interface structure */ +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ +#endif /* PUBKEY */ + + /* + * Initialize. Note that the packet has already been checked for + * valid format and extension field lengths. We first extract + * the field length, command code and timestamp in host byte + * order. These are used with all commands and modes. We discard + * old timestamps and filestamps; but, for duplicate timestamps + * we discard only if the authentic bit is set. Cute. + */ + pkt = (u_int32 *)&rbufp->recv_pkt; + authlen = LEN_PKT_NOMAC; + while ((has_mac = rbufp->recv_length - authlen) > MAX_MAC_LEN) { + i = authlen / 4; + len = ntohl(pkt[i]) & 0xffff; + code = (ntohl(pkt[i]) >> 16) & 0xffff; + temp = (code >> 8) & 0x3f; + if (temp != CRYPTO_VN) { + sys_unknownversion++; +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: incorrect version %d should be %d\n", + temp, CRYPTO_VN); +#endif + return; + } + tstamp = ntohl(pkt[i + 2]); +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: ext offset %d len %d code %x assocID %d\n", + authlen, len, code, (u_int32)ntohl(pkt[i + + 1])); +#endif + switch (code) { + + /* + * Install association ID and status word. + */ + case CRYPTO_ASSOC | CRYPTO_RESP: + cp = (struct cookie *)&pkt[i + 2]; + temp = ntohl(cp->key); + if (len < COOKIE_LEN) { + rval = RV_LEN; + } else if (tstamp == 0) { + rval = RV_TSP; + } else { + if (!peer->crypto) + peer->crypto = temp; + if (ntohl(pkt[i + 1]) != 0) + peer->assoc = ntohl(pkt[i + 1]); + rval = RV_OK; + } +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %d flags 0x%x ts %u\n", + rval, temp, tstamp); +#endif + break; + + /* + * Install autokey values in broadcast client and + * symmetric modes. + */ + case CRYPTO_AUTO | CRYPTO_RESP: + if (!(peer->flags & FLAG_AUTOKEY) && + ntohl(pkt[i + 1]) != 0) + peer->assoc = ntohl(pkt[i + 1]); + ap = (struct autokey *)&pkt[i + 2]; +#ifdef PUBKEY + temp = ntohl(ap->siglen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + if (len < AUTOKEY_LEN) { + rval = RV_LEN; + } else if (tstamp == 0 || tstamp < + peer->recauto.tstamp || (tstamp == + peer->recauto.tstamp && (peer->flags & + FLAG_AUTOKEY))) { + rval = RV_TSP; + } else if (!crypto_flags) { + rval = RV_OK; + } else if (kp == NULL) { + rval = RV_PUB; + } else if (temp != kp->bits / 8) { + rval = RV_SIG; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)ap, + 12); + rval = EVP_VerifyFinal(&ctx, + (u_char *)ap->pkt, temp, kp); + } +#else /* PUBKEY */ + if (tstamp < peer->recauto.tstamp || (tstamp == + peer->recauto.tstamp && (peer->flags & + FLAG_AUTOKEY))) + rval = RV_TSP; + else + rval = RV_OK; +#endif /* PUBKEY */ +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x autokey %d %08x ts %u (%u)\n", + rval, ntohl(ap->seq), + ntohl(ap->key), tstamp, + peer->recauto.tstamp); +#endif + if (rval != RV_OK) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x autokey %d %08x ts %u (%u)\n", + rval, ntohl(ap->seq), + ntohl(ap->key), tstamp, + peer->recauto.tstamp); + break; + } + peer->flags |= FLAG_AUTOKEY; + peer->flash &= ~TEST10; + peer->assoc = ntohl(pkt[i + 1]); + peer->recauto.tstamp = tstamp; + peer->recauto.seq = ntohl(ap->seq); + peer->recauto.key = ntohl(ap->key); + peer->pkeyid = peer->recauto.key; + break; + + /* + * Install session cookie in client mode. Use this also + * in symmetric modes for test when rsaref20 has not + * been installed. + */ + case CRYPTO_PRIV: + peer->cmmd = ntohl(pkt[i]); + /* fall through */ + + case CRYPTO_PRIV | CRYPTO_RESP: + cp = (struct cookie *)&pkt[i + 2]; +#ifdef PUBKEY + temp = ntohl(cp->siglen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + if (len < COOKIE_LEN) { + rval = RV_LEN; + } else if (tstamp == 0 || tstamp < + peer->pcookie.tstamp || (tstamp == + peer->pcookie.tstamp && (peer->flags & + FLAG_AUTOKEY))) { + rval = RV_TSP; + } else if (!crypto_flags) { + rval = RV_OK; + } else if (kp == NULL) { + rval = RV_PUB; + } else if (temp != kp->bits / 8) { + rval = RV_SIG; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)cp, 8); + rval = EVP_VerifyFinal(&ctx, + (u_char *)cp->pkt, temp, kp); + } +#else /* PUBKEY */ + if (tstamp <= peer->pcookie.tstamp || (tstamp == + peer->pcookie.tstamp && (peer->flags & + FLAG_AUTOKEY))) + rval = RV_TSP; + else + rval = RV_OK; +#endif /* PUBKEY */ + + /* + * Tricky here. If in client mode, use the + * server cookie; otherwise, use EXOR of both + * peer cookies. We call this Daffy-Hooligan + * agreement. + */ + if (peer->hmode == MODE_CLIENT) + temp = ntohl(cp->key); + else + temp = ntohl(cp->key) ^ peer->hcookie; +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x cookie %08x ts %u (%u)\n", + rval, temp, tstamp, + peer->pcookie.tstamp); +#endif + if (rval != RV_OK) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x cookie %08x ts %u (%u)\n", + rval, temp, tstamp, + peer->pcookie.tstamp); + peer->cmmd |= CRYPTO_ERROR; + break; + } + if (!(peer->cast_flags & MDF_BCLNT)) + peer->flags |= FLAG_AUTOKEY; + peer->flash &= ~TEST10; + peer->assoc = ntohl(pkt[i + 1]); + peer->pcookie.tstamp = tstamp; + if (temp != peer->pcookie.key) { + peer->pcookie.key = temp; + key_expire(peer); + } + break; + + /* + * The following commands and responses work only when + * public-key cryptography has been configured. If + * configured, but disabled due to no crypto command in + * the configuration file, they are ignored. + */ +#ifdef PUBKEY + /* + * Install public key and host name. + */ + case CRYPTO_NAME | CRYPTO_RESP: + if (!crypto_flags) + break; + vp = (struct value *)&pkt[i + 2]; + fstamp = ntohl(vp->fstamp); + temp = ntohl(vp->vallen); + j = i + 5 + ntohl(vp->vallen) / 4; + bits = ntohl(pkt[i + 5]); + if (len < VALUE_LEN) { + rval = RV_LEN; + } else if (temp < rsalen || bits < + MIN_RSA_MODULUS_BITS || bits > + MAX_RSA_MODULUS_BITS) { + rval = RV_KEY; + } else if (ntohl(pkt[j]) != bits / 8) { + rval = RV_SIG; + } else if (tstamp == 0 || tstamp < + peer->pubkey.tstamp || (tstamp == + peer->pubkey.tstamp && (peer->flags & + FLAG_AUTOKEY))) { + rval = RV_TSP; + } else if (tstamp < peer->pubkey.fstamp || + fstamp < peer->pubkey.fstamp) { + rval = RV_FSP; + } else if (fstamp == peer->pubkey.fstamp && + (peer->flags & FLAG_AUTOKEY)) { + rval = RV_FSP; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)vp, + temp + 12); + kp = emalloc(sizeof(R_RSA_PUBLIC_KEY)); + kp->bits = bits; + memcpy(kp->modulus, &pkt[i + 6], + rsalen - 4); + rval = EVP_VerifyFinal(&ctx, + (u_char *)&pkt[j + 1], + ntohl(pkt[j]), kp); + if (rval != 0) { + free(kp); + } else { + j = i + 5 + rsalen / 4; + peer->pubkey.ptr = (u_char *)kp; + temp = strlen((char *)&pkt[j]); + peer->keystr = emalloc(temp + + 1); + strcpy(peer->keystr, + (char *)&pkt[j]); + peer->pubkey.tstamp = tstamp; + peer->pubkey.fstamp = fstamp; + peer->flash &= ~TEST10; + if (!(peer->crypto & + CRYPTO_FLAG_CERT)) + peer->flags |= + FLAG_PROVEN; + } + } +#ifdef DEBUG + if (debug) + + printf( + "crypto_recv: verify %x host %s ts %u fs %u\n", + rval, (char *)&pkt[i + 5 + rsalen / + 4], tstamp, fstamp); +#endif + if (rval != RV_OK) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x host %s ts %u fs %u\n", + rval, (char *)&pkt[i + 5 + + rsalen / 4], tstamp, + fstamp); + } + break; + + /* + * Install certificate. + */ + case CRYPTO_CERT | CRYPTO_RESP: + if (!crypto_flags) + break; + vp = (struct value *)&pkt[i + 2]; + fstamp = ntohl(vp->fstamp); + temp = ntohl(vp->vallen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + j = i + 5 + temp / 4; + if (len < VALUE_LEN) { + rval = RV_LEN; + } else if (kp == NULL) { + rval = RV_PUB; + } else if (ntohl(pkt[j]) != kp->bits / 8) { + rval = RV_SIG; + } else if (tstamp == 0) { + rval = RV_TSP; + } else if (tstamp < + ntohl(peer->certif.fstamp) || fstamp < + ntohl(peer->certif.fstamp)) { + rval = RV_FSP; + } else if (fstamp == + ntohl(peer->certif.fstamp) && (peer->flags & + FLAG_AUTOKEY)) { + peer->crypto &= ~CRYPTO_FLAG_CERT; + rval = RV_FSP; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)vp, + temp + 12); + rval = EVP_VerifyFinal(&ctx, + (u_char *)&pkt[j + 1], + ntohl(pkt[j]), kp); + } +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x certificate %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); +#endif + + /* + * If the peer data are newer than the host + * data, replace the host data. Otherwise, + * wait for the peer to fetch the host data. + */ + if (rval != RV_OK || temp == 0) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x certificate %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); + break; + } + peer->flash &= ~TEST10; + peer->flags |= FLAG_PROVEN; + peer->crypto &= ~CRYPTO_FLAG_CERT; + + /* + * Initialize agreement parameters and extension + * field in network byte order. Note the private + * key length is set arbitrarily at half the + * prime length. + */ + peer->certif.tstamp = vp->tstamp; + peer->certif.fstamp = vp->fstamp; + peer->certif.vallen = vp->vallen; + if (peer->certif.ptr == NULL) + free(peer->certif.ptr); + peer->certif.ptr = emalloc(temp); + memcpy(peer->certif.ptr, vp->pkt, temp); + crypto_agree(); + break; + + /* + * Install agreement parameters in symmetric modes. + */ + case CRYPTO_DHPAR | CRYPTO_RESP: + if (!crypto_flags) + break; + vp = (struct value *)&pkt[i + 2]; + fstamp = ntohl(vp->fstamp); + temp = ntohl(vp->vallen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + j = i + 5 + temp / 4; + if (len < VALUE_LEN) { + rval = RV_LEN; + } else if (kp == NULL) { + rval = RV_PUB; + } else if (ntohl(pkt[j]) != kp->bits / 8) { + rval = RV_SIG; + } else if (tstamp == 0) { + rval = RV_TSP; + } else if (tstamp < ntohl(dhparam.fstamp) || + fstamp < ntohl(dhparam.fstamp)) { + rval = RV_FSP; + } else if (fstamp == ntohl(dhparam.fstamp) && + (peer->flags & FLAG_AUTOKEY)) { + peer->crypto &= ~CRYPTO_FLAG_DH; + rval = RV_FSP; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)vp, + temp + 12); + rval = EVP_VerifyFinal(&ctx, + (u_char *)&pkt[j + 1], + ntohl(pkt[j]), kp); + } +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x parameters %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); +#endif + + /* + * If the peer data are newer than the host + * data, replace the host data. Otherwise, + * wait for the peer to fetch the host data. + */ + if (rval != RV_OK || temp == 0) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x parameters %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); + break; + } + peer->flash &= ~TEST10; + crypto_flags |= CRYPTO_FLAG_DH; + peer->crypto &= ~CRYPTO_FLAG_DH; + + /* + * Initialize agreement parameters and extension + * field in network byte order. Note the private + * key length is set arbitrarily at half the + * prime length. + */ + dhparam.tstamp = vp->tstamp; + dhparam.fstamp = vp->fstamp; + dhparam.vallen = vp->vallen; + if (dhparam.ptr != NULL) + free(dhparam.ptr); + pp = emalloc(temp); + dhparam.ptr = (u_char *)pp; + memcpy(pp, vp->pkt, temp); + dh_params.primeLen = ntohl(*pp++); + dh_params.prime = (u_char *)pp; + pp += dh_params.primeLen / 4; + dh_params.generatorLen = ntohl(*pp++); + dh_params.generator = (u_char *)pp; + dh_keyLen = dh_params.primeLen / 2; + if (dh_private != NULL) + free(dh_private); + dh_private = emalloc(dh_keyLen); + if (dhparam.sig == NULL) + dhparam.sig = emalloc(private_key.bits / + 8); + + /* + * Initialize public value extension field. + */ + dhpub.tstamp = vp->tstamp; + dhpub.fstamp = vp->fstamp; + dhpub.vallen = htonl(dh_params.primeLen); + if (dhpub.ptr != NULL) + free(dhpub.ptr); + dhpub.ptr = emalloc(dh_params.primeLen); + if (dhpub.sig == NULL) + dhpub.sig = emalloc(private_key.bits / + 8); + crypto_agree(); + break; + + /* + * Verify public value and compute agreed key in + * symmetric modes. + */ + case CRYPTO_DH: + peer->cmmd = ntohl(pkt[i]); + if (!crypto_flags) + peer->cmmd |= CRYPTO_ERROR; + /* fall through */ + + case CRYPTO_DH | CRYPTO_RESP: + if (!crypto_flags) + break; + vp = (struct value *)&pkt[i + 2]; + fstamp = ntohl(vp->fstamp); + temp = ntohl(vp->vallen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + j = i + 5 + temp / 4; + if (len < VALUE_LEN) { + rval = RV_LEN; + } else if (temp != dh_params.primeLen) { + rval = RV_DH; + } else if (kp == NULL) { + rval = RV_PUB; + } else if (ntohl(pkt[j]) != kp->bits / 8) { + rval = RV_SIG; + } else if (tstamp == 0 || tstamp < + peer->pcookie.tstamp || (tstamp == + peer->pcookie.tstamp && (peer->flags & + FLAG_AUTOKEY))) { + rval = RV_TSP; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)vp, + temp + 12); + rval = EVP_VerifyFinal(&ctx, + (u_char *)&pkt[j + 1], + ntohl(pkt[j]), kp); + } + + /* + * Run the agreement algorithm and stash the key + * value. We use only the first u_int32 for the + * host cookie. Wasteful. If the association ID + * is zero, the other guy hasn't seen us as + * synchronized, in which case both of us should + * be using a zero cookie. + */ + if (rval != RV_OK) { + temp = 0; + } else if (fstamp > dhparam.fstamp) { + crypto_flags &= ~CRYPTO_FLAG_DH; + rval = RV_FSP; + } else { + rval = R_ComputeDHAgreedKey(dh_key, + (u_char *)&pkt[i + 5], dh_private, + dh_keyLen, &dh_params); + temp = ntohl(*(u_int32 *)dh_key); + } +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x agreement %08x ts %u (%u) fs %u\n", + rval, temp, tstamp, + peer->pcookie.tstamp, fstamp); +#endif + if (rval != RV_OK) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x agreement %08x ts %u (%u) fs %u\n", + rval, temp, tstamp, + peer->pcookie.tstamp, + fstamp); + peer->cmmd |= CRYPTO_ERROR; + break; + } + peer->flash &= ~TEST10; + peer->flags &= ~FLAG_AUTOKEY; + peer->assoc = ntohl(pkt[i + 1]); + peer->pcookie.tstamp = tstamp; + if (temp != peer->pcookie.key) { + peer->pcookie.key = temp; + key_expire(peer); + } + break; + + /* + * Install leapseconds table. + */ + case CRYPTO_TAI | CRYPTO_RESP: + if (!crypto_flags) + break; + vp = (struct value *)&pkt[i + 2]; + fstamp = ntohl(vp->fstamp); + temp = ntohl(vp->vallen); + kp = (R_RSA_PUBLIC_KEY *)peer->pubkey.ptr; + j = i + 5 + temp / 4; + if (len < VALUE_LEN) { + rval = RV_LEN; + } if (kp == NULL) { + rval = RV_PUB; + } else if (ntohl(pkt[j]) != kp->bits / 8) { + rval = RV_SIG; + } else if (tstamp == 0) { + rval = RV_TSP; + } else if (tstamp < ntohl(tai_leap.fstamp) || + fstamp < ntohl(tai_leap.fstamp)) { + rval = RV_FSP; + } else if (fstamp == ntohl(tai_leap.fstamp) && + (peer->flags & FLAG_AUTOKEY)) { + peer->crypto &= ~CRYPTO_FLAG_TAI; + rval = RV_FSP; + } else { + EVP_VerifyInit(&ctx, DA_MD5); + EVP_VerifyUpdate(&ctx, (u_char *)vp, + temp + 12); + rval = EVP_VerifyFinal(&ctx, + (u_char *)&pkt[j + 1], + ntohl(pkt[j]), kp); + } +#ifdef DEBUG + if (debug) + printf( + "crypto_recv: verify %x leapseconds %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); +#endif + + /* + * If the peer data are newer than the host + * data, replace the host data. Otherwise, + * wait for the peer to fetch the host data. + */ + if (rval != RV_OK || temp == 0) { + if (rval != RV_TSP) + msyslog(LOG_ERR, + "crypto: %x leapseconds %u ts %u fs %u\n", + rval, temp, tstamp, fstamp); + break; + } + peer->flash &= ~TEST10; + crypto_flags |= CRYPTO_FLAG_TAI; + peer->crypto &= ~CRYPTO_FLAG_TAI; + sys_tai = temp / 4 + TAI_1972 - 1; +#ifdef KERNEL_PLL +#if NTP_API > 3 + ntv.modes = MOD_TAI; + ntv.constant = sys_tai; + if (ntp_adjtime(&ntv) == TIME_ERROR) + msyslog(LOG_ERR, + "kernel TAI update failed"); +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ + + /* + * Initialize leapseconds table and extension + * field in network byte order. + */ + tai_leap.tstamp = vp->tstamp; + tai_leap.fstamp = vp->fstamp; + tai_leap.vallen = vp->vallen; + if (tai_leap.ptr == NULL) + free(tai_leap.ptr); + tai_leap.ptr = emalloc(temp); + memcpy(tai_leap.ptr, vp->pkt, temp); + if (tai_leap.sig == NULL) + tai_leap.sig = + emalloc(private_key.bits / 8); + crypto_agree(); + break; +#endif /* PUBKEY */ + + /* + * For other requests, save the request code for later; + * for unknown responses or errors, just ignore for now. + */ + default: + if (code & (CRYPTO_RESP | CRYPTO_ERROR)) + break; + peer->cmmd = ntohl(pkt[i]); + break; + + } + authlen += len; + } +} + + +/* + * crypto_xmit - construct extension fields + * + * This routine is called both when an association is configured and + * when one is not. The only case where this matters now is to retrieve + * the autokey information, in which case the caller has to provide the + * association ID to match the association. + */ +int /* return length of extension field */ +crypto_xmit( + u_int32 *xpkt, /* packet pointer */ + int start, /* offset to extension field */ + u_int code, /* extension field code */ + keyid_t cookie, /* session cookie */ + u_int associd /* association ID */ + ) +{ + struct peer *peer; /* peer structure pointer */ + struct autokey *ap; /* autokey pointer */ + struct cookie *cp; /* cookie pointer */ + int len; /* extension field length */ + u_int opcode; /* extension field opcode */ + int i; +#ifdef PUBKEY + R_SIGNATURE_CTX ctx; /* signature context */ + struct value *vp; /* value pointer */ + int rval; /* return value */ + u_int temp; + int j; +#endif /* PUBKEY */ + + /* + * Generate the requested extension field request code, length + * and association ID. Note that several extension fields are + * used with and without public-key cryptography. If public-key + * cryptography has not been configured, we do the same thing, + * but leave off the signature. + */ + i = start / 4; + opcode = code; + xpkt[i + 1] = htonl(associd); + len = 8; + switch (opcode) { + + /* + * Send association ID, timestamp and status word. + */ + case CRYPTO_ASSOC | CRYPTO_RESP: + cp = (struct cookie *)&xpkt[i + 2]; +#ifdef PUBKEY + cp->tstamp = host.tstamp; +#else + cp->tstamp = 0; +#endif /* PUBKEY */ + cp->key = htonl(crypto_flags); + cp->siglen = 0; + len += 12; + break; + + /* + * Find peer and send autokey data and signature in broadcast + * server and symmetric modes. If no association is found, + * either the server has restarted with new associations or some + * perp has replayed an old message. + */ + case CRYPTO_AUTO | CRYPTO_RESP: + peer = findpeerbyassoc(associd); + if (peer == NULL) { + opcode |= CRYPTO_ERROR; + break; + } + peer->flags &= ~FLAG_ASSOC; + ap = (struct autokey *)&xpkt[i + 2]; + ap->tstamp = peer->sndauto.tstamp; + ap->seq = peer->sndauto.seq; + ap->key = peer->sndauto.key; + ap->siglen = peer->sndauto.siglen; + len += 16; +#ifdef PUBKEY + if (!crypto_flags) + break; + temp = ntohl(ap->siglen); + if (temp != 0) + memcpy(ap->pkt, peer->sndauto.sig, temp); + len += temp; +#endif /* PUBKEY */ + break; + + /* + * Send peer cookie and signature in server mode. + */ + case CRYPTO_PRIV: + case CRYPTO_PRIV | CRYPTO_RESP: + cp = (struct cookie *)&xpkt[i + 2]; + cp->key = htonl(cookie); + cp->siglen = 0; + len += 12; +#ifdef PUBKEY + cp->tstamp = host.tstamp; + if (!crypto_flags) + break; + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)cp, 8); + rval = EVP_SignFinal(&ctx, (u_char *)cp->pkt, &temp, + &private_key); + if (rval != RV_OK) { + msyslog(LOG_ERR, + "crypto: cookie signature fails %x", rval); + break; + } + cp->siglen = htonl(temp); + len += temp; +#endif /* PUBKEY */ + break; + +#ifdef PUBKEY + /* + * The following commands and responses work only when public- + * key cryptography has been configured. If configured, but + * disabled due to no crypto command in the configuration file, + * they are ignored and an error response is returned. + */ + /* + * Send certificate, timestamp and signature. + */ + case CRYPTO_CERT | CRYPTO_RESP: + if (!crypto_flags) { + opcode |= CRYPTO_ERROR; + break; + } + vp = (struct value *)&xpkt[i + 2]; + vp->tstamp = certif.tstamp; + vp->fstamp = certif.fstamp; + vp->vallen = 0; + len += 12; + temp = ntohl(certif.vallen); + if (temp == 0) + break; + vp->vallen = htonl(temp); + memcpy(vp->pkt, certif.ptr, temp); + len += temp; + j = i + 5 + temp / 4; + temp = public_key.bits / 8; + xpkt[j++] = htonl(temp); + memcpy(&xpkt[j], certif.sig, temp); + len += temp + 4; + break; + + /* + * Send agreement parameters, timestamp and signature. + */ + case CRYPTO_DHPAR | CRYPTO_RESP: + if (!crypto_flags) { + opcode |= CRYPTO_ERROR; + break; + } + vp = (struct value *)&xpkt[i + 2]; + vp->tstamp = dhparam.tstamp; + vp->fstamp = dhparam.fstamp; + vp->vallen = 0; + len += 12; + temp = ntohl(dhparam.vallen); + if (temp == 0) + break; + vp->vallen = htonl(temp); + memcpy(vp->pkt, dhparam.ptr, temp); + len += temp; + j = i + 5 + temp / 4; + temp = public_key.bits / 8; + xpkt[j++] = htonl(temp); + memcpy(&xpkt[j], dhparam.sig, temp); + len += temp + 4; + break; + + /* + * Send public value, timestamp and signature. + */ + case CRYPTO_DH: + case CRYPTO_DH | CRYPTO_RESP: + if (!crypto_flags) { + opcode |= CRYPTO_ERROR; + break; + } + vp = (struct value *)&xpkt[i + 2]; + vp->tstamp = dhpub.tstamp; + vp->fstamp = dhpub.fstamp; + vp->vallen = 0; + len += 12; + temp = ntohl(dhpub.vallen); + if (temp == 0) + break; + vp->vallen = htonl(temp); + memcpy(vp->pkt, dhpub.ptr, temp); + len += temp; + j = i + 5 + temp / 4; + temp = public_key.bits / 8; + xpkt[j++] = htonl(temp); + memcpy(&xpkt[j], dhpub.sig, temp); + len += temp + 4; + break; + + /* + * Send public key, host name, timestamp and signature. + */ + case CRYPTO_NAME | CRYPTO_RESP: + if (!crypto_flags) { + opcode |= CRYPTO_ERROR; + break; + } + vp = (struct value *)&xpkt[i + 2]; + vp->tstamp = host.tstamp; + vp->fstamp = host.fstamp; + vp->vallen = 0; + len += 12; + temp = ntohl(host.vallen); + if (temp == 0) + break; + vp->vallen = htonl(temp); + memcpy(vp->pkt, host.ptr, temp); + len += temp; + j = i + 5 + temp / 4; + temp = public_key.bits / 8; + xpkt[j++] = htonl(temp); + memcpy(&xpkt[j], host.sig, temp); + len += temp + 4; + break; + + /* + * Send leapseconds table, timestamp and signature. + */ + case CRYPTO_TAI | CRYPTO_RESP: + if (!crypto_flags) { + opcode |= CRYPTO_ERROR; + break; + } + vp = (struct value *)&xpkt[i + 2]; + vp->tstamp = tai_leap.tstamp; + vp->fstamp = tai_leap.fstamp; + vp->vallen = 0; + len += 12; + temp = ntohl(tai_leap.vallen); + if (temp == 0) + break; + vp->vallen = htonl(temp); + memcpy(vp->pkt, tai_leap.ptr, temp); + len += temp; + j = i + 5 + temp / 4; + temp = public_key.bits / 8; + xpkt[j++] = htonl(temp); + memcpy(&xpkt[j], tai_leap.sig, temp); + len += temp + 4; + break; +#endif /* PUBKEY */ + + /* + * Default - Fall through for requests; for unknown responses, + * flag as error. + */ + default: + if (opcode & CRYPTO_RESP) + opcode |= CRYPTO_ERROR; + break; + } + + /* + * Round up the field length to a multiple of 8 octets and save + * the request code and length. + */ + len = ((len + 7) / 8) * 8; + if (len >= 4) { + xpkt[i] = htonl((u_int32)((opcode << 16) | len)); +#ifdef DEBUG + if (debug) + printf( + "crypto_xmit: ext offset %d len %d code %x assocID %d\n", + start, len, code, associd); +#endif + } + return (len); +} + +#ifdef PUBKEY +/* + * crypto_setup - load private key, public key, optional agreement + * parameters and optional leapseconds table, then initialize extension + * fields for later signatures. + */ +void +crypto_setup(void) +{ + char filename[MAXFILENAME]; + u_int fstamp; /* filestamp */ + u_int len, temp; + u_int32 *pp; + + /* + * Initialize structures. + */ + memset(&private_key, 0, sizeof(private_key)); + memset(&public_key, 0, sizeof(public_key)); + memset(&certif, 0, sizeof(certif)); + memset(&dh_params, 0, sizeof(dh_params)); + memset(&host, 0, sizeof(host)); + memset(&dhparam, 0, sizeof(dhparam)); + memset(&dhpub, 0, sizeof(dhpub)); + memset(&tai_leap, 0, sizeof(tai_leap)); + if (!crypto_flags) + return; + + /* + * Load required private key from file, default "ntpkey". + */ + if (private_key_file == NULL) + private_key_file = "ntpkey"; + host.fstamp = htonl(crypto_rsa(private_key_file, + (u_char *)&private_key, sizeof(R_RSA_PRIVATE_KEY))); + + /* + * Load required public key from file, default + * "ntpkey_host", where "host" is the canonical name of this + * machine. + */ + if (public_key_file == NULL) { + snprintf(filename, MAXFILENAME, "ntpkey_%s", + sys_hostname); + public_key_file = emalloc(strlen(filename) + 1); + strcpy(public_key_file, filename); + } + fstamp = htonl(crypto_rsa(public_key_file, + (u_char *)&public_key, sizeof(R_RSA_PUBLIC_KEY))); + if (fstamp != host.fstamp || strstr(public_key_file, + sys_hostname) == NULL) { + msyslog(LOG_ERR, + "crypto: public/private key files mismatch"); + exit (-1); + } + crypto_flags |= CRYPTO_FLAG_RSA; + + /* + * Assemble public key and host name in network byte order. + * These data will later be signed and sent in response to + * a client request. Note that the modulus must be a u_int32 in + * network byte order independent of the host order or u_int + * size. + */ + strcpy(filename, sys_hostname); + for (len = strlen(filename) + 1; len % 4 != 0; len++) + filename[len - 1] = 0; + temp = sizeof(R_RSA_PUBLIC_KEY) - sizeof(u_int) + 4; + host.vallen = htonl(temp + len); + pp = emalloc(temp + len); + host.ptr = (u_char *)pp; + *pp++ = htonl(public_key.bits); + memcpy(pp--, public_key.modulus, temp - 4); + pp += temp / 4; + memcpy(pp, filename, len); + host.sig = emalloc(private_key.bits / 8); + + /* + * Load optional certificate from file, default "ntpkey_certif". + * If the file is missing or defective, the values can later be + * retrieved from a server. + */ + if (certif_file == NULL) + snprintf(filename, MAXFILENAME, "ntpkey_certif_%s", + sys_hostname); + certif_file = emalloc(strlen(filename) + 1); + strcpy(certif_file, filename); + crypto_cert(certif_file); + + /* + * Load optional agreement parameters from file, default + * "ntpkey_dh". If the file is missing or defective, the values + * can later be retrieved from a server. + */ + if (dh_params_file == NULL) + dh_params_file = "ntpkey_dh"; + crypto_dh(dh_params_file); + + /* + * Load optional leapseconds from file, default "ntpkey_leap". + * If the file is missing or defective, the values can later be + * retrieved from a server. + */ + if (tai_leap_file == NULL) + tai_leap_file = "ntpkey_leap"; + crypto_tai(tai_leap_file); +} + + +/* + * crypto_agree - compute new public value and sign extension fields. + */ +void +crypto_agree(void) +{ + R_RANDOM_STRUCT randomstr; /* wiggle bits */ + R_SIGNATURE_CTX ctx; /* signature context */ + l_fp lstamp; /* NTP time */ + tstamp_t tstamp; /* seconds timestamp */ + u_int len, temp; + int rval, i; + + /* + * Sign host name and timestamps, but only if the clock is + * synchronized. + */ + if (sys_leap == LEAP_NOTINSYNC) + return; + get_systime(&lstamp); + tstamp = lstamp.l_ui; + host.tstamp = htonl(tstamp); + if (!crypto_flags) + return; + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)&host, 12); + EVP_SignUpdate(&ctx, host.ptr, ntohl(host.vallen)); + rval = EVP_SignFinal(&ctx, host.sig, &len, &private_key); + if (rval != RV_OK || len != private_key.bits / 8) { + msyslog(LOG_ERR, "crypto: host signature fails %x", + rval); + exit (-1); + } + host.siglen = ntohl(len); + + /* + * Sign certificate and timestamps. + */ + if (certif.vallen != 0) { + certif.tstamp = htonl(tstamp); + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)&certif, 12); + EVP_SignUpdate(&ctx, certif.ptr, + ntohl(certif.vallen)); + rval = EVP_SignFinal(&ctx, certif.sig, &len, + &private_key); + if (rval != RV_OK || len != private_key.bits / 8) { + msyslog(LOG_ERR, + "crypto: certificate signature fails %x", + rval); + exit (-1); + } + certif.siglen = ntohl(len); + } + + /* + * Sign agreement parameters and timestamps. + */ + if (dhparam.vallen != 0) { + dhparam.tstamp = htonl(tstamp); + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)&dhparam, 12); + EVP_SignUpdate(&ctx, dhparam.ptr, + ntohl(dhparam.vallen)); + rval = EVP_SignFinal(&ctx, dhparam.sig, &len, + &private_key); + if (rval != RV_OK || len != private_key.bits / 8) { + msyslog(LOG_ERR, + "crypto: parameters signature fails %x", + rval); + exit (-11); + } + dhparam.siglen = ntohl(len); + + /* + * Compute public value. + */ + R_RandomInit(&randomstr); + R_GetRandomBytesNeeded(&len, &randomstr); + for (i = 0; i < len; i++) { + temp = RANDOM; + R_RandomUpdate(&randomstr, (u_char *)&temp, 1); + } + rval = R_SetupDHAgreement(dhpub.ptr, dh_private, + dh_keyLen, &dh_params, &randomstr); + if (rval != RV_OK) { + msyslog(LOG_ERR, + "crypto: invalid public value"); + exit (-1); + } + + /* + * Sign public value and timestamps. + */ + dhpub.tstamp = htonl(tstamp); + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)&dhpub, 12); + EVP_SignUpdate(&ctx, dhpub.ptr, ntohl(dhpub.vallen)); + rval = EVP_SignFinal(&ctx, dhpub.sig, &len, + &private_key); + if (rval != RV_OK || len != private_key.bits / 8) { + msyslog(LOG_ERR, + "crypto: public value signature fails %x", + rval); + exit (-1); + } + dhpub.siglen = ntohl(len); + } + + /* + * Sign leapseconds table and timestamps. + */ + if (tai_leap.vallen != 0) { + tai_leap.tstamp = htonl(tstamp); + EVP_SignInit(&ctx, DA_MD5); + EVP_SignUpdate(&ctx, (u_char *)&tai_leap, 12); + EVP_SignUpdate(&ctx, tai_leap.ptr, + ntohl(tai_leap.vallen)); + rval = EVP_SignFinal(&ctx, tai_leap.sig, &len, + &private_key); + if (rval != RV_OK || len != private_key.bits / 8) { + msyslog(LOG_ERR, + "crypto: leapseconds signature fails %x", + rval); + exit (-1); + } + tai_leap.siglen = ntohl(len); + } +#ifdef DEBUG + if (debug) + printf( + "cypto_agree: ts %u host %u par %u pub %u leap %u\n", + tstamp, ntohl(host.fstamp), ntohl(dhparam.fstamp), + ntohl(dhpub.fstamp), ntohl(tai_leap.fstamp)); +#endif +} + + +/* + * crypto_rsa - read RSA key, decode and check for errors. + */ +static u_int +crypto_rsa( + char *cp, /* file name */ + u_char *key, /* key pointer */ + u_int keylen /* key length */ + ) +{ + FILE *str; /* file handle */ + u_char buf[MAX_LINLEN]; /* file line buffer */ + u_char encoded_key[MAX_ENCLEN]; /* encoded key buffer */ + char filename[MAXFILENAME]; /* name of parameter file */ + char linkname[MAXFILENAME]; /* file link (for filestamp) */ + u_int fstamp; /* filestamp */ + u_int bits, len; + char *rptr; + int rval; + + /* + * Open the file and discard comment lines. If the first + * character of the file name is not '/', prepend the keys + * directory string. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + str = fopen(filename, "r"); + if (str == NULL) { + msyslog(LOG_ERR, "crypto: RSA file %s not found", + filename); + exit (-1); + } + + /* + * Ignore initial comments and empty lines. + */ + while ((rptr = fgets(buf, MAX_LINLEN - 1, str)) != NULL) { + len = strlen(buf); + if (len < 1) + continue; + if (*buf == '#' || *buf == '\r' || *buf == '\0') + continue; + break; + } + + /* + * We are rather paranoid here, since an intruder might cause a + * coredump by infiltrating a naughty key. The line must contain + * a single integer followed by a PEM encoded, null-terminated + * string. + */ + if (rptr == NULL) + rval = RV_DAT; + else if (sscanf(buf, "%d %s", &bits, encoded_key) != 2) + rval = RV_DAT; + else if (R_DecodePEMBlock(&buf[sizeof(u_int)], &len, + encoded_key, strlen(encoded_key))) + rval = RV_DEC; + else if ((len += sizeof(u_int)) != keylen) + rval = RV_KEY; + else if (bits < MIN_RSA_MODULUS_BITS || bits > + MAX_RSA_MODULUS_BITS) + rval = RV_KEY; + else + rval = RV_OK; + if (rval != RV_OK) { + fclose(str); + msyslog(LOG_ERR, "crypto: RSA file %s error %x", cp, + rval); + exit (-1); + } + fclose(str); + *(u_int *)buf = bits; + memcpy(key, buf, keylen); + + /* + * Extract filestamp if present. + */ + rval = readlink(filename, linkname, MAXFILENAME - 1); + if (rval > 0) { + linkname[rval] = '\0'; + rptr = strrchr(linkname, '.'); + } else { + rptr = strrchr(filename, '.'); + } + if (rptr != NULL) + sscanf(++rptr, "%u", &fstamp); + else + fstamp = 0; +#ifdef DEBUG + if (debug) + printf( + "crypto_rsa: key file %s link %d fs %u modulus %d\n", + cp, rval, fstamp, bits); +#endif + return (fstamp); +} + + +/* + * crypto_cert - read certificate + */ +static void +crypto_cert( + char *cp /* file name */ + ) +{ + u_char buf[5000]; /* file line buffer */ + char filename[MAXFILENAME]; /* name of certificate file */ + char linkname[MAXFILENAME]; /* file link (for filestamp) */ + u_int fstamp; /* filestamp */ + u_int32 *pp; + u_int len; + char *rptr; + int rval, fd; + + /* + * Open the file and discard comment lines. If the first + * character of the file name is not '/', prepend the keys + * directory string. If the file is not found, not to worry; it + * can be retrieved over the net. But, if it is found with + * errors, we crash and burn. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + fd = open(filename, O_RDONLY, 0777); + if (fd <= 0) { + msyslog(LOG_INFO, + "crypto: certificate file %s not found", + filename); + return; + } + + /* + * We are rather paranoid here, since an intruder might cause a + * coredump by infiltrating naughty values. + */ + rval = RV_OK; + len = read(fd, buf, 5000); + close(fd); + if (rval != RV_OK) { + msyslog(LOG_ERR, + "crypto: certificate file %s error %d", cp, + rval); + exit (-1); + } + + /* + * The extension field entry consists of the raw certificate. + */ + certif.vallen = htonl(200); /* xxxxxxxxxxxxxxxxxx */ + pp = emalloc(len); + certif.ptr = (u_char *)pp; + memcpy(pp, buf, len); + certif.sig = emalloc(private_key.bits / 8); + crypto_flags |= CRYPTO_FLAG_CERT; + + /* + * Extract filestamp if present. + */ + rval = readlink(filename, linkname, MAXFILENAME - 1); + if (rval > 0) { + linkname[rval] = '\0'; + rptr = strrchr(linkname, '.'); + } else { + rptr = strrchr(filename, '.'); + } + if (rptr != NULL) + sscanf(++rptr, "%u", &fstamp); + else + fstamp = 0; + certif.fstamp = htonl(fstamp); +#ifdef DEBUG + if (debug) + printf( + "crypto_cert: certif file %s link %d fs %u len %d\n", + cp, rval, fstamp, len); +#endif +} + + +/* + * crypto_dh - read agreement parameters, decode and check for errors. + */ +static void +crypto_dh( + char *cp /* file name */ + ) +{ + FILE *str; /* file handle */ + u_char buf[MAX_LINLEN]; /* file line buffer */ + u_char encoded_key[MAX_ENCLEN]; /* encoded key buffer */ + u_char prime[MAX_KEYLEN]; /* decoded prime */ + u_char generator[MAX_KEYLEN]; /* decode generator */ + u_int primelen; /* prime length (octets) */ + u_int generatorlen; /* generator length (octets) */ + char filename[MAXFILENAME]; /* name of parameter file */ + char linkname[MAXFILENAME]; /* file link (for filestamp) */ + u_int fstamp; /* filestamp */ + u_int32 *pp; + u_int len; + char *rptr; + int rval; + + /* + * Open the file and discard comment lines. If the first + * character of the file name is not '/', prepend the keys + * directory string. If the file is not found, not to worry; it + * can be retrieved over the net. But, if it is found with + * errors, we crash and burn. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + str = fopen(filename, "r"); + if (str == NULL) { + msyslog(LOG_INFO, + "crypto: parameters file %s not found", filename); + return; + } + + /* + * Ignore initial comments and empty lines. + */ + while ((rptr = fgets(buf, MAX_LINLEN - 1, str)) != NULL) { + if (strlen(buf) < 1) + continue; + if (*buf == '#' || *buf == '\r' || *buf == '\0') + continue; + break; + } + + /* + * We are rather paranoid here, since an intruder might cause a + * coredump by infiltrating a naughty key. There must be two + * lines; the first contains the prime, the second the + * generator. Each line must contain a single integer followed + * by a PEM encoded, null-terminated string. + */ + if (rptr == NULL) + rval = RV_DAT; + else if (sscanf(buf, "%u %s", &primelen, encoded_key) != 2) + rval = RV_DAT; + else if (primelen > MAX_KEYLEN) + rval = RV_KEY; + else if (R_DecodePEMBlock(prime, &len, encoded_key, + strlen(encoded_key))) + rval = RV_DEC; + else if (primelen != len || primelen > + DECODED_CONTENT_LEN(strlen(encoded_key))) + rval = RV_DAT; + else if (fscanf(str, "%u %s", &generatorlen, encoded_key) != 2) + rval = RV_DAT; + else if (generatorlen > MAX_KEYLEN) + rval = RV_KEY; + else if (R_DecodePEMBlock(generator, &len, encoded_key, + strlen(encoded_key))) + rval = RV_DEC; + else if (generatorlen != len || generatorlen > + DECODED_CONTENT_LEN(strlen(encoded_key))) + rval = RV_DAT; + else + rval = RV_OK; + if (rval != RV_OK) { + msyslog(LOG_ERR, + "crypto: parameters file %s error %x", cp, + rval); + exit (-1); + } + fclose(str); + + /* + * Initialize agreement parameters and extension field in + * network byte order. Note the private key length is set + * arbitrarily at half the prime length. + */ + len = 4 + primelen + 4 + generatorlen; + dhparam.vallen = htonl(len); + pp = emalloc(len); + dhparam.ptr = (u_char *)pp; + *pp++ = htonl(primelen); + memcpy(pp, prime, primelen); + dh_params.prime = (u_char *)pp; + pp += primelen / 4; + *pp++ = htonl(generatorlen); + memcpy(pp, &generator, generatorlen); + dh_params.generator = (u_char *)pp; + + dh_params.primeLen = primelen; + dh_params.generatorLen = generatorlen; + dh_keyLen = primelen / 2; + dh_private = emalloc(dh_keyLen); + dhparam.sig = emalloc(private_key.bits / 8); + crypto_flags |= CRYPTO_FLAG_DH; + + /* + * Initialize public value extension field. + */ + dhpub.vallen = htonl(dh_params.primeLen); + dhpub.ptr = emalloc(dh_params.primeLen); + dhpub.sig = emalloc(private_key.bits / 8); + + /* + * Extract filestamp if present. + */ + rval = readlink(filename, linkname, MAXFILENAME - 1); + if (rval > 0) { + linkname[rval] = '\0'; + rptr = strrchr(linkname, '.'); + } else { + rptr = strrchr(filename, '.'); + } + if (rptr != NULL) + sscanf(++rptr, "%u", &fstamp); + else + fstamp = 0; + dhparam.fstamp = htonl(fstamp); + dhpub.fstamp = htonl(fstamp); +#ifdef DEBUG + if (debug) + printf( + "crypto_dh: pars file %s link %d fs %u prime %u gen %u\n", + cp, rval, fstamp, dh_params.primeLen, + dh_params.generatorLen); +#endif +} + + +/* + * crypto_tai - read leapseconds table and check for errors. + */ +static void +crypto_tai( + char *cp /* file name */ + ) +{ + FILE *str; /* file handle */ + u_char buf[MAX_LINLEN]; /* file line buffer */ + u_int leapsec[MAX_LEAP]; /* NTP time at leaps */ + u_int offset; /* offset at leap (s) */ + char filename[MAXFILENAME]; /* name of leapseconds file */ + char linkname[MAXFILENAME]; /* file link (for filestamp) */ + u_int fstamp; /* filestamp */ + u_int32 *pp; + u_int len; + char *rptr; + int rval, i; +#ifdef KERNEL_PLL +#if NTP_API > 3 + struct timex ntv; /* kernel interface structure */ +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ + + /* + * Open the file and discard comment lines. If the first + * character of the file name is not '/', prepend the keys + * directory string. If the file is not found, not to worry; it + * can be retrieved over the net. But, if it is found with + * errors, we crash and burn. + */ + if (*cp == '/') + strcpy(filename, cp); + else + snprintf(filename, MAXFILENAME, "%s/%s", keysdir, cp); + str = fopen(filename, "r"); + if (str == NULL) { + msyslog(LOG_INFO, + "crypto: leapseconds file %s not found", + filename); + return; + } + + /* + * We are rather paranoid here, since an intruder might cause a + * coredump by infiltrating naughty values. Empty lines and + * comments are ignored. Other lines must begin with two + * integers followed by junk or comments. The first integer is + * the NTP seconds of leap insertion, the second is the offset + * of TAI relative to UTC after that insertion. The second word + * must equal the initial insertion of ten seconds on 1 January + * 1972 plus one second for each succeeding insertion. + */ + i = 0; + rval = RV_OK; + while (i < MAX_LEAP) { + rptr = fgets(buf, MAX_LINLEN - 1, str); + if (rptr == NULL) + break; + if (strlen(buf) < 1) + continue; + if (*buf == '#') + continue; + if (sscanf(buf, "%u %u", &leapsec[i], &offset) != 2) + continue; + if (i != offset - TAI_1972) { + rval = RV_DAT; + break; + } + i++; + } + fclose(str); + if (rval != RV_OK || i == 0) { + msyslog(LOG_ERR, + "crypto: leapseconds file %s error %d", cp, + rval); + exit (-1); + } + + /* + * The extension field table entries consists of the NTP seconds + * of leap insertion in reverse order, so that the most recent + * insertion is the first entry in the table. + */ + len = i * 4; + tai_leap.vallen = htonl(len); + pp = emalloc(len); + tai_leap.ptr = (u_char *)pp; + for (; i >= 0; i--) { + *pp++ = htonl(leapsec[i]); + } + tai_leap.sig = emalloc(private_key.bits / 8); + crypto_flags |= CRYPTO_FLAG_TAI; + sys_tai = len / 4 + TAI_1972 - 1; +#ifdef KERNEL_PLL +#if NTP_API > 3 + ntv.modes = MOD_TAI; + ntv.constant = sys_tai; + if (ntp_adjtime(&ntv) == TIME_ERROR) + msyslog(LOG_ERR, + "crypto: kernel TAI update failed"); +#endif /* NTP_API */ +#endif /* KERNEL_PLL */ + + + /* + * Extract filestamp if present. + */ + rval = readlink(filename, linkname, MAXFILENAME - 1); + if (rval > 0) { + linkname[rval] = '\0'; + rptr = strrchr(linkname, '.'); + } else { + rptr = strrchr(filename, '.'); + } + if (rptr != NULL) + sscanf(++rptr, "%u", &fstamp); + else + fstamp = 0; + tai_leap.fstamp = htonl(fstamp); +#ifdef DEBUG + if (debug) + printf( + "crypto_tai: leapseconds file %s link %d fs %u offset %u\n", + cp, rval, fstamp, ntohl(tai_leap.vallen) / 4 + + TAI_1972); +#endif +} + + +/* + * crypto_config - configure crypto data from crypto configuration + * command. + */ +void +crypto_config( + int item, /* configuration item */ + char *cp /* file name */ + ) +{ + switch (item) { + + /* + * Initialize flags + */ + case CRYPTO_CONF_FLAGS: + sscanf(cp, "%x", &crypto_flags); + break; + + /* + * Set private key file name. + */ + case CRYPTO_CONF_PRIV: + private_key_file = emalloc(strlen(cp) + 1); + strcpy(private_key_file, cp); + break; + + /* + * Set public key file name. + */ + case CRYPTO_CONF_PUBL: + public_key_file = emalloc(strlen(cp) + 1); + strcpy(public_key_file, cp); + break; + + /* + * Set certificate file name. + */ + case CRYPTO_CONF_CERT: + certif_file = emalloc(strlen(cp) + 1); + strcpy(certif_file, cp); + break; + + /* + * Set agreement parameter file name. + */ + case CRYPTO_CONF_DH: + dh_params_file = emalloc(strlen(cp) + 1); + strcpy(dh_params_file, cp); + break; + + /* + * Set leapseconds table file name. + */ + case CRYPTO_CONF_LEAP: + tai_leap_file = emalloc(strlen(cp) + 1); + strcpy(tai_leap_file, cp); + break; + + /* + * Set crypto keys directory. + */ + case CRYPTO_CONF_KEYS: + keysdir = emalloc(strlen(cp) + 1); + strcpy(keysdir, cp); + break; + } + crypto_flags |= CRYPTO_FLAG_ENAB; +} +# else +int ntp_crypto_bs_pubkey; +# endif /* PUBKEY */ +#else +int ntp_crypto_bs_autokey; +#endif /* AUTOKEY */ diff --git a/contrib/ntp/ntpd/ntp_intres.c b/contrib/ntp/ntpd/ntp_intres.c index e9a387e..9653fdd 100644 --- a/contrib/ntp/ntpd/ntp_intres.c +++ b/contrib/ntp/ntpd/ntp_intres.c @@ -20,19 +20,25 @@ # include <config.h> #endif -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/time.h> -#include <netdb.h> -#include <signal.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_request.h" #include "ntp_stdlib.h" #include "ntp_syslog.h" +#include <stdio.h> +#include <ctype.h> +#include <netdb.h> +#include <signal.h> + +/**/ +#include <netinet/in.h> +#include <arpa/inet.h> +/**/ +#ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> /* MAXHOSTNAMELEN (often) */ +#endif + #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) /* @@ -52,6 +58,7 @@ struct conf_entry { #define ce_flags ce_config.flags #define ce_ttl ce_config.ttl #define ce_keyid ce_config.keyid +#define ce_keystr ce_config.keystr /* * confentries is a pointer to the list of configuration entries @@ -73,7 +80,6 @@ static struct conf_entry *confentries = NULL; #define MAXRESOLVE 32 #define CONFIG_TIME 2 #define ALARM_TIME 30 - #define SLEEPTIME 2 static volatile int config_timer = 0; @@ -107,7 +113,8 @@ static int resolve_value; /* next value of resolve timer */ #define TOK_FLAGS 5 #define TOK_TTL 6 #define TOK_KEYID 7 -#define NUMTOK 8 +#define TOK_KEYSTR 8 +#define NUMTOK 9 #define MAXLINESIZE 512 @@ -120,7 +127,7 @@ static int sockfd = -1; /* stuff to be filled in by caller */ -u_long req_keyid; /* request keyid */ +keyid_t req_keyid; /* request keyid */ char *req_file; /* name of the file with configuration info */ /* end stuff to be filled in */ @@ -129,7 +136,8 @@ char *req_file; /* name of the file with configuration info */ static RETSIGTYPE bong P((int)); static void checkparent P((void)); static void removeentry P((struct conf_entry *)); -static void addentry P((char *, int, int, int, int, int, int, u_long)); +static void addentry P((char *, int, int, int, int, u_int, + int, keyid_t, char *)); static int findhostaddr P((struct conf_entry *)); static void openntp P((void)); static int request P((struct conf_peer *)); @@ -137,10 +145,48 @@ static char * nexttoken P((char **)); static void readconf P((FILE *, char *)); static void doconfigure P((int)); +struct ntp_res_t_pkt { /* Tagged packet: */ + void *tag; /* For the caller */ + u_int32 paddr; /* IP to look up, or 0 */ + char name[MAXHOSTNAMELEN]; /* Name to look up (if 1st byte is not 0) */ +}; + +struct ntp_res_c_pkt { /* Control packet: */ + char name[MAXHOSTNAMELEN]; + u_int32 paddr; + int mode; + int version; + int minpoll; + int maxpoll; + u_int flags; + int ttl; + keyid_t keyid; + u_char keystr[MAXFILENAME]; +}; + + /* - * assumes: req_key, req_keyid, conffile valid - * syslog still open + * ntp_res_recv: Process an answer from the resolver */ + +void +ntp_res_recv(void) +{ + /* + We have data ready on our descriptor. + It may be an EOF, meaning the resolver process went away. + Otherwise, it will be an "answer". + */ +} + + +/* + * ntp_intres needs; + * + * req_key(???), req_keyid, req_file valid + * syslog still open + */ + void ntp_intres(void) { @@ -149,7 +195,7 @@ ntp_intres(void) sigset_t set; sigemptyset(&set); -#endif /* NTP_POSIX_SOURCE */ +#endif /* HAVE_SIGSUSPEND */ #ifdef DEBUG if (debug > 1) { @@ -160,7 +206,7 @@ ntp_intres(void) /* check out auth stuff */ if (sys_authenticate) { if (!authistrusted(req_keyid)) { - msyslog(LOG_ERR, "invalid request keyid %lu", + msyslog(LOG_ERR, "invalid request keyid %08x", req_keyid ); exit(1); } @@ -180,7 +226,7 @@ ntp_intres(void) (void) fclose(in); if (!debug ) - (void) unlink(req_file); + (void) unlink(req_file); /* * Sleep a little to make sure the server is completely up @@ -192,12 +238,13 @@ ntp_intres(void) * Make a first cut at resolving the bunch */ doconfigure(1); - if (confentries == NULL) + if (confentries == NULL) { #if defined SYS_WINNT - ExitThread(0); /* Don't want to kill whole NT process */ + ExitThread(0); /* Don't want to kill whole NT process */ #else - exit(0); /* done that quick */ + exit(0); /* done that quick */ #endif + } /* * Here we've got some problem children. Set up the timer @@ -221,7 +268,8 @@ ntp_intres(void) resolve_value <<= 1; resolve_timer = resolve_value; #ifdef DEBUG - msyslog(LOG_INFO, "resolve_timer: 0->%d", resolve_timer); + if (debug > 2) + msyslog(LOG_INFO, "resolve_timer: 0->%d", resolve_timer); #endif config_timer = CONFIG_TIME; doconfigure(1); @@ -229,7 +277,8 @@ ntp_intres(void) } else if (config_timer == 0) { config_timer = CONFIG_TIME; #ifdef DEBUG - msyslog(LOG_INFO, "config_timer: 0->%d", config_timer); + if (debug > 2) + msyslog(LOG_INFO, "config_timer: 0->%d", config_timer); #endif doconfigure(0); continue; @@ -239,11 +288,11 @@ ntp_intres(void) * There is a race in here. Is okay, though, since * all it does is delay things by 30 seconds. */ -#ifdef HAVE_SIGSUSPEND +# ifdef HAVE_SIGSUSPEND sigsuspend(&set); -#else +# else sigpause(0); -#endif /* HAVE_SIGSUSPEND */ +# endif /* HAVE_SIGSUSPEND */ #else if (config_timer > 0) config_timer--; @@ -336,17 +385,25 @@ addentry( int version, int minpoll, int maxpoll, - int flags, + u_int flags, int ttl, - u_long keyid + keyid_t keyid, + char *keystr ) { register char *cp; register struct conf_entry *ce; unsigned int len; +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, + "intres: <%s> %d %d %d %d %x %d %x %s\n", name, + mode, version, minpoll, maxpoll, flags, ttl, keyid, + keystr); +#endif len = strlen(name) + 1; - cp = (char*)emalloc(len); + cp = (char *)emalloc(len); memmove(cp, name, len); ce = (struct conf_entry *)emalloc(sizeof(struct conf_entry)); @@ -359,6 +416,7 @@ addentry( ce->ce_flags = (u_char)flags; ce->ce_ttl = (u_char)ttl; ce->ce_keyid = keyid; + strncpy((char *)ce->ce_keystr, keystr, MAXFILENAME); ce->ce_next = NULL; if (confentries == NULL) { @@ -375,12 +433,12 @@ addentry( /* - * findhostaddr - resolve a host name into an address + * findhostaddr - resolve a host name into an address (Or vice-versa) * - * The routine sticks the address into the entry's ce_peeraddr if it - * gets one. It returns 1 for "success" and 0 for an uncorrectable - * failure. Note that "success" includes try again errors. You can - * tell that you got a try again since ce_peeraddr will still be zero. + * Given one of {ce_peeraddr,ce_name}, find the other one. + * It returns 1 for "success" and 0 for an uncorrectable failure. + * Note that "success" includes try again errors. You can tell that you + * got a "try again" since {ce_peeraddr,ce_name} will still be zero. */ static int findhostaddr( @@ -388,31 +446,80 @@ findhostaddr( ) { struct hostent *hp; + struct in_addr in; checkparent(); /* make sure our guy is still running */ - hp = gethostbyname(entry->ce_name); + if (entry->ce_name && entry->ce_peeraddr) { + /* HMS: Squawk? */ + msyslog(LOG_ERR, "findhostaddr: both ce_name and ce_peeraddr are defined..."); + return 1; + } + + if (!entry->ce_name && !entry->ce_peeraddr) { + msyslog(LOG_ERR, "findhostaddr: both ce_name and ce_peeraddr are undefined!"); + return 0; + } + + if (entry->ce_name) { +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, "findhostaddr: Resolving <%s>", + entry->ce_name); +#endif /* DEBUG */ + hp = gethostbyname(entry->ce_name); + } else { +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, "findhostaddr: Resolving %x>", + entry->ce_peeraddr); +#endif + in.s_addr = entry->ce_peeraddr; + hp = gethostbyaddr((const char *)&in, + sizeof entry->ce_peeraddr, + AF_INET); + } if (hp == NULL) { -#ifndef NODNS /* * If the resolver is in use, see if the failure is * temporary. If so, return success. */ if (h_errno == TRY_AGAIN) return (1); -#endif return (0); } - /* - * Use the first address. We don't have any way to - * tell preferences and older gethostbyname() implementations - * only return one. - */ - memmove((char *)&(entry->ce_peeraddr), - (char *)hp->h_addr, - sizeof(struct in_addr)); + if (entry->ce_name) { +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, "findhostaddr: name resolved."); +#endif + /* + * Use the first address. We don't have any way to tell + * preferences and older gethostbyname() implementations + * only return one. + */ + memmove((char *)&(entry->ce_peeraddr), + (char *)hp->h_addr, + sizeof(struct in_addr)); + if (entry->ce_keystr[0] == '*') + strncpy((char *)&(entry->ce_keystr), hp->h_name, + MAXFILENAME); + } else { + char *cp; + size_t s; + +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, "findhostaddr: address resolved."); +#endif + s = strlen(hp->h_name) + 1; + cp = emalloc(s); + strcpy(cp, hp->h_name); + entry->ce_name = cp; + } + return (1); } @@ -460,7 +567,7 @@ openntp(void) #endif /* O_NONBLOCK */ #else /* SYS_WINNT */ { - int on=1; + int on = 1; if (ioctlsocket(sockfd,FIONBIO,(u_long *) &on) == SOCKET_ERROR) { msyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m"); exit(1); /* Windows NT - set socket in non-blocking mode */ @@ -470,7 +577,7 @@ openntp(void) if (connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) { - msyslog(LOG_ERR, "connect() failed: %m"); + msyslog(LOG_ERR, "openntp: connect() failed: %m"); exit(1); } } @@ -531,6 +638,11 @@ request( reqpkt.request = REQ_CONFIG; /* configure a new peer */ reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct conf_peer)); + /* Make sure mbz_itemsize <= sizeof reqpkt.data */ + if (sizeof(struct conf_peer) > sizeof (reqpkt.data)) { + msyslog(LOG_ERR, "Bletch: conf_peer is too big for reqpkt.data!"); + exit(1); + } memmove(reqpkt.data, (char *)conf, sizeof(struct conf_peer)); reqpkt.keyid = htonl(req_keyid); @@ -552,7 +664,7 @@ request( } #else /* In the NT world, documentation seems to indicate that there - * exist _write and _read routines that can be used to so blocking + * exist _write and _read routines that can be used to do blocking * I/O on sockets. Problem is these routines require a socket * handle obtained through the _open_osf_handle C run-time API * of which there is no explanation in the documentation. We need @@ -603,8 +715,8 @@ request( } else if (n == 0) { - if(debug) - msyslog(LOG_DEBUG, "select() returned 0."); + if (debug) + msyslog(LOG_INFO, "select() returned 0."); return 0; } @@ -814,7 +926,7 @@ readconf( register int i; char *token[NUMTOK]; u_long intval[NUMTOK]; - int flags; + u_int flags; char buf[MAXLINESIZE]; char *bp; @@ -830,7 +942,7 @@ readconf( } } - for (i = 1; i < NUMTOK; i++) { + for (i = 1; i < NUMTOK - 1; i++) { if (!atouint(token[i], &intval[i])) { msyslog(LOG_ERR, "format error for integer token `%s', file `%s', quitting", @@ -868,7 +980,7 @@ readconf( } if ((intval[TOK_FLAGS] & ~(FLAG_AUTHENABLE | FLAG_PREFER | - FLAG_NOSELECT | FLAG_BURST | FLAG_SKEY)) + FLAG_NOSELECT | FLAG_BURST | FLAG_IBURST | FLAG_SKEY)) != 0) { msyslog(LOG_ERR, "invalid flags (%ld) in file %s", intval[TOK_FLAGS], name); @@ -884,6 +996,8 @@ readconf( flags |= CONF_FLAG_NOSELECT; if (intval[TOK_FLAGS] & FLAG_BURST) flags |= CONF_FLAG_BURST; + if (intval[TOK_FLAGS] & FLAG_IBURST) + flags |= CONF_FLAG_IBURST; if (intval[TOK_FLAGS] & FLAG_SKEY) flags |= CONF_FLAG_SKEY; @@ -893,7 +1007,7 @@ readconf( addentry(token[TOK_HOSTNAME], (int)intval[TOK_HMODE], (int)intval[TOK_VERSION], (int)intval[TOK_MINPOLL], (int)intval[TOK_MAXPOLL], flags, (int)intval[TOK_TTL], - intval[TOK_KEYID]); + intval[TOK_KEYID], token[TOK_KEYSTR]); } } @@ -909,16 +1023,12 @@ doconfigure( register struct conf_entry *ce; register struct conf_entry *ceremove; -#ifdef DEBUG - if (debug > 1) - msyslog(LOG_INFO, "doconfigure(%d)", dores); -#endif - ce = confentries; while (ce != NULL) { #ifdef DEBUG if (debug > 1) - msyslog(LOG_INFO, "doconfigure: <%s> has peeraddr %#x", + msyslog(LOG_INFO, + "doconfigure: <%s> has peeraddr %#x", ce->ce_name, ce->ce_peeraddr); #endif if (dores && ce->ce_peeraddr == 0) { @@ -931,28 +1041,10 @@ doconfigure( removeentry(ceremove); continue; } -#ifdef DEBUG - if (debug > 1) { - msyslog(LOG_INFO, - "doconfigure:findhostaddr() worked"); - } -#endif } if (ce->ce_peeraddr != 0) { -#ifdef DEBUG - if (debug > 1) { - msyslog(LOG_INFO, - "doconfigure: calling request()"); - } -#endif if (request(&ce->ce_config)) { -#ifdef DEBUG - if (debug > 1) { - msyslog(LOG_INFO, - "doconfigure: request() OK, removing this entry"); - } -#endif ceremove = ce; ce = ceremove->ce_next; removeentry(ceremove); @@ -961,7 +1053,7 @@ doconfigure( #ifdef DEBUG if (debug > 1) { msyslog(LOG_INFO, - "doconfigure: request() FAILED, maybe next time."); + "doconfigure: request() FAILED, maybe next time."); } #endif } diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c index e209d6d..23c0cb7 100644 --- a/contrib/ntp/ntpd/ntp_io.c +++ b/contrib/ntp/ntpd/ntp_io.c @@ -7,15 +7,19 @@ # include <config.h> #endif +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_io.h" +#include "iosignal.h" +#include "ntp_refclock.h" +#include "ntp_if.h" +#include "ntp_stdlib.h" + #include <stdio.h> #include <signal.h> -#include <sys/types.h> #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif /* HAVE_SYS_PARAM_H */ -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif @@ -37,14 +41,6 @@ # include <ifaddrs.h> #endif -#include "ntp_machine.h" -#include "ntpd.h" -#include "ntp_io.h" -#include "iosignal.h" -#include "ntp_refclock.h" -#include "ntp_if.h" -#include "ntp_stdlib.h" - #if defined(VMS) /* most likely UCX-specific */ #include <UCX$INETDEF.H> @@ -116,10 +112,10 @@ u_long io_timereset; /* time counters were reset */ /* * Interface stuff */ -struct interface *any_interface; /* pointer to default interface */ -struct interface *loopback_interface; /* point to loopback interface */ -static struct interface inter_list[MAXINTERFACES]; -static int ninterfaces; +struct interface *any_interface; /* default interface */ +struct interface *loopback_interface; /* loopback interface */ +struct interface inter_list[MAXINTERFACES]; +int ninterfaces; #ifdef REFCLOCK /* @@ -241,6 +237,7 @@ create_sockets( inter_list[0].sent = 0; inter_list[0].notsent = 0; inter_list[0].flags = INT_BROADCAST; + any_interface = &inter_list[0]; #if _BSDI_VERSION >= 199510 #if _BSDI_VERSION >= 199701 @@ -274,46 +271,32 @@ create_sockets( if ((ifap->ifa_flags & IFF_UP) == 0) continue; - if (ifap->ifa_flags & IFF_LOOPBACK) - { + if (ifap->ifa_flags & IFF_LOOPBACK) { sin = (struct sockaddr_in *)ifap->ifa_addr; if (ntohl(sin->sin_addr.s_addr) != 0x7f000001) - { continue; - } } - inter_list[i].flags = 0; if (ifap->ifa_flags & IFF_BROADCAST) - inter_list[i].flags |= INT_BROADCAST; - - (void)strcpy(inter_list[i].name, ifap->ifa_name); - + inter_list[i].flags |= INT_BROADCAST; + strcpy(inter_list[i].name, ifap->ifa_name); sin = (struct sockaddr_in *)ifap->ifa_addr; inter_list[i].sin = *sin; inter_list[i].sin.sin_port = port; - - if (ifap->ifa_flags & IFF_LOOPBACK) - { + if (ifap->ifa_flags & IFF_LOOPBACK) { inter_list[i].flags = INT_LOOPBACK; if (loopback_interface == NULL || ntohl(sin->sin_addr.s_addr) != 0x7f000001) loopback_interface = &inter_list[i]; } - - if (inter_list[i].flags & INT_BROADCAST) - { + if (inter_list[i].flags & INT_BROADCAST) { sin = (struct sockaddr_in *)ifap->ifa_broadaddr; inter_list[i].bcast = *sin; inter_list[i].bcast.sin_port = port; } - - if (ifap->ifa_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) - { + if (ifap->ifa_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) { inter_list[i].mask.sin_addr.s_addr = 0xffffffff; - } - else - { + } else { sin = (struct sockaddr_in *)ifap->ifa_netmask; inter_list[i].mask = *sin; } @@ -444,7 +427,7 @@ create_sockets( continue; } # endif /* SYS_WINNT */ - memcpy(&ifreq, ifr, sizeof(ifreq)); + ifreq = *ifr; inter_list[i].flags = 0; /* is it broadcast capable? */ # ifndef SYS_WINNT @@ -614,9 +597,8 @@ create_sockets( maxactivefd = 0; FD_ZERO(&activefds); for (i = 0; i < ninterfaces; i++) { - inter_list[i].fd = - open_socket(&inter_list[i].sin, - inter_list[i].flags & INT_BROADCAST, 0); + inter_list[i].fd = open_socket(&inter_list[i].sin, + inter_list[i].flags & INT_BROADCAST, 0); } /* @@ -653,12 +635,10 @@ create_sockets( */ resmask.sin_addr.s_addr = ~ (u_int32)0; for (i = 1; i < ninterfaces; i++) - hack_restrict(RESTRICT_FLAGS, &inter_list[i].sin, &resmask, - RESM_NTPONLY|RESM_INTERFACE, RES_IGNORE); - - any_interface = &inter_list[0]; + hack_restrict(RESTRICT_FLAGS, &inter_list[i].sin, &resmask, + RESM_NTPONLY|RESM_INTERFACE, RES_IGNORE); #ifdef DEBUG - if (debug > 2) { + if (debug > 1) { printf("create_sockets: ninterfaces=%d\n", ninterfaces); for (i = 0; i < ninterfaces; i++) { printf("interface %d: fd=%d, bfd=%d, name=%.8s, flags=0x%x\n", @@ -694,17 +674,19 @@ io_setbclient(void) { int i; - for (i = 1; i < ninterfaces; i++) - { + for (i = 1; i < ninterfaces; i++) { if (!(inter_list[i].flags & INT_BROADCAST)) - continue; + continue; + if (inter_list[i].flags & INT_BCASTOPEN) - continue; + continue; + #ifdef SYS_SOLARIS inter_list[i].bcast.sin_addr.s_addr = htonl(INADDR_ANY); #endif #ifdef OPEN_BCAST_SOCKET /* Was: !SYS_DOMAINOS && !SYS_LINUX */ - inter_list[i].bfd = open_socket(&inter_list[i].bcast, INT_BROADCAST, 1); + inter_list[i].bfd = open_socket(&inter_list[i].bcast, + INT_BROADCAST, 1); inter_list[i].flags |= INT_BCASTOPEN; #endif } @@ -728,50 +710,47 @@ io_multicast_add( struct sockaddr_in *sinp; iaddr.s_addr = addr; - - if (!IN_CLASSD(haddr)) - { + if (!IN_CLASSD(haddr)) { msyslog(LOG_ERR, - "cannot add multicast address %s as it is not class D", + "multicast address %s not class D", inet_ntoa(iaddr)); return; } - - for (i = 0; i < ninterfaces; i++) - { + for (i = 0; i < ninterfaces; i++) { /* Already have this address */ - if (inter_list[i].sin.sin_addr.s_addr == addr) return; + if (inter_list[i].sin.sin_addr.s_addr == addr) + return; /* found a free slot */ if (inter_list[i].sin.sin_addr.s_addr == 0 && inter_list[i].fd <= 0 && inter_list[i].bfd <= 0 && - inter_list[i].flags == 0) break; + inter_list[i].flags == 0) + break; } sinp = &(inter_list[i].sin); - memset((char *)&mreq, 0, sizeof(mreq)); memset((char *)&inter_list[i], 0, sizeof inter_list[0]); sinp->sin_family = AF_INET; sinp->sin_addr = iaddr; sinp->sin_port = htons(123); + /* + * Try opening a socket for the specified class D address. This + * works under SunOS 4.x, but not OSF1 .. :-( + */ s = open_socket(sinp, 0, 1); - /* Try opening a socket for the specified class D address */ - /* This works under SunOS 4.x, but not OSF1 .. :-( */ - if (s < 0) - { + if (s < 0) { memset((char *)&inter_list[i], 0, sizeof inter_list[0]); i = 0; /* HACK ! -- stuff in an address */ inter_list[i].bcast.sin_addr.s_addr = addr; - msyslog(LOG_ERR, "...multicast address %s using wildcard socket", - inet_ntoa(iaddr)); - } - else - { + msyslog(LOG_ERR, + "...multicast address %s using wildcard socket", + inet_ntoa(iaddr)); + } else { inter_list[i].fd = s; inter_list[i].bfd = -1; (void) strncpy(inter_list[i].name, "multicast", - sizeof(inter_list[i].name)); + sizeof(inter_list[i].name)); inter_list[i].mask.sin_addr.s_addr = htonl(~(u_int32)0); } @@ -781,19 +760,21 @@ io_multicast_add( mreq.imr_multiaddr = iaddr; mreq.imr_interface.s_addr = htonl(INADDR_ANY); if (setsockopt(inter_list[i].fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, - (char *)&mreq, sizeof(mreq)) == -1) - msyslog(LOG_ERR, + (char *)&mreq, sizeof(mreq)) == -1) + msyslog(LOG_ERR, "setsockopt IP_ADD_MEMBERSHIP fails: %m for %x / %x (%s)", - mreq.imr_multiaddr.s_addr, mreq.imr_interface.s_addr, - inet_ntoa(iaddr)); + mreq.imr_multiaddr.s_addr, + mreq.imr_interface.s_addr, inet_ntoa(iaddr)); inter_list[i].flags |= INT_MULTICAST; - if (i >= ninterfaces) ninterfaces = i+1; + if (i >= ninterfaces) + ninterfaces = i+1; #else /* MCAST */ struct in_addr iaddr; iaddr.s_addr = addr; - msyslog(LOG_ERR, "cannot add multicast address %s as no MCAST support", - inet_ntoa(iaddr)); + msyslog(LOG_ERR, + "cannot add multicast address %s as no MCAST support", + inet_ntoa(iaddr)); #endif /* MCAST */ } @@ -886,8 +867,11 @@ open_socket( int turn_off_reuse ) { - int fd, tos; + int fd; int on = 1, off = 0; +#if defined(IPTOS_LOWDELAY) && defined(IPPROTO_IP) && defined(IP_TOS) + int tos; +#endif /* IPTOS_LOWDELAY && IPPROTO_IP && IP_TOS */ /* create a datagram (UDP) socket */ if ( (fd = socket(AF_INET, SOCK_DGRAM, 0)) @@ -1071,12 +1055,11 @@ close_socket( (void) closesocket(fd); FD_CLR( (u_int) fd, &activefds); - if (fd >= maxactivefd) - { + if (fd >= maxactivefd) { newmax = 0; for (i = 0; i < maxactivefd; i++) - if (FD_ISSET(i, &activefds)) - newmax = i; + if (FD_ISSET(i, &activefds)) + newmax = i; maxactivefd = newmax; } } @@ -1096,45 +1079,16 @@ close_file( (void) close(fd); FD_CLR( (u_int) fd, &activefds); - if (fd >= maxactivefd) - { + if (fd >= maxactivefd) { newmax = 0; for (i = 0; i < maxactivefd; i++) - if (FD_ISSET(i, &activefds)) - newmax = i; + if (FD_ISSET(i, &activefds)) + newmax = i; maxactivefd = newmax; } } -/* - * findbcastinter - find broadcast interface corresponding to address - */ -struct interface * -findbcastinter( - struct sockaddr_in *addr - ) -{ -#if defined(SIOCGIFCONF) || defined(SYS_WINNT) - register int i; - register u_int32 netnum; - - netnum = NSRCADR(addr); - for (i = 1; i < ninterfaces; i++) - { - if (!(inter_list[i].flags & INT_BROADCAST)) - continue; - if (NSRCADR(&inter_list[i].bcast) == netnum) - return &inter_list[i]; - if ((NSRCADR(&inter_list[i].sin) & NSRCADR(&inter_list[i].mask)) - == (netnum & NSRCADR(&inter_list[i].mask))) - return &inter_list[i]; - } -#endif /* SIOCGIFCONF */ - return any_interface; -} - - /* XXX ELIMINATE sendpkt similar in ntpq.c, ntpdc.c, ntp_io.c, ntptrace.c */ /* * sendpkt - send a packet to the specified destination. Maintain a @@ -1172,13 +1126,6 @@ sendpkt( #else #define badaddrs ((struct cache *)0) /* Only used in empty loops! */ #endif - - /* - * check if the source address is a multicast address - replace - * interface with any-interface if so. - */ - if (IN_MULTICAST(ntohl(inter->sin.sin_addr.s_addr))) - inter = any_interface; #ifdef DEBUG if (debug > 1) printf("%ssendpkt(fd=%d dst=%s, src=%s, ttl=%d, len=%d)\n", @@ -1188,18 +1135,20 @@ sendpkt( #endif #ifdef MCAST - /* for the moment we use the bcast option to set multicast ttl */ - if (ttl >= 0 && ttl != inter->last_ttl) - { + /* + * for the moment we use the bcast option to set multicast ttl + */ + if (ttl > 0 && ttl != inter->last_ttl) { char mttl = ttl; - /* set the multicast ttl for outgoing packets */ + /* + * set the multicast ttl for outgoing packets + */ if (setsockopt(inter->fd, IPPROTO_IP, IP_MULTICAST_TTL, - &mttl, sizeof(mttl)) == -1) - { + &mttl, sizeof(mttl)) == -1) msyslog(LOG_ERR, "setsockopt IP_MULTICAST_TTL fails: %m"); - } - else inter->last_ttl = ttl; + else + inter->last_ttl = ttl; } #endif /* MCAST */ @@ -1212,7 +1161,7 @@ sendpkt( err = io_completion_port_sendto(inter, pkt, len, dest); if (err != ERROR_SUCCESS) #else - cc = sendto(inter->fd, (char *)pkt, len, 0, (struct sockaddr *)dest, + cc = sendto(inter->fd, (char *)pkt, (size_t)len, 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in)); if (cc == -1) #endif @@ -1480,7 +1429,8 @@ input_handler( } else if (rb->recv_length < 0) { - msyslog(LOG_ERR, "recvfrom() fd=%d: %m", fd); + msyslog(LOG_ERR, "recvfrom(%s) fd=%d: %m", + inet_ntoa(rb->recv_srcadr.sin_addr), fd); #ifdef DEBUG if (debug) printf("input_handler: fd=%d dropped (bad recvfrom)\n", fd); @@ -1490,8 +1440,8 @@ input_handler( } #ifdef DEBUG if (debug > 2) - printf("input_handler: fd=%d length %d from %08lx %s\n", - fd, rb->recv_length, + printf("input_handler: if=%d fd=%d length %d from %08lx %s\n", + i, fd, rb->recv_length, (u_long)ntohl(rb->recv_srcadr.sin_addr.s_addr) & 0x00000000ffffffff, inet_ntoa(rb->recv_srcadr.sin_addr)); @@ -1580,27 +1530,85 @@ input_handler( #endif /* - * findinterface - utility used by other modules to find an interface - * given an address. + * findinterface - find interface corresponding to address */ struct interface * findinterface( struct sockaddr_in *addr ) { - register int i; - register u_int32 saddr; + int s, rtn, i; + struct sockaddr_in saddr; + int saddrlen = sizeof(saddr); + u_int32 xaddr; /* - * Just match the address portion. + * This is considerably hoke. We open a socket, connect to it + * and slap a getsockname() on it. If anything breaks, as it + * probably will in some j-random knockoff, we just return the + * wildcard interface. */ - saddr = addr->sin_addr.s_addr; - for (i = 0; i < ninterfaces; i++) - { - if (inter_list[i].sin.sin_addr.s_addr == saddr) - return &inter_list[i]; + saddr.sin_family = AF_INET; + saddr.sin_addr.s_addr = addr->sin_addr.s_addr; + saddr.sin_port = htons(2000); + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s < 0) + return (any_interface); + + rtn = connect(s, (struct sockaddr *)&saddr, sizeof(saddr)); + if (rtn < 0) + return (any_interface); + + rtn = getsockname(s, (struct sockaddr *)&saddr, &saddrlen); + if (rtn < 0) + return (any_interface); + + close(s); + xaddr = NSRCADR(&saddr); + for (i = 1; i < ninterfaces; i++) { + + /* + * We match the unicast address only. + */ + if (NSRCADR(&inter_list[i].sin) == xaddr) + return (&inter_list[i]); } - return (struct interface *)0; + return (any_interface); +} + + +/* + * findbcastinter - find broadcast interface corresponding to address + */ +struct interface * +findbcastinter( + struct sockaddr_in *addr + ) +{ +#if defined(SIOCGIFCONF) || defined(SYS_WINNT) + register int i; + register u_int32 xaddr; + + xaddr = NSRCADR(addr); + for (i = 1; i < ninterfaces; i++) { + + /* + * We match only those interfaces marked as + * broadcastable and either the explicit broadcast + * address or the network portion of the IP address. + * Sloppy. + */ + if (!(inter_list[i].flags & INT_BROADCAST)) + continue; + if (NSRCADR(&inter_list[i].bcast) == xaddr) + return (&inter_list[i]); + if ((NSRCADR(&inter_list[i].sin) & + NSRCADR(&inter_list[i].mask)) == (xaddr & + NSRCADR(&inter_list[i].mask))) + return (&inter_list[i]); + } +#endif /* SIOCGIFCONF */ + return (any_interface); } diff --git a/contrib/ntp/ntpd/ntp_loopfilter.c b/contrib/ntp/ntpd/ntp_loopfilter.c index 15b625d..c8a86cf 100644 --- a/contrib/ntp/ntpd/ntp_loopfilter.c +++ b/contrib/ntp/ntpd/ntp_loopfilter.c @@ -6,19 +6,17 @@ # include <config.h> #endif +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" + #include <stdio.h> #include <ctype.h> -#include <sys/time.h> - #include <signal.h> #include <setjmp.h> -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_unixtime.h" -#include "ntp_stdlib.h" - #if defined(VMS) && defined(VMS_LOCALUNIT) /*wjm*/ #include "ntp_refclock.h" #endif /* VMS */ @@ -36,8 +34,9 @@ */ #define CLOCK_MAX .128 /* default max offset (s) */ #define CLOCK_PANIC 1000. /* default panic offset (s) */ -#define CLOCK_MAXSTAB 2e-6 /* max frequency stability */ +#define CLOCK_MAXSTAB 2e-6 /* max frequency stability (s/s) */ #define CLOCK_MAXERR 1e-2 /* max phase jitter (s) */ +#define CLOCK_PHI 15e-6 /* max frequency error (s/s) */ #define SHIFT_PLL 4 /* PLL loop gain (shift) */ #define CLOCK_AVG 4. /* FLL loop gain */ #define CLOCK_MINSEC 256. /* min FLL update interval (s) */ @@ -51,7 +50,26 @@ /* * Clock discipline state machine. This is used to control the * synchronization behavior during initialization and following a - * timewarp. + * timewarp. + * + * State < max > max Comments + * ==================================================== + * NSET FREQ FREQ no ntp.drift + * + * FSET TSET if (allow) TSET, ntp.drift + * else FREQ + * + * TSET SYNC FREQ time set + * + * FREQ SYNC if (mu < 900) FREQ calculate frequency + * else if (allow) TSET + * else FREQ + * + * SYNC SYNC if (mu < 900) SYNC normal state + * else SPIK + * + * SPIK SYNC if (allow) TSET spike detector + * else FREQ */ #define S_NSET 0 /* clock never set */ #define S_FSET 1 /* frequency set from the drift file */ @@ -72,10 +90,10 @@ * support is used as described above; if false, the kernel is bypassed * entirely and the daemon PLL used instead. * - * Each update to a prefer peer sets pps_update if it survives the + * Each update to a prefer peer sets pps_stratum if it survives the * intersection algorithm and its time is within range. The PPS time * discipline is enabled (STA_PPSTIME bit set in the status word) when - * pps_update is true and the PPS frequency discipline is enabled. If + * pps_stratum is true and the PPS frequency discipline is enabled. If * the PPS time discipline is enabled and the kernel reports a PPS * signal is present, the pps_control variable is set to the current * time. If the current time is later than pps_control by PPS_MAXAGE @@ -91,18 +109,27 @@ #define PPS_MAXAGE 120 /* kernel pps signal timeout (s) */ /* + * Program variables that can be tinkered. + */ +double clock_max = CLOCK_MAX; /* max offset before step (s) */ +double clock_panic = CLOCK_PANIC; /* max offset before panic (s) */ +double clock_phi = CLOCK_PHI; /* dispersion rate (s/s) */ +double clock_minstep = CLOCK_MINSTEP; /* step timeout (s) */ +double allan_xpt = CLOCK_ALLAN; /* minimum Allan intercept (s) */ + +/* * Program variables */ static double clock_offset; /* clock offset adjustment (s) */ -double drift_comp; /* clock frequency (ppm) */ -double clock_stability; /* clock stability (ppm) */ -double clock_max = CLOCK_MAX; /* max offset allowed before step (s) */ -static double clock_panic = CLOCK_PANIC; /* max offset allowed before panic */ +double drift_comp; /* clock frequency (s/s) */ +double clock_stability; /* clock stability (s/s) */ u_long pps_control; /* last pps sample time */ -static void rstclock P((int)); /* state transition function */ +static void rstclock P((int, double, double)); /* transition function */ #ifdef KERNEL_PLL -int pll_status; /* status bits for kernel pll */ +struct timex ntv; /* kernel API parameters */ +int pll_status; /* status bits for kernel pll */ +int pll_nano; /* nanosecond kernel switch */ #endif /* KERNEL_PLL */ /* @@ -111,32 +138,38 @@ int pll_status; /* status bits for kernel pll */ int ntp_enable; /* clock discipline enabled */ int pll_control; /* kernel support available */ int kern_enable; /* kernel support enabled */ +int pps_enable; /* kernel PPS discipline enabled */ int ext_enable; /* external clock enabled */ -int pps_update; /* pps update valid */ -int allow_set_backward = TRUE; /* step corrections allowed */ -int correct_any = FALSE; /* corrections > 1000 s allowed */ - -#ifdef STA_NANO -int pll_nano; /* nanosecond kernel switch */ -#endif /* STA_NANO */ +int pps_stratum; /* pps stratum */ +int allow_step = TRUE; /* allow step correction */ +int allow_panic = FALSE; /* allow panic correction */ +int mode_ntpdate = FALSE; /* exit on first clock set */ /* * Clock state machine variables */ -u_char sys_poll; /* log2 of system poll interval */ +u_char sys_minpoll = NTP_MINDPOLL; /* min sys poll interval (log2 s) */ +u_char sys_poll = NTP_MINDPOLL; /* system poll interval (log2 s) */ int state; /* clock discipline state */ int tc_counter; /* poll-adjust counter */ u_long last_time; /* time of last clock update (s) */ double last_offset; /* last clock offset (s) */ -double allan_xpt; /* Allan intercept (s) */ -double sys_error; /* system standard error (s) */ +double sys_jitter; /* system RMS jitter (s) */ + +/* + * Huff-n'-puff filter variables + */ +static double *sys_huffpuff; /* huff-n'-puff filter */ +static int sys_hufflen; /* huff-n'-puff filter stages */ +static int sys_huffptr; /* huff-n'-puff filter pointer */ +static double sys_mindly; /* huff-n'-puff filter min delay */ #if defined(KERNEL_PLL) /* Emacs cc-mode goes nuts if we split the next line... */ #define MOD_BITS (MOD_OFFSET | MOD_MAXERROR | MOD_ESTERROR | \ MOD_STATUS | MOD_TIMECONST) -static void pll_trap P((int)); /* configuration trap */ #ifdef SIGSYS +static void pll_trap P((int)); /* configuration trap */ static struct sigaction sigsys; /* current sigaction status */ static struct sigaction newsigsys; /* new sigaction status */ static sigjmp_buf env; /* environment var. for pll_trap() */ @@ -153,7 +186,7 @@ init_loopfilter(void) * Initialize state variables. Initially, we expect no drift * file, so set the state to S_NSET. */ - rstclock(S_NSET); + rstclock(S_NSET, current_time, 0); } /* @@ -175,30 +208,70 @@ local_clock( double dtemp, etemp; /* double temps */ int retval; /* return value */ -#if defined(KERNEL_PLL) - struct timex ntv; /* kernel interface structure */ -#endif /* KERNEL_PLL */ - + /* + * If the loop is opened, monitor and record the offsets + * anyway in order to determine the open-loop response. + */ #ifdef DEBUG if (debug) printf( - "local_clock: offset %.6f jitter %.6f state %d\n", - fp_offset, SQRT(epsil), state); + "local_clock: assocID %d off %.6f jit %.6f sta %d\n", + peer->associd, fp_offset, SQRT(epsil), state); #endif - if (!ntp_enable) - return(0); + if (!ntp_enable) { + record_loop_stats(fp_offset, drift_comp, SQRT(epsil), + clock_stability, sys_poll); + return (0); + } /* - * If the clock is way off, don't tempt fate by correcting it. + * If the clock is way off, panic is declared. The clock_panic + * defaults to 1000 s; if set to zero, the panic will never + * occur. The allow_panic defaults to FALSE, so the first panic + * will exit. It can be set TRUE by a command line option, in + * which case the clock will be set anyway and time marches on. + * But, allow_panic will be set it FALSE when the update is + * within the step range; so, subsequent panics will exit. */ -#ifndef SYS_WINNT - if (fabs(fp_offset) >= clock_panic && !correct_any) { + if (fabs(fp_offset) > clock_panic && clock_panic > 0 && + !allow_panic) { msyslog(LOG_ERR, - "time error %.0f over %d seconds; set clock manually", - fp_offset, (int)clock_panic); + "time correction of %.0f seconds exceeds sanity limit (%.0f); set clock manually to the correct UTC time.", + fp_offset, clock_panic); return (-1); } -#endif + + /* + * If simulating ntpdate, set the clock directly, rather than + * using the discipline. The clock_max defines the step + * threshold, above which the clock will be stepped instead of + * slewed. The value defaults to 128 ms, but can be set to even + * unreasonable values. If set to zero, the clock will never be + * stepped. + * + * Note that if ntpdate is active, the terminal does not detach, + * so the termination comments print directly to the console. + */ + if (mode_ntpdate) { + if (allow_step && fabs(fp_offset) > clock_max && + clock_max > 0) { + step_systime(fp_offset); + NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) + msyslog(LOG_NOTICE, "time reset %.6f s", + fp_offset); + printf("ntpd: time reset %.6fs\n", fp_offset); + } else { + adj_systime(fp_offset); + NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) + msyslog(LOG_NOTICE, "time slew %.6f s", + fp_offset); + printf("ntpd: time slew %.6fs\n", fp_offset); + } + record_loop_stats(fp_offset, drift_comp, SQRT(epsil), + clock_stability, sys_poll); + exit (0); + } + /* * If the clock has never been set, set it and initialize the * discipline parameters. We then switch to frequency mode to @@ -210,29 +283,60 @@ local_clock( step_systime(fp_offset); NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) msyslog(LOG_NOTICE, "time set %.6f s", fp_offset); - rstclock(S_TSET); - rstclock(S_FREQ); + rstclock(S_FREQ, peer->epoch, fp_offset); return (1); } /* * Update the jitter estimate. */ - oerror = sys_error; - dtemp = SQUARE(sys_error); - sys_error = SQRT(dtemp + (epsil - dtemp) / CLOCK_AVG); + oerror = sys_jitter; + dtemp = SQUARE(sys_jitter); + sys_jitter = SQRT(dtemp + (epsil - dtemp) / CLOCK_AVG); + + /* + * The huff-n'-puff filter finds the lowest delay in the recent + * interval. This is used to correct the offset by one-half the + * difference between the sample delay and minimum delay. This + * is most effective if the delays are highly assymetric and + * clockhopping is avoided and the clock frequency wander is + * relatively small. + */ + if (sys_huffpuff != NULL) { + if (peer->delay < sys_huffpuff[sys_huffptr]) + sys_huffpuff[sys_huffptr] = peer->delay; + if (peer->delay < sys_mindly) + sys_mindly = peer->delay; + if (fp_offset > 0) + dtemp = -(peer->delay - sys_mindly) / 2; + else + dtemp = (peer->delay - sys_mindly) / 2; + fp_offset += dtemp; +#ifdef DEBUG + if (debug) + printf( + "local_clock: size %d mindly %.6f huffpuff %.6f\n", + sys_hufflen, sys_mindly, dtemp); +#endif + } /* * Clock state machine transition function. This is where the * action is and defines how the system reacts to large phase * and frequency errors. There are two main regimes: when the - * phase error exceeds the maximum allowed for ordinary tracking - * and otherwise when it does not. + * offset exceeds the step threshold and when it does not. + * However, if the step threshold is set to zero, a step will + * never occur. See the instruction manual for the details how + * these actions interact with the command line options. */ retval = 0; + if (sys_poll > peer->maxpoll) + sys_poll = peer->maxpoll; + else if (sys_poll < peer->minpoll) + sys_poll = peer->minpoll; clock_frequency = flladj = plladj = 0; - mu = current_time - last_time; - if (fabs(fp_offset) > clock_max) { + mu = peer->epoch - last_time; + if (fabs(fp_offset) > clock_max && clock_max > 0) { switch (state) { /* @@ -243,32 +347,29 @@ local_clock( * to S_FREQ state. */ case S_TSET: - rstclock(S_FREQ); - last_offset = clock_offset = fp_offset; - return (0); + state = S_FREQ; + break; /* * In S_SYNC state we ignore outlyers. At the first - * outlyer after CLOCK_MINSTEP (900 s), switch to S_SPIK + * outlyer after the stepout threshold, switch to S_SPIK * state. */ case S_SYNC: - if (mu < CLOCK_MINSTEP) + if (mu < clock_minstep) return (0); - rstclock(S_SPIK); + state = S_SPIK; return (0); /* * In S_FREQ state we ignore outlyers. At the first - * outlyer after CLOCK_MINSTEP (900 s), compute the - * apparent phase and frequency correction. + * outlyer after 900 s, compute the apparent phase and + * frequency correction. */ case S_FREQ: - if (mu < CLOCK_MINSTEP) + if (mu < clock_minstep) return (0); - clock_frequency = (fp_offset - clock_offset) / - mu; - /* fall through to default */ + /* fall through to S_SPIK */ /* * In S_SPIK state a large correction is necessary. @@ -286,19 +387,19 @@ local_clock( * reset or shaken, but never stirred. */ default: - if (allow_set_backward | correct_any) { + if (allow_step) { step_systime(fp_offset); NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) msyslog(LOG_NOTICE, "time reset %.6f s", fp_offset); - rstclock(S_TSET); + rstclock(S_TSET, peer->epoch, 0); retval = 1; } else { NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT) msyslog(LOG_NOTICE, "time slew %.6f s", fp_offset); - rstclock(S_FREQ); - last_offset = clock_offset = fp_offset; + rstclock(S_FREQ, peer->epoch, + fp_offset); } break; } @@ -306,28 +407,25 @@ local_clock( switch (state) { /* - * If this is the first update, initialize the - * discipline parameters and pretend we had just set the - * clock. We don't want to step the clock unless we have - * to. + * In S_FSET state this is the first update. Adjust the + * phase, but don't adjust the frequency until the next + * update. */ case S_FSET: - rstclock(S_TSET); - last_offset = clock_offset = fp_offset; - return (0); + rstclock(S_TSET, peer->epoch, fp_offset); + break; /* - * In S_FREQ state we ignore updates until CLOCK_MINSTEP - * (900 s). After that, correct the phase and frequency - * and switch to S_SYNC state. + * In S_FREQ state ignore updates until the stepout + * threshold. After that, correct the phase and + * frequency and switch to S_SYNC state. */ case S_FREQ: - if (mu < CLOCK_MINSTEP) + if (mu < clock_minstep) return (0); clock_frequency = (fp_offset - clock_offset) / mu; - clock_offset = fp_offset; - rstclock(S_SYNC); + rstclock(S_SYNC, peer->epoch, fp_offset); break; /* @@ -337,7 +435,7 @@ local_clock( */ case S_TSET: case S_SPIK: - rstclock(S_SYNC); + state = S_SYNC; /* fall through to default */ /* @@ -349,14 +447,17 @@ local_clock( * and ignore it. */ default: + allow_panic = TRUE; if (fabs(fp_offset - last_offset) > CLOCK_SGATE * oerror && mu < ULOGTOD(sys_poll + 1)) { #ifdef DEBUG if (debug) printf( - "local_clock: popcorn %.6f %.6f\n", - fp_offset, last_offset); + "local_clock: popcorn %.6f %.6f\n", + fabs(fp_offset - + last_offset), CLOCK_SGATE * + oerror); #endif last_offset = fp_offset; return (0); @@ -366,29 +467,32 @@ local_clock( * Compute the FLL and PLL frequency adjustments * conditioned on intricate weighting factors. * For the FLL, the averaging interval is - * clamped not to decrease below the Allan - * intercept and the gain is decreased from - * unity for mu above CLOCK_MINSEC (1024 s) to - * zero below CLOCK_MINSEC (256 s). For the PLL, - * the averaging interval is clamped not to - * exceed the sustem poll interval. These - * measures insure stability of the clock - * discipline even when the rules of fair - * engagement are broken. + * clamped to a minimum of 1024 s and the gain + * is decreased from unity for mu above 1024 s + * to zero below 256 s. For the PLL, the + * averaging interval is clamped not to exceed + * the sustem poll interval. No gain factor is + * necessary, since the frequency steering above + * 1024 s is negligible. Particularly for the + * PLL, these measures allow oversampling, but + * not undersampling and insure stability even + * when the rules of fair engagement are broken. */ dtemp = max(mu, allan_xpt); etemp = min(max(0, mu - CLOCK_MINSEC) / - CLOCK_ALLAN, 1.); + allan_xpt, 1.); flladj = fp_offset * etemp / (dtemp * CLOCK_AVG); dtemp = ULOGTOD(SHIFT_PLL + 2 + sys_poll); etemp = min(mu, ULOGTOD(sys_poll)); plladj = fp_offset * etemp / (dtemp * dtemp); - clock_offset = fp_offset; + last_time = peer->epoch; + last_offset = clock_offset = fp_offset; break; } } +#if defined(KERNEL_PLL) /* * This code segment works when clock adjustments are made using * precision time kernel support and the ntp_adjtime() system @@ -399,7 +503,6 @@ local_clock( * modifications provide a true microsecond clock and nanosecond * clock, respectively. */ -#if defined(KERNEL_PLL) if (pll_control && kern_enable) { /* @@ -413,7 +516,7 @@ local_clock( * frequency offsets for jitter and stability values and * to update the drift file. */ - memset((char *)&ntv, 0, sizeof ntv); + memset(&ntv, 0, sizeof(ntv)); if (ext_enable) { ntv.modes = MOD_STATUS; } else { @@ -422,25 +525,21 @@ local_clock( dtemp = -.5; else dtemp = .5; -#ifdef STA_NANO - if (pll_nano) + if (pll_nano) { ntv.offset = (int32)(clock_offset * 1e9 + dtemp); - else -#endif /* STA_NANO */ + ntv.constant = sys_poll; + } else { ntv.offset = (int32)(clock_offset * 1e6 + dtemp); + ntv.constant = sys_poll - 4; + } if (clock_frequency != 0) { ntv.modes |= MOD_FREQUENCY; ntv.freq = (int32)((clock_frequency + drift_comp) * 65536e6); } -#ifdef STA_NANO - ntv.constant = sys_poll; -#else - ntv.constant = sys_poll - 4; -#endif /* STA_NANO */ - ntv.esterror = (u_int32)(sys_error * 1e6); + ntv.esterror = (u_int32)(sys_jitter * 1e6); ntv.maxerror = (u_int32)((sys_rootdelay / 2 + sys_rootdispersion) * 1e6); ntv.status = STA_PLL; @@ -467,63 +566,53 @@ local_clock( */ if (sys_poll > NTP_MAXDPOLL) ntv.status |= STA_FLL; - } - /* - * Wiggle the PPS bits according to the health of the - * prefer peer. - */ - if (pll_status & STA_PPSSIGNAL) - ntv.status |= STA_PPSFREQ; - if (pll_status & STA_PPSFREQ && pps_update) - ntv.status |= STA_PPSTIME; + /* + * If the PPS signal is up and enabled, light + * the frequency bit. If the PPS driver is + * working, light the phase bit as well. If not, + * douse the lights, since somebody else may + * have left the switch on. + */ + if (pps_enable && pll_status & STA_PPSSIGNAL) { + ntv.status |= STA_PPSFREQ; + if (pps_stratum < STRATUM_UNSPEC) + ntv.status |= STA_PPSTIME; + } else { + ntv.status &= ~(STA_PPSFREQ | + STA_PPSTIME); + } + } /* - * Update the offset and frequency from the kernel - * variables. + * Pass the stuff to the kernel. If it squeals, turn off + * the pigs. In any case, fetch the kernel offset and + * frequency and pretend we did it here. */ if (ntp_adjtime(&ntv) == TIME_ERROR) { if (ntv.status != pll_status) msyslog(LOG_ERR, - "kernel pll status change %x", + "kernel time discipline status change %x", ntv.status); + ntv.status &= ~(STA_PPSFREQ | STA_PPSTIME); } pll_status = ntv.status; -#ifdef STA_NANO if (pll_nano) clock_offset = ntv.offset / 1e9; else -#endif /* STA_NANO */ clock_offset = ntv.offset / 1e6; -#ifdef STA_NANO - sys_poll = ntv.constant; -#else - sys_poll = ntv.constant + 4; -#endif /* STA_NANO */ clock_frequency = ntv.freq / 65536e6 - drift_comp; flladj = plladj = 0; /* - * If the kernel pps discipline is working, monitor its - * performance. + * If the kernel PPS is lit, monitor its performance. */ if (ntv.status & STA_PPSTIME) { - if (!pps_control) - NLOG(NLOG_SYSEVENT)msyslog(LOG_INFO, - "pps sync enabled"); pps_control = current_time; -#ifdef STA_NANO if (pll_nano) - record_peer_stats( - &loopback_interface->sin, - ctlsysstatus(), ntv.offset / 1e9, - 0., ntv.jitter / 1e9, 0.); + sys_jitter = ntv.jitter / 1e9; else -#endif /* STA_NANO */ - record_peer_stats( - &loopback_interface->sin, - ctlsysstatus(), ntv.offset / 1e6, - 0., ntv.jitter / 1e6, 0.); + sys_jitter = ntv.jitter / 1e6; } } #endif /* KERNEL_PLL */ @@ -537,21 +626,26 @@ local_clock( */ etemp = clock_frequency + flladj + plladj; drift_comp += etemp; - if (drift_comp > sys_maxfreq) - drift_comp = sys_maxfreq; - else if (drift_comp <= -sys_maxfreq) - drift_comp = -sys_maxfreq; + if (drift_comp > NTP_MAXFREQ) + drift_comp = NTP_MAXFREQ; + else if (drift_comp <= -NTP_MAXFREQ) + drift_comp = -NTP_MAXFREQ; dtemp = SQUARE(clock_stability); etemp = SQUARE(etemp) - dtemp; clock_stability = SQRT(dtemp + etemp / CLOCK_AVG); - allan_xpt = max(CLOCK_ALLAN, clock_stability * CLOCK_ADF); /* - * In SYNC state, adjust the poll interval. + * In SYNC state, adjust the poll interval. The trick here is to + * compare the apparent frequency change induced by the system + * jitter over the poll interval, or fritter, to the frequency + * stability. If the fritter is greater than the stability, + * phase noise predominates and the averaging interval is + * increased; otherwise, it is decreased. A bit of hysteresis + * helps calm the dance. Works best using burst mode. */ if (state == S_SYNC) { - if (clock_stability < CLOCK_MAXSTAB && - fabs(clock_offset) < CLOCK_PGATE * sys_error) { + if (sys_jitter / ULOGTOD(sys_poll) > clock_stability && + fabs(clock_offset) < CLOCK_PGATE * sys_jitter) { tc_counter += sys_poll; if (tc_counter > CLOCK_LIMIT) { tc_counter = CLOCK_LIMIT; @@ -575,25 +669,17 @@ local_clock( /* * Update the system time variables. */ - last_time = current_time; - last_offset = clock_offset; - dtemp = peer->disp + SQRT(peer->variance + SQUARE(sys_error)); + dtemp = peer->disp + sys_jitter; if ((peer->flags & FLAG_REFCLOCK) == 0 && dtemp < MINDISPERSE) dtemp = MINDISPERSE; sys_rootdispersion = peer->rootdispersion + dtemp; - (void)record_loop_stats(); -#ifdef DEBUG - if (debug) - printf( - "local_clock: mu %.0f allan %.0f fadj %.3f fll %.3f pll %.3f\n", - mu, allan_xpt, clock_frequency * 1e6, flladj * 1e6, - plladj * 1e6); -#endif /* DEBUG */ + record_loop_stats(last_offset, drift_comp, sys_jitter, + clock_stability, sys_poll); #ifdef DEBUG if (debug) printf( - "local_clock: jitter %.6f freq %.3f stab %.3f poll %d count %d\n", - sys_error, drift_comp * 1e6, clock_stability * 1e6, + "local_clock: mu %.0f noi %.3f stb %.3f pol %d cnt %d\n", + mu, sys_jitter * 1e6 / mu, clock_stability * 1e6, sys_poll, tc_counter); #endif /* DEBUG */ return (retval); @@ -620,7 +706,7 @@ adj_host_clock( * maximum error and the local clock driver will pick it up and * pass to the common refclock routines. Very elegant. */ - sys_rootdispersion += CLOCK_PHI; + sys_rootdispersion += clock_phi; /* * Declare PPS kernel unsync if the pps signal has not been @@ -665,51 +751,35 @@ adj_host_clock( */ static void rstclock( - int trans /* new state */ + int trans, /* new state */ + double epoch, /* last time */ + double offset /* last offset */ ) { - correct_any = FALSE; + tc_counter = 0; + sys_poll = NTP_MINPOLL; state = trans; - switch (state) { - - /* - * Frequency mode. The clock has ben set, but the frequency has - * not yet been determined. Note that the Allan intercept is set - * insure the clock filter considers only the most recent - * measurements. - */ - case S_FREQ: - sys_poll = NTP_MINDPOLL; - allan_xpt = CLOCK_ALLAN; - last_time = current_time; - break; + last_time = epoch; + last_offset = clock_offset = offset; +} - /* - * Synchronized mode. Discipline the poll interval. - */ - case S_SYNC: - sys_poll = NTP_MINDPOLL; - allan_xpt = CLOCK_ALLAN; - tc_counter = 0; - break; - /* - * Don't do anything in S_SPIK state; just continue from S_SYNC - * state. - */ - case S_SPIK: - break; +/* + * huff-n'-puff filter + */ +void +huffpuff() +{ + int i; - /* - * S_NSET, S_FSET and S_TSET states. These transient states set - * the time reference for future frequency updates. - */ - default: - sys_poll = NTP_MINDPOLL; - allan_xpt = CLOCK_ALLAN; - last_time = current_time; - last_offset = clock_offset = 0; - break; + if (sys_huffpuff == NULL) + return; + sys_huffptr = (sys_huffptr + 1) % sys_hufflen; + sys_huffpuff[sys_huffptr] = 1e9; + sys_mindly = 1e9; + for (i = 0; i < sys_hufflen; i++) { + if (sys_huffpuff[i] < sys_mindly) + sys_mindly = sys_huffpuff[i]; } } @@ -723,111 +793,148 @@ loop_config( double freq ) { -#if defined(KERNEL_PLL) - struct timex ntv; -#endif /* KERNEL_PLL */ + int i; -#ifdef DEBUG - if (debug) - printf("loop_config: state %d freq %.3f\n", item, freq * - 1e6); -#endif switch (item) { - case LOOP_DRIFTINIT: - case LOOP_DRIFTCOMP: + case LOOP_DRIFTINIT: - /* - * The drift file is present and the initial frequency - * is available, so set the state to S_FSET - */ - rstclock(S_FSET); - drift_comp = freq; - if (drift_comp > sys_maxfreq) - drift_comp = sys_maxfreq; - if (drift_comp < -sys_maxfreq) - drift_comp = -sys_maxfreq; #ifdef KERNEL_PLL /* - * If the phase-lock code is implemented in the kernel, - * give the time_constant and saved frequency offset to - * the kernel. If not, no harm is done. Note the initial - * time constant is zero, but the first clock update - * will fix that. + * Assume the kernel supports the ntp_adjtime() syscall. + * If that syscall works, initialize the kernel + * variables. Otherwise, continue leaving no harm + * behind. While at it, ask to set nanosecond mode. If + * the kernel agrees, rejoice; othewise, it does only + * microseconds. */ - memset((char *)&ntv, 0, sizeof ntv); pll_control = 1; -#ifdef MOD_NANO - ntv.modes = MOD_NANO; -#endif /* MOD_NANO */ + memset(&ntv, 0, sizeof(ntv)); +#ifdef STA_NANO + ntv.modes = MOD_BITS | MOD_NANO; +#else + ntv.modes = MOD_BITS; +#endif /* STA_NANO */ + ntv.maxerror = MAXDISPERSE; + ntv.esterror = MAXDISPERSE; + ntv.status = STA_UNSYNC; #ifdef SIGSYS + /* + * Use sigsetjmp() to save state and then call + * ntp_adjtime(); if it fails, then siglongjmp() is used + * to return control + */ newsigsys.sa_handler = pll_trap; newsigsys.sa_flags = 0; if (sigaction(SIGSYS, &newsigsys, &sigsys)) { msyslog(LOG_ERR, "sigaction() fails to save SIGSYS trap: %m"); pll_control = 0; - return; } - - /* - * Use sigsetjmp() to save state and then call - * ntp_adjtime(); if it fails, then siglongjmp() is used - * to return control - */ if (sigsetjmp(env, 1) == 0) - (void)ntp_adjtime(&ntv); + ntp_adjtime(&ntv); if ((sigaction(SIGSYS, &sigsys, (struct sigaction *)NULL))) { msyslog(LOG_ERR, "sigaction() fails to restore SIGSYS trap: %m"); pll_control = 0; - return; } #else /* SIGSYS */ - if (ntp_adjtime(&ntv) < 0) { - msyslog(LOG_ERR, - "loop_config: ntp_adjtime() failed: %m"); - pll_control = 0; - } + ntp_adjtime(&ntv); #endif /* SIGSYS */ - - /* - * If the kernel support is available and enabled, - * initialize the parameters, but only if the external - * clock is not present. - */ - if (pll_control && kern_enable) { - msyslog(LOG_NOTICE, - "using kernel phase-lock loop %04x", - ntv.status); + pll_status = ntv.status; + if (pll_control) { #ifdef STA_NANO - if (ntv.status & STA_NANO) + if (pll_status & STA_NANO) pll_nano = 1; + if (pll_status & STA_CLK) + ext_enable = 1; #endif /* STA_NANO */ -#ifdef STA_CLK + msyslog(LOG_NOTICE, + "kernel time discipline status %04x", + pll_status); + } +#endif /* KERNEL_PLL */ + break; - if (ntv.status & STA_CLK) { - ext_enable = 1; - } else { - ntv.modes = MOD_BITS | MOD_FREQUENCY; + case LOOP_DRIFTCOMP: + + /* + * Initialize the kernel frequency and clamp to + * reasonable value. Also set the initial state to + * S_FSET to indicated the frequency has been + * initialized from the previously saved drift file. + */ + rstclock(S_FSET, current_time, 0); + drift_comp = freq; + if (drift_comp > NTP_MAXFREQ) + drift_comp = NTP_MAXFREQ; + if (drift_comp < -NTP_MAXFREQ) + drift_comp = -NTP_MAXFREQ; + +#ifdef KERNEL_PLL + /* + * Sanity check. If the kernel is enabled, load the + * frequency and light up the loop. If not, set the + * kernel frequency to zero and leave the loop dark. In + * either case set the time to zero to cancel any + * previous nonsense. + */ + if (pll_control) { + memset((char *)&ntv, 0, sizeof(ntv)); + ntv.modes = MOD_OFFSET | MOD_FREQUENCY; + if (kern_enable) { + ntv.modes |= MOD_STATUS; + ntv.status = STA_PLL; ntv.freq = (int32)(drift_comp * 65536e6); - ntv.maxerror = MAXDISPERSE; - ntv.esterror = MAXDISPERSE; - ntv.status = STA_UNSYNC | STA_PLL; - (void)ntp_adjtime(&ntv); } -#else - ntv.modes = MOD_BITS | MOD_FREQUENCY; - ntv.freq = (int32)(drift_comp * 65536e6); - ntv.maxerror = MAXDISPERSE; - ntv.esterror = MAXDISPERSE; - ntv.status = STA_UNSYNC | STA_PLL; (void)ntp_adjtime(&ntv); -#endif /* STA_CLK */ } #endif /* KERNEL_PLL */ + break; + + /* + * Special tinker variables for Ulrich Windl. Very dangerous. + */ + case LOOP_MAX: /* step threshold */ + clock_max = freq; + break; + + case LOOP_PANIC: /* panic exit threshold */ + clock_panic = freq; + break; + + case LOOP_PHI: /* dispersion rate */ + clock_phi = freq; + break; + + case LOOP_MINSTEP: /* watchdog bark */ + clock_minstep = freq; + break; + + case LOOP_MINPOLL: /* ephemeral association poll */ + if (freq < NTP_MINPOLL) + freq = NTP_MINPOLL; + sys_minpoll = (u_char)freq; + break; + + case LOOP_ALLAN: /* minimum Allan intercept */ + if (freq < CLOCK_ALLAN) + freq = CLOCK_ALLAN; + allan_xpt = freq; + break; + + case LOOP_HUFFPUFF: /* huff-n'-puff filter length */ + if (freq < HUFFPUFF) + freq = HUFFPUFF; + sys_hufflen = (int)(freq / HUFFPUFF); + sys_huffpuff = (double *)emalloc(sizeof(double) * + sys_hufflen); + for (i = 0; i < sys_hufflen; i++) + sys_huffpuff[i] = 1e9; + sys_mindly = 1e9; + break; } } diff --git a/contrib/ntp/ntpd/ntp_monitor.c b/contrib/ntp/ntpd/ntp_monitor.c index 64dfb3e..8526aac 100644 --- a/contrib/ntp/ntpd/ntp_monitor.c +++ b/contrib/ntp/ntpd/ntp_monitor.c @@ -1,23 +1,22 @@ /* * ntp_monitor.c - monitor who is using the ntpd server */ + #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#include <stdio.h> -#include <sys/types.h> -#include <signal.h> -# ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -# endif -# include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_if.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <signal.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif + /* * I'm still not sure I like what I've done here. It certainly consumes * memory like it is going out of style, and also may not be as low diff --git a/contrib/ntp/ntpd/ntp_peer.c b/contrib/ntp/ntpd/ntp_peer.c index 90646ab..b164181 100644 --- a/contrib/ntp/ntpd/ntp_peer.c +++ b/contrib/ntp/ntpd/ntp_peer.c @@ -10,6 +10,9 @@ #include "ntpd.h" #include "ntp_stdlib.h" +#ifdef AUTOKEY +#include "ntp_crypto.h" +#endif /* AUTOKEY */ /* * Table of valid association combinations @@ -27,15 +30,13 @@ * CONTROL | e 0 0 0 0 0 * PRIVATE | e 0 0 0 0 0 * BCLIENT | e 0 0 0 e 1 - * MCLIENT | e 0 0 0 0 0 * - * One point to note here: - * a packet in BCAST mode can potentially match a peer in CLIENT - * mode, but we that is a special case and we check for that early - * in the decision process. This avoids having to keep track of - * what kind of associations are possible etc... We actually - * circumvent that problem by requiring that the first b(m)roadcast - * received after the change back to BCLIENT mode sets the clock. + * One point to note here: a packet in BCAST mode can potentially match + * a peer in CLIENT mode, but we that is a special case and we check for + * that early in the decision process. This avoids having to keep track + * of what kind of associations are possible etc... We actually + * circumvent that problem by requiring that the first b(m)roadcast + * received after the change back to BCLIENT mode sets the clock. */ int AM[AM_MODES][AM_MODES] = { @@ -58,82 +59,59 @@ int AM[AM_MODES][AM_MODES] = { /*PRIV*/{ AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH}, /*BCL*/ { AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_ERR, AM_PROCPKT}, - -/*MCL*/ { AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH} }; #define MATCH_ASSOC(x,y) AM[(x)][(y)] /* * These routines manage the allocation of memory to peer structures - * and the maintenance of the peer hash table. The two main entry - * points are findpeer(), which looks for corresponding peer data - * in the peer list, newpeer(), which allocates a new peer structure - * and adds it to the list, and unpeer(), which demobilizes the association + * and the maintenance of the peer hash table. The two main entry + * points are findpeer(), which looks for matching peer sturctures in + * the peer list, newpeer(), which allocates a new peer structure and + * adds it to the list, and unpeer(), which demobilizes the association * and deallocates the structure. */ - -/* - * The peer hash table (imported by the protocol module). - */ -struct peer *peer_hash[HASH_SIZE]; -int peer_hash_count[HASH_SIZE]; /* count of peers in each bucket */ - /* - * The association ID hash table. Used for lookups by association ID + * Peer hash tables */ -struct peer *assoc_hash[HASH_SIZE]; -int assoc_hash_count[HASH_SIZE]; +struct peer *peer_hash[HASH_SIZE]; /* peer hash table */ +int peer_hash_count[HASH_SIZE]; /* peers in each bucket */ +struct peer *assoc_hash[HASH_SIZE]; /* association ID hash table */ +int assoc_hash_count[HASH_SIZE]; /* peers in each bucket */ +static struct peer *peer_free; /* peer structures free list */ +int peer_free_count; /* count of free structures */ /* - * The free list. Clean structures only, please. - */ -static struct peer *peer_free; -int peer_free_count; - -/* - * Association ID. We initialize this value randomly, the assign a new + * Association ID. We initialize this value randomly, then assign a new * value every time the peer structure is incremented. */ -static u_short current_association_ID; +static associd_t current_association_ID; /* association ID */ /* * Memory allocation watermarks. */ -#define INIT_PEER_ALLOC 15 /* initialize space for 15 peers */ -#define INC_PEER_ALLOC 5 /* when we run out, add 5 more */ +#define INIT_PEER_ALLOC 15 /* initialize for 15 peers */ +#define INC_PEER_ALLOC 5 /* when run out, add 5 more */ /* * Miscellaneous statistic counters which may be queried. */ -u_long peer_timereset; /* time stat counters were zeroed */ -u_long findpeer_calls; /* number of calls to findpeer */ -u_long assocpeer_calls; /* number of calls to findpeerbyassoc */ -u_long peer_allocations; /* number of allocations from the free list */ -u_long peer_demobilizations; /* number of structs freed to free list */ -int total_peer_structs; /* number of peer structs in circulation */ -int peer_associations; /* number of active associations */ - -/* - * Our initial allocation of peer space - */ -static struct peer init_peer_alloc[INIT_PEER_ALLOC]; - -/* - * Initialization data. When configuring peers at initialization time, - * we try to get their poll update timers initialized to different values - * to prevent us from sending big clumps of data all at once. - */ -/* static u_long init_peer_starttime; */ +u_long peer_timereset; /* time stat counters zeroed */ +u_long findpeer_calls; /* calls to findpeer */ +u_long assocpeer_calls; /* calls to findpeerbyassoc */ +u_long peer_allocations; /* allocations from free list */ +u_long peer_demobilizations; /* structs freed to free list */ +int total_peer_structs; /* peer structs */ +int peer_associations; /* active associations */ +static struct peer init_peer_alloc[INIT_PEER_ALLOC]; /* init alloc */ static void getmorepeermem P((void)); -static void key_expire P((struct peer *)); /* * init_peer - initialize peer data structures and counters * - * N.B. We use the random number routine in here. It had better be - * initialized prior to getting here. + * N.B. We use the random number routine in here. It had better be + * initialized prior to getting here. */ void init_peer(void) @@ -157,11 +135,6 @@ init_peer(void) assocpeer_calls = peer_demobilizations = 0; /* - * Initialization counter. - */ - /* init_peer_starttime = 0; */ - - /* * Initialize peer memory. */ peer_free = 0; @@ -175,7 +148,7 @@ init_peer(void) /* * Initialize our first association ID */ - current_association_ID = (u_short)ranp2(16); + current_association_ID = (associd_t)ranp2(16); if (current_association_ID == 0) current_association_ID = 1; } @@ -190,7 +163,8 @@ getmorepeermem(void) register int i; register struct peer *peer; - peer = (struct peer *)emalloc(INC_PEER_ALLOC*sizeof(struct peer)); + peer = (struct peer *)emalloc(INC_PEER_ALLOC * + sizeof(struct peer)); for (i = 0; i < INC_PEER_ALLOC; i++) { peer->next = peer_free; peer_free = peer; @@ -202,7 +176,6 @@ getmorepeermem(void) } - /* * findexistingpeer - return a pointer to a peer in the hash table */ @@ -220,22 +193,21 @@ findexistingpeer( * same peer through different interfaces in the hash table. */ if (start_peer == 0) - peer = peer_hash[HASH_ADDR(addr)]; + peer = peer_hash[HASH_ADDR(addr)]; else - peer = start_peer->next; + peer = start_peer->next; while (peer != 0) { if (NSRCADR(addr) == NSRCADR(&peer->srcadr) && NSRCPORT(addr) == NSRCPORT(&peer->srcadr)) { if (mode == -1) - return peer; + return (peer); else if (peer->hmode == mode) break; } peer = peer->next; } - - return peer; + return (peer); } @@ -259,50 +231,46 @@ findpeer( for (peer = peer_hash[hash]; peer != 0; peer = peer->next) { if (NSRCADR(srcadr) == NSRCADR(&peer->srcadr) && NSRCPORT(srcadr) == NSRCPORT(&peer->srcadr)) { + /* - * if the association matching rules determine that - * this is not a valid combination, then look for - * the next valid peer association. + * if the association matching rules determine + * that this is not a valid combination, then + * look for the next valid peer association. */ *action = MATCH_ASSOC(peer->hmode, pkt_mode); /* * Sigh! Check if BCLIENT peer in client - * server mode, else return error + * server mode, else return error. */ - if ((*action == AM_POSSBCL) && - !(peer->cast_flags & FLAG_MCAST1)) { + if ((*action == AM_POSSBCL) && !(peer->flags & + FLAG_MCAST)) *action = AM_ERR; - } - /* if an error was returned, exit back right here */ + /* + * if an error was returned, exit back right + * here. + */ if (*action == AM_ERR) - return (struct peer *)0; + return ((struct peer *)0); - /* if a match is found, we stop our search */ + /* + * if a match is found, we stop our search. + */ if (*action != AM_NOMATCH) break; } } -#ifdef DEBUG - if (debug > 1) - printf("pkt_mode %d action %d\n", pkt_mode, *action); -#endif - /* if no matching association is found */ + /* + * If no matching association is found + */ if (peer == 0) { *action = MATCH_ASSOC(NO_PEER, pkt_mode); -#ifdef DEBUG - if (debug > 1) - printf("pkt_mode %d action %d\n", pkt_mode, *action); -#endif - return (struct peer *)0; + return ((struct peer *)0); } - - /* reset the default interface to something more meaningful */ - if ((peer->dstadr == any_interface)) - peer->dstadr = dstadr; - return peer; + peer->dstadr = dstadr; + return (peer); } /* @@ -310,7 +278,7 @@ findpeer( */ struct peer * findpeerbyassoc( - int assoc + u_int assoc ) { register struct peer *peer; @@ -319,101 +287,41 @@ findpeerbyassoc( assocpeer_calls++; hash = assoc & HASH_MASK; - for (peer = assoc_hash[hash]; peer != 0; peer = peer->ass_next) { - if ((u_short)assoc == peer->associd) - return peer; /* got it! */ + for (peer = assoc_hash[hash]; peer != 0; peer = + peer->ass_next) { + if (assoc == peer->associd) + return (peer); } - - /* - * Out of luck. Return 0. - */ - return (struct peer *)0; + return (NULL); } -/* - * findmanycastpeer - find and return an manycast peer if it exists - * - * - * the current implementation loops across all hash-buckets - * - * *** THERE IS AN URGENT NEED TO CHANGE THIS *** - */ -struct peer * -findmanycastpeer( - l_fp *p_org - ) -{ - register struct peer *peer; - register struct peer *manycast_peer = 0; - int i = 0; - - for (i = 0; i < HASH_SIZE; i++) { - if (peer_hash_count[i] == 0) - continue; - - for (peer = peer_hash[i]; peer != 0; peer = peer->next) { - if (peer->cast_flags & MDF_ACAST && - peer->flags & FLAG_CONFIG) { - if (L_ISEQU(&peer->xmt, p_org)) - return peer; /* got it */ - else - manycast_peer = peer; - } - } - } - - /* - * Out of luck. Return the manycastpeer for what it is worth. - */ - return manycast_peer; -} - -/* - * key_expire - garbage collect keys - */ -static void -key_expire( - struct peer *peer - ) -{ - int i; - - if (peer->keylist != 0) { - for (i = 0; i <= peer->keynumber; i++) - authtrust(peer->keylist[i], 0); - free(peer->keylist); - peer->keylist = 0; - } - if (peer->keyid > NTP_MAXKEY) { - authtrust(peer->keyid, 0); - peer->keyid = 0; - } -} /* - * key_rekey - expire all keys and roll a new private value. Note the - * 32-bit mask is necessary for 64-bit u_longs. + * clear_all - flush all time values for all associations */ void -key_expire_all( - ) +clear_all(void) { struct peer *peer, *next_peer; int n; + /* + * This routine is called when the clock is stepped, and so all + * previously saved time values are untrusted. + */ for (n = 0; n < HASH_SIZE; n++) { for (peer = peer_hash[n]; peer != 0; peer = next_peer) { next_peer = peer->next; - key_expire(peer); + peer_clear(peer); } } - sys_private = (u_long)RANDOM & 0xffffffff; #ifdef DEBUG if (debug) - printf("key_expire_all: at %lu private %08lx\n", - current_time, sys_private); + printf("clear_all: at %lu\n", current_time); #endif } + + /* * unpeer - remove peer structure from hash table and free structure */ @@ -424,16 +332,16 @@ unpeer( { int hash; + peer_associations--; #ifdef DEBUG - if (debug > 1) - printf("demobilize %u\n", peer_to_remove->associd); + if (debug) + printf("demobilize %u %d\n", peer_to_remove->associd, + peer_associations); #endif - key_expire(peer_to_remove); + peer_clear(peer_to_remove); hash = HASH_ADDR(&peer_to_remove->srcadr); peer_hash_count[hash]--; peer_demobilizations++; - peer_associations--; - #ifdef REFCLOCK /* * If this peer is actually a clock, shut it down first @@ -490,7 +398,7 @@ unpeer( /* - * peer_config - configure a new peer + * peer_config - configure a new association */ struct peer * peer_config( @@ -500,63 +408,83 @@ peer_config( int version, int minpoll, int maxpoll, - int flags, + u_int flags, int ttl, - u_long key + keyid_t key, + u_char *keystr ) { register struct peer *peer; + u_int cast_flags; /* - * See if we have this guy in the tables already. If - * so just mark him configured. + * First search from the beginning for an association with given + * remote address and mode. If an interface is given, search + * from there to find the association which matches that + * destination. */ peer = findexistingpeer(srcadr, (struct peer *)0, hmode); if (dstadr != 0) { while (peer != 0) { if (peer->dstadr == dstadr) - break; + break; peer = findexistingpeer(srcadr, peer, hmode); } } /* - * If we found one, just change his mode and mark him configured. + * We do a dirty little jig to figure the cast flags. This is + * probably not the best place to do this, at least until the + * configure code is rebuilt. Note only one flag can be set. + */ + switch (hmode) { + + case MODE_BROADCAST: + if (IN_CLASSD(ntohl(srcadr->sin_addr.s_addr))) + cast_flags = MDF_MCAST; + else + cast_flags = MDF_BCAST; + break; + + case MODE_CLIENT: + if (IN_CLASSD(ntohl(srcadr->sin_addr.s_addr))) + cast_flags = MDF_ACAST; + else + cast_flags = MDF_UCAST; + break; + + default: + cast_flags = MDF_UCAST; + break; + } + + /* + * If the peer is already configured, some dope has a duplicate + * configureation entry or another dope is wiggling from afar. */ if (peer != 0) { peer->hmode = (u_char)hmode; peer->version = (u_char)version; peer->minpoll = (u_char)minpoll; peer->maxpoll = (u_char)maxpoll; - peer->hpoll = peer->minpoll; - peer->ppoll = peer->minpoll; + peer->hpoll = peer->kpoll = peer->minpoll; + peer->ppoll = peer->maxpoll; peer->flags = flags | FLAG_CONFIG | (peer->flags & FLAG_REFCLOCK); - peer->cast_flags = (hmode == MODE_BROADCAST) ? - IN_CLASSD(ntohl(srcadr->sin_addr.s_addr)) ? MDF_MCAST : MDF_BCAST : MDF_UCAST; - peer->ttl = (u_char)ttl; + peer->cast_flags = cast_flags; + peer->ttlmax = ttl; peer->keyid = key; - peer->keynumber = 0; - return peer; + return (peer); } /* - * If we're here this guy is unknown to us. Make a new peer - * structure for him. + * Here no match has been found, so presumably this is a new + * persistent association. Mobilize the thing and initialize its + * variables. */ peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll, - ttl, key); - if (peer != 0) { - peer->flags |= flags | FLAG_CONFIG; -#ifdef DEBUG - if (debug) - printf("peer_config: %s mode %d vers %d min %d max %d flags 0x%04x ttl %d key %lu\n", - ntoa(&peer->srcadr), peer->hmode, peer->version, - peer->minpoll, peer->maxpoll, peer->flags, - peer->ttl, peer->keyid); -#endif - } - return peer; + flags | FLAG_CONFIG, cast_flags, ttl, key); + return (peer); } @@ -571,74 +499,63 @@ newpeer( int version, int minpoll, int maxpoll, + u_int flags, + u_int cast_flags, int ttl, - u_long key + keyid_t key ) { register struct peer *peer; register int i; /* - * Some dirt here. Some of the initialization requires - * knowlege of our system state. + * Allocate a new peer structure. Some dirt here, since some of + * the initialization requires knowlege of our system state. */ if (peer_free_count == 0) - getmorepeermem(); - + getmorepeermem(); peer = peer_free; peer_free = peer->next; peer_free_count--; peer_associations++; + memset((char *)peer, 0, sizeof(struct peer)); /* - * Initialize the structure. This stuff is sort of part of - * the receive procedure and part of the clear procedure rolled - * into one. - * - * Zero the whole thing for now. We might be pickier later. + * Initialize the peer structure and dance the interface jig. + * Reference clocks step the loopback waltz, the others + * squaredance around the interface list looking for a buddy. If + * the dance peters out, there is always the wildcard interface. + * This might happen in some systems and would preclude proper + * operation with public key cryptography. */ - memset((char *)peer, 0, sizeof(struct peer)); - - peer->srcadr = *srcadr; - if (dstadr != 0) - peer->dstadr = dstadr; - else if (hmode == MODE_BROADCAST) + if (ISREFCLOCKADR(srcadr)) + peer->dstadr = loopback_interface; + else if (cast_flags & MDF_BCLNT) peer->dstadr = findbcastinter(srcadr); + else if (dstadr != any_interface) + peer->dstadr = dstadr; else - peer->dstadr = any_interface; - peer->cast_flags = (hmode == MODE_BROADCAST) ? - (IN_CLASSD(ntohl(srcadr->sin_addr.s_addr))) ? MDF_MCAST : - MDF_BCAST : (hmode == MODE_BCLIENT || hmode == MODE_MCLIENT) ? - (peer->dstadr->flags & INT_MULTICAST) ? MDF_MCAST : MDF_BCAST : - MDF_UCAST; - /* Set manycast flags if appropriate */ - if (IN_CLASSD(ntohl(srcadr->sin_addr.s_addr)) && hmode == MODE_CLIENT) - peer->cast_flags = MDF_ACAST; + peer->dstadr = findinterface(srcadr); + peer->srcadr = *srcadr; peer->hmode = (u_char)hmode; - peer->keyid = key; peer->version = (u_char)version; - peer->minpoll = (u_char)minpoll; - peer->maxpoll = (u_char)maxpoll; - peer->hpoll = peer->minpoll; - peer->ppoll = peer->minpoll; - peer->ttl = ttl; - peer->leap = LEAP_NOTINSYNC; + peer->minpoll = (u_char)max(NTP_MINPOLL, minpoll); + peer->maxpoll = (u_char)min(NTP_MAXPOLL, maxpoll); + peer->flags = flags | (key > NTP_MAXKEY ? FLAG_SKEY : 0); + peer->cast_flags = cast_flags; + peer->ttlmax = ttl; + peer->keyid = key; peer->precision = sys_precision; - peer->variance = MAXDISPERSE; - peer->epoch = current_time; - peer->stratum = STRATUM_UNSPEC; peer_clear(peer); - peer->update = peer->outdate = current_time; - peer->nextdate = peer->outdate + RANDPOLL(NTP_MINPOLL); - if (peer->flags & FLAG_BURST) - peer->burst = NTP_SHIFT; + if (mode_ntpdate) + peer_ntpdate++; /* - * Assign him an association ID and increment the system variable + * Assign an association ID and increment the system variable. */ peer->associd = current_association_ID; if (++current_association_ID == 0) - ++current_association_ID; + ++current_association_ID; /* * Note time on statistics timers. @@ -646,7 +563,6 @@ newpeer( peer->timereset = current_time; peer->timereachable = current_time; peer->timereceived = current_time; - #ifdef REFCLOCK if (ISREFCLOCKADR(&peer->srcadr)) { /* @@ -662,29 +578,32 @@ newpeer( peer->next = peer_free; peer_free = peer; peer_free_count++; - return 0; + return (NULL); } } #endif /* - * Put him in the hash tables. + * Put the new peer in the hash tables. */ i = HASH_ADDR(&peer->srcadr); peer->next = peer_hash[i]; peer_hash[i] = peer; peer_hash_count[i]++; - i = peer->associd & HASH_MASK; peer->ass_next = assoc_hash[i]; assoc_hash[i] = peer; assoc_hash_count[i]++; #ifdef DEBUG - if (debug > 1) - printf("mobilize %u next %lu\n", peer->associd, - peer->nextdate - peer->outdate); + if (debug) + printf( + "newpeer: %s->%s mode %d vers %d poll %d %d flags %x %x ttl %d key %08x\n", + ntoa(&peer->dstadr->sin), ntoa(&peer->srcadr), + peer->hmode, peer->version, peer->minpoll, + peer->maxpoll, peer->flags, peer->cast_flags, + peer->ttlmax, peer->keyid); #endif - return peer; + return (peer); } @@ -707,14 +626,15 @@ peer_unconfig( if (peer->flags & FLAG_CONFIG && (dstadr == 0 || peer->dstadr == dstadr)) { num_found++; + /* - * Tricky stuff here. If the peer is polling us - * in active mode, turn off the configuration bit - * and make the mode passive. This allows us to - * avoid dumping a lot of history for peers we - * might choose to keep track of in passive mode. - * The protocol will eventually terminate undesirables - * on its own. + * Tricky stuff here. If the peer is polling us + * in active mode, turn off the configuration + * bit and make the mode passive. This allows us + * to avoid dumping a lot of history for peers + * we might choose to keep track of in passive + * mode. The protocol will eventually terminate + * undesirables on its own. */ if (peer->hmode == MODE_ACTIVE && peer->pmode == MODE_ACTIVE) { @@ -727,21 +647,7 @@ peer_unconfig( } peer = findexistingpeer(srcadr, peer, mode); } - return num_found; -} - -/* - * peer_copy_manycast - copy manycast peer variables to new association - * (right now it simply copies the transmit timestamp) - */ -void -peer_config_manycast( - struct peer *peer1, - struct peer *peer2 - ) -{ - peer2->cast_flags = MDF_ACAST; - peer2->xmt = peer1->xmt; + return (num_found); } /* @@ -775,7 +681,6 @@ peer_reset( peer->oldpkt = 0; peer->seldisptoolarge = 0; peer->selbroken = 0; - peer->seltooold = 0; peer->timereset = current_time; } @@ -793,3 +698,114 @@ peer_all_reset(void) for (peer = peer_hash[hash]; peer != 0; peer = peer->next) peer_reset(peer); } + + +#ifdef AUTOKEY +/* + * expire_all - flush all crypto data and update timestamps. + */ +void +expire_all(void) +{ + struct peer *peer, *next_peer; + int n; + + /* + * This routine is called about once per day from the timer + * routine and when the client is first synchronized. Search the + * peer list for all associations and flush only the key list + * and cookie. If a manycast client association, flush + * everything. Then, recompute and sign the agreement public + * value, if present. + */ + for (n = 0; n < HASH_SIZE; n++) { + for (peer = peer_hash[n]; peer != 0; peer = next_peer) { + next_peer = peer->next; + if (peer->cast_flags & MDF_ACAST) { + peer_clear(peer); +#ifdef AUTOKEY + } else { + key_expire(peer); + peer->pcookie.tstamp = 0; +#endif /* AUTOKEY */ + } + + } + } + sys_private = (u_int32)RANDOM & 0xffffffff; +#ifdef PUBKEY + crypto_agree(); +#endif /* PUBKEY */ +#ifdef DEBUG + if (debug) + printf("expire_all: at %lu\n", current_time); +#endif +} +#endif /* AUTOKEY */ + + +/* + * findmanycastpeer - find and return a manycast peer + */ +struct peer * +findmanycastpeer( + struct recvbuf *rbufp + ) +{ + register struct peer *peer; + struct pkt *pkt; + l_fp p_org; + int i; + + /* + * This routine is called upon arrival of a client-mode message + * from a manycast server. Search the peer list for a manycast + * client association where the last transmit timestamp matches + * the originate timestamp. This assumes the transmit timestamps + * for possibly more than one manycast association are unique. + */ + pkt = &rbufp->recv_pkt; + for (i = 0; i < HASH_SIZE; i++) { + if (peer_hash_count[i] == 0) + continue; + + for (peer = peer_hash[i]; peer != 0; peer = + peer->next) { + if (peer->cast_flags & MDF_ACAST) { + NTOHL_FP(&pkt->org, &p_org); + if (L_ISEQU(&peer->xmt, &p_org)) + return (peer); + } + } + } + return (NULL); +} + + +/* + * resetmanycast - reset all manycast clients + */ +void +resetmanycast(void) +{ + register struct peer *peer; + int i; + + /* + * This routine is called when the number of client associations + * falls below the minimum. Search the peer list for manycast + * client associations and reset the ttl and poll interval. + */ + for (i = 0; i < HASH_SIZE; i++) { + if (peer_hash_count[i] == 0) + continue; + + for (peer = peer_hash[i]; peer != 0; peer = + peer->next) { + if (peer->cast_flags & MDF_ACAST) { + peer->ttl = 0; + poll_update(peer, peer->hpoll); + } + } + } +} diff --git a/contrib/ntp/ntpd/ntp_proto.c b/contrib/ntp/ntpd/ntp_proto.c index a24c0e3..4962057 100644 --- a/contrib/ntp/ntpd/ntp_proto.c +++ b/contrib/ntp/ntpd/ntp_proto.c @@ -5,15 +5,14 @@ #include <config.h> #endif -#include <stdio.h> -#include <sys/types.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_stdlib.h" #include "ntp_unixtime.h" #include "ntp_control.h" #include "ntp_string.h" +#include "ntp_crypto.h" + +#include <stdio.h> #if defined(VMS) && defined(VMS_LOCALUNIT) /*wjm*/ #include "ntp_refclock.h" @@ -24,19 +23,22 @@ #endif /* - * System variables are declared here. See Section 3.2 of the + * System variables are declared here. See Section 3.2 of the * specification. */ u_char sys_leap; /* system leap indicator */ u_char sys_stratum; /* stratum of system */ s_char sys_precision; /* local clock precision */ -double sys_rootdelay; /* distance to current sync source */ -double sys_rootdispersion; /* dispersion of system clock */ +double sys_rootdelay; /* roundtrip delay to primary source */ +double sys_rootdispersion; /* dispersion to primary source */ u_int32 sys_refid; /* reference source for local clock */ static double sys_offset; /* current local clock offset */ l_fp sys_reftime; /* time we were last updated */ struct peer *sys_peer; /* our current peer */ +struct peer *sys_prefer; /* our cherished peer */ +#ifdef AUTOKEY u_long sys_automax; /* maximum session key lifetime */ +#endif /* AUTOKEY */ /* * Nonspecified system state variables. @@ -47,10 +49,15 @@ int sys_authenticate; /* requre authentication for config */ l_fp sys_authdelay; /* authentication delay */ static u_long sys_authdly[2]; /* authentication delay shift reg */ static u_char leap_consensus; /* consensus of survivor leap bits */ -static double sys_maxd; /* select error (squares) */ -static double sys_epsil; /* system error (squares) */ -u_long sys_private; /* private value for session seed */ -int sys_manycastserver; /* 1 => respond to manycast client pkts */ +static double sys_selerr; /* select error (squares) */ +static double sys_syserr; /* system error (squares) */ +keyid_t sys_private; /* private value for session seed */ +int sys_manycastserver; /* respond to manycast client pkts */ +u_int sys_survivors; /* truest of the truechimers */ +int peer_ntpdate; /* active peers in ntpdate mode */ +#ifdef AUTOKEY +char *sys_hostname; /* gethostname() name */ +#endif /* AUTOKEY */ /* * Statistics counters @@ -68,12 +75,10 @@ u_long sys_limitrejected; /* pkts rejected due to client count per net */ static double root_distance P((struct peer *)); static double clock_combine P((struct peer **, int)); static void peer_xmit P((struct peer *)); -static void fast_xmit P((struct recvbuf *, int, u_long)); +static void fast_xmit P((struct recvbuf *, int, keyid_t, int)); static void clock_update P((void)); int default_get_precision P((void)); -#ifdef MD5 -static void make_keylist P((struct peer *)); -#endif /* MD5 */ + /* * transmit - Transmit Procedure. See Section 3.4.2 of the @@ -91,116 +96,173 @@ transmit( u_char oreach; /* - * Determine reachability and diddle things if we - * haven't heard from the host for a while. If the peer - * is not configured and not likely to stay around, - * we exhaust it. + * The polling state machine. There are two kinds of + * machines, those that never expect a reply (broadcast + * and manycast server modes) and those that do (all + * other modes). The dance is intricate... */ + if (peer->cast_flags & (MDF_BCAST | MDF_MCAST)) { + + /* + * In broadcast mode the poll interval is fixed + * at minpoll and the ttl at ttlmax. + */ + hpoll = peer->minpoll; + peer->ttl = peer->ttlmax; +#ifdef AUTOKEY + } else if (peer->cast_flags & MDF_ACAST) { + + /* + * In manycast mode we start with the minpoll + * interval and ttl. However, the actual poll + * interval is eight times the nominal poll + * interval shown here. If fewer than three + * servers are found, the ttl is increased by + * one and we try again. If this continues to + * the max ttl, the poll interval is bumped by + * one and we try again. If at least three + * servers are found, the poll interval + * increases with the system poll interval to + * the max and we continue indefinately. + * However, about once per day when the + * agreement parameters are refreshed, the + * manycast clients are reset and we start from + * the beginning. This is to catch and clamp the + * ttl to the lowest practical value and avoid + * knocking on spurious doors. + */ + if (sys_survivors < NTP_MINCLOCK && peer->ttl < + peer->ttlmax) + peer->ttl++; + hpoll = sys_poll; +#endif /* AUTOKEY */ + } else { + + /* + * For associations expecting a reply, the + * watchdog counter is bumped by one if the peer + * has not been heard since the previous poll. + * If the counter reaches the max, the peer is + * demobilized if not configured and just + * cleared if it is, but in this case the poll + * interval is bumped by one. + */ + if (peer->unreach < NTP_UNREACH) { + peer->unreach++; + } else if (!(peer->flags & FLAG_CONFIG)) { + unpeer(peer); + clock_select(); + return; + + } else { + peer_clear(peer); + hpoll++; + } + } oreach = peer->reach; - if (oreach & 0x01) - peer->valid++; - if (oreach & 0x80) - peer->valid--; - if (!(peer->flags & FLAG_CONFIG) && peer->valid > - NTP_SHIFT / 2 && (peer->reach & 0x80) && - peer->status < CTL_PST_SEL_SYNCCAND) - peer->reach = 0; peer->reach <<= 1; if (peer->reach == 0) { /* - * If this is an uncofigured association and - * has become unreachable, demobilize it. + * If this association has become unreachable, + * clear it and raise a trap. */ if (oreach != 0) { report_event(EVNT_UNREACH, peer); peer->timereachable = current_time; - peer_clear(peer); if (!(peer->flags & FLAG_CONFIG)) { unpeer(peer); + clock_select(); return; + } else { + peer_clear(peer); + hpoll = peer->minpoll; } } - - /* - * We would like to respond quickly when the - * peer comes back to life. If the probes since - * becoming unreachable are less than - * NTP_UNREACH, clamp the poll interval to the - * minimum. In order to minimize the network - * traffic, the interval gradually ramps up the - * the maximum after that. - */ - peer->ppoll = peer->maxpoll; - if (peer->unreach < NTP_UNREACH) { - if (peer->hmode == MODE_CLIENT) - peer->unreach++; - hpoll = peer->minpoll; - } else { - hpoll++; - } - if (peer->flags & FLAG_BURST) - peer->burst = 2; - + if (peer->flags & FLAG_IBURST) + peer->burst = NTP_SHIFT; } else { /* - * Here the peer is reachable. If there is no - * system peer or if the stratum of the system - * peer is greater than this peer, clamp the - * poll interval to the minimum. If less than - * two samples are in the reachability register, - * reduce the interval; if more than six samples - * are in the register, increase the interval. + * Here the peer is reachable. If it has not + * been heard for three consecutive polls, stuff + * the clock filter. Next, determine the poll + * interval. If the peer is a synchronization + * candidate, use the system poll interval. If + * the peer is not sane, increase it by one. If + * the number of valid updates is not greater + * than half the register size, clamp it to the + * minimum. This is to quickly recover the time + * variables when a noisy peer shows life. */ - peer->unreach = 0; - if (sys_peer == 0) - hpoll = peer->minpoll; - else if (sys_peer->stratum > peer->stratum) - hpoll = peer->minpoll; - if ((peer->reach & 0x03) == 0) { + if (!(peer->reach & 0x07)) { clock_filter(peer, 0., 0., MAXDISPERSE); clock_select(); } - if (peer->valid <= 2) - hpoll--; - else if (peer->valid >= NTP_SHIFT - 2) + if ((peer->stratum > 1 && peer->refid == + peer->dstadr->sin.sin_addr.s_addr) || + peer->stratum >= STRATUM_UNSPEC) hpoll++; + else + hpoll = sys_poll; if (peer->flags & FLAG_BURST) peer->burst = NTP_SHIFT; } } else { peer->burst--; if (peer->burst == 0) { - if (peer->flags & FLAG_MCAST2) { - peer->flags &= ~FLAG_BURST; + + /* + * If a broadcast client at this point, the + * burst has concluded, so we switch to client + * mode and purge the keylist, since no further + * transmissions will be made. + */ + if (peer->cast_flags & MDF_BCLNT) { peer->hmode = MODE_BCLIENT; +#ifdef AUTOKEY + key_expire(peer); +#endif /* AUTOKEY */ } - clock_select(); poll_update(peer, hpoll); + clock_select(); + + /* + * If ntpdate mode and the clock has not been + * set and all peers have completed the burst, + * we declare a successful failure. + */ + if (mode_ntpdate) { + peer_ntpdate--; + if (peer_ntpdate > 0) + return; + NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) + msyslog(LOG_NOTICE, + "no reply; clock not set"); + printf( + "ntpd: no reply; clock not set\n"); + exit(0); + } return; + } } + peer->outdate = current_time; + poll_update(peer, hpoll); /* - * We need to be very careful about honking uncivilized time. If - * not operating in broadcast mode, honk in all except broadcast - * client mode. If operating in broadcast mode and synchronized - * to a real source, honk except when the peer is the local- - * clock driver and the prefer flag is not set. In other words, - * in broadcast mode we never honk unless known to be - * synchronized to real time. + * We need to be very careful about honking uncivilized time. + * Never transmit if in broadcast client mode or access denied. + * If in broadcast mode, transmit only if synchronized to a + * valid source. */ - if (peer->hmode != MODE_BROADCAST) { - if (peer->hmode != MODE_BCLIENT) - peer_xmit(peer); - } else if (sys_peer != 0 && sys_leap != LEAP_NOTINSYNC) { - if (!(sys_peer->refclktype == REFCLK_LOCALCLOCK && - !(sys_peer->flags & FLAG_PREFER))) - peer_xmit(peer); + if (peer->hmode == MODE_BCLIENT || peer->flash & TEST4) { + return; + } else if (peer->hmode == MODE_BROADCAST) { + if (sys_peer == NULL) + return; } - peer->outdate = current_time; - poll_update(peer, hpoll); + peer_xmit(peer); } /* @@ -216,482 +278,552 @@ receive( int hismode; int oflags; int restrict_mask; - int has_mac; /* has MAC field */ - int authlen; /* length of MAC field */ + int has_mac; /* length of MAC field */ + int authlen; /* offset of MAC field */ int is_authentic; /* cryptosum ok */ - int is_mystic; /* session key exists */ - int is_error; /* parse error */ -/* u_long pkeyid; */ - u_long skeyid, tkeyid; + keyid_t skeyid; /* cryptographic keys */ + struct sockaddr_in *dstadr_sin; /* active runway */ +#ifdef AUTOKEY + keyid_t pkeyid, tkeyid; /* cryptographic keys */ +#endif /* AUTOKEY */ struct peer *peer2; int retcode = AM_NOMATCH; /* - * Monitor the packet and get restrictions + * Monitor the packet and get restrictions. Note that the packet + * length for control and private mode packets must be checked + * by the service routines. Note that no statistics counters are + * recorded for restrict violations, since these counters are in + * the restriction routine. Note the careful distinctions here + * between a packet with a format error and a packet that is + * simply discarded without prejudice. Some restrictions have to + * be handled later in order to generate a kiss-of-death packet. */ ntp_monitor(rbufp); restrict_mask = restrictions(&rbufp->recv_srcadr); #ifdef DEBUG - if (debug > 1) - printf("receive: from %s restrict %02x\n", + if (debug > 2) + printf("receive: at %ld %s<-%s restrict %02x\n", + current_time, ntoa(&rbufp->dstadr->sin), ntoa(&rbufp->recv_srcadr), restrict_mask); #endif if (restrict_mask & RES_IGNORE) - return; - - /* - * Discard packets with invalid version number. - */ + return; /* no anything */ + if (!(SRCPORT(&rbufp->recv_srcadr) == NTP_PORT || + SRCPORT(&rbufp->recv_srcadr) >= IPPORT_RESERVED)) { + sys_badlength++; + return; /* invalid port */ + } pkt = &rbufp->recv_pkt; - if (PKT_VERSION(pkt->li_vn_mode) >= NTP_VERSION) - sys_newversionpkt++; - else if (PKT_VERSION(pkt->li_vn_mode) >= NTP_OLDVERSION) - sys_oldversionpkt++; - else { + if (PKT_VERSION(pkt->li_vn_mode) == NTP_VERSION) { + sys_newversionpkt++; /* new version */ + } else if (!(restrict_mask & RES_VERSION) && + PKT_VERSION(pkt->li_vn_mode) >= NTP_OLDVERSION) { + sys_oldversionpkt++; /* old version */ + } else { sys_unknownversion++; - return; + return; /* invalid version */ } - - /* - * Restrict control/private mode packets. Note that packet - * length has to be checked in the control/private mode protocol - * module. - */ if (PKT_MODE(pkt->li_vn_mode) == MODE_PRIVATE) { if (restrict_mask & RES_NOQUERY) - return; + return; /* no query private */ process_private(rbufp, ((restrict_mask & RES_NOMODIFY) == 0)); return; } if (PKT_MODE(pkt->li_vn_mode) == MODE_CONTROL) { if (restrict_mask & RES_NOQUERY) - return; + return; /* no query control */ process_control(rbufp, restrict_mask); return; } + if (rbufp->recv_length < LEN_PKT_NOMAC) { + sys_badlength++; + return; /* runt packet */ + } /* - * Restrict revenue packets. - */ - if (restrict_mask & RES_DONTSERVE) - return; - - /* - * See if we only accept limited number of clients from the net - * this guy is from. Note: the flag is determined dynamically - * within restrictions() + * Validate mode. Note that NTPv1 is no longer supported. */ - if (restrict_mask & RES_LIMITED) { - sys_limitrejected++; - return; - } + hismode = (int)PKT_MODE(pkt->li_vn_mode); + if (hismode == MODE_UNSPEC) { + sys_badlength++; + return; /* invalid mode */ + } /* - * If we are not a broadcast client, ignore broadcast packets. + * Discard broadcast packets received on the wildcard interface + * or if not enabled as broadcast client. */ - if ((PKT_MODE(pkt->li_vn_mode) == MODE_BROADCAST && - !sys_bclient)) + if (PKT_MODE(pkt->li_vn_mode) == MODE_BROADCAST && + (rbufp->dstadr == any_interface || !sys_bclient)) return; /* - * This is really awful ugly. We figure out whether an extension - * field is present and then measure the MAC size. If the number - * of words following the packet header is less than or equal to - * 5, no extension field is present and these words constitute - * the MAC. If the number of words is greater than 5, an - * extension field is present and the first word contains the - * length of the extension field and the MAC follows that. + * Parse the extension field if present. We figure out whether + * an extension field is present by measuring the MAC size. If + * the number of words following the packet header is 0 or 1, no + * MAC is present and the packet is not authenticated. If 1, the + * packet is a reply to a previous request that failed to + * authenticate. If 3, the packet is authenticated with DES; if + * 5, the packet is authenticated with MD5. If greater than 5, + * an extension field is present. If 2 or 4, the packet is a + * runt and goes poof! with a brilliant flash. */ - has_mac = 0; -/* pkeyid = 0; */ - skeyid = tkeyid = 0; + skeyid = 0; +#ifdef AUTOKEY + pkeyid = tkeyid = 0; +#endif /* AUTOKEY */ authlen = LEN_PKT_NOMAC; - has_mac = rbufp->recv_length - authlen; - if (has_mac <= 5 * sizeof(u_int32)) { - skeyid = (u_long)ntohl(pkt->keyid1) & 0xffffffff; - } else { - authlen += (u_long)ntohl(pkt->keyid1) & 0xffffffff; - has_mac = rbufp->recv_length - authlen; - if (authlen <= 0) { + while ((has_mac = rbufp->recv_length - authlen) > 0) { + int temp; + + if (has_mac % 4 != 0 || has_mac < 0) { sys_badlength++; return; } + if (has_mac == 1 * 4 || has_mac == 3 * 4 || has_mac == + MAX_MAC_LEN) { + skeyid = ntohl(((u_int32 *)pkt)[authlen / 4]); + break; - /* - * Note that keyid3 is actually the key ident of the - * MAC itself. - */ -/* pkeyid = (u_long)ntohl(pkt->keyid2) & 0xffffffff; */ - skeyid = tkeyid = (u_long)ntohl(pkt->keyid3) & - 0xffffffff; - } - - /* - * Figure out his mode and validate it. - */ - hismode = (int)PKT_MODE(pkt->li_vn_mode); - if (PKT_VERSION(pkt->li_vn_mode) == NTP_OLDVERSION && hismode == - 0) { - /* - * Easy. If it is from the NTP port it is - * a sym act, else client. - */ - if (SRCPORT(&rbufp->recv_srcadr) == NTP_PORT) - hismode = MODE_ACTIVE; - else - hismode = MODE_CLIENT; - } else { - if (hismode != MODE_ACTIVE && hismode != MODE_PASSIVE && - hismode != MODE_SERVER && hismode != MODE_CLIENT && - hismode != MODE_BROADCAST) + } else if (has_mac > MAX_MAC_LEN) { + temp = ntohl(((u_int32 *)pkt)[authlen / 4]) & + 0xffff; + if (temp < 4 || temp % 4 != 0) { + sys_badlength++; + return; + } + authlen += temp; + } else { + sys_badlength++; return; + } } /* - * If he included a mac field, decrypt it to see if it is - * authentic. + * We have tossed out as many buggy packets as possible early in + * the game to reduce the exposure to a clogging attack. Now we + * have to burn some cycles to find the association and + * authenticate the packet if required. Note that we burn only + * MD5 or DES cycles, again to reduce exposure. There may be no + * matching association and that's okay. + * + * More on the autokey mambo. Normally the local interface is + * found when the association was mobilized with respect to a + * designated remote address. We assume packets arriving from + * the remote address arrive via this interface and the local + * address used to construct the autokey is the unicast address + * of the interface. However, if the sender is a broadcaster, + * the interface broadcast address is used instead. + * Notwithstanding this technobabble, if the sender is a + * multicaster, the broadcast address is null, so we use the + * unicast address anyway. Don't ask. */ - is_authentic = is_mystic = 0; + peer = findpeer(&rbufp->recv_srcadr, rbufp->dstadr, rbufp->fd, + hismode, &retcode); + is_authentic = 0; + dstadr_sin = &rbufp->dstadr->sin; if (has_mac == 0) { #ifdef DEBUG if (debug) - printf("receive: at %ld from %s mode %d\n", - current_time, ntoa(&rbufp->recv_srcadr), - hismode); + printf("receive: at %ld %s<-%s mode %d code %d\n", + current_time, ntoa(&rbufp->dstadr->sin), + ntoa(&rbufp->recv_srcadr), hismode, retcode); #endif } else { - is_mystic = authistrusted(skeyid); -#ifdef MD5 - if (skeyid > NTP_MAXKEY && !is_mystic) { - +#ifdef AUTOKEY + /* + * For autokey modes, generate the session key + * and install in the key cache. Use the socket + * broadcast or unicast address as appropriate. + */ + if (skeyid > NTP_MAXKEY) { + /* - * For multicast mode, generate the session key - * and install in the key cache. For client - * mode, generate the session key for the - * unicast address. For server mode, the session - * key should already be in the key cache, since - * it was generated when the last request was - * sent. + * More on the autokey dance (AKD). A cookie is + * constructed from public and private values. + * For broadcast packets, the cookie is public + * (zero). For packets that match no + * association, the cookie is hashed from the + * addresses and private value. For server + * packets, the cookie was previously obtained + * from the server. For symmetric modes, the + * cookie was previously constructed using an + * agreement protocol; however, should PKI be + * unavailable, we construct a fake agreement as + * the EXOR of the peer and host cookies. + * + * hismode ephemeral persistent + * ======================================= + * active 0 cookie# + * passive 0% cookie# + * client sys cookie 0% + * server 0% sys cookie + * broadcast 0 0 + * + * # if unsync, 0 + * % can't happen */ if (hismode == MODE_BROADCAST) { + + /* + * For broadcaster, use the interface + * broadcast address when available; + * otherwise, use the unicast address + * found when the association was + * mobilized. + */ + pkeyid = 0; + if (rbufp->dstadr->bcast.sin_addr.s_addr + != 0) + dstadr_sin = + &rbufp->dstadr->bcast; + } else if (peer == NULL) { + pkeyid = session_key( + &rbufp->recv_srcadr, dstadr_sin, 0, + sys_private, 0); + } else { + pkeyid = peer->pcookie.key; + } + + /* + * The session key includes both the public + * values and cookie. In case of an extension + * field, the cookie used for authentication + * purposes is zero. Note the hash is saved for + * use later in the autokey mambo. + */ + if (authlen > LEN_PKT_NOMAC && pkeyid != 0) { + session_key(&rbufp->recv_srcadr, + dstadr_sin, skeyid, 0, 2); tkeyid = session_key( - ntohl((&rbufp->recv_srcadr)->sin_addr.s_addr), - ntohl(rbufp->dstadr->bcast.sin_addr.s_addr), - skeyid, (u_long)(4 * (1 << pkt->ppoll))); - } else if (hismode != MODE_SERVER) { + &rbufp->recv_srcadr, dstadr_sin, + skeyid, pkeyid, 0); + } else { tkeyid = session_key( - ntohl((&rbufp->recv_srcadr)->sin_addr.s_addr), - ntohl(rbufp->dstadr->sin.sin_addr.s_addr), - skeyid, (u_long)(4 * (1 << pkt->ppoll))); + &rbufp->recv_srcadr, dstadr_sin, + skeyid, pkeyid, 2); } } -#endif /* MD5 */ +#endif /* AUTOKEY */ /* * Compute the cryptosum. Note a clogging attack may - * succceed in bloating the key cache. + * succeed in bloating the key cache. If an autokey, + * purge it immediately, since we won't be needing it + * again. */ if (authdecrypt(skeyid, (u_int32 *)pkt, authlen, has_mac)) is_authentic = 1; else sys_badauth++; +#ifdef AUTOKEY + if (skeyid > NTP_MAXKEY) + authtrust(skeyid, 0); +#endif /* AUTOKEY */ #ifdef DEBUG if (debug) printf( - "receive: at %ld %s mode %d keyid %08lx mac %d auth %d\n", - current_time, ntoa(&rbufp->recv_srcadr), - hismode, skeyid, has_mac, is_authentic); + "receive: at %ld %s<-%s mode %d code %d keyid %08x len %d mac %d auth %d\n", + current_time, ntoa(dstadr_sin), + ntoa(&rbufp->recv_srcadr), hismode, retcode, + skeyid, authlen, has_mac, + is_authentic); #endif } /* - * Find the peer. This will return a null if this guy isn't in - * the database. + * The association matching rules are implemented by a set of + * routines and a table in ntp_peer.c. A packet matching an + * association is processed by that association. If not and + * certain conditions prevail, then an ephemeral association is + * mobilized: a broadcast packet mobilizes a broadcast client + * aassociation; a server packet mobilizes a client association; + * a symmetric active packet mobilizes a symmetric passive + * association. And, the adventure continues... */ - peer = findpeer(&rbufp->recv_srcadr, rbufp->dstadr, rbufp->fd, - hismode, &retcode); - /* - * The new association matching rules are driven by a table - * specified in ntp.h. We have replaced the *default* behaviour - * of replying to bogus packets in server mode in this version. - * A packet must now match an association in order to be - * processed. In the event that no association exists, then an - * association is mobilized if need be. Two different - * associations can be mobilized a) passive associations b) - * client associations due to broadcasts or manycasts. - */ - is_error = 0; switch (retcode) { case AM_FXMIT: /* - * If the client is configured purely as a broadcast - * client and not as an manycast server, it has no - * business being a server. Simply go home. Otherwise, - * send a MODE_SERVER response and go home. Note that we - * don't do a authentication check here, since we can't - * set the system clock; but, we do set the key ID to - * zero to tell the caller about this. + * This is a client mode packet not matching a known + * association. If from a manycast client we run a few + * sanity checks before deciding to send a unicast + * server response. Otherwise, it must be a client + * request, so send a server response and go home. */ - if (!sys_bclient || sys_manycastserver) { - if (is_authentic) - fast_xmit(rbufp, MODE_SERVER, skeyid); - else - fast_xmit(rbufp, MODE_SERVER, 0); + if (sys_manycastserver && (rbufp->dstadr->flags & + INT_MULTICAST)) { + + /* + * We are picky about responding to a + * manycaster. There is no reason to respond to + * a request if our time is worse than the + * manycaster. We certainly don't reply if not + * synchronized to proventic time. + */ + if (sys_peer == NULL) + return; + + /* + * We don't reply if the our stratum is greater + * than the manycaster. + */ + if (PKT_TO_STRATUM(pkt->stratum) < sys_stratum) + return; } /* - * We can't get here if an association is mobilized, so - * just toss the key, if appropriate. + * Note that we don't require an authentication check + * here, since we can't set the system clock; but, we do + * set the key ID to zero to tell the caller about this. */ - if (!is_mystic && skeyid > NTP_MAXKEY) - authtrust(skeyid, 0); - return; + if (is_authentic) + fast_xmit(rbufp, MODE_SERVER, skeyid, + restrict_mask); + else + fast_xmit(rbufp, MODE_SERVER, 0, restrict_mask); + return; case AM_MANYCAST: /* - * This could be in response to a multicast packet sent - * by the "manycast" mode association. Find peer based - * on the originate timestamp in the packet. Note that - * we don't mobilize a new association, unless the - * packet is properly authenticated. The response must - * be properly authenticated and it's darn funny of the - * manycaster isn't around now. + * This is a server mode packet returned in response to + * a client mode packet sent to a multicast group + * address. The originate timestamp is a good nonce to + * reliably associate the reply with what was sent. If + * there is no match, that's curious and could be an + * intruder attempting to clog, so we just ignore it. + * + * First, make sure the packet is authentic. If so and + * the manycast association is found, we mobilize a + * client mode association, copy pertinent variables + * from the manycast to the client mode association and + * wind up the spring. + * + * There is an implosion hazard at the manycast client, + * since the manycast servers send the server packet + * immediately. */ - if ((sys_authenticate && !is_authentic)) { - is_error = 1; - break; - } - peer2 = (struct peer *)findmanycastpeer(&pkt->org); - if (peer2 == 0) { - is_error = 1; - break; - } + if ((restrict_mask & (RES_DONTSERVE | RES_LIMITED | + RES_NOPEER)) || (sys_authenticate && + !is_authentic)) + return; + + peer2 = findmanycastpeer(rbufp); + if (peer2 == 0) + return; - /* - * Create a new association and copy the peer variables - * to it. If something goes wrong, carefully pry the new - * association away and return its marbles to the candy - * store. - */ peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr, MODE_CLIENT, PKT_VERSION(pkt->li_vn_mode), - NTP_MINDPOLL, NTP_MAXDPOLL, 0, skeyid); - if (peer == 0) { - is_error = 1; - break; - } - peer_config_manycast(peer2, peer); - break; - - case AM_ERR: - - /* - * Something bad happened. Dirty floor will be mopped by - * the code at the end of this adventure. - */ - is_error = 1; + sys_minpoll, NTP_MAXDPOLL, FLAG_IBURST | + (peer2->flags & (FLAG_AUTHENABLE | FLAG_SKEY)), + MDF_UCAST, 0, skeyid); + if (peer == NULL) + return; break; case AM_NEWPASS: /* - * Okay, we're going to keep him around. Allocate him - * some memory. But, don't do that unless the packet is - * properly authenticated. + * This is the first packet received from a symmetric + * active peer. First, make sure the packet is + * authentic. If so, mobilize a symmetric passive + * association. */ - if ((sys_authenticate && !is_authentic)) { - is_error = 1; - break; + if ((restrict_mask & (RES_DONTSERVE | RES_LIMITED | + RES_NOPEER)) || (sys_authenticate && + !is_authentic)) { + fast_xmit(rbufp, MODE_PASSIVE, 0, + restrict_mask); + return; } peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr, MODE_PASSIVE, PKT_VERSION(pkt->li_vn_mode), - NTP_MINDPOLL, NTP_MAXDPOLL, 0, skeyid); + sys_minpoll, NTP_MAXDPOLL, sys_authenticate ? + FLAG_AUTHENABLE : 0, MDF_UCAST, 0, skeyid); + if (peer == NULL) + return; break; case AM_NEWBCL: /* - * Broadcast client being set up now. Do this only if - * the packet is properly authenticated. + * This is the first packet received from a broadcast + * server. First, make sure the packet is authentic, not + * restricted and that we are a broadcast or multicast + * client. If so, mobilize a broadcast client + * association. */ - if ((restrict_mask & RES_NOPEER) || !sys_bclient || - (sys_authenticate && !is_authentic)) { - is_error = 1; - break; - } + if ((restrict_mask & (RES_DONTSERVE | RES_LIMITED | + RES_NOPEER)) || (sys_authenticate && + !is_authentic) || !sys_bclient) + return; + peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr, - MODE_MCLIENT, PKT_VERSION(pkt->li_vn_mode), - NTP_MINDPOLL, NTP_MAXDPOLL, 0, skeyid); - if (peer == 0) - break; - peer->flags |= FLAG_MCAST1 | FLAG_MCAST2 | FLAG_BURST; - peer->hmode = MODE_CLIENT; - break; + MODE_CLIENT, PKT_VERSION(pkt->li_vn_mode), + sys_minpoll, NTP_MAXDPOLL, FLAG_MCAST | + FLAG_IBURST | (sys_authenticate ? + FLAG_AUTHENABLE : 0), MDF_BCLNT, 0, skeyid); +#ifdef AUTOKEY +#ifdef PUBKEY + if (peer == NULL) + return; + if (peer->flags & FLAG_SKEY) + crypto_recv(peer, rbufp); +#endif /* PUBKEY */ +#endif /* AUTOKEY */ + return; case AM_POSSBCL: case AM_PROCPKT: /* - * It seems like it is okay to process the packet now + * Happiness and nothing broke. Earn some revenue. */ break; default: /* - * shouldn't be getting here, but simply return anyway! + * Invalid mode combination. Leave the island + * immediately. */ - is_error = 1; - } - if (is_error) { - - /* - * Error stub. If we get here, something broke. We - * scuttle the autokey if necessary and sink the ship. - * This can occur only upon mobilization, so we can - * throw the structure away without fear of breaking - * anything. - */ - if (!is_mystic && skeyid > NTP_MAXKEY) - authtrust(skeyid, 0); - if (peer != 0) - if (!(peer->flags & FLAG_CONFIG)) - unpeer(peer); #ifdef DEBUG if (debug) - printf("match error code %d assoc %d\n", - retcode, peer_associations); + printf("receive: bad protocol %d\n", retcode); #endif return; } /* - * If the peer isn't configured, set his keyid and authenable - * status based on the packet. + * If the peer isn't configured, set his authenable and autokey + * status based on the packet. Once the status is set, it can't + * be unset. It seems like a silly idea to do this here, rather + * in the configuration routine, but in some goofy cases the + * first packet sent cannot be authenticated and we need a way + * for the dude to change his mind. */ oflags = peer->flags; peer->timereceived = current_time; + peer->received++; if (!(peer->flags & FLAG_CONFIG) && has_mac) { peer->flags |= FLAG_AUTHENABLE; - if (skeyid > NTP_MAXKEY) { - if (peer->flags & FLAG_MCAST2) - peer->keyid = skeyid; - else - peer->flags |= FLAG_SKEY; - } +#ifdef AUTOKEY + if (skeyid > NTP_MAXKEY) + peer->flags |= FLAG_SKEY; +#endif /* AUTOKEY */ } /* - * Determine if this guy is basically trustable. If not, flush - * the bugger. If this is the first packet that is - * authenticated, flush the clock filter. This is to foil - * clogging attacks that might starve the poor dear. + * A valid packet must be from an authentic and allowed source. + * All packets must pass the authentication allowed tests. + * Autokey authenticated packets must pass additional tests and + * public-key authenticated packets must have the credentials + * verified. If all tests are passed, the packet is forwarded + * for processing. If not, the packet is discarded and the + * association demobilized if appropriate. */ peer->flash = 0; - if (is_authentic) + if (is_authentic) { peer->flags |= FLAG_AUTHENTIC; - else + } else { peer->flags &= ~FLAG_AUTHENTIC; - if (peer->hmode == MODE_BROADCAST && (restrict_mask & - RES_DONTTRUST)) - peer->flash |= TEST10; /* access denied */ + } + if (peer->hmode == MODE_BROADCAST && + (restrict_mask & RES_DONTTRUST)) /* test 4 */ + peer->flash |= TEST4; /* access denied */ if (peer->flags & FLAG_AUTHENABLE) { - if (!(peer->flags & FLAG_AUTHENTIC)) + if (!(peer->flags & FLAG_AUTHENTIC)) /* test 5 */ peer->flash |= TEST5; /* auth failed */ - else if (skeyid == 0) - peer->flash |= TEST9; /* peer not auth */ - else if (!(oflags & FLAG_AUTHENABLE)) { - peer_clear(peer); + else if (!(oflags & FLAG_AUTHENABLE)) report_event(EVNT_PEERAUTH, peer); - } } - if ((peer->flash & ~(u_int)TEST9) != 0) { - - /* - * The packet is bogus, so we throw it away before - * becoming a denial-of-service hazard. We don't throw - * the current association away if it is configured or - * if it has prior reachable friends. - */ - if (!is_mystic && skeyid > NTP_MAXKEY) - authtrust(skeyid, 0); - if (!(peer->flags & FLAG_CONFIG) && peer->reach == 0) - unpeer(peer); + if (peer->flash) { #ifdef DEBUG if (debug) - printf( - "invalid packet 0x%02x code %d assoc %d\n", - peer->flash, retcode, peer_associations); + printf("receive: bad auth %03x\n", peer->flash); #endif return; } -#ifdef MD5 +#ifdef AUTOKEY /* - * The autokey dance. The cha-cha requires that the hash of the - * current session key matches the previous key identifier. - * Heaps of trouble if the steps falter. + * More autokey dance. The rules of the cha-cha are as follows: + * + * 1. If there is no key or the key is not auto, do nothing. + * + * 2. If an extension field contains a verified signature, it is + * self-authenticated and we sit the dance. + * + * 3. If this is a server reply, check only to see that the + * transmitted key ID matches the received key ID. + * + * 4. Check to see that one or more hashes of the current key ID + * matches the previous key ID or ultimate original key ID + * obtained from the broadcaster or symmetric peer. If no + * match, sit the dance and wait for timeout. */ - if (skeyid > NTP_MAXKEY) { - int i; - - /* - * In the case of a new autokey, verify the hash matches - * one of the previous four hashes. If not, raise the - * authentication flasher and hope the next one works. - */ + if (peer->flags & FLAG_SKEY) { + peer->flash |= TEST10; + crypto_recv(peer, rbufp); + poll_update(peer, peer->hpoll); if (hismode == MODE_SERVER) { - peer->pkeyid = peer->keyid; - } else if (peer->flags & FLAG_MCAST2) { - if (peer->pkeyid > NTP_MAXKEY) - authtrust(peer->pkeyid, 0); - for (i = 0; i < 4 && tkeyid != peer->pkeyid; - i++) { - tkeyid = session_key( - ntohl((&rbufp->recv_srcadr)->sin_addr.s_addr), - ntohl(rbufp->dstadr->bcast.sin_addr.s_addr), - tkeyid, 0); - } + if (skeyid == peer->keyid) + peer->flash &= ~TEST10; + } else if (!peer->flash & TEST10) { + peer->pkeyid = skeyid; } else { - if (peer->pkeyid > NTP_MAXKEY) - authtrust(peer->pkeyid, 0); - for (i = 0; i < 4 && tkeyid != peer->pkeyid; - i++) { + int i; + + for (i = 0; ; i++) { + if (tkeyid == peer->pkeyid || + tkeyid == peer->recauto.key) { + peer->flash &= ~TEST10; + peer->pkeyid = skeyid; + break; + } + if (i > peer->recauto.seq) + break; tkeyid = session_key( - ntohl((&rbufp->recv_srcadr)->sin_addr.s_addr), - ntohl(rbufp->dstadr->sin.sin_addr.s_addr), - tkeyid, 0); + &rbufp->recv_srcadr, dstadr_sin, + tkeyid, pkeyid, 0); } } -#ifdef XXX /* temp until certificate code is mplemented */ - if (tkeyid != peer->pkeyid) - peer->flash |= TEST9; /* peer not authentic */ +#ifdef PUBKEY + + /* + * This is delicious. Ordinarily, we kick out all errors + * at this point; however, in symmetric mode and just + * warming up, an unsynchronized peer must inject the + * timestamps, even if it fails further up the road. So, + * let the dude by here, but only if the jerk is not yet + * reachable. After that, he's on his own. + */ + if (!(peer->flags & FLAG_PROVEN)) + peer->flash |= TEST11; + if (peer->flash && peer->reach) { +#ifdef DEBUG + if (debug) + printf("packet: bad autokey %03x\n", + peer->flash); #endif - peer->pkeyid = skeyid; + return; + } +#endif /* PUBKEY */ } -#endif /* MD5 */ +#endif /* AUTOKEY */ /* - * Gawdz, it's come to this. Process the dang packet. If - * something breaks and the association doesn't deserve to live, - * toss it. Be careful in active mode and return a packet - * anyway. + * We have survived the gaunt. Forward to the packet routine. If + * a symmetric passive association has been mobilized and the + * association doesn't deserve to live, it will die in the + * transmit routine if not reachable after timeout. */ - process_packet(peer, pkt, &(rbufp->recv_time)); - if (!(peer->flags & FLAG_CONFIG) && peer->reach == 0) { - if (peer->hmode == MODE_PASSIVE) { - if (is_authentic) - fast_xmit(rbufp, MODE_PASSIVE, skeyid); - else - fast_xmit(rbufp, MODE_PASSIVE, 0); - } - unpeer(peer); - } + process_packet(peer, pkt, &rbufp->recv_time); } @@ -701,7 +833,7 @@ receive( * reasonable expectation that we will be having a long term * relationship with this host. */ -int +void process_packet( register struct peer *peer, register struct pkt *pkt, @@ -713,10 +845,13 @@ process_packet( double dtemp; l_fp p_rec, p_xmt, p_org, p_reftime; l_fp ci; - int pmode; + int pmode, pleap, pstratum; /* - * Swap header fields and keep the books. + * Swap header fields and keep the books. The books amount to + * the receive timestamp and poll interval in the header. We + * need these even if there are other problems in order to crank + * up the state machine. */ sys_processed++; peer->processed++; @@ -729,84 +864,115 @@ process_packet( NTOHL_FP(&pkt->org, &p_org); else p_org = peer->rec; - peer->rec = *recv_ts; - peer->ppoll = pkt->ppoll; - pmode = PKT_MODE(pkt->li_vn_mode); /* - * Test for old or duplicate packets (tests 1 through 3). + * Test for old, duplicate or unsynch packets (tests 1-3). */ + peer->rec = *recv_ts; + pmode = PKT_MODE(pkt->li_vn_mode); + pleap = PKT_LEAP(pkt->li_vn_mode); + pstratum = PKT_TO_STRATUM(pkt->stratum); if (L_ISHIS(&peer->org, &p_xmt)) /* count old packets */ peer->oldpkt++; - if (L_ISEQU(&peer->org, &p_xmt)) /* test 1 */ - peer->flash |= TEST1; /* duplicate packet */ - if (PKT_MODE(pkt->li_vn_mode) != MODE_BROADCAST) { - if (!L_ISEQU(&peer->xmt, &p_org)) { /* test 2 */ - peer->bogusorg++; - peer->flash |= TEST2; /* bogus packet */ - } - if (L_ISZERO(&p_rec) || L_ISZERO(&p_org)) - peer->flash |= TEST3; /* unsynchronized */ - } else { - if (L_ISZERO(&p_org)) - peer->flash |= TEST3; /* unsynchronized */ + if (L_ISEQU(&peer->org, &p_xmt)) /* 1 */ + peer->flash |= TEST1; /* dupe */ + if (pmode != MODE_BROADCAST) { + if (!L_ISEQU(&peer->xmt, &p_org)) /* 2 */ + peer->flash |= TEST2; /* bogus */ + if (L_ISZERO(&p_rec) || L_ISZERO(&p_org)) /* test 3 */ + peer->flash |= TEST3; /* unsynch */ } + if (L_ISZERO(&p_xmt)) /* 3 */ + peer->flash |= TEST3; /* unsynch */ peer->org = p_xmt; /* - * Test for valid header (tests 5 through 10) + * If tests 1-3 fail, the packet is discarded leaving only the + * receive and origin timestamps and poll interval, which is + * enough to get the protocol started. + */ + if (peer->flash) { +#ifdef DEBUG + if (debug) + printf("packet: bad data %03x\n", + peer->flash); +#endif + return; + } + + /* + * A kiss-of-death (kod) packet is returned by a server in case + * the client is denied access. It consists of the client + * request packet with the leap bits indicating never + * synchronized, stratum zero and reference ID field the ASCII + * string "DENY". If the packet originate timestamp matches the + * association transmit timestamp the kod is legitimate. If the + * peer leap bits indicate never synchronized, this must be + * access deny and the association is disabled; otherwise this + * must be a limit reject. In either case a naughty message is + * forced to the system log. + */ + if (pleap == LEAP_NOTINSYNC && pstratum >= STRATUM_UNSPEC && + memcmp(&pkt->refid, "DENY", 4) == 0) { + if (peer->leap == LEAP_NOTINSYNC) { + peer->stratum = STRATUM_UNSPEC; + peer->flash |= TEST4; + memcpy(&peer->refid, &pkt->refid, 4); + msyslog(LOG_INFO, "access denied"); + } else { + msyslog(LOG_INFO, "limit reject"); + } + return; + } + + /* + * Test for valid peer data (tests 6-8) */ ci = p_xmt; L_SUB(&ci, &p_reftime); LFPTOD(&ci, dtemp); - if (PKT_LEAP(pkt->li_vn_mode) == LEAP_NOTINSYNC || /* test 6 */ - PKT_TO_STRATUM(pkt->stratum) >= NTP_MAXSTRATUM || - dtemp < 0) - peer->flash |= TEST6; /* peer clock unsynchronized */ - if (!(peer->flags & FLAG_CONFIG) && sys_peer != 0) { /* test 7 */ - if (PKT_TO_STRATUM(pkt->stratum) > sys_stratum) { - peer->flash |= TEST7; /* peer stratum too high */ + if (pleap == LEAP_NOTINSYNC || /* 6 */ + pstratum >= STRATUM_UNSPEC || dtemp < 0) + peer->flash |= TEST6; /* bad synch */ + if (!(peer->flags & FLAG_CONFIG) && sys_peer != NULL) { /* 7 */ + if (pstratum > sys_stratum && pmode != MODE_ACTIVE) { + peer->flash |= TEST7; /* bad stratum */ sys_badstratum++; } } - if (fabs(p_del) >= MAXDISPERSE /* test 8 */ - || p_disp >= MAXDISPERSE) - peer->flash |= TEST8; /* delay/dispersion too high */ - - /* - * If the packet header is invalid (tests 5 through 10), exit. - * XXX we let TEST9 sneak by until the certificate code is - * implemented, but only to mobilize the association. - */ - if (peer->flash & (TEST5 | TEST6 | TEST7 | TEST8 | TEST10)) { + if (p_del < 0 || p_disp < 0 || p_del / /* 8 */ + 2 + p_disp >= MAXDISPERSE) + peer->flash |= TEST8; /* bad peer distance */ + if (peer->flash) { #ifdef DEBUG if (debug) - printf( - "invalid packet header 0x%02x mode %d\n", - peer->flash, pmode); + printf("packet: bad header %03x\n", + peer->flash); #endif - return (0); + return; } /* - * Valid header; update our state. + * The header is valid. Capture the remaining header values and + * mark as reachable. */ - record_raw_stats(&peer->srcadr, &peer->dstadr->sin, - &p_org, &p_rec, &p_xmt, &peer->rec); - - peer->leap = PKT_LEAP(pkt->li_vn_mode); - peer->pmode = pmode; /* unspec */ - peer->stratum = PKT_TO_STRATUM(pkt->stratum); + record_raw_stats(&peer->srcadr, &peer->dstadr->sin, &p_org, + &p_rec, &p_xmt, &peer->rec); + peer->leap = pleap; + peer->pmode = pmode; + peer->stratum = pstratum; + peer->ppoll = pkt->ppoll; peer->precision = pkt->precision; peer->rootdelay = p_del; peer->rootdispersion = p_disp; peer->refid = pkt->refid; peer->reftime = p_reftime; - if (peer->reach == 0) { + if (!(peer->reach)) { report_event(EVNT_REACH, peer); peer->timereachable = current_time; } peer->reach |= 1; + peer->unreach = 0; poll_update(peer, peer->hpoll); /* @@ -827,34 +993,25 @@ process_packet( t23 = p_rec; /* compute t2 - t3 */ L_SUB(&t23, &p_org); ci = t10; - p_disp = CLOCK_PHI * (peer->rec.l_ui - p_org.l_ui); + p_disp = clock_phi * (peer->rec.l_ui - p_org.l_ui); /* * If running in a broadcast association, the clock offset is * (t1 - t0) corrected by the one-way delay, but we can't - * measure that directly; therefore, we start up in - * client/server mode, calculate the clock offset, using the - * engineered refinement algorithms, while also receiving - * broadcasts. When a broadcast is received in client/server - * mode, we calculate a correction factor to use after switching - * back to broadcast mode. We know NTP_SKEWFACTOR == 16, which - * accounts for the simplified ei calculation. - * - * If FLAG_MCAST2 is set, we are a broadcast/multicast client. - * If FLAG_MCAST1 is set, we haven't calculated the propagation - * delay. If hmode is MODE_CLIENT, we haven't set the local - * clock in client/server mode. Initially, we come up - * MODE_CLIENT. When the clock is first updated and FLAG_MCAST2 - * is set, we switch from MODE_CLIENT to MODE_BCLIENT. + * measure that directly. Therefore, we start up in MODE_CLIENT + * mode, set FLAG_MCAST and exchange eight messages to determine + * the clock offset. When the last message is sent, we switch to + * MODE_BCLIENT mode. The next broadcast message after that + * computes the broadcast offset and clears FLAG_MCAST. */ if (pmode == MODE_BROADCAST) { - if (peer->flags & FLAG_MCAST1) { - if (peer->hmode == MODE_BCLIENT) - peer->flags &= ~FLAG_MCAST1; + if (peer->flags & FLAG_MCAST) { LFPTOD(&ci, p_offset); peer->estbdelay = peer->offset - p_offset; - return (1); + if (peer->hmode == MODE_CLIENT) + return; + peer->flags &= ~FLAG_MCAST; } DTOLFP(peer->estbdelay, &t10); L_ADD(&ci, &t10); @@ -865,32 +1022,29 @@ process_packet( L_SUB(&t23, &t10); LFPTOD(&t23, p_del); } + p_del = max(p_del, LOGTOD(sys_precision)); LFPTOD(&ci, p_offset); - if (fabs(p_del) >= MAXDISPERSE || p_disp >= MAXDISPERSE) /* test 4 */ - peer->flash |= TEST4; /* delay/dispersion too big */ + if ((peer->rootdelay + p_del) / 2. + peer->rootdispersion + + p_disp >= MAXDISPERSE) /* 9 */ + peer->flash |= TEST9; /* bad peer distance */ /* - * If the packet data are invalid (tests 1 through 4), exit. + * If any flasher bits remain set at this point, abandon ship. + * Otherwise, forward to the clock filter. */ if (peer->flash) { #ifdef DEBUG if (debug) - printf("invalid packet data 0x%02x mode %d\n", - peer->flash, pmode); + printf("packet: bad packet data %03x\n", + peer->flash); #endif - return(1); + return; } - - - /* - * This one is valid. Mark it so, give it to clock_filter(). - */ - clock_filter(peer, p_offset, p_del, fabs(p_disp)); + clock_filter(peer, p_offset, p_del, p_disp); clock_select(); record_peer_stats(&peer->srcadr, ctlpeerstatus(peer), peer->offset, peer->delay, peer->disp, - SQRT(peer->variance)); - return(1); + SQRT(peer->jitter)); } @@ -902,15 +1056,13 @@ clock_update(void) { u_char oleap; u_char ostratum; - int i; - struct peer *peer; /* * Reset/adjust the system clock. Do this only if there is a * system peer and we haven't seen that peer lately. Watch for * timewarps here. */ - if (sys_peer == 0) + if (sys_peer == NULL) return; if (sys_peer->pollsw == FALSE || sys_peer->burst > 0) return; @@ -922,60 +1074,58 @@ clock_update(void) #endif oleap = sys_leap; ostratum = sys_stratum; - switch (local_clock(sys_peer, sys_offset, sys_epsil)) { + switch (local_clock(sys_peer, sys_offset, sys_syserr)) { - case -1: - /* - * Clock is too screwed up. Just exit for now. - */ + /* + * Clock is too screwed up. Just exit for now. + */ + case -1: report_event(EVNT_SYSFAULT, (struct peer *)0); exit(1); /*NOTREACHED*/ - case 1: - /* - * Clock was stepped. Clear filter registers - * of all peers. - */ - for (i = 0; i < HASH_SIZE; i++) { - for (peer = peer_hash[i]; peer != 0; - peer =peer->next) - peer_clear(peer); - } - NLOG(NLOG_SYNCSTATUS) - msyslog(LOG_INFO, "synchronisation lost"); - sys_peer = 0; + /* + * Clock was stepped. Flush all time values of all peers. + */ + case 1: + clear_all(); + sys_peer = NULL; sys_stratum = STRATUM_UNSPEC; + sys_poll = NTP_MINPOLL; + NLOG(NLOG_SYNCSTATUS) + msyslog(LOG_INFO, "synchronisation lost"); report_event(EVNT_CLOCKRESET, (struct peer *)0); break; - default: - /* - * Update the system stratum, leap bits, root delay, - * root dispersion, reference ID and reference time. We - * also update select dispersion and max frequency - * error. - */ + /* + * Update the system stratum, leap bits, root delay, root + * dispersion, reference ID and reference time. We also update + * select dispersion and max frequency error. If the leap + * changes, we gotta reroll the keys. + */ + default: sys_stratum = sys_peer->stratum + 1; if (sys_stratum == 1) sys_refid = sys_peer->refid; else sys_refid = sys_peer->srcadr.sin_addr.s_addr; sys_reftime = sys_peer->rec; - sys_rootdelay = sys_peer->rootdelay + - fabs(sys_peer->delay); + sys_rootdelay = sys_peer->rootdelay + sys_peer->delay; sys_leap = leap_consensus; } - if (oleap != sys_leap) + if (oleap == LEAP_NOTINSYNC) { report_event(EVNT_SYNCCHG, (struct peer *)0); +#ifdef AUTOKEY + expire_all(); +#endif /* AUTOKEY */ + } if (ostratum != sys_stratum) report_event(EVNT_PEERSTCHG, (struct peer *)0); } /* - * poll_update - update peer poll interval. See Section 3.4.9 of the - * spec. + * poll_update - update peer poll interval */ void poll_update( @@ -983,46 +1133,83 @@ poll_update( int hpoll ) { - long update; +#ifdef AUTOKEY + int oldpoll; +#endif /* AUTOKEY */ /* - * The wiggle-the-poll-interval dance. Broadcasters dance only - * the minpoll beat. Reference clock partners sit this one out. - * Dancers surviving the clustering algorithm beat to the system - * clock. Broadcast clients are usually lead by their broadcast - * partner, but faster in the initial mating dance. + * A little foxtrot to determine what controls the poll + * interval. If the peer is reachable, but the last four polls + * have not been answered, use the minimum. If declared + * truechimer, use the system poll interval. This allows each + * association to ramp up the poll interval for useless sources + * and to clamp it to the minimum when first starting up. */ - if (peer->hmode == MODE_BROADCAST) { +#ifdef AUTOKEY + oldpoll = peer->kpoll; +#endif /* AUTOKEY */ + if (hpoll > peer->maxpoll) + peer->hpoll = peer->maxpoll; + else if (hpoll < peer->minpoll) peer->hpoll = peer->minpoll; - } else if (peer->flags & FLAG_SYSPEER) { - peer->hpoll = sys_poll; - } else { - if (hpoll > peer->maxpoll) - peer->hpoll = peer->maxpoll; - else if (hpoll < peer->minpoll) - peer->hpoll = peer->minpoll; - else - peer->hpoll = hpoll; - } + else + peer->hpoll = hpoll; + + /* + * Bit of adventure here. If during a burst and not timeout, + * just slink away. If timeout, figure what the next timeout + * should be. If IBURST or a reference clock, use one second. If + * not and the dude was reachable during the previous poll + * interval, randomize over 1-4 seconds; otherwise, randomize + * over 15-18 seconds. This is to give time for a modem to + * complete the call, for example. If not during a burst, + * randomize over the poll interval -1 to +2 seconds. + * + * In case of manycast server, make the poll interval, which is + * axtually the manycast beacon interval, eight times the system + * poll interval. Normally when the host poll interval settles + * up to 17.1 s, the beacon interval settles up to 2.3 hours. + */ if (peer->burst > 0) { if (peer->nextdate != current_time) return; - if (peer->flags & FLAG_REFCLOCK) +#ifdef REFCLOCK + else if (peer->flags & FLAG_REFCLOCK) peer->nextdate++; +#endif else if (peer->reach & 0x1) peer->nextdate += RANDPOLL(BURST_INTERVAL2); else peer->nextdate += RANDPOLL(BURST_INTERVAL1); + } else if (peer->cast_flags & MDF_ACAST) { + if (sys_survivors < NTP_MINCLOCK) + peer->kpoll = peer->hpoll; + else + peer->kpoll = peer->hpoll + 3; + peer->nextdate = peer->outdate + RANDPOLL(peer->kpoll); } else { - update = max(min(peer->ppoll, peer->hpoll), + peer->kpoll = max(min(peer->ppoll, peer->hpoll), peer->minpoll); - peer->nextdate = peer->outdate + RANDPOLL(update); + peer->nextdate = peer->outdate + RANDPOLL(peer->kpoll); } + if (peer->nextdate < current_time) + peer->nextdate = current_time; +#ifdef AUTOKEY + /* + * Bit of crass arrogance at this point. If the poll interval + * has changed and we have a keylist, the lifetimes in the + * keylist are probably bogus. In this case purge the keylist + * and regenerate it later. + */ + if (peer->kpoll != oldpoll) + key_expire(peer); +#endif /* AUTOKEY */ #ifdef DEBUG if (debug > 1) - printf("poll_update: at %lu %s poll %d burst %d last %lu next %lu\n", - current_time, ntoa(&peer->srcadr), hpoll, - peer->burst, peer->outdate, peer->nextdate); + printf("poll_update: at %lu %s flags %04x poll %d burst %d last %lu next %lu\n", + current_time, ntoa(&peer->srcadr), peer->flags, + peer->kpoll, peer->burst, peer->outdate, + peer->nextdate); #endif } @@ -1036,28 +1223,72 @@ peer_clear( ) { register int i; + u_long u_rand; + /* + * If cryptographic credentials have been acquired, toss them to + * Valhalla. Note that autokeys are ephemeral, in that they are + * tossed immediately upon use. Therefore, the keylist can be + * purged anytime without needing to preserve random keys. Note + * that, if the peer is purged, the cryptographic variables are + * purged, too. This makes it much harder to sneak in some + * unauthenticated data in the clock filter. + */ +#ifdef DEBUG + if (debug) + printf("peer_clear: at %ld assoc ID %d\n", current_time, + peer->associd); +#endif +#ifdef AUTOKEY + key_expire(peer); +#ifdef PUBKEY + if (peer->keystr != NULL) + free(peer->keystr); + if (peer->pubkey.ptr != NULL) + free(peer->pubkey.ptr); + if (peer->certif.ptr != NULL) + free(peer->certif.ptr); +#endif /* PUBKEY */ +#endif /* AUTOKEY */ memset(CLEAR_TO_ZERO(peer), 0, LEN_CLEAR_TO_ZERO); + + /* + * If he dies as a broadcast client, he comes back to life as + * a broadcast client in client mode in order to recover the + * initial autokey values. Note that there is no need to call + * clock_select(), since the perp has already been voted off + * the island at this point. + */ + if (peer->cast_flags & MDF_BCLNT) { + peer->flags |= FLAG_MCAST; + peer->hmode = MODE_CLIENT; + } + peer->flags &= ~(FLAG_AUTOKEY | FLAG_ASSOC); peer->estbdelay = sys_bdelay; - peer->hpoll = peer->minpoll; + peer->hpoll = peer->kpoll = peer->minpoll; + peer->ppoll = peer->maxpoll; peer->pollsw = FALSE; - peer->variance = MAXDISPERSE; + peer->jitter = MAXDISPERSE; peer->epoch = current_time; +#ifdef REFCLOCK + if (!(peer->flags & FLAG_REFCLOCK)) { + peer->leap = LEAP_NOTINSYNC; + peer->stratum = STRATUM_UNSPEC; + } +#endif for (i = 0; i < NTP_SHIFT; i++) { peer->filter_order[i] = i; peer->filter_disp[i] = MAXDISPERSE; peer->filter_epoch[i] = current_time; } - poll_update(peer, peer->minpoll); /* - * Since we have a chance to correct possible funniness in - * our selection of interfaces on a multihomed host, do so - * by setting us to no particular interface. - * WARNING: do so only in non-broadcast mode! + * Randomize the first poll over 1-16s to avoid bunching. */ - if (peer->hmode != MODE_BROADCAST) - peer->dstadr = any_interface; + peer->update = peer->outdate = current_time; + u_rand = RANDOM; + peer->nextdate = current_time + (u_rand & ((1 << + BURST_INTERVAL1) - 1)) + 1; } @@ -1067,130 +1298,172 @@ peer_clear( */ void clock_filter( - register struct peer *peer, - double sample_offset, - double sample_delay, - double sample_disp + register struct peer *peer, /* peer structure pointer */ + double sample_offset, /* clock offset */ + double sample_delay, /* roundtrip delay */ + double sample_disp /* dispersion */ ) { - register int i, j, k, n = 0; - register u_char *ord; - double distance[NTP_SHIFT]; - double x, y, z, off; + double dst[NTP_SHIFT]; /* distance vector */ + int ord[NTP_SHIFT]; /* index vector */ + register int i, j, k, m; + double dsp, jit, dtemp, etemp; /* - * Update error bounds and calculate distances. Also initialize - * sort index vector. + * Shift the new sample into the register and discard the oldest + * one. The new offset and delay come directly from the + * timestamp calculations. The dispersion grows from the last + * outbound packet or reference clock update to the present time + * and increased by the sum of the peer precision and the system + * precision. The delay can sometimes swing negative due to + * frequency skew, so it is clamped non-negative. */ - x = CLOCK_PHI * (current_time - peer->update); - peer->update = current_time; - ord = peer->filter_order; + dsp = min(LOGTOD(peer->precision) + LOGTOD(sys_precision) + + sample_disp, MAXDISPERSE); j = peer->filter_nextpt; - for (i = 0; i < NTP_SHIFT; i++) { - peer->filter_disp[j] += x; - if (peer->filter_disp[j] > MAXDISPERSE) - peer->filter_disp[j] = MAXDISPERSE; - distance[i] = fabs(peer->filter_delay[j]) / 2 + - peer->filter_disp[j]; - ord[i] = j; - if (--j < 0) - j += NTP_SHIFT; - } + peer->filter_offset[j] = sample_offset; + peer->filter_delay[j] = max(0, sample_delay); + peer->filter_disp[j] = dsp; + peer->filter_epoch[j] = current_time; + j++; j %=NTP_SHIFT; + peer->filter_nextpt = j; /* - * Insert the new sample at the beginning of the register. + * Update dispersions since the last update and at the same + * time initialize the distance and index lists. The distance + * list uses a compound metric. If the sample is valid and + * younger than the minimum Allan intercept, use delay; + * otherwise, use biased dispersion. */ - peer->filter_offset[peer->filter_nextpt] = sample_offset; - peer->filter_delay[peer->filter_nextpt] = sample_delay; - x = LOGTOD(peer->precision) + LOGTOD(sys_precision) + - sample_disp; - peer->filter_disp[peer->filter_nextpt] = min(x, MAXDISPERSE); - peer->filter_epoch[peer->filter_nextpt] = current_time; - distance[0] = min(x + fabs(sample_delay) / 2, MAXDISTANCE); - peer->filter_nextpt++; - if (peer->filter_nextpt >= NTP_SHIFT) - peer->filter_nextpt = 0; + dtemp = clock_phi * (current_time - peer->update); + peer->update = current_time; + for (i = NTP_SHIFT - 1; i >= 0; i--) { + if (i != 0) { + peer->filter_disp[j] += dtemp; + if (peer->filter_disp[j] > MAXDISPERSE) + peer->filter_disp[j] = MAXDISPERSE; + } + if (peer->filter_disp[j] >= MAXDISPERSE) + dst[i] = MAXDISPERSE; + else if (peer->update - peer->filter_epoch[j] > + allan_xpt) + dst[i] = MAXDISTANCE + peer->filter_disp[j]; + else + dst[i] = peer->filter_delay[j]; + ord[i] = j; + j++; j %= NTP_SHIFT; + } - /* - * Sort the samples in the register by distance. The winning - * sample will be in ord[0]. Sort the samples only if they - * are younger than the Allen intercept. + /* + * Sort the samples in both lists by distance. */ - y = min(allan_xpt, NTP_SHIFT * ULOGTOD(sys_poll)); - for (n = 0; n < NTP_SHIFT && current_time - - peer->filter_epoch[ord[n]] <= y; n++) { - for (j = 0; j < n; j++) { - if (distance[j] > distance[n]) { - x = distance[j]; + for (i = 1; i < NTP_SHIFT; i++) { + for (j = 0; j < i; j++) { + if (dst[j] > dst[i]) { k = ord[j]; - distance[j] = distance[n]; - ord[j] = ord[n]; - distance[n] = x; - ord[n] = k; + ord[j] = ord[i]; + ord[i] = k; + etemp = dst[j]; + dst[j] = dst[i]; + dst[i] = etemp; } } - } + } + + /* + * Copy the index list to the association structure so ntpq + * can see it later. Prune the distance list to samples less + * than MAXDISTANCE, but keep at least two valid samples for + * jitter calculation. + */ + m = 0; + for (i = 0; i < NTP_SHIFT; i++) { + peer->filter_order[i] = ord[i]; + if (dst[i] >= MAXDISPERSE || (m >= 2 && dst[i] >= + MAXDISTANCE)) + continue; + m++; + } /* - * Compute the error bound and standard error. + * Compute the dispersion and jitter squares. The dispersion + * is weighted exponentially by NTP_FWEIGHT (0.5) so it is + * normalized close to 1.0. The jitter is the mean of the square + * differences relative to the lowest delay sample. If no + * acceptable samples remain in the shift register, quietly + * tiptoe home leaving only the + * dispersion. */ - x = y = z = off = 0.; + jit = 0; + peer->disp = 0; + k = ord[0]; for (i = NTP_SHIFT - 1; i >= 0; i--) { - x = NTP_FWEIGHT * (x + peer->filter_disp[ord[i]]); - if (i < n) { - z += 1. / distance[i]; - off += peer->filter_offset[ord[i]] / - distance[i]; - y += DIFF(peer->filter_offset[ord[i]], - peer->filter_offset[ord[0]]); - } + + j = ord[i]; + peer->disp = NTP_FWEIGHT * (peer->disp + + peer->filter_disp[j]); + if (i < m) + jit += DIFF(peer->filter_offset[j], + peer->filter_offset[k]); } - peer->delay = peer->filter_delay[ord[0]]; - peer->variance = min(y / n, MAXDISPERSE); - peer->disp = min(x, MAXDISPERSE); - peer->epoch = current_time; - x = peer->offset; - if (peer->flags & FLAG_BURST) - peer->offset = off / z; - else - peer->offset = peer->filter_offset[ord[0]]; + + /* + * If no acceptable samples remain in the shift register, + * quietly tiptoe home leaving only the dispersion. Otherwise, + * save the offset, delay and jitter average. Note the jitter + * must not be less than the system precision. + */ + if (m == 0) + return; + etemp = peer->offset; + peer->offset = peer->filter_offset[k]; + peer->delay = peer->filter_delay[k]; + if (m > 1) + jit /= m - 1; + peer->jitter = max(jit, SQUARE(LOGTOD(sys_precision))); /* * A new sample is useful only if it is younger than the last * one used. */ - if (peer->filter_epoch[ord[0]] > peer->epoch) { + if (peer->filter_epoch[k] <= peer->epoch) { #ifdef DEBUG if (debug) printf("clock_filter: discard %lu\n", - peer->filter_epoch[ord[0]] - peer->epoch); + peer->epoch - peer->filter_epoch[k]); #endif return; } /* - * If the offset exceeds the dispersion by CLOCK_SGATE and the - * interval since the last update is less than twice the system - * poll interval, consider the update a popcorn spike and ignore - * it. + * If the difference between the last offset and the current one + * exceeds the jitter by CLOCK_SGATE (4) and the interval since + * the last update is less than twice the system poll interval, + * consider the update a popcorn spike and ignore it. */ - if (fabs(x - peer->offset) > CLOCK_SGATE && - peer->filter_epoch[ord[0]] - peer->epoch < (1 << - (sys_poll + 1))) { + if (m > 1 && fabs(peer->offset - etemp) > SQRT(peer->jitter) * + CLOCK_SGATE && peer->filter_epoch[k] - peer->epoch < + (1 << (sys_poll + 1))) { #ifdef DEBUG if (debug) - printf("clock_filter: popcorn spike %.6f\n", x); + printf("clock_filter: n %d popcorn spike %.6f jitter %.6f\n", + m, peer->offset, SQRT(peer->jitter)); #endif return; } - peer->epoch = peer->filter_epoch[ord[0]]; + + /* + * The mitigated sample statistics are saved for later + * processing, but can be processed only once. + */ + peer->epoch = peer->filter_epoch[k]; peer->pollsw = TRUE; #ifdef DEBUG if (debug) printf( - "clock_filter: offset %.6f delay %.6f disp %.6f std %.6f, age %lu\n", - peer->offset, peer->delay, peer->disp, - SQRT(peer->variance), current_time - peer->epoch); + "clock_filter: n %d off %.6f del %.6f dsp %.6f jit %.6f, age %lu\n", + m, peer->offset, peer->delay, peer->disp, + SQRT(peer->jitter), peer->update - peer->epoch); #endif } @@ -1202,35 +1475,34 @@ void clock_select(void) { register struct peer *peer; - int i; - int nlist, nl3; + int i, j, k, n; + int nreach, nlist, nl3; double d, e, f; - int j; - int n; - int allow, found, k; + int allow, found, sw; double high, low; double synch[NTP_MAXCLOCK], error[NTP_MAXCLOCK]; struct peer *osys_peer; - struct peer *typeacts = 0; - struct peer *typelocal = 0; - struct peer *typepps = 0; - struct peer *typeprefer = 0; - struct peer *typesystem = 0; + struct peer *typeacts = NULL; + struct peer *typelocal = NULL; + struct peer *typepps = NULL; + struct peer *typesystem = NULL; static int list_alloc = 0; static struct endpoint *endpoint = NULL; - static int *index = NULL; + static int *indx = NULL; static struct peer **peer_list = NULL; static u_int endpoint_size = 0; - static u_int index_size = 0; + static u_int indx_size = 0; static u_int peer_list_size = 0; /* - * Initialize. If a prefer peer does not survive this thing, - * the pps_update switch will remain zero. + * Initialize and create endpoint, index and peer lists big + * enough to handle all associations. */ - pps_update = 0; - nlist = 0; + osys_peer = sys_peer; + sys_peer = NULL; + sys_prefer = NULL; + nreach = nlist = 0; low = 1e9; high = -1e9; for (n = 0; n < HASH_SIZE; n++) @@ -1238,49 +1510,58 @@ clock_select(void) if (nlist > list_alloc) { if (list_alloc > 0) { free(endpoint); - free(index); + free(indx); free(peer_list); } while (list_alloc < nlist) { list_alloc += 5; - endpoint_size += 5 * 3 * sizeof *endpoint; - index_size += 5 * 3 * sizeof *index; - peer_list_size += 5 * sizeof *peer_list; + endpoint_size += 5 * 3 * sizeof(*endpoint); + indx_size += 5 * 3 * sizeof(*indx); + peer_list_size += 5 * sizeof(*peer_list); } endpoint = (struct endpoint *)emalloc(endpoint_size); - index = (int *)emalloc(index_size); + indx = (int *)emalloc(indx_size); peer_list = (struct peer **)emalloc(peer_list_size); } /* - * This first chunk of code is supposed to go through all - * peers we know about to find the peers which are most likely - * to succeed. We run through the list doing the sanity checks - * and trying to insert anyone who looks okay. + * Initially, we populate the island with all the rifraff peers + * that happen to be lying around. Those with seriously + * defective clocks are immediately booted off the island. Then, + * the falsetickers are culled and put to sea. The truechimers + * remaining are subject to repeated rounds where the most + * unpopular at each round is kicked off. When the population + * has dwindled to NTP_MINCLOCK (3), the survivors split a + * million bucks and collectively crank the chimes. */ nlist = nl3 = 0; /* none yet */ for (n = 0; n < HASH_SIZE; n++) { - for (peer = peer_hash[n]; peer != 0; peer = peer->next) { + for (peer = peer_hash[n]; peer != NULL; peer = + peer->next) { peer->flags &= ~FLAG_SYSPEER; peer->status = CTL_PST_SEL_REJECT; - if (peer->flags & FLAG_NOSELECT) - continue; /* noselect (survey) */ - if (peer->reach == 0) - continue; /* unreachable */ - if (peer->stratum > 1 && peer->refid == - peer->dstadr->sin.sin_addr.s_addr) - continue; /* sync loop */ - if (root_distance(peer) >= MAXDISTANCE + 2 * - CLOCK_PHI * ULOGTOD(sys_poll)) { - peer->seldisptoolarge++; - continue; /* noisy or broken */ - } /* - * Don't allow the local-clock or acts drivers + * A peer leaves the island immediately if + * unreachable, synchronized to us or suffers + * excessive root distance. Careful with the + * root distance, since the poll interval can + * increase to a day and a half. + */ + if (!peer->reach || (peer->stratum > 1 && + peer->refid == + peer->dstadr->sin.sin_addr.s_addr) || + peer->stratum >= STRATUM_UNSPEC || + (root_distance(peer) >= MAXDISTANCE + 2 * + clock_phi * ULOGTOD(sys_poll))) + continue; + + /* + * Don't allow the local clock or modem drivers * in the kitchen at this point, unless the * prefer peer. Do that later, but only if - * nobody else is around. + * nobody else is around. These guys are all + * configured, so we never throw them away. */ if (peer->refclktype == REFCLK_LOCALCLOCK #if defined(VMS) && defined(VMS_LOCALUNIT) @@ -1299,9 +1580,11 @@ clock_select(void) } /* - * If we get this far, we assume the peer is - * acceptable. + * If we get this far, the peer can stay on the + * island, but does not yet have the immunity + * idol. */ + nreach++; peer->status = CTL_PST_SEL_SANE; peer_list[nlist++] = peer; @@ -1313,40 +1596,41 @@ clock_select(void) f = root_distance(peer); e = e + f; for (i = nl3 - 1; i >= 0; i--) { - if (e >= endpoint[index[i]].val) + if (e >= endpoint[indx[i]].val) break; - index[i + 3] = index[i]; + indx[i + 3] = indx[i]; } - index[i + 3] = nl3; + indx[i + 3] = nl3; endpoint[nl3].type = 1; endpoint[nl3++].val = e; e = e - f; /* Center point */ for ( ; i >= 0; i--) { - if (e >= endpoint[index[i]].val) + if (e >= endpoint[indx[i]].val) break; - index[i + 2] = index[i]; + indx[i + 2] = indx[i]; } - index[i + 2] = nl3; + indx[i + 2] = nl3; endpoint[nl3].type = 0; endpoint[nl3++].val = e; e = e - f; /* Lower end */ for ( ; i >= 0; i--) { - if (e >= endpoint[index[i]].val) + if (e >= endpoint[indx[i]].val) break; - index[i + 1] = index[i]; + indx[i + 1] = indx[i]; } - index[i + 1] = nl3; + indx[i + 1] = nl3; endpoint[nl3].type = -1; endpoint[nl3++].val = e; } } #ifdef DEBUG - if (debug > 1) + if (debug > 2) for (i = 0; i < nl3; i++) - printf("select: endpoint %2d %.6f\n", - endpoint[index[i]].type, endpoint[index[i]].val); + printf("select: endpoint %2d %.6f\n", + endpoint[indx[i]].type, + endpoint[indx[i]].val); #endif i = 0; j = nl3 - 1; @@ -1355,30 +1639,30 @@ clock_select(void) while (allow > 0) { allow--; for (n = 0; i <= j; i++) { - n += endpoint[index[i]].type; + n += endpoint[indx[i]].type; if (n < 0) break; - if (endpoint[index[i]].type == 0) + if (endpoint[indx[i]].type == 0) found++; } for (n = 0; i <= j; j--) { - n += endpoint[index[j]].type; + n += endpoint[indx[j]].type; if (n > 0) break; - if (endpoint[index[j]].type == 0) + if (endpoint[indx[j]].type == 0) found++; } if (found > allow) break; - low = endpoint[index[i++]].val; - high = endpoint[index[j--]].val; + low = endpoint[indx[i++]].val; + high = endpoint[indx[j--]].val; } /* - * If no survivors remain at this point, check if the acts or - * local clock drivers have been found. If so, nominate one of - * them as the only survivor. Otherwise, give up and declare us - * unsynchronized. + * If no survivors remain at this point, check if the local + * clock or modem drivers have been found. If so, nominate one + * of them as the only survivor. Otherwise, give up and declare + * us unsynchronized. */ if ((allow << 1) >= nlist) { if (typeacts != 0) { @@ -1390,35 +1674,45 @@ clock_select(void) peer_list[0] = typelocal; nlist = 1; } else { - if (sys_peer != 0) { - report_event(EVNT_PEERSTCHG, - (struct peer *)0); + if (osys_peer != NULL) { + sys_poll = NTP_MINPOLL; NLOG(NLOG_SYNCSTATUS) - msyslog(LOG_INFO, + msyslog(LOG_INFO, "synchronisation lost"); + report_event(EVNT_PEERSTCHG, + (struct peer *)0); } - sys_peer = 0; + sys_survivors = 0; +#ifdef AUTOKEY + resetmanycast(); +#endif /* AUTOKEY */ return; } } #ifdef DEBUG - if (debug > 1) + if (debug > 2) printf("select: low %.6f high %.6f\n", low, high); #endif /* - * Clustering algorithm. Process intersection list to discard - * outlyers. Construct candidate list in cluster order - * determined by the sum of peer synchronization distance plus - * scaled stratum. We must find at least one peer. + * Clustering algorithm. Construct candidate list in order first + * by stratum then by root distance. If we have more than + * MAXCLOCK peers, keep only the best MAXCLOCK of them. Scan the + * list to find falsetickers, who leave the island immediately. + * If a falseticker is not configured, his association raft is + * drowned as well. We must leave at least one peer to collect + * the million bucks. */ j = 0; for (i = 0; i < nlist; i++) { peer = peer_list[i]; - if (nlist > 1 && (low >= peer->offset || - peer->offset >= high)) + if (nlist > 1 && (low >= peer->offset || peer->offset >= + high)) { + if (!(peer->flags & FLAG_CONFIG)) + unpeer(peer); continue; - peer->status = CTL_PST_SEL_CORRECT; + } + peer->status = CTL_PST_SEL_DISTSYSPEER; d = root_distance(peer) + peer->stratum * MAXDISPERSE; if (j >= NTP_MAXCLOCK) { if (d >= synch[j - 1]) @@ -1429,77 +1723,98 @@ clock_select(void) for (k = j; k > 0; k--) { if (d >= synch[k - 1]) break; - synch[k] = synch[k - 1]; peer_list[k] = peer_list[k - 1]; + error[k] = error[k - 1]; + synch[k] = synch[k - 1]; } peer_list[k] = peer; + error[k] = peer->jitter; synch[k] = d; j++; } nlist = j; + for (i = 0; i < nlist; i++) { + peer_list[i]->status = CTL_PST_SEL_SELCAND; #ifdef DEBUG - if (debug > 1) - for (i = 0; i < nlist; i++) + if (debug > 2) printf("select: %s distance %.6f\n", ntoa(&peer_list[i]->srcadr), synch[i]); #endif + } /* - * Now, prune outlyers by root dispersion. Continue as long as - * there are more than NTP_MINCLOCK survivors and the minimum - * select dispersion is greater than the maximum peer - * dispersion. Stop if we are about to discard a prefer peer. + * Now, vote outlyers off the island by select jitter weighted + * by root dispersion. Continue voting as long as there are more + * than NTP_MINCLOCK survivors and the minimum select jitter + * squared is greater than the maximum peer jitter squared. Stop + * if we are about to discard a prefer peer, who of course has + * the immunity idol. */ - for (i = 0; i < nlist; i++) { - peer = peer_list[i]; - error[i] = peer->variance; - if (i < NTP_CANCLOCK) - peer->status = CTL_PST_SEL_SELCAND; - else - peer->status = CTL_PST_SEL_DISTSYSPEER; - } while (1) { - sys_maxd = 0; - d = error[0]; - for (k = i = nlist - 1; i >= 0; i--) { - double sdisp = 0; - - for (j = nlist - 1; j > 0; j--) { - sdisp = NTP_SWEIGHT * (sdisp + - DIFF(peer_list[i]->offset, - peer_list[j]->offset)); + d = 1e9; + e = -1e9; + k = 0; + for (i = 0; i < nlist; i++) { + + if (error[i] < d) + d = error[i]; + f = 0; + if (nlist > 1) { + for (j = 0; j < nlist; j++) + f += DIFF(peer_list[j]->offset, + peer_list[i]->offset); + f /= nlist - 1; } - if (sdisp > sys_maxd) { - sys_maxd = sdisp; + f = max(f, SQUARE(LOGTOD(sys_precision))); + if (f * synch[i] > e) { + sys_selerr = f; + e = f * synch[i]; k = i; } - if (error[i] < d) - d = error[i]; } #ifdef DEBUG - if (debug > 1) + if (debug > 2) printf( "select: survivors %d select %.6f peer %.6f\n", - nlist, SQRT(sys_maxd), SQRT(d)); + k, SQRT(sys_selerr), SQRT(d)); #endif - if (nlist <= NTP_MINCLOCK || sys_maxd <= d || - peer_list[k]->flags & FLAG_PREFER) + if (nlist <= NTP_MINCLOCK || sys_selerr <= d || + peer_list[k]->flags & FLAG_PREFER) break; + if (!(peer_list[k]->flags & FLAG_CONFIG)) + unpeer(peer_list[k]); for (j = k + 1; j < nlist; j++) { peer_list[j - 1] = peer_list[j]; error[j - 1] = error[j]; } nlist--; } + +#ifdef AUTOKEY + /* + * In manycast client mode we may have spooked a sizeable number + * of servers that we don't need. If there are at least + * NTP_MINCLOCK of them, the manycast message will be turned + * off. By the time we get here we nay be ready to prune some of + * them back, but we want to make sure all the candicates have + * had a chance. If they didn't pass the sanity and intersection + * tests, they have already been voted off the island. + */ + if (sys_survivors >= NTP_MINCLOCK && nlist < NTP_MINCLOCK) + resetmanycast(); +#endif /* AUTOKEY */ + sys_survivors = nlist; + #ifdef DEBUG - if (debug > 1) { + if (debug > 2) { for (i = 0; i < nlist; i++) printf( "select: %s offset %.6f, distance %.6f poll %d\n", - ntoa(&peer_list[i]->srcadr), peer_list[i]->offset, - synch[i], peer_list[i]->pollsw); + ntoa(&peer_list[i]->srcadr), + peer_list[i]->offset, synch[i], + peer_list[i]->pollsw); } #endif @@ -1518,27 +1833,30 @@ clock_select(void) * him. We note that the head of the list is at the lowest * stratum and that unsynchronized peers cannot survive this * far. + * + * Note that we go no further, unless the number of survivors is + * a majority of the suckers that have been found reachable and + * no prior source is available. This avoids the transient when + * one of a flock of sources is out to lunch and just happens + * to be the first survivor. */ + if (osys_peer == NULL && 2 * nlist < min(nreach, NTP_MINCLOCK)) + return; leap_consensus = 0; for (i = nlist - 1; i >= 0; i--) { - peer_list[i]->status = CTL_PST_SEL_SYNCCAND; - peer_list[i]->flags |= FLAG_SYSPEER; - poll_update(peer_list[i], peer_list[i]->hpoll); - if (peer_list[i]->stratum == peer_list[0]->stratum) { - leap_consensus |= peer_list[i]->leap; - if (peer_list[i]->refclktype == REFCLK_ATOM_PPS) - typepps = peer_list[i]; - if (peer_list[i] == sys_peer) - typesystem = peer_list[i]; - if (peer_list[i]->flags & FLAG_PREFER) { - typeprefer = peer_list[i]; - if (fabs(typeprefer->offset) < - clock_max) - pps_update = 1; - } - } else { - if (peer_list[i] == sys_peer) - sys_peer = 0; + peer = peer_list[i]; + peer->status = CTL_PST_SEL_SYNCCAND; + peer->flags |= FLAG_SYSPEER; + poll_update(peer, peer->hpoll); + if (peer->stratum == peer_list[0]->stratum) { + leap_consensus |= peer->leap; + if (peer->refclktype == REFCLK_ATOM_PPS && + peer->stratum < STRATUM_UNSPEC) + typepps = peer; + if (peer == osys_peer) + typesystem = peer; + if (peer->flags & FLAG_PREFER) + sys_prefer = peer; } } @@ -1554,38 +1872,45 @@ clock_select(void) * stated. Note that all of these must be at the lowest stratum, * i.e., the stratum of the head of the survivor list. */ - osys_peer = sys_peer; - if (typeprefer && (typeprefer->refclktype == REFCLK_LOCALCLOCK - || typeprefer->sstclktype == CTL_SST_TS_TELEPHONE || - !typepps)) { - sys_peer = typeprefer; + if (sys_prefer) + sw = sys_prefer->refclktype == REFCLK_LOCALCLOCK || + sys_prefer->sstclktype == CTL_SST_TS_TELEPHONE || + !typepps; + else + sw = 0; + if (sw) { + sys_peer = sys_prefer; sys_peer->status = CTL_PST_SEL_SYSPEER; sys_offset = sys_peer->offset; - sys_epsil = sys_peer->variance; + sys_syserr = sys_peer->jitter; #ifdef DEBUG if (debug > 1) printf("select: prefer offset %.6f\n", sys_offset); #endif - } else if (typepps && pps_update) { + } else if (typepps) { sys_peer = typepps; sys_peer->status = CTL_PST_SEL_PPS; sys_offset = sys_peer->offset; - sys_epsil = sys_peer->variance; + sys_syserr = sys_peer->jitter; if (!pps_control) - NLOG(NLOG_SYSEVENT) /* conditional syslog */ - msyslog(LOG_INFO, "pps sync enabled"); + NLOG(NLOG_SYSEVENT) + msyslog(LOG_INFO, + "pps sync enabled"); pps_control = current_time; #ifdef DEBUG if (debug > 1) - printf("select: pps offset %.6f\n", sys_offset); + printf("select: pps offset %.6f\n", + sys_offset); #endif } else { - if (!typesystem) + if (typesystem) + sys_peer = osys_peer; + else sys_peer = peer_list[0]; sys_peer->status = CTL_PST_SEL_SYSPEER; sys_offset = clock_combine(peer_list, nlist); - sys_epsil = sys_peer->variance + sys_maxd; + sys_syserr = sys_peer->jitter + sys_selerr; #ifdef DEBUG if (debug > 1) printf("select: combine offset %.6f\n", @@ -1625,10 +1950,14 @@ root_distance( struct peer *peer ) { - return ((fabs(peer->delay) + peer->rootdelay) / 2 + - peer->rootdispersion + peer->disp + - SQRT(peer->variance) + CLOCK_PHI * (current_time - - peer->update)); + /* + * Careful squeak here. The value returned must be greater than + * zero blamed on the peer jitter, which must be at least the + * square of sys_precision. + */ + return ((peer->rootdelay + peer->delay) / 2 + + peer->rootdispersion + peer->disp + clock_phi * + (current_time - peer->update) + SQRT(peer->jitter)); } /* @@ -1639,279 +1968,518 @@ peer_xmit( struct peer *peer /* peer structure pointer */ ) { - struct pkt xpkt; - int find_rtt = (peer->cast_flags & MDF_MCAST) && - peer->hmode != MODE_BROADCAST; - int sendlen; + struct pkt xpkt; /* transmit packet */ + int sendlen, authlen; + keyid_t xkeyid; /* transmit key ID */ + l_fp xmt_tx; /* - * Initialize protocol fields. + * Initialize transmit packet header fields. */ - xpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, - peer->version, peer->hmode); + xpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, peer->version, + peer->hmode); xpkt.stratum = STRATUM_TO_PKT(sys_stratum); xpkt.ppoll = peer->hpoll; xpkt.precision = sys_precision; xpkt.rootdelay = HTONS_FP(DTOFP(sys_rootdelay)); - xpkt.rootdispersion = HTONS_FP(DTOUFP(sys_rootdispersion + - LOGTOD(sys_precision))); + xpkt.rootdispersion = HTONS_FP(DTOUFP(sys_rootdispersion)); xpkt.refid = sys_refid; HTONL_FP(&sys_reftime, &xpkt.reftime); HTONL_FP(&peer->org, &xpkt.org); HTONL_FP(&peer->rec, &xpkt.rec); /* - * Authenticate the packet if enabled and either configured or - * the previous packet was authenticated. If for some reason the - * key associated with the key identifier is not in the key - * cache, then honk key zero. + * If the received packet contains a MAC, the transmitted packet + * is authenticated and contains a MAC. If not, the transmitted + * packet is not authenticated. + * + * In the current I/O semantics the default interface is set + * until after receiving a packet and setting the right + * interface. So, the first packet goes out unauthenticated. + * That's why the really icky test next is here. */ sendlen = LEN_PKT_NOMAC; - if (peer->flags & FLAG_AUTHENABLE) { - u_long xkeyid; - l_fp xmt_tx; + if (!(peer->flags & FLAG_AUTHENABLE)) { + get_systime(&peer->xmt); + HTONL_FP(&peer->xmt, &xpkt.xmt); + sendpkt(&peer->srcadr, peer->dstadr, peer->ttl, &xpkt, + sendlen); + peer->sent++; +#ifdef DEBUG + if (debug) + printf("transmit: at %ld %s->%s mode %d\n", + current_time, ntoa(&peer->dstadr->sin), + ntoa(&peer->srcadr), peer->hmode); +#endif + return; + } + + /* + * The received packet contains a MAC, so the transmitted packet + * must be authenticated. If autokey is enabled, fuss with the + * various modes; otherwise, private key cryptography is used. + */ +#ifdef AUTOKEY + if ((peer->flags & FLAG_SKEY)) { + u_int cmmd; /* - * Transmit encrypted packet compensated for the - * encryption delay. + * The Public Key Dance (PKD): Cryptographic credentials + * are contained in extension fields, each including a + * 4-octet length/code word followed by a 4-octet + * association ID and optional additional data. Optional + * data includes a 4-octet data length field followed by + * the data itself. Request messages are sent from a + * configured association; response messages can be sent + * from a configured association or can take the fast + * path without ever matching an association. Response + * messages have the same code as the request, but have + * a response bit and possibly an error bit set. In this + * implementation, a message may contain no more than + * one command and no more than one response. + * + * Cryptographic session keys include both a public and + * a private componet. Request and response messages + * using extension fields are always sent with the + * private component set to zero. Packets without + * extension fields indlude the private component when + * the session key is generated. */ -#ifdef MD5 - if (peer->flags & FLAG_SKEY) { - + while (1) { + /* - * In autokey mode, allocate and initialize a - * key list if not already done. Then, use the - * list in inverse order, discarding keys once - * used. Keep the latest key around until the - * next one, so clients can use client/server - * packets to compute propagation delay. Note we - * have to wait until the receive side of the - * socket is bound and the server address - * confirmed. + * Allocate and initialize a keylist if not + * already done. Then, use the list in inverse + * order, discarding keys once used. Keep the + * latest key around until the next one, so + * clients can use client/server packets to + * compute propagation delay. + * + * Note that once a key is used from the list, + * it is retained in the key cache until the + * next key is used. This is to allow a client + * to retrieve the encrypted session key + * identifier to verify authenticity. + * + * If for some reason a key is no longer in the + * key cache, a birthday has happened and the + * pseudo-random sequence is probably broken. In + * that case, purge the keylist and regenerate + * it. */ - if (ntohl(peer->dstadr->sin.sin_addr.s_addr) == - 0 && - ntohl(peer->dstadr->bcast.sin_addr.s_addr) == 0) - peer->keyid = 0; - else { - if (peer->keylist == 0) { - make_keylist(peer); - } else { - authtrust(peer->keylist[peer->keynumber], 0); - if (peer->keynumber == 0) - make_keylist(peer); - else { - peer->keynumber--; - xkeyid = peer->keylist[peer->keynumber]; - if (!authistrusted(xkeyid)) - make_keylist(peer); - } - } - peer->keyid = peer->keylist[peer->keynumber]; - xpkt.keyid1 = htonl(2 * sizeof(u_int32)); - xpkt.keyid2 = htonl(sys_private); - sendlen += 2 * sizeof(u_int32); - } + if (peer->keynumber == 0) + make_keylist(peer, peer->dstadr); + else + peer->keynumber--; + xkeyid = peer->keylist[peer->keynumber]; + if (authistrusted(xkeyid)) + break; + else + key_expire(peer); } -#endif /* MD5 */ - xkeyid = peer->keyid; - get_systime(&peer->xmt); - L_ADD(&peer->xmt, &sys_authdelay); - HTONL_FP(&peer->xmt, &xpkt.xmt); - sendlen += authencrypt(xkeyid, (u_int32 *)&xpkt, - sendlen); - get_systime(&xmt_tx); - sendpkt(&peer->srcadr, find_rtt ? any_interface : - peer->dstadr, ((peer->cast_flags & MDF_MCAST) && - !find_rtt) ? ((peer->cast_flags & MDF_ACAST) ? -7 : - peer->ttl) : -7, &xpkt, sendlen); + peer->keyid = xkeyid; + switch (peer->hmode) { /* - * Calculate the encryption delay. Keep the minimum over - * the latest two samples. + * In broadcast mode the autokey values are required. + * Send them when a new keylist is generated; otherwise, + * send the association ID so the client can request + * them at other times. */ - L_SUB(&xmt_tx, &peer->xmt); - L_ADD(&xmt_tx, &sys_authdelay); - sys_authdly[1] = sys_authdly[0]; - sys_authdly[0] = xmt_tx.l_uf; - if (sys_authdly[0] < sys_authdly[1]) - sys_authdelay.l_uf = sys_authdly[0]; - else - sys_authdelay.l_uf = sys_authdly[1]; - peer->sent++; -#ifdef DEBUG - if (debug) - printf( - "transmit: at %ld to %s mode %d keyid %08lx index %d\n", - current_time, ntoa(&peer->srcadr), - peer->hmode, xkeyid, peer->keynumber); -#endif - } else { + case MODE_BROADCAST: + if (peer->flags & FLAG_ASSOC) + cmmd = CRYPTO_AUTO | CRYPTO_RESP; + else + cmmd = CRYPTO_ASSOC | CRYPTO_RESP; + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, cmmd, 0, peer->associd); + break; + /* - * Transmit non-authenticated packet. + * In symmetric modes the public key, leapsecond table, + * agreement parameters and autokey values are required. + * + * 1. If a response is pending, always send it first. + * + * 2. Don't send anything except a public-key request + * until the public key has been stored. + * + * 3. Once the public key has been stored, don't send + * anything except an agreement parameter request + * until the agreement parameters have been stored. + * + * 4. Once the argeement parameters have been stored, + * don't send anything except a public value request + * until the agreed key has been stored. + * + * 5. When the agreed key has been stored and the key + * list is regenerated, send the autokey values + * gratis unless they have already been sent. */ - get_systime(&(peer->xmt)); - HTONL_FP(&peer->xmt, &xpkt.xmt); - sendpkt(&(peer->srcadr), find_rtt ? any_interface : - peer->dstadr, ((peer->cast_flags & MDF_MCAST) && - !find_rtt) ? ((peer->cast_flags & MDF_ACAST) ? -7 : - peer->ttl) : -8, &xpkt, sendlen); - peer->sent++; + case MODE_ACTIVE: + case MODE_PASSIVE: +#ifdef PUBKEY + if (peer->cmmd != 0) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, (peer->cmmd >> 16) | + CRYPTO_RESP, peer->hcookie, + peer->associd); + if (!peer->crypto) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_ASSOC, + peer->hcookie, peer->assoc); + else if (!crypto_flags && + peer->pcookie.tstamp == 0 && sys_leap != + LEAP_NOTINSYNC) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_PRIV, peer->hcookie, + peer->assoc); + else if (crypto_flags && peer->pubkey.ptr == + NULL) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_NAME, peer->hcookie, + peer->assoc); + else if (peer->crypto & CRYPTO_FLAG_CERT) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_CERT, peer->hcookie, + peer->assoc); + else if (crypto_flags && peer->crypto & + CRYPTO_FLAG_DH && sys_leap != + LEAP_NOTINSYNC) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_DHPAR, + peer->hcookie, peer->assoc); + else if (crypto_flags && peer->pcookie.tstamp == + 0 && sys_leap != LEAP_NOTINSYNC) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_DH, peer->hcookie, + peer->assoc); +#else + if (peer->cmmd != 0) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, (peer->cmmd >> 16) | + CRYPTO_RESP, peer->hcookie, + peer->associd); + if (peer->pcookie.tstamp == 0 && sys_leap != + LEAP_NOTINSYNC) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_PRIV, peer->hcookie, + peer->assoc); +#endif /* PUBKEY */ + else if (!(peer->flags & FLAG_AUTOKEY)) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_AUTO, peer->hcookie, + peer->assoc); + else if ((peer->flags & FLAG_ASSOC) && + (peer->cmmd >> 16) != CRYPTO_AUTO) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_AUTO | CRYPTO_RESP, + peer->hcookie, peer->associd); +#ifdef PUBKEY + else if (peer->crypto & CRYPTO_FLAG_TAI) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_TAI, peer->hcookie, + peer->assoc); +#endif /* PUBKEY */ + peer->cmmd = 0; + break; + + /* + * In client mode, the public key, host cookie and + * autokey values are required. In broadcast client + * mode, these values must be acquired during the + * client/server exchange to avoid having to wait until + * the next key list regeneration. Otherwise, the poor + * dude may die a lingering death until becoming + * unreachable and attempting rebirth. Note that we ask + * for the cookie at each key list regeneration anyway. + */ + case MODE_CLIENT: + if (peer->cmmd != 0) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, (peer->cmmd >> 16) | + CRYPTO_RESP, peer->hcookie, + peer->associd); + if (!peer->crypto) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_ASSOC, + peer->hcookie, peer->assoc); +#ifdef PUBKEY + else if (crypto_flags && peer->pubkey.ptr == + NULL) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_NAME, peer->hcookie, + peer->assoc); + else if (peer->crypto & CRYPTO_FLAG_CERT) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_CERT, peer->hcookie, + peer->assoc); +#endif /* PUBKEY */ + else if (peer->pcookie.tstamp == 0) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_PRIV, peer->hcookie, + peer->assoc); + else if (!(peer->flags & FLAG_AUTOKEY) && + (peer->cast_flags & MDF_BCLNT)) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_AUTO, peer->hcookie, + peer->assoc); +#ifdef PUBKEY + else if (peer->crypto & CRYPTO_FLAG_TAI) + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, CRYPTO_TAI, peer->hcookie, + peer->assoc); +#endif /* PUBKEY */ + peer->cmmd = 0; + break; + } + + /* + * If extension fields are present, we must use a + * private value of zero and force min poll interval. + * Most intricate. + */ + if (sendlen > LEN_PKT_NOMAC) + session_key(&peer->dstadr->sin, &peer->srcadr, + xkeyid, 0, 2); + } +#endif /* AUTOKEY */ + xkeyid = peer->keyid; + get_systime(&peer->xmt); + L_ADD(&peer->xmt, &sys_authdelay); + HTONL_FP(&peer->xmt, &xpkt.xmt); + authlen = authencrypt(xkeyid, (u_int32 *)&xpkt, sendlen); + if (authlen == 0) { + msyslog(LOG_NOTICE, + "transmit: no encryption key found"); + peer->flash |= TEST4 | TEST5; + return; + } + sendlen += authlen; +#ifdef AUTOKEY + if (xkeyid > NTP_MAXKEY) + authtrust(xkeyid, 0); +#endif /* AUTOKEY */ + get_systime(&xmt_tx); + if (sendlen > sizeof(xpkt)) { + msyslog(LOG_ERR, "buffer overflow %u", sendlen); + exit(-1); + } + sendpkt(&peer->srcadr, peer->dstadr, peer->ttl, &xpkt, sendlen); + + /* + * Calculate the encryption delay. Keep the minimum over + * the latest two samples. + */ + L_SUB(&xmt_tx, &peer->xmt); + L_ADD(&xmt_tx, &sys_authdelay); + sys_authdly[1] = sys_authdly[0]; + sys_authdly[0] = xmt_tx.l_uf; + if (sys_authdly[0] < sys_authdly[1]) + sys_authdelay.l_uf = sys_authdly[0]; + else + sys_authdelay.l_uf = sys_authdly[1]; + peer->sent++; +#ifdef AUTOKEY #ifdef DEBUG - if (debug) - printf("transmit: at %ld to %s mode %d\n", - current_time, ntoa(&peer->srcadr), - peer->hmode); + if (debug) + printf( + "transmit: at %ld %s->%s mode %d keyid %08x len %d mac %d index %d\n", + current_time, ntoa(&peer->dstadr->sin), + ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen, + authlen, peer->keynumber); #endif - } +#else +#ifdef DEBUG + if (debug) + printf( + "transmit: at %ld %s->%s mode %d keyid %08x len %d mac %d\n", + current_time, ntoa(&peer->dstadr->sin), + ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen, + authlen); +#endif +#endif /* AUTOKEY */ } + /* - * fast_xmit - Send packet for nonpersistent association. + * fast_xmit - Send packet for nonpersistent association. Note that + * neither the source or destination can be a broadcast address. */ static void fast_xmit( struct recvbuf *rbufp, /* receive packet pointer */ int xmode, /* transmit mode */ - u_long xkeyid /* transmit key ID */ + keyid_t xkeyid, /* transmit key ID */ + int mask /* restrict mask */ ) { - struct pkt xpkt; - struct pkt *rpkt; - int sendlen; - l_fp xmt_ts; + struct pkt xpkt; /* transmit packet structure */ + struct pkt *rpkt; /* receive packet structure */ + l_fp xmt_ts; /* transmit timestamp */ + l_fp xmt_tx; /* transmit timestamp after authent */ + int sendlen, authlen; /* - * Initialize transmit packet header fields in the receive - * buffer provided. We leave some fields intact as received. + * Initialize transmit packet header fields from the receive + * buffer provided. We leave some fields intact as received. If + * the gazinta was from a multicast address, the gazouta must go + * out another way. */ rpkt = &rbufp->recv_pkt; - xpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, - PKT_VERSION(rpkt->li_vn_mode), xmode); - xpkt.stratum = STRATUM_TO_PKT(sys_stratum); + if (rbufp->dstadr->flags & INT_MULTICAST) + rbufp->dstadr = findinterface(&rbufp->recv_srcadr); + + /* + * If the caller is restricted, return a kiss-of-death packet; + * otherwise, smooch politely. + */ + if (mask & (RES_DONTSERVE | RES_LIMITED)) { + if (!(mask & RES_DEMOBILIZE)) { + return; + } else { + xpkt.li_vn_mode = + PKT_LI_VN_MODE(LEAP_NOTINSYNC, + PKT_VERSION(rpkt->li_vn_mode), xmode); + xpkt.stratum = STRATUM_UNSPEC; + memcpy(&xpkt.refid, "DENY", 4); + } + } else { + xpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap, + PKT_VERSION(rpkt->li_vn_mode), xmode); + xpkt.stratum = STRATUM_TO_PKT(sys_stratum); + xpkt.refid = sys_refid; + } xpkt.ppoll = rpkt->ppoll; xpkt.precision = sys_precision; xpkt.rootdelay = HTONS_FP(DTOFP(sys_rootdelay)); - xpkt.rootdispersion = HTONS_FP(DTOUFP(sys_rootdispersion + - LOGTOD(sys_precision))); - xpkt.refid = sys_refid; + xpkt.rootdispersion = + HTONS_FP(DTOUFP(sys_rootdispersion)); HTONL_FP(&sys_reftime, &xpkt.reftime); xpkt.org = rpkt->xmt; HTONL_FP(&rbufp->recv_time, &xpkt.rec); - sendlen = LEN_PKT_NOMAC; - if (rbufp->recv_length > sendlen) { - l_fp xmt_tx; - /* - * Transmit encrypted packet compensated for the - * encryption delay. - */ - if (xkeyid > NTP_MAXKEY) { - xpkt.keyid1 = htonl(2 * sizeof(u_int32)); - xpkt.keyid2 = htonl(sys_private); - sendlen += 2 * sizeof(u_int32); - } + /* + * If the received packet contains a MAC, the transmitted packet + * is authenticated and contains a MAC. If not, the transmitted + * packet is not authenticated. + */ + sendlen = LEN_PKT_NOMAC; + if (rbufp->recv_length == sendlen) { get_systime(&xmt_ts); - L_ADD(&xmt_ts, &sys_authdelay); HTONL_FP(&xmt_ts, &xpkt.xmt); - sendlen += authencrypt(xkeyid, (u_int32 *)&xpkt, + sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, &xpkt, sendlen); - get_systime(&xmt_tx); - sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, -9, &xpkt, - sendlen); - - /* - * Calculate the encryption delay. Keep the minimum over - * the latest two samples. - */ - L_SUB(&xmt_tx, &xmt_ts); - L_ADD(&xmt_tx, &sys_authdelay); - sys_authdly[1] = sys_authdly[0]; - sys_authdly[0] = xmt_tx.l_uf; - if (sys_authdly[0] < sys_authdly[1]) - sys_authdelay.l_uf = sys_authdly[0]; - else - sys_authdelay.l_uf = sys_authdly[1]; #ifdef DEBUG if (debug) - printf( - "transmit: at %ld to %s mode %d keyid %08lx\n", - current_time, ntoa(&rbufp->recv_srcadr), - xmode, xkeyid); + printf("transmit: at %ld %s->%s mode %d\n", + current_time, ntoa(&rbufp->dstadr->sin), + ntoa(&rbufp->recv_srcadr), xmode); #endif - } else { + return; + } + + /* + * The received packet contains a MAC, so the transmitted packet + * must be authenticated. For private-key cryptography, use the + * predefined private keys to generate the cryptosum. For + * autokey cryptography, use the server private value to + * generate the cookie, which is unique for every source- + * destination-key ID combination. + */ +#ifdef AUTOKEY + if (xkeyid > NTP_MAXKEY) { + keyid_t cookie; + u_int code, associd; /* - * Transmit non-authenticated packet. + * The only way to get here is a reply to a legitimate + * client request message, so the mode must be + * MODE_SERVER. If an extension field is present, there + * can be only one and that must be a command. Do what + * needs, but with private value of zero so the poor + * jerk can decode it. If no extension field is present, + * use the cookie to generate the session key. */ - get_systime(&xmt_ts); - HTONL_FP(&xmt_ts, &xpkt.xmt); - sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, -10, &xpkt, - sendlen); + code = (htonl(rpkt->exten[0]) >> 16) | CRYPTO_RESP; + cookie = session_key(&rbufp->recv_srcadr, + &rbufp->dstadr->sin, 0, sys_private, 0); + associd = htonl(rpkt->exten[1]); + if (rbufp->recv_length >= sendlen + MAX_MAC_LEN + 2 * + sizeof(u_int32)) { + session_key(&rbufp->dstadr->sin, + &rbufp->recv_srcadr, xkeyid, 0, 2); + sendlen += crypto_xmit((u_int32 *)&xpkt, + sendlen, code, cookie, associd); + } else { + session_key(&rbufp->dstadr->sin, + &rbufp->recv_srcadr, xkeyid, cookie, 2); + } + } +#endif /* AUTOKEY */ + get_systime(&xmt_ts); + L_ADD(&xmt_ts, &sys_authdelay); + HTONL_FP(&xmt_ts, &xpkt.xmt); + authlen = authencrypt(xkeyid, (u_int32 *)&xpkt, sendlen); + sendlen += authlen; +#ifdef AUTOKEY + if (xkeyid > NTP_MAXKEY) + authtrust(xkeyid, 0); +#endif /* AUTOKEY */ + get_systime(&xmt_tx); + if (sendlen > sizeof(xpkt)) { + msyslog(LOG_ERR, "buffer overflow %u", sendlen); + exit(-1); + } + sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, &xpkt, sendlen); + + /* + * Calculate the encryption delay. Keep the minimum over the + * latest two samples. + */ + L_SUB(&xmt_tx, &xmt_ts); + L_ADD(&xmt_tx, &sys_authdelay); + sys_authdly[1] = sys_authdly[0]; + sys_authdly[0] = xmt_tx.l_uf; + if (sys_authdly[0] < sys_authdly[1]) + sys_authdelay.l_uf = sys_authdly[0]; + else + sys_authdelay.l_uf = sys_authdly[1]; #ifdef DEBUG - if (debug) - printf("transmit: at %ld to %s mode %d\n", - current_time, ntoa(&rbufp->recv_srcadr), - xmode); + if (debug) + printf( + "transmit: at %ld %s->%s mode %d keyid %08x len %d mac %d\n", + current_time, ntoa(&rbufp->dstadr->sin), + ntoa(&rbufp->recv_srcadr), xmode, xkeyid, sendlen, + authlen); #endif - } } -#ifdef MD5 + +#ifdef AUTOKEY /* - * Compute key list + * key_expire - purge the key list */ -static void -make_keylist( - struct peer *peer +void +key_expire( + struct peer *peer /* peer structure pointer */ ) { int i; - u_long keyid; - u_long ltemp; - /* - * Allocate the key list if necessary. - */ - if (peer->keylist == 0) - peer->keylist = (u_long *)emalloc(sizeof(u_long) * - NTP_MAXSESSION); - - /* - * Generate an initial key ID which is unique and greater than - * NTP_MAXKEY. - */ - while (1) { - keyid = (u_long)RANDOM & 0xffffffff; - if (keyid <= NTP_MAXKEY) - continue; - if (authhavekey(keyid)) - continue; - break; - } - - /* - * Generate up to NTP_MAXSESSION session keys. Stop if the - * next one would not be unique or not a session key ID or if - * it would expire before the next poll. - */ - ltemp = sys_automax; - for (i = 0; i < NTP_MAXSESSION; i++) { - peer->keylist[i] = keyid; - peer->keynumber = i; - keyid = session_key( - ntohl(peer->dstadr->sin.sin_addr.s_addr), - (peer->hmode == MODE_BROADCAST || (peer->flags & - FLAG_MCAST2)) ? - ntohl(peer->dstadr->bcast.sin_addr.s_addr): - ntohl(peer->srcadr.sin_addr.s_addr), keyid, ltemp); - ltemp -= 1 << peer->hpoll; - if (auth_havekey(keyid) || keyid <= NTP_MAXKEY || - ltemp <= (1 << (peer->hpoll + 1))) - break; + if (peer->keylist != NULL) { + for (i = 0; i <= peer->keynumber; i++) + authtrust(peer->keylist[i], 0); + free(peer->keylist); + peer->keylist = NULL; } + peer->keynumber = peer->sndauto.seq = 0; +#ifdef DEBUG + if (debug) + printf("key_expire: at %lu\n", current_time); +#endif } -#endif /* MD5 */ +#endif /* AUTOKEY */ /* * Find the precision of this particular machine @@ -2031,19 +2599,17 @@ init_proto(void) sys_leap = LEAP_NOTINSYNC; sys_stratum = STRATUM_UNSPEC; sys_precision = (s_char)default_get_precision(); + sys_jitter = LOGTOD(sys_precision); sys_rootdelay = 0; sys_rootdispersion = 0; sys_refid = 0; L_CLR(&sys_reftime); - sys_peer = 0; + sys_peer = NULL; + sys_survivors = 0; get_systime(&dummy); sys_bclient = 0; sys_bdelay = DEFBROADDELAY; -#if defined(DES) || defined(MD5) sys_authenticate = 1; -#else - sys_authenticate = 0; -#endif L_CLR(&sys_authdelay); sys_authdly[0] = sys_authdly[1] = 0; sys_stattime = 0; @@ -2055,7 +2621,9 @@ init_proto(void) sys_processed = 0; sys_badauth = 0; sys_manycastserver = 0; +#ifdef AUTOKEY sys_automax = 1 << NTP_AUTOMAX; +#endif /* AUTOKEY */ /* * Default these to enable @@ -2064,11 +2632,12 @@ init_proto(void) #ifndef KERNEL_FLL_BUG kern_enable = 1; #endif - msyslog(LOG_DEBUG, "kern_enable is %d", kern_enable); + pps_enable = 0; stats_control = 1; /* - * Some system clocks should only be adjusted in 10ms increments. + * Some system clocks should only be adjusted in 10ms + * increments. */ #if defined RELIANTUNIX_CLOCK systime_10ms_ticks = 1; /* Reliant UNIX */ @@ -2174,6 +2743,24 @@ proto_config( sys_authenticate = (int)value; break; + case PROTO_PPS: + + /* + * Turn on/off PPS discipline + */ + pps_enable = (int)value; + break; + +#ifdef REFCLOCK + case PROTO_CAL: + + /* + * Turn on/off refclock calibrate + */ + cal_enable = (int)value; + break; +#endif + default: /* diff --git a/contrib/ntp/ntpd/ntp_refclock.c b/contrib/ntp/ntpd/ntp_refclock.c index c47031c..2205b6c 100644 --- a/contrib/ntp/ntpd/ntp_refclock.c +++ b/contrib/ntp/ntpd/ntp_refclock.c @@ -5,23 +5,25 @@ # include <config.h> #endif -#include <stdio.h> -#include <sys/types.h> -#ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -#endif /* HAVE_SYS_IOCTL_H */ - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" +#include "ntp_tty.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> + +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif /* HAVE_SYS_IOCTL_H */ + #ifdef REFCLOCK #ifdef TTYCLK # ifdef HAVE_SYS_CLKDEFS_H # include <sys/clkdefs.h> +# include <stropts.h> # endif # ifdef HAVE_SYS_SIO_H # include <sys/sio.h> @@ -32,15 +34,9 @@ #include <sys/ppsclock.h> #endif /* HAVE_PPSCLOCK_H */ -#ifdef HAVE_PPSAPI -# ifdef HAVE_TIMEPPS_H -# include <timepps.h> -# else -# ifdef HAVE_SYS_TIMEPPS_H -# include <sys/timepps.h> -# endif -# endif -#endif /* HAVE_PPSAPI */ +#ifdef KERNEL_PLL +#include "ntp_syscall.h" +#endif /* KERNEL_PLL */ /* * Reference clock support is provided here by maintaining the fiction @@ -72,24 +68,12 @@ * refclockproc structure pointer from the table typeunit[type][unit]. * This interface is strongly discouraged and may be abandoned in * future. - * - * The routines include support for the 1-pps signal provided by some - * radios and connected via a level converted described in the gadget - * directory. The signal is captured using a serial port and one of - * three STREAMS modules described in the refclock_atom.c file. For the - * highest precision, the signal is captured using the carrier-detect - * line of a serial port and either the ppsclock or ppsapi streams - * module or some devilish ioctl() folks keep slipping in as a patch. Be - * advised ALL support for other than the duly standardized ppsapi - * interface will eventually be withdrawn. */ #define MAXUNIT 4 /* max units */ +#define FUDGEFAC .1 /* fudge correction factor */ -#if defined(PPS) || defined(HAVE_PPSAPI) int fdpps; /* pps file descriptor */ -#endif /* PPS HAVE_PPSAPI */ - -#define FUDGEFAC .1 /* fudge correction factor */ +int cal_enable; /* enable refclock calibrate */ /* * Type/unit peer index. Used to find the peer structure for control and @@ -108,11 +92,6 @@ static int refclock_cmpl_fp P((const double *, const double *)); #endif /* QSORT_USES_VOID_P */ static int refclock_sample P((struct refclockproc *)); -#ifdef HAVE_PPSAPI -extern int pps_assert; /* capture edge 1:assert, 0:clear */ -extern int pps_hardpps; /* PPS kernel 1:on, 0:off */ -#endif /* HAVE_PPSAPI */ - /* * refclock_report - note the occurance of an event * @@ -222,7 +201,6 @@ refclock_newpeer( clktype); return (0); } - refclock_unpeer(peer); /* * Allocate and initialize interface structure @@ -247,14 +225,6 @@ refclock_newpeer( pp->timestarted = current_time; /* - * If the interface has been set to any_interface, set it to the - * loopback address if we have one. This is so that peers which - * are unreachable are easy to see in the peer display. - */ - if (peer->dstadr == any_interface && loopback_interface != 0) - peer->dstadr = loopback_interface; - - /* * Set peer.pmode based on the hmode. For appearances only. */ switch (peer->hmode) { @@ -273,7 +243,7 @@ refclock_newpeer( * can be wiggled, then finish up for consistency. */ if (!((refclock_conf[clktype]->clock_start)(unit, peer))) { - free(pp); + refclock_unpeer(peer); return (0); } peer->hpoll = peer->minpoll; @@ -354,25 +324,21 @@ refclock_transmit( * network code. */ oreach = peer->reach; - if (oreach & 0x01) - peer->valid++; - if (oreach & 0x80) - peer->valid--; - peer->reach <<= 1; - if (peer->reach == 0) { - if (oreach != 0) { + peer->reach <<= 1; + if (!peer->reach) { + if (oreach) { report_event(EVNT_UNREACH, peer); peer->timereachable = current_time; peer_clear(peer); } } else { - if ((oreach & 0x03) == 0) { + if (!(oreach & 0x03)) { clock_filter(peer, 0., 0., MAXDISPERSE); clock_select(); } - if (peer->valid <= 2) { + if (!(oreach & 0x0f)) { hpoll--; - } else if (peer->valid > NTP_SHIFT - 2) + } else if ((oreach & 0x0f) == 0x0f) hpoll++; if (peer->flags & FLAG_BURST) peer->burst = NSTAGE; @@ -383,7 +349,6 @@ refclock_transmit( if (refclock_conf[clktype]->clock_poll != noentry) (refclock_conf[clktype]->clock_poll)(unit, peer); peer->outdate = next; - poll_update(peer, hpoll); if (peer->burst > 0) peer->burst--; poll_update(peer, hpoll); @@ -428,7 +393,9 @@ refclock_cmpl_fp( /* * refclock_process_offset - update median filter * - * This routine uses the given offset and timestamps to construct a new entry in the median filter circular buffer. Samples that overflow the filter are quietly discarded. + * This routine uses the given offset and timestamps to construct a new + * entry in the median filter circular buffer. Samples that overflow the + * filter are quietly discarded. */ void refclock_process_offset( @@ -442,7 +409,6 @@ refclock_process_offset( pp->lastref = offset; pp->lastrec = lastrec; - pp->variance = 0; L_SUB(&offset, &lastrec); LFPTOD(&offset, doffset); SAMPLE(doffset + fudge); @@ -490,18 +456,18 @@ refclock_process( * * This routine implements a recursive median filter to suppress spikes * in the data, as well as determine a performance statistic. It - * calculates the mean offset and mean-square variance. A time - * adjustment fudgetime1 can be added to the final offset to compensate - * for various systematic errors. The routine returns the number of - * samples processed, which could be 0. + * calculates the mean offset and jitter (squares). A time adjustment + * fudgetime1 can be added to the final offset to compensate for various + * systematic errors. The routine returns the number of samples + * processed, which could be zero. */ static int refclock_sample( struct refclockproc *pp ) { - int i, j, k, n; - double offset, disp; + int i, j, k, m, n; + double offset; double off[MAXSTAGE]; /* @@ -514,15 +480,15 @@ refclock_sample( while (pp->codeproc != pp->coderecv) off[n++] = pp->filter[pp->codeproc++ % MAXSTAGE]; if (n > 1) - qsort((char *)off, n, sizeof(double), refclock_cmpl_fp); + qsort((char *)off, (size_t)n, sizeof(double), refclock_cmpl_fp); /* * Reject the furthest from the median of the samples until * approximately 60 percent of the samples remain. */ i = 0; j = n; - k = n - (n * 2) / NSTAGE; - while ((j - i) > k) { + m = n - (n * 2) / NSTAGE; + while ((j - i) > m) { offset = off[(j + i) / 2]; if (off[j - 1] - offset < offset - off[i]) i++; /* reject low end */ @@ -531,21 +497,21 @@ refclock_sample( } /* - * Determine the offset and variance. + * Determine the offset and jitter. */ - offset = disp = 0; - for (; i < j; i++) { - offset += off[i]; - disp += SQUARE(off[i]); - } - offset /= k; - pp->offset = offset; - pp->variance += disp / k - SQUARE(offset); + offset = 0; + for (k = i; k < j; k++) + offset += off[k]; + pp->offset = offset / m; + if (m > 1) + pp->jitter = SQUARE(off[i] - off[j - 1]); + else + pp->jitter = 0; #ifdef DEBUG if (debug) printf( - "refclock_sample: n %d offset %.6f disp %.6f std %.6f\n", - n, pp->offset, pp->disp, SQRT(pp->variance)); + "refclock_sample: n %d offset %.6f disp %.6f jitter %.6f\n", + n, pp->offset, pp->disp, SQRT(pp->jitter)); #endif return (n); } @@ -587,21 +553,29 @@ refclock_receive( refclock_report(peer, CEVNT_FAULT); return; } - if (peer->reach == 0) + if (!peer->reach) report_event(EVNT_REACH, peer); peer->reach |= 1; peer->reftime = peer->org = pp->lastrec; - peer->rootdispersion = pp->disp + SQRT(pp->variance); + peer->rootdispersion = pp->disp + SQRT(pp->jitter); get_systime(&peer->rec); if (!refclock_sample(pp)) return; - clock_filter(peer, pp->offset, 0., 0.); + clock_filter(peer, pp->offset, 0., pp->jitter); clock_select(); record_peer_stats(&peer->srcadr, ctlpeerstatus(peer), - peer->offset, peer->delay, CLOCK_PHI * (current_time - - peer->epoch), SQRT(peer->variance)); - if (pps_control && pp->sloppyclockflag & CLK_FLAG1) - pp->fudgetime1 -= pp->offset * FUDGEFAC; + peer->offset, peer->delay, clock_phi * (current_time - + peer->epoch), SQRT(peer->jitter)); + if (cal_enable && last_offset < MINDISPERSE) { +#ifdef KERNEL_PLL + if (peer != sys_peer || pll_status & STA_PPSTIME) +#else + if (peer != sys_peer) +#endif /* KERNEL_PLL */ + pp->fudgetime1 -= pp->offset * FUDGEFAC; + else + pp->fudgetime1 -= pp->fudgetime1 * FUDGEFAC; + } } /* @@ -619,21 +593,13 @@ refclock_gtlin( struct recvbuf *rbufp, /* receive buffer pointer */ char *lineptr, /* current line pointer */ int bmax, /* remaining characters in line */ - l_fp *tsptr /* pointer to timestamp returned */ + l_fp *tsptr /* pointer to timestamp returned */ ) { char *dpt, *dpend, *dp; int i; l_fp trtmp, tstmp; char c; -#ifdef TIOCDCDTIMESTAMP - struct timeval dcd_time; -#endif /* TIOCDCDTIMESTAMP */ -#ifdef HAVE_PPSAPI - pps_info_t pi; - struct timespec timeout, *tsp; - double a; -#endif /* HAVE_PPSAPI */ /* * Check for the presence of a timestamp left by the tty_clock @@ -646,58 +612,6 @@ refclock_gtlin( dpend = dpt + rbufp->recv_length; trtmp = rbufp->recv_time; -#ifdef HAVE_PPSAPI - timeout.tv_sec = 0; - timeout.tv_nsec = 0; - if ((rbufp->fd == fdpps) && - (time_pps_fetch(fdpps, PPS_TSFMT_TSPEC, &pi, &timeout) >= 0)) { - if(pps_assert) - tsp = &pi.assert_timestamp; - else - tsp = &pi.clear_timestamp; - a = tsp->tv_nsec; - a /= 1e9; - tstmp.l_uf = a * 4294967296.0; - tstmp.l_ui = tsp->tv_sec; - tstmp.l_ui += JAN_1970; - L_SUB(&trtmp, &tstmp); - if (trtmp.l_ui == 0) { -#ifdef DEBUG - if (debug > 1) { - printf( - "refclock_gtlin: fd %d time_pps_fetch %s", - fdpps, lfptoa(&tstmp, 6)); - printf(" sigio %s\n", lfptoa(&trtmp, 6)); - } -#endif - trtmp = tstmp; - goto gotit; - } else - trtmp = rbufp->recv_time; - } -#endif /* HAVE_PPSAPI */ -#ifdef TIOCDCDTIMESTAMP - if(ioctl(rbufp->fd, TIOCDCDTIMESTAMP, &dcd_time) != -1) { - TVTOTS(&dcd_time, &tstmp); - tstmp.l_ui += JAN_1970; - L_SUB(&trtmp, &tstmp); - if (trtmp.l_ui == 0) { -#ifdef DEBUG - if (debug > 1) { - printf( - "refclock_gtlin: fd %d DCDTIMESTAMP %s", - rbufp->fd, lfptoa(&tstmp, 6)); - printf(" sigio %s\n", lfptoa(&trtmp, 6)); - } -#endif - trtmp = tstmp; - goto gotit; - } else - trtmp = rbufp->recv_time; - } - else - /* XXX fallback to old method if kernel refuses TIOCDCDTIMESTAMP */ -#endif /* TIOCDCDTIMESTAMP */ if (dpend >= dpt + 8) { if (buftvtots(dpend - 8, &tstmp)) { L_SUB(&trtmp, &tstmp); @@ -719,9 +633,6 @@ refclock_gtlin( } } -#if defined(HAVE_PPSAPI) || defined(TIOCDCDTIMESTAMP) -gotit: -#endif /* * Edit timecode to remove control chars. Don't monkey with the * line buffer if the input buffer contains no ASCII printing @@ -767,36 +678,42 @@ refclock_open( { int fd, i; int flags; -#ifdef HAVE_TERMIOS - struct termios ttyb, *ttyp; -#endif /* HAVE_TERMIOS */ -#ifdef HAVE_SYSV_TTYS - struct termio ttyb, *ttyp; -#endif /* HAVE_SYSV_TTYS */ -#ifdef HAVE_BSD_TTYS - struct sgttyb ttyb, *ttyp; -#endif /* HAVE_BSD_TTYS */ + TTY ttyb, *ttyp; #ifdef TIOCMGET u_long ltemp; #endif /* TIOCMGET */ + int omode; /* * Open serial port and set default options */ flags = lflags; - if (strcmp(dev, pps_device) == 0) - flags |= LDISC_PPS; + + omode = O_RDWR; #ifdef O_NONBLOCK - fd = open(dev, O_RDWR | O_NONBLOCK, 0777); -#else - fd = open(dev, O_RDWR, 0777); -#endif /* O_NONBLOCK */ - if (fd == -1) { + omode |= O_NONBLOCK; +#endif +#ifdef O_NOCTTY + omode |= O_NOCTTY; +#endif + + fd = open(dev, omode, 0777); + + if (fd < 0) { msyslog(LOG_ERR, "refclock_open: %s: %m", dev); return (0); } /* + * This little jewel lights up the PPS file descriptor if the + * device name matches the name in the pps line in the + * configuration file. This is so the atom driver can glom onto + * the right device. Very silly. + */ + if (strcmp(dev, pps_device) == 0) + fdpps = fd; + + /* * The following sections initialize the serial line port in * canonical (line-oriented) mode and set the specified line * speed, 8 bits and no parity. The modem control, break, erase @@ -958,9 +875,8 @@ refclock_open( * This routine attempts to hide the internal, system-specific details * of serial ports. It can handle POSIX (termios), SYSV (termio) and BSD * (sgtty) interfaces with varying degrees of success. The routine sets - * up optional features such as tty_clk, ppsclock and ppsapi, as well as - * their many other variants. The routine returns 1 if success and 0 if - * failure. + * up optional features such as tty_clk. The routine returns 1 if + * success and 0 if failure. */ int refclock_ioctl( @@ -973,45 +889,13 @@ refclock_ioctl( #if defined(HAVE_TERMIOS) || defined(HAVE_SYSV_TTYS) || defined(HAVE_BSD_TTYS) #ifdef TTYCLK -#ifdef HAVE_TERMIOS - struct termios ttyb, *ttyp; -#endif /* HAVE_TERMIOS */ -#ifdef HAVE_SYSV_TTYS - struct termio ttyb, *ttyp; -#endif /* HAVE_SYSV_TTYS */ -#ifdef HAVE_BSD_TTYS - struct sgttyb ttyb, *ttyp; -#endif /* HAVE_BSD_TTYS */ + TTY ttyb, *ttyp; #endif /* TTYCLK */ #ifdef DEBUG if (debug) printf("refclock_ioctl: fd %d flags 0x%x\n", fd, flags); #endif - - /* - * The following sections select optional features, such as - * modem control, PPS capture and so forth. Some require - * specific operating system support in the form of STREAMS - * modules, which can be loaded and unloaded at run time without - * rebooting the kernel. The STREAMS modules require System - * V STREAMS support. The checking frenzy is attenuated here, - * since the device is already open. - * - * Note that the tty_clk and ppsclock modules are optional; if - * configured and unavailable, the dang thing still works, but - * the accuracy improvement using them will not be available. - * The only known implmentations of these moldules are specific - * to SunOS 4.x. Use the ppsclock module ONLY with Sun baseboard - * ttya or ttyb. Using it with the SPIF multipexor crashes the - * kernel. - * - * The preferred way to capture PPS timestamps is using the - * ppsapi interface, which is machine independent. The SunOS 4.x - * and Digital Unix 4.x interfaces use STREAMS modules and - * support both the ppsapi specification and ppsclock - * functionality, but other systems may vary widely. - */ if (flags == 0) return (1); #if !(defined(HAVE_TERMIOS) || defined(HAVE_BSD_TTYS)) @@ -1061,104 +945,6 @@ refclock_ioctl( } } #endif /* TTYCLK */ - -#if defined(PPS) && !defined(HAVE_PPSAPI) - /* - * The PPS option provides timestamping at the driver level. - * It uses a 1-pps signal and level converter (gadget box) and - * requires the ppsclock streams module and System V STREAMS - * support. This option has been superseded by the ppsapi - * option and may be withdrawn in future. - */ - if (flags & LDISC_PPS) { - int rval = 0; -#ifdef HAVE_TIOCSPPS /* Solaris */ - int one = 1; -#endif /* HAVE_TIOCSPPS */ - - if (fdpps > 0) { - msyslog(LOG_ERR, - "refclock_ioctl: PPS already configured"); - return (0); - } -#ifdef HAVE_TIOCSPPS /* Solaris */ - if (ioctl(fd, TIOCSPPS, &one) < 0) { - msyslog(LOG_NOTICE, - "refclock_ioctl: TIOCSPPS failed: %m"); - return (0); - } - if (debug) - printf("refclock_ioctl: fd %d TIOCSPPS %d\n", - fd, rval); -#else - if (ioctl(fd, I_PUSH, "ppsclock") < 0) { - msyslog(LOG_NOTICE, - "refclock_ioctl: I_PUSH ppsclock failed: %m"); - return (0); - } - if (debug) - printf("refclock_ioctl: fd %d ppsclock %d\n", - fd, rval); -#endif /* not HAVE_TIOCSPPS */ - fdpps = fd; - } -#endif /* PPS HAVE_PPSAPI */ - -#ifdef HAVE_PPSAPI - /* - * The PPSAPI option provides timestamping at the driver level. - * It uses a 1-pps signal and level converter (gadget box) and - * requires ppsapi compiled into the kernel on non STREAMS - * systems. This is the preferred way to capture PPS timestamps - * and is expected to become an IETF cross-platform standard. - */ - if (flags & (LDISC_PPS | LDISC_CLKPPS)) { - pps_params_t pp; - int mode, temp; - pps_handle_t handle; - - memset((char *)&pp, 0, sizeof(pp)); - if (fdpps > 0) { - msyslog(LOG_ERR, - "refclock_ioctl: ppsapi already configured"); - return (0); - } - if (time_pps_create(fd, &handle) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_create failed: %m"); - return (0); - } - if (time_pps_getcap(handle, &mode) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_getcap failed: %m"); - return (0); - } - pp.mode = mode & PPS_CAPTUREBOTH; - if (time_pps_setparams(handle, &pp) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_setparams failed: %m"); - return (0); - } - if (!pps_hardpps) - temp = 0; - else if (pps_assert) - temp = mode & PPS_CAPTUREASSERT; - else - temp = mode & PPS_CAPTURECLEAR; - if (time_pps_kcbind(handle, PPS_KC_HARDPPS, temp, - PPS_TSFMT_TSPEC) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_kcbind failed: %m"); - return (0); - } - (void)time_pps_getparams(handle, &pp); - fdpps = (int)handle; - if (debug) - printf( - "refclock_ioctl: fd %d ppsapi vers %d mode 0x%x cap 0x%x\n", - fdpps, pp.api_version, pp.mode, mode); - } -#endif /* HAVE_PPSAPI */ #endif /* HAVE_TERMIOS || HAVE_SYSV_TTYS || HAVE_BSD_TTYS */ #endif /* SYS_VXWORKS SYS_WINNT */ return (1); @@ -1196,6 +982,8 @@ refclock_control( return; if (!(peer = typeunit[clktype][unit])) return; + if (peer->procptr == NULL) + return; pp = peer->procptr; /* diff --git a/contrib/ntp/ntpd/ntp_request.c b/contrib/ntp/ntpd/ntp_request.c index 3743118..6f5e153 100644 --- a/contrib/ntp/ntpd/ntp_request.c +++ b/contrib/ntp/ntpd/ntp_request.c @@ -2,14 +2,9 @@ * ntp_request.c - respond to information requests */ #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#include <sys/types.h> -#include <stdio.h> -#include <signal.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_request.h" @@ -17,6 +12,12 @@ #include "ntp_refclock.h" #include "ntp_if.h" #include "ntp_stdlib.h" + +#include <stdio.h> +#include <signal.h> +#include <netinet/in.h> +#include <arpa/inet.h> + #include "recvbuff.h" #ifdef KERNEL_PLL @@ -60,6 +61,7 @@ static void mem_stats P((struct sockaddr_in *, struct interface *, struct req_pk static void io_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void timer_stats P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void loop_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); +static void dns_a P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void do_conf P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void do_unconf P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void set_sys_flag P((struct sockaddr_in *, struct interface *, struct req_pkt *)); @@ -77,7 +79,7 @@ static void reset_peer P((struct sockaddr_in *, struct interface *, struct req_p static void do_key_reread P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void trust_key P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void untrust_key P((struct sockaddr_in *, struct interface *, struct req_pkt *)); -static void do_trustkey P((struct sockaddr_in *, struct interface *, struct req_pkt *, int)); +static void do_trustkey P((struct sockaddr_in *, struct interface *, struct req_pkt *, u_long)); static void get_auth_info P((struct sockaddr_in *, struct interface *, struct req_pkt *)); static void reset_auth_stats P((void)); static void req_get_traps P((struct sockaddr_in *, struct interface *, struct req_pkt *)); @@ -112,6 +114,7 @@ static struct req_proc ntp_codes[] = { { REQ_MEM_STATS, NOAUTH, 0, mem_stats }, { REQ_LOOP_INFO, NOAUTH, 0, loop_info }, { REQ_TIMER_STATS, NOAUTH, 0, timer_stats }, + { REQ_HOSTNAME_ASSOCID, AUTH, sizeof(struct info_dns_assoc), dns_a }, { REQ_CONFIG, AUTH, sizeof(struct conf_peer), do_conf }, { REQ_UNCONFIG, AUTH, sizeof(struct conf_unpeer), do_unconf }, { REQ_SET_SYS_FLAG, AUTH, sizeof(struct conf_sys_flags), set_sys_flag }, @@ -150,7 +153,7 @@ static struct req_proc ntp_codes[] = { * Authentication keyid used to authenticate requests. Zero means we * don't allow writing anything. */ -u_long info_auth_keyid; +keyid_t info_auth_keyid; /* * Statistic counters to keep track of requests and responses. @@ -379,6 +382,7 @@ process_private( struct sockaddr_in *srcadr; struct interface *inter; struct req_proc *proc; + int ec; /* * Initialize pointers, for convenience @@ -389,7 +393,7 @@ process_private( #ifdef DEBUG if (debug > 2) - printf("prepare_pkt: impl %d req %d\n", + printf("process_private: impl %d req %d\n", inpkt->implementation, inpkt->request); #endif @@ -397,15 +401,18 @@ process_private( * Do some sanity checks on the packet. Return a format * error if it fails. */ - if (ISRESPONSE(inpkt->rm_vn_mode) - || ISMORE(inpkt->rm_vn_mode) - || INFO_VERSION(inpkt->rm_vn_mode) > NTP_VERSION - || INFO_VERSION(inpkt->rm_vn_mode) < NTP_OLDVERSION - || INFO_SEQ(inpkt->auth_seq) != 0 - || INFO_ERR(inpkt->err_nitems) != 0 - || INFO_MBZ(inpkt->mbz_itemsize) != 0 - || rbufp->recv_length > REQ_LEN_MAC - || rbufp->recv_length < REQ_LEN_NOMAC) { + ec = 0; + if ( (++ec, ISRESPONSE(inpkt->rm_vn_mode)) + || (++ec, ISMORE(inpkt->rm_vn_mode)) + || (++ec, INFO_VERSION(inpkt->rm_vn_mode) > NTP_VERSION) + || (++ec, INFO_VERSION(inpkt->rm_vn_mode) < NTP_OLDVERSION) + || (++ec, INFO_SEQ(inpkt->auth_seq) != 0) + || (++ec, INFO_ERR(inpkt->err_nitems) != 0) + || (++ec, INFO_MBZ(inpkt->mbz_itemsize) != 0) + || (++ec, rbufp->recv_length > REQ_LEN_MAC) + || (++ec, rbufp->recv_length < REQ_LEN_NOMAC) + ) { + msyslog(LOG_ERR, "process_private: INFO_ERR_FMT: test %d failed", ec); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -424,7 +431,6 @@ process_private( return; } - /* * Search the list for the request codes. If it isn't one * we know, return an error. @@ -478,6 +484,8 @@ process_private( printf("bad pkt length %d\n", rbufp->recv_length); #endif + msyslog(LOG_ERR, "process_private: bad pkt length %d", + rbufp->recv_length); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -520,16 +528,21 @@ process_private( * don't, check to see that there is none (picky, picky). */ if (INFO_ITEMSIZE(inpkt->mbz_itemsize) != proc->sizeofitem) { + msyslog(LOG_ERR, "INFO_ITEMSIZE(inpkt->mbz_itemsize) != proc->sizeofitem: %d != %d", + INFO_ITEMSIZE(inpkt->mbz_itemsize), proc->sizeofitem); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } if (proc->sizeofitem != 0) if (proc->sizeofitem*INFO_NITEMS(inpkt->err_nitems) > sizeof(inpkt->data)) { + msyslog(LOG_ERR, "sizeofitem(%d)*NITEMS(%d) > data: %d > %ld", + proc->sizeofitem, INFO_NITEMS(inpkt->err_nitems), + proc->sizeofitem*INFO_NITEMS(inpkt->err_nitems), + (long)sizeof(inpkt->data)); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } - #ifdef DEBUG if (debug > 3) printf("process_private: all okay, into handler\n"); @@ -610,14 +623,16 @@ peer_list_sum( if (debug > 3) printf("sum: got one\n"); #endif - ips->dstadr = (pp->processed) ? - pp->cast_flags == MDF_BCAST ? - pp->dstadr->bcast.sin_addr.s_addr: - pp->cast_flags ? - pp->dstadr->sin.sin_addr.s_addr ? - pp->dstadr->sin.sin_addr.s_addr: - pp->dstadr->bcast.sin_addr.s_addr: - 1 : 5; + ips->dstadr = + (pp->processed) + ? pp->cast_flags == MDF_BCAST + ? pp->dstadr->bcast.sin_addr.s_addr + : pp->cast_flags + ? pp->dstadr->sin.sin_addr.s_addr + ? pp->dstadr->sin.sin_addr.s_addr + : pp->dstadr->bcast.sin_addr.s_addr + : 1 + : 5; ips->srcadr = pp->srcadr.sin_addr.s_addr; ips->srcport = pp->srcadr.sin_port; ips->stratum = pp->stratum; @@ -686,14 +701,16 @@ peer_info ( ipl++; if ((pp = findexistingpeer(&addr, (struct peer *)0, -1)) == 0) continue; - ip->dstadr = (pp->processed) ? - pp->cast_flags == MDF_BCAST ? - pp->dstadr->bcast.sin_addr.s_addr: - pp->cast_flags ? - pp->dstadr->sin.sin_addr.s_addr ? - pp->dstadr->sin.sin_addr.s_addr: - pp->dstadr->bcast.sin_addr.s_addr: - 2 : 6; + ip->dstadr = + (pp->processed) + ? pp->cast_flags == MDF_BCAST + ? pp->dstadr->bcast.sin_addr.s_addr + : pp->cast_flags + ? pp->dstadr->sin.sin_addr.s_addr + ? pp->dstadr->sin.sin_addr.s_addr + : pp->dstadr->bcast.sin_addr.s_addr + : 2 + : 6; ip->srcadr = NSRCADR(&pp->srcadr); ip->srcport = NSRCPORT(&pp->srcadr); ip->flags = 0; @@ -721,7 +738,6 @@ peer_info ( ip->hpoll = pp->hpoll; ip->precision = pp->precision; ip->version = pp->version; - ip->valid = pp->valid; ip->reach = pp->reach; ip->unreach = pp->unreach; ip->flash = (u_char)pp->flash; @@ -752,7 +768,7 @@ peer_info ( HTONL_FP(<mp, &ip->offset); ip->delay = HTONS_FP(DTOFP(pp->delay)); ip->dispersion = HTONS_FP(DTOUFP(SQRT(pp->disp))); - ip->selectdisp = HTONS_FP(DTOUFP(SQRT(pp->variance))); + ip->selectdisp = HTONS_FP(DTOUFP(SQRT(pp->jitter))); ip = (struct info_peer *)more_pkt(); } flush_pkt(); @@ -788,14 +804,16 @@ peer_stats ( ipl++; if ((pp = findexistingpeer(&addr, (struct peer *)0, -1)) == 0) continue; - ip->dstadr = (pp->processed) ? - pp->cast_flags == MDF_BCAST ? - pp->dstadr->bcast.sin_addr.s_addr: - pp->cast_flags ? - pp->dstadr->sin.sin_addr.s_addr ? - pp->dstadr->sin.sin_addr.s_addr: - pp->dstadr->bcast.sin_addr.s_addr: - 3 : 7; + ip->dstadr = + (pp->processed) + ? pp->cast_flags == MDF_BCAST + ? pp->dstadr->bcast.sin_addr.s_addr + : pp->cast_flags + ? pp->dstadr->sin.sin_addr.s_addr + ? pp->dstadr->sin.sin_addr.s_addr + : pp->dstadr->bcast.sin_addr.s_addr + : 3 + : 7; ip->srcadr = NSRCADR(&pp->srcadr); ip->srcport = NSRCPORT(&pp->srcadr); ip->flags = 0; @@ -860,7 +878,7 @@ sys_info( extern double sys_bdelay; extern l_fp sys_authdelay; extern double clock_stability; - extern double sys_error; + extern double sys_jitter; is = (struct info_sys *)prepare_pkt(srcadr, inter, inpkt, sizeof(struct info_sys)); @@ -877,7 +895,7 @@ sys_info( is->precision = sys_precision; is->rootdelay = htonl(DTOFP(sys_rootdelay)); is->rootdispersion = htonl(DTOUFP(sys_rootdispersion)); - is->frequency = htonl(DTOFP(sys_error)); + is->frequency = htonl(DTOFP(sys_jitter)); is->stability = htonl(DTOUFP(clock_stability * 1e6)); is->refid = sys_refid; HTONL_FP(&sys_reftime, &is->reftime); @@ -1114,10 +1132,10 @@ do_conf( struct req_pkt *inpkt ) { + u_int fl; register struct conf_peer *cp; register int items; struct sockaddr_in peeraddr; - int fl; /* * Do a check of everything to see that it looks @@ -1136,13 +1154,15 @@ do_conf( && cp->hmode != MODE_CLIENT && cp->hmode != MODE_BROADCAST) fl = 1; - if (cp->flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER - | CONF_FLAG_NOSELECT | CONF_FLAG_BURST | CONF_FLAG_SKEY)) + if (cp->flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER | + CONF_FLAG_NOSELECT | CONF_FLAG_BURST | CONF_FLAG_IBURST | + CONF_FLAG_SKEY)) fl = 1; cp++; } if (fl) { + msyslog(LOG_ERR, "do_conf: fl is nonzero!"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1164,6 +1184,11 @@ do_conf( !ISREFCLOCKADR(&peeraddr) && #endif ISBADADR(&peeraddr)) { +#ifdef REFCLOCK + msyslog(LOG_ERR, "do_conf: !ISREFCLOCK && ISBADADR"); +#else + msyslog(LOG_ERR, "do_conf: ISBADADR"); +#endif req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1171,20 +1196,22 @@ do_conf( while (items-- > 0) { fl = 0; if (cp->flags & CONF_FLAG_AUTHENABLE) - fl |= FLAG_AUTHENABLE; + fl |= FLAG_AUTHENABLE; if (cp->flags & CONF_FLAG_PREFER) - fl |= FLAG_PREFER; + fl |= FLAG_PREFER; if (cp->flags & CONF_FLAG_NOSELECT) - fl |= FLAG_NOSELECT; + fl |= FLAG_NOSELECT; if (cp->flags & CONF_FLAG_BURST) - fl |= FLAG_BURST; + fl |= FLAG_BURST; + if (cp->flags & CONF_FLAG_IBURST) + fl |= FLAG_IBURST; if (cp->flags & CONF_FLAG_SKEY) fl |= FLAG_SKEY; peeraddr.sin_addr.s_addr = cp->peeraddr; /* XXX W2DO? minpoll/maxpoll arguments ??? */ - if (peer_config(&peeraddr, (struct interface *)0, - cp->hmode, cp->version, cp->minpoll, cp->maxpoll, - fl, cp->ttl, cp->keyid) == 0) { + if (peer_config(&peeraddr, any_interface, cp->hmode, + cp->version, cp->minpoll, cp->maxpoll, fl, cp->ttl, + cp->keyid, cp->keystr) == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } @@ -1196,6 +1223,100 @@ do_conf( /* + * dns_a - Snarf DNS info for an association ID + */ +static void +dns_a( + struct sockaddr_in *srcadr, + struct interface *inter, + struct req_pkt *inpkt + ) +{ + register struct info_dns_assoc *dp; + register int items; + struct sockaddr_in peeraddr; + + /* + * Do a check of everything to see that it looks + * okay. If not, complain about it. Note we are + * very picky here. + */ + items = INFO_NITEMS(inpkt->err_nitems); + dp = (struct info_dns_assoc *)inpkt->data; + + /* + * Looks okay, try it out + */ + items = INFO_NITEMS(inpkt->err_nitems); + dp = (struct info_dns_assoc *)inpkt->data; + memset((char *)&peeraddr, 0, sizeof(struct sockaddr_in)); + peeraddr.sin_family = AF_INET; + peeraddr.sin_port = htons(NTP_PORT); + + /* + * Make sure the address is valid + */ + if ( +#ifdef REFCLOCK + !ISREFCLOCKADR(&peeraddr) && +#endif + ISBADADR(&peeraddr)) { +#ifdef REFCLOCK + msyslog(LOG_ERR, "dns_a: !ISREFCLOCK && ISBADADR"); +#else + msyslog(LOG_ERR, "dns_a: ISBADADR"); +#endif + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + return; + } + + while (items-- > 0) { + associd_t associd; + size_t hnl; + struct peer *peer; + int bogon = 0; + + associd = dp->associd; + peer = findpeerbyassoc(associd); + if (peer == 0 || peer->flags & FLAG_REFCLOCK) { + msyslog(LOG_ERR, "dns_a: %s", + (peer == 0) + ? "peer == 0" + : "peer->flags & FLAG_REFCLOCK"); + ++bogon; + } + peeraddr.sin_addr.s_addr = dp->peeraddr; + for (hnl = 0; dp->hostname[hnl] && hnl < sizeof dp->hostname; ++hnl) ; + if (hnl >= sizeof dp->hostname) { + msyslog(LOG_ERR, "dns_a: hnl (%ld) >= %ld", + (long)hnl, (long)sizeof dp->hostname); + ++bogon; + } + + msyslog(LOG_INFO, "dns_a: <%s> for %s, AssocID %d, bogon %d", + dp->hostname, inet_ntoa(peeraddr.sin_addr), associd, + bogon); + + if (bogon) { + /* If it didn't work */ + req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); + return; + } else { +#if 0 +#ifdef PUBKEY + crypto_public(peer, dp->hostname); +#endif /* PUBKEY */ +#endif + } + + dp++; + } + + req_ack(srcadr, inter, inpkt, INFO_OKAY); +} + + +/* * do_unconf - remove a peer from the configuration list */ static void @@ -1300,26 +1421,31 @@ setclr_flags( u_long set ) { - register u_long flags; + register u_int flags; if (INFO_NITEMS(inpkt->err_nitems) > 1) { + msyslog(LOG_ERR, "setclr_flags: err_nitems > 1"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } flags = ((struct conf_sys_flags *)inpkt->data)->flags; - if (flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_AUTHENTICATE | + if (flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_PPS | SYS_FLAG_NTP | SYS_FLAG_KERNEL | SYS_FLAG_MONITOR | SYS_FLAG_FILEGEN)) { + msyslog(LOG_ERR, "setclr_flags: extra flags: %#x", + flags & ~(SYS_FLAG_BCLIENT | SYS_FLAG_PPS | + SYS_FLAG_NTP | SYS_FLAG_KERNEL | + SYS_FLAG_MONITOR | SYS_FLAG_FILEGEN)); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } if (flags & SYS_FLAG_BCLIENT) proto_config(PROTO_BROADCLIENT, set, 0.); - if (flags & SYS_FLAG_AUTHENTICATE) - proto_config(PROTO_AUTHENTICATE, set, 0.); + if (flags & SYS_FLAG_PPS) + proto_config(PROTO_PPS, set, 0.); if (flags & SYS_FLAG_NTP) proto_config(PROTO_NTP, set, 0.); if (flags & SYS_FLAG_KERNEL) @@ -1440,15 +1566,16 @@ do_restrict( bad = 0; while (items-- > 0 && !bad) { if (cr->mflags & ~(RESM_NTPONLY)) - bad = 1; + bad |= 1; if (cr->flags & ~(RES_ALLFLAGS)) - bad = 1; + bad |= 2; if (cr->addr == htonl(INADDR_ANY) && cr->mask != htonl(INADDR_ANY)) - bad = 1; + bad |= 4; cr++; } if (bad) { + msyslog(LOG_ERR, "do_restrict: bad = %#x", bad); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1606,6 +1733,7 @@ reset_stats( struct reset_entry *rent; if (INFO_NITEMS(inpkt->err_nitems) > 1) { + msyslog(LOG_ERR, "reset_stats: err_nitems > 1"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1613,6 +1741,8 @@ reset_stats( flags = ((struct reset_flags *)inpkt->data)->flags; if (flags & ~RESET_ALLFLAGS) { + msyslog(LOG_ERR, "reset_stats: reset leaves %#lx", + flags & ~RESET_ALLFLAGS); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1736,7 +1866,7 @@ do_trustkey( struct sockaddr_in *srcadr, struct interface *inter, struct req_pkt *inpkt, - int trust + u_long trust ) { register u_long *kp; @@ -1928,6 +2058,7 @@ do_setclr_trap( * the error reporting problem. */ if (INFO_NITEMS(inpkt->err_nitems) > 1) { + msyslog(LOG_ERR, "do_setclr_trap: err_nitems > 1"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1980,12 +2111,13 @@ set_request_keyid( struct req_pkt *inpkt ) { - u_long keyid; + keyid_t keyid; /* * Restrict ourselves to one item only. */ if (INFO_NITEMS(inpkt->err_nitems) > 1) { + msyslog(LOG_ERR, "set_request_keyid: err_nitems > 1"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -2007,13 +2139,14 @@ set_control_keyid( struct req_pkt *inpkt ) { - u_long keyid; - extern u_long ctl_auth_keyid; + keyid_t keyid; + extern keyid_t ctl_auth_keyid; /* * Restrict ourselves to one item only. */ if (INFO_NITEMS(inpkt->err_nitems) > 1) { + msyslog(LOG_ERR, "set_control_keyid: err_nitems > 1"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -2256,6 +2389,7 @@ set_clock_fudge( (CLK_HAVEFLAG1|CLK_HAVEFLAG2|CLK_HAVEFLAG3|CLK_HAVEFLAG4); break; default: + msyslog(LOG_ERR, "set_clock_fudge: default!"); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } diff --git a/contrib/ntp/ntpd/ntp_resolver.c b/contrib/ntp/ntpd/ntp_resolver.c new file mode 100644 index 0000000..84b2583 --- /dev/null +++ b/contrib/ntp/ntpd/ntp_resolver.c @@ -0,0 +1,987 @@ +/* +** Ancestor was ripped off from ../ntpres/ntpres.c by Greg Troxel 4/2/92 +** +** The previous resolver only needed to do forward lookups, and all names +** were known before we started the resolver process. +** +** The new code must be able to handle reverse lookups, and the requests can +** show up at any time. +** +** Here's the drill for the new logic. +** +** We want to be able to do forward or reverse lookups. Forward lookups +** require one set of information to be sent back to the daemon, reverse +** lookups require a different set of information. The caller knows this. +** +** The daemon must not block. This includes communicating with the resolver +** process (if the resolver process is a separate task). +** +** Current resolver code blocks waiting for the response, so the +** alternatives are: +** +** - Find a nonblocking resolver library +** - Do each (initial) lookup in a separate process +** - - subsequent lookups *could* be handled by a different process that has +** a queue of pending requests +** +** We could use nonblocking lookups in a separate process (just to help out +** with timers). +** +** If we don't have nonblocking resolver calls we have more opportunities +** for denial-of-service problems. +** +** - too many fork()s +** - communications path +** +*/ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_request.h" +#include "ntp_stdlib.h" +#include "ntp_syslog.h" + +#include <stdio.h> +#include <ctype.h> +#include <netdb.h> +#include <signal.h> + +#include <netinet/in.h> +#include <arpa/inet.h> + +#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) + +/* + * Each item we are to resolve and configure gets one of these + * structures defined for it. + */ +struct dns_entry { + int de_done; +#define DE_NAME 001 +#define DE_ADDR 002 +#define DE_NA (DE_NAME | DE_ADDR) +#define DE_PENDING 000 +#define DE_GOT 010 +#define DE_FAIL 020 +#define DE_RESULT (DE_PENDING | DE_GOT | DE_FAIL) + struct dns_entry *de_next; + struct info_dns_assoc de_info; /* DNS info for peer */ +}; +#define de_associd de_info.associd +#define de_peeraddr de_info.peeraddr +#define de_hostname de_info.hostname + +/* + * dns_entries is a pointer to the list of configuration entries + * we have left to do. + */ +static struct dns_entry *dns_entries = NULL; + +/* + * We take an interrupt every thirty seconds, at which time we decrement + * config_timer and resolve_timer. The former is set to 2, so we retry + * unsucessful reconfigurations every minute. The latter is set to + * an exponentially increasing value which starts at 2 and increases to + * 32. When this expires we retry failed name resolutions. + * + * We sleep SLEEPTIME seconds before doing anything, to give the server + * time to arrange itself. + */ +#define MINRESOLVE 2 +#define MAXRESOLVE 32 +#define CONFIG_TIME 2 +#define ALARM_TIME 30 + +#define SLEEPTIME 2 + +static volatile int config_timer = 0; +static volatile int resolve_timer = 0; + +static int resolve_value; /* next value of resolve timer */ + +/* + * Big hack attack + */ +#define LOCALHOST 0x7f000001 /* 127.0.0.1, in hex, of course */ +#define SKEWTIME 0x08000000 /* 0.03125 seconds as a l_fp fraction */ + +/* + * Select time out. Set to 2 seconds. The server is on the local machine, + * after all. + */ +#define TIMEOUT_SEC 2 +#define TIMEOUT_USEC 0 + +/* + * File descriptor for ntp request code. + */ +static int sockfd = -1; + +/* + * Pipe descriptors + */ +int p_fd[2] = { -1, -1 }; + +/* stuff to be filled in by caller */ + +extern keyid_t req_keyid; /* request keyid */ + +/* end stuff to be filled in */ + +void ntp_res P((void)); +static RETSIGTYPE bong P((int)); +static void checkparent P((void)); +static void removeentry P((struct dns_entry *)); +static void addentry P((char *, u_int32, u_short)); +static void findhostaddr P((struct dns_entry *)); +static void openntp P((void)); +static int tell_ntpd P((struct info_dns_assoc *)); +static void doconfigure P((int)); + +struct ntp_res_t_pkt { /* Tagged packet: */ + void *tag; /* For the caller */ + u_int32 paddr; /* IP to look up, or 0 */ + char name[NTP_MAXHOSTNAME]; /* Name to look up (if 1st byte is not 0) */ +}; + +struct ntp_res_c_pkt { /* Control packet: */ + char name[NTP_MAXHOSTNAME]; + u_int32 paddr; + int mode; + int version; + int minpoll; + int maxpoll; + int flags; + int ttl; + keyid_t keyid; + u_char keystr[MAXFILENAME]; +}; + +/* + * ntp_res_name + */ + +void +ntp_res_name( + u_int32 paddr, /* Address to resolve */ + u_short associd /* Association ID */ + ) +{ + pid_t pid; + + /* + * fork. + * - parent returns + * - child stuffs data and calls ntp_res() + */ + + for (pid = -1; pid == -1;) { +#ifdef RES_TEST + pid = 0; +#else + pid = fork(); +#endif + if (pid == -1) { + msyslog(LOG_ERR, "ntp_res_name: fork() failed: %m"); + sleep(2); + } + } + switch (pid) { + case -1: /* Error */ + msyslog(LOG_INFO, "ntp_res_name: error..."); + /* Can't happen */ + break; + + case 0: /* Child */ + closelog(); + kill_asyncio(); + (void) signal_no_reset(SIGCHLD, SIG_DFL); +#ifndef LOG_DAEMON + openlog("ntp_res", LOG_PID); +# else /* LOG_DAEMON */ +# ifndef LOG_NTP +# define LOG_NTP LOG_DAEMON +# endif + openlog("ntp_res_name", LOG_PID | LOG_NDELAY, LOG_NTP); +#endif + + addentry(NULL, paddr, associd); + ntp_res(); + break; + + default: /* Parent */ + /* Nothing to do. (In Real Life, this never happens.) */ + return; + } +} + +/* + * ntp_res needs; + * + * req_key(???), req_keyid valid + * syslog still open + */ + +void +ntp_res(void) +{ +#ifdef HAVE_SIGSUSPEND + sigset_t set; + + sigemptyset(&set); +#endif /* HAVE_SIGSUSPEND */ + +#ifdef DEBUG + if (debug) { + msyslog(LOG_INFO, "NTP_RESOLVER running"); + } +#endif + + /* check out auth stuff */ + if (sys_authenticate) { + if (!authistrusted(req_keyid)) { + msyslog(LOG_ERR, "invalid request keyid %08x", + req_keyid ); + exit(1); + } + } + + /* + * Make a first cut at resolving the bunch + */ + doconfigure(1); + if (dns_entries == NULL) { + if (debug) { + msyslog(LOG_INFO, "NTP_RESOLVER done!"); + } +#if defined SYS_WINNT + ExitThread(0); /* Don't want to kill whole NT process */ +#else + exit(0); /* done that quick */ +#endif + } + + /* + * Here we've got some problem children. Set up the timer + * and wait for it. + */ + resolve_value = resolve_timer = MINRESOLVE; + config_timer = CONFIG_TIME; +#ifndef SYS_WINNT + (void) signal_no_reset(SIGALRM, bong); + alarm(ALARM_TIME); +#endif /* SYS_WINNT */ + + for (;;) { + if (dns_entries == NULL) + exit(0); + + checkparent(); + + if (resolve_timer == 0) { + if (resolve_value < MAXRESOLVE) + resolve_value <<= 1; + resolve_timer = resolve_value; +#ifdef DEBUG + msyslog(LOG_INFO, "resolve_timer: 0->%d", resolve_timer); +#endif + config_timer = CONFIG_TIME; + doconfigure(1); + continue; + } else if (config_timer == 0) { + config_timer = CONFIG_TIME; +#ifdef DEBUG + msyslog(LOG_INFO, "config_timer: 0->%d", config_timer); +#endif + doconfigure(0); + continue; + } +#ifndef SYS_WINNT + /* + * There is a race in here. Is okay, though, since + * all it does is delay things by 30 seconds. + */ +# ifdef HAVE_SIGSUSPEND + sigsuspend(&set); +# else + sigpause(0); +# endif /* HAVE_SIGSUSPEND */ +#else + if (config_timer > 0) + config_timer--; + if (resolve_timer > 0) + resolve_timer--; + sleep(ALARM_TIME); +#endif /* SYS_WINNT */ + } +} + + +#ifndef SYS_WINNT +/* + * bong - service and reschedule an alarm() interrupt + */ +static RETSIGTYPE +bong( + int sig + ) +{ + if (config_timer > 0) + config_timer--; + if (resolve_timer > 0) + resolve_timer--; + alarm(ALARM_TIME); +} +#endif /* SYS_WINNT */ + +/* + * checkparent - see if our parent process is still running + * + * No need to worry in the Windows NT environment whether the + * main thread is still running, because if it goes + * down it takes the whole process down with it (in + * which case we won't be running this thread either) + * Turn function into NOP; + */ + +static void +checkparent(void) +{ +#if !defined (SYS_WINNT) && !defined (SYS_VXWORKS) + + /* + * If our parent (the server) has died we will have been + * inherited by init. If so, exit. + */ + if (getppid() == 1) { + msyslog(LOG_INFO, "parent died before we finished, exiting"); + exit(0); + } +#endif /* SYS_WINNT && SYS_VXWORKS*/ +} + + +/* + * removeentry - we are done with an entry, remove it from the list + */ +static void +removeentry( + struct dns_entry *entry + ) +{ + register struct dns_entry *de; + + de = dns_entries; + if (de == entry) { + dns_entries = de->de_next; + return; + } + + while (de != NULL) { + if (de->de_next == entry) { + de->de_next = entry->de_next; + return; + } + de = de->de_next; + } +} + + +/* + * addentry - add an entry to the configuration list + */ +static void +addentry( + char *name, + u_int32 paddr, + u_short associd + ) +{ + register struct dns_entry *de; + +#ifdef DEBUG + if (debug > 1) { + struct in_addr si; + + si.s_addr = paddr; + msyslog(LOG_INFO, + "ntp_res_name: <%s> %s associd %d\n", + (name) ? name : "", inet_ntoa(si), associd); + } +#endif + + de = (struct dns_entry *)emalloc(sizeof(struct dns_entry)); + if (name) { + strncpy(de->de_hostname, name, sizeof de->de_hostname); + de->de_done = DE_PENDING | DE_ADDR; + } else { + de->de_hostname[0] = 0; + de->de_done = DE_PENDING | DE_NAME; + } + de->de_peeraddr = paddr; + de->de_associd = associd; + de->de_next = NULL; + + if (dns_entries == NULL) { + dns_entries = de; + } else { + register struct dns_entry *dep; + + for (dep = dns_entries; dep->de_next != NULL; + dep = dep->de_next) + /* nothing */; + dep->de_next = de; + } +} + + +/* + * findhostaddr - resolve a host name into an address (Or vice-versa) + * + * sets entry->de_done appropriately when we're finished. We're finished if + * we either successfully look up the missing name or address, or if we get a + * "permanent" failure on the lookup. + * + */ +static void +findhostaddr( + struct dns_entry *entry + ) +{ + struct hostent *hp; + + checkparent(); /* make sure our guy is still running */ + + /* + * The following should never trip - this subroutine isn't + * called if hostname and peeraddr are "filled". + */ + if (entry->de_hostname[0] && entry->de_peeraddr) { + struct in_addr si; + + si.s_addr = entry->de_peeraddr; + msyslog(LOG_ERR, "findhostaddr: both de_hostname and de_peeraddr are defined: <%s>/%s: state %#x", + &entry->de_hostname[0], inet_ntoa(si), entry->de_done); + return; + } + + /* + * The following should never trip. + */ + if (!entry->de_hostname[0] && !entry->de_peeraddr) { + msyslog(LOG_ERR, "findhostaddr: both de_hostname and de_peeraddr are undefined!"); + entry->de_done |= DE_FAIL; + return; + } + + if (entry->de_hostname[0]) { +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, "findhostaddr: Resolving <%s>", + &entry->de_hostname[0]); +#endif /* DEBUG */ + hp = gethostbyname(&entry->de_hostname[0]); + } else { +#ifdef DEBUG + if (debug > 2) { + struct in_addr si; + + si.s_addr = entry->de_peeraddr; + msyslog(LOG_INFO, "findhostaddr: Resolving %s", + inet_ntoa(si)); + } +#endif + hp = gethostbyaddr((const char *)&entry->de_peeraddr, + sizeof entry->de_peeraddr, + AF_INET); + } + + if (hp == NULL) { + /* + * Bail if we should TRY_AGAIN. + * Otherwise, we have a permanent failure. + */ + if (h_errno == TRY_AGAIN) + return; + entry->de_done |= DE_FAIL; + } else { + entry->de_done |= DE_GOT; + } + + if (entry->de_done & DE_GOT) { + switch (entry->de_done & DE_NA) { + case DE_NAME: +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, + "findhostaddr: name resolved."); +#endif + /* + * Use the first address. We don't have any way to + * tell preferences and older gethostbyname() + * implementations only return one. + */ + memmove((char *)&(entry->de_peeraddr), + (char *)hp->h_addr, + sizeof(struct in_addr)); + break; + case DE_ADDR: +#ifdef DEBUG + if (debug > 2) + msyslog(LOG_INFO, + "findhostaddr: address resolved."); +#endif + strncpy(&entry->de_hostname[0], hp->h_name, + sizeof entry->de_hostname); + break; + default: + msyslog(LOG_ERR, "findhostaddr: Bogus de_done: %#x", + entry->de_done); + break; + } + } else { +#ifdef DEBUG + if (debug > 2) { + struct in_addr si; + const char *hes; +#ifndef HAVE_HSTRERROR + char hnum[20]; + + switch (h_errno) { + case HOST_NOT_FOUND: + hes = "Authoritive Answer Host not found"; + break; + case TRY_AGAIN: + hes = "Non-Authoritative Host not found, or SERVERFAIL"; + break; + case NO_RECOVERY: + hes = "Non recoverable errors, FORMERR, REFUSED, NOTIMP"; + break; + case NO_DATA: + hes = "Valid name, no data record of requested type"; + break; + default: + snprintf(hnum, sizeof hnum, "%d", h_errno); + hes = hnum; + break; + } +#else + hes = hstrerror(h_errno); +#endif + + si.s_addr = entry->de_peeraddr; + msyslog(LOG_INFO, + "findhostaddr: Failed resolution on <%s>/%s: %s", + entry->de_hostname, inet_ntoa(si), hes); + } +#endif + /* Send a NAK message back to the daemon */ + } + return; +} + + +/* + * openntp - open a socket to the ntp server + */ +static void +openntp(void) +{ + struct sockaddr_in saddr; + + if (sockfd >= 0) + return; + + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd == -1) { + msyslog(LOG_ERR, "socket() failed: %m"); + exit(1); + } + + memset((char *)&saddr, 0, sizeof(saddr)); + saddr.sin_family = AF_INET; + saddr.sin_port = htons(NTP_PORT); /* trash */ + saddr.sin_addr.s_addr = htonl(LOCALHOST); /* garbage */ + + /* + * Make the socket non-blocking. We'll wait with select() + */ +#ifndef SYS_WINNT +# if defined(O_NONBLOCK) + if (fcntl(sockfd, F_SETFL, O_NONBLOCK) == -1) { + msyslog(LOG_ERR, "fcntl(O_NONBLOCK) failed: %m"); + exit(1); + } +# else +# if defined(FNDELAY) + if (fcntl(sockfd, F_SETFL, FNDELAY) == -1) { + msyslog(LOG_ERR, "fcntl(FNDELAY) failed: %m"); + exit(1); + } +# else +# include "Bletch: NEED NON BLOCKING IO" +# endif /* FNDDELAY */ +# endif /* O_NONBLOCK */ +#else /* SYS_WINNT */ + { + int on = 1; + + if (ioctlsocket(sockfd,FIONBIO,(u_long *) &on) == SOCKET_ERROR) { + msyslog(LOG_ERR, "ioctlsocket(FIONBIO) fails: %m"); + exit(1); /* Windows NT - set socket in non-blocking mode */ + } + } +#endif /* SYS_WINNT */ + + if (connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) { + msyslog(LOG_ERR, "openntp: connect() failed: %m"); + exit(1); + } +} + + +/* + * tell_ntpd: Tell ntpd what we discovered. + */ +static int +tell_ntpd( + struct info_dns_assoc *conf + ) +{ + fd_set fdset; + struct timeval tvout; + struct req_pkt reqpkt; + l_fp ts; + int n; +#ifdef SYS_WINNT + HANDLE hReadWriteEvent = NULL; + BOOL ret; + DWORD NumberOfBytesWritten, NumberOfBytesRead, dwWait; + OVERLAPPED overlap; +#endif /* SYS_WINNT */ + + checkparent(); /* make sure our guy is still running */ + + if (sockfd < 0) + openntp(); + +#ifdef SYS_WINNT + hReadWriteEvent = CreateEvent(NULL, FALSE, FALSE, NULL); +#endif /* SYS_WINNT */ + + /* + * Try to clear out any previously received traffic so it + * doesn't fool us. Note the socket is nonblocking. + */ + tvout.tv_sec = 0; + tvout.tv_usec = 0; + FD_ZERO(&fdset); + FD_SET(sockfd, &fdset); + while (select(sockfd + 1, &fdset, (fd_set *)0, (fd_set *)0, &tvout) > + 0) { + recv(sockfd, (char *)&reqpkt, REQ_LEN_MAC, 0); + FD_ZERO(&fdset); + FD_SET(sockfd, &fdset); + } + + /* + * Make up a request packet with the configuration info + */ + memset((char *)&reqpkt, 0, sizeof(reqpkt)); + + reqpkt.rm_vn_mode = RM_VN_MODE(0, 0, 0); + reqpkt.auth_seq = AUTH_SEQ(1, 0); /* authenticated, no seq */ + reqpkt.implementation = IMPL_XNTPD; /* local implementation */ + reqpkt.request = REQ_HOSTNAME_ASSOCID; /* Hostname for associd */ + reqpkt.err_nitems = ERR_NITEMS(0, 1); /* one item */ + reqpkt.mbz_itemsize = MBZ_ITEMSIZE(sizeof(struct info_dns_assoc)); + memmove(reqpkt.data, (char *)conf, sizeof(struct info_dns_assoc)); + reqpkt.keyid = htonl(req_keyid); + + get_systime(&ts); + L_ADDUF(&ts, SKEWTIME); + HTONL_FP(&ts, &reqpkt.tstamp); + n = 0; + if (sys_authenticate) + n = authencrypt(req_keyid, (u_int32 *)&reqpkt, REQ_LEN_NOMAC); + + /* + * Done. Send it. + */ +#ifndef SYS_WINNT + n = send(sockfd, (char *)&reqpkt, (unsigned)(REQ_LEN_NOMAC + n), 0); + if (n < 0) { + msyslog(LOG_ERR, "send to NTP server failed: %m"); + return 0; /* maybe should exit */ + } +#else + /* In the NT world, documentation seems to indicate that there + * exist _write and _read routines that can be used to do blocking + * I/O on sockets. Problem is these routines require a socket + * handle obtained through the _open_osf_handle C run-time API + * of which there is no explanation in the documentation. We need + * nonblocking write's and read's anyway for our purpose here. + * We're therefore forced to deviate a little bit from the Unix + * model here and use the ReadFile and WriteFile Win32 I/O API's + * on the socket + */ + overlap.Offset = overlap.OffsetHigh = (DWORD)0; + overlap.hEvent = hReadWriteEvent; + ret = WriteFile((HANDLE)sockfd, (char *)&reqpkt, REQ_LEN_NOMAC + n, + (LPDWORD)&NumberOfBytesWritten, (LPOVERLAPPED)&overlap); + if ((ret == FALSE) && (GetLastError() != ERROR_IO_PENDING)) { + msyslog(LOG_ERR, "send to NTP server failed: %m"); + return 0; + } + dwWait = WaitForSingleObject(hReadWriteEvent, (DWORD) TIMEOUT_SEC * 1000); + if ((dwWait == WAIT_FAILED) || (dwWait == WAIT_TIMEOUT)) { + if (dwWait == WAIT_FAILED) + msyslog(LOG_ERR, "WaitForSingleObject failed: %m"); + return 0; + } +#endif /* SYS_WINNT */ + + + /* + * Wait for a response. A weakness of the mode 7 protocol used + * is that there is no way to associate a response with a + * particular request, i.e. the response to this configuration + * request is indistinguishable from that to any other. I should + * fix this some day. In any event, the time out is fairly + * pessimistic to make sure that if an answer is coming back + * at all, we get it. + */ + for (;;) { + FD_ZERO(&fdset); + FD_SET(sockfd, &fdset); + tvout.tv_sec = TIMEOUT_SEC; + tvout.tv_usec = TIMEOUT_USEC; + + n = select(sockfd + 1, &fdset, (fd_set *)0, + (fd_set *)0, &tvout); + + if (n < 0) + { + msyslog(LOG_ERR, "select() fails: %m"); + return 0; + } + else if (n == 0) + { + if(debug) + msyslog(LOG_INFO, "select() returned 0."); + return 0; + } + +#ifndef SYS_WINNT + n = recv(sockfd, (char *)&reqpkt, REQ_LEN_MAC, 0); + if (n <= 0) { + if (n < 0) { + msyslog(LOG_ERR, "recv() fails: %m"); + return 0; + } + continue; + } +#else /* Overlapped I/O used on non-blocking sockets on Windows NT */ + ret = ReadFile((HANDLE)sockfd, (char *)&reqpkt, (DWORD)REQ_LEN_MAC, + (LPDWORD)&NumberOfBytesRead, (LPOVERLAPPED)&overlap); + if ((ret == FALSE) && (GetLastError() != ERROR_IO_PENDING)) { + msyslog(LOG_ERR, "ReadFile() fails: %m"); + return 0; + } + dwWait = WaitForSingleObject(hReadWriteEvent, (DWORD) TIMEOUT_SEC * 1000); + if ((dwWait == WAIT_FAILED) || (dwWait == WAIT_TIMEOUT)) { + if (dwWait == WAIT_FAILED) { + msyslog(LOG_ERR, "WaitForSingleObject fails: %m"); + return 0; + } + continue; + } + n = NumberOfBytesRead; +#endif /* SYS_WINNT */ + + /* + * Got one. Check through to make sure it is what + * we expect. + */ + if (n < RESP_HEADER_SIZE) { + msyslog(LOG_ERR, "received runt response (%d octets)", + n); + continue; + } + + if (!ISRESPONSE(reqpkt.rm_vn_mode)) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, "received non-response packet"); +#endif + continue; + } + + if (ISMORE(reqpkt.rm_vn_mode)) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, "received fragmented packet"); +#endif + continue; + } + + if ( ( (INFO_VERSION(reqpkt.rm_vn_mode) < 2) + || (INFO_VERSION(reqpkt.rm_vn_mode) > NTP_VERSION)) + || INFO_MODE(reqpkt.rm_vn_mode) != MODE_PRIVATE) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, + "version (%d/%d) or mode (%d/%d) incorrect", + INFO_VERSION(reqpkt.rm_vn_mode), + NTP_VERSION, + INFO_MODE(reqpkt.rm_vn_mode), + MODE_PRIVATE); +#endif + continue; + } + + if (INFO_SEQ(reqpkt.auth_seq) != 0) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, + "nonzero sequence number (%d)", + INFO_SEQ(reqpkt.auth_seq)); +#endif + continue; + } + + if (reqpkt.implementation != IMPL_XNTPD || + reqpkt.request != REQ_HOSTNAME_ASSOCID) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, + "implementation (%d/%d) or request (%d/%d) incorrect", + reqpkt.implementation, IMPL_XNTPD, + reqpkt.request, REQ_HOSTNAME_ASSOCID); +#endif + continue; + } + + if (INFO_NITEMS(reqpkt.err_nitems) != 0 || + INFO_MBZ(reqpkt.mbz_itemsize) != 0 || + INFO_ITEMSIZE(reqpkt.mbz_itemsize) != 0) { +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_INFO, + "nitems (%d) mbz (%d) or itemsize (%d) nonzero", + INFO_NITEMS(reqpkt.err_nitems), + INFO_MBZ(reqpkt.mbz_itemsize), + INFO_ITEMSIZE(reqpkt.mbz_itemsize)); +#endif + continue; + } + + n = INFO_ERR(reqpkt.err_nitems); + switch (n) { + case INFO_OKAY: + /* success */ + return 1; + + case INFO_ERR_IMPL: + msyslog(LOG_ERR, + "server reports implementation mismatch!!"); + return 0; + + case INFO_ERR_REQ: + msyslog(LOG_ERR, + "server claims configuration request is unknown"); + return 0; + + case INFO_ERR_FMT: + msyslog(LOG_ERR, + "server indicates a format error occurred(!!)"); + return 0; + + case INFO_ERR_NODATA: + msyslog(LOG_ERR, + "server indicates no data available (shouldn't happen)"); + return 0; + + case INFO_ERR_AUTH: + msyslog(LOG_ERR, + "server returns a permission denied error"); + return 0; + + default: + msyslog(LOG_ERR, + "server returns unknown error code %d", n); + return 0; + } + } +} + + +/* + * doconfigure - attempt to resolve names/addresses + */ +static void +doconfigure( + int dores + ) +{ + register struct dns_entry *de; + register struct dns_entry *deremove; + char *done_msg = ""; + + de = dns_entries; + while (de != NULL) { +#ifdef DEBUG + if (debug > 1) { + struct in_addr si; + + si.s_addr = de->de_peeraddr; + msyslog(LOG_INFO, + "doconfigure: name: <%s> peeraddr: %s", + de->de_hostname, inet_ntoa(si)); + } +#endif + if (dores && (de->de_hostname[0] == 0 || de->de_peeraddr == 0)) { + findhostaddr(de); + } + + switch (de->de_done & DE_RESULT) { + case DE_PENDING: + done_msg = ""; + break; + case DE_GOT: + done_msg = "succeeded"; + break; + case DE_FAIL: + done_msg = "failed"; + break; + default: + done_msg = "(error - shouldn't happen)"; + break; + } + if (done_msg[0]) { + /* Send the answer */ + if (tell_ntpd(&de->de_info)) { + struct in_addr si; + + si.s_addr = de->de_peeraddr; +#ifdef DEBUG + if (debug > 1) { + msyslog(LOG_INFO, + "DNS resolution on <%s>/%s %s", + de->de_hostname, inet_ntoa(si), + done_msg); + } +#endif + deremove = de; + de = deremove->de_next; + removeentry(deremove); + } + } else { + de = de->de_next; + } + } +} diff --git a/contrib/ntp/ntpd/ntp_timer.c b/contrib/ntp/ntpd/ntp_timer.c index 0e2dc88..71a84e2 100644 --- a/contrib/ntp/ntpd/ntp_timer.c +++ b/contrib/ntp/ntpd/ntp_timer.c @@ -5,20 +5,26 @@ # include <config.h> #endif +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_stdlib.h" + #include <stdio.h> -#include <sys/types.h> -#include <sys/time.h> #include <signal.h> #include <sys/signal.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif -#include "ntp_machine.h" -#include "ntpd.h" -#include "ntp_stdlib.h" #if defined(HAVE_IO_COMPLETION_PORT) # include "ntp_iocompletionport.h" # include "ntp_timer.h" #endif +#ifdef PUBKEY +#include "ntp_crypto.h" +#endif /* PUBKEY */ + /* * These routines provide support for the event timer. The timer is * implemented by an interrupt routine which sets a flag once every @@ -41,8 +47,11 @@ volatile int alarm_flag; static u_long adjust_timer; /* second timer */ static u_long keys_timer; /* minute timer */ static u_long hourly_timer; /* hour timer */ +static u_long huffpuff_timer; /* huff-n'-puff timer */ +#ifdef AUTOKEY static u_long revoke_timer; /* keys revoke timer */ -u_long sys_revoke = KEY_REVOKE; /* keys revoke timeout */ +u_long sys_revoke = 1 << KEY_REVOKE; /* keys revoke timeout */ +#endif /* AUTOKEY */ /* * Statistics counter for the interested. @@ -101,6 +110,7 @@ init_timer(void) alarm_overflow = 0; adjust_timer = 1; hourly_timer = HOUR; + huffpuff_timer = 0; current_time = 0; timer_overflows = 0; timer_xmtcalls = 0; @@ -206,7 +216,7 @@ void timer(void) { register struct peer *peer, *next_peer; - int n; + u_int n; current_time += (1<<EVENT_TIMEOUT); @@ -250,12 +260,27 @@ timer(void) } /* - * Garbage collect revoked keys + * Huff-n'-puff filter + */ + if (huffpuff_timer <= current_time) { + huffpuff_timer += HUFFPUFF; + huffpuff(); + } + +#ifdef AUTOKEY + /* + * Garbage collect old keys and generate new private value */ if (revoke_timer <= current_time) { - revoke_timer += RANDPOLL(sys_revoke); - key_expire_all(); + revoke_timer += sys_revoke; + expire_all(); +#ifdef DEBUG + if (debug) + printf("key expire: at %lu next %lu\n", + current_time, revoke_timer); +#endif } +#endif /* AUTOKEY */ /* * Finally, call the hourly routine. diff --git a/contrib/ntp/ntpd/ntp_util.c b/contrib/ntp/ntpd/ntp_util.c index c53255a..f86e930 100644 --- a/contrib/ntp/ntpd/ntp_util.c +++ b/contrib/ntp/ntpd/ntp_util.c @@ -1,18 +1,11 @@ /* * ntp_util.c - stuff I didn't have any other place for */ + #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -# ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -# endif -# include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" @@ -20,6 +13,20 @@ #include "ntp_if.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> +#include <sys/types.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif + +#ifdef HAVE_IEEEFP_H +# include <ieeefp.h> +#endif +#ifdef HAVE_MATH_H +# include <math.h> +#endif + #ifdef DOSYNCTODR #if !defined(VMS) #include <sys/resource.h> @@ -218,7 +225,8 @@ hourly_stats(void) NLOG(NLOG_SYSSTATIST) msyslog(LOG_INFO, "offset %.6f sec freq %.3f ppm error %.6f poll %d", - last_offset, drift_comp * 1e6, sys_error, sys_poll); + last_offset, drift_comp * 1e6, sys_jitter, sys_poll); + if (stats_drift_file != 0) { if ((fp = fopen(stats_temp_file, "w")) == NULL) { @@ -341,12 +349,27 @@ stats_config( break; } if (fscanf(fp, "%lf", &old_drift) != 1) { - msyslog(LOG_ERR, "invalid frequency from %s", + msyslog(LOG_ERR, "Un-parsable frequency in %s", stats_drift_file); (void) fclose(fp); break; } (void) fclose(fp); + if ( +#ifdef HAVE_FINITE + !finite(old_drift) +#else /* not HAVE_FINITE */ +# ifdef HAVE_ISFINITE + !isfinite(old_drift) +# else /* not HAVE_ISFINITE */ + 0 +# endif /* not HAVE_ISFINITE */ +#endif /* not HAVE_FINITE */ + || (fabs(old_drift) > (NTP_MAXFREQ * 1e6))) { + msyslog(LOG_ERR, "invalid frequency (%f) in %s", + old_drift, stats_drift_file); + old_drift = 0.0; + } msyslog(LOG_INFO, "frequency initialized %.3f from %s", old_drift, stats_drift_file); loop_config(LOOP_DRIFTCOMP, old_drift / 1e6); @@ -466,7 +489,13 @@ record_peer_stats( * time constant (log base 2) */ void -record_loop_stats(void) +record_loop_stats( + double offset, + double freq, + double jitter, + double stability, + int poll + ) { struct timeval tv; #ifdef HAVE_GETCLOCK @@ -490,8 +519,8 @@ record_loop_stats(void) filegen_setup(&loopstats, (u_long)(tv.tv_sec + JAN_1970)); if (loopstats.fp != NULL) { fprintf(loopstats.fp, "%lu %lu.%03lu %.9f %.6f %.9f %.6f %d\n", - day, sec, msec, last_offset, drift_comp * 1e6, - sys_error, clock_stability * 1e6, sys_poll); + day, sec, msec, offset, freq * 1e6, jitter, + stability * 1e6, poll); fflush(loopstats.fp); } } diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c index 3dbef60..aab9881 100644 --- a/contrib/ntp/ntpd/ntpd.c +++ b/contrib/ntp/ntpd/ntpd.c @@ -1,11 +1,15 @@ /* * ntpd.c - main program for the fixed point NTP daemon */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif -#include <sys/types.h> +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_stdlib.h" + #ifdef HAVE_UNISTD_H # include <unistd.h> #endif @@ -21,7 +25,6 @@ # ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> # endif /* HAVE_SYS_IOCTL_H */ -# include <sys/time.h> # ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> # endif /* HAVE_SYS_RESOURCE_H */ @@ -68,11 +71,8 @@ # include <apollo/base.h> #endif /* SYS_DOMAINOS */ -#include "ntpd.h" -#include "ntp_io.h" - -#include "ntp_stdlib.h" #include "recvbuff.h" +#include "ntp_cmdargs.h" #if 0 /* HMS: I don't think we need this. 961223 */ #ifdef LOCK_PROCESS @@ -85,13 +85,17 @@ #endif #ifdef _AIX -#include <ulimit.h> +# include <ulimit.h> #endif /* _AIX */ #ifdef SCO5_CLOCK -#include <sys/ci/ciioctl.h> +# include <sys/ci/ciioctl.h> #endif +#ifdef PUBKEY +#include "ntp_crypto.h" +#endif /* PUBKEY */ + /* * Signals we catch for debugging. If not debugging we ignore them. */ @@ -102,10 +106,10 @@ * Signals which terminate us gracefully. */ #ifndef SYS_WINNT -#define SIGDIE1 SIGHUP -#define SIGDIE3 SIGQUIT -#define SIGDIE2 SIGINT -#define SIGDIE4 SIGTERM +# define SIGDIE1 SIGHUP +# define SIGDIE3 SIGQUIT +# define SIGDIE2 SIGINT +# define SIGDIE4 SIGTERM #endif /* SYS_WINNT */ #if defined SYS_WINNT @@ -122,7 +126,12 @@ static BOOL WINAPI OnConsoleEvent(DWORD dwCtrlType); /* * Scheduling priority we run at */ -# define NTPD_PRIO (-12) +#define NTPD_PRIO (-12) + +int priority_done = 2; /* 0 - Set priority */ + /* 1 - priority is OK where it is */ + /* 2 - Don't set priority */ + /* 1 and 2 are pretty much the same */ /* * Debugging flag @@ -223,39 +232,23 @@ catch_danger(int signo) static void set_process_priority(void) { - int done = 0; - -#ifdef SYS_WINNT - DWORD SingleCPUMask = 0; - DWORD ProcessAffinityMask, SystemAffinityMask; - if (!GetProcessAffinityMask(GetCurrentProcess(), &ProcessAffinityMask, &SystemAffinityMask)) - msyslog(LOG_ERR, "GetProcessAffinityMask: %m"); - else { - SingleCPUMask = 1; -# ifdef DEBUG - msyslog(LOG_INFO, "System AffinityMask = %x", SystemAffinityMask ); -# endif - } - while (SingleCPUMask && !(SingleCPUMask & SystemAffinityMask)) { - SingleCPUMask = SingleCPUMask << 1; - } - if (!SingleCPUMask) - msyslog(LOG_ERR, "Can't set Processor Affinity Mask"); - else if (!SetProcessAffinityMask(GetCurrentProcess(), SingleCPUMask)) - msyslog(LOG_ERR, "SetProcessAffinityMask: %m"); -# ifdef DEBUG - else msyslog(LOG_INFO,"ProcessorAffinity Mask: %x", SingleCPUMask ); -# endif +#ifdef DEBUG + if (debug > 1) + msyslog(LOG_DEBUG, "set_process_priority: %s: priority_done is <%d>", + ((priority_done) + ? "Leave priority alone" + : "Attempt to set priority" + ), + priority_done); +#endif /* DEBUG */ - if (!SetPriorityClass(GetCurrentProcess(), (DWORD) REALTIME_PRIORITY_CLASS)) - msyslog(LOG_ERR, "SetPriorityClass: %m"); - else - ++done; +#ifdef SYS_WINNT + priority_done += NT_set_process_priority(); #endif -# if defined(HAVE_SCHED_SETSCHEDULER) - if (!done) { +#if defined(HAVE_SCHED_SETSCHEDULER) + if (!priority_done) { extern int config_priority_override, config_priority; int pmax, pmin; struct sched_param sched; @@ -274,12 +267,12 @@ set_process_priority(void) if ( sched_setscheduler(0, SCHED_FIFO, &sched) == -1 ) msyslog(LOG_ERR, "sched_setscheduler(): %m"); else - ++done; + ++priority_done; } -# endif /* HAVE_SCHED_SETSCHEDULER */ -# if defined(HAVE_RTPRIO) -# ifdef RTP_SET - if (!done) { +#endif /* HAVE_SCHED_SETSCHEDULER */ +#if defined(HAVE_RTPRIO) +# ifdef RTP_SET + if (!priority_done) { struct rtprio srtp; srtp.type = RTP_PRIO_REALTIME; /* was: RTP_PRIO_NORMAL */ @@ -288,37 +281,37 @@ set_process_priority(void) if (rtprio(RTP_SET, getpid(), &srtp) < 0) msyslog(LOG_ERR, "rtprio() error: %m"); else - ++done; + ++priority_done; } -# else /* not RTP_SET */ - if (!done) { +# else /* not RTP_SET */ + if (!priority_done) { if (rtprio(0, 120) < 0) msyslog(LOG_ERR, "rtprio() error: %m"); else - ++done; + ++priority_done; } -# endif /* not RTP_SET */ -# endif /* HAVE_RTPRIO */ -# if defined(NTPD_PRIO) && NTPD_PRIO != 0 -# ifdef HAVE_ATT_NICE - if (!done) { +# endif /* not RTP_SET */ +#endif /* HAVE_RTPRIO */ +#if defined(NTPD_PRIO) && NTPD_PRIO != 0 +# ifdef HAVE_ATT_NICE + if (!priority_done) { errno = 0; if (-1 == nice (NTPD_PRIO) && errno != 0) msyslog(LOG_ERR, "nice() error: %m"); else - ++done; + ++priority_done; } -# endif /* HAVE_ATT_NICE */ -# ifdef HAVE_BSD_NICE - if (!done) { +# endif /* HAVE_ATT_NICE */ +# ifdef HAVE_BSD_NICE + if (!priority_done) { if (-1 == setpriority(PRIO_PROCESS, 0, NTPD_PRIO)) msyslog(LOG_ERR, "setpriority() error: %m"); else - ++done; + ++priority_done; } -# endif /* HAVE_BSD_NICE */ -# endif /* NTPD_PRIO && NTPD_PRIO != 0 */ - if (!done) +# endif /* HAVE_BSD_NICE */ +#endif /* NTPD_PRIO && NTPD_PRIO != 0 */ + if (!priority_done) msyslog(LOG_ERR, "set_process_priority: No way found to improve our priority"); } @@ -335,6 +328,10 @@ ntpdmain( { l_fp now; char *cp; +#ifdef AUTOKEY + u_int n; + char hostname[MAXFILENAME]; +#endif /* AUTOKEY */ struct recvbuf *rbuflist; struct recvbuf *rbuf; #ifdef _AIX /* HMS: ifdef SIGDANGER? */ @@ -347,7 +344,7 @@ ntpdmain( #ifdef HAVE_UMASK { - unsigned int uv; + mode_t uv; uv = umask(0); if(uv) @@ -378,10 +375,13 @@ ntpdmain( } addSourceToRegistry("NTP", szMsgPath); #endif + getstartup(argc, argv); /* startup configuration, may set debug */ + /* + * Initialize random generator and public key pair + */ get_systime(&now); SRANDOM((int)(now.l_i * now.l_uf)); - getstartup(argc, argv); /* startup configuration, may set debug */ #if !defined(VMS) # ifndef NODETACH @@ -395,9 +395,9 @@ ntpdmain( # endif /* DEBUG */ { # ifndef SYS_WINNT -# ifdef HAVE_DAEMON +# ifdef HAVE_DAEMON daemon(0, 0); -# else /* not HAVE_DAEMON */ +# else /* not HAVE_DAEMON */ if (fork()) /* HMS: What about a -1? */ exit(0); @@ -417,11 +417,11 @@ ntpdmain( msyslog(LOG_ERR, "ntpd: failed to close open files(): %m"); #else /* not F_CLOSEM */ -#if defined(HAVE_SYSCONF) && defined(_SC_OPEN_MAX) +# if defined(HAVE_SYSCONF) && defined(_SC_OPEN_MAX) max_fd = sysconf(_SC_OPEN_MAX); -#else /* HAVE_SYSCONF && _SC_OPEN_MAX */ +# else /* HAVE_SYSCONF && _SC_OPEN_MAX */ max_fd = getdtablesize(); -#endif /* HAVE_SYSCONF && _SC_OPEN_MAX */ +# endif /* HAVE_SYSCONF && _SC_OPEN_MAX */ for (s = 0; s < max_fd; s++) (void) close((int)s); #endif /* not F_CLOSEM */ @@ -473,8 +473,8 @@ ntpdmain( (void) sigaction(SIGDANGER, &sa, NULL); #endif /* _AIX */ } -#endif /* not HAVE_DAEMON */ -#else /* SYS_WINNT */ +# endif /* not HAVE_DAEMON */ +# else /* SYS_WINNT */ { SERVICE_TABLE_ENTRY dispatchTable[] = { @@ -489,10 +489,10 @@ ntpdmain( ExitProcess(2); } } -#endif /* SYS_WINNT */ +# endif /* SYS_WINNT */ } -#endif /* NODETACH */ -#if defined(SYS_WINNT) && !defined(NODETACH) +# endif /* NODETACH */ +# if defined(SYS_WINNT) && !defined(NODETACH) else service_main(argc, argv); return 0; /* must return a value */ @@ -513,7 +513,10 @@ service_main( char *cp; struct recvbuf *rbuflist; struct recvbuf *rbuf; - +#ifdef AUTOKEY + u_int n; + char hostname[MAXFILENAME]; +#endif /* AUTOKEY */ if(!debug) { /* register our service control handler */ @@ -541,7 +544,7 @@ service_main( } } /* debug */ -#endif /* defined(SYS_WINNT) && !defined(NODETACH) */ +# endif /* defined(SYS_WINNT) && !defined(NODETACH) */ #endif /* VMS */ /* @@ -638,15 +641,15 @@ service_main( if (plock(PROCLOCK) < 0) msyslog(LOG_ERR, "plock(PROCLOCK): %m"); # else /* not PROCLOCK */ -# ifdef TXTLOCK +# ifdef TXTLOCK /* * Lock text into ram */ if (plock(TXTLOCK) < 0) msyslog(LOG_ERR, "plock(TXTLOCK) error: %m"); -# else /* not TXTLOCK */ +# else /* not TXTLOCK */ msyslog(LOG_ERR, "plock() - don't know what to lock!"); -# endif /* not TXTLOCK */ +# endif /* not TXTLOCK */ # endif /* not PROCLOCK */ # endif /* HAVE_PLOCK */ #endif /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */ @@ -715,27 +718,38 @@ service_main( init_refclock(); #endif set_process_priority(); - init_proto(); + init_proto(); /* Call at high priority */ init_io(); init_loopfilter(); - - mon_start(MON_ON); /* monitor on by default now */ + mon_start(MON_ON); /* monitor on by default now */ /* turn off in config if unwanted */ /* * Get configuration. This (including argument list parsing) is * done in a separate module since this will definitely be different - * for the gizmo board. + * for the gizmo board. While at it, save the host name for later + * along with the length. The crypto needs this. */ +#ifdef DEBUG + debug = 0; +#endif getconfig(argc, argv); - +#ifdef AUTOKEY + gethostname(hostname, MAXFILENAME); + n = strlen(hostname) + 1; + sys_hostname = emalloc(n); + memcpy(sys_hostname, hostname, n); +#ifdef PUBKEY + crypto_setup(); +#endif /* PUBKEY */ +#endif /* AUTOKEY */ initializing = 0; #if defined(SYS_WINNT) && !defined(NODETACH) # if defined(DEBUG) if(!debug) { -#endif +# endif /* report to the service control manager that the service is running */ ssStatus.dwCurrentState = SERVICE_RUNNING; ssStatus.dwWin32ExitCode = NO_ERROR; @@ -750,7 +764,7 @@ service_main( } # if defined(DEBUG) } -#endif +# endif #endif /* @@ -773,7 +787,7 @@ service_main( * and - lacking a hardware reference clock - I have * yet to learn about anything else that is. */ -# if defined(HAVE_IO_COMPLETION_PORT) +#if defined(HAVE_IO_COMPLETION_PORT) WaitHandles[0] = CreateEvent(NULL, FALSE, FALSE, NULL); /* exit reques */ WaitHandles[1] = get_timer_handle(); @@ -805,21 +819,21 @@ service_main( } /* switch */ rbuflist = getrecvbufs(); /* get received buffers */ -# else /* normal I/O */ +#else /* normal I/O */ was_alarmed = 0; rbuflist = (struct recvbuf *)0; for (;;) { -# if !defined(HAVE_SIGNALED_IO) +# if !defined(HAVE_SIGNALED_IO) extern fd_set activefds; extern int maxactivefd; fd_set rdfdes; int nfound; -# elif defined(HAVE_SIGNALED_IO) +# elif defined(HAVE_SIGNALED_IO) block_io_and_alarm(); -# endif +# endif rbuflist = getrecvbufs(); /* get received buffers */ if (alarm_flag) /* alarmed? */ @@ -833,9 +847,9 @@ service_main( /* * Nothing to do. Wait for something. */ -#ifndef HAVE_SIGNALED_IO +# ifndef HAVE_SIGNALED_IO rdfdes = activefds; -# if defined(VMS) || defined(SYS_VXWORKS) +# if defined(VMS) || defined(SYS_VXWORKS) /* make select() wake up after one second */ { struct timeval t1; @@ -844,10 +858,10 @@ service_main( nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0, (fd_set *)0, &t1); } -# else +# else nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0, (fd_set *)0, (struct timeval *)0); -# endif /* VMS */ +# endif /* VMS */ if (nfound > 0) { l_fp ts; @@ -858,15 +872,13 @@ service_main( } else if (nfound == -1 && errno != EINTR) msyslog(LOG_ERR, "select() error: %m"); - else if (debug) { -# if !defined SYS_VXWORKS && !defined SCO5_CLOCK /* to unclutter log */ + else if (debug > 2) { msyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound); -# endif } -# else /* HAVE_SIGNALED_IO */ +# else /* HAVE_SIGNALED_IO */ wait_for_signal(); -# endif /* HAVE_SIGNALED_IO */ +# endif /* HAVE_SIGNALED_IO */ if (alarm_flag) /* alarmed? */ { was_alarmed = 1; @@ -888,7 +900,7 @@ service_main( was_alarmed = 0; } -# endif /* HAVE_IO_COMPLETION_PORT */ +#endif /* HAVE_IO_COMPLETION_PORT */ /* * Call the data procedure to handle each received * packet. @@ -900,11 +912,11 @@ service_main( (rbuf->receiver)(rbuf); freerecvbuf(rbuf); } -# if defined DEBUG && defined SYS_WINNT +#if defined DEBUG && defined SYS_WINNT if (debug > 4) printf("getrecvbufs: %ld handler interrupts, %ld frames\n", handler_calls, handler_pkts); -# endif +#endif /* * Go around again @@ -929,11 +941,11 @@ finish( switch (sig) { -#ifdef SIGBUS +# ifdef SIGBUS case SIGBUS: printf("\nfinish(SIGBUS)\n"); exit(0); -#endif +# endif case 0: /* Should never happen... */ return; default: diff --git a/contrib/ntp/ntpd/refclock_acts.c b/contrib/ntp/ntpd/refclock_acts.c index 9c367b5..efdf536 100644 --- a/contrib/ntp/ntpd/refclock_acts.c +++ b/contrib/ntp/ntpd/refclock_acts.c @@ -9,13 +9,6 @@ #if defined(REFCLOCK) && (defined(CLOCK_ACTS) || defined(CLOCK_PTBACTS)) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -#endif /* HAVE_SYS_IOCTL_H */ - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" @@ -23,6 +16,12 @@ #include "ntp_stdlib.h" #include "ntp_control.h" +#include <stdio.h> +#include <ctype.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif /* HAVE_SYS_IOCTL_H */ + /* MUST BE AFTER LAST #include <config.h> !!! */ #if defined(CLOCK_ACTS) && defined(CLOCK_PTBACTS) @@ -655,19 +654,22 @@ acts_receive ( (void)write(pp->io.fd, &flag, 1); /* - * Yes, I know this code incorrectly thinks that 2000 is a leap - * year. The ACTS timecode format croaks then anyway. Life is - * short. Would only the timecode mavens resist the urge to - * express months of the year and days of the month in favor of - * days of the year. - * NOTE: year 2000 IS a leap year!!! ghealton Y2KFixes + * The ACTS timecode format croaks in 2000. Life is short. + * Would only the timecode mavens resist the urge to express months + * of the year and days of the month in favor of days of the year. */ if (month < 1 || month > 12 || day < 1) { refclock_report(peer, CEVNT_BADTIME); return; } - if ( pp->year <= YEAR_PIVOT ) pp->year += 100; /* Y2KFixes */ - if ( !isleap_tm(pp->year) ) { /* Y2KFixes */ + + /* + * Depending on the driver, at this point we have a two-digit year + * or a four-digit year. Make sure we have a four-digit year. + */ + if ( pp->year < YEAR_PIVOT ) pp->year += 100; /* Y2KFixes */ + if ( pp->year < YEAR_BREAK ) pp->year += 1900; /* Y2KFixes */ + if ( !isleap_4(pp->year) ) { /* Y2KFixes */ if (day > day1tab[month - 1]) { refclock_report(peer, CEVNT_BADTIME); return; @@ -798,7 +800,7 @@ acts_timeout ( acts_disc(peer); return; } - switch (peer->ttl) { + switch (peer->ttlmax) { /* * In manual mode the ACTS calling program is activated diff --git a/contrib/ntp/ntpd/refclock_arbiter.c b/contrib/ntp/ntpd/refclock_arbiter.c index 045a93a..cdbe2ee 100644 --- a/contrib/ntp/ntpd/refclock_arbiter.c +++ b/contrib/ntp/ntpd/refclock_arbiter.c @@ -9,15 +9,14 @@ #if defined(REFCLOCK) && defined(CLOCK_ARBITER) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the Arbiter 1088A/B Satellite Controlled Clock. * The claimed accuracy of this clock is 100 ns relative to the PPS diff --git a/contrib/ntp/ntpd/refclock_arc.c b/contrib/ntp/ntpd/refclock_arc.c index 1db8a9a..c771f47 100644 --- a/contrib/ntp/ntpd/refclock_arc.c +++ b/contrib/ntp/ntpd/refclock_arc.c @@ -303,10 +303,13 @@ Also note h<cr> command which starts a resync to MSF signal. */ +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_refclock.h" +#include "ntp_stdlib.h" #include <stdio.h> #include <ctype.h> -#include <sys/time.h> #if defined(HAVE_BSD_TTYS) #include <sgtty.h> @@ -320,11 +323,6 @@ Also note h<cr> command which starts a resync to MSF signal. #include <termios.h> #endif -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_refclock.h" -#include "ntp_stdlib.h" - /* * This driver supports the ARCRON MSF Radio Controlled Clock */ diff --git a/contrib/ntp/ntpd/refclock_as2201.c b/contrib/ntp/ntpd/refclock_as2201.c index 2c10440..516f7ad 100644 --- a/contrib/ntp/ntpd/refclock_as2201.c +++ b/contrib/ntp/ntpd/refclock_as2201.c @@ -8,16 +8,15 @@ #if defined(REFCLOCK) && defined(CLOCK_AS2201) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the Austron 2200A/2201A GPS Receiver with * Buffered RS-232-C Interface Module. Note that the original 2200/2201 diff --git a/contrib/ntp/ntpd/refclock_atom.c b/contrib/ntp/ntpd/refclock_atom.c index 764f6e0..56f86b3 100644 --- a/contrib/ntp/ntpd/refclock_atom.c +++ b/contrib/ntp/ntpd/refclock_atom.c @@ -5,8 +5,6 @@ #include <config.h> #endif -#if defined(REFCLOCK) && defined(CLOCK_ATOM) - #include <stdio.h> #include <ctype.h> @@ -16,15 +14,8 @@ #include "ntp_refclock.h" #include "ntp_stdlib.h" -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#ifdef HAVE_SYS_TERMIOS_H -# include <sys/termios.h> -#endif -#ifdef HAVE_SYS_PPSCLOCK_H -# include <sys/ppsclock.h> -#endif +#if defined(REFCLOCK) && defined(CLOCK_ATOM) + #ifdef HAVE_PPSAPI # ifdef HAVE_TIMEPPS_H # include <timepps.h> @@ -37,120 +28,109 @@ /* * This driver furnishes an interface for pulse-per-second (PPS) signals - * produced by a cesium clock, timing receiver or related equipment. It + * produced by a cesium clock, timing receiver or related equipment. It * can be used to remove accumulated jitter and retime a secondary * server when synchronized to a primary server over a congested, wide- * area network and before redistributing the time to local clients. * - * In order for this driver to work, the local clock must be set to + * Before this driver becomes active, the local clock must be set to * within +-500 ms by another means, such as a radio clock or NTP - * itself. The 1-pps signal is connected via a serial port and gadget - * box consisting of a one-shot flopflop and RS232 level converter. - * Conntection is either via the carrier detect (DCD) lead or via the - * receive data (RD) lead. The incidental jitter using the DCD lead is - * essentially the interrupt latency. The incidental jitter using the RD - * lead has an additional component due to the line sampling clock. When - * operated at 38.4 kbps, this arrangement has a worst-case jitter less - * than 26 us. + * itself. There are two ways to connect the PPS signal, normally at TTL + * levels, to the computer. One is to shift to EIA levels and connect to + * pin 8 (DCD) of a serial port. This requires a level converter and + * may require a one-shot flipflop to lengthen the pulse. The other is + * to connect the PPS signal directly to pin 10 (ACK) of a PC paralell + * port. These methods are architecture dependent. * - * There are four ways in which this driver can be used. They are - * described in decreasing order of merit below. The first way uses the - * ppsapi STREAMS module and the LDISC_PPS line discipline, while the - * second way uses the ppsclock STREAMS module and the LDISC_PPS line - * discipline. Either of these works only for the baseboard serial ports - * of the Sun SPARC IPC and clones. However, the ppsapi uses the - * proposed IETF interface expected to become standard for PPS signals. - * The serial port to be used is specified by the pps command in the - * configuration file. This driver reads the timestamp directly by a - * designated ioctl() system call. + * Both methods require a modified device driver and kernel interface + * compatible with the Pulse-per-Second API for Unix-like Operating + * Systems, Version 1.0, RFC-2783 (PPSAPI). Implementations are + * available for FreeBSD, Linux, SunOS, Solaris and Alpha. However, at + * present only the Alpha implementation provides the full generality of + * the API with multiple PPS drivers and multiple handles per driver. * - * The third way uses the LDISC_CLKPPS line discipline and works for - * any architecture supporting a serial port. If after a few seconds - * this driver finds no ppsclock module configured, it attempts to open - * a serial port device /dev/pps%d, where %d is the unit number, and - * assign the LDISC_CLKPPS line discipline to it. If the line discipline - * fails, no harm is done except the accuracy is reduced somewhat. The - * pulse generator in the gadget box is adjusted to produce a start bit - * of length 26 usec at 38400 bps. Used with the LDISC_CLKPPS line - * discipline, this produces an ASCII DEL character ('\377') followed by - * a timestamp at each seconds epoch. + * In many configurations a single port is used for the radio timecode + * and PPS signal. In order to provide for this configuration and others + * involving dedicated multiple serial/parallel ports, the driver first + * attempts to open the device /dev/pps%d, where %d is the unit number. + * If this fails, the driver attempts to open the device specified by + * the pps configuration command. If a port is to be shared, the pps + * command must be placed before the radio device(s) and the radio + * device(s) must be placed before the PPS driver(s) in the + * configuration file. * - * The fourth way involves an auxiliary radio clock driver which calls - * the PPS driver with a timestamp captured by that driver. This use is - * documented in the source code for the driver(s) involved. Note that - * some drivers collect the sample information themselves before calling - * pps_sample(), and others call knowing only that they are running - * shortly after an on-time tick and they expect to retrieve the PPS - * offset, fudge their result, and insert it into the timestream. + * This driver normally uses the PLL/FLL clock discipline implemented in + * the ntpd code. If kernel support is available, the kernel PLL/FLL + * clock discipline is used instead. The default configuration is not to + * use the kernel PPS discipline, if present. The kernel PPS discipline + * can be enabled using the pps command. * * Fudge Factors * * There are no special fudge factors other than the generic. The fudge - * time1 parameter can be used to compensate for miscellaneous UART and - * OS delays. Allow about 247 us for uart delays at 38400 bps and about - * 1 ms for STREAMS nonsense with older workstations. Velocities may - * vary with modern workstations. + * time1 parameter can be used to compensate for miscellaneous device + * driver and OS delays. */ /* * Interface definitions */ #ifdef HAVE_PPSAPI -extern int pps_assert; +extern int pps_assert; /* selects rising or falling edge */ +extern int pps_hardpps; /* enables the kernel PPS interface */ +#define DEVICE "/dev/pps%d" /* device name and unit */ #endif /* HAVE_PPSAPI */ -#ifdef TTYCLK -#define DEVICE "/dev/pps%d" /* device name and unit */ -#ifdef B38400 -#define SPEED232 B38400 /* uart speed (38400 baud) */ -#else -#define SPEED232 EXTB /* as above */ -#endif -#endif /* TTYCLK */ #define PRECISION (-20) /* precision assumed (about 1 us) */ #define REFID "PPS\0" /* reference ID */ #define DESCRIPTION "PPS Clock Discipline" /* WRU */ +#define NANOSECOND 1000000000 /* one second (ns) */ +#define RANGEGATE 500000 /* range gate (ns) */ +#define ASTAGE 8 /* filter stages */ -#define FLAG_TTY 0x01 /* tty_clk heard from */ -#define FLAG_PPS 0x02 /* ppsclock heard from */ -#define FLAG_AUX 0x04 /* auxiliary PPS source */ - -static struct peer *pps_peer; /* atom driver for auxiliary PPS sources */ - -#ifdef TTYCLK -static void atom_receive P((struct recvbuf *)); -#endif /* TTYCLK */ +static struct peer *pps_peer; /* atom driver for PPS sources */ +#ifdef HAVE_PPSAPI /* - * Unit control structure + * PPS unit control structure */ -struct atomunit { -#ifdef HAVE_PPSAPI - pps_info_t pps_info; /* pps_info control */ -#endif /* HAVE_PPSAPI */ -#ifdef PPS - struct ppsclockev ev; /* ppsclock control */ -#endif /* PPS */ - int flags; /* flags that wave */ +struct ppsunit { + struct timespec ts; /* last timestamp */ + int fddev; /* pps device descriptor */ + pps_params_t pps_params; /* pps parameters */ + pps_info_t pps_info; /* last pps data */ + pps_handle_t handle; /* pps handlebars */ }; +#endif /* HAVE_PPSAPI */ /* * Function prototypes */ static int atom_start P((int, struct peer *)); -static void atom_shutdown P((int, struct peer *)); static void atom_poll P((int, struct peer *)); -#if defined(PPS) || defined(HAVE_PPSAPI) +#ifdef HAVE_PPSAPI +static void atom_shutdown P((int, struct peer *)); +static void atom_control P((int, struct refclockstat *, struct + refclockstat *, struct peer *)); static int atom_pps P((struct peer *)); -#endif /* PPS || HAVE_PPSAPI */ +static int atom_ppsapi P((struct peer *, int, int)); +#endif /* HAVE_PPSAPI */ /* * Transfer vector */ struct refclock refclock_atom = { atom_start, /* start up driver */ +#ifdef HAVE_PPSAPI atom_shutdown, /* shut down driver */ +#else + noentry, /* shut down driver */ +#endif /* HAVE_PPSAPI */ atom_poll, /* transmit poll message */ - noentry, /* not used (old atom_control) */ +#ifdef HAVE_PPSAPI + atom_control, /* fudge control */ +#else + noentry, /* fudge control */ +#endif /* HAVE_PPSAPI */ noentry, /* initialize driver */ noentry, /* not used (old atom_buginfo) */ NOFLAGS /* not used */ @@ -162,74 +142,142 @@ struct refclock refclock_atom = { */ static int atom_start( - int unit, - struct peer *peer + int unit, /* unit number (not used) */ + struct peer *peer /* peer structure pointer */ ) { - register struct atomunit *up; struct refclockproc *pp; - int flags; -#ifdef TTYCLK - int fd = 0; - char device[20]; - int ldisc = LDISC_CLKPPS; -#endif /* TTYCLK */ +#ifdef HAVE_PPSAPI + register struct ppsunit *up; + char device[80]; +#endif /* HAVE_PPSAPI */ + /* + * Allocate and initialize unit structure + */ pps_peer = peer; - flags = 0; + pp = peer->procptr; + peer->precision = PRECISION; + pp->clockdesc = DESCRIPTION; + memcpy((char *)&pp->refid, REFID, 4); + peer->burst = ASTAGE; + peer->stratum = STRATUM_UNSPEC; +#ifdef HAVE_PPSAPI + up = emalloc(sizeof(struct ppsunit)); + memset(up, 0, sizeof(struct ppsunit)); + pp->unitptr = (caddr_t)up; -#ifdef TTYCLK -# if defined(SCO5_CLOCK) - ldisc = LDISC_RAW; /* DCD timestamps without any line discipline */ -# endif /* - * Open serial port. Use LDISC_CLKPPS line discipline only - * if the LDISC_PPS line discipline is not availble, + * Open PPS device. If this fails and some driver has already + * opened the associated radio device, fdpps has the file + * descriptor for it. */ -# if defined(PPS) || defined(HAVE_PPSAPI) - if (fdpps <= 0) -# endif - { - (void)sprintf(device, DEVICE, unit); - if ((fd = refclock_open(device, SPEED232, ldisc)) != 0) - flags |= FLAG_TTY; + sprintf(device, DEVICE, unit); + up->fddev = open(device, O_RDWR, 0777); + if (up->fddev <= 0 && fdpps > 0) { + strcpy(device, pps_device); + up->fddev = fdpps; + } + if (up->fddev <= 0) { + msyslog(LOG_ERR, + "refclock_atom: %s: %m", device); + return (0); } -#endif /* TTYCLK */ /* - * Allocate and initialize unit structure + * Light off the PPSAPI interface. If this PPS device is shared + * with the radio device, take the default options from the pps + * command. This is for legacy purposes. */ - if (!(up = (struct atomunit *)emalloc(sizeof(struct atomunit)))) { -#ifdef TTYCLK - if (flags & FLAG_TTY) - (void) close(fd); -#endif /* TTYCLK */ + if (time_pps_create(up->fddev, &up->handle) < 0) { + msyslog(LOG_ERR, + "refclock_atom: time_pps_create failed: %m"); return (0); } - memset((char *)up, 0, sizeof(struct atomunit)); + return (atom_ppsapi(peer, pps_assert, pps_hardpps)); +#else /* HAVE_PPSAPI */ + return (1); +#endif /* HAVE_PPSAPI */ +} + + +#ifdef HAVE_PPSAPI +/* + * atom_control - fudge control + */ +static void +atom_control( + int unit, /* unit (not used */ + struct refclockstat *in, /* input parameters (not uded) */ + struct refclockstat *out, /* output parameters (not used) */ + struct peer *peer /* peer structure pointer */ + ) +{ + struct refclockproc *pp; + pp = peer->procptr; - pp->unitptr = (caddr_t)up; -#ifdef TTYCLK - if (flags & FLAG_TTY) { - pp->io.clock_recv = atom_receive; - pp->io.srcclock = (caddr_t)peer; - pp->io.datalen = 0; - pp->io.fd = fd; - if (!io_addclock(&pp->io)) { - (void) close(fd); - free(up); + atom_ppsapi(peer, pp->sloppyclockflag & CLK_FLAG2, + pp->sloppyclockflag & CLK_FLAG3); +} + + +/* + * Initialize PPSAPI + */ +int +atom_ppsapi( + struct peer *peer, /* peer structure pointer */ + int enb_clear, /* clear enable */ + int enb_hardpps /* hardpps enable */ + ) +{ + struct refclockproc *pp; + register struct ppsunit *up; + int capability; + + pp = peer->procptr; + up = (struct ppsunit *)pp->unitptr; + if (time_pps_getcap(up->handle, &capability) < 0) { + msyslog(LOG_ERR, + "refclock_atom: time_pps_getcap failed: %m"); + return (0); + } + memset(&up->pps_params, 0, sizeof(pps_params_t)); + if (enb_clear) + up->pps_params.mode = capability & PPS_CAPTURECLEAR; + else + up->pps_params.mode = capability & PPS_CAPTUREASSERT; + if (!up->pps_params.mode) { + msyslog(LOG_ERR, + "refclock_atom: invalid capture edge %d", + pps_assert); + return (0); + } + up->pps_params.mode |= PPS_TSFMT_TSPEC; + if (time_pps_setparams(up->handle, &up->pps_params) < 0) { + msyslog(LOG_ERR, + "refclock_atom: time_pps_setparams failed: %m"); + return (0); + } + if (enb_hardpps) { + if (time_pps_kcbind(up->handle, PPS_KC_HARDPPS, + up->pps_params.mode & ~PPS_TSFMT_TSPEC, + PPS_TSFMT_TSPEC) < 0) { + msyslog(LOG_ERR, + "refclock_atom: time_pps_kcbind failed: %m"); return (0); } + pps_enable = 1; } -#endif /* TTYCLK */ - - /* - * Initialize miscellaneous variables - */ - peer->precision = PRECISION; - pp->clockdesc = DESCRIPTION; - memcpy((char *)&pp->refid, REFID, 4); - up->flags = flags; +#if DEBUG + if (debug) { + time_pps_getparams(up->handle, &up->pps_params); + printf( + "refclock_ppsapi: fd %d capability 0x%x version %d mode 0x%x kern %d\n", + up->fddev, capability, up->pps_params.api_version, + up->pps_params.mode, enb_hardpps); + } +#endif return (1); } @@ -239,181 +287,122 @@ atom_start( */ static void atom_shutdown( - int unit, - struct peer *peer + int unit, /* unit number (not used) */ + struct peer *peer /* peer structure pointer */ ) { - register struct atomunit *up; struct refclockproc *pp; + register struct ppsunit *up; pp = peer->procptr; - up = (struct atomunit *)pp->unitptr; -#ifdef TTYCLK - if (up->flags & FLAG_TTY) - io_closeclock(&pp->io); -#endif /* TTYCLK */ + up = (struct ppsunit *)pp->unitptr; + if (up->fddev > 0) + close(up->fddev); + if (up->handle != 0) + time_pps_destroy(up->handle); if (pps_peer == peer) pps_peer = 0; free(up); } -#if defined(PPS) || defined(HAVE_PPSAPI) /* - * atom_pps - receive data from the LDISC_PPS discipline + * atom_pps - receive data from the PPSAPI interface + * + * This routine is called once per second when the PPSAPI interface is + * present. It snatches the PPS timestamp from the kernel and saves the + * sign-extended fraction in a circular buffer for processing at the + * next poll event. */ static int atom_pps( - struct peer *peer + struct peer *peer /* peer structure pointer */ ) { - register struct atomunit *up; + register struct ppsunit *up; struct refclockproc *pp; -#ifdef HAVE_PPSAPI - struct timespec timeout; -# ifdef HAVE_TIMESPEC - struct timespec ts; -# else - struct timeval ts; -# endif /* HAVE_TIMESPEC */ -#endif /* HAVE_PPSAPI */ - l_fp lftmp; - double doffset; - int i; -#if !defined(HAVE_PPSAPI) - int request = -# ifdef HAVE_CIOGETEV - CIOGETEV -# endif -# ifdef HAVE_TIOCGPPSEV - TIOCGPPSEV -# endif - ; -#endif /* HAVE_PPSAPI */ + pps_info_t pps_info; + struct timespec timeout, ts; + double dtemp; /* - * This routine is called once per second when the LDISC_PPS - * discipline is present. It snatches the pps timestamp from the - * kernel and saves the sign-extended fraction in a circular - * buffer for processing at the next poll event. - */ - pp = peer->procptr; - up = (struct atomunit *)pp->unitptr; - - /* - * Convert the timeval to l_fp and save for billboards. Sign- - * extend the fraction and stash in the buffer. No harm is done - * if previous data are overwritten. If the discipline comes bum - * or the data grow stale, just forget it. Round the nanoseconds - * to microseconds with great care. + * Convert the timespec nanoseconds field to signed double and + * save in the median filter. for billboards. No harm is done if + * previous data are overwritten. If the discipline comes bum or + * the data grow stale, just forget it. A range gate rejects new + * samples if less than a jiggle time from the next second. */ - if (fdpps <= 0) - return (1); -#ifdef HAVE_PPSAPI + pp = peer->procptr; + up = (struct ppsunit *)pp->unitptr; + if (up->handle == 0) + return (-1); timeout.tv_sec = 0; timeout.tv_nsec = 0; - i = up->pps_info.assert_sequence; - if (time_pps_fetch(fdpps, PPS_TSFMT_TSPEC, &up->pps_info, &timeout) - < 0) - return (2); - if (i == up->pps_info.assert_sequence) - return (3); - if (pps_assert) + memcpy(&pps_info, &up->pps_info, sizeof(pps_info_t)); + if (time_pps_fetch(up->handle, PPS_TSFMT_TSPEC, &up->pps_info, + &timeout) < 0) + return (-1); + if (up->pps_params.mode & PPS_CAPTUREASSERT) { + if (pps_info.assert_sequence == + up->pps_info.assert_sequence) + return (1); ts = up->pps_info.assert_timestamp; - else + } else if (up->pps_params.mode & PPS_CAPTURECLEAR) { + if (pps_info.clear_sequence == + up->pps_info.clear_sequence) + return (1); ts = up->pps_info.clear_timestamp; - pp->lastrec.l_ui = ts.tv_sec + JAN_1970; - ts.tv_nsec = (ts.tv_nsec + 500) / 1000; - if (ts.tv_nsec > 1000000) { - ts.tv_nsec -= 1000000; - ts.tv_sec++; + } else { + return (-1); } - TVUTOTSF(ts.tv_nsec, pp->lastrec.l_uf); -#else - i = up->ev.serial; - if (ioctl(fdpps, request, (caddr_t)&up->ev) < 0) - return (2); - if (i == up->ev.serial) - return (3); - pp->lastrec.l_ui = up->ev.tv.tv_sec + JAN_1970; - TVUTOTSF(up->ev.tv.tv_usec, pp->lastrec.l_uf); -#endif /* HAVE_PPSAPI */ - up->flags |= FLAG_PPS; - L_CLR(&lftmp); - L_ADDF(&lftmp, pp->lastrec.l_f); - LFPTOD(&lftmp, doffset); - SAMPLE(-doffset + pp->fudgetime1); + if (!((ts.tv_sec == up->ts.tv_sec && ts.tv_nsec - + up->ts.tv_nsec > NANOSECOND - RANGEGATE) || + (ts.tv_sec - up->ts.tv_sec == 1 && ts.tv_nsec - + up->ts.tv_nsec < RANGEGATE))) { + up->ts = ts; + return (1); + } + up->ts = ts; + pp->lastrec.l_ui = ts.tv_sec + JAN_1970; + dtemp = ts.tv_nsec * FRAC / 1e9; + if (dtemp >= FRAC) + pp->lastrec.l_ui++; + pp->lastrec.l_uf = (u_int32)dtemp; + if (ts.tv_nsec > NANOSECOND / 2) + ts.tv_nsec -= NANOSECOND; + dtemp = -(double)ts.tv_nsec / NANOSECOND; + SAMPLE(dtemp + pp->fudgetime1); +#ifdef DEBUG + if (debug > 1) + printf("atom_pps %f %f\n", dtemp, pp->fudgetime1); +#endif return (0); } -#endif /* PPS || HAVE_PPSAPI */ - -#ifdef TTYCLK -/* - * atom_receive - receive data from the LDISC_CLK discipline - */ -static void -atom_receive( - struct recvbuf *rbufp - ) -{ - register struct atomunit *up; - struct refclockproc *pp; - struct peer *peer; - l_fp lftmp; - double doffset; - - /* - * This routine is called once per second when the serial - * interface is in use. It snatches the timestamp from the - * buffer and saves the sign-extended fraction in a circular - * buffer for processing at the next poll event. - */ - peer = (struct peer *)rbufp->recv_srcclock; - pp = peer->procptr; - up = (struct atomunit *)pp->unitptr; - pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, - &pp->lastrec); +#endif /* HAVE_PPSAPI */ - /* - * Save the timestamp for billboards. Sign-extend the fraction - * and stash in the buffer. No harm is done if previous data are - * overwritten. Do this only if the ppsclock gizmo is not - * working. - */ - if (up->flags & FLAG_PPS) - return; - L_CLR(&lftmp); - L_ADDF(&lftmp, pp->lastrec.l_f); - LFPTOD(&lftmp, doffset); - SAMPLE(-doffset + pp->fudgetime1); -} -#endif /* TTYCLK */ /* * pps_sample - receive PPS data from some other clock driver + * + * This routine is called once per second when the external clock driver + * processes PPS information. It processes the PPS timestamp and saves + * the sign-extended fraction in a circular buffer for processing at the + * next poll event. This works only for a single PPS device. */ int pps_sample( - l_fp *offset + l_fp *offset /* PPS offset */ ) { register struct peer *peer; - register struct atomunit *up; struct refclockproc *pp; l_fp lftmp; double doffset; - /* - * This routine is called once per second when the external - * clock driver processes PPS information. It processes the pps - * timestamp and saves the sign-extended fraction in a circular - * buffer for processing at the next poll event. - */ peer = pps_peer; if (peer == 0) /* nobody home */ - return 1; + return (1); pp = peer->procptr; - up = (struct atomunit *)pp->unitptr; /* * Convert the timeval to l_fp and save for billboards. Sign- @@ -421,7 +410,6 @@ pps_sample( * if previous data are overwritten. If the discipline comes bum * or the data grow stale, just forget it. */ - up->flags |= FLAG_AUX; pp->lastrec = *offset; L_CLR(&lftmp); L_ADDF(&lftmp, pp->lastrec.l_f); @@ -432,63 +420,81 @@ pps_sample( /* * atom_poll - called by the transmit procedure + * + * This routine is called once per second when in burst mode to save PPS + * sample offsets in the median filter. At the end of the burst period + * the samples are processed as a heap and the clock filter updated. */ static void atom_poll( - int unit, - struct peer *peer + int unit, /* unit number (not used) */ + struct peer *peer /* peer structure pointer */ ) { -#if defined(PPS) || defined(HAVE_PPSAPI) - register struct atomunit *up; -#endif /* PPS || HAVE_PPSAPI */ struct refclockproc *pp; +#ifdef HAVE_PPSAPI + int err; +#endif /* HAVE_PPSAPI */ /* - * Accumulate samples in the median filter. At the end of each - * poll interval, do a little bookeeping and process the - * samples. + * Accumulate samples in the median filter. If a noise sample, + * return with no prejudice; if a protocol error, get mean; + * otherwise, cool. At the end of each poll interval, do a + * little bookeeping and process the surviving samples. */ pp = peer->procptr; -#if defined(PPS) || defined(HAVE_PPSAPI) - up = (struct atomunit *)pp->unitptr; - if (!(up->flags & !(FLAG_AUX | FLAG_TTY))) { - int err; - - err = atom_pps(peer); - if (err > 0) { - refclock_report(peer, CEVNT_FAULT); - return; - } - } -#endif /* PPS || HAVE_PPSAPI */ pp->polls++; - if (peer->burst > 0) - return; - if (pp->coderecv == pp->codeproc) { - refclock_report(peer, CEVNT_TIMEOUT); +#ifdef HAVE_PPSAPI + err = atom_pps(peer); + if (err < 0) { + refclock_report(peer, CEVNT_FAULT); return; } +#endif /* HAVE_PPSAPI */ /* - * Valid time (leap bits zero) is returned only if the prefer - * peer has survived the intersection algorithm and within - * clock_max of local time and not too long ago. This ensures - * the pps time is within +-0.5 s of the local time and the - * seconds numbering is unambiguous. + * Valid time is returned only if the prefer peer has survived + * the intersection algorithm and within clock_max of local time + * and not too long ago. This ensures the PPS time is within + * +-0.5 s of the local time and the seconds numbering is + * unambiguous. Note that the leap bits are set no-warning on + * the first valid update and the stratum is set at the prefer + * peer. */ - if (pps_update) { - pp->leap = LEAP_NOWARNING; - } else { - pp->leap = LEAP_NOTINSYNC; + if (peer->burst > 0) + return; + peer->stratum = STRATUM_UNSPEC; + if (pp->codeproc == pp->coderecv) { + refclock_report(peer, CEVNT_TIMEOUT); + peer->burst = ASTAGE; + return; + + } else if (!sys_prefer) { + pp->codeproc = pp->coderecv; + peer->burst = ASTAGE; + return; + + } else if (fabs(sys_prefer->offset) > clock_max) { + pp->codeproc = pp->coderecv; + peer->burst = ASTAGE; return; } - pp->variance = 0; - record_clock_stats(&peer->srcadr, pp->a_lastcode); + peer->stratum = sys_prefer->stratum; + if (peer->stratum <= 1) + peer->refid = pp->refid; + else + peer->refid = peer->srcadr.sin_addr.s_addr; + pp->leap = LEAP_NOWARNING; refclock_receive(peer); - peer->burst = MAXSTAGE; + peer->burst = ASTAGE; } - #else int refclock_atom_bs; +int +pps_sample( + l_fp *offset /* PPS offset */ + ) +{ + return 1; +} #endif /* REFCLOCK */ diff --git a/contrib/ntp/ntpd/refclock_bancomm.c b/contrib/ntp/ntpd/refclock_bancomm.c index 95c211b..a3debcb 100644 --- a/contrib/ntp/ntpd/refclock_bancomm.c +++ b/contrib/ntp/ntpd/refclock_bancomm.c @@ -32,12 +32,6 @@ #endif #if defined(REFCLOCK) && defined(CLOCK_BANC) -#include <stdio.h> -#include <syslog.h> -#include <ctype.h> -#include <string.h> -#include <strings.h> -#include <sys/time.h> #include "ntpd.h" #include "ntp_io.h" @@ -45,6 +39,10 @@ #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <syslog.h> +#include <ctype.h> + /* STUFF BY RES */ struct btfp_time /* Structure for reading 5 time words */ /* in one ioctl(2) operation. */ @@ -83,11 +81,6 @@ struct vmedate { /* structure returned by get_vmetime.c */ /* END OF STUFF FROM RES */ /* - * Definitions - */ -#define MAXUNITS 2 /* max number of VME units */ - -/* * VME interface parameters. */ #define VMEPRECISION (-21) /* precision assumed (1 us) */ @@ -119,14 +112,6 @@ struct vmeunit { }; /* - * Keep the fudge factors separately so they can be set even - * when no clock is configured. - */ -static double fudgefactor[MAXUNITS]; -static u_char stratumtouse[MAXUNITS]; -static u_char sloppyclockflag[MAXUNITS]; - -/* * Function prototypes */ static void vme_init (void); @@ -140,35 +125,18 @@ struct vmedate *get_datumtime(struct vmedate *); * Transfer vector */ struct refclock refclock_bancomm = { - vme_start, - vme_shutdown, - vme_poll, - noentry, /* not used (old vme_control) */ - vme_init, - noentry, /* not used (old vme_buginfo) */ - NOFLAGS + vme_start, /* start up driver */ + vme_shutdown, /* shut down driver */ + vme_poll, /* transmit poll message */ + noentry, /* not used (old vme_control) */ + noentry, /* initialize driver */ + noentry, /* not used (old vme_buginfo) */ + NOFLAGS /* not used */ }; int fd_vme; /* file descriptor for ioctls */ int regvalue; -/* - * vme_init - initialize internal vme driver data - */ -static void -vme_init(void) -{ - register int i; - - /* - * Initialize fudge factors to default. - */ - for (i = 0; i < MAXUNITS; i++) { - fudgefactor[i] = 0.0; - stratumtouse[i] = 0; - sloppyclockflag[i] = 0; - } -} /* * vme_start - open the VME device and initialize data for processing @@ -185,14 +153,6 @@ vme_start( char vmedev[20]; /* - * Check configuration info. - */ - if (unit >= MAXUNITS) { - msyslog(LOG_ERR, "vme_start: unit %d invalid", unit); - return (0); - } - - /* * Open VME device */ #ifdef DEBUG @@ -236,13 +196,8 @@ vme_start( * return success. Note that root delay and root dispersion are * always zero for this clock. */ - pp->leap = LEAP_NOWARNING; peer->precision = VMEPRECISION; - peer->stratum = stratumtouse[unit]; - memcpy( (char *)&peer->refid, USNOREFID,4); - - peer->refid = htonl(VMEHSREFID); - + memcpy(&pp->refid, USNOREFID,4); return (1); } @@ -258,17 +213,11 @@ vme_shutdown( { register struct vmeunit *vme; struct refclockproc *pp; - - pp = peer->procptr; - - if (unit >= MAXUNITS) { - msyslog(LOG_ERR, "vme_shutdown: unit %d invalid", unit); - return; - } /* * Tell the I/O module to turn us off. We're history. */ + pp = peer->procptr; vme = (struct vmeunit *)pp->unitptr; io_closeclock(&pp->io); pp->unitptr = NULL; diff --git a/contrib/ntp/ntpd/refclock_chronolog.c b/contrib/ntp/ntpd/refclock_chronolog.c index 2982ecc..9273a84 100644 --- a/contrib/ntp/ntpd/refclock_chronolog.c +++ b/contrib/ntp/ntpd/refclock_chronolog.c @@ -13,17 +13,15 @@ #if defined(REFCLOCK) && defined(CLOCK_CHRONOLOG) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_calendar.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the Chronolog K-series WWVB receiver. * diff --git a/contrib/ntp/ntpd/refclock_chu.c b/contrib/ntp/ntpd/refclock_chu.c index 4235b8e..10fcea5 100644 --- a/contrib/ntp/ntpd/refclock_chu.c +++ b/contrib/ntp/ntpd/refclock_chu.c @@ -7,20 +7,19 @@ #if defined(REFCLOCK) && defined(CLOCK_CHU) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> -#include <math.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_calendar.h" #include "ntp_stdlib.h" -#ifdef AUDIO_CHU + +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#ifdef HAVE_AUDIO #include "audio.h" -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ #define ICOM 1 /* undefine to suppress ICOM code */ @@ -173,10 +172,18 @@ * Fudge flag3 enables audio monitoring of the input signal. For this * purpose, the speaker volume must be set before the driver is started. * - * The ICOM code is normally compiled in the driver. It isn't used, - * unless the mode keyword on the server configuration command specifies - * a nonzero ICOM ID select code. The C-IV trace is turned on if the - * debug level is greater than one. + * The audio codec code is normally compiled in the driver if the + * architecture supports it (HAVE_AUDIO defined), but is used only if the + * link /dev/chu_audio is defined and valid. The serial port + * code is alwasy compiled in the driver, but is used only if the autdio + * codec is not available and the link /dev/chu%d is defined and valid. + * The ICOM code is normally compiled in the driver if selected (ICOM + * defined), but is used only if the link /dev/icom%d is defined and + * valid and the mode keyword on the server configuration command + * specifies a nonzero mode (ICOM ID select code). The C-IV speed is + * 9600 bps if the high order 0x80 bit of the mode is zero and 1200 bps + * if one. The C-IV trace is turned on if the debug level is greater + * than one. */ /* * Interface definitions @@ -184,12 +191,13 @@ #define SPEED232 B300 /* uart speed (300 baud) */ #define PRECISION (-10) /* precision assumed (about 1 ms) */ #define REFID "CHU" /* reference ID */ +#define DEVICE "/dev/chu%d" /* device name and unit */ +#define SPEED232 B300 /* UART speed (300 baud) */ #ifdef ICOM #define DWELL 5 /* minutes before qsy */ #define NCHAN 3 /* number of channels */ #endif /* ICOM */ -#ifdef AUDIO_CHU -#define DESCRIPTION "CHU Modem Receiver" /* WRU */ +#ifdef HAVE_AUDIO /* * Audio demodulator definitions @@ -202,11 +210,11 @@ #define LIMIT 1000. /* soft limiter threshold */ #define AGAIN 6. /* baseband gain */ #define LAG 10 /* discriminator lag */ +#define DEVICE_AUDIO "/dev/chu_audio" /* device name */ +#define DESCRIPTION "CHU Audio/Modem Receiver" /* WRU */ #else -#define DEVICE "/dev/chu%d" /* device name and unit */ -#define SPEED232 B300 /* UART speed (300 baud) */ -#define DESCRIPTION "CHU Audio Receiver" /* WRU */ -#endif /* AUDIO_CHU */ +#define DESCRIPTION "CHU Modem Receiver" /* WRU */ +#endif /* HAVE_AUDIO */ /* * Decoder definitions @@ -255,14 +263,14 @@ #define DECERR 0x04 /* data decoding error */ #define TSPERR 0x08 /* insufficient data */ -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO struct surv { double shift[12]; /* mark register */ double es_max, es_min; /* max/min envelope signals */ double dist; /* sample distance */ int uart; /* decoded character */ }; -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ /* * CHU unit control structure @@ -279,9 +287,9 @@ struct chuunit { int bufptr; /* buffer index pointer */ char ident[10]; /* transmitter frequency */ #ifdef ICOM + int fd_icom; /* ICOM file descriptor */ int chan; /* frequency identifier */ int dwell; /* dwell minutes at current frequency */ - int fd_icom; /* ICOM file descriptor */ #endif /* ICOM */ /* @@ -304,10 +312,11 @@ struct chuunit { int tai; /* TAI - UTC correction */ int dst; /* Canadian DST code */ -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO /* * Audio codec variables */ + int fd_audio; /* audio port file descriptor */ double comp[SIZE]; /* decompanding table */ int port; /* codec port */ int gain; /* codec gain */ @@ -333,7 +342,7 @@ struct chuunit { struct surv surv[8]; /* UART survivor structures */ int decptr; /* decode pointer */ int dbrk; /* holdoff counter */ -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ }; /* @@ -354,11 +363,13 @@ static void chu_a P((struct peer *, int)); static void chu_b P((struct peer *, int)); static int chu_dist P((int, int)); static int chu_major P((struct peer *)); -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO static void chu_uart P((struct surv *, double)); static void chu_rf P((struct peer *, double)); static void chu_gain P((struct peer *)); -#endif /* AUDIO_CHU */ +static void chu_audio_receive P((struct recvbuf *rbufp)); +#endif /* HAVE_AUDIO */ +static void chu_serial_receive P((struct recvbuf *rbufp)); /* * Global variables @@ -393,43 +404,52 @@ chu_start( { struct chuunit *up; struct refclockproc *pp; + char device[20]; /* device name */ int fd; /* file descriptor */ #ifdef ICOM char tbuf[80]; /* trace buffer */ int temp; #endif /* ICOM */ -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO + int fd_audio; /* audio port file descriptor */ int i; /* index */ double step; /* codec adjustment */ /* - * Open audio device + * Open audio device. */ - fd = audio_init(); - if (fd < 0) - return (0); + fd_audio = audio_init(DEVICE_AUDIO); #ifdef DEBUG - if (debug) + if (fd_audio > 0 && debug) audio_show(); #endif -#else - char device[20]; /* device name */ /* * Open serial port in raw mode. */ - (void)sprintf(device, DEVICE, unit); - if (!(fd = refclock_open(device, SPEED232, LDISC_RAW))) { - return (0); + if (fd_audio > 0) { + fd = fd_audio; + } else { + sprintf(device, DEVICE, unit); + fd = refclock_open(device, SPEED232, LDISC_RAW); } -#endif /* AUDIO_CHU */ +#else /* HAVE_AUDIO */ + + /* + * Open serial port in raw mode. + */ + sprintf(device, DEVICE, unit); + fd = refclock_open(device, SPEED232, LDISC_RAW); +#endif /* HAVE_AUDIO */ + if (fd <= 0) + return (0); /* * Allocate and initialize unit structure */ if (!(up = (struct chuunit *) emalloc(sizeof(struct chuunit)))) { - (void) close(fd); + close(fd); return (0); } memset((char *)up, 0, sizeof(struct chuunit)); @@ -440,7 +460,7 @@ chu_start( pp->io.datalen = 0; pp->io.fd = fd; if (!io_addclock(&pp->io)) { - (void)close(fd); + close(fd); free(up); return (0); } @@ -452,13 +472,15 @@ chu_start( pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); DTOLFP(CHAR, &up->charstamp); -#ifdef AUDIO_CHU - up->gain = 127; +#ifdef HAVE_AUDIO /* * The companded samples are encoded sign-magnitude. The table - * contains all the 256 values in the interest of speed. + * contains all the 256 values in the interest of speed. We do + * this even if the audio codec is not available. C'est la lazy. */ + up->fd_audio = fd_audio; + up->gain = 127; up->comp[0] = up->comp[OFFSET] = 0.; up->comp[1] = 1; up->comp[OFFSET + 1] = -1.; up->comp[2] = 3; up->comp[OFFSET + 2] = -3.; @@ -470,7 +492,7 @@ chu_start( step *= 2.; } DTOLFP(1. / SECOND, &up->tick); -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ strcpy(up->ident, "X"); #ifdef ICOM temp = 0; @@ -478,8 +500,8 @@ chu_start( if (debug > 1) temp = P_TRACE; #endif - if (peer->ttl > 0) { - if (peer->ttl & 0x80) + if (peer->ttlmax > 0) { + if (peer->ttlmax & 0x80) up->fd_icom = icom_init("/dev/icom", B1200, temp); else @@ -487,7 +509,7 @@ chu_start( temp); } if (up->fd_icom > 0) { - if (icom_freq(up->fd_icom, peer->ttl & 0x7f, + if (icom_freq(up->fd_icom, peer->ttlmax & 0x7f, qsy[up->chan]) < 0) { NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT) msyslog(LOG_ERR, @@ -524,22 +546,58 @@ chu_shutdown( pp = peer->procptr; up = (struct chuunit *)pp->unitptr; + if (up == NULL) + return; io_closeclock(&pp->io); if (up->fd_icom > 0) close(up->fd_icom); free(up); } -#ifdef AUDIO_CHU - /* - * chu_receive - receive data from the audio device + * chu_receive - receive data from the audio or serial device */ static void chu_receive( struct recvbuf *rbufp /* receive buffer structure pointer */ ) { +#ifdef HAVE_AUDIO + struct chuunit *up; + struct refclockproc *pp; + struct peer *peer; + + peer = (struct peer *)rbufp->recv_srcclock; + pp = peer->procptr; + up = (struct chuunit *)pp->unitptr; + + /* + * If the audio codec is warmed up, the buffer contains codec + * samples which need to be demodulated and decoded into CHU + * characters using the software UART. Otherwise, the buffer + * contains CHU characters from the serial port, so the software + * UART is bypassed. In this case the CPU will probably run a + * few degrees cooler. + */ + if (up->fd_audio > 0) + chu_audio_receive(rbufp); + else + chu_serial_receive(rbufp); +#else + chu_serial_receive(rbufp); +#endif /* HAVE_AUDIO */ +} + +#ifdef HAVE_AUDIO + +/* + * chu_audio_receive - receive data from the audio device + */ +static void +chu_audio_receive( + struct recvbuf *rbufp /* receive buffer structure pointer */ + ) +{ struct chuunit *up; struct refclockproc *pp; struct peer *peer; @@ -712,9 +770,9 @@ chu_rf( up->disc[up->discptr] = limit; up->discptr = (up->discptr + 1 ) % LAG; if (disc >= 0) - disc = sqrt(disc); + disc = SQRT(disc); else - disc = -sqrt(-disc); + disc = -SQRT(-disc); /* * Lowpass filter. Raised cosine, Ts = 1 / 300, beta = 0.1. @@ -849,14 +907,14 @@ chu_uart( sp->es_min = es_min; sp->dist = dist / (11 * (es_max - es_min)); } +#endif /* HAVE_AUDIO */ -#else /* AUDIO_CHU */ /* - * chu_receive - receive data from the serial interface + * chu_serial_receive - receive data from the serial device */ static void -chu_receive( +chu_serial_receive( struct recvbuf *rbufp /* receive buffer structure pointer */ ) { @@ -877,11 +935,10 @@ chu_receive( dpt = (u_char *)&rbufp->recv_space; chu_decode(peer, *dpt); } -#endif /* AUDIO_CHU */ /* - * chu_decode - decode the data + * chu_decode - decode the character data */ static void chu_decode( @@ -1108,14 +1165,20 @@ chu_a( if (temp > 9 || k + 9 >= nchar || temp != ((up->cbuf[k + 9] >> 4) & 0xf)) temp = 0; -#ifdef AUDIO_CHU - sprintf(tbuf, "chuA %04x %4.0f %2d %2d %2d %2d %1d ", - up->status, up->maxsignal, nchar, up->burdist, k, - up->syndist, temp); +#ifdef HAVE_AUDIO + if (up->fd_audio) + sprintf(tbuf, "chuA %04x %4.0f %2d %2d %2d %2d %1d ", + up->status, up->maxsignal, nchar, up->burdist, k, + up->syndist, temp); + else + sprintf(tbuf, "chuA %04x %2d %2d %2d %2d %1d ", + up->status, nchar, up->burdist, k, up->syndist, + temp); + #else sprintf(tbuf, "chuA %04x %2d %2d %2d %2d %1d ", up->status, nchar, up->burdist, k, up->syndist, temp); -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ for (i = 0; i < nchar; i++) sprintf(&tbuf[strlen(tbuf)], "%02x", up->cbuf[i]); @@ -1221,7 +1284,7 @@ chu_poll( } else if (up->fd_icom > 0) { up->dwell = 0; up->chan = (up->chan + 1) % NCHAN; - icom_freq(up->fd_icom, peer->ttl & 0x7f, qsy[up->chan]); + icom_freq(up->fd_icom, peer->ttlmax & 0x7f, qsy[up->chan]); sprintf(up->ident, "%.3f", qsy[up->chan]); sprintf(tbuf, "chu: QSY to %s MHz", up->ident); record_clock_stats(&peer->srcadr, tbuf); @@ -1255,19 +1318,28 @@ chu_poll( } else { pp->leap = LEAP_NOWARNING; } -#ifdef AUDIO_CHU - sprintf(pp->a_lastcode, - "%c%1X %4d %3d %02d:%02d:%02d.000 %c%x %+d %d %d %s %d %d %d %d", - synchar, qual, pp->year, pp->day, pp->hour, pp->minute, - pp->second, leapchar, up->dst, up->dut, minset, up->gain, - up->ident, up->tai, up->burstcnt, up->mindist, up->ntstamp); +#ifdef HAVE_AUDIO + if (up->fd_audio) + sprintf(pp->a_lastcode, + "%c%1X %4d %3d %02d:%02d:%02d.000 %c%x %+d %d %d %s %d %d %d %d", + synchar, qual, pp->year, pp->day, pp->hour, + pp->minute, pp->second, leapchar, up->dst, up->dut, + minset, up->gain, up->ident, up->tai, up->burstcnt, + up->mindist, up->ntstamp); + else + sprintf(pp->a_lastcode, + "%c%1X %4d %3d %02d:%02d:%02d.000 %c%x %+d %d %s %d %d %d %d", + synchar, qual, pp->year, pp->day, pp->hour, + pp->minute, pp->second, leapchar, up->dst, up->dut, + minset, up->ident, up->tai, up->burstcnt, + up->mindist, up->ntstamp); #else sprintf(pp->a_lastcode, "%c%1X %4d %3d %02d:%02d:%02d.000 %c%x %+d %d %s %d %d %d %d", synchar, qual, pp->year, pp->day, pp->hour, pp->minute, pp->second, leapchar, up->dst, up->dut, minset, up->ident, up->tai, up->burstcnt, up->mindist, up->ntstamp); -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ pp->lencode = strlen(pp->a_lastcode); /* @@ -1390,7 +1462,6 @@ chu_major( return (0); } pp->lastref = offset; - pp->variance = 0; for (i = 0; i < up->ntstamp; i++) { toffset = offset; L_SUB(&toffset, &up->tstamp[i]); @@ -1462,7 +1533,7 @@ chu_dist( } -#ifdef AUDIO_CHU +#ifdef HAVE_AUDIO /* * chu_gain - adjust codec gain * @@ -1500,7 +1571,7 @@ chu_gain( audio_gain(up->gain, up->port); up->clipcnt = 0; } -#endif /* AUDIO_CHU */ +#endif /* HAVE_AUDIO */ #else diff --git a/contrib/ntp/ntpd/refclock_conf.c b/contrib/ntp/ntpd/refclock_conf.c index 71140c8..0e6c927 100644 --- a/contrib/ntp/ntpd/refclock_conf.c +++ b/contrib/ntp/ntpd/refclock_conf.c @@ -24,7 +24,7 @@ extern struct refclock refclock_local; #define refclock_local refclock_none #endif -#ifdef CLOCK_TRAK +#if defined(CLOCK_TRAK) && defined(PPS) extern struct refclock refclock_trak; #else #define refclock_trak refclock_none @@ -60,7 +60,7 @@ extern struct refclock refclock_parse; #define refclock_parse refclock_none #endif -#if defined(CLOCK_MX4200) && defined(PPS) +#if defined(CLOCK_MX4200) && defined(HAVE_PPSAPI) extern struct refclock refclock_mx4200; #else #define refclock_mx4200 refclock_none @@ -186,7 +186,7 @@ extern struct refclock refclock_palisade; #define refclock_palisade refclock_none #endif -#ifdef CLOCK_ONCORE +#if defined(CLOCK_ONCORE) && defined(HAVE_PPSAPI) extern struct refclock refclock_oncore; #else #define refclock_oncore refclock_none @@ -228,6 +228,17 @@ extern struct refclock refclock_fg; #define refclock_fg refclock_none #endif +#ifdef CLOCK_HOPF_SERIAL +extern struct refclock refclock_hopfser; +#else +#define refclock_hopfser refclock_none +#endif + +#ifdef CLOCK_HOPF_PCI +extern struct refclock refclock_hopfpci; +#else +#define refclock_hopfpci refclock_none +#endif /* * Order is clock_start(), clock_shutdown(), clock_poll(), @@ -273,7 +284,9 @@ struct refclock *refclock_conf[] = { &refclock_ulink, /* 34 REFCLOCK_ULINK */ &refclock_pcf, /* 35 REFCLOCK_PCF */ &refclock_wwv, /* 36 REFCLOCK_WWV_AUDIO */ - &refclock_fg /* 37 REFCLOCK_FG */ + &refclock_fg, /* 37 REFCLOCK_FG */ + &refclock_hopfser, /* 38 REFCLK_HOPF_SERIAL */ + &refclock_hopfpci /* 39 REFCLK_HOPF_PCI */ }; u_char num_refclock_conf = sizeof(refclock_conf)/sizeof(struct refclock *); diff --git a/contrib/ntp/ntpd/refclock_datum.c b/contrib/ntp/ntpd/refclock_datum.c index 74a37db..db03c95 100644 --- a/contrib/ntp/ntpd/refclock_datum.c +++ b/contrib/ntp/ntpd/refclock_datum.c @@ -17,16 +17,15 @@ ** Include Files */ -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + #if defined(HAVE_BSD_TTYS) #include <sgtty.h> #endif /* HAVE_BSD_TTYS */ @@ -45,10 +44,6 @@ #endif /* WWVBCLK */ #endif /* STREAM */ -#if defined (WWVBPPS) -#include <sys/ppsclock.h> -#endif /* WWVBPPS */ - #include "ntp_stdlib.h" /* @@ -120,8 +115,8 @@ */ -#define PTSPRECISION (-10) /* precision assumed 1/1024 ms */ -#define DATMREFID "DATM" /* reference id */ +#define PRECISION (-10) /* precision assumed 1/1024 ms */ +#define REFID "DATM" /* reference id */ #define DATUM_DISPERSION 0 /* fixed dispersion = 0 ms */ #define DATUM_MAX_ERROR 0.100 /* limits on sigma squared */ @@ -238,7 +233,6 @@ datum_pts_start( { struct datum_pts_unit **temp_datum_pts_unit; struct datum_pts_unit *datum_pts; - #ifdef HAVE_TERMIOS struct termios arg; #endif @@ -304,6 +298,10 @@ datum_pts_start( msyslog(LOG_ERR, "Datum_PTS: Termios not supported in this driver"); (void)close(datum_pts->PTS_fd); + peer->precision = PRECISION; + pp->clockdesc = DESCRIPTION; + memcpy((char *)&pp->refid, REFID, 4); + return 0; #endif @@ -331,10 +329,6 @@ datum_pts_start( return 0; } - peer->precision = PTSPRECISION; - peer->stratum = 0; - memcpy((char *)&peer->refid, DATMREFID, 4); - /* ** Now add one to the number of units and return a successful code */ @@ -438,7 +432,7 @@ datum_pts_poll( ) { int i; - int index; + int unit_index; int error_code; struct datum_pts_unit *datum_pts; @@ -451,10 +445,10 @@ datum_pts_poll( ** Find the right unit and send out a time request once it is found. */ - index = -1; + unit_index = -1; for (i=0; i<nunits; i++) { if (datum_pts_unit[i]->unit == unit) { - index = i; + unit_index = i; datum_pts = datum_pts_unit[i]; error_code = write(datum_pts->PTS_fd, TIME_REQUEST, 6); if (error_code != 6) perror("TIME_REQUEST"); @@ -467,7 +461,7 @@ datum_pts_poll( ** Print out an error message if we could not find the right unit. */ - if (index == -1) { + if (unit_index == -1) { #ifdef DEBUG_DATUM_PTC if (debug) diff --git a/contrib/ntp/ntpd/refclock_dumbclock.c b/contrib/ntp/ntpd/refclock_dumbclock.c index 8138d9e..c439646 100644 --- a/contrib/ntp/ntpd/refclock_dumbclock.c +++ b/contrib/ntp/ntpd/refclock_dumbclock.c @@ -14,17 +14,15 @@ #if defined(REFCLOCK) && defined(CLOCK_DUMBCLOCK) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_calendar.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports a generic dumb clock that only outputs hh:mm:ss, * in local time, no less. diff --git a/contrib/ntp/ntpd/refclock_fg.c b/contrib/ntp/ntpd/refclock_fg.c index f1320b0..655b6bc 100644 --- a/contrib/ntp/ntpd/refclock_fg.c +++ b/contrib/ntp/ntpd/refclock_fg.c @@ -8,8 +8,6 @@ #if defined(REFCLOCK) && defined(CLOCK_FG) -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" diff --git a/contrib/ntp/ntpd/refclock_gpsvme.c b/contrib/ntp/ntpd/refclock_gpsvme.c index b37466b..42eb2f9 100644 --- a/contrib/ntp/ntpd/refclock_gpsvme.c +++ b/contrib/ntp/ntpd/refclock_gpsvme.c @@ -16,19 +16,18 @@ #endif #if defined(REFCLOCK) && defined(CLOCK_GPSVME) -#include <stdio.h> -#include <syslog.h> -#include <ctype.h> -#include <string.h> -#include <strings.h> -#include <sys/time.h> -#include "gps.h" #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" + +#include <stdio.h> +#include <syslog.h> +#include <ctype.h> + +#include "gps.h" #include "/etc/conf/h/io.h" /* GLOBAL STUFF BY RES */ diff --git a/contrib/ntp/ntpd/refclock_heath.c b/contrib/ntp/ntpd/refclock_heath.c index 9d297d1..ef4db5a 100644 --- a/contrib/ntp/ntpd/refclock_heath.c +++ b/contrib/ntp/ntpd/refclock_heath.c @@ -1,5 +1,5 @@ /* - * refclock_heath - clock driver for Heath GC-1000 Most Accurate Clock + * refclock_heath - clock driver for Heath GC-1000 and and GC-1000 II */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -7,27 +7,18 @@ #if defined(REFCLOCK) && defined(CLOCK_HEATH) +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_refclock.h" +#include "ntp_stdlib.h" + #include <stdio.h> #include <ctype.h> -#ifdef TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -#else -# ifdef TM_IN_SYS_TIME -# include <sys/time.h> -# else -# include <time.h> -# endif -#endif + #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif /* not HAVE_SYS_IOCTL_H */ -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_refclock.h" -#include "ntp_stdlib.h" - /* * This driver supports the Heath GC-1000 Most Accurate Clock, with * RS232C Output Accessory. This is a WWV/WWVH receiver somewhat less @@ -41,15 +32,21 @@ * occasionally being rudely stepped when the offset exceeds the default * clock_max of 128 ms. * - * The internal DIPswitches should be set to operate at 1200 baud in - * MANUAL mode and the current year. The external DIPswitches should be - * set to GMT and 24-hour format, or to the host local time zone (with - * DST) and 12-hour format. It is very important that the year be - * set correctly in the DIPswitches. Otherwise, the day of year will be - * incorrect after 28 April[?] of a normal or leap year. In 12-hour mode - * with DST selected the clock will be incorrect by an hour for an - * indeterminate amount of time between 0000Z and 0200 on the day DST - * changes. + * There are two GC-1000 versions supported by this driver. The original + * GC-1000 with RS-232 output first appeared in 1983, but dissapeared + * from the market a few years later. The GC-1000 II with RS-232 output + * first appeared circa 1990, but apparently is no longer manufactured. + * The two models differ considerably, both in interface and commands. + * The GC-1000 has a pseudo-bipolar timecode output triggered by a RTS + * transition. The timecode includes both the day of year and time of + * day. The GC-1000 II has a true bipolar output and a complement of + * single character commands. The timecode includes only the time of + * day. + * + * GC-1000 + * + * The internal DIPswitches should be set to operate in MANUAL mode. The + * external DIPswitches should be set to GMT and 24-hour format. * * In MANUAL mode the clock responds to a rising edge of the request to * send (RTS) modem control line by sending the timecode. Therefore, it @@ -81,6 +78,72 @@ * established and hh:mm:ss.? once synchronization is established and * then lost again for about a day. * + * GC-1000 II + * + * Commands consist of a single letter and are case sensitive. When + * enterred in lower case, a description of the action performed is + * displayed. When enterred in upper case the action is performed. + * Following is a summary of descriptions as displayed by the clock: + * + * The clock responds with a command The 'A' command returns an ASCII + * local time string: HH:MM:SS.T xx<CR>, where + * + * HH = hours + * MM = minutes + * SS = seconds + * T = tenths-of-seconds + * xx = 'AM', 'PM', or ' ' + * <CR> = carriage return + * + * The 'D' command returns 24 pairs of bytes containing the variable + * divisor value at the end of each of the previous 24 hours. This + * allows the timebase trimming process to be observed. UTC hour 00 is + * always returned first. The first byte of each pair is the high byte + * of (variable divisor * 16); the second byte is the low byte of + * (variable divisor * 16). For example, the byte pair 3C 10 would be + * returned for a divisor of 03C1 hex (961 decimal). + * + * The 'I' command returns: | TH | TL | ER | DH | DL | U1 | I1 | I2 | , + * where + * + * TH = minutes since timebase last trimmed (high byte) + * TL = minutes since timebase last trimmed (low byte) + * ER = last accumulated error in 1.25 ms increments + * DH = high byte of (current variable divisor * 16) + * DL = low byte of (current variable divisor * 16) + * U1 = UT1 offset (/.1 s): | + | 4 | 2 | 1 | 0 | 0 | 0 | 0 | + * I1 = information byte 1: | W | C | D | I | U | T | Z | 1 | , + * where + * + * W = set by WWV(H) + * C = CAPTURE LED on + * D = TRIM DN LED on + * I = HI SPEC LED on + * U = TRIM UP LED on + * T = DST switch on + * Z = UTC switch on + * 1 = UT1 switch on + * + * I2 = information byte 2: | 8 | 8 | 4 | 2 | 1 | D | d | S | , + * where + * + * 8, 8, 4, 2, 1 = TIME ZONE switch settings + * D = DST bit (#55) in last-received frame + * d = DST bit (#2) in last-received frame + * S = clock is in simulation mode + * + * The 'P' command returns 24 bytes containing the number of frames + * received without error during UTC hours 00 through 23, providing an + * indication of hourly propagation. These bytes are updated each hour + * to reflect the previous 24 hour period. UTC hour 00 is always + * returned first. + * + * The 'T' command returns the UTC time: | HH | MM | SS | T0 | , where + * HH = tens-of-hours and hours (packed BCD) + * MM = tens-of-minutes and minutes (packed BCD) + * SS = tens-of-seconds and seconds (packed BCD) + * T = tenths-of-seconds (BCD) + * * Fudge Factors * * A fudge time1 value of .04 s appears to center the clock offset @@ -93,12 +156,12 @@ * Interface definitions */ #define DEVICE "/dev/heath%d" /* device name and unit */ -#define SPEED232 B1200 /* uart speed (1200 baud) */ #define PRECISION (-4) /* precision assumed (about 100 ms) */ #define REFID "WWV\0" /* reference ID */ #define DESCRIPTION "Heath GC-1000 Most Accurate Clock" /* WRU */ -#define LENHEATH 23 /* min timecode length */ +#define LENHEATH1 23 /* min timecode length */ +#define LENHEATH2 13 /* min timecode length */ /* * Tables to compute the ddd of year form icky dd/mm timecode. Viva la @@ -108,6 +171,12 @@ static int day1tab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static int day2tab[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; /* + * Baud rate table. The GC-1000 supports 1200, 2400 and 4800; the + * GC-1000 II supports only 9600. + */ +static int speed[] = {B1200, B2400, B4800, B9600}; + +/* * Unit control structure */ struct heathunit { @@ -136,65 +205,6 @@ struct refclock refclock_heath = { NOFLAGS /* not used */ }; -#if 0 -/* - * Gee, Unix so thoughfully omitted code to convert from a struct tm to - * a long, so I'll just have to ferret out the inverse myself, the hard way. - * (Newton's method.) - */ -#define timelocal(x) invert(x, localtime) -/* - * comparetm compares two tm structures and returns -1 if the first - * is less than the second, 0 if they are equal, and +1 if the first - * is greater than the second. Only the year, month, day, hour, minute - * and second are compared. The yearday (Julian), day of week, and isdst - * are not compared. - */ - -static int -comparetm( - struct tm *a, - struct tm *b - ) -{ - if (a->tm_year < b->tm_year ) return -1; - if (a->tm_year > b->tm_year ) return 1; - if (a->tm_mon < b->tm_mon ) return -1; - if (a->tm_mon > b->tm_mon ) return 1; - if (a->tm_mday < b->tm_mday ) return -1; - if (a->tm_mday > b->tm_mday ) return 1; - if (a->tm_hour < b->tm_hour ) return -1; - if (a->tm_hour > b->tm_hour ) return 1; - if (a->tm_min < b->tm_min ) return -1; - if (a->tm_min > b->tm_min ) return 1; - if (a->tm_sec < b->tm_sec ) return -1; - if (a->tm_sec > b->tm_sec ) return 1; - return 0; -} - -static long -invert ( - struct tm *x, - struct tm *(*func)() - ) -{ - struct tm *y; - int result; - long trial; - long lower=0L; - long upper=(long)((unsigned long)(~lower) >> 1); - - do { - trial = (upper + lower) / 2L; - y = (*func)(&trial); - result = comparetm(x, y); - if (result < 0) upper = trial; - if (result > 0) lower = trial; - } while (result != 0); - return trial; -} -#endif /* 0 */ - /* * heath_start - open the devices and initialize data for processing @@ -214,7 +224,7 @@ heath_start( * Open serial port */ (void)sprintf(device, DEVICE, unit); - if (!(fd = refclock_open(device, SPEED232, 0))) + if (!(fd = refclock_open(device, speed[peer->ttlmax & 0x3], 0))) return (0); /* @@ -291,7 +301,8 @@ heath_receive( peer = (struct peer *)rbufp->recv_srcclock; pp = peer->procptr; up = (struct heathunit *)pp->unitptr; - pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp); + pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, + &trtmp); /* * We get a buffer and timestamp for each <cr>; however, we use @@ -314,76 +325,37 @@ heath_receive( * its contents. If the timecode has invalid length or is not in * proper format, we declare bad format and exit. */ - if (pp->lencode < LENHEATH) { - refclock_report(peer, CEVNT_BADREPLY); - return; - } + switch (pp->lencode) { /* - * Timecode format: "hh:mm:ss.f AM mm/dd/yy" + * GC-1000 timecode format: "hh:mm:ss.f AM mm/dd/yy" + * GC-1000 II timecode format: "hh:mm:ss.f " */ - if (sscanf(pp->a_lastcode, "%2d:%2d:%2d.%c%5c%2d/%2d/%2d", - &pp->hour, &pp->minute, &pp->second, &dsec, a, &month, &day, - &pp->year) != 8) { - refclock_report(peer, CEVNT_BADREPLY); - return; - } - - /* - * If AM or PM is received, assume the clock is displaying local - * time. First, convert to 24-hour format. - */ - - switch (a[1]) { - case 'P': - if (12 > pp->hour) - pp->hour += 12; - break; - - case 'A': - if (12 == pp->hour) - pp->hour -= 12; + case LENHEATH1: + if (sscanf(pp->a_lastcode, + "%2d:%2d:%2d.%c%5c%2d/%2d/%2d", &pp->hour, + &pp->minute, &pp->second, &dsec, a, &month, &day, + &pp->year) != 8) { + refclock_report(peer, CEVNT_BADREPLY); + return; + } break; - } /* - * Now make a struct tm out of it, convert to UTC, and - * repopulate pp-> + * GC-1000 II timecode format: "hh:mm:ss.f " */ - - if (' ' != a[1]) { - struct tm t, *q; - time_t l; - - t.tm_sec = pp->second; - t.tm_min = pp->minute; - t.tm_hour = pp->hour; - t.tm_mday = day; /* not converted to yday yet */ - t.tm_mon = month-1; /* ditto */ - t.tm_year = pp->year; - if ( t.tm_year < YEAR_PIVOT ) t.tm_year += 100; /* Y2KFixes */ - - t.tm_wday = -1; /* who knows? */ - t.tm_yday = -1; /* who knows? */ - t.tm_isdst = -1; /* who knows? */ - - l = mktime(&t); - if (l == -1) { - /* HMS: do we want to do this? */ - refclock_report(peer, CEVNT_BADTIME); + case LENHEATH2: + if (sscanf(pp->a_lastcode, "%2d:%2d:%2d.%c", &pp->hour, + &pp->minute, &pp->second, &dsec) != 4) { + refclock_report(peer, CEVNT_BADREPLY); return; } - q = gmtime(&l); - - pp->year = q->tm_year; - month = q->tm_mon+1; - day = q->tm_mday; /* still not converted */ - pp->hour = q->tm_hour; - /* pp->minute = q->tm_min; GC-1000 cannot adjust timezone */ - /* pp->second = q->tm_sec; by other than hour increments */ - } + break; - + default: + refclock_report(peer, CEVNT_BADREPLY); + return; + } /* * We determine the day of the year from the DIPswitches. This @@ -396,11 +368,6 @@ heath_receive( * timecode accordingly. Icky pooh. This bit of nonsense could * be avoided if the engineers had been required to write a * device driver before finalizing the timecode format. - * - * Yes, I know this code incorrectly thinks that 2000 is a leap - * year; but, the latest year that can be set by the DIPswitches - * is 1997 anyay. Life is short. - * Hey! Year 2000 IS a leap year! Y2KFixes */ if (month < 1 || month > 12 || day < 1) { refclock_report(peer, CEVNT_BADTIME); @@ -460,17 +427,20 @@ heath_poll( pp->polls++; /* - * We toggle the RTS modem control lead to kick a timecode loose - * from the radio. This code works only for POSIX and SYSV - * interfaces. With bsd you are on your own. We take a timestamp - * between the up and down edges to lengthen the pulse, which - * should be about 50 usec on a Sun IPC. With hotshot CPUs, the - * pulse might get too short. Later. + * We toggle the RTS modem control lead (GC-1000) and sent a T + * (GC-1000 II) to kick a timecode loose from the radio. This + * code works only for POSIX and SYSV interfaces. With bsd you + * are on your own. We take a timestamp between the up and down + * edges to lengthen the pulse, which should be about 50 usec on + * a Sun IPC. With hotshot CPUs, the pulse might get too short. + * Later. */ if (ioctl(pp->io.fd, TIOCMBIC, (char *)&bits) < 0) refclock_report(peer, CEVNT_FAULT); get_systime(&up->tstamp); ioctl(pp->io.fd, TIOCMBIS, (char *)&bits); + if (write(pp->io.fd, "T", 1) != 1) + refclock_report(peer, CEVNT_FAULT); if (peer->burst > 0) return; if (pp->coderecv == pp->codeproc) { diff --git a/contrib/ntp/ntpd/refclock_hopfpci.c b/contrib/ntp/ntpd/refclock_hopfpci.c new file mode 100644 index 0000000..a9deb21 --- /dev/null +++ b/contrib/ntp/ntpd/refclock_hopfpci.c @@ -0,0 +1,274 @@ +/* + * refclock_hopfpci.c + * + * - clock driver for hopf 6039 PCI board (GPS or DCF77) + * Bernd Altmeier altmeier@atlsoft.de + * + * latest source and further information can be found at: + * http://www.ATLSoft.de/ntp + * + * In order to run this driver you have to install and test + * the PCI-board driver for your system first. + * + * On Linux/UNIX + * + * The driver attempts to open the device /dev/hopf6039 . + * The device entry will be made by the installation process of + * the kernel module for the PCI-bus board. The driver sources + * belongs to the delivery equipment of the PCI-board. + * + * On Windows NT/2000 + * + * The driver attempts to open the device by calling the function + * "OpenHopfDevice()". This function will be installed by the + * Device Driver for the PCI-bus board. The driver belongs to the + * delivery equipment of the PCI-board. + * + * + * Start 21.03.2000 Revision: 01.20 + * changes 22.12.2000 Revision: 01.40 flag1 = 1 sync even if Quarz + * + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if defined(REFCLOCK) && defined(CLOCK_HOPF_PCI) + +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_refclock.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" + +#undef fileno +#include <ctype.h> +#undef fileno + +#ifndef SYS_WINNT +# include <sys/ipc.h> +# include <assert.h> +# include <unistd.h> +# include <stdio.h> +# include "hopf6039.h" +#else +# include "hopf_PCI_io.h" +#endif + +/* + * hopfpci interface definitions + */ +#define PRECISION (-10) /* precision assumed (1 ms) */ +#define REFID "hopf" /* reference ID */ +#define DESCRIPTION "hopf Elektronik PCI radio board" + +#define NSAMPLES 3 /* stages of median filter */ +#ifndef SYS_WINNT +# define DEVICE "/dev/hopf6039" /* device name inode*/ +#else +# define DEVICE "hopf6039" /* device name WinNT */ +#endif + +#define LEWAPWAR 0x20 /* leap second warning bit */ + +#define HOPF_OPMODE 0xC0 /* operation mode mask */ +#define HOPF_INVALID 0x00 /* no time code available */ +#define HOPF_INTERNAL 0x40 /* internal clock */ +#define HOPF_RADIO 0x80 /* radio clock */ +#define HOPF_RADIOHP 0xC0 /* high precision radio clock */ + + +/* + * hopfclock unit control structure. + */ +struct hopfclock_unit { + short unit; /* NTP refclock unit number */ + char leap_status; /* leap second flag */ +}; +int fd; /* file descr. */ + +/* + * Function prototypes + */ +static int hopfpci_start (int, struct peer *); +static void hopfpci_shutdown (int, struct peer *); +static void hopfpci_poll (int unit, struct peer *); + +/* + * Transfer vector + */ +struct refclock refclock_hopfpci = { + hopfpci_start, /* start up driver */ + hopfpci_shutdown, /* shut down driver */ + hopfpci_poll, /* transmit poll message */ + noentry, /* not used */ + noentry, /* initialize driver (not used) */ + noentry, /* not used */ + NOFLAGS /* not used */ +}; + +/* + * hopfpci_start - attach to hopf PCI board 6039 + */ +static int +hopfpci_start( + int unit, + struct peer *peer + ) +{ + struct refclockproc *pp; + struct hopfclock_unit *up; + + /* + * Allocate and initialize unit structure + */ + up = (struct hopfclock_unit *) emalloc(sizeof(struct hopfclock_unit)); + + if (!(up)) { + msyslog(LOG_ERR, "hopfPCIClock(%d) emalloc: %m",unit); +#ifdef DEBUG + printf("hopfPCIClock(%d) emalloc\n",unit); +#endif + return (0); + } + memset((char *)up, 0, sizeof(struct hopfclock_unit)); + +#ifndef SYS_WINNT + + fd = open(DEVICE,O_RDWR); /* try to open hopf clock device */ + +#else + if (!OpenHopfDevice()){ + msyslog(LOG_ERR,"Start: %s unit: %d failed!",DEVICE,unit); + return (0); + } +#endif + + pp = peer->procptr; + pp->io.clock_recv = noentry; + pp->io.srcclock = (caddr_t)peer; + pp->io.datalen = 0; + pp->io.fd = -1; + pp->unitptr = (caddr_t)up; + + get_systime(&pp->lastrec); + + /* + * Initialize miscellaneous peer variables + */ + if (pp->unitptr!=0) { + memcpy((char *)&pp->refid, REFID, 4); + peer->precision = PRECISION; + pp->clockdesc = DESCRIPTION; + up->leap_status = 0; + up->unit = (short) unit; + return (1); + } + else { + return 0; + } +} + + +/* + * hopfpci_shutdown - shut down the clock + */ +static void +hopfpci_shutdown( + int unit, + struct peer *peer + ) +{ + struct refclockproc *pp; + register struct hopfpciTime *up; + + pp = peer->procptr; + up = (struct hopfpciTime *)pp->unitptr; + +#ifndef SYS_WINNT + close(fd); +#else + CloseHopfDevice(); +// UnmapViewOfFile (up); +#endif +} + + +/* + * hopfpci_poll - called by the transmit procedure + */ +static void +hopfpci_poll( + int unit, + struct peer *peer + ) +{ + struct refclockproc *pp; + register struct hopfpciTime *up; + HOPFTIME m_time; + + pp = peer->procptr; + up = (struct hopfpciTime *)pp->unitptr; + +#ifndef SYS_WINNT + ioctl(fd,HOPF_CLOCK_GET_UTC,&m_time); +#else + GetHopfSystemTime(&m_time); +#endif + pp->polls++; + + pp->day = ymd2yd(m_time.wYear,m_time.wMonth,m_time.wDay); + pp->hour = m_time.wHour; + pp->minute = m_time.wMinute; + pp->second = m_time.wSecond; + pp->msec=m_time.wMilliseconds; + pp->usec=0; + if (m_time.wStatus & LEWAPWAR) + pp->leap = LEAP_ADDSECOND; + else + pp->leap = LEAP_NOWARNING; + + sprintf(pp->a_lastcode,"ST: %02X T: %02d:%02d:%02d.%03d D: %02d.%02d.%04d", + m_time.wStatus, pp->hour, pp->minute, pp->second, pp->msec, + m_time.wDay, m_time.wMonth, m_time.wYear); + pp->lencode = strlen(pp->a_lastcode); + + get_systime(&pp->lastrec); + + /* + * If clock has no valid status then report error and exit + */ + if ((m_time.wStatus & HOPF_OPMODE) == HOPF_INVALID) { /* time ok? */ + refclock_report(peer, CEVNT_BADTIME); + pp->leap = LEAP_NOTINSYNC; + return; + } + + /* + * Test if time is running on internal quarz + * if CLK_FLAG1 is set, sychronize even if no radio operation + */ + + if ((m_time.wStatus & HOPF_OPMODE) == HOPF_INTERNAL){ + if ((pp->sloppyclockflag & CLK_FLAG1) == 0) { + refclock_report(peer, CEVNT_BADTIME); + pp->leap = LEAP_NOTINSYNC; + return; + } + } + + if (!refclock_process(pp)) { + refclock_report(peer, CEVNT_BADTIME); + return; + } + refclock_receive(peer); + + record_clock_stats(&peer->srcadr, pp->a_lastcode); + + return; +} + +#else +int refclock_hopfpci_bs; +#endif /* REFCLOCK */ diff --git a/contrib/ntp/ntpd/refclock_hopfser.c b/contrib/ntp/ntpd/refclock_hopfser.c new file mode 100644 index 0000000..a9d74dd --- /dev/null +++ b/contrib/ntp/ntpd/refclock_hopfser.c @@ -0,0 +1,372 @@ +/* + * + * refclock_hopfser.c + * - clock driver for hopf serial boards (GPS or DCF77) + * + * Date: 30.03.2000 Revision: 01.10 + * + * latest source and further information can be found at: + * http://www.ATLSoft.de/ntp + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if defined(REFCLOCK) && (defined(CLOCK_HOPF_SERIAL)) + +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_control.h" +#include "ntp_refclock.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" + +#if defined HAVE_SYS_MODEM_H +# include <sys/modem.h> +# define TIOCMSET MCSETA +# define TIOCMGET MCGETA +# define TIOCM_RTS MRTS +#endif + +#ifdef HAVE_TERMIOS_H +# ifdef TERMIOS_NEEDS__SVID3 +# define _SVID3 +# endif +# include <termios.h> +# ifdef TERMIOS_NEEDS__SVID3 +# undef _SVID3 +# endif +#endif + +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif + +/* + * clock definitions + */ +#define DESCRIPTION "hopf Elektronik serial clock" /* Long name */ +#define PRECISION (-10) /* precision assumed (about 1 ms) */ +#define REFID "hopf\0" /* reference ID */ +/* + * I/O definitions + */ +#define DEVICE "/dev/hopfclock%d" /* device name and unit */ +#define SPEED232 B9600 /* uart speed (9600 baud) */ + + +#define STX 0x02 +#define ETX 0x03 +#define CR 0x0c +#define LF 0x0a + +/* parse states */ +#define REC_QUEUE_EMPTY 0 +#define REC_QUEUE_FULL 1 + +#define HOPF_OPMODE 0x0C /* operation mode mask */ +#define HOPF_INVALID 0x00 /* no time code available */ +#define HOPF_INTERNAL 0x04 /* internal clock */ +#define HOPF_RADIO 0x08 /* radio clock */ +#define HOPF_RADIOHP 0x0C /* high precision radio clock */ + +/* + * hopfclock unit control structure. + */ +struct hopfclock_unit { + l_fp laststamp; /* last receive timestamp */ + short unit; /* NTP refclock unit number */ + u_long polled; /* flag to detect noreplies */ + char leap_status; /* leap second flag */ + int rpt_next; +}; + +/* + * Function prototypes + */ + +static int hopfserial_start P((int, struct peer *)); +static void hopfserial_shutdown P((int, struct peer *)); +static void hopfserial_receive P((struct recvbuf *)); +static void hopfserial_poll P((int, struct peer *)); +/* static void hopfserial_io P((struct recvbuf *)); */ +/* + * Transfer vector + */ +struct refclock refclock_hopfser = { + hopfserial_start, /* start up driver */ + hopfserial_shutdown, /* shut down driver */ + hopfserial_poll, /* transmit poll message */ + noentry, /* not used */ + noentry, /* initialize driver (not used) */ + noentry, /* not used */ + NOFLAGS /* not used */ +}; + +/* + * hopfserial_start - open the devices and initialize data for processing + */ +static int +hopfserial_start ( + int unit, + struct peer *peer + ) +{ + register struct hopfclock_unit *up; + struct refclockproc *pp; + int fd; + char gpsdev[20]; + +#ifdef SYS_WINNT + (void) sprintf(gpsdev, "COM%d:", unit); +#else + (void) sprintf(gpsdev, DEVICE, unit); +#endif + /* LDISC_STD, LDISC_RAW + * Open serial port. Use CLK line discipline, if available. + */ + fd = refclock_open(gpsdev, SPEED232, LDISC_CLK); + if (fd <= 0) { +#ifdef DEBUG + printf("hopfSerialClock(%d) start: open %s failed\n", unit, gpsdev); +#endif + return 0; + } + + msyslog(LOG_NOTICE, "hopfSerialClock(%d) fd: %d dev: %s", unit, fd, + gpsdev); + + /* + * Allocate and initialize unit structure + */ + up = (struct hopfclock_unit *) emalloc(sizeof(struct hopfclock_unit)); + + if (!(up)) { + msyslog(LOG_ERR, "hopfSerialClock(%d) emalloc: %m",unit); +#ifdef DEBUG + printf("hopfSerialClock(%d) emalloc\n",unit); +#endif + (void) close(fd); + return (0); + } + + memset((char *)up, 0, sizeof(struct hopfclock_unit)); + pp = peer->procptr; + pp->unitptr = (caddr_t)up; + pp->io.clock_recv = hopfserial_receive; + pp->io.srcclock = (caddr_t)peer; + pp->io.datalen = 0; + pp->io.fd = fd; + if (!io_addclock(&pp->io)) { +#ifdef DEBUG + printf("hopfSerialClock(%d) io_addclock\n",unit); +#endif + (void) close(fd); + free(up); + return (0); + } + + /* + * Initialize miscellaneous variables + */ + pp->clockdesc = DESCRIPTION; + peer->precision = PRECISION; + peer->burst = NSTAGE; + memcpy((char *)&pp->refid, REFID, 4); + + up->leap_status = 0; + up->unit = (short) unit; + + return (1); +} + + +/* + * hopfserial_shutdown - shut down the clock + */ +static void +hopfserial_shutdown ( + int unit, + struct peer *peer + ) +{ + register struct hopfclock_unit *up; + struct refclockproc *pp; + + pp = peer->procptr; + up = (struct hopfclock_unit *)pp->unitptr; + io_closeclock(&pp->io); + free(up); +} + + + +/* + * hopfserial_receive - receive data from the serial interface + */ + +static void +hopfserial_receive ( + struct recvbuf *rbufp + ) +{ + struct hopfclock_unit *up; + struct refclockproc *pp; + struct peer *peer; + + int sync; /* synchronization indicator */ + int DoW; /* Dow */ + + int day, month; /* ddd conversion */ + + /* + * Initialize pointers and read the timecode and timestamp. + */ + peer = (struct peer *)rbufp->recv_srcclock; + pp = peer->procptr; + up = (struct hopfclock_unit *)pp->unitptr; + + if (up->rpt_next == 0 ) + return; + + + up->rpt_next = 0; /* wait until next poll interval occur */ + + pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &pp->lastrec); + + if (pp->lencode == 0) + return; + + sscanf(pp->a_lastcode, +#if 1 + "%1x%1x%2d%2d%2d%2d%2d%2d", /* ...cr,lf */ +#else + "%*c%1x%1x%2d%2d%2d%2d%2d%2d", /* stx...cr,lf,etx */ +#endif + &sync, + &DoW, + &pp->hour, + &pp->minute, + &pp->second, + &day, + &month, + &pp->year); + + + /* + Validate received values at least enough to prevent internal + array-bounds problems, etc. + */ + if((pp->hour < 0) || (pp->hour > 23) || + (pp->minute < 0) || (pp->minute > 59) || + (pp->second < 0) || (pp->second > 60) /*Allow for leap seconds.*/ || + (day < 1) || (day > 31) || + (month < 1) || (month > 12) || + (pp->year < 0) || (pp->year > 99)) { + /* Data out of range. */ + refclock_report(peer, CEVNT_BADREPLY); + return; + } + /* + some preparations + */ + pp->day = ymd2yd(pp->year,month,day); + pp->leap=0; + + /* Year-2000 check! */ + /* wrap 2-digit date into 4-digit */ + + if(pp->year < YEAR_PIVOT) { pp->year += 100; } /* < 98 */ + pp->year += 1900; + + /* preparation for timecode ntpq rl command ! */ + +#if 0 + wsprintf(pp->a_lastcode, + "STATUS: %1X%1X, DATE: %02d.%02d.%04d TIME: %02d:%02d:%02d", + sync, + DoW, + day, + month, + pp->year, + pp->hour, + pp->minute, + pp->second); + + pp->lencode = strlen(pp->a_lastcode); + if ((sync && 0xc) == 0 ){ /* time ok? */ + refclock_report(peer, CEVNT_BADTIME); + pp->leap = LEAP_NOTINSYNC; + return; + } +#endif + /* + * If clock has no valid status then report error and exit + */ + if ((sync & HOPF_OPMODE) == HOPF_INVALID ){ /* time ok? */ + refclock_report(peer, CEVNT_BADTIME); + pp->leap = LEAP_NOTINSYNC; + return; + } + + /* + * Test if time is running on internal quarz + * if CLK_FLAG1 is set, sychronize even if no radio operation + */ + + if ((sync & HOPF_OPMODE) == HOPF_INTERNAL){ + if ((pp->sloppyclockflag & CLK_FLAG1) == 0) { + refclock_report(peer, CEVNT_BADTIME); + pp->leap = LEAP_NOTINSYNC; + return; + } + } + + + if (!refclock_process(pp)) { + refclock_report(peer, CEVNT_BADTIME); + return; + } + refclock_receive(peer); + +#if 0 + msyslog(LOG_ERR, " D:%x D:%d D:%d",sync,pp->minute,pp->second); +#endif + + record_clock_stats(&peer->srcadr, pp->a_lastcode); + + return; +} + + +/* + * hopfserial_poll - called by the transmit procedure + * + */ +static void +hopfserial_poll ( + int unit, + struct peer *peer + ) +{ + register struct hopfclock_unit *up; + struct refclockproc *pp; + pp = peer->procptr; + + up = (struct hopfclock_unit *)pp->unitptr; + + pp->polls++; + up->rpt_next = 1; + +#if 0 + record_clock_stats(&peer->srcadr, pp->a_lastcode); +#endif + + return; +} + +#else +int refclock_hopfser_bs; +#endif /* REFCLOCK */ diff --git a/contrib/ntp/ntpd/refclock_hpgps.c b/contrib/ntp/ntpd/refclock_hpgps.c index 30aa494..7a506cf 100644 --- a/contrib/ntp/ntpd/refclock_hpgps.c +++ b/contrib/ntp/ntpd/refclock_hpgps.c @@ -1,21 +1,21 @@ /* * refclock_hpgps - clock driver for HP 58503A GPS receiver */ + #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif #if defined(REFCLOCK) && defined(CLOCK_HPGPS) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* Version 0.1 April 1, 1995 * 0.2 April 25, 1995 * tolerant of missing timecode response prompt and sends diff --git a/contrib/ntp/ntpd/refclock_irig.c b/contrib/ntp/ntpd/refclock_irig.c index ab4b525..7efd57e 100644 --- a/contrib/ntp/ntpd/refclock_irig.c +++ b/contrib/ntp/ntpd/refclock_irig.c @@ -7,19 +7,19 @@ #if defined(REFCLOCK) && defined(CLOCK_IRIG) +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_refclock.h" +#include "ntp_calendar.h" +#include "ntp_stdlib.h" + #include <stdio.h> #include <ctype.h> -#include <sys/time.h> #include <math.h> #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif /* HAVE_SYS_IOCTL_H */ -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_refclock.h" -#include "ntp_calendar.h" -#include "ntp_stdlib.h" #include "audio.h" /* @@ -140,6 +140,7 @@ /* * Interface definitions */ +#define DEVICE_AUDIO "/dev/audio" /* audio device name */ #define PRECISION (-17) /* precision assumed (about 10 us) */ #define REFID "IRIG" /* reference ID */ #define DESCRIPTION "Generic IRIG Audio Driver" /* WRU */ @@ -310,7 +311,7 @@ irig_start( /* * Open audio device */ - fd = audio_init(); + fd = audio_init(DEVICE_AUDIO); if (fd < 0) return (0); #ifdef DEBUG diff --git a/contrib/ntp/ntpd/refclock_jupiter.c b/contrib/ntp/ntpd/refclock_jupiter.c index b337e0c..4d1d4c2 100644 --- a/contrib/ntp/ntpd/refclock_jupiter.c +++ b/contrib/ntp/ntpd/refclock_jupiter.c @@ -37,10 +37,6 @@ #if defined(REFCLOCK) && defined(CLOCK_JUPITER) && defined(PPS) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -48,6 +44,9 @@ #include "ntp_stdlib.h" #include "ntp_calendar.h" +#include <stdio.h> +#include <ctype.h> + #include "jupiter.h" #include <sys/ppsclock.h> @@ -681,7 +680,7 @@ jupiter_process(register struct peer *peer) */ for (i = 0; i < NSAMPLES; i++) off[i] = up->filter[i]; - qsort((char *)off, NSAMPLES, sizeof(l_fp), jupiter_cmpl_fp); + qsort((char *)off, (size_t)NSAMPLES, sizeof(l_fp), jupiter_cmpl_fp); /* * Reject the furthest from the median of NSAMPLES samples until diff --git a/contrib/ntp/ntpd/refclock_leitch.c b/contrib/ntp/ntpd/refclock_leitch.c index edee3f8..42b02fc 100644 --- a/contrib/ntp/ntpd/refclock_leitch.c +++ b/contrib/ntp/ntpd/refclock_leitch.c @@ -1,21 +1,21 @@ /* * refclock_leitch - clock driver for the Leitch CSD-5300 Master Clock */ + #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif #if defined(REFCLOCK) && defined(CLOCK_LEITCH) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" +#include <stdio.h> +#include <ctype.h> + #ifdef STREAM #include <stropts.h> #if defined(LEITCHCLK) diff --git a/contrib/ntp/ntpd/refclock_local.c b/contrib/ntp/ntpd/refclock_local.c index 12184db..a3e5773 100644 --- a/contrib/ntp/ntpd/refclock_local.c +++ b/contrib/ntp/ntpd/refclock_local.c @@ -8,14 +8,14 @@ #endif #ifdef REFCLOCK -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> #include "ntpd.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + #ifdef KERNEL_PLL #include "ntp_syscall.h" #endif @@ -34,7 +34,7 @@ * particular server's clock as the clock of last resort when all other * normal synchronization sources have gone away. This is especially * useful if that server has an ovenized oscillator. For this you would - * configure this driver at a higher stratum (say 3 or 4) to prevent the + * configure this driver at a higher stratum (say 5) to prevent the * server's stratum from falling below that. * * A third application for this driver is when an external discipline @@ -69,7 +69,7 @@ * * Fudge Factors * - * The stratum for this driver set at 3 by default, but it can be changed + * The stratum for this driver set at 5 by default, but it can be changed * by the fudge command and/or the ntpdc utility. The reference ID is * "LCL" by default, but can be changed using the same mechanism. *NEVER* * configure this driver to operate at a stratum which might possibly @@ -96,7 +96,7 @@ #define REFID "LCL\0" /* reference ID */ #define DESCRIPTION "Undisciplined local clock" /* WRU */ -#define STRATUM 3 /* default stratum */ +#define STRATUM 5 /* default stratum */ #define DISPERSION .01 /* default dispersion (10 ms) */ /* @@ -213,7 +213,7 @@ local_poll( refclock_process_offset(pp, pp->lastrec, pp->lastrec, pp->fudgetime1); pp->leap = LEAP_NOWARNING; pp->disp = DISPERSION; - pp->variance = 0; + pp->jitter = 0; #if defined(KERNEL_PLL) && defined(STA_CLK) /* @@ -246,7 +246,7 @@ local_poll( pp->leap = LEAP_NOTINSYNC; } pp->disp = ntv.maxerror / 1e6; - pp->variance = SQUARE(ntv.esterror / 1e6); + pp->jitter = SQUARE(ntv.esterror / 1e6); } } else { ext_enable = 0; diff --git a/contrib/ntp/ntpd/refclock_msfees.c b/contrib/ntp/ntpd/refclock_msfees.c index db6c6b1..b1aaa56 100644 --- a/contrib/ntp/ntpd/refclock_msfees.c +++ b/contrib/ntp/ntpd/refclock_msfees.c @@ -11,16 +11,13 @@ * (hence probably didn't work). Still in RCS file at cl.cam.ac.uk */ -#include <ctype.h> -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_calendar.h" + +#include <ctype.h> #if defined(HAVE_BSD_TTYS) #include <sgtty.h> #endif /* HAVE_BSD_TTYS */ @@ -1287,7 +1284,7 @@ ees_process( if (ees->dump_vals) dump_buf(coffs, 0, samples, "Raw data is:"); /* Sort the offsets, trim off the extremes, then choose one. */ - qsort((char *) coffs, (u_int)samples, sizeof(l_fp), offcompare); + qsort((char *) coffs, (size_t)samples, sizeof(l_fp), offcompare); noff = samples; i = 0; diff --git a/contrib/ntp/ntpd/refclock_mx4200.c b/contrib/ntp/ntpd/refclock_mx4200.c index f08bb23..3c520b0 100644 --- a/contrib/ntp/ntpd/refclock_mx4200.c +++ b/contrib/ntp/ntpd/refclock_mx4200.c @@ -47,11 +47,7 @@ # include <config.h> #endif -#if defined(REFCLOCK) && defined(CLOCK_MX4200) && defined(PPS) - -#include <stdio.h> -#include <ctype.h> -#include <sys/types.h> +#if defined(REFCLOCK) && defined(CLOCK_MX4200) && defined(HAVE_PPSAPI) #include "ntpd.h" #include "ntp_io.h" @@ -59,11 +55,11 @@ #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + #include "mx4200.h" -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif #ifdef HAVE_SYS_TERMIOS_H # include <sys/termios.h> #endif @@ -73,7 +69,7 @@ #ifndef HAVE_STRUCT_PPSCLOCKEV struct ppsclockev { -# ifdef HAVE_TIMESPEC +# ifdef HAVE_STRUCT_TIMESPEC struct timespec tv; # else struct timeval tv; @@ -82,6 +78,14 @@ struct ppsclockev { }; #endif /* ! HAVE_STRUCT_PPSCLOCKEV */ +#ifdef HAVE_TIMEPPS_H +# include <timepps.h> +#else +# ifdef HAVE_SYS_TIMEPPS_H +# include <sys/timepps.h> +# endif +#endif + /* * This driver supports the Magnavox Model MX 4200 GPS Receiver * adapted to precision timing applications. It requires the @@ -97,7 +101,7 @@ struct ppsclockev { /* * Check this every time you edit the code! */ -#define YEAR_RIGHT_NOW 1998 +#define YEAR_LAST_MODIFIED 2000 /* * GPS Definitions @@ -117,13 +121,6 @@ struct ppsclockev { /* * Position Averaging. - * Reference: Dr. Thomas A. Clark's Totally Accurate Clock (TAC) files at - * ftp://aleph.gsfc.nasa.gov/GPS/totally.accurate.clock/ - * For a 6-channel Motorola Oncore, he indicates that good nominal - * HDOP and VDOP are 1.50 and 2.00 respectively. Given the relationship - * HDOP^2 = NDOP^2 + EDOP^2 and assuming EDOP and NDOP are equal, we - * have a nominal NDOP = EDOP = sqrt((HDOP*HDOP)/2). An 8-channel - * Oncore does well with HDOP=1.20 and VDOP=1.70. */ #define INTERVAL 1 /* Interval between position measurements (s) */ #define AVGING_TIME 24 /* Number of hours to average */ @@ -141,18 +138,16 @@ struct mx4200unit { double avg_lon; /* average longitude */ double avg_alt; /* average height */ double central_meridian; /* central meridian */ - double filt_lat; /* latitude filter length */ - double filt_lon; /* longitude filter length */ - double filt_alt; /* height filter length */ - double edop; /* EDOP (east DOP) */ - double ndop; /* NDOP (north DOP) */ - double vdop; /* VDOP (vertical DOP) */ + double N_fixes; /* Number of position measurements */ int last_leap; /* leap second warning */ u_int moving; /* mobile platform? */ u_long sloppyclockflag; /* fudge flags */ u_int known; /* position known yet? */ u_long clamp_time; /* when to stop postion averaging */ u_long log_time; /* when to print receiver status */ + pps_handle_t pps_h; + pps_params_t pps_p; + pps_info_t pps_i; }; static char pmvxg[] = "PMVXG"; @@ -181,14 +176,13 @@ static void mx4200_poll P((int, struct peer *)); static char * mx4200_parse_t P((struct peer *)); static char * mx4200_parse_p P((struct peer *)); -static char * mx4200_parse_d P((struct peer *)); static char * mx4200_parse_s P((struct peer *)); #ifdef QSORT_USES_VOID_P int mx4200_cmpl_fp P((const void *, const void *)); #else int mx4200_cmpl_fp P((const l_fp *, const l_fp *)); #endif /* not QSORT_USES_VOID_P */ -static void mx4200_config P((struct peer *)); +static int mx4200_config P((struct peer *)); static void mx4200_ref P((struct peer *)); static void mx4200_send P((struct peer *, char *, ...)) __attribute__ ((format (printf, 2, 3))); @@ -239,6 +233,7 @@ mx4200_start( * Allocate unit structure */ if (!(up = (struct mx4200unit *) emalloc(sizeof(struct mx4200unit)))) { + perror("emalloc"); (void) close(fd); return (0); } @@ -263,8 +258,7 @@ mx4200_start( memcpy((char *)&pp->refid, REFID, 4); /* Ensure the receiver is properly configured */ - mx4200_config(peer); - return (1); + return mx4200_config(peer); } @@ -290,7 +284,7 @@ mx4200_shutdown( /* * mx4200_config - Configure the receiver */ -static void +static int mx4200_config( struct peer *peer ) @@ -299,6 +293,7 @@ mx4200_config( int add_mode; register struct mx4200unit *up; struct refclockproc *pp; + int mode; pp = peer->procptr; up = (struct mx4200unit *)pp->unitptr; @@ -324,16 +319,52 @@ mx4200_config( up->avg_lon = 0.0; up->avg_alt = 0.0; up->central_meridian = NOT_INITIALIZED; - up->filt_lat = 0.0; - up->filt_lon = 0.0; - up->filt_alt = 0.0; - up->edop = 1; - up->ndop = 1; - up->vdop = 1; + up->N_fixes = 0.0; up->last_leap = 0; /* LEAP_NOWARNING */ up->clamp_time = current_time + (AVGING_TIME * 60 * 60); up->log_time = current_time + SLEEPTIME; + if (time_pps_create(pp->io.fd, &up->pps_h) < 0) { + perror("time_pps_create"); + msyslog(LOG_ERR, + "mx4200_config: time_pps_create failed: %m"); + return (0); + } + if (time_pps_getcap(up->pps_h, &mode) < 0) { + msyslog(LOG_ERR, + "mx4200_config: time_pps_getcap failed: %m"); + return (0); + } + + if (time_pps_getparams(up->pps_h, &up->pps_p) < 0) { + msyslog(LOG_ERR, + "mx4200_config: time_pps_getparams failed: %m"); + return (0); + } + + /* nb. only turn things on, if someone else has turned something + * on before we get here, leave it alone! + */ + + up->pps_p.mode = PPS_CAPTUREASSERT | PPS_TSFMT_TSPEC; + up->pps_p.mode &= mode; /* only set what is legal */ + + if (time_pps_setparams(up->pps_h, &up->pps_p) < 0) { + perror("time_pps_setparams"); + msyslog(LOG_ERR, + "mx4200_config: time_pps_setparams failed: %m"); + exit(1); + } + + if (time_pps_kcbind(up->pps_h, PPS_KC_HARDPPS, PPS_CAPTUREASSERT, + PPS_TSFMT_TSPEC) < 0) { + perror("time_pps_kcbind"); + msyslog(LOG_ERR, + "mx4200_config: time_pps_kcbind failed: %m"); + exit(1); + } + + /* * "007" Control Port Configuration * Zero the output list (do it twice to flush possible junk) @@ -419,7 +450,7 @@ mx4200_config( 500, /* max time error in ns */ 0, /* user bias in ns */ 1); /* output "830" sentences to control port */ - /* Multi-satellite mode */ + /* Multi-satellite mode */ /* * Output position information (to calculate fixed installation @@ -431,21 +462,6 @@ mx4200_config( add_mode = 1; /* add to list */ } - /* - * "007" Control Port Configuration - * Output "022" DOPs - */ - mx4200_send(peer, "%s,%03d,%03d,%d,%d,,%d,,,", pmvxg, - PMVXG_S_PORTCONF, - PMVXG_D_DOPS, /* control port output block Label */ - 0, /* clear current output control list (0=no) */ - add_mode, /* add/delete sentences from list (1=add, 2=del) */ - /* must be null */ - INTERVAL); /* sentence output rate (sec) */ - /* precision for position output */ - /* nmea version for cga & gll output */ - /* pass-through control */ - /* * "007" Control Port Configuration @@ -456,11 +472,13 @@ mx4200_config( PMVXG_D_PHV, /* control port output block Label */ 0, /* clear current output control list (0=no) */ add_mode, /* add/delete sentences from list (1=add, 2=del) */ - /* must be null */ + /* must be null */ INTERVAL); /* sentence output rate (sec) */ - /* precision for position output */ - /* nmea version for cga & gll output */ - /* pass-through control */ + /* precision for position output */ + /* nmea version for cga & gll output */ + /* pass-through control */ + + return (1); } /* @@ -490,21 +508,6 @@ mx4200_ref( /* * "007" Control Port Configuration - * Stop outputting "022" DOPs - */ - mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg, - PMVXG_S_PORTCONF, - PMVXG_D_DOPS, /* control port output block Label */ - 0, /* clear current output control list (0=no) */ - 2); /* add/delete sentences from list (2=delete) */ - /* must be null */ - /* sentence output rate (sec) */ - /* precision for position output */ - /* nmea version for cga & gll output */ - /* pass-through control */ - - /* - * "007" Control Port Configuration * Stop outputting "021" position, height, velocity reports */ mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg, @@ -590,7 +593,7 @@ mx4200_ref( lons, /* longitude DDDMM.MMMM */ ewc, /* east/west */ alt, /* Altitude */ - 1); /* Altitude Reference (0=WGS84 ellipsoid, 1=MSL geoid) */ + 1); /* Altitude Reference (0=WGS84 ellipsoid, 1=MSL geoid)*/ msyslog(LOG_DEBUG, "mx4200: reconfig to fixed location: %s %c, %s %c, %.2f m", @@ -766,10 +769,14 @@ mx4200_receive( sentence_type = strtol(cp, &cp, 10); /* - * "000" Status message + * Process the sentence according to its type. */ + switch (sentence_type) { - if (sentence_type == PMVXG_D_STATUS) { + /* + * "000" Status message + */ + case PMVXG_D_STATUS: /* * XXX * Since we configure the receiver to not give us status @@ -785,52 +792,35 @@ mx4200_receive( } mx4200_debug(peer, "mx4200_receive: reset receiver\n"); mx4200_config(peer); - return; - } + break; /* * "021" Position, Height, Velocity message, * if we are still averaging our position */ - if (sentence_type == PMVXG_D_PHV && !up->known) { - /* - * Parse the message, calculating our averaged position. - */ - if ((cp = mx4200_parse_p(peer)) != NULL) { - mx4200_debug(peer, "mx4200_receive: pos: %s\n", cp); - return; - } - mx4200_debug(peer, - "mx4200_receive: position avg %.9f %.9f %.4f\n", - up->avg_lat, up->avg_lon, up->avg_alt); - mx4200_debug(peer, - "mx4200_receive: position len %.4f %.4f %.4f\n", - up->filt_lat, up->filt_lon, up->filt_alt); - mx4200_debug(peer, - "mx4200_receive: position dop %.1f %.1f %.1f\n", - up->ndop, up->edop, up->vdop); - /* - * Reinitialize as a reference station - * if position is well known. - */ - if (current_time > up->clamp_time) { - up->known++; - mx4200_debug(peer, "mx4200_receive: reconfiguring!\n"); - mx4200_ref(peer); - } - return; - } - - /* - * "022" DOPs, if we are still averaging our position - */ - if (sentence_type == PMVXG_D_DOPS && !up->known) { - if ((cp = mx4200_parse_d(peer)) != NULL) { - mx4200_debug(peer, "mx4200_receive: dop: %s\n", cp); - return; + case PMVXG_D_PHV: + if (!up->known) { + /* + * Parse the message, calculating our averaged position. + */ + if ((cp = mx4200_parse_p(peer)) != NULL) { + mx4200_debug(peer, "mx4200_receive: pos: %s\n", cp); + return; + } + mx4200_debug(peer, + "mx4200_receive: position avg %f %.9f %.9f %.4f\n", + up->N_fixes, up->avg_lat, up->avg_lon, up->avg_alt); + /* + * Reinitialize as a reference station + * if position is well known. + */ + if (current_time > up->clamp_time) { + up->known++; + mx4200_debug(peer, "mx4200_receive: reconfiguring!\n"); + mx4200_ref(peer); + } } - return; - } + break; /* * Print to the syslog: @@ -838,21 +828,20 @@ mx4200_receive( * "030" Software Configuration * "523" Time Recovery Parameters Currently in Use */ - if (sentence_type == PMVXG_D_MODEDATA || - sentence_type == PMVXG_D_SOFTCONF || - sentence_type == PMVXG_D_TRECOVUSEAGE ) { + case PMVXG_D_MODEDATA: + case PMVXG_D_SOFTCONF: + case PMVXG_D_TRECOVUSEAGE: + if ((cp = mx4200_parse_s(peer)) != NULL) { mx4200_debug(peer, "mx4200_receive: multi-record: %s\n", cp); - return; } - return; - } + break; /* * "830" Time Recovery Results message */ - if (sentence_type == PMVXG_D_TRECOVOUT) { + case PMVXG_D_TRECOVOUT: /* * Capture the last PPS signal. @@ -911,12 +900,16 @@ mx4200_receive( * Turn off the flag and return */ up->polled = 0; - return; - } + break; /* * Ignore all other sentence types */ + default: + break; + + } /* switch (sentence_type) */ + return; } @@ -969,17 +962,19 @@ mx4200_parse_t( struct mx4200unit *up; char time_mark_valid, time_sync, op_mode; int sentence_type, valid; - int year, day_of_year, month, day_of_month, hour, minute, second, leapsec; + int year, day_of_year, month, day_of_month; + int hour, minute, second, leapsec; int oscillator_offset, time_mark_error, time_bias; pp = peer->procptr; up = (struct mx4200unit *)pp->unitptr; leapsec = 0; /* Not all receivers output leap second warnings (!) */ - sscanf(pp->a_lastcode, "$PMVXG,%d,%c,%d,%d,%d,%d:%d:%d,%c,%c,%d,%d,%d,%d", + sscanf(pp->a_lastcode, + "$PMVXG,%d,%c,%d,%d,%d,%d:%d:%d,%c,%c,%d,%d,%d,%d", &sentence_type, &time_mark_valid, &year, &month, &day_of_month, - &hour, &minute, &second, &time_sync, &op_mode, &oscillator_offset, - &time_mark_error, &time_bias, &leapsec); + &hour, &minute, &second, &time_sync, &op_mode, + &oscillator_offset, &time_mark_error, &time_bias, &leapsec); if (sentence_type != PMVXG_D_TRECOVOUT) return ("wrong rec-type"); @@ -1029,7 +1024,7 @@ mx4200_parse_t( * (Certainly can't be any year before this code was last altered!) */ if (day_of_month > 31 || month > 12 || - day_of_month < 1 || month < 1 || year < YEAR_RIGHT_NOW) { + day_of_month < 1 || month < 1 || year < YEAR_LAST_MODIFIED) { mx4200_debug(peer, "mx4200_parse_t: bad date (%4d-%02d-%02d)\n", year, month, day_of_month); @@ -1250,7 +1245,7 @@ mx4200_parse_p( struct refclockproc *pp; struct mx4200unit *up; int sentence_type, mode; - double mtime, lat, lon, alt, geoid, vele, veln, weight; + double mtime, lat, lon, alt, geoid, vele, veln; char north_south, east_west; pp = peer->procptr; @@ -1259,9 +1254,10 @@ mx4200_parse_p( /* Should never happen! */ if (up->moving) return ("mobile platform - no pos!"); - sscanf ( pp->a_lastcode, "$PMVXG,%d,%lf,%lf,%c,%lf,%c,%lf,%lf,%lf,%lf,%d", - &sentence_type, &mtime, &lat, &north_south, &lon, &east_west, &alt, - &geoid, &vele, &veln, &mode); + sscanf ( pp->a_lastcode, + "$PMVXG,%d,%lf,%lf,%c,%lf,%c,%lf,%lf,%lf,%lf,%d", + &sentence_type, &mtime, &lat, &north_south, &lon, &east_west, + &alt, &geoid, &vele, &veln, &mode); /* Sentence type */ if (sentence_type != PMVXG_D_PHV) @@ -1324,92 +1320,22 @@ mx4200_parse_p( if (lon > 180.0) lon -= 360.0; /* - * Calculate running weighted averages + * Calculate running averages */ - weight = 1. / up->edop; - weight *= weight; - up->avg_lon = (up->filt_lon * up->avg_lon) + (weight * lon); - up->filt_lon += weight; - up->avg_lon = up->avg_lon / up->filt_lon; - - weight = 1. / up->ndop; - weight *= weight; - up->avg_lat = (up->filt_lat * up->avg_lat) + (weight * lat); - up->filt_lat += weight; - up->avg_lat = up->avg_lat / up->filt_lat; - - weight = 1. / up->vdop; - weight *= weight; - up->avg_alt = (up->filt_alt * up->avg_alt) + (weight * alt); - up->filt_alt += weight; - up->avg_alt = up->avg_alt / up->filt_alt; - mx4200_debug(peer, - "mx4200_receive: position rdg %.9f %.9f %.4f (CM=%.9f)\n", - lat, lon, alt, up->central_meridian); + up->avg_lon = (up->N_fixes * up->avg_lon) + lon; + up->avg_lat = (up->N_fixes * up->avg_lat) + lat; + up->avg_alt = (up->N_fixes * up->avg_alt) + alt; - return (NULL); -} + up->N_fixes += 1.0; -/* - * Parse a mx4200 DOP sentence. - * - * A typical message looks like this. Checksum has already been stripped. - * - * $PMVXG,022,SSSSSS.SSEE.E,NN.N,VV.V,XX,XX,XX,XX,XX,XX - * - * Field Field Contents - * ----- -------------- - * Block Label: $PMVXG - * Sentence Type: 022=DOPs. The DOP values in this sentence - * correspond to the satellites listed. The PRNs in - * the message are listed in receiver channel number order - * 1 UTC measurement time (seconds into week) - * 2 EDOP (east DOP) - * 3 NDOP (north DOP) - * 4 VDOP (vertical DOP) - * 5 PRN on channel 1 - * 6 PRN on channel 2 - * 7 PRN on channel 3 - * 8 PRN on channel 4 - * 9 PRN on channel 5 - * 10 PRN on channel 6 - * 11 PRN on channel 7 (12-channel receivers only) - * 12 PRN on channel 8 (12-channel receivers only) - * 13 PRN on channel 9 (12-channel receivers only) - * 14 PRN on channel 10 (12-channel receivers only) - * 15 PRN on channel 11 (12-channel receivers only) - * 16 PRN on channel 12 (12-channel receivers only) - */ -static char * -mx4200_parse_d( - struct peer *peer - ) -{ - struct refclockproc *pp; - struct mx4200unit *up; - int sentence_type; - double mtime, edop, ndop, vdop; + up->avg_lon /= up->N_fixes; + up->avg_lat /= up->N_fixes; + up->avg_alt /= up->N_fixes; - pp = peer->procptr; - up = (struct mx4200unit *)pp->unitptr; - - /* Should never happen! */ - if (up->moving) return ("mobile platform - no dop!"); - - sscanf ( pp->a_lastcode, "$PMVXG,%d,%lf,%lf,%lf,%lf", - &sentence_type, &mtime, &edop, &ndop, &vdop); - - /* Sentence type */ - if (sentence_type != PMVXG_D_DOPS) - return ("wrong rec-type"); - - /* Update values */ - if (edop <= 0.0 || ndop <= 0.0 || vdop <= 0.0) - return ("nonpositive dop"); - up->edop = edop; - up->ndop = ndop; - up->vdop = vdop; + mx4200_debug(peer, + "mx4200_receive: position rdg %.0f: %.9f %.9f %.4f (CM=%.9f)\n", + up->N_fixes, lat, lon, alt, up->central_meridian); return (NULL); } @@ -1551,19 +1477,19 @@ mx4200_parse_s( case PMVXG_D_STATUS: msyslog(LOG_DEBUG, - "mx4200: status: %s", pp->a_lastcode); + "mx4200: status: %s", pp->a_lastcode); break; case PMVXG_D_MODEDATA: msyslog(LOG_DEBUG, - "mx4200: mode data: %s", pp->a_lastcode); + "mx4200: mode data: %s", pp->a_lastcode); break; case PMVXG_D_SOFTCONF: msyslog(LOG_DEBUG, - "mx4200: firmware configuration: %s", pp->a_lastcode); + "mx4200: firmware configuration: %s", pp->a_lastcode); break; case PMVXG_D_TRECOVUSEAGE: msyslog(LOG_DEBUG, - "mx4200: time recovery parms: %s", pp->a_lastcode); + "mx4200: time recovery parms: %s", pp->a_lastcode); break; default: return ("wrong rec-type"); @@ -1573,7 +1499,7 @@ mx4200_parse_s( } /* - * Process a PPS signal, returning a timestamp. + * Process a PPS signal, placing a timestamp in pp->lastrec. */ static int mx4200_pps( @@ -1584,13 +1510,7 @@ mx4200_pps( struct refclockproc *pp; struct mx4200unit *up; - int request; -#ifdef HAVE_CIOGETEV - request = CIOGETEV; -#endif -#ifdef HAVE_TIOCGPPSEV - request = TIOCGPPSEV; -#endif + struct timespec timeout; pp = peer->procptr; up = (struct mx4200unit *)pp->unitptr; @@ -1598,41 +1518,47 @@ mx4200_pps( /* * Grab the timestamp of the PPS signal. */ - temp_serial = up->ppsev.serial; - if (ioctl(fdpps, request, (caddr_t)&up->ppsev) < 0) { - /* XXX Actually, if this fails, we're pretty much screwed */ + temp_serial = up->pps_i.assert_sequence; + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + if (time_pps_fetch(up->pps_h, PPS_TSFMT_TSPEC, &(up->pps_i), + &timeout) < 0) { mx4200_debug(peer, - "mx4200_pps: CIOGETEV/TIOCGPPSEV: serial=%d, fdpps=%d, %s\n", - up->ppsev.serial, fdpps, strerror(errno)); + "mx4200_pps: time_pps_fetch: serial=%d, %s\n", + up->pps_i.assert_sequence, strerror(errno)); refclock_report(peer, CEVNT_FAULT); return(1); } - if (temp_serial == up->ppsev.serial) { + if (temp_serial == up->pps_i.assert_sequence) { mx4200_debug(peer, - "mx4200_pps: ppsev serial not incrementing: %d\n", - up->ppsev.serial); + "mx4200_pps: assert_sequence serial not incrementing: %d\n", + up->pps_i.assert_sequence); refclock_report(peer, CEVNT_FAULT); return(1); } - /* * Check pps serial number against last one */ - if (up->lastserial + 1 != up->ppsev.serial && up->lastserial != 0) { - if (up->ppsev.serial == up->lastserial) + if (up->lastserial + 1 != up->pps_i.assert_sequence && + up->lastserial != 0) { + if (up->pps_i.assert_sequence == up->lastserial) { mx4200_debug(peer, "mx4200_pps: no new pps event\n"); - else + } else { mx4200_debug(peer, "mx4200_pps: missed %d pps events\n", - up->ppsev.serial - up->lastserial - 1); + up->pps_i.assert_sequence - up->lastserial - 1); + } refclock_report(peer, CEVNT_FAULT); } - up->lastserial = up->ppsev.serial; + up->lastserial = up->pps_i.assert_sequence; /* * Return the timestamp in pp->lastrec */ - up->ppsev.tv.tv_sec += (u_int32) JAN_1970; - TVTOTS(&up->ppsev.tv,&pp->lastrec); + + pp->lastrec.l_ui = up->pps_i.assert_timestamp.tv_sec + + (u_int32) JAN_1970; + pp->lastrec.l_uf = ((double)(up->pps_i.assert_timestamp.tv_nsec) * + 4.2949672960) + 0.5; return(0); } diff --git a/contrib/ntp/ntpd/refclock_nmea.c b/contrib/ntp/ntpd/refclock_nmea.c index d90f71c..e9304ee 100644 --- a/contrib/ntp/ntpd/refclock_nmea.c +++ b/contrib/ntp/ntpd/refclock_nmea.c @@ -9,16 +9,25 @@ #if defined(REFCLOCK) && defined(CLOCK_NMEA) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" +#include "ntp_unixtime.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + +#ifdef HAVE_PPSAPI +# ifdef HAVE_TIMEPPS_H +# include <timepps.h> +# else +# ifdef HAVE_SYS_TIMEPPS_H +# include <sys/timepps.h> +# endif +# endif +#endif /* HAVE_PPSAPI */ + /* * This driver supports the NMEA GPS Receiver with * @@ -27,6 +36,23 @@ * The receiver used spits out the NMEA sentences for boat navigation. * And you thought it was an information superhighway. Try a raging river * filled with rapids and whirlpools that rip away your data and warp time. + * + * If HAVE_PPSAPI is defined code to use the PPSAPI will be compiled in. + * On startup if initialization of the PPSAPI fails, it will fall back + * to the "normal" timestamps. + * + * The PPSAPI part of the driver understands fudge flag2 and flag3. If + * flag2 is set, it will use the clear edge of the pulse. If flag3 is + * set, kernel hardpps is enabled. + * + * GPS sentences other than RMC (the default) may be enabled by setting + * the relevent bits of 'mode' in the server configuration line + * server 127.127.20.x mode X + * + * bit 0 - enables RMC (1) + * bit 1 - enables GGA (2) + * bit 2 - enables GLL (4) + * multiple sentences may be selected */ /* @@ -39,9 +65,11 @@ #endif #define SPEED232 B4800 /* uart speed (4800 bps) */ #define PRECISION (-9) /* precision assumed (about 2 ms) */ -#define DCD_PRECISION (-20) /* precision assumed (about 1 us) */ +#define PPS_PRECISION (-20) /* precision assumed (about 1 us) */ #define REFID "GPS\0" /* reference id */ #define DESCRIPTION "NMEA GPS Clock" /* who we are */ +#define NANOSECOND 1000000000 /* one second (ns) */ +#define RANGEGATE 500000 /* range gate (ns) */ #define LENNMEA 75 /* min timecode length */ @@ -59,6 +87,12 @@ struct nmeaunit { int pollcnt; /* poll message counter */ int polled; /* Hand in a sample? */ l_fp tstamp; /* timestamp of last poll */ +#ifdef HAVE_PPSAPI + struct timespec ts; /* last timestamp */ + pps_params_t pps_params; /* pps parameters */ + pps_info_t pps_info; /* last pps data */ + pps_handle_t handle; /* pps handlebars */ +#endif /* HAVE_PPSAPI */ }; /* @@ -66,6 +100,12 @@ struct nmeaunit { */ static int nmea_start P((int, struct peer *)); static void nmea_shutdown P((int, struct peer *)); +#ifdef HAVE_PPSAPI +static void nmea_control P((int, struct refclockstat *, struct + refclockstat *, struct peer *)); +static int nmea_ppsapi P((struct peer *, int, int)); +static int nmea_pps P((struct nmeaunit *, l_fp *)); +#endif /* HAVE_PPSAPI */ static void nmea_receive P((struct recvbuf *)); static void nmea_poll P((int, struct peer *)); static void gps_send P((int, const char *, struct peer *)); @@ -78,7 +118,11 @@ struct refclock refclock_nmea = { nmea_start, /* start up driver */ nmea_shutdown, /* shut down driver */ nmea_poll, /* transmit poll message */ - noentry, /* handle control */ +#ifdef HAVE_PPSAPI + nmea_control, /* fudge control */ +#else + noentry, /* fudge control */ +#endif /* HAVE_PPSAPI */ noentry, /* initialize driver */ noentry, /* buginfo */ NOFLAGS /* not used */ @@ -130,13 +174,27 @@ nmea_start( /* * Initialize miscellaneous variables */ - peer->precision = DCD_PRECISION; + peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); up->pollcnt = 2; gps_send(pp->io.fd,"$PMOTG,RMC,0000*1D\r\n", peer); +#ifdef HAVE_PPSAPI + /* + * Start the PPSAPI interface if it is there. Default to use + * the assert edge and do not enable the kernel hardpps. + */ + if (time_pps_create(fd, &up->handle) < 0) { + up->handle = 0; + msyslog(LOG_ERR, + "refclock_nmea: time_pps_create failed: %m"); + return (1); + } + return(nmea_ppsapi(peer, 0, 0)); +#else return (1); +#endif /* HAVE_PPSAPI */ } /* @@ -153,10 +211,149 @@ nmea_shutdown( pp = peer->procptr; up = (struct nmeaunit *)pp->unitptr; +#ifdef HAVE_PPSAPI + if (up->handle != 0) + time_pps_destroy(up->handle); +#endif /* HAVE_PPSAPI */ io_closeclock(&pp->io); free(up); } +#ifdef HAVE_PPSAPI +/* + * nmea_control - fudge control + */ +static void +nmea_control( + int unit, /* unit (not used */ + struct refclockstat *in, /* input parameters (not uded) */ + struct refclockstat *out, /* output parameters (not used) */ + struct peer *peer /* peer structure pointer */ + ) +{ + struct refclockproc *pp; + + pp = peer->procptr; + nmea_ppsapi(peer, pp->sloppyclockflag & CLK_FLAG2, + pp->sloppyclockflag & CLK_FLAG3); +} + + +/* + * Initialize PPSAPI + */ +int +nmea_ppsapi( + struct peer *peer, /* peer structure pointer */ + int enb_clear, /* clear enable */ + int enb_hardpps /* hardpps enable */ + ) +{ + struct refclockproc *pp; + struct nmeaunit *up; + int capability; + + pp = peer->procptr; + up = (struct nmeaunit *)pp->unitptr; + if (time_pps_getcap(up->handle, &capability) < 0) { + msyslog(LOG_ERR, + "refclock_nmea: time_pps_getcap failed: %m"); + return (0); + } + memset(&up->pps_params, 0, sizeof(pps_params_t)); + if (enb_clear) + up->pps_params.mode = capability & PPS_CAPTURECLEAR; + else + up->pps_params.mode = capability & PPS_CAPTUREASSERT; + if (!up->pps_params.mode) { + msyslog(LOG_ERR, + "refclock_nmea: invalid capture edge %d", + !enb_clear); + return (0); + } + up->pps_params.mode |= PPS_TSFMT_TSPEC; + if (time_pps_setparams(up->handle, &up->pps_params) < 0) { + msyslog(LOG_ERR, + "refclock_nmea: time_pps_setparams failed: %m"); + return (0); + } + if (enb_hardpps) { + if (time_pps_kcbind(up->handle, PPS_KC_HARDPPS, + up->pps_params.mode & ~PPS_TSFMT_TSPEC, + PPS_TSFMT_TSPEC) < 0) { + msyslog(LOG_ERR, + "refclock_nmea: time_pps_kcbind failed: %m"); + return (0); + } + pps_enable = 1; + } + peer->precision = PPS_PRECISION; + +#if DEBUG + if (debug) { + time_pps_getparams(up->handle, &up->pps_params); + printf( + "refclock_ppsapi: capability 0x%x version %d mode 0x%x kern %d\n", + capability, up->pps_params.api_version, + up->pps_params.mode, enb_hardpps); + } +#endif + + return (1); +} + +/* + * Get PPSAPI timestamps. + * + * Return 0 on failure and 1 on success. + */ +static int +nmea_pps( + struct nmeaunit *up, + l_fp *tsptr + ) +{ + pps_info_t pps_info; + struct timespec timeout, ts; + double dtemp; + l_fp tstmp; + + /* + * Convert the timespec nanoseconds field to ntp l_fp units. + */ + if (up->handle == 0) + return (0); + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + memcpy(&pps_info, &up->pps_info, sizeof(pps_info_t)); + if (time_pps_fetch(up->handle, PPS_TSFMT_TSPEC, &up->pps_info, + &timeout) < 0) + return (0); + if (up->pps_params.mode & PPS_CAPTUREASSERT) { + if (pps_info.assert_sequence == + up->pps_info.assert_sequence) + return (0); + ts = up->pps_info.assert_timestamp; + } else if (up->pps_params.mode & PPS_CAPTURECLEAR) { + if (pps_info.clear_sequence == + up->pps_info.clear_sequence) + return (0); + ts = up->pps_info.clear_timestamp; + } else { + return (0); + } + if ((up->ts.tv_sec == ts.tv_sec) && (up->ts.tv_nsec == ts.tv_nsec)) + return (0); + up->ts = ts; + + tstmp.l_ui = ts.tv_sec + JAN_1970; + dtemp = ts.tv_nsec * FRAC / 1e9; + tstmp.l_uf = (u_int32)dtemp; + *tsptr = tstmp; + return (1); +} +#endif /* HAVE_PPSAPI */ + /* * nmea_receive - receive data from the serial interface */ @@ -168,11 +365,14 @@ nmea_receive( register struct nmeaunit *up; struct refclockproc *pp; struct peer *peer; - l_fp trtmp; int month, day; int i; char *cp, *dp; int cmdtype; + /* Use these variables to hold data until we decide its worth keeping */ + char rd_lastcode[BMAX]; + l_fp rd_tmp; + u_short rd_lencode; /* * Initialize pointers and read the timecode and timestamp @@ -180,23 +380,18 @@ nmea_receive( peer = (struct peer *)rbufp->recv_srcclock; pp = peer->procptr; up = (struct nmeaunit *)pp->unitptr; - pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp); + rd_lencode = refclock_gtlin(rbufp, rd_lastcode, BMAX, &rd_tmp); /* * There is a case that a <CR><LF> gives back a "blank" line */ - if (pp->lencode == 0) + if (rd_lencode == 0) return; - /* - * We get a buffer and timestamp for each <cr>. - */ - pp->lastrec = up->tstamp = trtmp; - up->pollcnt = 2; #ifdef DEBUG if (debug) - printf("nmea: timecode %d %s\n", pp->lencode, - pp->a_lastcode); + printf("nmea: gpsread %d %s\n", rd_lencode, + rd_lastcode); #endif /* @@ -204,18 +399,31 @@ nmea_receive( * we only care about a few of them. The most important being * the $GPRMC format * $GPRMC,hhmmss,a,fddmm.xx,n,dddmmm.xx,w,zz.z,yyy.,ddmmyy,dd,v*CC - * $GPGGA,162617.0,4548.339,N,00837.719,E,1,07,0.97,00262,M,048,M,,*5D + * For Magellan (ColorTrak) GLL probably datum (order of sentences) + * also mode (0,1,2,3) select sentence ANY/ALL, RMC, GGA, GLL + * $GPGLL,3513.8385,S,14900.7851,E,232420.594,A*21 + * $GPGGA,232420.59,3513.8385,S,14900.7851,E,1,05,3.4,00519,M,,,,*3F + * $GPRMB,... + * $GPRMC,232418.19,A,3513.8386,S,14900.7853,E,00.0,000.0,121199,12.,E*77 + * $GPAPB,... + * $GPGSA,... + * $GPGSV,... + * $GPGSV,... */ -#define GPRMC 0 -#define GPXXX 1 -#define GPGCA 2 - cp = pp->a_lastcode; +#define GPXXX 0 +#define GPRMC 1 +#define GPGGA 2 +#define GPGLL 4 + cp = rd_lastcode; cmdtype=0; if(strncmp(cp,"$GPRMC",6)==0) { cmdtype=GPRMC; } else if(strncmp(cp,"$GPGGA",6)==0) { - cmdtype=GPGCA; + cmdtype=GPGGA; + } + else if(strncmp(cp,"$GPGLL",6)==0) { + cmdtype=GPGLL; } else if(strncmp(cp,"$GPXXX",6)==0) { cmdtype=GPXXX; @@ -223,14 +431,84 @@ nmea_receive( else return; + + /* See if I want to process this message type */ + if ( ((peer->ttlmax == 0) && (cmdtype != GPRMC)) + || ((peer->ttlmax != 0) && !(cmdtype & peer->ttlmax)) ) + return; + + pp->lencode = rd_lencode; + strcpy(pp->a_lastcode,rd_lastcode); + cp = pp->a_lastcode; + + pp->lastrec = up->tstamp = rd_tmp; + up->pollcnt = 2; + +#ifdef DEBUG + if (debug) + printf("nmea: timecode %d %s\n", pp->lencode, + pp->a_lastcode); +#endif + + + /* Grab field depending on clock string type */ switch( cmdtype ) { case GPRMC: - case GPGCA: /* - * Check time code format of NMEA + * Test for synchronization. Check for quality byte. + */ + dp = field_parse(cp,2); + if( dp[0] != 'A') + pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; + + /* Now point at the time field */ + dp = field_parse(cp,1); + break; + + + case GPGGA: + /* + * Test for synchronization. Check for quality byte. */ + dp = field_parse(cp,6); + if( dp[0] == '0') + pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; + /* Now point at the time field */ dp = field_parse(cp,1); + break; + + + case GPGLL: + /* + * Test for synchronization. Check for quality byte. + */ + dp = field_parse(cp,6); + if( dp[0] != 'A') + pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; + + /* Now point at the time field */ + dp = field_parse(cp,5); + break; + + + case GPXXX: + return; + default: + return; + + } + + /* + * Check time code format of NMEA + */ + if( !isdigit((int)dp[0]) || !isdigit((int)dp[1]) || !isdigit((int)dp[2]) || @@ -242,40 +520,55 @@ nmea_receive( return; } - /* - * Test for synchronization. Check for quality byte. - */ - dp = field_parse(cp,2); - if( dp[0] != 'A') { - refclock_report(peer, CEVNT_BADREPLY); - return; + + /* + * Convert time and check values. + */ + pp->hour = ((dp[0] - '0') * 10) + dp[1] - '0'; + pp->minute = ((dp[2] - '0') * 10) + dp[3] - '0'; + pp->second = ((dp[4] - '0') * 10) + dp[5] - '0'; + /* Default to 0 milliseconds, if decimal convert milliseconds in + one, two or three digits + */ + pp->msec = 0; + if (dp[6] == '.') { + if (isdigit((int)dp[7])) { + pp->msec = (dp[7] - '0') * 100; + if (isdigit((int)dp[8])) { + pp->msec += (dp[8] - '0') * 10; + if (isdigit((int)dp[9])) { + pp->msec += (dp[9] - '0'); + } + } } - break; - case GPXXX: - return; - default: - return; + } + if (pp->hour > 23 || pp->minute > 59 || pp->second > 59 + || pp->msec > 1000) { + refclock_report(peer, CEVNT_BADTIME); + return; } - if (cmdtype ==GPGCA) { - /* only time */ - time_t tt = time(NULL); - struct tm * t = gmtime(&tt); - day = t->tm_mday; - month = t->tm_mon + 1; - pp->year= t->tm_year; - } else { - dp = field_parse(cp,9); + /* * Convert date and check values. */ - day = dp[0] - '0'; - day = (day * 10) + dp[1] - '0'; - month = dp[2] - '0'; - month = (month * 10) + dp[3] - '0'; - pp->year = dp[4] - '0'; - pp->year = (pp->year * 10) + dp[5] - '0'; + if (cmdtype==GPRMC) { + dp = field_parse(cp,9); + day = dp[0] - '0'; + day = (day * 10) + dp[1] - '0'; + month = dp[2] - '0'; + month = (month * 10) + dp[3] - '0'; + pp->year = dp[4] - '0'; + pp->year = (pp->year * 10) + dp[5] - '0'; + } + else { + /* only time */ + time_t tt = time(NULL); + struct tm * t = gmtime(&tt); + day = t->tm_mday; + month = t->tm_mon + 1; + pp->year= t->tm_year; } if (month < 1 || month > 12 || day < 1) { @@ -283,6 +576,9 @@ nmea_receive( return; } + /* Hmmmm this will be a nono for 2100,2200,2300 but I don't think I'll be here */ + /* good thing that 2000 is a leap year */ + /* pp->year will be 00-99 if read from GPS, 00-> (years since 1900) from tm_year */ if (pp->year % 4) { if (day > day1tab[month - 1]) { refclock_report(peer, CEVNT_BADTIME); @@ -300,19 +596,17 @@ nmea_receive( } pp->day = day; - dp = field_parse(cp,1); + +#ifdef HAVE_PPSAPI /* - * Convert time and check values. + * If the PPSAPI is working, rather use its timestamps. + * assume that the PPS occurs on the second so blow any msec */ - pp->hour = ((dp[0] - '0') * 10) + dp[1] - '0'; - pp->minute = ((dp[2] - '0') * 10) + dp[3] - '0'; - pp->second = ((dp[4] - '0') * 10) + dp[5] - '0'; - pp->msec = 0; - - if (pp->hour > 23 || pp->minute > 59 || pp->second > 59) { - refclock_report(peer, CEVNT_BADTIME); - return; + if (nmea_pps(up, &rd_tmp) == 1) { + pp->lastrec = up->tstamp = rd_tmp; + pp->msec = 0; } +#endif /* HAVE_PPSAPI */ /* * Process the new sample in the median filter and determine the @@ -322,11 +616,14 @@ nmea_receive( * time, which may cause a paranoid protocol module to chuck out * the data. */ + if (!refclock_process(pp)) { refclock_report(peer, CEVNT_BADTIME); return; } + + /* * Only go on if we had been polled. */ @@ -336,7 +633,11 @@ nmea_receive( refclock_receive(peer); + /* If we get here - what we got from the clock is OK, so say so */ + refclock_report(peer, CEVNT_NOMINAL); + record_clock_stats(&peer->srcadr, pp->a_lastcode); + } /* diff --git a/contrib/ntp/ntpd/refclock_oncore.c b/contrib/ntp/ntpd/refclock_oncore.c index e0ba177..dbb9f5d 100644 --- a/contrib/ntp/ntpd/refclock_oncore.c +++ b/contrib/ntp/ntpd/refclock_oncore.c @@ -9,6 +9,9 @@ * refclock_oncore.c * * Driver for some of the various the Motorola Oncore GPS receivers. + * should work with Basic, PVT6, VP, UT, UT+, GT, GT+, SL, M12. + * The receivers with TRAIM (VP, UT, UT+), will be more accurate than the others. + * The receivers without position hold (GT, GT+) will be less accurate. * * Tested with: * @@ -24,28 +27,40 @@ * MANUFACTUR DATE 6H07 MANUFACTUR DATE 7E02 * OPTIONS LIST IB * + * (Basic) (M12) + * COPYRIGHT 1991-1996 MOTOROLA INC. COPYRIGHT 1991-2000 MOTOROLA INC. + * SFTW P/N # 98-P36830P SFTW P/N # 61-G10002A + * SOFTWARE VER # 8 SOFTWARE VER # 1 + * SOFTWARE REV # 8 SOFTWARE REV # 3 + * SOFTWARE DATE 06 Aug 1996 SOFTWARE DATE Mar 13 2000 + * MODEL # B4121P1155 MODEL # P143T12NR1 + * HDWR P/N # _ HWDR P/N # 1 + * SERIAL # SSG0226478 SERIAL # P003UD + * MANUFACTUR DATE 7E02 MANUFACTUR DATE 0C27 + * OPTIONS LIST IB + * * -------------------------------------------------------------------------- * This code uses the two devices - * /dev/oncore.serial.n - * /dev/oncore.pps.n + * /dev/oncore.serial.n + * /dev/oncore.pps.n * which may be linked to the same device. * and can read initialization data from the file - * /etc/ntp.oncoreN (where n and N are the unit number, viz 127.127.30.N) - * or /etc/ntp.oncore + * /etc/ntp.oncoreN, /etc/ntp.oncore.N, or /etc/ntp.oncore, where + * n or N are the unit number, viz 127.127.30.N. * -------------------------------------------------------------------------- * Reg.Clemens <reg@dwf.com> Sep98. * Original code written for FreeBSD. - * With these mods it works on SunOS, Solaris (untested) and Linux - * (RedHat 5.1 2.0.35 + PPSKit, 2.1.126 + changes). + * With these mods it works on FreeBSD, SunOS, Solaris and Linux + * (SunOS 4.1.3 + ppsclock) + * (Solaris7 + MU4) + * (RedHat 5.1 2.0.35 + PPSKit, 2.1.126 + or later). * * Lat,Long,Ht, cable-delay, offset, and the ReceiverID (along with the * state machine state) are printed to CLOCKSTATS if that file is enabled * in /etc/ntp.conf. * * -------------------------------------------------------------------------- - */ - -/* + * * According to the ONCORE manual (TRM0003, Rev 3.2, June 1998, page 3.13) * doing an average of 10000 valid 2D and 3D fixes is what the automatic * site survey mode does. Looking at the output from the receiver @@ -58,20 +73,26 @@ /* * ONCORE_SHMEM_STATUS will create a mmap(2)'ed file named according to a * "STATUS" line in the oncore config file, which contains the most recent - * copy of all types of messages we recognize. This file can be mmap(2)'ed + * copy of all types of messages we recognize. This file can be mmap(2)'ed * by monitoring and statistics programs. + * + * See separate HTML documentation for this option. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#if defined(REFCLOCK) && defined(CLOCK_ONCORE) +#if defined(REFCLOCK) && defined(CLOCK_ONCORE) && defined(HAVE_PPSAPI) + +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_unixtime.h" +#include "ntp_refclock.h" +#include "ntp_stdlib.h" #include <stdio.h> #include <ctype.h> -#include <sys/types.h> -#include <sys/time.h> #include <sys/stat.h> #ifdef ONCORE_SHMEM_STATUS # ifdef HAVE_SYS_MMAN_H @@ -83,11 +104,11 @@ #endif /* ONCORE_SHMEM_STATUS */ #ifdef HAVE_PPSAPI -# ifdef HAVE_TIMEPPS_H -# include <timepps.h> +# ifdef HAVE_TIMEPPS_H +# include <timepps.h> # else # ifdef HAVE_SYS_TIMEPPS_H -# include <sys/timepps.h> +# include <sys/timepps.h> # endif # endif #endif @@ -96,14 +117,8 @@ # include <sys/sio.h> #endif -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_unixtime.h" -#include "ntp_refclock.h" -#include "ntp_stdlib.h" - #ifdef HAVE_SYS_TERMIOS_H -#include <sys/termios.h> +# include <sys/termios.h> #endif #ifdef HAVE_SYS_PPSCLOCK_H @@ -112,7 +127,7 @@ #ifndef HAVE_STRUCT_PPSCLOCKEV struct ppsclockev { -# ifdef HAVE_TIMESPEC +# ifdef HAVE_STRUCT_TIMESPEC struct timespec tv; # else struct timeval tv; @@ -123,90 +138,163 @@ struct ppsclockev { enum receive_state { ONCORE_NO_IDEA, + ONCORE_ID_SENT, ONCORE_RESET_SENT, ONCORE_TEST_SENT, - ONCORE_ID_SENT, + ONCORE_INIT, ONCORE_ALMANAC, ONCORE_RUN }; enum site_survey_state { ONCORE_SS_UNKNOWN, + ONCORE_SS_TESTING, ONCORE_SS_HW, ONCORE_SS_SW, ONCORE_SS_DONE }; +/* Model Name, derived from the @@Cj message. + * Used to initialize some variables. + */ + +enum oncore_model { + ONCORE_BASIC, + ONCORE_PVT6, + ONCORE_VP, + ONCORE_UT, + ONCORE_UTPLUS, + ONCORE_GT, + ONCORE_GTPLUS, + ONCORE_SL, + ONCORE_M12, + ONCORE_UNKNOWN +}; + +/* the bits that describe these properties are in the same place + * on the VP/UT, but have moved on the M12. As such we extract + * them, and use them from this struct. + * + */ + +struct RSM { + u_char posn0D; + u_char posn2D; + u_char posn3D; + u_char bad_almanac; + u_char bad_fix; +}; + +/* It is possible to test the VP/UT each cycle (@@Ea or equivalent) to + * see what mode it is in. The bits on the M12 are multiplexed with + * other messages, so we have to 'keep' the last known mode here. + */ + +enum posn_mode { + MODE_UNKNOWN, + MODE_0D, + MODE_2D, + MODE_3D +}; + struct instance { int unit; /* 127.127.30.unit */ + struct refclockproc *pp; + struct peer *peer; + int ttyfd; /* TTY file descriptor */ int ppsfd; /* PPS file descriptor */ int statusfd; /* Status shm descriptor */ - u_char *shmem; #ifdef HAVE_PPSAPI pps_handle_t pps_h; pps_params_t pps_p; #endif enum receive_state o_state; /* Receive state */ - + enum posn_mode mode; /* 0D, 2D, 3D */ enum site_survey_state site_survey; /* Site Survey state */ - struct refclockproc *pp; - struct peer *peer; - int Bj_day; - long delay; /* ns */ + u_long delay; /* ns */ long offset; /* ns */ + u_char *shmem; + char *shmem_fname; + u_int shmem_Cb; + u_int shmem_Ba; + u_int shmem_Ea; + u_int shmem_Ha; + u_char shmem_first; + u_char shmem_reset; + u_char shmem_Posn; + double ss_lat; double ss_long; double ss_ht; + double dH; int ss_count; - u_char ss_ht_type; - u_char posn_set; + u_char posn_set; - u_char printed; - u_char polled; + enum oncore_model model; + u_int version; + u_int revision; + + u_char chan; /* 6 for PVT6 or BASIC, 8 for UT/VP, 12 for m12, 0 if unknown */ + s_char traim; /* do we have traim? yes UT/VP, no BASIC, GT, -1 unknown, 0 no, +1 yes */ + u_char traim_delay; /* seconds counter, waiting for reply */ + + struct RSM rsm; /* bits extracted from Receiver Status Msg in @@Ea */ + u_char printed; + u_char polled; int pollcnt; u_int ev_serial; int Rcvptr; u_char Rcvbuf[500]; - u_char Ea[77]; - u_char En[70]; + u_char Ea[160]; /* Ba, Ea or Ha */ + u_char En[70]; /* Bn or En */ u_char Cj[300]; u_char As; u_char Ay; u_char Az; + u_char have_dH; u_char init_type; s_char saw_tooth; - u_char timeout; /* flag to retry Cj after Fa reset */ - s_char assert; + u_int timeout; /* count to retry Cj after Fa self-test */ + u_char count; /* cycles thru Ea before starting */ + s_char assert; + u_int saw_At; }; #define rcvbuf instance->Rcvbuf #define rcvptr instance->Rcvptr -static void oncore_consume P((struct instance *)); -static void oncore_poll P((int, struct peer *)); -static void oncore_read_config P((struct instance *)); -static void oncore_receive P((struct recvbuf *)); -static void oncore_sendmsg P((int fd, u_char *, u_int)); -static void oncore_shutdown P((int, struct peer *)); -static int oncore_start P((int, struct peer *)); - -static void oncore_msg_any P((struct instance *, u_char *, u_int, int)); -static void oncore_msg_As P((struct instance *, u_char *, u_int)); -static void oncore_msg_At P((struct instance *, u_char *, u_int)); -static void oncore_msg_Ay P((struct instance *, u_char *, u_int)); -static void oncore_msg_Az P((struct instance *, u_char *, u_int)); -static void oncore_msg_Bj P((struct instance *, u_char *, u_int)); -static void oncore_msg_Cb P((struct instance *, u_char *, u_int)); -static void oncore_msg_Cf P((struct instance *, u_char *, u_int)); -static void oncore_msg_Cj P((struct instance *, u_char *, u_int)); -static void oncore_msg_Ea P((struct instance *, u_char *, u_int)); -static void oncore_msg_En P((struct instance *, u_char *, u_int)); -static void oncore_msg_Fa P((struct instance *, u_char *, u_int)); +static void oncore_consume P((struct instance *)); +static void oncore_poll P((int, struct peer *)); +static void oncore_read_config P((struct instance *)); +static void oncore_receive P((struct recvbuf *)); +static void oncore_sendmsg P((int fd, u_char *, size_t)); +static void oncore_shutdown P((int, struct peer *)); +static int oncore_start P((int, struct peer *)); +static void oncore_get_timestamp P((struct instance *, long, long)); +static void oncore_init_shmem P((struct instance *)); +static void oncore_print_As P((struct instance *)); + +static void oncore_msg_any P((struct instance *, u_char *, size_t, int)); +static void oncore_msg_As P((struct instance *, u_char *, size_t)); +static void oncore_msg_At P((struct instance *, u_char *, size_t)); +static void oncore_msg_Ay P((struct instance *, u_char *, size_t)); +static void oncore_msg_Az P((struct instance *, u_char *, size_t)); +static void oncore_msg_BaEaHa P((struct instance *, u_char *, size_t)); +static void oncore_msg_Bj P((struct instance *, u_char *, size_t)); +static void oncore_msg_BnEn P((struct instance *, u_char *, size_t)); +static void oncore_msg_CaFaIa P((struct instance *, u_char *, size_t)); +static void oncore_msg_Cb P((struct instance *, u_char *, size_t)); +static void oncore_msg_Cf P((struct instance *, u_char *, size_t)); +static void oncore_msg_Cj P((struct instance *, u_char *, size_t)); +static void oncore_msg_Cj_id P((struct instance *, u_char *, size_t)); +static void oncore_msg_Cj_init P((struct instance *, u_char *, size_t)); +static void oncore_msg_Gj P((struct instance *, u_char *, size_t)); +static void oncore_msg_Sz P((struct instance *, u_char *, size_t)); struct refclock refclock_oncore = { oncore_start, /* start up driver */ @@ -220,65 +308,83 @@ struct refclock refclock_oncore = { /* * Understanding the next bit here is not easy unless you have a manual - * for the the UT or VP Oncore. + * for the the various Oncore Models. */ static struct msg_desc { const char flag[3]; const int len; - void (*handler) P((struct instance *, u_char *, u_int)); + void (*handler) P((struct instance *, u_char *, size_t)); const char *fmt; int shmem; } oncore_messages[] = { - /* Ea and En first since they're most common */ - { "Ea", 76, oncore_msg_Ea, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdimsdimsdsC" }, - { "En", 69, oncore_msg_En, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffsffffsffffC" }, - { "Ab", 10, 0, "" }, - { "Ac", 11, 0, "" }, - { "Ad", 11, 0, "" }, - { "Ae", 11, 0, "" }, - { "Af", 15, 0, "" }, - { "As", 20, oncore_msg_As, "" }, - { "At", 8, oncore_msg_At, "" }, - { "Aw", 8, 0, "" }, - { "Ay", 11, oncore_msg_Ay, "" }, - { "Az", 11, oncore_msg_Az, "" }, - { "AB", 8, 0, "" }, - { "Bb", 92, 0, "" }, - { "Bj", 8, oncore_msg_Bj, "" }, - { "Cb", 33, oncore_msg_Cb, "" }, - { "Cf", 7, oncore_msg_Cf, "" }, - { "Cg", 8, 0, "" }, - { "Ch", 9, 0, "" }, - { "Cj", 294, oncore_msg_Cj, "" }, - { "Ek", 71, 0, "" }, - { "Fa", 9, oncore_msg_Fa, "" }, - { "Sz", 8, 0, "" }, - { {0}, 7, 0, ""} + /* Ea and En first since they're most common */ + { "Ea", 76, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdimsdimsdsC" }, + { "Ba", 68, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmvvhhddtntimsdimsdimsdimsdimsdimsdsC" }, + { "Ha", 154, oncore_msg_BaEaHa, "mdyyhmsffffaaaaoooohhhhmmmmaaaaoooohhhhmmmmVVvvhhddntimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddimsiddssrrccooooTTushmvvvvvvC" }, + { "En", 69, oncore_msg_BnEn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffsffffsffffC" }, + { "Bn", 59, oncore_msg_BnEn, "otaapxxxxxxxxxxpysreensffffsffffsffffsffffsffffsffffC" }, + { "Ab", 10, 0, "" }, + { "Ac", 11, 0, "" }, + { "Ad", 11, 0, "" }, + { "Ae", 11, 0, "" }, + { "Af", 15, 0, "" }, + { "As", 20, oncore_msg_As, "" }, + { "At", 8, oncore_msg_At, "" }, + { "Au", 12, 0, "" }, + { "Av", 8, 0, "" }, + { "Aw", 8, 0, "" }, + { "Ay", 11, oncore_msg_Ay, "" }, + { "Az", 11, oncore_msg_Az, "" }, + { "AB", 8, 0, "" }, + { "Bb", 92, 0, "" }, + { "Bj", 8, oncore_msg_Bj, "" }, + { "Ca", 9, oncore_msg_CaFaIa, "" }, + { "Cb", 33, oncore_msg_Cb, "" }, + { "Cf", 7, oncore_msg_Cf, "" }, + { "Cg", 8, 0, "" }, + { "Ch", 9, 0, "" }, + { "Cj", 294, oncore_msg_Cj, "" }, + { "Ek", 71, 0, "" }, + { "Fa", 9, oncore_msg_CaFaIa, "" }, + { "Gd", 8, 0, "" }, + { "Gj", 21, oncore_msg_Gj, "" }, + { "Ia", 10, oncore_msg_CaFaIa, "" }, + { "Sz", 8, oncore_msg_Sz, "" }, + { {0}, 7, 0, "" } }; -static unsigned int oncore_shmem_Cb; - /* * Position Set. */ u_char oncore_cmd_Ad[] = { 'A', 'd', 0,0,0,0 }; u_char oncore_cmd_Ae[] = { 'A', 'e', 0,0,0,0 }; u_char oncore_cmd_Af[] = { 'A', 'f', 0,0,0,0, 0 }; +u_char oncore_cmd_Ga[] = { 'G', 'a', 0,0,0,0, 0,0,0,0, 0,0,0,0, 0 }; /* * Position-Hold Mode * Start automatic site survey */ -static u_char oncore_cmd_At[] = { 'A', 't', 2 }; +static u_char oncore_cmd_At0[] = { 'A', 't', 0 }; /* Posn Hold off */ +static u_char oncore_cmd_At1[] = { 'A', 't', 1 }; /* Posn Hold on */ +static u_char oncore_cmd_At2[] = { 'A', 't', 2 }; /* Start Site Survey */ /* - * Position-Hold Position + * 0D/2D Position and Set. */ u_char oncore_cmd_As[] = { 'A', 's', 0,0,0,0, 0,0,0,0, 0,0,0,0, 0 }; u_char oncore_cmd_Asx[]= { 'A', 's', 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }; +u_char oncore_cmd_Au[] = { 'A', 'u', 0,0,0,0,0 }; + +u_char oncore_cmd_Av0[] = { 'A', 'v', 0 }; +u_char oncore_cmd_Av1[] = { 'A', 'v', 1 }; + +u_char oncore_cmd_Gd0[] = { 'G', 'd', 0 }; /* 3D */ +u_char oncore_cmd_Gd1[] = { 'G', 'd', 1 }; /* 0D */ +u_char oncore_cmd_Gd2[] = { 'G', 'd', 2 }; /* 2D */ /* * Set to UTC time (not GPS). @@ -317,6 +423,7 @@ u_char oncore_cmd_Bb[] = { 'B', 'b', 1 }; * Request message once */ u_char oncore_cmd_Bj[] = { 'B', 'j', 0 }; +u_char oncore_cmd_Gj[] = { 'G', 'j' }; /* * Set to Defaults @@ -337,7 +444,11 @@ static u_char oncore_cmd_Cj[] = { 'C', 'j' }; * Position/Status/Data message * Send once per second */ -static u_char oncore_cmd_Ea[] = { 'E', 'a', 1 }; +static u_char oncore_cmd_Ea[] = { 'E', 'a', 1 }; +static u_char oncore_cmd_Ba[] = { 'B', 'a', 1 }; +static u_char oncore_cmd_Ha[] = { 'H', 'a', 1 }; +static u_char oncore_cmd_Ea0[] = { 'E', 'a', 0 }; +static u_char oncore_cmd_Ba0[] = { 'B', 'a', 0 }; /* * Position/Status Extension Msg @@ -351,12 +462,17 @@ u_char oncore_cmd_Ek[] = { 'E', 'k', 0 }; /* just turn off */ * Alarm limit 1us * PPS on when we have the first sat */ -static u_char oncore_cmd_En[] = { 'E', 'n', 1, 1, 0,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static u_char oncore_cmd_En[] = { 'E', 'n', 1, 1, 0,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static u_char oncore_cmd_En0[] = { 'E', 'n', 0, 1, 0,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static u_char oncore_cmd_Bn[] = { 'B', 'n', 1, 1, 0,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static u_char oncore_cmd_Bn0[] = { 'B', 'n', 0, 1, 0,10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* * Self-test */ -static u_char oncore_cmd_Fa[] = { 'F', 'a' }; +static u_char oncore_cmd_Ca[] = { 'C', 'a' }; /* 6 Chan */ +static u_char oncore_cmd_Fa[] = { 'F', 'a' }; /* 8 Chan */ +static u_char oncore_cmd_Ia[] = { 'I', 'a' }; /* 12 Chan */ #define DEVICE1 "/dev/oncore.serial.%d" /* name of serial device */ #define DEVICE2 "/dev/oncore.pps.%d" /* name of pps device */ @@ -370,7 +486,7 @@ static u_char oncore_cmd_Fa[] = { 'F', 'a' }; */ /* to buffer, int w, u_char *buf */ -#define w32_buf(buf,w) { unsigned int i_tmp; \ +#define w32_buf(buf,w) { u_int i_tmp; \ i_tmp = (w<0) ? (~(-w)+1) : (w); \ (buf)[0] = (i_tmp >> 24) & 0xff; \ (buf)[1] = (i_tmp >> 16) & 0xff; \ @@ -390,9 +506,11 @@ extern int pps_assert; extern int pps_hardpps; + /* * oncore_start - initialize data for processing */ + static int oncore_start( int unit, @@ -452,22 +570,44 @@ oncore_start( } } - /* Devices now open, initialize instance structure */ + /* Devices now open, create instance structure for this unit */ - if (!(instance = (struct instance *)emalloc(sizeof *instance))) { + if (!(instance = (struct instance *) malloc(sizeof *instance))) { perror("malloc"); close(fd1); return (0); } memset((char *) instance, 0, sizeof *instance); + + /* link instance up and down */ + pp = peer->procptr; - pp->unitptr = (caddr_t)instance; - instance->unit = unit; + pp->unitptr = (caddr_t) instance; + instance->pp = pp; + instance->unit = unit; + instance->peer = peer; + + /* initialize miscellaneous variables */ + + instance->o_state = ONCORE_NO_IDEA; + cp = "state = ONCORE_NO_IDEA"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->ttyfd = fd1; instance->ppsfd = fd2; instance->Bj_day = -1; instance->assert = pps_assert; + instance->traim = -1; + instance->model = ONCORE_UNKNOWN; + instance->mode = MODE_UNKNOWN; + instance->site_survey = ONCORE_SS_UNKNOWN; + + peer->precision = -26; + peer->minpoll = 4; + peer->maxpoll = 4; + pp->clockdesc = "Motorola Oncore GPS Receiver"; + memcpy((char *)&pp->refid, "GPS\0", (size_t) 4); /* go read any input data in /etc/ntp.oncoreX */ @@ -492,10 +632,10 @@ oncore_start( } /* nb. only turn things on, if someone else has turned something - * on before we get here, leave it alone! + * on before we get here, leave it alone! */ - if (instance->assert) { /* nb, default or ON */ + if (instance->assert) { /* nb, default or ON */ instance->pps_p.mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT; instance->pps_p.assert_offset.tv_sec = 0; instance->pps_p.assert_offset.tv_nsec = 0; @@ -505,7 +645,7 @@ oncore_start( instance->pps_p.clear_offset.tv_nsec = 0; } instance->pps_p.mode |= PPS_TSFMT_TSPEC; - instance->pps_p.mode &= mode; /* only do it if it is legal */ + instance->pps_p.mode &= mode; /* only set what is legal */ if (time_pps_setparams(instance->pps_h, &instance->pps_p) < 0) { perror("time_pps_setparams"); @@ -517,17 +657,17 @@ oncore_start( perror("ONCORE: stat pps_device"); return(0); } - + /* must have hardpps ON, and fd2 must be the same device as on the pps line */ - + if (pps_hardpps && ((stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino))) { - int i; - + int i; + if (instance->assert) i = PPS_CAPTUREASSERT; else i = PPS_CAPTURECLEAR; - + if (i&mode) { if (time_pps_kcbind(instance->pps_h, PPS_KC_HARDPPS, i, PPS_TSFMT_TSPEC) < 0) { @@ -535,27 +675,12 @@ oncore_start( "refclock_ioctl: time_pps_kcbind failed: %m"); return (0); } + pps_enable = 1; } } } #endif - instance->pp = pp; - instance->peer = peer; - instance->o_state = ONCORE_NO_IDEA; - cp = "state = ONCORE_NO_IDEA"; - record_clock_stats(&(instance->peer->srcadr), cp); - - /* - * Initialize miscellaneous variables - */ - - peer->precision = -26; - peer->minpoll = 4; - peer->maxpoll = 4; - pp->clockdesc = "Motorola UT/VP Oncore GPS Receiver"; - memcpy((char *)&pp->refid, "GPS\0", 4); - pp->io.clock_recv = oncore_receive; pp->io.srcclock = (caddr_t)peer; pp->io.datalen = 0; @@ -566,26 +691,16 @@ oncore_start( free(instance); return (0); } - pp->unitptr = (caddr_t)instance; /* - * This will start the Oncore receiver. - * We send info from config to Oncore later. + * This will return the Model Number of the Oncore receiver. */ - instance->timeout = 1; - mode = instance->init_type; - if (mode == 3 || mode == 4) { - oncore_sendmsg(instance->ttyfd, oncore_cmd_Cf, sizeof oncore_cmd_Cf); - instance->o_state = ONCORE_RESET_SENT; - cp = "state = ONCORE_RESET_SENT"; - record_clock_stats(&(instance->peer->srcadr), cp); - } else { - oncore_sendmsg(instance->ttyfd, oncore_cmd_Fa, sizeof oncore_cmd_Fa); - instance->o_state = ONCORE_TEST_SENT; - cp = "state = ONCORE_TEST_SENT"; - record_clock_stats(&(instance->peer->srcadr), cp); - } + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); + instance->o_state = ONCORE_ID_SENT; + cp = "state = ONCORE_ID SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->timeout = 4; instance->pollcnt = 2; return (1); @@ -593,94 +708,25 @@ oncore_start( -static void -oncore_init_shmem(struct instance *instance, char *filename) -{ -#ifdef ONCORE_SHMEM_STATUS - int i, l, n; - char *buf; - struct msg_desc *mp; - static unsigned int oncore_shmem_length; - - if (oncore_messages[0].shmem == 0) { - n = 1; - for (mp = oncore_messages; mp->flag[0]; mp++) { - mp->shmem = n; - /* Allocate space for multiplexed almanac */ - if (!strcmp(mp->flag, "Cb")) { - oncore_shmem_Cb = n; - n += (mp->len + 2) * 34; - } - n += mp->len + 2; - } - oncore_shmem_length = n + 2; - fprintf(stderr, "ONCORE: SHMEM length: %d bytes\n", oncore_shmem_length); - } - instance->statusfd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0644); - if (instance->statusfd < 0) { - perror(filename); - exit(4); - } - buf = malloc(oncore_shmem_length); - if (buf == NULL) { - perror("malloc"); - exit(4); - } - memset(buf, 0, sizeof(buf)); - i = write(instance->statusfd, buf, oncore_shmem_length); - if (i != oncore_shmem_length) { - perror(filename); - exit(4); - } - free(buf); - instance->shmem = (u_char *) mmap(0, oncore_shmem_length, - PROT_READ | PROT_WRITE, -#ifdef MAP_HASSEMAPHORE - MAP_HASSEMAPHORE | -#endif - MAP_SHARED, - instance->statusfd, (off_t)0); - if (instance->shmem == MAP_FAILED) { - instance->shmem = 0; - close (instance->statusfd); - exit(4); - } - for (mp = oncore_messages; mp->flag[0]; mp++) { - l = mp->shmem; - instance->shmem[l + 0] = mp->len >> 8; - instance->shmem[l + 1] = mp->len & 0xff; - instance->shmem[l + 2] = '@'; - instance->shmem[l + 3] = '@'; - instance->shmem[l + 4] = mp->flag[0]; - instance->shmem[l + 5] = mp->flag[1]; - if (!strcmp(mp->flag, "Cb")) { - for (i = 1; i < 35; i++) { - instance->shmem[l + i * 35 + 0] = mp->len >> 8; - instance->shmem[l + i * 35 + 1] = mp->len & 0xff; - instance->shmem[l + i * 35 + 2] = '@'; - instance->shmem[l + i * 35 + 3] = '@'; - instance->shmem[l + i * 35 + 4] = mp->flag[0]; - instance->shmem[l + i * 35 + 5] = mp->flag[1]; - } - } - } -#endif /* ONCORE_SHMEM_STATUS */ -} - /* * Read Input file if it exists. */ + static void oncore_read_config( struct instance *instance ) { /* - * First we try to open the configuration file /etc/ntp.oncoreN, where - * N is the unit number viz 127.127.30.N. - * If we don't find it, then we try the file /etc/ntp.oncore. + * First we try to open the configuration file + * /etc/oncoreN + * where N is the unit number viz 127.127.30.N. + * If we don't find it we try + * /etc/ntp.oncore.N + * and then + * /etc/ntp.oncore * - * If we find NEITHER then we don't have the cable delay or PPS offset + * If we don't find any then we don't have the cable delay or PPS offset * and we choose MODE (4) below. * * Five Choices for MODE @@ -705,7 +751,8 @@ oncore_read_config( * ------------------------------------------------------------------------------- * * If we open one or the other of the files, we read it looking for - * MODE, LAT, LON, (HT, HTGPS, HTMSL), DELAY, OFFSET + * MODE, LAT, LON, (HT, HTGPS, HTMSL), DELAY, OFFSET, ASSERT, CLEAR, STATUS, + * POSN3D, POSN2D, CHAN, TRAIM * then initialize using method MODE. For Mode = (1,3) all of (LAT, LON, HT) must * be present or mode reverts to (2,4). * @@ -723,26 +770,47 @@ oncore_read_config( * DDD MMM.mmm * DDD MMM SSS.sss * - * Expect to see one line with 'HT' (or 'HTMSL' or 'HTGPS') as first field. - * followed by 1-2 fields. First is a number, the second is 'FT' or 'M'. - * for feet or meters. HT is the same as HTGPS. - * HTMSL = HT above mean_sea_level, - * HTGPS = HT above GPS ellipse. + * Expect to see one line with 'HT' as first field, + * followed by 1-2 fields. First is a number, the second is 'FT' or 'M' + * for feet or meters. HT is the height above the GPS ellipsoid. + * If the reciever reports height in both GPS and MSL, then we will report + * the difference GPS-MSL on the clockstats file. * - * There are two optional lines, starting with DELAY and OFFSET, followed + * There is an optional line, starting with DELAY, followed * by 1 or two fields. The first is a number (a time) the second is * 'MS', 'US' or 'NS' for miliseconds, microseconds or nanoseconds. - * DELAY is cable delay, typically a few tens of ns. - * OFFSET is the offset of the PPS pulse from 0. (only fully implemented + * DELAY is cable delay, typically a few tens of ns. + * + * There is an optional line, starting with OFFSET, followed + * by 1 or two fields. The first is a number (a time) the second is + * 'MS', 'US' or 'NS' for miliseconds, microseconds or nanoseconds. + * OFFSET is the offset of the PPS pulse from 0. (only fully implemented * with the PPSAPI, we need to be able to tell the Kernel about this * offset if the Kernel PLL is in use, but can only do this presently * when using the PPSAPI interface. If not using the Kernel PLL, * then there is no problem. * - * There is another optional line, with either ASSERT or CLEAR on it, which + * There is an optional line, with either ASSERT or CLEAR on it, which * determine which transition of the PPS signal is used for timing by the * PPSAPI. If neither is present, then ASSERT is assumed. * + * There are three options that have to do with using the shared memory opition. + * First, to enable the option there must be an ASSERT line with a file name. + * The file name is the file associated with the shared memory. + * + * In the shared memory there are three 'records' containing the @@Ea (or equivalent) + * data, and this contains the position data. There will always be data in the + * record cooresponding to the '0D' @@Ea record, and the user has a choice of + * filling the '3D' @@Ea record by specifying POSN3D, or the '2D' record by + * specifying POSN2D. In either case the '2D' or '3D' record is filled once + * every 15s. + * + * Two additional variables that can be set are CHAN and TRAIM. These should be + * set correctly by the code examining the @@Cj record, but we bring them out here + * to allow the user to override either the # of channels, or the existance of TRAIM. + * CHAN expects to be followed by in integer: 6, 8, or 12. TRAIM expects to be + * followed by YES or NO. + * * So acceptable input would be * # these are my coordinates (RWC) * LON -106 34.610 @@ -752,16 +820,20 @@ oncore_read_config( */ FILE *fd; - char *cp, *cc, *ca, line[100], units[2], device[20]; + char *cp, *cc, *ca, line[100], units[2], device[20], Msg[160]; int i, sign, lat_flg, long_flg, ht_flg, mode; double f1, f2, f3; - sprintf(device, "%s%d", INIT_FILE, instance->unit); - if ((fd=fopen(device, "r")) == NULL) - if ((fd=fopen(INIT_FILE, "r")) == NULL) { - instance->init_type = 4; - return; + sprintf(device, "%s%d", INIT_FILE, instance->unit); /* try "ntp.oncore0" first */ + if ((fd=fopen(device, "r")) == NULL) { /* it was in the original documentation */ + sprintf(device, "%s.%d", INIT_FILE, instance->unit); /* then try "ntp.oncore.0 */ + if ((fd=fopen(device, "r")) == NULL) { + if ((fd=fopen(INIT_FILE, "r")) == NULL) { /* and finally "ntp.oncore" */ + instance->init_type = 4; + return; + } } + } mode = 0; lat_flg = long_flg = ht_flg = 0; @@ -770,7 +842,7 @@ oncore_read_config( /* Remove comments */ if ((cp = strchr(line, '#'))) *cp = '\0'; - + /* Remove trailing space */ for (i = strlen(line); i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]); @@ -785,24 +857,30 @@ oncore_read_config( if (!*cc) continue; - /* Lowercase the command and find the arg */ + /* Uppercase the command and find the arg */ for (ca = cc; *ca; ca++) { - if (isascii((int)*ca) && islower((int)*ca)) { - *ca = toupper(*ca); - } else if (isascii((int)*ca) && isspace((int)*ca)) { - break; - } else if (*ca == '=') { - *ca = ' '; - break; + if (isascii((int)*ca)) { + if (islower((int)*ca)) { + *ca = toupper(*ca); + } else if (isspace((int)*ca) || (*ca == '=')) + break; } } - - /* Remove space leading the arg */ - for (; *ca && isascii((int)*ca) && isspace((int)*ca); ca++) + + /* Remove space (and possible =) leading the arg */ + for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++) continue; - if (!strncmp(cc, "STATUS", 6)) { - oncore_init_shmem(instance, ca); + /* + * move call to oncore_shmem_init() from here to after + * we have determined Oncore Model, so we can ignore + * request if model doesnt 'support' it + */ + + if (!strncmp(cc, "STATUS", (size_t) 6) || !strncmp(cc, "SHMEM", (size_t) 5)) { + i = strlen(ca); + instance->shmem_fname = (char *) malloc((unsigned) (i+1)); + strcpy(instance->shmem_fname, ca); continue; } @@ -811,7 +889,7 @@ oncore_read_config( if (isascii((int)*cp) && islower((int)*cp)) *cp = toupper(*cp); - if (!strncmp(cc, "LAT", 3)) { + if (!strncmp(cc, "LAT", (size_t) 3)) { f1 = f2 = f3 = 0; sscanf(ca, "%lf %lf %lf", &f1, &f2, &f3); sign = 1; @@ -821,7 +899,7 @@ oncore_read_config( } instance->ss_lat = sign*1000*(fabs(f3) + 60*(fabs(f2) + 60*f1)); /*miliseconds*/ lat_flg++; - } else if (!strncmp(cc, "LON", 3)) { + } else if (!strncmp(cc, "LON", (size_t) 3)) { f1 = f2 = f3 = 0; sscanf(ca, "%lf %lf %lf", &f1, &f2, &f3); sign = 1; @@ -831,13 +909,7 @@ oncore_read_config( } instance->ss_long = sign*1000*(fabs(f3) + 60*(fabs(f2) + 60*f1)); /*miliseconds*/ long_flg++; - } else if (!strncmp(cc, "HT", 2)) { - if (!strncmp(cc, "HTGPS", 5)) - instance->ss_ht_type = 0; - else if (!strncmp(cc, "HTMSL", 5)) - instance->ss_ht_type = 1; - else - instance->ss_ht_type = 0; + } else if (!strncmp(cc, "HT", (size_t) 2)) { f1 = 0; units[0] = '\0'; sscanf(ca, "%lf %1s", &f1, units); @@ -845,7 +917,7 @@ oncore_read_config( f1 = 0.3048 * f1; instance->ss_ht = 100 * f1; /* cm */ ht_flg++; - } else if (!strncmp(cc, "DELAY", 5)) { + } else if (!strncmp(cc, "DELAY", (size_t) 5)) { f1 = 0; units[0] = '\0'; sscanf(ca, "%lf %1s", &f1, units); @@ -859,8 +931,12 @@ oncore_read_config( f1 = 1000000000 * f1; if (f1 < 0 || f1 > 1.e9) f1 = 0; - instance->delay = f1; /* delay in ns */ - } else if (!strncmp(cc, "OFFSET", 6)) { + if (f1 < 0 || f1 > 999999) { + sprintf(Msg, "PPS Cable delay of %fns out of Range, ignored", f1); + record_clock_stats(&(instance->peer->srcadr), Msg); + } else + instance->delay = f1; /* delay in ns */ + } else if (!strncmp(cc, "OFFSET", (size_t) 6)) { f1 = 0; units[0] = '\0'; sscanf(ca, "%lf %1s", &f1, units); @@ -874,16 +950,31 @@ oncore_read_config( f1 = 1000000000 * f1; if (f1 < 0 || f1 > 1.e9) f1 = 0; - instance->offset = f1; /* offset in ns */ - } else if (!strncmp(cc, "MODE", 4)) { + if (f1 < 0 || f1 > 999999999.) { + sprintf(Msg, "PPS Offset of %fns out of Range, ignored", f1); + record_clock_stats(&(instance->peer->srcadr), Msg); + } else + instance->offset = f1; /* offset in ns */ + } else if (!strncmp(cc, "MODE", (size_t) 4)) { sscanf(ca, "%d", &mode); if (mode < 0 || mode > 4) mode = 4; - instance->init_type = mode; - } else if (!strncmp(cc, "ASSERT", 6)) { + } else if (!strncmp(cc, "ASSERT", (size_t) 6)) { instance->assert = 1; - } else if (!strncmp(cc, "CLEAR", 5)) { + } else if (!strncmp(cc, "CLEAR", (size_t) 5)) { instance->assert = 0; + } else if (!strncmp(cc, "POSN2D", (size_t) 6)) { + instance->shmem_Posn = 2; + } else if (!strncmp(cc, "POSN3D", (size_t) 6)) { + instance->shmem_Posn = 3; + } else if (!strncmp(cc, "CHAN", (size_t) 4)) { + sscanf(ca, "%d", &i); + if ((i == 6) || (i == 8) || (i == 12)) + instance->chan = i; + } else if (!strncmp(cc, "TRAIM", (size_t) 5)) { + instance->traim = 1; /* so TRAIM alone is YES */ + if (!strcmp(ca, "NO") || !strcmp(ca, "OFF")) /* Yes/No, On/Off */ + instance->traim = 0; } } fclose(fd); @@ -897,9 +988,116 @@ oncore_read_config( if ((lat_flg || long_flg || ht_flg) && !(lat_flg * long_flg * ht_flg)) { printf("ONCORE: incomplete data on %s\n", INIT_FILE); instance->posn_set = 0; - if (mode == 1 || mode == 3) - instance->init_type++; + if (mode == 1 || mode == 3) { + sprintf(Msg, "Input Mode = %d, but no/incomplete position, mode set to %d", mode, mode+1); + record_clock_stats(&(instance->peer->srcadr), Msg); + mode++; + } } + instance->init_type = mode; + + sprintf(Msg, "Input mode = %d", mode); + record_clock_stats(&(instance->peer->srcadr), Msg); +} + + + +static void +oncore_init_shmem( + struct instance *instance + ) +{ +#ifdef ONCORE_SHMEM_STATUS + int i, l, n; + char *buf; + struct msg_desc *mp; + size_t oncore_shmem_length; + + if (instance->shmem_first) + return; + + instance->shmem_first++; + + if ((instance->statusfd = open(instance->shmem_fname, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) { + perror(instance->shmem_fname); + return; + } + + n = 1; + for (mp = oncore_messages; mp->flag[0]; mp++) { + mp->shmem = n; + /* Allocate space for multiplexed almanac, and 0D/2D/3D @@Ea records */ + if (!strcmp(mp->flag, "Cb")) { + instance->shmem_Cb = n; + n += (mp->len + 3) * 34; + } + if (!strcmp(mp->flag, "Ba")) { + instance->shmem_Ba = n; + n += (mp->len + 3) * 3; + } + if (!strcmp(mp->flag, "Ea")) { + instance->shmem_Ea = n; + n += (mp->len + 3) * 3; + } + if (!strcmp(mp->flag, "Ha")) { + instance->shmem_Ha = n; + n += (mp->len + 3) * 3; + } + n += (mp->len + 3); + } + oncore_shmem_length = n + 2; + fprintf(stderr, "ONCORE: SHMEM length: %d bytes\n", (int) oncore_shmem_length); + + buf = malloc(oncore_shmem_length); + if (buf == NULL) { + perror("malloc"); + return; + } + memset(buf, 0, sizeof(buf)); + i = write(instance->statusfd, buf, oncore_shmem_length); + if (i != oncore_shmem_length) { + perror(instance->shmem_fname); + return; + } + free(buf); + instance->shmem = (u_char *) mmap(0, oncore_shmem_length, + PROT_READ | PROT_WRITE, +#ifdef MAP_HASSEMAPHORE + MAP_HASSEMAPHORE | +#endif + MAP_SHARED, + instance->statusfd, (off_t)0); + if (instance->shmem == (u_char *)MAP_FAILED) { + instance->shmem = 0; + close (instance->statusfd); + return; + } + for (mp = oncore_messages; mp->flag[0]; mp++) { + l = mp->shmem; + instance->shmem[l + 0] = mp->len >> 8; + instance->shmem[l + 1] = mp->len & 0xff; + instance->shmem[l + 2] = 0; + instance->shmem[l + 3] = '@'; + instance->shmem[l + 4] = '@'; + instance->shmem[l + 5] = mp->flag[0]; + instance->shmem[l + 6] = mp->flag[1]; + if (!strcmp(mp->flag, "Cb") || !strcmp(mp->flag, "Ba") || !strcmp(mp->flag, "Ea") || !strcmp(mp->flag, "Ha")) { + if (!strcmp(mp->flag, "Cb")) + n = 35; + else + n = 4; + for (i = 1; i < n; i++) { + instance->shmem[l + i * (mp->len+3) + 0] = mp->len >> 8; + instance->shmem[l + i * (mp->len+3) + 1] = mp->len & 0xff; + instance->shmem[l + i * (mp->len+3) + 2] = 0; + instance->shmem[l + i * (mp->len+3) + 3] = '@'; + instance->shmem[l + i * (mp->len+3) + 4] = '@'; + instance->shmem[l + i * (mp->len+3) + 5] = mp->flag[0]; + instance->shmem[l + i * (mp->len+3) + 6] = mp->flag[1]; + } + } + } +#endif /* ONCORE_SHMEM_STATUS */ } @@ -907,6 +1105,7 @@ oncore_read_config( /* * oncore_shutdown - shut down the clock */ + static void oncore_shutdown( int unit, @@ -918,6 +1117,9 @@ oncore_shutdown( pp = peer->procptr; instance = (struct instance *) pp->unitptr; + + io_closeclock(&pp->io); + free(instance); } @@ -926,6 +1128,7 @@ oncore_shutdown( /* * oncore_poll - called by the transmit procedure */ + static void oncore_poll( int unit, @@ -936,12 +1139,18 @@ oncore_poll( instance = (struct instance *) peer->procptr->unitptr; if (instance->timeout) { - char *cp; + char *cp; - oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof oncore_cmd_Cj); - instance->o_state = ONCORE_ID_SENT; - cp = "state = ONCORE_ID_SENT"; - record_clock_stats(&(instance->peer->srcadr), cp); + instance->timeout--; + if (instance->timeout == 0) { + cp = "Oncore: No response from @@Cj, shutting down driver"; + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_shutdown(unit, peer); + } else { + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); + cp = "Oncore: Resend @@Cj"; + record_clock_stats(&(instance->peer->srcadr), cp); + } return; } @@ -956,14 +1165,15 @@ oncore_poll( /* - * move dta from NTP to buffer (toss in unlikely case it wont fit) + * move data from NTP to buffer (toss in unlikely case it wont fit) */ + static void oncore_receive( struct recvbuf *rbufp ) { - u_int i; + size_t i; u_char *p; struct peer *peer; struct instance *instance; @@ -999,6 +1209,7 @@ oncore_receive( /* * Deal with any complete messages */ + static void oncore_consume( struct instance *instance @@ -1014,49 +1225,65 @@ oncore_consume( if (rcvbuf[i] == '@' && rcvbuf[i+1] == '@') break; if (debug > 4) - printf("ONCORE: >>> skipping %d chars\n", i); + printf("ONCORE[%d]: >>> skipping %d chars\n", instance->unit, i); if (i != rcvptr) - memcpy(rcvbuf, rcvbuf+i, (unsigned)(rcvptr-i)); + memcpy(rcvbuf, rcvbuf+i, (size_t)(rcvptr-i)); rcvptr -= i; + continue; } /* Ok, we have a header now */ l = sizeof(oncore_messages)/sizeof(oncore_messages[0]) -1; for(m=0; m<l; m++) - if (!strncmp(oncore_messages[m].flag, (char *)(rcvbuf+2), 2)) + if (!strncmp(oncore_messages[m].flag, (char *)(rcvbuf+2), (size_t) 2)) break; + if (m == l) { + if (debug > 4) + printf("ONCORE[%d]: >>> Unknown MSG, skipping 4 (%c%c)\n", instance->unit, rcvbuf[2], rcvbuf[3]); + memcpy(rcvbuf, rcvbuf+4, (size_t) 4); + rcvptr -= 4; + continue; + } + l = oncore_messages[m].len; #if 0 if (debug > 3) - printf("ONCORE: GOT: %c%c %d of %d entry %d\n", rcvbuf[2], rcvbuf[3], rcvptr, l, m); + printf("ONCORE[%d]: GOT: %c%c %d of %d entry %d\n", instance->unit, rcvbuf[2], rcvbuf[3], rcvptr, l, m); #endif /* Got the entire message ? */ if (rcvptr < l) return; - /* Check the checksum */ - - j = 0; - for (i = 2; i < l-3; i++) - j ^= rcvbuf[i]; - if (j == rcvbuf[l-3]) { - if (instance->shmem != NULL) - memcpy(instance->shmem + oncore_messages[m].shmem + 2, - rcvbuf, l); - oncore_msg_any(instance, rcvbuf, (unsigned) (l-3), m); - if (oncore_messages[m].handler) - oncore_messages[m].handler(instance, rcvbuf, (unsigned) (l-3)); - } else if (debug) { - printf("ONCORE: Checksum mismatch! calc %o is %o\n", j, rcvbuf[l-3]); - printf("ONCORE: @@%c%c ", rcvbuf[2], rcvbuf[3]); - for (i=4; i<l; i++) - printf("%03o ", rcvbuf[i]); - printf("\n"); + /* are we at the end of message? should be <Cksum><CR><LF> */ + + if (rcvbuf[l-2] != '\r' || rcvbuf[l-1] != '\n') { + if (debug) + printf("ONCORE[%d]: NO <CR><LF> at end of message\n", instance->unit); + } else { /* check the CheckSum */ + j = 0; + for (i = 2; i < l-3; i++) + j ^= rcvbuf[i]; + if (j == rcvbuf[l-3]) { + if (instance->shmem != NULL) { + instance->shmem[oncore_messages[m].shmem + 2]++; + memcpy(instance->shmem + oncore_messages[m].shmem + 3, + rcvbuf, (size_t) l); + } + oncore_msg_any(instance, rcvbuf, (size_t) (l-3), m); + if (oncore_messages[m].handler) + oncore_messages[m].handler(instance, rcvbuf, (size_t) (l-3)); + } else if (debug) { + printf("ONCORE[%d]: Checksum mismatch! calc %o is %o\n", instance->unit, j, rcvbuf[l-3]); + printf("ONCORE[%d]: @@%c%c ", instance->unit, rcvbuf[2], rcvbuf[3]); + for (i=4; i<l; i++) + printf("%03o ", rcvbuf[i]); + printf("\n"); + } } if (l != rcvptr) - memcpy(rcvbuf, rcvbuf+l, (unsigned) (rcvptr-l)); + memcpy(rcvbuf, rcvbuf+l, (size_t) (rcvptr-l)); rcvptr -= l; } } @@ -1066,42 +1293,56 @@ oncore_consume( /* * write message to Oncore. */ + static void oncore_sendmsg( int fd, u_char *ptr, - u_int len + size_t len ) { u_char cs = 0; - printf("ONCORE: Send @@%c%c %d\n", ptr[0], ptr[1], len); - write(fd, "@@", 2); + printf("ONCORE: Send @@%c%c %d\n", ptr[0], ptr[1], (int) len); + write(fd, "@@", (size_t) 2); write(fd, ptr, len); while (len--) cs ^= *ptr++; - write(fd, &cs, 1); - write(fd, "\r\n", 2); + write(fd, &cs, (size_t) 1); + write(fd, "\r\n", (size_t) 2); } +/* + * print Oncore response message. + */ + static void oncore_msg_any( struct instance *instance, u_char *buf, - u_int len, + size_t len, int idx ) { int i; const char *fmt = oncore_messages[idx].fmt; const char *p; +#ifdef HAVE_GETCLOCK + struct timespec ts; +#endif struct timeval tv; if (debug > 3) { +#ifdef HAVE_GETCLOCK + (void) getclock(TIMEOFDAY, &ts); + tv.tv_sec = ts.tv_sec; + tv.tv_usec = ts.tv_nsec / 1000; +#else GETTIMEOFDAY(&tv, 0); - printf("ONCORE: %ld.%06ld\n", (long) tv.tv_sec, (long) tv.tv_usec); +#endif + printf("ONCORE[%d]: %ld.%06ld\n", instance->unit, (long) tv.tv_sec, (long) tv.tv_usec); if (!*fmt) { printf(">>@@%c%c ", buf[2], buf[3]); @@ -1130,11 +1371,12 @@ oncore_msg_any( /* * Demultiplex the almanac into shmem */ + static void oncore_msg_Cb( struct instance *instance, u_char *buf, - u_int len + size_t len ) { int i; @@ -1142,7 +1384,7 @@ oncore_msg_Cb( if (instance->shmem == NULL) return; - if (buf[4] == 5) + if (buf[4] == 5) i = buf[5]; else if (buf[4] == 4 && buf[5] <= 5) i = buf[5] + 24; @@ -1150,88 +1392,63 @@ oncore_msg_Cb( i = buf[5] + 23; else i = 34; - i *= 35; - memcpy(instance->shmem + oncore_shmem_Cb + i + 2, buf, len + 3); + i *= 36; + instance->shmem[instance->shmem_Cb + i + 2]++; + memcpy(instance->shmem + instance->shmem_Cb + i + 3, buf, (size_t) (len + 3)); } -/* - * Set to Factory Defaults (Reasonable for UT w/ no Battery Backup - * not so for VP (eeprom) or UT with battery - */ -static void -oncore_msg_Cf( - struct instance *instance, - u_char *buf, - u_int len - ) -{ - const char *cp; - if (instance->o_state == ONCORE_RESET_SENT) { - oncore_sendmsg(instance->ttyfd, oncore_cmd_Fa, sizeof oncore_cmd_Fa); - instance->o_state = ONCORE_TEST_SENT; - cp = "state = ONCORE_TEST_SENT"; - record_clock_stats(&(instance->peer->srcadr), cp); - } -} +/* + * We do an @@Cj twice in the initialization sequence. + * o Once at the very beginning to get the Model number so we know what commands + * we can issue, + * o And once later after we have done a reset and test, (which may hang), + * as we are about to initialize the Oncore and start it running. + * o We have one routine below for each case. + */ -/* there are good reasons NOT to do a @@Fa command with the ONCORE. - * Doing it, it was found that under some circumstances the following - * command would fail if issued immediately after the return from the - * @@Fa, but a 2sec delay seemed to fix things. Since simply calling - * sleep(2) is wastefull, and may cause trouble for some OS's, repeating - * itimer, we set a flag, and test it at the next POLL. If it hasnt - * been cleared, we reissue the @@Ca that is issued below. +/* + * Determine the Type from the Model #, this determines #chan and if TRAIM is + * available. We use ONLY the #chans, and determint TRAIM by trying it. */ static void -oncore_msg_Fa( +oncore_msg_Cj( struct instance *instance, u_char *buf, - u_int len + size_t len ) { - const char *cp; - - if (instance->o_state == ONCORE_TEST_SENT) { - if (debug > 2) - printf("ONCORE: >>@@Fa %x %x\n", buf[4], buf[5]); - if (buf[4] || buf[5]) { - printf("ONCORE: SELF TEST FAILED\n"); - exit(1); - } + memcpy(instance->Cj, buf, len); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof oncore_cmd_Cj); - instance->o_state = ONCORE_ID_SENT; - cp = "state = ONCORE_ID_SENT"; - record_clock_stats(&(instance->peer->srcadr), cp); - } + instance->timeout = 0; + if (instance->o_state == ONCORE_ID_SENT) + oncore_msg_Cj_id(instance, buf, len); + else if (instance->o_state == ONCORE_INIT) + oncore_msg_Cj_init(instance, buf, len); } -/* - * preliminaries out of the way, this is the REAL start of initialization +/* The information on determing a Oncore 'Model', viz VP, UT, etc, from + * the Model Number comes from "Richard M. Hambly" <rick@cnssys.com> + * and from Motorola. Until recently Rick was the only source of + * this information as Motorola didnt give the information out. */ + static void -oncore_msg_Cj( +oncore_msg_Cj_id( struct instance *instance, u_char *buf, - u_int len + size_t len ) { - char *cp, *cp1; + char *cp, *cp1, *cp2, Model[21], Msg[160]; int mode; - instance->timeout = 0; - if (instance->o_state != ONCORE_ID_SENT) - return; - - memcpy(instance->Cj, buf, len); - - /* Write Receiver ID to clockstats file */ + /* Write Receiver ID message to clockstats file */ instance->Cj[294] = '\0'; for (cp=(char *)instance->Cj; cp< (char *) &instance->Cj[294]; ) { @@ -1243,6 +1460,114 @@ oncore_msg_Cj( *cp1 = '\r'; cp = cp1+2; } + + /* next, the Firmware Version and Revision numbers */ + + instance->version = atoi(&instance->Cj[83]); + instance->revision = atoi(&instance->Cj[111]); + + /* from model number decide which Oncore this is, + and then the number of channels */ + + for (cp=&instance->Cj[160]; *cp == ' '; cp++) /* start right after 'Model #' */ + ; + cp1 = cp; + cp2 = Model; + for (; !isspace((int)*cp) && cp-cp1 < 20; cp++, cp2++) + *cp2 = *cp; + *cp2 = '\0'; + + cp = 0; + if (!strncmp(Model, "PVT6", (size_t) 4)) { + cp = "PVT6"; + instance->model = ONCORE_PVT6; + } else if (Model[0] == 'A') { + cp = "Basic"; + instance->model = ONCORE_BASIC; + } else if (Model[0] == 'B' || !strncmp(Model, "T8", (size_t) 2)) { + cp = "VP"; + instance->model = ONCORE_VP; + } else if (!strncmp(Model, "P1", (size_t) 2)) { + cp = "M12"; + instance->model = ONCORE_M12; + } else if (Model[0] == 'R') { + if (Model[5] == 'N') { + cp = "GT"; + instance->model = ONCORE_GT; + } else if ((Model[1] == '3' || Model[1] == '4') && Model[5] == 'G') { + cp = "GT+"; + instance->model = ONCORE_GTPLUS; + } else if ((Model[1] == '5' && Model[5] == 'U') || (Model[1] == '1' && Model[5] == 'A')) { + cp = "UT"; + instance->model = ONCORE_UT; + } else if (Model[1] == '5' && Model[5] == 'G') { + cp = "UT+"; + instance->model = ONCORE_UTPLUS; + } else if (Model[1] == '6' && Model[5] == 'G') { + cp = "SL"; + instance->model = ONCORE_SL; + } else { + cp = "Unknown"; + instance->model = ONCORE_UNKNOWN; + } + } else { + cp = "Unknown"; + instance->model = ONCORE_UNKNOWN; + } + + sprintf(Msg, "This looks like an Oncore %s with version %d.%d firmware.", cp, instance->version, instance->revision); + record_clock_stats(&(instance->peer->srcadr), Msg); + + if (instance->chan == 0) { /* dont reset if set in input data */ + instance->chan = 8; /* default */ + if (instance->model == ONCORE_BASIC || instance->model == ONCORE_PVT6) + instance->chan = 6; + else if (instance->model == ONCORE_VP || instance->model == ONCORE_UT || instance->model == ONCORE_UTPLUS) + instance->chan = 8; + else if (instance->model == ONCORE_M12) + instance->chan = 12; + } + + if (instance->traim == -1) { /* dont reset if set in input data */ + instance->traim = 0; /* default */ + if (instance->model == ONCORE_BASIC || instance->model == ONCORE_PVT6) + instance->traim = 0; + else if (instance->model == ONCORE_VP || instance->model == ONCORE_UT || instance->model == ONCORE_UTPLUS) + instance->traim = 1; + else if (instance->model == ONCORE_M12) + instance->traim = 0; + } + + sprintf(Msg, "Channels = %d, TRAIM = %s", instance->chan, + ((instance->traim < 0) ? "UNKNOWN" : ((instance->traim > 0) ? "ON" : "OFF"))); + record_clock_stats(&(instance->peer->srcadr), Msg); + + /* The M12 with 1.3 Firmware, looses track of all Satellites and has to + * start again if we go from 0D -> 3D, then looses them again when we + * go from 3D -> 0D. We do this to get a @@Ea message for SHMEM. + * For NOW we have SHMEM turned off for the M12, v1.3 + */ + +/*BAD M12*/ if (instance->model == ONCORE_M12 && instance->version == 1 && instance->revision <= 3) { + instance->shmem_fname = 0; + cp = "*** SHMEM turned off for ONCORE M12 ***"; + record_clock_stats(&(instance->peer->srcadr), cp); + } + + /* + * we now know model number and have zeroed + * instance->shmem_fname if SHMEM is not supported + */ + + if (instance->shmem_fname); + oncore_init_shmem(instance); + + if (instance->shmem) + cp = "SHMEM is available"; + else + cp = "SHMEM is NOT available"; + record_clock_stats(&(instance->peer->srcadr), cp); + #ifdef HAVE_PPSAPI if (instance->assert) cp = "Timing on Assert."; @@ -1251,72 +1576,180 @@ oncore_msg_Cj( record_clock_stats(&(instance->peer->srcadr), cp); #endif - oncore_sendmsg(instance->ttyfd, oncore_cmd_Cg, sizeof oncore_cmd_Cg); /* Set Posn Fix mode (not Idle (VP)) */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Bb, sizeof oncore_cmd_Bb); /* turn off */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ek, sizeof oncore_cmd_Ek); /* turn off */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Aw, sizeof oncore_cmd_Aw); /* UTC time */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_AB, sizeof oncore_cmd_AB); /* Appl type static */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Be, sizeof oncore_cmd_Be); /* Tell us the Almanac */ + mode = instance->init_type; + if (mode == 3 || mode == 4) { /* Cf will call Fa */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cf, sizeof(oncore_cmd_Cf)); + instance->o_state = ONCORE_RESET_SENT; + cp = "state = ONCORE_RESET_SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + } else { + if (instance->chan == 6) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ca, sizeof(oncore_cmd_Ca)); + else if (instance->chan == 8) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Fa, sizeof(oncore_cmd_Fa)); + else if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ia, sizeof(oncore_cmd_Ia)); + + instance->o_state = ONCORE_TEST_SENT; + cp = "state = ONCORE_TEST_SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->timeout = 4; + } +} + + + +static void +oncore_msg_Cj_init( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char *cp, Cmd[20], Msg[160]; + int mode; + + /* OK, know type of Oncore, have possibly reset, and have tested. + * If we have or don't have TRAIM and position hold may still be unknown. + * Now initialize. + */ + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cg, sizeof(oncore_cmd_Cg)); /* Set Posn Fix mode (not Idle (VP)) */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bb, sizeof(oncore_cmd_Bb)); /* turn on for shmem */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ek, sizeof(oncore_cmd_Ek)); /* turn off */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Aw, sizeof(oncore_cmd_Aw)); /* UTC time */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_AB, sizeof(oncore_cmd_AB)); /* Appl type static */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Be, sizeof(oncore_cmd_Be)); /* Tell us the Almanac for shmem */ + + /* Turn OFF position hold, it needs to be off to set position (for some units), + will get set ON in @@Ea later */ + + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd0, sizeof(oncore_cmd_Gd0)); + else { + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); + } mode = instance->init_type; - if (debug) - printf("ONCORE: INIT mode = %d\n", mode); + if (debug) { + printf("ONCORE[%d]: INIT mode = %d\n", instance->unit, mode); + printf("ONCORE[%d]: chan = %d\n", instance->unit, instance->chan); + } /* If there is Position input in the Config file * and mode = (1,3) set it as posn hold posn, goto 0D mode. - * or mode = (2,4) set it as INITIAL position, and Site Survey. + * or mode = (2,4) set it as INITIAL position, and do Site Survey. */ + + if (instance->posn_set) { + switch (mode) { /* if we have a position, put it in as posn and posn-hold posn */ + case 0: + break; + case 1: + case 2: + case 3: + case 4: + memcpy(Cmd, oncore_cmd_As, sizeof(oncore_cmd_As)); /* dont modify static variables */ + w32_buf(&Cmd[2], (int) instance->ss_lat); + w32_buf(&Cmd[6], (int) instance->ss_long); + w32_buf(&Cmd[10], (int) instance->ss_ht); + Cmd[14] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_As)); + + memcpy(Cmd, oncore_cmd_Au, sizeof(oncore_cmd_Au)); + w32_buf(&Cmd[2], (int) instance->ss_ht); + Cmd[6] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Au)); + + if (instance->chan == 12) { + memcpy(Cmd, oncore_cmd_Ga, sizeof(oncore_cmd_Ga)); + w32_buf(&Cmd[2], (int) instance->ss_lat); + w32_buf(&Cmd[6], (int) instance->ss_long); + w32_buf(&Cmd[10], (int) instance->ss_ht); + Cmd[14] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ga)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd1, sizeof(oncore_cmd_Gd1)); + } else { + memcpy(Cmd, oncore_cmd_Ad, sizeof(oncore_cmd_Ad)); + w32_buf(&Cmd[2], (int) instance->ss_lat); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ad)); + + memcpy(Cmd, oncore_cmd_Ae, sizeof(oncore_cmd_Ae)); + w32_buf(&Cmd[2], (int) instance->ss_long); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ae)); + + memcpy(Cmd, oncore_cmd_Af, sizeof(oncore_cmd_Af)); + w32_buf(&Cmd[2], (int) instance->ss_ht); + Cmd[6] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Af)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_At1, sizeof(oncore_cmd_At1)); + } + break; + } + } + + switch (mode) { case 0: /* NO initialization, don't change anything */ instance->site_survey = ONCORE_SS_DONE; break; case 1: - case 3: - w32_buf(&oncore_cmd_As[2], (int) instance->ss_lat); - w32_buf(&oncore_cmd_As[6], (int) instance->ss_long); - w32_buf(&oncore_cmd_As[10], (int) instance->ss_ht); - oncore_cmd_As[14] = instance->ss_ht_type; - oncore_sendmsg(instance->ttyfd, oncore_cmd_As, sizeof oncore_cmd_As); - + case 3: /* Use given Position */ instance->site_survey = ONCORE_SS_DONE; - oncore_cmd_At[2] = 1; - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); - record_clock_stats(&(instance->peer->srcadr), "Now in 0D mode"); break; case 2: - case 4: - if (instance->posn_set) { - w32_buf(&oncore_cmd_Ad[2], (int) instance->ss_lat); - w32_buf(&oncore_cmd_Ae[2], (int) instance->ss_long); - w32_buf(&oncore_cmd_Af[2], (int) instance->ss_ht); - oncore_cmd_Af[6] = instance->ss_ht_type; - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ad, sizeof oncore_cmd_Ad); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ae, sizeof oncore_cmd_Ae); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Af, sizeof oncore_cmd_Af); + case 4: /* Site Survey */ + if (instance->chan == 12) { /* no 12chan site survey command */ + instance->site_survey = ONCORE_SS_SW; + sprintf(Msg, "Initiating software 3D site survey (%d samples)", POS_HOLD_AVERAGE); + record_clock_stats(&(instance->peer->srcadr), Msg); + } else { + instance->site_survey = ONCORE_SS_TESTING; + oncore_sendmsg(instance->ttyfd, oncore_cmd_At2, sizeof(oncore_cmd_At2)); } - instance->site_survey = ONCORE_SS_UNKNOWN; - oncore_cmd_At[2] = 2; - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); break; } if (mode != 0) { /* cable delay in ns */ - w32_buf(&oncore_cmd_Az[2], instance->delay); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Az, sizeof oncore_cmd_Az); + memcpy(Cmd, oncore_cmd_Az, sizeof(oncore_cmd_Az)); + w32_buf(&Cmd[2], instance->delay); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Az)); /* PPS offset in ns */ - w32_buf(&oncore_cmd_Ay[2], instance->offset); - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ay, sizeof oncore_cmd_Ay); + if (instance->offset) { + if (instance->model == ONCORE_VP || instance->model == ONCORE_UT || + instance->model == ONCORE_UTPLUS) { + memcpy(Cmd, oncore_cmd_Ay, sizeof(oncore_cmd_Ay)); + w32_buf(&Cmd[2], instance->offset); + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Ay)); + } else { + cp = "Can only set PPS OFFSET for VP/UT/UT+, offset ignored"; + record_clock_stats(&(instance->peer->srcadr), cp); + instance->offset = 0; + } + } } - /* 8chan - Position/Status/Data Output Message, 1/s */ - - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea, sizeof oncore_cmd_Ea); - + /* 6, 8 12 chan - Position/Status/Data Output Message, 1/s */ + /* now we're really running */ + + if (instance->chan == 6) { /* kill 8 chan commands, possibly testing VP in 6chan mode */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba, sizeof(oncore_cmd_Ba)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea0, sizeof(oncore_cmd_Ea0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_En0, sizeof(oncore_cmd_En0)); + } else if (instance->chan == 8) { /* kill 6chan commands */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ea, sizeof(oncore_cmd_Ea)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ba0, sizeof(oncore_cmd_Ba0)); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bn0, sizeof(oncore_cmd_Bn0)); + } else if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ha, sizeof(oncore_cmd_Ha)); + + instance->count = 1; instance->o_state = ONCORE_ALMANAC; cp = "state = ONCORE_ALMANAC"; record_clock_stats(&(instance->peer->srcadr), cp); @@ -1324,104 +1757,412 @@ oncore_msg_Cj( +/* + * Set to Factory Defaults (Reasonable for UT w/ no Battery Backup + * not so for VP (eeprom) or any unit with a battery + */ + +static void +oncore_msg_Cf( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + const char *cp; + + if (instance->o_state == ONCORE_RESET_SENT) { + if (instance->chan == 6) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ca, sizeof(oncore_cmd_Ca)); + else if (instance->chan == 8) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Fa, sizeof(oncore_cmd_Fa)); + else if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ia, sizeof(oncore_cmd_Ia)); + + instance->o_state = ONCORE_TEST_SENT; + cp = "state = ONCORE_TEST_SENT"; + record_clock_stats(&(instance->peer->srcadr), cp); + } +} + + + +/* Here for @@Ca, @@Fa and @@Ia messages */ + +/* There are good reasons NOT to do a @@Ca or @@Fa command with the ONCORE. + * Doing it, it was found that under some circumstances the following + * command would fail if issued immediately after the return from the + * @@Fa, but a 2sec delay seemed to fix things. Since simply calling + * sleep(2) is wastefull, and may cause trouble for some OS's, repeating + * itimer, we set a flag, and test it at the next POLL. If it hasnt + * been cleared, we reissue the @@Cj that is issued below. + * Note that we do a @@Cj at the beginning, and again here. + * The first is to get the info, the 2nd is just used as a safe command + * after the @@Fa for all Oncores (and it was in this posn in the + * original code). + */ + +static void +oncore_msg_CaFaIa( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + char *cp; + + if (instance->o_state == ONCORE_TEST_SENT) { + int antenna; + + instance->timeout = 0; + + if (debug > 2) { + if (buf[2] == 'I') + printf("ONCORE[%d]: >>@@%ca %x %x %x\n", instance->unit, buf[2], buf[4], buf[5], buf[6]); + else + printf("ONCORE[%d]: >>@@%ca %x %x\n", instance->unit, buf[2], buf[4], buf[5]); + } + + antenna = buf[4] & 0xc0; + antenna >>= 6; + buf[4] &= ~0xc0; + + if (buf[4] || buf[5] || ((buf[2] == 'I') && buf[6])) { + cp = "ONCORE: Self Test Failed, shutting down driver"; + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_shutdown(instance->unit, instance->peer); + return; + } + if (antenna) { + char *cp1, Msg[160]; + + cp1 = (antenna == 0x1) ? "(Over Current)" : + ((antenna == 0x2) ? "(Under Current)" : "(No Voltage)"); + + cp = "ONCORE: Self Test, NonFatal Antenna Problems "; + strcpy(Msg, cp); + strcat(Msg, cp1); + record_clock_stats(&(instance->peer->srcadr), Msg); + } + + oncore_sendmsg(instance->ttyfd, oncore_cmd_Cj, sizeof(oncore_cmd_Cj)); + instance->o_state = ONCORE_INIT; + cp = "state = ONCORE_INIT"; + record_clock_stats(&(instance->peer->srcadr), cp); + } +} + + + +/* Ba, Ea and Ha come here */ + static void -oncore_msg_Ea( +oncore_msg_BaEaHa( struct instance *instance, u_char *buf, - u_int len + size_t len ) { const char *cp; - char Msg[160]; + char Msg[160], Cmd[20]; + u_char *vp; /* pointer to start of shared mem for Ba/Ea/Ha */ + size_t Len; + + /* At the beginning of Ea here there are various 'timers'. + * We enter Ea 1/sec, and since the upper levels of NTP have usurped + * the use of timers, we use the 1/sec entry to Ea to do things that + * we would normally do with timers... + */ + + if (instance->count) { + if (instance->count++ < 5) /* make sure results are stable, using position */ + return; + instance->count = 0; + } if (instance->o_state != ONCORE_ALMANAC && instance->o_state != ONCORE_RUN) return; - memcpy(instance->Ea, buf, len); + Len = len+3; /* message length @@ -> CR,LF */ + memcpy(instance->Ea, buf, Len); /* Ba, Ea or Ha */ + + if (buf[2] == 'B') { /* 6chan */ + if (instance->Ea[64]&0x8) + instance->mode = MODE_0D; + else if (instance->Ea[64]&0x10) + instance->mode = MODE_2D; + else if (instance->Ea[64]&0x20) + instance->mode = MODE_3D; + } else if (buf[2] == 'E') { /* 8chan */ + if (instance->Ea[72]&0x8) + instance->mode = MODE_0D; + else if (instance->Ea[72]&0x10) + instance->mode = MODE_2D; + else if (instance->Ea[72]&0x20) + instance->mode = MODE_3D; + } else if (buf[2] == 'H') { /* 12chan */ + int bits; + + bits = (instance->Ea[129]>>5) & 0x7; /* actually Ha */ + if (bits == 0x4) + instance->mode = MODE_0D; + else if (bits == 0x6) + instance->mode = MODE_2D; + else if (bits == 0x7) + instance->mode = MODE_3D; + } + + vp = (u_char) 0; /* just to keep compiler happy */ + if (instance->chan == 6) { + instance->rsm.bad_almanac = instance->Ea[64]&0x1; + instance->rsm.bad_fix = instance->Ea[64]&0x52; + vp = &instance->shmem[instance->shmem_Ba]; + } else if (instance->chan == 8) { + instance->rsm.bad_almanac = instance->Ea[72]&0x1; + instance->rsm.bad_fix = instance->Ea[72]&0x52; + vp = &instance->shmem[instance->shmem_Ea]; + } else if (instance->chan == 12) { + int bits1, bits2; + + bits1 = (instance->Ea[129]>>5) & 0x7; /* actually Ha */ + bits2 = instance->Ea[130]; + instance->rsm.bad_almanac = (bits2 & 0x80); + instance->rsm.bad_fix = (bits2 & 0x8) || (bits1 == 0x2); + /* too few sat Bad Geom */ + vp = &instance->shmem[instance->shmem_Ha]; +#if 0 +fprintf(stderr, "ONCORE: DEBUG BITS: (%x %x), (%x %x), %x %x %x %x %x\n", + instance->Ea[129], instance->Ea[130], bits1, bits2, instance->mode == MODE_0D, instance->mode == MODE_2D, + instance->mode == MODE_3D, instance->rsm.bad_almanac, instance->rsm.bad_fix); +#endif + } + + /* Here calculate dH = GPS - MSL for output message */ + /* also set Altitude Hold mode if GT */ + + if (!instance->have_dH) { + int GPS, MSL; + + instance->have_dH++; + if (instance->chan == 12) { + GPS = buf_w32(&instance->Ea[39]); + MSL = buf_w32(&instance->Ea[43]); + } else { + GPS = buf_w32(&instance->Ea[23]); + MSL = buf_w32(&instance->Ea[27]); + } + instance->dH = GPS - MSL; + instance->dH /= 100.; + + if (MSL) { /* not set ! */ + sprintf(Msg, "dH = (GPS - MSL) = %.2fm", instance->dH); + record_clock_stats(&(instance->peer->srcadr), Msg); + } - /* When we have an almanac, start the En messages */ + /* stuck in here as it only gets done once */ + + if (instance->chan != 12 && !instance->saw_At) { + cp = "Not Good, no @@At command, must be a GT/GT+"; + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); + } + } + + /* + * For instance->site_survey to be ONCORE_SS_TESTING, this must be the first + * time thru @@Ea. There are two choices + * (a) We did not get a response to the @@At0 or @@At2 commands, + * must be a GT/GT+/SL with no position hold mode. + * (b) Saw the @@At0, @@At2 commands, but @@At2 failed, + * must be a VP or older UT which doesnt have Site Survey mode. + * We will have to do it ourselves. + */ + + if (instance->site_survey == ONCORE_SS_TESTING) { /* first time thru Ea */ + sprintf(Msg, "Initiating software 3D site survey (%d samples)", + POS_HOLD_AVERAGE); + record_clock_stats(&(instance->peer->srcadr), Msg); + instance->site_survey = ONCORE_SS_SW; + + instance->ss_lat = instance->ss_long = instance->ss_ht = 0; + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); /* disable */ + } + + if (instance->shmem) { + int i; + + i = 0; + if (instance->mode == MODE_0D) /* 0D, Position Hold */ + i = 1; + else if (instance->mode == MODE_2D) /* 2D, Altitude Hold */ + i = 2; + else if (instance->mode == MODE_3D) /* 3D fix */ + i = 3; + if (i) { + i *= (Len+3); + vp[i + 2]++; + memcpy(&vp[i+3], buf, Len); + } + } + + /* Almanac mode, waiting for Almanac, cant do anything till we have it */ + /* When we have an almanac, start the En/Bn messages */ if (instance->o_state == ONCORE_ALMANAC) { - if ((instance->Ea[72] & 1)) { + if (instance->rsm.bad_almanac) { if (debug) printf("ONCORE: waiting for almanac\n"); return; - } else { - oncore_sendmsg(instance->ttyfd, oncore_cmd_En, sizeof oncore_cmd_En); + } else { /* Here we have almanac. + Start TRAIM (@@En/@@Bn) dependant on TRAIM flag. + If flag == -1, then we dont know if this unit supports + traim, and we issue the command and then wait up to + 5sec to see if we get a reply */ + + if (instance->traim != 0) { /* either yes or unknown */ + if (instance->chan == 6) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bn, sizeof(oncore_cmd_Bn)); + else if (instance->chan == 8) + oncore_sendmsg(instance->ttyfd, oncore_cmd_En, sizeof(oncore_cmd_En)); + + if (instance->traim == -1) + instance->traim_delay = 1; + } instance->o_state = ONCORE_RUN; cp = "state = ONCORE_RUN"; record_clock_stats(&(instance->peer->srcadr), cp); } } - /* must be ONCORE_RUN if we are here */ - /* First check if Hardware SiteSurvey has Finished */ + /* + * check if timer active + * if it hasnt been cleared, then @@En/@@Bn did not respond + */ + + if (instance->traim_delay) { + if (instance->traim_delay++ > 5) { + instance->traim = 0; + instance->traim_delay = 0; + cp = "ONCORE: Did not detect TRAIM response, TRAIM = OFF"; + record_clock_stats(&(instance->peer->srcadr), cp); + } + } + + /* + * must be ONCORE_RUN if we are here. + */ + + instance->pp->year = buf[6]*256+buf[7]; + instance->pp->day = ymd2yd(buf[6]*256+buf[7], buf[4], buf[5]); + instance->pp->hour = buf[8]; + instance->pp->minute = buf[9]; + instance->pp->second = buf[10]; + + /* + * Check to see if Hardware SiteSurvey has Finished. + */ if ((instance->site_survey == ONCORE_SS_HW) && !(instance->Ea[37] & 0x20)) { - instance->site_survey = ONCORE_SS_DONE; record_clock_stats(&(instance->peer->srcadr), "Now in 0D mode"); + instance->site_survey = ONCORE_SS_DONE; } - if (!instance->printed && instance->site_survey == ONCORE_SS_DONE) { /* will print to clockstat when all */ - instance->printed = 1; /* three messages respond */ - /* Read back Position Hold Params */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Asx, sizeof oncore_cmd_Asx); + if (!instance->printed && instance->site_survey == ONCORE_SS_DONE) { + instance->printed = 1; + /* Read back Position Hold Params (cant for GT) */ + if (instance->saw_At) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Asx, sizeof(oncore_cmd_Asx)); + else + oncore_print_As(instance); + /* Read back PPS Offset for Output */ - /* Nb. This will fail silently for early UT (no plus) model */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Ayx, sizeof oncore_cmd_Ayx); + /* Nb. This will fail silently for early UT (no plus) and M12 models */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_Ayx, sizeof(oncore_cmd_Ayx)); + /* Read back Cable Delay for Output */ - oncore_sendmsg(instance->ttyfd, oncore_cmd_Azx, sizeof oncore_cmd_Azx); + oncore_sendmsg(instance->ttyfd, oncore_cmd_Azx, sizeof(oncore_cmd_Azx)); } - /* Check the leap second status once per day */ + /* + * Check the leap second status once per day. + */ + + if (instance->Bj_day != buf[5]) { /* do this 1/day */ + instance->Bj_day = buf[5]; + + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gj, sizeof(oncore_cmd_Gj)); + else { + /* + * The following additional check, checking for June/December, is a + * workaround for incorrect ONCORE firmware. The oncore starts + * reporting the leap second when the GPS satellite data message + * (page 18, subframe 4) is updated to a date in the future, which + * can be several months before the leap second. WWV and other + * services seem to wait until the month of the event to turn + * on their indicators (which is usually a single bit). + */ + + if ((buf[4] == 6) || (buf[4] == 12)) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Bj, sizeof(oncore_cmd_Bj)); + } + } /* - * The following additional check, checking for June/December, is a - * workaround for incorrect ONCORE firmware. The oncore starts - * reporting the leap second when the GPS satellite data message - * (page 18, subframe 4) is updated to a date in the future, which - * which can be several months before the leap second. WWV and other - * services seem to wait until the month of the event to turn - * on their indicators (which are usually a single bit). + * if SHMEM active, every 15s, steal one 'tick' to get 2D or 3D posn. */ - if ((buf[4] == 6) || (buf[4] == 12)) { - if (instance->Bj_day != buf[5]) { /* do this 1/day */ - instance->Bj_day = buf[5]; - oncore_sendmsg(instance->ttyfd, oncore_cmd_Bj, sizeof oncore_cmd_Bj); + if (instance->shmem && instance->shmem_Posn && (instance->site_survey == ONCORE_SS_DONE)) { /* dont screw up the SS by changing mode */ + if (instance->pp->second%15 == 3) { /* start the sequence */ + instance->shmem_reset = 1; + if (instance->chan == 12) { + if (instance->shmem_Posn == 2) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd2, sizeof(oncore_cmd_Gd2)); /* 2D */ + else + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd0, sizeof(oncore_cmd_Gd0)); /* 3D */ + } else { + if (instance->saw_At) { + oncore_sendmsg(instance->ttyfd, oncore_cmd_At0, sizeof(oncore_cmd_At0)); /* out of 0D to 3D mode */ + if (instance->shmem_Posn == 2) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); /* 3D to 2D mode */ + } else + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); + } + } else if (instance->shmem_reset || (instance->mode != MODE_0D)) { + instance->shmem_reset = 0; + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd1, sizeof(oncore_cmd_Gd1)); /* 0D */ + else { + if (instance->saw_At) { + if (instance->mode == MODE_2D) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av0, sizeof(oncore_cmd_Av0)); /* 2D -> 3D or 0D */ + oncore_sendmsg(instance->ttyfd, oncore_cmd_At1, sizeof(oncore_cmd_At1)); /* to 0D mode */ + } else + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); + } } } - instance->pp->year = buf[6]*256+buf[7]; - instance->pp->day = ymd2yd(buf[6]*256+buf[7], buf[4], buf[5]); - instance->pp->hour = buf[8]; - instance->pp->minute = buf[9]; - instance->pp->second = buf[10]; + + if (instance->traim == 0) /* NO traim, go get tick */ + oncore_get_timestamp(instance, instance->offset, instance->offset); if (instance->site_survey != ONCORE_SS_SW) return; /* * We have to average our own position for the Position Hold Mode + * We use Heights from the GPS ellipsoid. */ - /* We only take PDOP/3D fixes */ - - if (instance->Ea[37] & 1) + if (instance->rsm.bad_fix) /* Not if poor geometry or less than 3 sats */ return; - /* Not if poor geometry or less than 3 sats */ - - if (instance->Ea[72] & 0x52) - return; - - /* Only 3D fix */ - - if (!(instance->Ea[72] & 0x20)) + if (instance->mode != MODE_3D) /* Only 3D Fix */ return; instance->ss_lat += buf_w32(&instance->Ea[15]); instance->ss_long += buf_w32(&instance->Ea[19]); - instance->ss_ht += buf_w32(&instance->Ea[23]); /* GPS ellipse */ + instance->ss_ht += buf_w32(&instance->Ea[23]); /* GPS ellipsoid */ instance->ss_count++; if (instance->ss_count != POS_HOLD_AVERAGE) @@ -1435,14 +2176,33 @@ oncore_msg_Ea( instance->ss_lat, instance->ss_long, instance->ss_ht); record_clock_stats(&(instance->peer->srcadr), Msg); - w32_buf(&oncore_cmd_As[2], (int) instance->ss_lat); - w32_buf(&oncore_cmd_As[6], (int) instance->ss_long); - w32_buf(&oncore_cmd_As[10], (int) instance->ss_ht); - oncore_cmd_As[14] = 0; - oncore_sendmsg(instance->ttyfd, oncore_cmd_As, sizeof oncore_cmd_As); + /* set newly determined position as 3D Position hold position */ + + memcpy(Cmd, oncore_cmd_As, sizeof(oncore_cmd_As)); + w32_buf(&Cmd[2], (int) instance->ss_lat); + w32_buf(&Cmd[6], (int) instance->ss_long); + w32_buf(&Cmd[10], (int) instance->ss_ht); + Cmd[14] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_As)); + + /* set height seperately for 2D */ + + memcpy(Cmd, oncore_cmd_Au, sizeof(oncore_cmd_Au)); + w32_buf(&Cmd[2], (int) instance->ss_ht); + Cmd[6] = 0; + oncore_sendmsg(instance->ttyfd, Cmd, sizeof(oncore_cmd_Au)); + + /* and set Position Hold */ + + if (instance->chan == 12) + oncore_sendmsg(instance->ttyfd, oncore_cmd_Gd1, sizeof(oncore_cmd_Gd1)); + else { + if (instance->saw_At) + oncore_sendmsg(instance->ttyfd, oncore_cmd_At1, sizeof(oncore_cmd_At1)); + else + oncore_sendmsg(instance->ttyfd, oncore_cmd_Av1, sizeof(oncore_cmd_Av1)); + } - oncore_cmd_At[2] = 1; - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); record_clock_stats(&(instance->peer->srcadr), "Now in 0D mode"); instance->site_survey = ONCORE_SS_DONE; } @@ -1450,21 +2210,60 @@ oncore_msg_Ea( static void -oncore_msg_En( +oncore_msg_BnEn( struct instance *instance, u_char *buf, - u_int len + size_t len ) { - int j; + long dt1, dt2; + char *cp; + + if (instance->o_state != ONCORE_RUN) + return; + + if (instance->traim_delay) { /* flag that @@En/@@Bn returned */ + instance->traim = 1; + instance->traim_delay = 0; + cp = "ONCORE: Detected TRAIM, TRAIM = ON"; + record_clock_stats(&(instance->peer->srcadr), cp); + } + + memcpy(instance->En, buf, len); /* En or Bn */ + + /* If Time RAIM doesn't like it, don't trust it */ + + if (instance->En[21]) + return; + + dt1 = instance->saw_tooth + instance->offset; /* dt this time step */ + instance->saw_tooth = (s_char) instance->En[25]; /* update for next time */ + dt2 = instance->saw_tooth + instance->offset; /* dt next time step */ + + oncore_get_timestamp(instance, dt1, dt2); +} + + + +static void +oncore_get_timestamp( + struct instance *instance, + long dt1, /* tick offset THIS time step */ + long dt2 /* tick offset NEXT time step */ + ) +{ + int Rsm; + u_long i, j; l_fp ts, ts_tmp; double dmy; -#ifdef HAVE_TIMESPEC +#ifdef HAVE_STRUCT_TIMESPEC struct timespec *tsp = 0; #else struct timeval *tsp = 0; #endif #ifdef HAVE_PPSAPI + int current_mode; + pps_params_t current_params; struct timespec timeout; pps_info_t pps_i; #else /* ! HAVE_PPSAPI */ @@ -1481,19 +2280,12 @@ oncore_msg_En( #endif #endif /* ! HAVE_PPS_API */ - if (instance->o_state != ONCORE_RUN) + if ((instance->site_survey == ONCORE_SS_DONE) && (instance->mode != MODE_0D)) return; - memcpy(instance->En, buf, len); - /* Don't do anything without an almanac to define the GPS->UTC delta */ - if (instance->Ea[72] & 1) - return; - - /* If Time RAIM doesn't like it, don't trust it */ - - if (instance->En[21]) + if (instance->rsm.bad_almanac) return; #ifdef HAVE_PPSAPI @@ -1509,24 +2301,40 @@ oncore_msg_En( if (instance->assert) { tsp = &pps_i.assert_timestamp; - if (debug > 2) - printf("ONCORE: serial/j (%d, %d) %ld.%09ld\n", - pps_i.assert_sequence, j, tsp->tv_sec, tsp->tv_nsec); + if (debug > 2) { + i = (u_long) pps_i.assert_sequence; +#ifdef HAVE_STRUCT_TIMESPEC + printf("ONCORE[%d]: serial/j (%lu, %lu) %ld.%09ld\n", + instance->unit, i, j, + (long)tsp->tv_sec, (long)tsp->tv_nsec); +#else + printf("ONCORE[%d]: serial/j (%lu, %lu) %ld.%06ld\n", + instance->unit, i, j, + (long)tsp->tv_sec, (long)tsp->tv_usec); +#endif + } if (pps_i.assert_sequence == j) { - printf("ONCORE: oncore_msg_En, error serial pps\n"); + printf("ONCORE: oncore_get_timestamp, error serial pps\n"); return; } instance->ev_serial = pps_i.assert_sequence; } else { tsp = &pps_i.clear_timestamp; - if (debug > 2) - printf("ONCORE: serial/j (%d, %d) %ld.%09ld\n", - pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_nsec); + if (debug > 2) { + i = (u_long) pps_i.clear_sequence; +#ifdef HAVE_STRUCT_TIMESPEC + printf("ONCORE[%d]: serial/j (%lu, %lu) %ld.%09ld\n", + instance->unit, i, j, (long)tsp->tv_sec, (long)tsp->tv_nsec); +#else + printf("ONCORE[%d]: serial/j (%lu, %lu) %ld.%06ld\n", + instance->unit, i, j, (long)tsp->tv_sec, (long)tsp->tv_usec); +#endif + } if (pps_i.clear_sequence == j) { - printf("ONCORE: oncore_msg_En, error serial pps\n"); + printf("ONCORE: oncore_get_timestamp, error serial pps\n"); return; } instance->ev_serial = pps_i.clear_sequence; @@ -1561,11 +2369,16 @@ oncore_msg_En( tsp = &ev.tv; if (debug > 2) +#ifdef HAVE_STRUCT_TIMESPEC + printf("ONCORE: serial/j (%d, %d) %ld.%09ld\n", + ev.serial, j, tsp->tv_sec, tsp->tv_nsec); +#else printf("ONCORE: serial/j (%d, %d) %ld.%06ld\n", ev.serial, j, tsp->tv_sec, tsp->tv_usec); +#endif if (ev.serial == j) { - printf("ONCORE: oncore_msg_En, error serial pps\n"); + printf("ONCORE: oncore_get_timestamp, error serial pps\n"); return; } instance->ev_serial = ev.serial; @@ -1587,7 +2400,7 @@ oncore_msg_En( # endif #endif /* now have timestamp in ts */ - /* add in saw_tooth and offset */ + /* add in saw_tooth and offset, these will be ZERO if no TRAIM */ /* saw_tooth not really necessary if using TIMEVAL */ /* since its only precise to us, but do it anyway. */ @@ -1595,26 +2408,57 @@ oncore_msg_En( /* offset in ns, and is positive (late), we subtract */ /* to put the PPS time transition back where it belongs */ - j = instance->saw_tooth + instance->offset; - instance->saw_tooth = (s_char) buf[25]; /* update for next time */ #ifdef HAVE_PPSAPI - /* must hand this offset off to the Kernel to do the addition */ - /* so that the Kernel PLL sees the offset too */ + /* must hand the offset for the NEXT sec off to the Kernel to do */ + /* the addition, so that the Kernel PLL sees the offset too */ - if (instance->assert) { - instance->pps_p.assert_offset.tv_nsec = - -(instance->saw_tooth + instance->offset); - } else { - instance->pps_p.clear_offset.tv_nsec = - -(instance->saw_tooth + instance->offset); + if (instance->assert) + instance->pps_p.assert_offset.tv_nsec = -dt2; + else + instance->pps_p.clear_offset.tv_nsec = -dt2; + + /* The following code is necessary, and not just a time_pps_setparams, + * using the saved instance->pps_p, since some other process on the + * machine may have diddled with the mode bits (say adding something + * that it needs). We take what is there and ADD what we need. + * [[ The results from the time_pps_getcap is unlikely to change so + * we could probably just save it, but I choose to do the call ]] + * Unfortunately, there is only ONE set of mode bits in the kernel per + * interface, and not one set for each open handle. + * + * There is still a race condition here where we might mess up someone + * elses mode, but if he is being careful too, he should survive. + */ + + if (time_pps_getcap(instance->pps_h, ¤t_mode) < 0) { + msyslog(LOG_ERR, + "refclock_ioctl: time_pps_getcap failed: %m"); + return; + } + + if (time_pps_getparams(instance->pps_h, ¤t_params) < 0) { + msyslog(LOG_ERR, + "refclock_ioctl: time_pps_getparams failed: %m"); + return; } - if (time_pps_setparams(instance->pps_h, &instance->pps_p)) + /* or current and mine */ + current_params.mode |= instance->pps_p.mode; + /* but only set whats legal */ + current_params.mode &= current_mode; + + current_params.assert_offset.tv_sec = 0; + current_params.assert_offset.tv_nsec = -dt2; + current_params.clear_offset.tv_sec = 0; + current_params.clear_offset.tv_nsec = -dt2; + + if (time_pps_setparams(instance->pps_h, ¤t_params)) perror("time_pps_setparams"); #else - /* if not PPSAPI, no way to inform kernel of OFFSET, just do it */ + /* if not PPSAPI, no way to inform kernel of OFFSET, just add the */ + /* offset for THIS second */ - dmy = -1.0e-9*j; + dmy = -1.0e-9*dt1; DTOLFP(dmy, &ts_tmp); L_ADD(&ts, &ts_tmp); #endif @@ -1625,28 +2469,55 @@ oncore_msg_En( instance->pp->msec = 0; ts_tmp = ts; - ts_tmp.l_ui = 0; /* zero integer part */ - LFPTOD(&ts_tmp, dmy); /* convert fractional part to a double */ - j = 1.0e9*dmy; /* then to integer ns */ - sprintf(instance->pp->a_lastcode, - "%u.%09u %d %d %2d %2d %2d %2ld rstat %02x dop %d nsat %2d,%d raim %d sigma %d neg-sawtooth %3d sat %d%d%d%d%d%d%d%d", - ts.l_ui, j, - instance->pp->year, instance->pp->day, - instance->pp->hour, instance->pp->minute, instance->pp->second, - (long) tsp->tv_sec % 60, - - instance->Ea[72], instance->Ea[37], instance->Ea[38], instance->Ea[39], instance->En[21], - /*rstat dop nsat visible, nsat tracked, raim */ - instance->En[23]*256+instance->En[24], (s_char) buf[25], - /* sigma neg-sawtooth */ - /*sat*/ instance->Ea[41], instance->Ea[45], instance->Ea[49], instance->Ea[53], - instance->Ea[57], instance->Ea[61], instance->Ea[65], instance->Ea[69] - ); + ts_tmp.l_ui = 0; /* zero integer part */ + LFPTOD(&ts_tmp, dmy); /* convert fractional part to a double */ + j = 1.0e9*dmy; /* then to integer ns */ + + Rsm = 0; + if (instance->chan == 6) + Rsm = instance->Ea[64]; + else if (instance->chan == 8) + Rsm = instance->Ea[72]; + else if (instance->chan == 12) + Rsm = ((instance->Ea[129]<<8) | instance->Ea[130]); + + if (instance->chan == 6 || instance->chan == 8) { + sprintf(instance->pp->a_lastcode, /* MAX length 128, currently at 117 */ + "%u.%09lu %d %d %2d %2d %2d %2ld rstat %02x dop %4.1f nsat %2d,%d traim %d sigma %d neg-sawtooth %3d sat %d%d%d%d%d%d%d%d", + ts.l_ui, j, + instance->pp->year, instance->pp->day, + instance->pp->hour, instance->pp->minute, instance->pp->second, + (long) tsp->tv_sec % 60, + Rsm, 0.1*(256*instance->Ea[35]+instance->Ea[36]), + /*rsat dop */ + instance->Ea[38], instance->Ea[39], instance->En[21], + /* nsat visible, nsat tracked, traim */ + instance->En[23]*256+instance->En[24], (s_char) instance->En[25], + /* sigma neg-sawtooth */ + /*sat*/ instance->Ea[41], instance->Ea[45], instance->Ea[49], instance->Ea[53], + instance->Ea[57], instance->Ea[61], instance->Ea[65], instance->Ea[69] + ); /* will be 0 for 6 chan */ + } else if (instance->chan == 12) { + sprintf(instance->pp->a_lastcode, + "%u.%09lu %d %d %2d %2d %2d %2ld rstat %02x dop %4.1f nsat %2d,%d sat %d%d%d%d%d%d%d%d%d%d%d%d", + ts.l_ui, j, + instance->pp->year, instance->pp->day, + instance->pp->hour, instance->pp->minute, instance->pp->second, + (long) tsp->tv_sec % 60, + Rsm, 0.1*(256*instance->Ea[53]+instance->Ea[54]), + /*rsat dop */ + instance->Ea[55], instance->Ea[56], + /* nsat visible, nsat tracked */ + /*sat*/ instance->Ea[58], instance->Ea[64], instance->Ea[70], instance->Ea[76], + instance->Ea[82], instance->Ea[88], instance->Ea[94], instance->Ea[100], + instance->Ea[106], instance->Ea[112], instance->Ea[118], instance->Ea[124] + ); + } if (debug > 2) { - int i; - i = strlen(instance->pp->a_lastcode); - printf("ONCORE: len = %d %s\n", i, instance->pp->a_lastcode); + int n; + n = strlen(instance->pp->a_lastcode); + printf("ONCORE[%d]: len = %d %s\n", instance->unit, n, instance->pp->a_lastcode); } if (!refclock_process(instance->pp)) { @@ -1672,35 +2543,21 @@ oncore_msg_En( * Try to use Oncore UT+ Auto Survey Feature * If its not there (VP), set flag to do it ourselves. */ + static void oncore_msg_At( struct instance *instance, u_char *buf, - u_int len + size_t len ) { - if (instance->site_survey != ONCORE_SS_UNKNOWN) - return; - - if (buf[4] == 2) { - record_clock_stats(&(instance->peer->srcadr), - "Initiating hardware 3D site survey"); - instance->site_survey = ONCORE_SS_HW; - } else { - char Msg[160]; - /* - * Probably a VP or an older UT which can't do site-survey. - * We will have to do it ourselves - */ - - sprintf(Msg, "Initiating software 3D site survey (%d samples)", - POS_HOLD_AVERAGE); - record_clock_stats(&(instance->peer->srcadr), Msg); - instance->site_survey = ONCORE_SS_SW; - - oncore_cmd_At[2] = 0; - instance->ss_lat = instance->ss_long = instance->ss_ht = 0; - oncore_sendmsg(instance->ttyfd, oncore_cmd_At, sizeof oncore_cmd_At); + instance->saw_At = 1; + if (instance->site_survey == ONCORE_SS_TESTING) { + if (buf[4] == 2) { + record_clock_stats(&(instance->peer->srcadr), + "Initiating hardware 3D site survey"); + instance->site_survey = ONCORE_SS_HW; + } } } @@ -1720,7 +2577,7 @@ static void oncore_msg_Bj( struct instance *instance, u_char *buf, - u_int len + size_t len ) { const char *cp; @@ -1743,41 +2600,97 @@ oncore_msg_Bj( record_clock_stats(&(instance->peer->srcadr), cp); } +/* Leap Second for M12, gives all info from satellite message */ + +static void +oncore_msg_Gj( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + int dt; + char Msg[160], *cp; + static char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jly", + "Aug", "Sep", "Oct", "Nov", "Dec" }; + + /* print the message to verify whats there */ + + dt = buf[5] - buf[4]; + +#if 1 + sprintf(Msg, "ONCORE[%d]: Leap Sec Msg: %d %d %d %d %d %d %d %d %d %d", + instance->unit, + buf[4], buf[5], 256*buf[6]+buf[7], buf[8], buf[9], buf[10], + (buf[14]+256*(buf[13]+256*(buf[12]+256*buf[11]))), + buf[15], buf[16], buf[17]); + record_clock_stats(&(instance->peer->srcadr), Msg); +#endif + if (dt) { + sprintf(Msg, "ONCORE[%d]: Leap second (%d) scheduled for %d%s%d at %d:%d:%d", + instance->unit, + dt, buf[9], Month[buf[8]], 256*buf[6]+buf[7], + buf[15], buf[16], buf[17]); + record_clock_stats(&(instance->peer->srcadr), Msg); + } + + /* Only raise warning within a month of the leap second */ + + instance->peer->leap = LEAP_NOWARNING; + cp = "Set peer.leap to LEAP_NOWARNING"; + + if (buf[6] == instance->Ea[6] && buf[7] == instance->Ea[7] && /* year */ + buf[8] == instance->Ea[4]) { /* month */ + if (dt) { + if (dt < 0) { + instance->peer->leap = LEAP_DELSECOND; + cp = "Set peer.leap to LEAP_DELSECOND"; + } else { + instance->peer->leap = LEAP_ADDSECOND; + cp = "Set peer.leap to LEAP_ADDSECOND"; + } + } + } + record_clock_stats(&(instance->peer->srcadr), cp); +} + /* * get Position hold position */ + static void oncore_msg_As( struct instance *instance, u_char *buf, - u_int len + size_t len ) { - char Msg[120], ew, ns; - const char *Ht; - double xd, xm, xs, yd, ym, ys, hm, hft; - int idx, idy, is, imx, imy; - long lat, lon, ht; - if (!instance->printed || instance->As) return; instance->As = 1; - lat = buf_w32(&buf[4]); - instance->ss_lat = lat; + instance->ss_lat = buf_w32(&buf[4]); + instance->ss_long = buf_w32(&buf[8]); + instance->ss_ht = buf_w32(&buf[12]); - lon = buf_w32(&buf[8]); - instance->ss_long = lon; + /* Print out Position */ + oncore_print_As(instance); +} - ht = buf_w32(&buf[12]); - instance->ss_ht = ht; - instance->ss_ht_type = buf[16]; - /* Print out Position */ +static void +oncore_print_As( + struct instance *instance + ) +{ + char Msg[120], ew, ns; + double xd, xm, xs, yd, ym, ys, hm, hft; + int idx, idy, is, imx, imy; + long lat, lon; record_clock_stats(&(instance->peer->srcadr), "Posn:"); ew = 'E'; @@ -1796,11 +2709,10 @@ oncore_msg_As( hm = instance->ss_ht/100.; hft= hm/0.3048; - Ht = instance->ss_ht_type ? "MSL" : "GPS"; xd = lat/3600000.; /* lat, lon in int msec arc, ht in cm. */ yd = lon/3600000.; - sprintf(Msg, "Lat = %c %11.7fdeg, Long = %c %11.7fdeg, Alt = %5.2fm (%5.2fft) %s", ns, xd, ew, yd, hm, hft, Ht); + sprintf(Msg, "Lat = %c %11.7fdeg, Long = %c %11.7fdeg, Alt = %5.2fm (%5.2fft) GPS", ns, xd, ew, yd, hm, hft); record_clock_stats(&(instance->peer->srcadr), Msg); idx = xd; @@ -1809,7 +2721,7 @@ oncore_msg_As( imy = lon%3600000; xm = imx/60000.; ym = imy/60000.; - sprintf(Msg, "Lat = %c %3ddeg %7.4fm, Long = %c %3ddeg %8.5fm, Alt = %5.2fm (%5.2fft) %s", ns, idx, xm, ew, idy, ym, hm, hft, Ht); + sprintf(Msg, "Lat = %c %3ddeg %7.4fm, Long = %c %3ddeg %8.5fm, Alt = %7.2fm (%7.2fft) GPS", ns, idx, xm, ew, idy, ym, hm, hft); record_clock_stats(&(instance->peer->srcadr), Msg); imx = xm; @@ -1818,7 +2730,7 @@ oncore_msg_As( xs = is/1000.; is = lon%60000; ys = is/1000.; - sprintf(Msg, "Lat = %c %3ddeg %2dm %5.2fs, Long = %c %3ddeg %2dm %5.2fs, Alt = %5.2fm (%5.2fft) %s", ns, idx, imx, xs, ew, idy, imy, ys, hm, hft, Ht); + sprintf(Msg, "Lat = %c %3ddeg %2dm %5.2fs, Long = %c %3ddeg %2dm %5.2fs, Alt = %7.2fm (%7.2fft) GPS", ns, idx, imx, xs, ew, idy, imy, ys, hm, hft); record_clock_stats(&(instance->peer->srcadr), Msg); } @@ -1828,11 +2740,12 @@ oncore_msg_As( * get PPS Offset * Nb. @@Ay is not supported for early UT (no plus) model */ + static void oncore_msg_Ay( struct instance *instance, u_char *buf, - u_int len + size_t len ) { char Msg[120]; @@ -1853,11 +2766,12 @@ oncore_msg_Ay( /* * get Cable Delay */ + static void oncore_msg_Az( struct instance *instance, u_char *buf, - u_int len + size_t len ) { char Msg[120]; @@ -1872,6 +2786,23 @@ oncore_msg_Az( sprintf(Msg, "Cable delay is set to %ld ns", instance->delay); record_clock_stats(&(instance->peer->srcadr), Msg); } + +static void +oncore_msg_Sz( + struct instance *instance, + u_char *buf, + size_t len + ) +{ + const char *cp; + + cp = "Oncore: System Failure at Power On"; + if (instance && instance->peer) { + record_clock_stats(&(instance->peer->srcadr), cp); + oncore_shutdown(instance->unit, instance->peer); + } +} + #else int refclock_oncore_bs; #endif /* REFCLOCK */ diff --git a/contrib/ntp/ntpd/refclock_palisade.c b/contrib/ntp/ntpd/refclock_palisade.c index bedf6e8..d8ce411 100644 --- a/contrib/ntp/ntpd/refclock_palisade.c +++ b/contrib/ntp/ntpd/refclock_palisade.c @@ -2,7 +2,7 @@ * This software was developed by the Software and Component Technologies * group of Trimble Navigation, Ltd. * - * Copyright (c) 1997, 1998, 1999 Trimble Navigation Ltd. + * Copyright (c) 1997, 1998, 1999, 2000 Trimble Navigation Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/contrib/ntp/ntpd/refclock_palisade.h b/contrib/ntp/ntpd/refclock_palisade.h index b78d988..cc37716 100644 --- a/contrib/ntp/ntpd/refclock_palisade.h +++ b/contrib/ntp/ntpd/refclock_palisade.h @@ -2,7 +2,7 @@ * This software was developed by the Software and Component Technologies * group of Trimble Navigation, Ltd. * - * Copyright (c) 1997, 1998, 1999 Trimble Navigation Ltd. + * Copyright (c) 1997, 1998, 1999, 2000 Trimble Navigation Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -91,8 +91,8 @@ #define DESCRIPTION "Trimble Palisade GPS" /* Long name */ #define PRECISION (-20) /* precision assumed (about 1 us) */ #define REFID "GPS\0" /* reference ID */ -#define TRMB_MINPOLL 5 /* 16 seconds */ -#define TRMB_MAXPOLL 7 /* 64 seconds */ +#define TRMB_MINPOLL 4 /* 16 seconds */ +#define TRMB_MAXPOLL 5 /* 32 seconds */ /* * I/O Definitions diff --git a/contrib/ntp/ntpd/refclock_parse.c b/contrib/ntp/ntpd/refclock_parse.c index 95b93aa..cfb9904 100644 --- a/contrib/ntp/ntpd/refclock_parse.c +++ b/contrib/ntp/ntpd/refclock_parse.c @@ -767,8 +767,6 @@ static poll_info_t rcc8000_pollinfo = { RCC_POLLRATE, RCC_POLLCMD, RCC_CMDSIZE } #define COMPUTIME_SAMPLES 5 #define COMPUTIME_KEEP 3 -static poll_info_t we400a_pollinfo = { 60, "T", 1 }; - /* * Varitext Radio Clock Receiver */ @@ -1169,18 +1167,18 @@ static struct parse_clockinfo }, { /* mode 15 */ 0, /* operation flags (io modes) */ - poll_dpoll, /* active poll routine */ - poll_init, /* active poll init routine */ + NO_POLL, /* active poll routine */ + NO_INIT, /* active poll init routine */ NO_EVENT, /* special event handling (e.g. reset clock) */ NO_END, /* active poll end routine */ NO_MESSAGE, /* process a lower layer message */ - ((void *)(&we400a_pollinfo)), /* local data area for "poll" mechanism */ + NO_DATA, /* local data area for "poll" mechanism */ 0, /* rootdelay */ - 1.0 / 960, /* current offset by which the RS232 + 11.0 /* bits */ / 9600, /* current offset by which the RS232 time code is delayed from the actual time */ DCF_ID, /* ID code */ "WHARTON 400A Series clock", /* device name */ - "WHARTON 400A Series clock Output Format 5", /* fixed format */ + "WHARTON 400A Series clock Output Format 1", /* fixed format */ /* Must match a format-name in a libparse/clk_xxx.c file */ DCF_TYPE, /* clock type (ntp control) */ (1*60*60), /* time to trust oscillator after loosing synch */ @@ -1242,10 +1240,10 @@ static struct parse_clockinfo static int ncltypes = sizeof(parse_clockinfo) / sizeof(struct parse_clockinfo); -#define CLK_REALTYPE(x) ((int)(((x)->ttl) & 0x7F)) +#define CLK_REALTYPE(x) ((int)(((x)->ttlmax) & 0x7F)) #define CLK_TYPE(x) ((CLK_REALTYPE(x) >= ncltypes) ? ~0 : CLK_REALTYPE(x)) #define CLK_UNIT(x) ((int)REFCLOCKUNIT(&(x)->srcadr)) -#define CLK_PPS(x) (((x)->ttl) & 0x80) +#define CLK_PPS(x) (((x)->ttlmax) & 0x80) /* * Other constant stuff @@ -5150,16 +5148,24 @@ rawdcf_init_1( struct parseunit *parse ) { + /* fixed 2000 for using with Linux by Wolfram Pienkoss <wp@bszh.de> */ /* * You can use the RS232 to supply the power for a DCF77 receiver. * Here a voltage between the DTR and the RTS line is used. Unfortunately * the name has changed from CIOCM_DTR to TIOCM_DTR recently. */ - + int sl232; + + if (ioctl(parse->generic->io.fd, TIOCMGET, (caddr_t)&sl232) == -1) + { + msyslog(LOG_NOTICE, "PARSE receiver #%d: rawdcf_init_1: WARNING: ioctl(fd, TIOCMGET, [C|T]IOCM_DTR): %m", CLK_UNIT(parse->peer)); + return 0; + } + #ifdef TIOCM_DTR - int sl232 = TIOCM_DTR; /* turn on DTR for power supply */ + sl232 = (sl232 & ~TIOCM_RTS) | TIOCM_DTR; /* turn on DTR, clear RTS for power supply */ #else - int sl232 = CIOCM_DTR; /* turn on DTR for power supply */ + sl232 = (sl232 & ~CIOCM_RTS) | CIOCM_DTR; /* turn on DTR, clear RTS for power supply */ #endif if (ioctl(parse->generic->io.fd, TIOCMSET, (caddr_t)&sl232) == -1) @@ -5189,16 +5195,24 @@ rawdcf_init_2( struct parseunit *parse ) { + /* fixed 2000 for using with Linux by Wolfram Pienkoss <wp@bszh.de> */ /* * You can use the RS232 to supply the power for a DCF77 receiver. * Here a voltage between the DTR and the RTS line is used. Unfortunately * the name has changed from CIOCM_DTR to TIOCM_DTR recently. */ - + int sl232; + + if (ioctl(parse->generic->io.fd, TIOCMGET, (caddr_t)&sl232) == -1) + { + msyslog(LOG_NOTICE, "PARSE receiver #%d: rawdcf_init_2: WARNING: ioctl(fd, TIOCMGET, [C|T]IOCM_RTS): %m", CLK_UNIT(parse->peer)); + return 0; + } + #ifdef TIOCM_RTS - int sl232 = TIOCM_RTS; /* turn on RTS, clear DTR for power supply */ + sl232 = (sl232 & ~TIOCM_DTR) | TIOCM_RTS; /* turn on RTS, clear DTR for power supply */ #else - int sl232 = CIOCM_RTS; /* turn on DTR for power supply */ + sl232 = (sl232 & ~CIOCM_DTR) | CIOCM_RTS; /* turn on RTS, clear DTR for power supply */ #endif if (ioctl(parse->generic->io.fd, TIOCMSET, (caddr_t)&sl232) == -1) diff --git a/contrib/ntp/ntpd/refclock_pcf.c b/contrib/ntp/ntpd/refclock_pcf.c index c882404..ff2b28e 100644 --- a/contrib/ntp/ntpd/refclock_pcf.c +++ b/contrib/ntp/ntpd/refclock_pcf.c @@ -8,8 +8,6 @@ #if defined(REFCLOCK) && defined(CLOCK_PCF) -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -17,18 +15,20 @@ #include "ntp_stdlib.h" /* - * This driver supports the parallel port radio clocks sold by Conrad + * This driver supports the parallel port radio clock sold by Conrad * Electronic under order numbers 967602 and 642002. * * It requires that the local timezone be CET/CEST and that the pcfclock - * device driver be installed. A device driver for Linux 2.2 is available - * at http://home.pages.de/~voegele/pcf.html. + * device driver be installed. A device driver for Linux is available at + * http://home.pages.de/~voegele/pcf.html. Information about a FreeBSD + * driver is available at http://schumann.cx/pcfclock/. */ /* * Interface definitions */ -#define DEVICE "/dev/pcfclock%d" +#define DEVICE "/dev/pcfclocks/%d" +#define OLDDEVICE "/dev/pcfclock%d" #define PRECISION (-1) /* precision assumed (about 0.5 s) */ #define REFID "PCF" #define DESCRIPTION "Conrad parallel port radio clock" @@ -67,17 +67,22 @@ pcf_start( { struct refclockproc *pp; int fd; - char device[20]; + char device[128]; /* * Open device file for reading. */ (void)sprintf(device, DEVICE, unit); + fd = open(device, O_RDONLY); + if (fd == -1) { + (void)sprintf(device, OLDDEVICE, unit); + fd = open(device, O_RDONLY); + } #ifdef DEBUG if (debug) printf ("starting PCF with device %s\n",device); #endif - if ((fd = open(device, O_RDONLY)) == -1) { + if (fd == -1) { return (0); } @@ -92,6 +97,9 @@ pcf_start( */ peer->precision = PRECISION; pp->clockdesc = DESCRIPTION; + /* one transmission takes 172.5 milliseconds since the radio clock + transmits 69 bits with a period of 2.5 milliseconds per bit */ + pp->fudgetime1 = 0.1725; memcpy((char *)&pp->refid, REFID, 4); return (1); @@ -142,7 +150,7 @@ pcf_poll( tm.tm_hour = buf[7] * 10 + buf[6]; tm.tm_min = buf[5] * 10 + buf[4]; tm.tm_sec = buf[3] * 10 + buf[2]; - tm.tm_isdst = -1; + tm.tm_isdst = (buf[8] & 1) ? 1 : (buf[8] & 2) ? 0 : -1; /* * Y2K convert the 2-digit year @@ -204,7 +212,7 @@ pcf_poll( return; } record_clock_stats(&peer->srcadr, pp->a_lastcode); - if (buf[1] & 1) + if ((buf[1] & 1) && !(pp->sloppyclockflag & CLK_FLAG2)) pp->leap = LEAP_NOTINSYNC; else pp->leap = LEAP_NOWARNING; diff --git a/contrib/ntp/ntpd/refclock_pst.c b/contrib/ntp/ntpd/refclock_pst.c index 6af4382..b92a2e0 100644 --- a/contrib/ntp/ntpd/refclock_pst.c +++ b/contrib/ntp/ntpd/refclock_pst.c @@ -8,15 +8,14 @@ #if defined(REFCLOCK) && defined(CLOCK_PST) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the PSTI 1010 and Traconex 1020 WWV/WWVH * Receivers. No specific claim of accuracy is made for these receiver, diff --git a/contrib/ntp/ntpd/refclock_shm.c b/contrib/ntp/ntpd/refclock_shm.c index a8094c8..3747ce0 100644 --- a/contrib/ntp/ntpd/refclock_shm.c +++ b/contrib/ntp/ntpd/refclock_shm.c @@ -13,12 +13,6 @@ #if defined(REFCLOCK) && defined(CLOCK_SHM) -#undef fileno -#include <ctype.h> -#undef fileno -#include <sys/time.h> -#undef fileno - #include "ntpd.h" #undef fileno #include "ntp_io.h" @@ -29,15 +23,16 @@ #undef fileno #include "ntp_stdlib.h" +#undef fileno +#include <ctype.h> +#undef fileno + #ifndef SYS_WINNT -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <assert.h> -#include <time.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +# include <sys/ipc.h> +# include <sys/shm.h> +# include <assert.h> +# include <unistd.h> +# include <stdio.h> #endif /* @@ -94,35 +89,19 @@ struct shmTime { }; struct shmTime *getShmTime (int unit) { #ifndef SYS_WINNT - extern char *sys_errlist[ ]; - extern int sys_nerr; int shmid=0; assert (unit<10); /* MAXUNIT is 4, so should never happen */ shmid=shmget (0x4e545030+unit, sizeof (struct shmTime), IPC_CREAT|(unit<2?0700:0777)); if (shmid==-1) { /*error */ - char buf[20]; - char *pe=buf; - if (errno<sys_nerr) - pe=sys_errlist[errno]; - else { - sprintf (buf,"errno=%d",errno); - } - msyslog(LOG_ERR,"SHM shmget (unit %d): %s",unit,pe); + msyslog(LOG_ERR,"SHM shmget (unit %d): %s",unit,strerror(errno)); return 0; } else { /* no error */ struct shmTime *p=(struct shmTime *)shmat (shmid, 0, 0); if ((int)(long)p==-1) { /* error */ - char buf[20]; - char *pe=buf; - if (errno<sys_nerr) - pe=sys_errlist[errno]; - else { - sprintf (buf,"errno=%d",errno); - } - msyslog(LOG_ERR,"SHM shmat (unit %d): %s",unit,pe); + msyslog(LOG_ERR,"SHM shmat (unit %d): %s",unit,strerror(errno)); return 0; } return p; @@ -285,6 +264,7 @@ shm_poll( up->valid=0; if (ok) { TVTOTS(&tvr,&pp->lastrec); + pp->lastrec.l_ui += JAN_1970; /* pp->lasttime = current_time; */ pp->polls++; t=gmtime (&tvt.tv_sec); diff --git a/contrib/ntp/ntpd/refclock_tpro.c b/contrib/ntp/ntpd/refclock_tpro.c index a29383a..159f817 100644 --- a/contrib/ntp/ntpd/refclock_tpro.c +++ b/contrib/ntp/ntpd/refclock_tpro.c @@ -8,10 +8,6 @@ #if defined(REFCLOCK) && defined(CLOCK_TPRO) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -19,6 +15,9 @@ #include "sys/tpro.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the KSI/Odetecs TPRO-S IRIG-B reader and TPRO- * SAT GPS receiver for the Sun Microsystems SBus. It requires that the diff --git a/contrib/ntp/ntpd/refclock_trak.c b/contrib/ntp/ntpd/refclock_trak.c index e7833af..326a8e9 100644 --- a/contrib/ntp/ntpd/refclock_trak.c +++ b/contrib/ntp/ntpd/refclock_trak.c @@ -10,13 +10,7 @@ #include <config.h> #endif -#if defined(REFCLOCK) && defined(CLOCK_TRAK) - -#include <stdio.h> -#include <ctype.h> -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif +#if defined(REFCLOCK) && defined(CLOCK_TRAK) && defined(PPS) #include "ntpd.h" #include "ntp_io.h" @@ -24,6 +18,9 @@ #include "ntp_stdlib.h" #include "ntp_unixtime.h" +#include <stdio.h> +#include <ctype.h> + #ifdef HAVE_SYS_TERMIOS_H # include <sys/termios.h> #endif diff --git a/contrib/ntp/ntpd/refclock_true.c b/contrib/ntp/ntpd/refclock_true.c index b841f72..dcc362d 100644 --- a/contrib/ntp/ntpd/refclock_true.c +++ b/contrib/ntp/ntpd/refclock_true.c @@ -12,16 +12,15 @@ #if defined(REFCLOCK) && defined(CLOCK_TRUETIME) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_unixtime.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* This should be an atom clock but those are very hard to build. * * The PCL720 from P C Labs has an Intel 8253 lookalike, as well as a bunch @@ -62,11 +61,12 @@ * * Quality codes indicate possible error of * 468-DC GOES Receiver: - * GPS-TM/TMD Receiver: - * ? +/- 500 milliseconds # +/- 50 milliseconds - * * +/- 5 milliseconds . +/- 1 millisecond - * space less than 1 millisecond - * OM-DC OMEGA Receiver: + * GPS-TM/TMD Receiver: (default quality codes for XL-DC) + * ? +/- 1 milliseconds # +/- 100 microseconds + * * +/- 10 microseconds . +/- 1 microsecond + * space less than 1 microsecond + * OM-DC OMEGA Receiver: (default quality codes for OMEGA) + * WARNING OMEGA navigation system is no longer existent * > >+- 5 seconds * ? >+/- 500 milliseconds # >+/- 50 milliseconds * * >+/- 5 milliseconds . >+/- 1 millisecond @@ -109,6 +109,7 @@ * flag4 - use the PCL-720 (BSD/OS only) */ + /* * Definitions */ @@ -211,11 +212,12 @@ true_debug(struct peer *peer, const char *fmt, ...) if (want_debugging != now_debugging) { if (want_debugging) { - char filename[20]; + char filename[40]; + int fd; - sprintf(filename, "/tmp/true%d.debug", up->unit); - up->debug = fopen(filename, "w"); - if (up->debug) { + snprintf(filename, sizeof(filename), "/tmp/true%d.debug", up->unit); + fd = open(filename, O_CREAT | O_WRONLY | O_EXCL, 0600); + if (fd >= 0 && (up->debug = fdopen(fd, "r+"))) { #ifdef HAVE_SETVBUF static char buf[BUFSIZ]; setvbuf(up->debug, buf, _IOLBF, BUFSIZ); @@ -247,13 +249,13 @@ true_start( { register struct true_unit *up; struct refclockproc *pp; - char device[20]; + char device[40]; int fd; /* * Open serial port */ - (void)sprintf(device, DEVICE, unit); + (void)snprintf(device, sizeof(device), DEVICE, unit); if (!(fd = refclock_open(device, SPEED232, LDISC_CLK))) return (0); @@ -325,6 +327,10 @@ true_receive( char synced; int i; int lat, lon, off; /* GOES Satellite position */ + /* Use these variable to hold data until we decide its worth keeping */ + char rd_lastcode[BMAX]; + l_fp rd_tmp; + u_short rd_lencode; /* * Get the clock this applies to and pointers to the data. @@ -336,14 +342,17 @@ true_receive( /* * Read clock output. Automatically handles STREAMS, CLKLDISC. */ - pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &pp->lastrec); + rd_lencode = refclock_gtlin(rbufp, rd_lastcode, BMAX, &rd_tmp); + rd_lastcode[rd_lencode] = '\0'; /* * There is a case where <cr><lf> generates 2 timestamps. */ - if (pp->lencode == 0) - return; - pp->a_lastcode[pp->lencode] = '\0'; + if (rd_lencode == 0) + return; + pp->lencode = rd_lencode; + strcpy(pp->a_lastcode, rd_lastcode); + pp->lastrec = rd_tmp; true_debug(peer, "receive(%s) [%d]\n", pp->a_lastcode, pp->lencode); up->pollcnt = 2; @@ -360,7 +369,8 @@ true_receive( /* * Clock misunderstood our last command? */ - if (pp->a_lastcode[0] == '?') { + if (pp->a_lastcode[0] == '?' || + strcmp(pp->a_lastcode, "ERROR 05 NO SUCH FUNCTION") == 0) { true_doevent(peer, e_Huh); return; } @@ -428,13 +438,14 @@ true_receive( } /* - * Timecode: " TRUETIME Mk III" - * (from a TM/TMD clock during initialization.) + * Timecode: " TRUETIME Mk III" or " TRUETIME XL" + * (from a TM/TMD/XL clock during initialization.) */ - if (strcmp(pp->a_lastcode, " TRUETIME Mk III") == 0) { + if (strcmp(pp->a_lastcode, " TRUETIME Mk III") == 0 || + strncmp(pp->a_lastcode, " TRUETIME XL", 12) == 0) { true_doevent(peer, e_F18); NLOG(NLOG_CLOCKSTATUS) { - msyslog(LOG_INFO, "TM/TMD: %s", pp->a_lastcode); + msyslog(LOG_INFO, "TM/TMD/XL: %s", pp->a_lastcode); } return; } @@ -467,9 +478,12 @@ true_receive( /* * Adjust the synchronize indicator according to timecode + * say were OK, and then say not if we really are not OK */ - if (synced != ' ' && synced != '.' && synced != '*') + if (synced == '>' || synced == '#' || synced == '?') pp->leap = LEAP_NOTINSYNC; + else + pp->leap = LEAP_NOWARNING; true_doevent(peer, e_TS); @@ -527,6 +541,11 @@ true_receive( refclock_report(peer, CEVNT_BADTIME); return; } + /* + * If clock is good we send a NOMINAL message so that + * any previous BAD messages are nullified + */ + refclock_report(peer, CEVNT_NOMINAL); refclock_receive(peer); /* diff --git a/contrib/ntp/ntpd/refclock_ulink.c b/contrib/ntp/ntpd/refclock_ulink.c index 347040d..5bf569a 100644 --- a/contrib/ntp/ntpd/refclock_ulink.c +++ b/contrib/ntp/ntpd/refclock_ulink.c @@ -1,12 +1,25 @@ /* - * refclock_ulink - clock driver for Ultralink Model 320 WWVB receivers - * By Dave Strout <dstrout@linuxfoundary.com> - * - * Latest version is always on www.linuxfoundary.com - * - * Based on the Spectracom driver + * refclock_ulink - clock driver for Ultralink WWVB receiver + * */ +/*********************************************************************** + * * + * Copyright (c) David L. Mills 1992-1998 * + * * + * Permission to use, copy, modify, and distribute this software and * + * its documentation for any purpose and without fee is hereby * + * granted, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission * + * notice appear in supporting documentation, and that the name * + * University of Delaware not be used in advertising or publicity * + * pertaining to distribution of the software without specific, * + * written prior permission. The University of Delaware makes no * + * representations about the suitability this software for any * + * purpose. It is provided "as is" without express or implied * + * warranty. * + **********************************************************************/ + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -15,8 +28,6 @@ #include <stdio.h> #include <ctype.h> -#include <sys/time.h> -#include <time.h> #include "ntpd.h" #include "ntp_io.h" @@ -25,63 +36,66 @@ #include "ntp_stdlib.h" /* - * This driver supports the Ultralink Model 320 WWVB receiver. The Model 320 is - * an RS-232 powered unit which consists of two parts: a DB-25 shell that contains - * a microprocessor, and an approx 2"x4" plastic box that contains the antenna. - * The two are connected by a 6-wire RJ-25 cable of length up to 1000'. The - * microprocessor steals power from the RS-232 port, which means that the port must - * be kept open all of the time. The unit also has an internal clock for loss of signal - * periods. Claimed accuracy is 0.1 sec. - * - * The timecode format is: + * This driver supports ultralink Model 320,330,331,332 WWVB radios * - * <cr><lf>SQRYYYYDDD+HH:MM:SS.mmLT<cr> + * this driver was based on the refclock_wwvb.c driver + * in the ntp distribution. * - * where: + * Fudge Factors * - * S = 'S' -- sync'd in last hour, '0'-'9' - hours x 10 since last update, else '?' - * Q = Number of correlating time-frames, from 0 to 5 - * R = 'R' -- reception in progress, 'N' -- Noisy reception, ' ' -- standby mode - * YYYY = year from 1990 to 2089 - * DDD = current day from 1 to 366 - * + = '+' if current year is a leap year, else ' ' - * HH = UTC hour 0 to 23 - * MM = Minutes of current hour from 0 to 59 - * SS = Seconds of current minute from 0 to 59 - * mm = 10's milliseconds of the current second from 00 to 99 - * L = Leap second pending at end of month -- 'I' = inset, 'D'=delete - * T = DST <-> STD transition indicators + * fudge flag1 0 don't poll clock + * 1 send poll character * - * Note that this driver does not do anything with the L or T flags. + * revision history: + * 99/9/09 j.c.lang original edit's + * 99/9/11 j.c.lang changed timecode parse to + * match what the radio actually + * sends. + * 99/10/11 j.c.lang added support for continous + * time code mode (dipsw2) + * 99/11/26 j.c.lang added support for 320 decoder + * (taken from Dave Strout's + * Model 320 driver) + * 99/11/29 j.c.lang added fudge flag 1 to control + * clock polling + * 99/12/15 j.c.lang fixed 320 quality flag + * 01/02/21 s.l.smith fixed 33x quality flag + * added more debugging stuff + * updated 33x time code explanation * - * The M320 also has a 'U' command which returns UT1 correction information. It - * is not used in this driver. + * Questions, bugs, ideas send to: + * Joseph C. Lang + * tcnojl1@earthlink.net * - */ + * Dave Strout + * dstrout@linuxfoundry.com + * + * + * on the Ultralink model 33X decoder Dip switch 2 controls + * polled or continous timecode + * set fudge flag1 if using polled (needed for model 320) + * dont set fudge flag1 if dip switch 2 is set on model 33x decoder +*/ + /* * Interface definitions */ -#define DEVICE "/dev/ulink%d" /* device name and unit */ +#define DEVICE "/dev/wwvb%d" /* device name and unit */ #define SPEED232 B9600 /* uart speed (9600 baud) */ -#define PRECISION (-13) /* precision assumed (about 100 us) */ -#define REFID "M320" /* reference ID */ +#define PRECISION (-10) /* precision assumed (about 10 ms) */ +#define REFID "WWVB" /* reference ID */ #define DESCRIPTION "Ultralink WWVB Receiver" /* WRU */ -#define LENWWVB0 28 /* format 0 timecode length */ -#define LENWWVB2 24 /* format 2 timecode length */ -#define LENWWVB3 29 /* format 3 timecode length */ - -#define MONLIN 15 /* number of monitoring lines */ +#define LEN33X 32 /* timecode length Model 325 & 33X */ +#define LEN320 24 /* timecode length Model 320 */ /* - * ULINK unit control structure + * unit control structure */ struct ulinkunit { u_char tcswitch; /* timecode switch */ l_fp laststamp; /* last receive timestamp */ - u_char lasthour; /* last hour (for monitor) */ - u_char linect; /* count ignored lines (for monitor */ }; /* @@ -91,7 +105,6 @@ static int ulink_start P((int, struct peer *)); static void ulink_shutdown P((int, struct peer *)); static void ulink_receive P((struct recvbuf *)); static void ulink_poll P((int, struct peer *)); -static int fd; /* We need to keep the serial port open to power the ULM320 */ /* * Transfer vector @@ -100,10 +113,10 @@ struct refclock refclock_ulink = { ulink_start, /* start up driver */ ulink_shutdown, /* shut down driver */ ulink_poll, /* transmit poll message */ - noentry, /* not used (old wwvb_control) */ - noentry, /* initialize driver (not used) */ - noentry, /* not used (old wwvb_buginfo) */ - NOFLAGS /* not used */ + noentry, /* not used */ + noentry, /* not used */ + noentry, /* not used */ + NOFLAGS }; @@ -118,8 +131,9 @@ ulink_start( { register struct ulinkunit *up; struct refclockproc *pp; + int fd; char device[20]; - fprintf(stderr, "Starting Ulink driver\n"); + /* * Open serial port. Use CLK line discipline, if available. */ @@ -152,7 +166,6 @@ ulink_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; - peer->flags |= FLAG_BURST; peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); @@ -176,7 +189,6 @@ ulink_shutdown( up = (struct ulinkunit *)pp->unitptr; io_closeclock(&pp->io); free(up); - close(fd); } @@ -193,11 +205,12 @@ ulink_receive( struct peer *peer; l_fp trtmp; /* arrival timestamp */ + int quality; /* quality indicator */ + int temp; /* int temp */ char syncchar; /* synchronization indicator */ - char qualchar; /* quality indicator */ - char modechar; /* Modes: 'R'=rx, 'N'=noise, ' '=standby */ char leapchar; /* leap indicator */ - int temp; /* int temp */ + char modechar; /* model 320 mode flag */ + char char_quality[2]; /* temp quality flag */ /* * Initialize pointers and read the timecode and timestamp @@ -209,13 +222,7 @@ ulink_receive( /* * Note we get a buffer and timestamp for both a <cr> and <lf>, - * but only the <cr> timestamp is retained. Note: in format 0 on - * a Netclock/2 or upgraded 8170 the start bit is delayed 100 - * +-50 us relative to the pps; however, on an unmodified 8170 - * the start bit can be delayed up to 10 ms. In format 2 the - * reading precision is only to the millisecond. Thus, unless - * you have a pps gadget and don't have to have the year, format - * 0 provides the lowest jitter. + * but only the <cr> timestamp is retained. */ if (temp == 0) { if (up->tcswitch == 0) { @@ -237,40 +244,217 @@ ulink_receive( /* * We get down to business, check the timecode format and decode - * its contents. This code uses the timecode length to determine - * whether format 0 or format 2. If the timecode has invalid - * length or is not in proper format, we declare bad format and - * exit. + * its contents. If the timecode has invalid length or is not in + * proper format, we declare bad format and exit. */ - syncchar = qualchar = leapchar = ' '; + syncchar = leapchar = modechar = ' '; pp->msec = 0; + + switch (pp->lencode ) { + case LEN33X: + /* + * Model 33X decoder: + * Timecode format from January 29, 2001 datasheet is: + * <CR><LF>S9+D 00 YYYY+DDDUTCS HH:MM:SSL+5 + * S WWVB decoder sync indicator. S for in-sync(?) + * or N for noisy signal. + * 9+ RF signal level in S-units, 0-9 followed by + * a space (0x20). The space turns to '+' if the + * level is over 9. + * D Data bit 0, 1, 2 (position mark), or + * 3 (unknown). + * space Space character (0x20) + * 00 Hours since last good WWVB frame sync. Will + * be 00-23 hrs, or '1d' to '7d'. Will be 'Lk' + * if currently in sync. + * space Space character (0x20) + * YYYY Current year, 1990-2089 + * + Leap year indicator. '+' if a leap year, + * a space (0x20) if not. + * DDD Day of year, 001 - 366. + * UTC Timezone (always 'UTC'). + * S Daylight savings indicator + * S - standard time (STD) in effect + * O - during STD to DST day 0000-2400 + * D - daylight savings time (DST) in effect + * I - during DST to STD day 0000-2400 + * space Space character (0x20) + * HH Hours 00-23 + * : This is the REAL in sync indicator (: = insync) + * MM Minutes 00-59 + * : : = in sync ? = NOT in sync + * SS Seconds 00-59 + * L Leap second flag. Changes from space (0x20) + * to '+' or '-' during month preceding leap + * second adjustment. + * +5 UT1 correction (sign + digit )) + */ + + if (sscanf(pp->a_lastcode, + "%*4c %2c %4d%*c%3d%*4c %2d%c%2d:%2d%c%*2c", + char_quality, &pp->year, &pp->day, + &pp->hour, &syncchar, &pp->minute, &pp->second, + &leapchar) == 8) { + + if (char_quality[0] == 'L') { + quality = 0; + } else if (char_quality[0] == '0') { + quality = (char_quality[1] & 0x0f); + } else { + quality = 99; + } +/* +#ifdef DEBUG + if (debug) { + printf("ulink: char_quality %c %c\n", + char_quality[0], char_quality[1]); + printf("ulink: quality %d\n", quality); + printf("ulink: syncchar %x\n", syncchar); + printf("ulink: leapchar %x\n", leapchar); + } +#endif +*/ + + break; + } + + case LEN320: + /* + * Model 320 Decoder + * The timecode format is: + * + * <cr><lf>SQRYYYYDDD+HH:MM:SS.mmLT<cr> + * + * where: + * + * S = 'S' -- sync'd in last hour, + * '0'-'9' - hours x 10 since last update, + * '?' -- not in sync + * Q = Number of correlating time-frames, from 0 to 5 + * R = 'R' -- reception in progress, + * 'N' -- Noisy reception, + * ' ' -- standby mode + * YYYY = year from 1990 to 2089 + * DDD = current day from 1 to 366 + * + = '+' if current year is a leap year, else ' ' + * HH = UTC hour 0 to 23 + * MM = Minutes of current hour from 0 to 59 + * SS = Seconds of current minute from 0 to 59 + * mm = 10's milliseconds of the current second from 00 to 99 + * L = Leap second pending at end of month + * 'I' = insert, 'D'= delete + * T = DST <-> STD transition indicators + * + */ + if (sscanf(pp->a_lastcode, "%c%1d%c%4d%3d%*c%2d:%2d:%2d.%2d%c", + &syncchar, &quality, &modechar, &pp->year, &pp->day, + &pp->hour, &pp->minute, &pp->second, + &pp->msec,&leapchar) == 10) { + pp->msec *= 10; /* M320 returns 10's of msecs */ + if (leapchar == 'I' ) leapchar = '+'; + if (leapchar == 'D' ) leapchar = '-'; + if (syncchar != '?' ) syncchar = ':'; + + break; + } + + default: + refclock_report(peer, CEVNT_BADREPLY); + return; + } + + /* - * Timecode format SQRYYYYDDD+HH:MM:SS.mmLT + * Decode quality indicator + * For the 325 & 33x series, the lower the number the "better" + * the time is. I used the dispersion as the measure of time + * quality. The quality indicator in the 320 is the number of + * correlating time frames (the more the better) */ - sscanf(pp->a_lastcode, "%c%c%c%4d%3d%c%2d:%2d:%2d.%2d", - &syncchar, &qualchar, &modechar, &pp->year, &pp->day, - &leapchar,&pp->hour, &pp->minute, &pp->second,&pp->msec); - pp->msec *= 10; /* M320 returns 10's of msecs */ - qualchar = ' '; + /* + * The spec sheet for the 325 & 33x series states the clock will + * maintain +/-0.002 seconds accuracy when locked to WWVB. This + * is indicated by 'Lk' in the quality portion of the incoming + * string. When not in lock, a drift of +/-0.015 seconds should + * be allowed for. + * With the quality indicator decoding scheme above, the 'Lk' + * condition will produce a quality value of 0. If the quality + * indicator starts with '0' then the second character is the + * number of hours since we were last locked. If the first + * character is anything other than 'L' or '0' then we have been + * out of lock for more than 9 hours so we assume the worst and + * force a quality value that selects the 'default' maximum + * dispersion. The dispersion values below are what came with the + * driver. They're not unreasonable so they've not been changed. + */ + + if (pp->lencode == LEN33X) { + switch (quality) { + case 0 : + pp->disp=.002; + break; + case 1 : + pp->disp=.02; + break; + case 2 : + pp->disp=.04; + break; + case 3 : + pp->disp=.08; + break; + default: + pp->disp=MAXDISPERSE; + break; + } + } else { + switch (quality) { + case 5 : + pp->disp=.002; + break; + case 4 : + pp->disp=.02; + break; + case 3 : + pp->disp=.04; + break; + case 2 : + pp->disp=.08; + break; + case 1 : + pp->disp=.16; + break; + default: + pp->disp=MAXDISPERSE; + break; + } + + } /* - * Decode synchronization, quality and leap characters. If + * Decode synchronization, and leap characters. If * unsynchronized, set the leap bits accordingly and exit. * Otherwise, set the leap bits according to the leap character. - * Once synchronized, the dispersion depends only on the - * quality character. */ - pp->disp = .001; - pp->leap = LEAP_NOWARNING; + + if (syncchar != ':') + pp->leap = LEAP_NOTINSYNC; + else if (leapchar == '+') + pp->leap = LEAP_ADDSECOND; + else if (leapchar == '-') + pp->leap = LEAP_DELSECOND; + else + pp->leap = LEAP_NOWARNING; /* * Process the new sample in the median filter and determine the * timecode timestamp. */ - if (!refclock_process(pp)) + if (!refclock_process(pp)) { refclock_report(peer, CEVNT_BADTIME); + } + } @@ -283,35 +467,30 @@ ulink_poll( struct peer *peer ) { - register struct ulinkunit *up; - struct refclockproc *pp; - char pollchar; - - pp = peer->procptr; - up = (struct ulinkunit *)pp->unitptr; - pollchar = 'T'; - if (write(pp->io.fd, &pollchar, 1) != 1) - refclock_report(peer, CEVNT_FAULT); - else - pp->polls++; - if (peer->burst > 0) - return; - if (pp->coderecv == pp->codeproc) { - refclock_report(peer, CEVNT_TIMEOUT); - return; + struct refclockproc *pp; + char pollchar; + + pp = peer->procptr; + pollchar = 'T'; + if (pp->sloppyclockflag & CLK_FLAG1) { + if (write(pp->io.fd, &pollchar, 1) != 1) + refclock_report(peer, CEVNT_FAULT); + else + pp->polls++; } - record_clock_stats(&peer->srcadr, pp->a_lastcode); - refclock_receive(peer); - peer->burst = NSTAGE; + else + pp->polls++; + + if (peer->burst > 0) + return; + if (pp->coderecv == pp->codeproc) { + refclock_report(peer, CEVNT_TIMEOUT); + return; + } + record_clock_stats(&peer->srcadr, pp->a_lastcode); + refclock_receive(peer); + peer->burst = NSTAGE; - /* - * If the monitor flag is set (flag4), we dump the internal - * quality table at the first timecode beginning the day. - */ - if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < - (int)up->lasthour) - up->linect = MONLIN; - up->lasthour = pp->hour; } #else diff --git a/contrib/ntp/ntpd/refclock_usno.c b/contrib/ntp/ntpd/refclock_usno.c index cf404e7..30a1330 100644 --- a/contrib/ntp/ntpd/refclock_usno.c +++ b/contrib/ntp/ntpd/refclock_usno.c @@ -9,13 +9,6 @@ #if defined(REFCLOCK) && defined(CLOCK_USNO) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -#endif /* HAVE_SYS_IOCTL_H */ - #include "ntpd.h" #include "ntp_io.h" #include "ntp_unixtime.h" @@ -23,6 +16,12 @@ #include "ntp_stdlib.h" #include "ntp_control.h" +#include <stdio.h> +#include <ctype.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif /* HAVE_SYS_IOCTL_H */ + /* * This driver supports the Naval Observatory dialup at +1 202 653 0351. * It is a hacked-up version of the ACTS driver. @@ -438,7 +437,7 @@ usno_timeout( peer->nextdate = current_time + ANSWER; return; } - switch (peer->ttl) { + switch (peer->ttlmax) { /* * In manual mode the calling program is activated diff --git a/contrib/ntp/ntpd/refclock_wwv.c b/contrib/ntp/ntpd/refclock_wwv.c index 52e76e6..b1d05c7 100644 --- a/contrib/ntp/ntpd/refclock_wwv.c +++ b/contrib/ntp/ntpd/refclock_wwv.c @@ -7,14 +7,6 @@ #if defined(REFCLOCK) && defined(CLOCK_WWV) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <math.h> -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif /* HAVE_SYS_IOCTL_H */ - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" @@ -22,6 +14,13 @@ #include "ntp_stdlib.h" #include "audio.h" +#include <stdio.h> +#include <ctype.h> +#include <math.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif /* HAVE_SYS_IOCTL_H */ + #define ICOM 1 /* undefine to suppress ICOM code */ #ifdef ICOM @@ -64,6 +63,7 @@ /* * Interface definitions */ +#define DEVICE_AUDIO "/dev/audio" /* audio device name */ #define PRECISION (-10) /* precision assumed (about 1 ms) */ #define REFID "NONE" /* reference ID */ #define DESCRIPTION "WWV/H Audio Demodulator/Decoder" /* WRU */ @@ -646,7 +646,7 @@ wwv_start( /* * Open audio device */ - fd = audio_init(); + fd = audio_init(DEVICE_AUDIO); if (fd < 0) return (0); #ifdef DEBUG @@ -739,8 +739,8 @@ wwv_start( if (debug > 1) temp = P_TRACE; #endif - if (peer->ttl != 0) { - if (peer->ttl & 0x80) + if (peer->ttlmax != 0) { + if (peer->ttlmax & 0x80) up->fd_icom = icom_init("/dev/icom", B1200, temp); else @@ -1443,8 +1443,8 @@ wwv_qrz( sp->select &= ~JITRNG; if (abs(sp->jitter) > AWND * MS) sp->select |= JITRNG; - sp->sigmax = sqrt(sp->sigmax); - sp->noise = sqrt(sp->noise); + sp->sigmax = SQRT(sp->sigmax); + sp->noise = SQRT(sp->noise); if (up->status & MSYNC) { /* @@ -1769,9 +1769,9 @@ wwv_epoch( cp = &up->mitig[up->achan]; if (up->rphase == 800 * MS) { sp = &cp->wwv; - sp->synamp = sqrt(sp->amp); + sp->synamp = SQRT(sp->amp); sp = &cp->wwvh; - sp->synamp = sqrt(sp->amp); + sp->synamp = SQRT(sp->amp); } if (up->rsec == 0) { @@ -1787,7 +1787,7 @@ wwv_epoch( up->noiamp += (up->irig - up->noiamp) / (MINAVG << up->avgint); else - cp->noiamp += (sqrt(up->irig * + cp->noiamp += (SQRT(up->irig * up->irig + up->qrig * up->qrig) - cp->noiamp) / 8; @@ -1817,7 +1817,7 @@ wwv_epoch( up->datapt += 80; } } else { - up->sigamp = sqrt(up->irig * up->irig + + up->sigamp = SQRT(up->irig * up->irig + up->qrig * up->qrig); up->datsnr = wwv_snr(up->sigamp, cp->noiamp); @@ -2586,7 +2586,8 @@ wwv_newchan( up->sptr = sp; up->status |= sp->select & (SELV | SELH); memcpy((char *)&pp->refid, sp->refid, 4); - memcpy((char *)&peer->refid, sp->refid, 4); + if (peer->stratum <= 1) + memcpy((char *)&peer->refid, sp->refid, 4); wwv_qsy(peer, up->dchan); } } @@ -2614,7 +2615,7 @@ wwv_qsy( up->mitig[up->achan].gain = up->gain; #ifdef ICOM if (up->fd_icom > 0) - rval = icom_freq(up->fd_icom, peer->ttl & 0x7f, + rval = icom_freq(up->fd_icom, peer->ttlmax & 0x7f, qsy[chan]); #endif /* ICOM */ up->achan = chan; @@ -2645,7 +2646,10 @@ wwv_qsy( * agc audio gain (0-255) * iden station identifier (station and frequency) * comp minute sync compare counter - * errs bit errors in last minute * freq frequency offset (PPM) * avgt averaging time (s) */ + * errs bit errors in last minute + * freq frequency offset (PPM) + * avgt averaging time (s) + */ static int timecode( struct wwvunit *up, /* driver structure pointer */ diff --git a/contrib/ntp/ntpd/refclock_wwvb.c b/contrib/ntp/ntpd/refclock_wwvb.c index 63d6e0b..0ca9f75 100644 --- a/contrib/ntp/ntpd/refclock_wwvb.c +++ b/contrib/ntp/ntpd/refclock_wwvb.c @@ -8,17 +8,15 @@ #if defined(REFCLOCK) && defined(CLOCK_SPECTRACOM) -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> - #include "ntpd.h" #include "ntp_io.h" #include "ntp_refclock.h" #include "ntp_calendar.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> + /* * This driver supports the Spectracom Model 8170 and Netclock/2 WWVB * Synchronized Clocks and the Netclock/GPS Master Clock. Both the WWVB @@ -187,9 +185,9 @@ wwvb_start( * Initialize miscellaneous variables */ peer->precision = PRECISION; - peer->burst = NSTAGE; pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); + peer->burst = NSTAGE; return (1); } @@ -233,6 +231,7 @@ wwvb_receive( char qualchar; /* quality indicator */ char leapchar; /* leap indicator */ char dstchar; /* daylight/standard indicator */ + char tmpchar; /* trashbin */ /* * Initialize pointers and read the timecode and timestamp @@ -287,16 +286,15 @@ wwvb_receive( * Timecode format 0: "I ddd hh:mm:ss DTZ=nn" */ if (sscanf(pp->a_lastcode, - "%c %3d %2d:%2d:%2d %cTZ=%2d", + "%c %3d %2d:%2d:%2d%c%cTZ=%2d", &syncchar, &pp->day, &pp->hour, &pp->minute, - &pp->second, &dstchar, &tz) == 7) + &pp->second, &tmpchar, &dstchar, &tz) == 8) break; case LENWWVB2: /* - * Timecode format 2: "IQyy ddd hh:mm:ss.mmm LD" - */ + * Timecode format 2: "IQyy ddd hh:mm:ss.mmm LD" */ if (sscanf(pp->a_lastcode, "%c%c %2d %3d %2d:%2d:%2d.%3d %c", &syncchar, &qualchar, &pp->year, &pp->day, diff --git a/contrib/ntp/ntpdate/Makefile.am b/contrib/ntp/ntpdate/Makefile.am index ba6c21f..ea55108 100644 --- a/contrib/ntp/ntpdate/Makefile.am +++ b/contrib/ntp/ntpdate/Makefile.am @@ -5,7 +5,7 @@ ntptimeset_SOURCES = ntptimeset.c ntptime_config.c INCLUDES = -I$(top_srcdir)/include # LDADD might need RESLIB and ADJLIB LDADD = version.o ../libntp/libntp.a @LIBRSAREF@ -DISTCLEANFILES = .version stamp-v +DISTCLEANFILES = .version version.c stamp-v noinst_HEADERS = ntpdate.h #EXTRA_DIST = ntpdate.mak ETAGS_ARGS = Makefile.am diff --git a/contrib/ntp/ntpdate/Makefile.in b/contrib/ntp/ntpdate/Makefile.in index c913235..f66e351 100644 --- a/contrib/ntp/ntpdate/Makefile.in +++ b/contrib/ntp/ntpdate/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -107,113 +123,99 @@ ntptimeset_SOURCES = ntptimeset.c ntptime_config.c INCLUDES = -I$(top_srcdir)/include # LDADD might need RESLIB and ADJLIB LDADD = version.o ../libntp/libntp.a @LIBRSAREF@ -DISTCLEANFILES = .version stamp-v +DISTCLEANFILES = .version version.c stamp-v noinst_HEADERS = ntpdate.h #EXTRA_DIST = ntpdate.mak ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = ntpdate mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = ntpdate$(EXEEXT) ntptimeset$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr ntpdate_SOURCES = ntpdate.c -ntpdate_OBJECTS = ntpdate$U.o +ntpdate_OBJECTS = ntpdate$U.$(OBJEXT) ntpdate_LDADD = $(LDADD) -ntpdate_DEPENDENCIES = version.o ../libntp/libntp.a +ntpdate_DEPENDENCIES = version.o ../libntp/libntp.a ntpdate_LDFLAGS = -am_ntptimeset_OBJECTS = ntptimeset$U.o ntptime_config$U.o -ntptimeset_OBJECTS = $(am_ntptimeset_OBJECTS) +am_ntptimeset_OBJECTS = ntptimeset$U.$(OBJEXT) \ +ntptime_config$U.$(OBJEXT) +ntptimeset_OBJECTS = $(am_ntptimeset_OBJECTS) ntptimeset_LDADD = $(LDADD) -ntptimeset_DEPENDENCIES = version.o ../libntp/libntp.a +ntptimeset_DEPENDENCIES = version.o ../libntp/libntp.a ntptimeset_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = ntpdate.c $(ntptimeset_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +DIST_SOURCES = ntpdate.c $(ntptimeset_SOURCES) +HEADERS = $(noinst_HEADERS) -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/ntpdate$U.Po \ -$(DEPDIR)/ntptime_config$U.Po $(DEPDIR)/ntptimeset$U.Po -SOURCES = ntpdate.c $(ntptimeset_SOURCES) -OBJECTS = ntpdate$U.o $(am_ntptimeset_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpdate/Makefile +@AMDEP@DEP_FILES = $(DEPDIR)/ntpdate$U.Po $(DEPDIR)/ntptime_config$U.Po \ +@AMDEP@ $(DEPDIR)/ntptimeset$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: +SOURCES = ntpdate.c $(ntptimeset_SOURCES) +OBJECTS = ntpdate$U.$(OBJEXT) $(am_ntptimeset_OBJECTS) -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntpdate/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - ntpdate: $(ntpdate_OBJECTS) $(ntpdate_DEPENDENCIES) @rm -f ntpdate $(LINK) $(ntpdate_LDFLAGS) $(ntpdate_OBJECTS) $(ntpdate_LDADD) $(LIBS) @@ -227,7 +229,8 @@ ntptime_config_.c: ntptime_config.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptime_config.c; then echo $(srcdir)/ntptime_config.c; else echo ntptime_config.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptime_config_.c ntptimeset_.c: ntptimeset.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptimeset.c; then echo $(srcdir)/ntptimeset.c; else echo ntptimeset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptimeset_.c -ntpdate_.o ntptime_config_.o ntptimeset_.o : $(ANSI2KNR) +ntpdate_.$(OBJEXT) ntptime_config_.$(OBJEXT) ntptimeset_.$(OBJEXT) : \ +$(ANSI2KNR) tags: TAGS @@ -238,9 +241,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -253,76 +256,73 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/ntpdate$U.Po -@AMDEP@include $(DEPDIR)/ntptime_config$U.Po -@AMDEP@include $(DEPDIR)/ntptimeset$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/ntpdate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntptime_config$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntptimeset$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) $(HEADERS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -334,45 +334,55 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ + uninstall uninstall-am uninstall-binPROGRAMS $(PROGRAMS): $(LDADD) diff --git a/contrib/ntp/ntpdate/ntpdate.c b/contrib/ntp/ntpdate/ntpdate.c index e79b73e..b01d539 100644 --- a/contrib/ntp/ntpdate/ntpdate.c +++ b/contrib/ntp/ntpdate/ntpdate.c @@ -6,9 +6,20 @@ # include <config.h> #endif -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> +#ifdef HAVE_NETINFO +#include <netinfo/ni.h> #endif + +#include "ntp_fp.h" +#include "ntp.h" +#include "ntp_io.h" +#include "ntp_unixtime.h" +#include "ntpdate.h" +#include "ntp_string.h" +#include "ntp_syslog.h" +#include "ntp_select.h" +#include "ntp_stdlib.h" + #ifdef HAVE_UNISTD_H # include <unistd.h> #endif @@ -17,14 +28,15 @@ #include <signal.h> #include <ctype.h> #ifdef HAVE_POLL_H -#include <poll.h> +# include <poll.h> #endif #ifndef SYS_WINNT # include <netdb.h> # include <sys/signal.h> -# include <sys/ioctl.h> +# ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +# endif #endif /* SYS_WINNT */ -#include <sys/time.h> #ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> #endif /* HAVE_SYS_RESOURCE_H */ @@ -40,24 +52,6 @@ struct timeval timeout = {0,0}; struct timeval timeout = {60,0}; #endif - -#if defined(SYS_HPUX) -# include <utmp.h> -#endif - -#ifdef HAVE_NETINFO -#include <netinfo/ni.h> -#endif - -#include "ntp_fp.h" -#include "ntp.h" -#include "ntp_io.h" -#include "ntp_unixtime.h" -#include "ntpdate.h" -#include "ntp_string.h" -#include "ntp_syslog.h" -#include "ntp_select.h" -#include "ntp_stdlib.h" #include "recvbuff.h" #ifdef SYS_WINNT @@ -471,7 +465,7 @@ ntpdatemain ( * Add servers we are going to be polling */ #ifdef HAVE_NETINFO - inetinfoservers = getnetinfoservers(); + netinfoservers = getnetinfoservers(); #endif for ( ; ntp_optind < argc; ntp_optind++) @@ -505,9 +499,10 @@ ntpdatemain ( if (sys_authenticate) { init_auth(); if (!authreadkeys(key_file)) { - msyslog(LOG_ERR, "no key file, exitting"); + msyslog(LOG_ERR, "no key file <%s>, exiting", key_file); exit(1); } + authtrust(sys_authkey, 1); if (!authistrusted(sys_authkey)) { char buf[10]; @@ -702,7 +697,7 @@ transmit( if (sys_authenticate) { int len; - xpkt.keyid1 = htonl(sys_authkey); + xpkt.exten[0] = htonl(sys_authkey); get_systime(&server->xmt); L_ADDUF(&server->xmt, sys_authdelay); HTONL_FP(&server->xmt, &xpkt.xmt); @@ -772,7 +767,7 @@ receive( if ((PKT_MODE(rpkt->li_vn_mode) != MODE_SERVER && PKT_MODE(rpkt->li_vn_mode) != MODE_PASSIVE) - || rpkt->stratum > NTP_MAXSTRATUM) { + || rpkt->stratum >= STRATUM_UNSPEC) { if (debug) printf("receive: mode %d stratum %d\n", PKT_MODE(rpkt->li_vn_mode), rpkt->stratum); @@ -810,11 +805,11 @@ receive( if (debug > 3) printf("receive: rpkt keyid=%ld sys_authkey=%ld decrypt=%ld\n", - (long int)ntohl(rpkt->keyid1), (long int)sys_authkey, + (long int)ntohl(rpkt->exten[0]), (long int)sys_authkey, (long int)authdecrypt(sys_authkey, (u_int32 *)rpkt, LEN_PKT_NOMAC, (int)(rbufp->recv_length - LEN_PKT_NOMAC))); - if (has_mac && ntohl(rpkt->keyid1) == sys_authkey && + if (has_mac && ntohl(rpkt->exten[0]) == sys_authkey && authdecrypt(sys_authkey, (u_int32 *)rpkt, LEN_PKT_NOMAC, (int)(rbufp->recv_length - LEN_PKT_NOMAC))) is_authentic = 1; @@ -1372,6 +1367,11 @@ timer(void) } +/* + * The code duplication in the following subroutine sucks, but + * we need to appease ansi2knr. + */ + #ifndef SYS_WINNT /* * alarming - record the occurance of an alarm interrupt @@ -1380,13 +1380,16 @@ static RETSIGTYPE alarming( int sig ) +{ + alarm_flag++; +} #else void CALLBACK alarming(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) -#endif /* SYS_WINNT */ { alarm_flag++; } +#endif /* SYS_WINNT */ /* @@ -1651,7 +1654,7 @@ sendpkt( DWORD err; #endif /* SYS_WINNT */ - cc = sendto(fd, (char *)pkt, len, 0, (struct sockaddr *)dest, + cc = sendto(fd, (char *)pkt, (size_t)len, 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in)); #ifndef SYS_WINNT if (cc == -1) { diff --git a/contrib/ntp/ntpdate/ntpdate.h b/contrib/ntp/ntpdate/ntpdate.h index 85e438e..5ead20f 100644 --- a/contrib/ntp/ntpdate/ntpdate.h +++ b/contrib/ntp/ntpdate/ntpdate.h @@ -4,6 +4,8 @@ #include "ntp_malloc.h" +extern void loadservers P((char *cfgpath)); + /* * The server structure is a much simplified version of the * peer structure, for ntpdate's use. Since we always send @@ -61,6 +63,8 @@ struct server { */ #define NTPDATE_THRESHOLD (FP_SECOND >> 1) /* 1/2 second */ +#define NTP_MAXAGE 86400 /* one day in seconds */ + /* * When doing adjustments, ntpdate actually overadjusts (currently * by 50%, though this may change). While this will make it take longer diff --git a/contrib/ntp/ntpdate/ntptime_config.c b/contrib/ntp/ntpdate/ntptime_config.c index 56f6539..e784d28 100644 --- a/contrib/ntp/ntpdate/ntptime_config.c +++ b/contrib/ntp/ntpdate/ntptime_config.c @@ -11,15 +11,6 @@ # include <config.h> #endif -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#include <stdio.h> -#include <signal.h> -#include <ctype.h> -#include <sys/time.h> - #include "ntp_fp.h" #include "ntp.h" #include "ntp_io.h" @@ -29,6 +20,10 @@ #include "ntp_syslog.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <signal.h> +#include <ctype.h> + /* * These routines are used to read the configuration file at * startup time. An entry in the file must fit on a single line. diff --git a/contrib/ntp/ntpdate/ntptimeset.c b/contrib/ntp/ntpdate/ntptimeset.c index bf618ca..95b70b6 100644 --- a/contrib/ntp/ntpdate/ntptimeset.c +++ b/contrib/ntp/ntpdate/ntptimeset.c @@ -121,9 +121,17 @@ # include <config.h> #endif -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif +#include "ntp_fp.h" +#include "ntp.h" +#include "ntp_io.h" +#include "iosignal.h" +#include "ntp_unixtime.h" +#include "ntpdate.h" +#include "ntp_string.h" +#include "ntp_syslog.h" +#include "ntp_select.h" +#include "ntp_stdlib.h" + #ifdef HAVE_UNISTD_H # include <unistd.h> #endif @@ -136,7 +144,7 @@ # include <sys/signal.h> # include <sys/ioctl.h> #endif /* SYS_WINNT */ -#include <sys/time.h> + #ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> #endif /* HAVE_SYS_RESOURCE_H */ @@ -147,21 +155,6 @@ # include "timers.h" #endif - -#if defined(SYS_HPUX) -# include <utmp.h> -#endif - -#include "ntp_fp.h" -#include "ntp.h" -#include "ntp_io.h" -#include "iosignal.h" -#include "ntp_unixtime.h" -#include "ntpdate.h" -#include "ntp_string.h" -#include "ntp_syslog.h" -#include "ntp_select.h" -#include "ntp_stdlib.h" #include "recvbuff.h" #ifdef SYS_WINNT @@ -308,7 +301,6 @@ u_long finish_time = 0; int ntptimesetmain P((int argc, char *argv[])); -extern void loadservers P((char *cfgpath)); static void analysis P((int final)); static int have_enough P((void)); static void transmit P((register struct server *server)); @@ -892,7 +884,7 @@ transmit( if (sys_authenticate) { int len; - xpkt.keyid1 = htonl(sys_authkey); + xpkt.exten[0] = htonl(sys_authkey); get_systime(&server->xmt); L_ADDUF(&server->xmt, sys_authdelay); HTONL_FP(&server->xmt, &xpkt.xmt); @@ -1013,7 +1005,7 @@ receive( if ((PKT_MODE(rpkt->li_vn_mode) != MODE_SERVER && PKT_MODE(rpkt->li_vn_mode) != MODE_PASSIVE) - || rpkt->stratum > NTP_MAXSTRATUM) { + || rpkt->stratum >=STRATUM_UNSPEC) { if (debug > 1) printf("receive: mode %d stratum %d\n", PKT_MODE(rpkt->li_vn_mode), rpkt->stratum); @@ -1051,11 +1043,11 @@ receive( if (debug > 3) printf("receive: rpkt keyid=%ld sys_authkey=%ld decrypt=%ld\n", - (long int)ntohl(rpkt->keyid1), (long int)sys_authkey, + (long int)ntohl(rpkt->exten[0]), (long int)sys_authkey, (long int)authdecrypt(sys_authkey, (u_int32 *)rpkt, LEN_PKT_NOMAC, (int)(rbufp->recv_length - LEN_PKT_NOMAC))); - if (has_mac && ntohl(rpkt->keyid1) == sys_authkey && + if (has_mac && ntohl(rpkt->exten[0]) == sys_authkey && authdecrypt(sys_authkey, (u_int32 *)rpkt, LEN_PKT_NOMAC, (int)(rbufp->recv_length - LEN_PKT_NOMAC))) is_authentic = 1; @@ -1977,7 +1969,7 @@ sendpkt( } - cc = sendto(fd, (char *)pkt, len, 0, (struct sockaddr *)dest, + cc = sendto(fd, (char *)pkt, (size_t)len, 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in)); #ifndef SYS_WINNT if (cc == -1) { diff --git a/contrib/ntp/ntpdc/Makefile.in b/contrib/ntp/ntpdc/Makefile.in index a796bc4..ce9683a 100644 --- a/contrib/ntp/ntpdc/Makefile.in +++ b/contrib/ntp/ntpdc/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -112,103 +128,88 @@ noinst_HEADERS = ntpdc.h ETAGS_ARGS = Makefile.am ntpdc_SOURCES = ntpdc.c ntpdc_ops.c +EXEEXT = +OBJEXT = o subdir = ntpdc mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = ntpdc$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr -am_ntpdc_OBJECTS = ntpdc$U.o ntpdc_ops$U.o -ntpdc_OBJECTS = $(am_ntpdc_OBJECTS) +am_ntpdc_OBJECTS = ntpdc$U.$(OBJEXT) ntpdc_ops$U.$(OBJEXT) +ntpdc_OBJECTS = $(am_ntpdc_OBJECTS) ntpdc_LDADD = $(LDADD) -ntpdc_DEPENDENCIES = version.o ../libntp/libntp.a +ntpdc_DEPENDENCIES = version.o ../libntp/libntp.a ntpdc_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(ntpdc_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +DIST_SOURCES = $(ntpdc_SOURCES) +HEADERS = $(noinst_HEADERS) -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/ntpdc$U.Po $(DEPDIR)/ntpdc_ops$U.Po +@AMDEP@DEP_FILES = $(DEPDIR)/ntpdc$U.Po $(DEPDIR)/ntpdc_ops$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in + SOURCES = $(ntpdc_SOURCES) OBJECTS = $(am_ntpdc_OBJECTS) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpdc/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntpdc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - ntpdc: $(ntpdc_OBJECTS) $(ntpdc_DEPENDENCIES) @rm -f ntpdc $(LINK) $(ntpdc_LDFLAGS) $(ntpdc_OBJECTS) $(ntpdc_LDADD) $(LIBS) @@ -216,7 +217,7 @@ ntpdc_.c: ntpdc.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc.c; then echo $(srcdir)/ntpdc.c; else echo ntpdc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpdc_.c ntpdc_ops_.c: ntpdc_ops.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc_ops.c; then echo $(srcdir)/ntpdc_ops.c; else echo ntpdc_ops.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpdc_ops_.c -ntpdc_.o ntpdc_ops_.o : $(ANSI2KNR) +ntpdc_.$(OBJEXT) ntpdc_ops_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -227,9 +228,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -242,75 +243,72 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/ntpdc$U.Po -@AMDEP@include $(DEPDIR)/ntpdc_ops$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/ntpdc$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntpdc_ops$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) $(HEADERS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -322,45 +320,55 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ + uninstall uninstall-am uninstall-binPROGRAMS $(PROGRAMS): $(LDADD) diff --git a/contrib/ntp/ntpdc/ntpdc.c b/contrib/ntp/ntpdc/ntpdc.c index a529954..09ba633 100644 --- a/contrib/ntp/ntpdc/ntpdc.c +++ b/contrib/ntp/ntpdc/ntpdc.c @@ -1,25 +1,29 @@ /* * ntpdc - control and monitor your ntpd daemon */ + #include <stdio.h> + +#include "ntpdc.h" +#include "ntp_select.h" +#include "ntp_io.h" +#include "ntp_stdlib.h" + #include <ctype.h> #include <signal.h> #include <setjmp.h> -#include <sys/types.h> -#include <sys/time.h> #include <netdb.h> #ifdef SYS_WINNT -#include <io.h> +# include <io.h> #else -#define closesocket close +# define closesocket close #endif /* SYS_WINNT */ - -#include "ntpdc.h" -#include "ntp_select.h" -#include "ntp_io.h" -#include "ntp_stdlib.h" +#ifdef HAVE_LIBREADLINE +# include <readline/readline.h> +# include <readline/history.h> +#endif /* HAVE_LIBREADLINE */ #ifdef SYS_VXWORKS /* vxWorks needs mode flag -casey*/ @@ -484,7 +488,7 @@ sendpkt( int xdatalen ) { - if (send(sockfd, xdata, xdatalen, 0) == -1) { + if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) { warning("write to %s failed", currenthost, ""); return -1; } @@ -914,6 +918,16 @@ doquery( static void getcmds(void) { +#ifdef HAVE_LIBREADLINE + char *line; + + for (;;) { + if ((line = readline(interactive?prompt:"")) == NULL) return; + if (*line) add_history(line); + docmd(line); + free(line); + } +#else /* not HAVE_LIBREADLINE */ char line[MAXLINE]; for (;;) { @@ -930,6 +944,7 @@ getcmds(void) docmd(line); } +#endif /* not HAVE_LIBREADLINE */ } @@ -1283,9 +1298,9 @@ help( cmdsort[n++] = xcp->keyword; #ifdef QSORT_USES_VOID_P - qsort(cmdsort, n, sizeof(char *), helpsort); + qsort(cmdsort, (size_t)n, sizeof(char *), helpsort); #else - qsort((char *)cmdsort, n, sizeof(char *), helpsort); + qsort((char *)cmdsort, (size_t)n, sizeof(char *), helpsort); #endif maxlength = 0; @@ -1528,6 +1543,7 @@ passwd( if (!interactive) { authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pcmd->argval[0].string); + authtrust(info_auth_keyid, 1); } else { pass = getpass((info_auth_keytype == KEY_TYPE_DES) ? "DES Password: " @@ -1535,9 +1551,11 @@ passwd( ); if (*pass == '\0') (void) fprintf(fp, "Password unchanged\n"); - else + else { authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pass); + authtrust(info_auth_keyid, 1); + } } } diff --git a/contrib/ntp/ntpdc/ntpdc_ops.c b/contrib/ntp/ntpdc/ntpdc_ops.c index c4b13e6..0661d53 100644 --- a/contrib/ntp/ntpdc/ntpdc_ops.c +++ b/contrib/ntp/ntpdc/ntpdc_ops.c @@ -7,9 +7,13 @@ #endif #include <stdio.h> + +#include "ntpdc.h" +#include "ntp_control.h" +#include "ntp_refclock.h" +#include "ntp_stdlib.h" + #include <ctype.h> -#include <sys/types.h> -#include <sys/time.h> #ifdef HAVE_SYS_TIMEX_H # include <sys/timex.h> #endif @@ -18,11 +22,6 @@ #include <netinet/in.h> #endif -#include "ntpdc.h" -#include "ntp_control.h" -#include "ntp_refclock.h" -#include "ntp_stdlib.h" - #include <arpa/inet.h> /* @@ -143,12 +142,12 @@ struct xcmd opcmds[] = { "display the server's restrict list" }, { "restrict", new_restrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", - "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer", + "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "create restrict entry/add flags to entry" }, { "unrestrict", unrestrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", - "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer", + "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "remove flags from a restrict entry" }, { "delrestrict", delrestrict, { ADD, ADD, OPT|NTP_STR, NO }, @@ -470,8 +469,8 @@ printpeer( pp->ppoll, pp->hpoll, (u_long)pp->keyid, pp->version, ntohs(pp->associd)); (void) fprintf(fp, - "valid %d, reach %03o, unreach %d, flash 0x%04x, ", - pp->valid, pp->reach, pp->unreach, pp->flash2); + "reach %03o, unreach %d, flash 0x%04x, ", + pp->reach, pp->unreach, pp->flash2); (void) fprintf(fp, "boffset %s, ttl/mode %d\n", fptoa(NTOHS_FP(pp->estbdelay), 5), pp->ttl); @@ -863,7 +862,7 @@ sysstats( (u_long)ntohl(ss->newversionpkt)); (void) fprintf(fp, "unknown version number: %ld\n", (u_long)ntohl(ss->unknownversion)); - (void) fprintf(fp, "bad packet length: %ld\n", + (void) fprintf(fp, "bad packet format: %ld\n", (u_long)ntohl(ss->badlength)); (void) fprintf(fp, "packets processed: %ld\n", (u_long)ntohl(ss->processed)); @@ -872,7 +871,7 @@ sysstats( if (itemsize != sizeof(struct info_sys_stats)) return; - (void) fprintf(fp, "limitation rejects: %ld\n", + (void) fprintf(fp, "packets rejected: %ld\n", (u_long)ntohl(ss->limitrejected)); } @@ -1257,8 +1256,8 @@ doset( sys.flags = 0; res = 0; for (items = 0; items < pcmd->nargs; items++) { - if (STREQ(pcmd->argval[items].string, "auth")) - sys.flags |= SYS_FLAG_AUTHENTICATE; + if (STREQ(pcmd->argval[items].string, "pps")) + sys.flags |= SYS_FLAG_PPS; else if (STREQ(pcmd->argval[items].string, "bclient")) sys.flags |= SYS_FLAG_BCLIENT; else if (STREQ(pcmd->argval[items].string, "monitor")) @@ -1306,6 +1305,9 @@ static struct resflags resflags[] = { { "notrap", RES_NOTRAP }, { "lptrap", RES_LPTRAP }, { "limited", RES_LIMITED }, + { "version", RES_VERSION }, + { "kod", RES_DEMOBILIZE }, + { "", 0 } }; diff --git a/contrib/ntp/ntpq/Makefile.am b/contrib/ntp/ntpq/Makefile.am index aced169..90f4c39 100644 --- a/contrib/ntp/ntpq/Makefile.am +++ b/contrib/ntp/ntpq/Makefile.am @@ -4,7 +4,7 @@ bin_PROGRAMS = ntpq INCLUDES = -I$(top_srcdir)/include # LDADD might need RESLIB and ADJLIB LDADD = version.o ../libntp/libntp.a @LIBRSAREF@ -DISTCLEANFILES = .version +DISTCLEANFILES = .version version.c noinst_HEADERS = ntpq.h #EXTRA_DIST = ntpq.mak ETAGS_ARGS = Makefile.am diff --git a/contrib/ntp/ntpq/Makefile.in b/contrib/ntp/ntpq/Makefile.in index d84dd67..2de95b7 100644 --- a/contrib/ntp/ntpq/Makefile.in +++ b/contrib/ntp/ntpq/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -106,109 +122,94 @@ bin_PROGRAMS = ntpq INCLUDES = -I$(top_srcdir)/include # LDADD might need RESLIB and ADJLIB LDADD = version.o ../libntp/libntp.a @LIBRSAREF@ -DISTCLEANFILES = .version +DISTCLEANFILES = .version version.c noinst_HEADERS = ntpq.h #EXTRA_DIST = ntpq.mak ETAGS_ARGS = Makefile.am ntpq_SOURCES = ntpq.c ntpq_ops.c +EXEEXT = +OBJEXT = o subdir = ntpq mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = ntpq$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr -am_ntpq_OBJECTS = ntpq$U.o ntpq_ops$U.o -ntpq_OBJECTS = $(am_ntpq_OBJECTS) +am_ntpq_OBJECTS = ntpq$U.$(OBJEXT) ntpq_ops$U.$(OBJEXT) +ntpq_OBJECTS = $(am_ntpq_OBJECTS) ntpq_LDADD = $(LDADD) -ntpq_DEPENDENCIES = version.o ../libntp/libntp.a +ntpq_DEPENDENCIES = version.o ../libntp/libntp.a ntpq_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(ntpq_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +DIST_SOURCES = $(ntpq_SOURCES) +HEADERS = $(noinst_HEADERS) -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/ntpq$U.Po $(DEPDIR)/ntpq_ops$U.Po +@AMDEP@DEP_FILES = $(DEPDIR)/ntpq$U.Po $(DEPDIR)/ntpq_ops$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in + SOURCES = $(ntpq_SOURCES) OBJECTS = $(am_ntpq_OBJECTS) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntpq/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntpq/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - ntpq: $(ntpq_OBJECTS) $(ntpq_DEPENDENCIES) @rm -f ntpq $(LINK) $(ntpq_LDFLAGS) $(ntpq_OBJECTS) $(ntpq_LDADD) $(LIBS) @@ -216,7 +217,7 @@ ntpq_.c: ntpq.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq.c; then echo $(srcdir)/ntpq.c; else echo ntpq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpq_.c ntpq_ops_.c: ntpq_ops.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpq_ops.c; then echo $(srcdir)/ntpq_ops.c; else echo ntpq_ops.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpq_ops_.c -ntpq_.o ntpq_ops_.o : $(ANSI2KNR) +ntpq_.$(OBJEXT) ntpq_ops_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -227,9 +228,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -242,75 +243,72 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/ntpq$U.Po -@AMDEP@include $(DEPDIR)/ntpq_ops$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/ntpq$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntpq_ops$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) $(HEADERS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -322,45 +320,55 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ + uninstall uninstall-am uninstall-binPROGRAMS $(PROGRAMS): $(LDADD) diff --git a/contrib/ntp/ntpq/ntpq.c b/contrib/ntp/ntpq/ntpq.c index 4d8c4b8..f529d61 100644 --- a/contrib/ntp/ntpq/ntpq.c +++ b/contrib/ntp/ntpq/ntpq.c @@ -1,12 +1,19 @@ /* * ntpq - query an NTP server using mode 6 commands */ + #include <stdio.h> + +#include "ntpq.h" +#include "ntp_unixtime.h" +#include "ntp_calendar.h" +#include "ntp_io.h" +#include "ntp_select.h" +#include "ntp_stdlib.h" + #include <ctype.h> #include <signal.h> #include <setjmp.h> -#include <sys/types.h> -#include <sys/time.h> #include <netdb.h> #ifdef SYS_WINNT # include <io.h> @@ -14,13 +21,6 @@ #define closesocket close #endif /* SYS_WINNT */ -#include "ntpq.h" -#include "ntp_unixtime.h" -#include "ntp_calendar.h" -#include "ntp_io.h" -#include "ntp_select.h" -#include "ntp_stdlib.h" - #ifdef SYS_VXWORKS /* vxWorks needs mode flag -casey*/ #define open(name, flags) open(name, flags, 0777) @@ -107,13 +107,15 @@ struct ctl_var sys_var[] = { { CS_POLL, UI, "poll" }, /* 8 */ { CS_PEERID, UI, "peer" }, /* 9 */ { CS_STATE, UI, "state" }, /* 10 */ - { CS_OFFSET, FL, "phase" }, /* 11 */ + { CS_OFFSET, FL, "offset" }, /* 11 */ { CS_DRIFT, FS, "frequency" }, /* 12 */ - { CS_COMPLIANCE, FU, "jitter" }, /* 13 */ + { CS_JITTER, FU, "jitter" }, /* 13 */ { CS_CLOCK, TS, "clock" }, /* 14 */ { CS_PROCESSOR, ST, "processor" }, /* 15 */ { CS_SYSTEM, ST, "system" }, /* 16 */ - { CS_STABIL, FS, "stability" }, /* 17 */ + { CS_VERSION, ST, "version" }, /* 17 */ + { CS_STABIL, FS, "stability" }, /* 18 */ + { CS_VARLIST, ST, "sys_var_list" }, /* 19 */ { 0, EOV, "" } }; @@ -158,7 +160,8 @@ struct ctl_var peer_var[] = { { CP_SENT, UI, "sent" }, /* 33 */ { CP_FILTERROR, AR, "filtdisp" }, /* 34 */ { CP_FLASH, FX, "flash" }, /* 35 */ - { CP_DISP, FU, "disp" }, /* 36 */ + { CP_TTL, UI, "ttl" }, /* 36 */ + { CP_TTLMAX, UI, "ttlmax" }, /* 37 */ /* * These are duplicate entries so that we can * process deviant version of the ntp protocol. @@ -199,14 +202,15 @@ struct ctl_var clock_var[] = { static const char *tstflagnames[] = { "dup_pkt", /* TEST1 */ "bogus_pkt", /* TEST2 */ - "proto_sync", /* TEST3 */ - "peer_bounds", /* TEST4 */ - "auth", /* TEST5 */ - "peer_sync", /* TEST6 */ + "proto_unsync", /* TEST3 */ + "no_access", /* TEST4 */ + "bad_auth", /* TEST5 */ + "peer_unsync", /* TEST6 */ "peer_stratum", /* TEST7 */ "root_bounds", /* TEST8 */ - "peer_auth", /* TEST9 */ - "access" /* TEST10 */ + "peer_bounds", /* TEST9 */ + "bad_autokey", /* TEST10 */ + "not_proventic" /* TEST11*/ }; @@ -667,7 +671,7 @@ sendpkt( printf("Sending %d octets\n", xdatalen); - if (send(sockfd, xdata, xdatalen, 0) == -1) { + if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) { warning("write to %s failed", currenthost, ""); return -1; } @@ -1904,9 +1908,9 @@ help( cmdsort[n++] = xcp->keyword; #ifdef QSORT_USES_VOID_P - qsort(cmdsort, (unsigned)n, sizeof(char *), helpsort); + qsort(cmdsort, (size_t)n, sizeof(char *), helpsort); #else - qsort((char *)cmdsort, n, sizeof(char *), helpsort); + qsort((char *)cmdsort, (size_t)n, sizeof(char *), helpsort); #endif maxlength = 0; @@ -2837,7 +2841,7 @@ tstflags( cb += strlen(cb); } else { *cb++ = ' '; - for (i = 0; i < 10; i++) { + for (i = 0; i < 11; i++) { if (val & 0x1) { sprintf(cb, "%s%s", sep, tstflagnames[i]); sep = ", "; @@ -3055,7 +3059,7 @@ sortassoc(void) #else (char *) #endif - assoc_cache, (unsigned)numassoc, + assoc_cache, (size_t)numassoc, sizeof(struct association), assoccmp); } diff --git a/contrib/ntp/ntpq/ntpq_ops.c b/contrib/ntp/ntpq/ntpq_ops.c index 8827a84..c907503 100644 --- a/contrib/ntp/ntpq/ntpq_ops.c +++ b/contrib/ntp/ntpq/ntpq_ops.c @@ -1,15 +1,15 @@ /* * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc */ + #include <stdio.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/time.h> -#include <netdb.h> #include "ntpq.h" #include "ntp_stdlib.h" +#include <ctype.h> +#include <netdb.h> + extern char * chosts[]; extern char currenthost[]; extern int numhosts; @@ -940,7 +940,7 @@ printassoc( conf = "yes"; else conf = "no"; - if (statval & CTL_PST_REACH) { + if (statval & CTL_PST_REACH || 1) { reach = "yes"; if (statval & CTL_PST_AUTHENABLE) { if (statval & CTL_PST_AUTHENTIC) @@ -1544,8 +1544,8 @@ dopeers( } (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host"); } - (void) fprintf(fp, - " remote refid st t when poll reach delay offset jitter\n"); + fprintf(fp, + " remote refid st t when poll reach delay offset jitter\n"); if (numhosts > 1) for (i = 0; i <= maxhostlen; ++i) (void) fprintf(fp, "="); @@ -1610,6 +1610,8 @@ doopeers( (void) fprintf(fp, " remote local st t when poll reach delay offset disp\n"); (void) fprintf(fp, + " (s) (s) (ms) (ms) (ms)\n"); + (void) fprintf(fp, "==============================================================================\n"); for (i = 0; i < numassoc; i++) { diff --git a/contrib/ntp/ntptrace/Makefile.in b/contrib/ntp/ntptrace/Makefile.in index 35078e9..f014e02 100644 --- a/contrib/ntp/ntptrace/Makefile.in +++ b/contrib/ntp/ntptrace/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -110,109 +126,94 @@ DISTCLEANFILES = .version version.c noinst_HEADERS = ntptrace.h #EXTRA_DIST = ntptrace.mak README TAGS save ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = ntptrace mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = ntptrace$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr ntptrace_SOURCES = ntptrace.c -ntptrace_OBJECTS = ntptrace$U.o +ntptrace_OBJECTS = ntptrace$U.$(OBJEXT) ntptrace_LDADD = $(LDADD) -ntptrace_DEPENDENCIES = version.o ../libntp/libntp.a +ntptrace_DEPENDENCIES = version.o ../libntp/libntp.a ntptrace_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = ntptrace.c -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +DIST_SOURCES = ntptrace.c +HEADERS = $(noinst_HEADERS) -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/ntptrace$U.Po -SOURCES = ntptrace.c -OBJECTS = ntptrace$U.o - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntptrace/Makefile +@AMDEP@DEP_FILES = $(DEPDIR)/ntptrace$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: +SOURCES = ntptrace.c +OBJECTS = ntptrace$U.$(OBJEXT) -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntptrace/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - ntptrace: $(ntptrace_OBJECTS) $(ntptrace_DEPENDENCIES) @rm -f ntptrace $(LINK) $(ntptrace_LDFLAGS) $(ntptrace_OBJECTS) $(ntptrace_LDADD) $(LIBS) ntptrace_.c: ntptrace.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptrace.c; then echo $(srcdir)/ntptrace.c; else echo ntptrace.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptrace_.c -ntptrace_.o : $(ANSI2KNR) +ntptrace_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -223,9 +224,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -238,74 +239,71 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/ntptrace$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/ntptrace$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) $(HEADERS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -317,45 +315,55 @@ distclean-generic: -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + distclean distclean-compile distclean-depend distclean-generic \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ + uninstall uninstall-am uninstall-binPROGRAMS $(PROGRAMS): $(LDADD) diff --git a/contrib/ntp/ntptrace/ntptrace.c b/contrib/ntp/ntptrace/ntptrace.c index d69e2b0..f7106ba 100644 --- a/contrib/ntp/ntptrace/ntptrace.c +++ b/contrib/ntp/ntptrace/ntptrace.c @@ -8,18 +8,9 @@ * * Large portions stolen from ntpdate.c */ -#include <stdio.h> -#include <signal.h> -#include <ctype.h> -#include <netdb.h> -#include <sys/types.h> -#include <sys/signal.h> -#include <sys/ioctl.h> -#include <sys/time.h> -#include <sys/resource.h> -#if defined(SYS_HPUX) -#include <utmp.h> +#ifdef HAVE_CONFIG_H +# include <config.h> #endif #include "ntp_fp.h" @@ -32,6 +23,17 @@ #include "ntp_select.h" #include "ntp_stdlib.h" #include "recvbuff.h" + +#include <stdio.h> +#include <signal.h> +#include <ctype.h> +#include <netdb.h> +#include <sys/signal.h> +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif +#include <sys/resource.h> + /* * only 16 stratums, so this is more than enough. */ @@ -59,7 +61,7 @@ int sys_retries = 5; /* # of retry attempts per server */ int sys_timeout = 2; /* timeout time, in seconds */ struct server **sys_servers; /* the server list */ int sys_numservers = 0; /* number of servers to poll */ -int sys_maxservers = NTP_MAXSTRATUM+1; /* max number of servers to deal with */ +int sys_maxservers = STRATUM_UNSPEC; /* max number of servers to deal with */ int sys_version = NTP_OLDVERSION; /* version to poll with */ @@ -242,6 +244,15 @@ DoTrace( { int retries = sys_retries; + if (!server->srcadr.sin_addr.s_addr) { + if (nonames) + printf("%s:\t*Not Synchronized*\n", ntoa(&server->srcadr)); + else + printf("%s:\t*Not Synchronized*\n", ntohost(&server->srcadr)); + fflush(stdout); + return; + } + if (!verbose) { if (nonames) printf("%s: ", ntoa(&server->srcadr)); @@ -426,7 +437,7 @@ ReceiveBuf( if ((PKT_MODE(rpkt->li_vn_mode) != MODE_SERVER && PKT_MODE(rpkt->li_vn_mode) != MODE_PASSIVE) - || rpkt->stratum > NTP_MAXSTRATUM) { + || rpkt->stratum >= STRATUM_UNSPEC) { if (debug) printf("receive: mode %d stratum %d\n", PKT_MODE(rpkt->li_vn_mode), rpkt->stratum); @@ -607,7 +618,7 @@ sendpkt( { int cc; - cc = sendto(fd, (char *)pkt, len, 0, (struct sockaddr *)dest, + cc = sendto(fd, (char *)pkt, (size_t)len, 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in)); if (cc == -1) { #ifndef SYS_WINNT diff --git a/contrib/ntp/parseutil/Makefile.am b/contrib/ntp/parseutil/Makefile.am index 902eb5c..2904f15 100644 --- a/contrib/ntp/parseutil/Makefile.am +++ b/contrib/ntp/parseutil/Makefile.am @@ -4,6 +4,7 @@ noinst_PROGRAMS = @TESTDCF@ @DCFD@ EXTRA_PROGRAMS = testdcf dcfd INCLUDES = -I$(top_srcdir)/include ETAGS_ARGS = Makefile.am +DISTCLEANFILES = $(EXTRA_PROGRAMS) #EXTRA_DIST= TAGS check-local: dcfd diff --git a/contrib/ntp/parseutil/Makefile.in b/contrib/ntp/parseutil/Makefile.in index 1ca4785..61309e6 100644 --- a/contrib/ntp/parseutil/Makefile.in +++ b/contrib/ntp/parseutil/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies @@ -106,87 +122,75 @@ noinst_PROGRAMS = @TESTDCF@ @DCFD@ EXTRA_PROGRAMS = testdcf dcfd INCLUDES = -I$(top_srcdir)/include ETAGS_ARGS = Makefile.am +DISTCLEANFILES = $(EXTRA_PROGRAMS) +EXEEXT = +OBJEXT = o subdir = parseutil mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = testdcf$(EXEEXT) dcfd$(EXEEXT) +noinst_PROGRAMS = @TESTDCF@ @DCFD@ +PROGRAMS = $(noinst_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr dcfd_SOURCES = dcfd.c -dcfd_OBJECTS = dcfd$U.o +dcfd_OBJECTS = dcfd$U.$(OBJEXT) dcfd_LDADD = $(LDADD) dcfd_DEPENDENCIES = dcfd_LDFLAGS = testdcf_SOURCES = testdcf.c -testdcf_OBJECTS = testdcf$U.o +testdcf_OBJECTS = testdcf$U.$(OBJEXT) testdcf_LDADD = $(LDADD) testdcf_DEPENDENCIES = testdcf_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = dcfd.c testdcf.c -DIST_COMMON = README Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best +DIST_SOURCES = dcfd.c testdcf.c depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/dcfd$U.Po $(DEPDIR)/testdcf$U.Po +@AMDEP@DEP_FILES = $(DEPDIR)/dcfd$U.Po $(DEPDIR)/testdcf$U.Po +DIST_COMMON = README Makefile.am Makefile.in + SOURCES = dcfd.c testdcf.c -OBJECTS = dcfd$U.o testdcf$U.o +OBJECTS = dcfd$U.$(OBJEXT) testdcf$U.$(OBJEXT) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu parseutil/Makefile +all: all-am -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu parseutil/Makefile -mostlyclean-noinstPROGRAMS: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - dcfd: $(dcfd_OBJECTS) $(dcfd_DEPENDENCIES) @rm -f dcfd $(LINK) $(dcfd_LDFLAGS) $(dcfd_OBJECTS) $(dcfd_LDADD) $(LIBS) @@ -198,7 +202,7 @@ dcfd_.c: dcfd.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dcfd.c; then echo $(srcdir)/dcfd.c; else echo dcfd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > dcfd_.c testdcf_.c: testdcf.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/testdcf.c; then echo $(srcdir)/testdcf.c; else echo testdcf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > testdcf_.c -dcfd_.o testdcf_.o : $(ANSI2KNR) +dcfd_.$(OBJEXT) testdcf_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -209,9 +213,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -224,75 +228,72 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/dcfd$U.Po -@AMDEP@include $(DEPDIR)/testdcf$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/dcfd$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/testdcf$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -301,47 +302,56 @@ clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am -clean-am: clean-noinstPROGRAMS clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstPROGRAMS distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi \ -check-local check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +.PHONY: all all-am check check-am check-local clean clean-generic \ + clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-kr tags uninstall uninstall-am #EXTRA_DIST= TAGS diff --git a/contrib/ntp/parseutil/testdcf.c b/contrib/ntp/parseutil/testdcf.c index 754ff63..afdc89d 100644 --- a/contrib/ntp/parseutil/testdcf.c +++ b/contrib/ntp/parseutil/testdcf.c @@ -16,14 +16,12 @@ * written consent of the author. */ +#include "ntp_stdlib.h" + #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <termios.h> -#include <sys/types.h> -#include <sys/time.h> - -#include "ntp_stdlib.h" /* * state flags diff --git a/contrib/ntp/scripts/Makefile.am b/contrib/ntp/scripts/Makefile.am index c3bb684..b970602 100644 --- a/contrib/ntp/scripts/Makefile.am +++ b/contrib/ntp/scripts/Makefile.am @@ -1 +1,4 @@ -noinst_SCRIPTS = mkver ntpver +bin_SCRIPTS = ntp-wait +noinst_SCRIPTS = calc_tickadj checktime freq_adj mkver ntpsweep ntpver plot_summary summary +EXTRA_DIST = fixautomakedepsmagic hpadjtime.sh monitoring ntp-close \ + ntp-groper ntp-restart ntp-status rc1 rc2 stats support diff --git a/contrib/ntp/scripts/Makefile.in b/contrib/ntp/scripts/Makefile.in index bc662fb..b857234 100644 --- a/contrib/ntp/scripts/Makefile.in +++ b/contrib/ntp/scripts/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,88 +91,141 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ -noinst_SCRIPTS = mkver ntpver +bin_SCRIPTS = ntp-wait +noinst_SCRIPTS = calc_tickadj checktime freq_adj mkver ntpsweep ntpver plot_summary summary +EXTRA_DIST = fixautomakedepsmagic hpadjtime.sh monitoring ntp-close \ + ntp-groper ntp-restart ntp-status rc1 rc2 stats support + +EXEEXT = +OBJEXT = o subdir = scripts mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = mkver ntpver -SCRIPTS = $(noinst_SCRIPTS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = calc_tickadj checktime freq_adj mkver ntp-wait \ +ntpsweep ntpver plot_summary summary +SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS) -DIST_SOURCES = -DIST_COMMON = README Makefile.am Makefile.in mkver.in ntpver.in +DIST_SOURCES = +DIST_COMMON = README Makefile.am Makefile.in calc_tickadj.in \ +checktime.in freq_adj.in mkver.in ntp-wait.in ntpsweep.in ntpver.in \ +plot_summary.in summary.in +all: all-am -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu scripts/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +calc_tickadj: $(top_builddir)/config.status calc_tickadj.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +checktime: $(top_builddir)/config.status checktime.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +freq_adj: $(top_builddir)/config.status freq_adj.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status mkver: $(top_builddir)/config.status mkver.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +ntp-wait: $(top_builddir)/config.status ntp-wait.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +ntpsweep: $(top_builddir)/config.status ntpsweep.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status ntpver: $(top_builddir)/config.status ntpver.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +plot_summary: $(top_builddir)/config.status plot_summary.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +summary: $(top_builddir)/config.status summary.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + if test -f $$p; then \ + echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f; \ + elif test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done tags: TAGS TAGS: -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ else \ test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ fi; \ done -info-am: -info: info-am -dvi-am: -dvi: dvi-am check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(SCRIPTS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(SCRIPTS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -178,31 +236,52 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic mostlyclean-am -clean-am: clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-generic -distclean-am: distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binSCRIPTS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +uninstall-am: uninstall-binSCRIPTS + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am info info-am install \ + install-am install-binSCRIPTS install-data install-data-am \ + install-exec install-exec-am install-info install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic uninstall uninstall-am uninstall-binSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/ntp/scripts/README b/contrib/ntp/scripts/README index 9e29467..673ddb4 100644 --- a/contrib/ntp/scripts/README +++ b/contrib/ntp/scripts/README @@ -18,11 +18,17 @@ rc1 start/stop scripts for NTP rc2 start/stop script for NTP +ntp-close find public stratum 2 servers that don't respond + ntp-groper script useful for reaching out and rattling the cages of NTP peers to see if animals are inside the bars ntp-restart script useful for killing and restarting the NTP daemon +ntp-wait Blocks until ntpd is in state 4 (synchronized). + Hopefully useful at boot time, to delay the boot sequence + until after "ntpd -g" has set the time. + ntpsweep prints per host given in <file> the NTP stratum level, the clock offset in seconds, the daemon version, the operating system and the processor. diff --git a/contrib/ntp/scripts/calc_tickadj.in b/contrib/ntp/scripts/calc_tickadj.in new file mode 100644 index 0000000..32eae12 --- /dev/null +++ b/contrib/ntp/scripts/calc_tickadj.in @@ -0,0 +1,38 @@ +#! @PATH_PERL@ +# +# drift of 104.8576 -> +1 tick. Base of 10000 ticks. +# +# 970306 HMS Deal with nanoseconds. Fix sign of adjustments. + +$df="/etc/ntp.drift"; +# Assumes a 100Hz box with "tick" of 10000 +# Someday, we might call "tickadj" for better values... +$base=10000; # tick: 1,000,000 / HZ +$cvt=104.8576; # 2 ** 20 / $base +$v1=0.; +$v2=""; + +if (open(DF, $df)) + { + if ($_=<DF>) + { + ($v1, $v2) = split; + } + + while ($v1 < 0) + { + $v1 += $cvt; + $base--; + } + + while ($v1 > $cvt) + { + $v1 -= $cvt; + $base++; + } + } + +printf("%.3f (drift)\n", $v1); + +printf("%d usec; %d nsec\n", $base, ($base + ($v1/$cvt)) * 1000); + diff --git a/contrib/ntp/scripts/checktime.in b/contrib/ntp/scripts/checktime.in new file mode 100644 index 0000000..2fe8f71 --- /dev/null +++ b/contrib/ntp/scripts/checktime.in @@ -0,0 +1,79 @@ +#! @PATH_PERL@ +#! @PATH_PERL@ -d +# +# This script compares the time of several machines with the +# time on the local host. +# +# Use or modify it as you wish. +# +# As the original author is only expecting 14 minutes of fame, +# leaving his name attached would be appreciated. +# +# R. Gary Cutbill <rgary@chrysalis.com> +# 21 April 1999 +# +$tol=2.0; +$|=1; +print "Time Check"; + +open(HOSTS,"ypcat hosts.byaddr |"); # get a list of hosts from the yp server. + +while ($line=<HOSTS>) { # loop for each host getting the offset compared to localhost + ($addr,$host,$aliases)=split(/\s+/,$line,3); + $res=`/usr/local/bin/ntptrace -m 1 -r 1 -t 1 $host`; + print "."; + chop $res; + push (@results,$res); +} +print "\n"; + + +# +# Sort the list of hosts, and print out there offsets +# from the local host. +# +@list=sort appropriately @results; +foreach $i ( @list ) { + + @dargs=split(/\s+/,$i); + if ( $dargs[1] eq "\*Timeout\*" ) { + print "$i\n"; + chop $dargs[0]; + push(@down,$dargs[0]); + } else { + printf "%-25s %7s %3s %6s %10s %5s %8s %8s\n",@dargs; + if ( ( $dargs[4] > $tol ) || ( $dargs[4] < -$tol ) ) { + chop $dargs[0]; + push(@toofarout,$dargs[0]); } + } +} +# +# When the above list finishes, hosts that are different by +/- $tol (two seconds) +# are in @toofarout. Hosts that are down are in @down. They are treated the same +# way here, but you might want to do something different depending on your site. +# +# print a set of suggested rsh commands to run on the hosts that +# don't have "good" time. "restartntp" is left as an excersize to the reader. +# I usually use it to kill a running xntpd, ntpdate some server, and the start xntp +# again. +# +print "\nConsider:\n"; +foreach $i ( (@down,@toofarout) ) { + print " rsh $i sudo restartntp\n"; +} + + +# +# sort the results from the list. First by stratum, then by time deviation +# Put hosts that didn't respond (timed out) on the bottom. +# +sub appropriately { + @af=split(/\s+/,$a); + @bf=split(/\s+/,$b); + $aba= ($af[4]<0)?-$af[4]:$af[4]; + $abb= ($bf[4]<0)?-$bf[4]:$bf[4]; + + ( $af[1] ne $bf[1] ) ? $bf[1] cmp $af[1] : + ( ( $af[2] != $bf[2] ) ? ( $bf[2] <=> $af[2] ) : + ( ( $aba != $abb ) ? ( $abb <=> $aba ) : ($af[0] cmp $bf[0] ) ) ); +} diff --git a/contrib/ntp/scripts/freq_adj.in b/contrib/ntp/scripts/freq_adj.in new file mode 100644 index 0000000..88eb390 --- /dev/null +++ b/contrib/ntp/scripts/freq_adj.in @@ -0,0 +1,97 @@ +#! @PATH_PERL@ -w + +die "perl5 needed\n" unless ($] > 5); + +use Getopt::Std; +use vars qw($opt_n); + +getopts('d:nt:'); + +#chop($ncpu = `sysctl -n hw.ncpu`); +#die "Found $ncpu CPUs; can only be run on systems with 1 CPU.\n" if ($ncpu > 1); + +$driftfile = "/etc/ntp.drift"; +$driftfile = $opt_d if defined($opt_d); + +chop($timer = `sysctl -n kern.timecounter.hardware 2> /dev/null`); + +$timer =~ tr/\U/\L/; + +if ($timer eq '') { + open(DM, "/var/run/dmesg.boot"); + while(<DM>) { + # Timecounter "i8254" frequency 1193182 Hz + if (/^Timecounter "(\w+)"\s+/) { + $timer = $1; + last; + } + } + close(DM); +} + +$opt_t = $timer if !defined($opt_t); + +if ($timer ne '') { # $timer found... + if ($opt_t ne '') { # - and $opt_t found + if ($timer ne $opt_t) { # - - and they differ + warn "You specified a $opt_t timer but I detected a $timer timer.\n"; + usage(); + exit 1; + } else { # - - and they are the same + ; + } + } else { # - but no $opt_t specified; this is OK + ; + } +} else { # No $timer found... + if ($opt_t ne '') { # - but $opt_t was specified + $timer = $opt_t; # - - so use it. + } else { # - and neither was $opt_t + warn "I can't tell what timer you have. Please specify one.\n"; + usage(); + exit 1; + } +} + +open(DF, $driftfile) || die "Can't open driftfile ($driftfile): $!\n"; +while(<DF>) { + chop; + if (/^(-?\d+\.\d+)(\s\d)?$/) { + $drift = $1; + } else { + die "Bogus value in driftfile $driftfile: <$_>\n"; + } +} +close(DF); + +print "NTP drift is <$drift>\n"; + +# Convert from NTP's idea of PPM to a decimal equivalent +$freq_adj = int ( $drift * ( 10 ** 6 / 2 ** 20) ); +print "normalized freq_adj is <$freq_adj>\n"; + +$freq_adj = int ( ( $freq_adj - 1 ) / 2 ); +print "Applying freq_adj of <".-$freq_adj.">\n"; + +$sysctl = "machdep.".$timer."_freq"; + +chop($mach_freq = `sysctl -n $sysctl`); + +print "$sysctl is <$mach_freq>\n"; + +$n_mach_freq = $mach_freq - $freq_adj; + +if (defined($opt_n)) { + print "$sysctl $mach_freq -> $n_mach_freq\n"; +} else { + print "i8254: ".`sysctl -w $sysctl=$n_mach_freq`; +} + +sub usage { + print STDERR <<EOUsage +Usage: $0 [-d drift_file] [-n] [-t timer] +where "drift_file" defaults to /etc/ntp.drift +and "timer" is usually "tsc" or "i8254" +and "-n" says "don't really change anything, just say what would happen". +EOUsage +} diff --git a/contrib/ntp/scripts/mkver.in b/contrib/ntp/scripts/mkver.in index 79d83f8..c6dc8da 100644 --- a/contrib/ntp/scripts/mkver.in +++ b/contrib/ntp/scripts/mkver.in @@ -3,12 +3,19 @@ PROG=${1-UNKNOWN} ConfStr="$PROG" +ConfStr="$ConfStr @VERSION@" + case "@LIBRSAREF@" in - '') ;; - *) ConfStr="$ConfStr RSAREF" ;; + '') + case "@AUTOKEY@" in + '') ;; + *) ConfStr="${ConfStr}-a" ;; + esac + ;; + *) ConfStr="${ConfStr}-r" ;; esac -ConfStr="$ConfStr @VERSION@ `date`" +ConfStr="$ConfStr `LC_TIME=C date`" if [ ! -f .version ]; then echo 0 > .version diff --git a/contrib/ntp/scripts/monitoring/README b/contrib/ntp/scripts/monitoring/README index fa8ad8b..f8eb0a9 100644 --- a/contrib/ntp/scripts/monitoring/README +++ b/contrib/ntp/scripts/monitoring/README @@ -1,14 +1,14 @@ This directory contains support for monitoring the local clock of xntp daemons. -WARNING: The scripts and routines contained in this directory are bete realease! - Do not depend on their correct operation. They are, however, in regular - use at University of Erlangen-Nuernberg. No severe problems are known - for this code. +WARNING: The scripts and routines contained in this directory are beta + release! Do not depend on their correct operation. They are, + however, in regular use at University of Erlangen-Nuernberg. + No severe problems are known for this code. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE THINK TWICE BEFORE STARTING MONITORING REMOTE XNTP DEAMONS !!!! MONITORING MAY INCREASE THE LOAD OF THE DEAMON MONITORED AND MAY -INCREASE THE NETWORK LOAD SIGNIFICANTLY +INCREASE THE NETWORK LOAD SIGNIFICANTLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -23,8 +23,8 @@ ntptrap: It sends a set_trap request to each server given and dumps the trap messages received. It handles refresh of set_trap. Currently it handles only NTP V2, however the NTP V3 servers - also accept v2 requests. It will not interpret v3 system and peer - stati correctly. + also accept v2 requests. It will not interpret v3 system and + peer stati correctly. usage: ntptrap [-n] [-p <port>] [-l <debug-output>] servers... @@ -72,7 +72,9 @@ ntploopstat: if a timeout occurs the next sample is tried after delay/2 seconds - The script will terminate after MAX_FAIL (currently 60) consecutive errors. + The script will terminate after MAX_FAIL (currently 60) + consecutive errors. + Errors are counted for: - error on send call - error on select call @@ -114,10 +116,10 @@ ntploopwatch: command line values would be replaced by settings from the config file. printer: specify printer to print plot - BSD print systems semantics apply; if printer is omitted - the name "ps" is used; plots are prepared using - PostScript, thus the printer should best accept - postscript input + BSD print systems semantics apply; if printer + is omitted the name "ps" is used; plots are + prepared using PostScript, thus the printer + should best accept postscript input For the following see also the comments in loopwatch.config.SAMPLE @@ -139,8 +141,10 @@ lr.pl: within display range timelocal.pl: - used during conversion of ISO_DATE_TIME values specified in loopwatch - config files to unix epoch values (seconds since 1970-01-01_00:00_00 UTC) + + used during conversion of ISO_DATE_TIME values specified in + loopwatch config files to unix epoch values (seconds since + 1970-01-01_00:00_00 UTC) A version of this file is distributed with perl-4.x, however, it has a bug related to dates crossing 1970, causing endless loops.. diff --git a/contrib/ntp/scripts/monitoring/lr.pl b/contrib/ntp/scripts/monitoring/lr.pl index 02c7550..7980d22 100644 --- a/contrib/ntp/scripts/monitoring/lr.pl +++ b/contrib/ntp/scripts/monitoring/lr.pl @@ -9,9 +9,14 @@ ;# Frank Kardel, Rainer Pruy ;# Friedrich-Alexander Universitaet Erlangen-Nuernberg ;# +;# Copyright (c) 1997 by +;# Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> +;# (Converted to a PERL 5.004 package) ;# ;############################################################# +package lr; + ## ## y = A + Bx ## @@ -23,123 +28,124 @@ ## ## interface ## -*lr_init = *lr'lr_init; #';# &lr_init(tag); initialize data set for tag -*lr_sample = *lr'lr_sample; #';# &lr_sample(x,y,tag); enter sample -*lr_Y = *lr'lr_Y; #';# &lr_Y(x,tag); compute y for given x -*lr_X = *lr'lr_X; #';# &lr_X(y,tag); compute x for given y -*lr_r = *lr'lr_r; #';# &lr_r(tag); regression coeffizient -*lr_cov = *lr'lr_cov; #';# &lr_cov(tag); covariance -*lr_A = *lr'lr_A; #';# &lr_A(tag); -*lr_B = *lr'lr_B; #';# &lr_B(tag); -*lr_sigma = *lr'lr_sigma; #';# &lr_sigma(tag); standard deviation -*lr_mean = *lr'lr_mean; #';# &lr_mean(tag); +;# init(tag); initialize data set for tag +;# sample(x, y, tag); enter sample +;# Y(x, tag); compute y for given x +;# X(y, tag); compute x for given y +;# r(tag); regression coefficient +;# cov(tag); covariance +;# A(tag); +;# B(tag); +;# sigma(tag); standard deviation +;# mean(tag); ######################### -package lr; - -sub tagify +sub init { - local($tag) = @_; - if (defined($tag)) - { - *lr_n = eval "*${tag}_n"; - *lr_sx = eval "*${tag}_sx"; - *lr_sx2 = eval "*${tag}_sx2"; - *lr_sxy = eval "*${tag}_sxy"; - *lr_sy = eval "*${tag}_sy"; - *lr_sy2 = eval "*${tag}_sy2"; - } + my $self = shift; + + $self->{n} = 0; + $self->{sx} = 0.0; + $self->{sx2} = 0.0; + $self->{sxy} = 0.0; + $self->{sy} = 0.0; + $self->{sy2} = 0.0; } -sub lr_init +sub sample($$$) { - &tagify($_[$[]) if defined($_[$[]); - - $lr_n = 0; - $lr_sx = 0.0; - $lr_sx2 = 0.0; - $lr_sxy = 0.0; - $lr_sy = 0.0; - $lr_sy2 = 0.0; + my $self = shift; + my($_x, $_y) = @_; + + ++($self->{n}); + $self->{sx} += $_x; + $self->{sy} += $_y; + $self->{sxy} += $_x * $_y; + $self->{sx2} += $_x**2; + $self->{sy2} += $_y**2; } -sub lr_sample +sub B($) { - local($_x, $_y) = @_; - - &tagify($_[$[+2]) if defined($_[$[+2]); + my $self = shift; - $lr_n++; - $lr_sx += $_x; - $lr_sy += $_y; - $lr_sxy += $_x * $_y; - $lr_sx2 += $_x**2; - $lr_sy2 += $_y**2; + return 1 unless ($self->{n} * $self->{sx2} - $self->{sx}**2); + return ($self->{n} * $self->{sxy} - $self->{sx} * $self->{sy}) + / ($self->{n} * $self->{sx2} - $self->{sx}**2); } -sub lr_B +sub A($) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return 1 unless ($lr_n * $lr_sx2 - $lr_sx**2); - return ($lr_n * $lr_sxy - $lr_sx * $lr_sy) / ($lr_n * $lr_sx2 - $lr_sx**2); + return ($self->{sy} - B($self) * $self->{sx}) / $self->{n}; } -sub lr_A +sub Y($$) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return ($lr_sy - &lr_B * $lr_sx) / $lr_n; + return A($self) + B($self) * $_[$[]; } -sub lr_Y +sub X($$) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return &lr_A + &lr_B * $_[$[]; + return ($_[$[] - A($self)) / B($self); } -sub lr_X +sub r($) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return ($_[$[] - &lr_A) / &lr_B; -} - -sub lr_r -{ - &tagify($_[$[]) if defined($_[$[]); - - local($s) = ($lr_n * $lr_sx2 - $lr_sx**2) * ($lr_n * $lr_sy2 - $lr_sy**2); + my $s = ($self->{n} * $self->{sx2} - $self->{sx}**2) + * ($self->{n} * $self->{sy2} - $self->{sy}**2); return 1 unless $s; - return ($lr_n * $lr_sxy - $lr_sx * $lr_sy) / sqrt($s); + return ($self->{n} * $self->{sxy} - $self->{sx} * $self->{sy}) / sqrt($s); } -sub lr_cov +sub cov($) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return ($lr_sxy - $lr_sx * $lr_sy / $lr_n) / ($lr_n - 1); + return ($self->{sxy} - $self->{sx} * $self->{sy} / $self->{n}) + / ($self->{n} - 1); } -sub lr_sigma +sub sigma($) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return 0 if $lr_n <= 1; - return sqrt(($lr_sy2 - ($lr_sy * $lr_sy) / $lr_n) / ($lr_n)); + return 0 if $self->{n} <= 1; + return sqrt(($self->{sy2} - ($self->{sy} * $self->{sy}) / $self->{n}) + / ($self->{n})); } -sub lr_mean +sub mean($) { - &tagify($_[$[]) if defined($_[$[]); + my $self = shift; - return 0 if $lr_n <= 0; - return $lr_sy / $lr_n; + return 0 if $self->{n} <= 0; + return $self->{sy} / $self->{n}; } -&lr_init(); +sub new +{ + my $class = shift; + my $self = { + (n => undef, + sx => undef, + sx2 => undef, + sxy => undef, + sy => undef, + sy2 => undef) + }; + bless $self, $class; + init($self); + return $self; +} 1; diff --git a/contrib/ntp/scripts/monitoring/ntp.pl b/contrib/ntp/scripts/monitoring/ntp.pl index ea9e69c..b23f396 100644 --- a/contrib/ntp/scripts/monitoring/ntp.pl +++ b/contrib/ntp/scripts/monitoring/ntp.pl @@ -1,4 +1,4 @@ -#!/local/bin/perl +#!/usr/bin/perl -w ;# ;# ntp.pl,v 3.1 1993/07/06 01:09:09 jbj Exp ;# @@ -43,7 +43,7 @@ $keyid=0; ;# N key ;# N2 checksum -;# first bye of packet +;# first byte of packet sub pkt_LI { return ($_[$[] >> 6) & 0x3; } sub pkt_VN { return ($_[$[] >> 3) & 0x7; } sub pkt_MODE { return ($_[$[] ) & 0x7; } @@ -223,6 +223,7 @@ sub PeerSelection { &getval(&psw_PSel($_[$[]),*PeerSelection); } + sub PeerEvent { &getval(&psw_PCode($_[$[]),*PeerEvent); @@ -394,14 +395,14 @@ sub handle_packet $lastseen = 1 if !&pkt_M($r_e_m_op); if (!defined(%FRAGS)) { - # (&pkt_M($r_e_m_op) ? " more" : "")."\n"; + print((&pkt_M($r_e_m_op) ? " more" : "")."\n"); $FRAGS{$offset} = $data; ;# save other info @FRAGS = ($status,$associd,&pkt_OP($r_e_m_op),$seq,$auth_keyid,$r_e_m_op); } else { - # (&pkt_M($r_e_m_op) ? " more" : "")."\n"; + print((&pkt_M($r_e_m_op) ? " more" : "")."\n"); ;# add frag to previous - combine on the fly if (defined($FRAGS{$offset})) { diff --git a/contrib/ntp/scripts/monitoring/ntploopstat b/contrib/ntp/scripts/monitoring/ntploopstat index 75cdff2..7583c7c 100644 --- a/contrib/ntp/scripts/monitoring/ntploopstat +++ b/contrib/ntp/scripts/monitoring/ntploopstat @@ -1,4 +1,5 @@ -#!/local/bin/perl -w--*-perl-*- +#!/usr/bin/perl -w +# --*-perl-*- ;# ;# ntploopstat,v 3.1 1993/07/06 01:09:11 jbj Exp ;# @@ -22,7 +23,7 @@ ;# (Should have implemented &gettimeofday()..) ;# -$0 =~ s!^.*/([^/]+)$!\1!; # beautify script name +$0 =~ s!^.*/([^/]+)$!$1!; # beautify script name $ntpserver = 'localhost'; # default host to poll $delay = 60; # default sampling rate diff --git a/contrib/ntp/scripts/ntp-close b/contrib/ntp/scripts/ntp-close new file mode 100755 index 0000000..b5077e6 --- /dev/null +++ b/contrib/ntp/scripts/ntp-close @@ -0,0 +1,8 @@ +#! /bin/sh + +lynx -source http://www.eecis.udel.edu/~mills/ntp/clock2.htm | + sed -n -e 's,).*,,' -e' /([0-9.]*$/s/.*(//p' | + xargs ntpdate -q | + sort -n +7 > /tmp/ntp-close + +# From: Neal McBurnett <neal@bcn.boulder.co.us> diff --git a/contrib/ntp/scripts/ntp-restart b/contrib/ntp/scripts/ntp-restart index d2023f0..0a1d58a 100755 --- a/contrib/ntp/scripts/ntp-restart +++ b/contrib/ntp/scripts/ntp-restart @@ -1,9 +1,10 @@ #!/bin/sh # # This script can be used to kill and restart the NTP daemon. Edit the -# /usr/local/bin/xntpd line to fit. +# /usr/local/bin/ntpd line to fit. # -kill -INT `ps -ax | egrep "xntpd" | egrep -v "egrep" | sed 's/^\([ 0-9]*\) .*/\1'/` +kill -INT `ps -ax | egrep "ntpd" | egrep -v "egrep" | sed 's/^\([ 0-9]*\) .*/\1'/` sleep 10 -/usr/local/bin/xntpd +/usr/local/bin/ntpd -g +/usr/local/bin/ntp-wait exit 0 diff --git a/contrib/ntp/scripts/ntp-wait.in b/contrib/ntp/scripts/ntp-wait.in new file mode 100644 index 0000000..a26630b --- /dev/null +++ b/contrib/ntp/scripts/ntp-wait.in @@ -0,0 +1,42 @@ +#! @PATH_PERL@ -w + +die "perl5 needed\n" unless ($] > 5); + +use Getopt::Std; + +$opt_f = 0; # 'Hard' failure if 'state' is unknown +$opt_n = 1000; # How many tries before we give up? (10 min+) +$opt_s = 6; # Seconds to sleep between tries (6s = 10/min) +$opt_v = 0; # Be verbose? + +getopts('fn:s:v'); + +$cmd = 'ntpq -c "rv 0 state"'; + +$| = 1; # Autoflush output. + +print "Waiting for ntpd to synchronize... " if ($opt_v); +for ($i = 0; $i < $opt_n; ++$i) { + open(Q, $cmd." 2>&1 |") || die "Can't start ntpq: $!"; + while(<Q>) { + if (/^state=4/) { + print "\bOK!\n" if ($opt_v); + exit 0; + } + + if (/request variable was unknown/) { + print "\bCan't tell!\nPerhaps you are running an old version of ntpd.\n" if ($opt_v); + exit $opt_f; + } + + if (/Connection refused/) { + print "\bntpd is not running!\n" if ($opt_v); + exit 1; + } + } + close(Q); + print "\b".substr("*+:.", $i % 4, 1) if ($opt_v); + sleep($opt_s); +} +print "\bNo!\nntpd did not synchronize.\n" if ($opt_v); +exit 1; diff --git a/contrib/ntp/scripts/ntpsweep.in b/contrib/ntp/scripts/ntpsweep.in new file mode 100644 index 0000000..eb41563 --- /dev/null +++ b/contrib/ntp/scripts/ntpsweep.in @@ -0,0 +1,301 @@ +#! @PATH_PERL@ -w +# +# $Id: ntpsweep.in,v 1.1 2000/02/10 08:13:40 stenn Exp $ +# +# DISCLAIMER +# +# Copyright (C) 1999,2000 Hans Lambermont and Origin B.V. +# +# Permission to use, copy, modify and distribute this software and its +# documentation for any purpose and without fee is hereby granted, +# provided that the above copyright notice appears in all copies and +# that both the copyright notice and this permission notice appear in +# supporting documentation. This software is supported as is and without +# any express or implied warranties, including, without limitation, the +# implied warranties of merchantability and fitness for a particular +# purpose. The name Origin B.V. must not be used to endorse or promote +# products derived from this software without prior written permission. +# +# Hans Lambermont <Hans.Lambermont@nl.origin-it.com>/<H.Lambermont@chello.nl> +# 14 Jan 2000 + +require 5.0; # But actually tested on 5.004 ;) +use Getopt::Long; # GetOptions() +use strict; + +my $version = 1.3; +(my $program = $0) =~ s%.*/(.+?)(.pl)?$%$1%; + +# Hardcoded paths/program names +my $ntpdate = "ntpdate"; +my $ntpq = "ntpq"; + +# no STDOUT buffering +$| = 1; + +my ($help, $single_host, $showpeers, $maxlevel, $strip, $askversion); +my $res = GetOptions("help!" => \$help, + "host=s" => \$single_host, + "peers!" => \$showpeers, + "maxlevel=s" => \$maxlevel, + "strip=s" => \$strip, + "version!" => \$askversion); + +if ($askversion) { + print("$version\n"); + exit 0; +} + +if ($help || ((@ARGV != 1) && !$single_host)) { + warn <<EOF; +This is $program, version $version +Copyright (C) 1999,2000 Hans Lambermont and Origin B.V. Disclaimer inside. + +Usage: + $program [--help|--peers|--strip <string>|--maxlevel <level>|--version] \\ + <file>|[--host <hostname>] + +Description: + $program prints per host given in <file> the NTP stratum level, the + clock offset in seconds, the daemon version, the operating system and + the processor. Optionally recursing through all peers. + +Options: +--help + Print this short help text and exit. +--version + Print version ($version) and exit. +<file> + Specify hosts file. File format is one hostname or ip number per line. + Lines beginning with # are considered as comment. +--host <hostname> + Speficy a single host, bypassing the need for a hosts file. +--peers + Recursively list all peers a host synchronizes to. + An '= ' before a peer means a loop. Recursion stops here. +--maxlevel <level> + Traverse peers up to this level (4 is a reasonable number). +--strip <string> + Strip <string> from hostnames. + +Examples: + $program myhosts.txt --strip .foo.com + $program --host some.host --peers --maxlevel 4 +EOF + exit 1; +} + +my $hostsfile = shift; +my (@hosts, @known_hosts); +my (%known_host_info, %known_host_peers); + +sub read_hosts() +{ + local *HOSTS; + open (HOSTS, $hostsfile) || + die "$program: FATAL: unable to read $hostsfile: $!\n"; + while (<HOSTS>) { + next if /^\s*(#|$)/; # comment/empty + chomp; + push(@hosts, $_); + } + close(HOSTS); +} + +# translate IP to hostname if possible +sub ip2name { + my($ip) = @_; + my($addr, $name, $aliases, $addrtype, $length, @addrs); + $addr = pack('C4', split(/\./, $ip)); + ($name, $aliases, $addrtype, $length, @addrs) = gethostbyaddr($addr, 2); + if ($name) { + # return lower case name + return("\L$name"); + } else { + return($ip); + } +} + +# item_in_list($item, @list): returns 1 if $item is in @list, 0 if not +sub item_in_list { + my($item, @list) = @_; + my($i); + foreach $i (@list) { + return 1 if ($item eq $i); + } + return 0; +} + +sub scan_host($;$;$) { + my($host, $level, @trace) = @_; + my $stratum = 0; + my $offset = 0; + my $daemonversion = ""; + my $system = ""; + my $processor = ""; + my @peers; + my $known_host = 0; + + if (&item_in_list($host, @known_hosts)) { + $known_host = 1; + } else { + # ntpdate part + open(NTPDATE, "$ntpdate -bd $host 2>/dev/null |") || + die "Cannot open ntpdate pipe: $!\n"; + while (<NTPDATE>) { + /^stratum\s+(\d+).*$/ && do { + $stratum = $1; + }; + /^offset\s+([0-9.-]+)$/ && do { + $offset = $1; + }; + } + close(NTPDATE); + + # got answers ? If so, go on. + if ($stratum) { + # ntpq part + my $ntpqparams = "-c 'rv 0 processor,system,daemon_version'"; + open(NTPQ, "$ntpq $ntpqparams $host 2>/dev/null |") || + die "Cannot open ntpq pipe: $!\n"; + while (<NTPQ>) { + /daemon_version="(.*)"/ && do { + $daemonversion = $1; + }; + /system="([^"]*)"/ && do { + $system = $1; + }; + /processor="([^"]*)"/ && do { + $processor = $1; + }; + } + close(NTPQ); + + # Shorten daemon_version string. + $daemonversion =~ s/(;|Mon|Tue|Wed|Thu|Fri|Sat|Sun).*$//; + $daemonversion =~ s/version=//; + $daemonversion =~ s/(x|)ntpd //; + $daemonversion =~ s/(\(|\))//g; + $daemonversion =~ s/beta/b/; + $daemonversion =~ s/multicast/mc/; + + # Shorten system string + $system =~ s/UNIX\///; + $system =~ s/RELEASE/r/; + $system =~ s/CURRENT/c/; + + # Shorten processor string + $processor =~ s/unknown//; + } + + # got answers ? If so, go on. + if ($daemonversion) { + # ntpq again, find out the peers this time + if ($showpeers) { + my $ntpqparams = "-pn"; + open(NTPQ, "$ntpq $ntpqparams $host 2>/dev/null |") || + die "Cannot open ntpq pipe: $!\n"; + while (<NTPQ>) { + /^No association ID's returned$/ && do { + last; + }; + /^ remote/ && do { + next; + }; + /^==/ && do { + next; + }; + /^( |x|\.|-|\+|#|\*|o)([^ ]+)/ && do { + push(@peers, ip2name($2)); + next; + }; + print "ERROR: $_"; + } + close(NTPQ); + } + } + + # Add scanned host to known_hosts array + push(@known_hosts, $host); + if ($stratum) { + $known_host_info{$host} = sprintf("%2d %9.3f %-11s %-12s %s", + $stratum, $offset, substr($daemonversion,0,11), + substr($system,0,12), substr($processor,0,9)); + } else { + # Stratum level 0 is consider invalid + $known_host_info{$host} = sprintf(" ?"); + } + $known_host_peers{$host} = [@peers]; + } + + if ($stratum || $known_host) { # Valid or known host + my $printhost = ' ' x $level . $host; + # Shorten host string + if ($strip) { + $printhost =~ s/$strip//; + } + # append number of peers in brackets if requested and valid + if ($showpeers && ($known_host_info{$host} ne " ?")) { + $printhost .= " (" . @{$known_host_peers{$host}} . ")"; + } + # Finally print complete host line + printf("%-32s %s\n", + substr($printhost,0,32), $known_host_info{$host}); + if ($showpeers && (eval($maxlevel ? $level < $maxlevel : 1))) { + my $peer; + push(@trace, $host); + # Loop through peers + foreach $peer (@{$known_host_peers{$host}}) { + if (&item_in_list($peer, @trace)) { + # we've detected a loop ! + $printhost = ' ' x ($level + 1) . "= " . $peer; + # Shorten host string + if ($strip) { + $printhost =~ s/$strip//; + } + printf("%-32s %s\n", + substr($printhost,0,32)); + } else { + if (substr($peer,0,3) ne "127") { + &scan_host($peer, $level + 1, @trace); + } + } + } + } + } else { # We did not get answers from this host + my $printhost = ' ' x $level . $host; + # Shorten host string + if ($strip) { + $printhost =~ s/$strip//; + } + printf("%-32s ?\n", substr($printhost,0,32)); + } +} + +sub scan_hosts() +{ + my $host; + for $host (@hosts) { + my @trace; + push(@trace, $host); + scan_host($host, 0, @trace); + } +} + +# Main program + +if ($single_host) { + push(@hosts, $single_host); +} else { + &read_hosts($hostsfile); +} + +# Print header +print <<EOF; +Host st offset(s) version system processor +--------------------------------+--+---------+-----------+------------+--------- +EOF + +&scan_hosts(); + +exit 0; diff --git a/contrib/ntp/scripts/plot_summary.in b/contrib/ntp/scripts/plot_summary.in new file mode 100644 index 0000000..03d8203 --- /dev/null +++ b/contrib/ntp/scripts/plot_summary.in @@ -0,0 +1,337 @@ +#! @PATH_PERL@ -w +# $Id: plot_summary.in,v 1.1 2000/02/10 08:13:40 stenn Exp $ +# +# Use Gnuplot to display data in summary files produced by summary.pl. +# This script requires GNUPLOT 3.7! +# +# Copyright (c) 1997, 1999 by Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +require 5.003; # "never tested with any other version of Perl" +use strict; + +use Time::Local; +use Getopt::Long; + +# parse command line +my $summary_dir = "/tmp"; +my $identifier = "host " . `hostname`; # origin of these data +chomp $identifier; # remove newline +my $offset_limit = 0.128; # limit of absolute offset +my $output_file = ""; # output file defaults to stdout +my $output_file_number = 1; # numbering of output files +my $gnuplot_terminal = $ENV{DISPLAY} ? "x11" : "dumb"; +my $wait_after_plot = 1; +my @peer_list = (); + +my %options = ("directory|input-directory=s" => \$summary_dir, + "identifier=s" => \$identifier, + "offset-limit=f" => \$offset_limit, + "output-file=s" => \$output_file, + "peer=s@" => \@peer_list, + "plot-term|gnuplot-term=s" => \$gnuplot_terminal, + "wait-after-plot!" => \$wait_after_plot, + ); + +if ( !GetOptions(%options) ) +{ + print STDERR "valid options for $0 are:\n"; + my $opt; + foreach $opt (sort(keys %options)) { + print STDERR "\t--$opt\t(default is "; + if ( ref($options{$opt}) eq "ARRAY" ) { + print STDERR join(", ", map { "'$_'" } @{$options{$opt}}); + } else { + print STDERR "'${$options{$opt}}'"; + } + print STDERR ")\n"; + } + print STDERR "\n"; + die; +} + +chomp $identifier; +die "illegal offset-limit: $offset_limit" unless $offset_limit > 0.0; +$offset_limit *= 1e6; # scale to microseconds + +# return the smallest value in the given list +sub min +{ + my ($result, @rest) = @_; + map { $result = $_ if ($_ < $result) } @rest; + return($result); +} + +# return the largest value in the given list +sub max +{ + my ($result, @rest) = @_; + map { $result = $_ if ($_ > $result) } @rest; + return($result); +} + +# maybe open alternate output file +sub open_output +{ + my $file; + if ($output_file) { + while ( -r ($file = "$output_file$output_file_number") ) { + ++$output_file_number; + } + open TOUCH, ">$file" and close TOUCH or die "$file: $!"; + print "set output \"$file\"\n"; + } +} + +# make Gnuplot wait +sub maybe_add_pause +{ + print "pause -1 \"Press key to continue...\"\n" if $wait_after_plot; +} + +# plot data from loop summary +sub do_loop +{ + my $fname = shift; + my $line; + my $out_file = "/tmp/tempdata$$"; + my $cmd_file = "/tmp/tempcmd$$"; + my ($first_day, $day_out) = ("", 0); + my ($lower_bound, $upper_bound, $rms); + my ($min_offs, $max_offs) = (1e9, -1e9); + my ($min_rms, $max_rms) = (1e9, -1e9); + open INPUT, "$fname" or die "$fname: $!"; + open OUTPUT, ">$out_file" or die "$out_file: $!"; + my @Fld; + while (<INPUT>) { + chop; # strip record separator + @Fld = split; + if ($#Fld == 0) { +# loops.19960405 + $_ = $Fld[0]; s/.*([12]\d{3}[01]\d[0-3]\d)$/$1/; + m/(\d{4})(\d{2})(\d{2})/; + $line = timegm(59, 59, 23, $3, $2 - 1, $1 - 1900, 0, 0, 0); + $line = int $line / 86400; # days relative to 1970 + $first_day = "$1-$2-$3 ($line)" unless $day_out; + next; + } + if ($#Fld != 8) { + warn "Illegal number of fields in file $fname, line $."; + next; + } +# loop 216, 856106+/-874041.5, rms 117239.8, freq 67.52+/-10.335, var 4.850 + $_ = $Fld[1]; s/,/ /; $line .= " $_"; + $_ = $Fld[2]; m:(.+?)\+/-(.+),:; + $lower_bound = $1 - $2; + $upper_bound = $1 + $2; + $line .= "$1 $lower_bound $upper_bound"; + $min_offs = min($min_offs, $lower_bound); + $max_offs = max($max_offs, $upper_bound); + $_ = $Fld[4]; s/,/ /; $rms = $_; + $min_rms = min($min_rms, $rms); + $max_rms = max($max_rms, $rms); + $line .= " $rms"; + $_ = $Fld[6]; m:(.+?)\+/-(.+),:; + $line .= " $1 " . ($1-$2) . " " . ($1+$2); + $line .= " $Fld[8]"; + print OUTPUT "$line\n"; + $day_out = 1; +# 9621 216 856106 -17935.5 1730147.5 117239.8 67.52 57.185 77.855 4.850 + } + close INPUT; + close OUTPUT or die "close failed on $out_file: $!"; + my $ylimit = "["; + if ($min_offs < -$offset_limit) { + $ylimit .= "-$offset_limit"; + } + $ylimit .= ":"; + if ($max_offs > $offset_limit) { + $ylimit .= "$offset_limit"; + } + if ( $ylimit eq "[:" ) { + $ylimit = ""; + } else { + $ylimit = "[] $ylimit]"; + } +# build command file for GNUplot + open OUTPUT, "> $cmd_file" or die "$cmd_file: $!"; + my $oldfh = select OUTPUT; + print "set term $gnuplot_terminal\n"; + open_output; + print "set grid\n"; + print "set title \"Loop Summary for $identifier: " . + "Daily mean values since $first_day\\n" . + "(Offset limit is $offset_limit microseconds)\"\n"; + print "set ylabel \"[us]\"\n"; + print "set data style yerrorbars\n"; + print "set multiplot\n"; + print "set size 1, 0.5\n"; + print "set lmargin 8\n"; + print "set origin 0, 0.5\n"; + print "plot $ylimit \"$out_file\"" . + " using 1:3:4:5 title \"mean offset\", "; + print "\"$out_file\" using 1:(\$3-\$6/2) " . + "title \"(sigma low)\" with lines, "; + print "\"$out_file\" using 1:3 smooth bezier " . + "title \"(Bezier med)\" with lines, "; + print "\"$out_file\" using 1:(\$3+\$6/2) " . + "title \"(sigma high)\" with lines\n"; + print "set ylabel \"[ppm]\"\n"; + print "set origin 0, 0.0\n"; + print "set title\n"; + print "set xlabel \"Days relative to 1970\"\n"; + print "plot \"$out_file\" using 1:7:8:9 title \"mean frequency\", "; + print "\"$out_file\" using 1:(\$7-\$10/2) " . + "title \"(sigma low)\" with lines, "; + print "\"$out_file\" using 1:7 smooth bezier " . + "title \"(Bezier med)\" with lines, "; + print "\"$out_file\" using 1:(\$7+\$10/2) " . + "title \"(sigma high)\" with lines\n"; + print "set nomultiplot\n"; + maybe_add_pause; + + $ylimit = "["; + if ($min_rms < -$offset_limit) { + $ylimit .= "-$offset_limit"; + } + $ylimit .= ":"; + if ($max_rms > $offset_limit) { + $ylimit .= "$offset_limit"; + } + if ( $ylimit eq "[:" ) { + $ylimit =""; + } else { + $ylimit = "[] $ylimit]"; + } + + open_output; + print "set title \"Loop Summary for $identifier: " . + "Standard deviation since $first_day\\n" . + "(Offset limit is $offset_limit microseconds)\"\n"; + print "set xlabel\n"; + print "set ylabel \"[us]\"\n"; + print "set origin 0, 0.5\n"; + print "set data style linespoints\n"; + print "set multiplot\n"; + print "plot $ylimit \"$out_file\" using 1:6 title \"Offset\", "; + print "\"$out_file\" using 1:6 smooth bezier " . + "title \"(Bezier)\" with lines\n"; + print "set title\n"; + print "set origin 0, 0.0\n"; + print "set xlabel \"Days relative to 1970\"\n"; + print "set ylabel \"[ppm]\"\n"; + print "plot \"$out_file\" using 1:10 title \"Frequency\", "; + print "\"$out_file\" using 1:10 smooth bezier " . + "title \"(Bezier)\" with lines\n"; + print "set nomultiplot\n"; + maybe_add_pause; + + close OUTPUT or die "close failed on $cmd_file: $!"; + select $oldfh; + print `gnuplot $cmd_file`; + unlink $cmd_file; + unlink $out_file; +} + +# plot data form peer summary +sub do_peer +{ + my $fname = shift; + my $peer = shift; + my $out_file = "/tmp/tempdata$$"; + my $cmd_file = "/tmp/tempcmd$$"; + my $line; + my ($first_day, $day_out) = ("", 0); + open INPUT, "$fname" or die "$fname: $!"; + open OUTPUT, ">$out_file" or die "$out_file: $!"; + my @Fld; + while (<INPUT>) { + chop; # strip record separator + @Fld = split; + if ($#Fld == 0) { +# peers.19960405 + $_ = $Fld[0]; s/.*([12]\d{3}[01]\d[0-3]\d)$/$1/; + m/(\d{4})(\d{2})(\d{2})/ or next; + $line = timegm(59, 59, 23, $3, $2 - 1, $1 - 1900, 0, 0, 0); + $line = int $line / 86400; # days relative to 1970 + $first_day = "$1-$2-$3 ($line)" unless $day_out; + next; + } + if ($#Fld != 7) { + warn "Illegal number of fields in file $fname, line $."; + next; + } + next if ($Fld[0] ne $peer); +# ident cnt mean rms max delay dist disp +# 127.127.8.1 38 30.972 189.867 1154.607 0.000 879.760 111.037 + $Fld[0] = $line; + print OUTPUT join(' ', @Fld) . "\n"; +# 9969 38 30.972 189.867 1154.607 0.000 879.760 111.037 + $day_out = 1; + } + close INPUT; + close OUTPUT or die "close failed on $out_file: $!"; + die "no data found for peer $peer" if !$day_out; + open OUTPUT, "> $cmd_file" or die "$cmd_file: $!"; + my $oldfh = select OUTPUT; + print "set term $gnuplot_terminal\n"; + open_output; + print "set grid\n"; + print "set multiplot\n"; + print "set lmargin 8\n"; + print "set size 1, 0.34\n"; + print "set origin 0, 0.66\n"; + print "set title " . + "\"Peer Summary for $peer on $identifier since $first_day\"\n"; + print "set data style linespoints\n"; + print "set ylabel \"[us]\"\n"; + print "plot \"$out_file\" using 1:3 title \"mean offset\", "; + print "\"$out_file\" using 1:3 smooth bezier " . + "title \"(Bezier)\" with lines, "; + print "\"$out_file\" using 1:(\$3-\$7/2) " . + "title \"(sigma low)\" with lines, "; + print "\"$out_file\" using 1:(\$3+\$7/2) " . + "title \"(sigma high)\" with lines\n"; + print "set title\n"; + print "set origin 0, 0.34\n"; + print "set size 1, 0.32\n"; + print "set ylabel\n"; + print "plot \"$out_file\" using 1:7 title \"dist\", "; + print "\"$out_file\" using 1:7 smooth bezier " . + "title \"(Bezier)\" with lines\n"; + print "set origin 0, 0.00\n"; + print "set size 1, 0.35\n"; + print "set xlabel \"Days relative to 1970\"\n"; + print "plot \"$out_file\" using 1:8 title \"disp\", "; + print "\"$out_file\" using 1:8 smooth bezier " . + "title \"(Bezier)\" with lines\n"; + print "set nomultiplot\n"; + maybe_add_pause; + + select $oldfh; + close OUTPUT or die "close failed on $cmd_file: $!"; + print `gnuplot $cmd_file`; + unlink $cmd_file; + unlink $out_file; +} + + +my $loop_summary ="$summary_dir/loop_summary"; +my $peer_summary ="$summary_dir/peer_summary"; +my $clock_summary="$summary_dir/clock_summary"; + +do_loop $loop_summary; +map { do_peer $peer_summary, $_ } @peer_list; diff --git a/contrib/ntp/scripts/stats/summary.sh b/contrib/ntp/scripts/stats/summary.sh index 655c4be..dffdb0b 100755 --- a/contrib/ntp/scripts/stats/summary.sh +++ b/contrib/ntp/scripts/stats/summary.sh @@ -6,7 +6,7 @@ # runs the file-specific summary script and appends the summary data to # designated files. # -DATE=`date +19%y%m%d` +DATE=`date +20%y%m%d` S=/usr/local/bin/S SIN=S.in SOUT=S.out diff --git a/contrib/ntp/scripts/summary.in b/contrib/ntp/scripts/summary.in new file mode 100644 index 0000000..ac259d4 --- /dev/null +++ b/contrib/ntp/scripts/summary.in @@ -0,0 +1,373 @@ +#! @PATH_PERL@ -w +# $Id: summary.in,v 1.1 2000/02/10 08:13:40 stenn Exp $ +# Perl version of (summary.sh, loop.awk, peer.awk): +# Create summaries from xntpd's loop and peer statistics. +# +# Copyright (c) 1997, 1999 by Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +require 5.003; # "never tested with any other version of Perl" +use strict; + +use Getopt::Long; + +my $log_date_pattern = '[12]\d{3}[01]\d[0-3]\d'; +my $statsdir = "/var/log/ntp"; # directory with input files +my $outputdir = "/tmp"; # directory for output files +my $skip_time_steps = 3600.0; # ignore time offsets larger that this +my $startdate = "19700101"; # first data file to use (YYYYMMDD) +my $enddate=`date -u +%Y%m%d`; chomp $enddate; --$enddate; +my $peer_dist_limit = 400.0; + +my %options = ("directory|input-directory=s" => \$statsdir, + "output-directory=s" => \$outputdir, + "skip-time-steps:f" => \$skip_time_steps, + "start-date=s" => \$startdate, + "end-date=s" => \$enddate, + "peer-dist-limit=f" => \$peer_dist_limit); + +if ( !GetOptions(%options) ) +{ + print STDERR "valid options for $0 are:\n"; + my $opt; + foreach $opt (sort(keys %options)) { + print STDERR "\t--$opt\t(default is "; + if ( ref($options{$opt}) eq "ARRAY" ) { + print STDERR join(", ", map { "'$_'" } @{$options{$opt}}); + } else { + print STDERR "'${$options{$opt}}'"; + } + print STDERR ")\n"; + } + print STDERR "\n"; + die; +} + +# check possibly current values of options +die "$statsdir: no such directory" unless (-d $statsdir); +die "$outputdir: no such directory" unless (-d $outputdir); +die "$skip_time_steps: skip-time-steps must be positive" + unless ($skip_time_steps >= 0.0); +die "$startdate: invalid start date|$`|$&|$'" + unless ($startdate =~ m/.*$log_date_pattern$/); +die "$enddate: invalid end date" + unless ($enddate =~ m/.*$log_date_pattern$/); + +$skip_time_steps = 0.128 if ($skip_time_steps == 0); + +sub min +{ + my ($result, @rest) = @_; + map { $result = $_ if ($_ < $result) } @rest; + return($result); +} + +sub max +{ + my ($result, @rest) = @_; + map { $result = $_ if ($_ > $result) } @rest; + return($result); +} + +# calculate mean, range, and standard deviation for offset and frequency +sub do_loop +{ + my ($directory, $fname, $out_file) = @_; + print "$directory/$fname\n"; + open INPUT, "$directory/$fname" or warn "can't open $directory/$fname: $!"; + open OUTPUT, ">>$out_file" or die "can't open $out_file: $!"; + print OUTPUT "$fname\n"; + my ($loop_tmax, $loop_fmax) = (-1e9, -1e9); + my ($loop_tmin, $loop_fmin) = (1e9, 1e9); + my ($loop_time_rms, $loop_freq_rms) = (0, 0); + my $loop_count = 0; + my $loop_time = 0; + my $loop_freq = 0; + my ($freq, $offs); + my @Fld; + while (<INPUT>) { + chop; # strip record separator + @Fld = split; + next if ($#Fld < 4); +#NTPv3: 50529 74356.259 -0.000112 16.1230 8 +#NTPv3: day, sec.msec, offset, drift_comp, sys_poll +#NTPv4: 51333 54734.582 0.000001648 16.981964 0.000001094 0.020938 6 +#NTPv4: day, sec.msec, offset, drift_comp, sys_error, clock_stabil, sys_poll + if ($Fld[2] > $skip_time_steps || $Fld[2] < -$skip_time_steps) { + warn "ignoring loop offset $Fld[2] (file $fname, line $.)\n"; + next + } + $loop_count++; + ($offs, $freq) = ($Fld[2], $Fld[3]); + $loop_tmax = max($loop_tmax, $offs); + $loop_tmin = min($loop_tmin, $offs); + $loop_fmax = max($loop_fmax, $freq); + $loop_fmin = min($loop_fmin, $freq); + $loop_time += $offs; + $loop_time_rms += $offs * $offs; + $loop_freq += $freq; + $loop_freq_rms += $freq * $freq; + } + close INPUT; + if ($loop_count > 1) { + $loop_time /= $loop_count; + $loop_time_rms = $loop_time_rms / $loop_count - $loop_time * $loop_time; + if ($loop_time_rms < 0) { + warn "loop_time_rms: $loop_time_rms < 0"; + $loop_time_rms = 0; + } + $loop_time_rms = sqrt($loop_time_rms); + $loop_freq /= $loop_count; + $loop_freq_rms = $loop_freq_rms / $loop_count - $loop_freq * $loop_freq; + if ($loop_freq_rms < 0) { + warn "loop_freq_rms: $loop_freq_rms < 0"; + $loop_freq_rms = 0; + } + $loop_freq_rms = sqrt($loop_freq_rms); + printf OUTPUT + ("loop %d, %.0f+/-%.1f, rms %.1f, freq %.2f+/-%0.3f, var %.3f\n", + $loop_count, ($loop_tmax + $loop_tmin) / 2 * 1e6, + ($loop_tmax - $loop_tmin) / 2 * 1e6, $loop_time_rms * 1e6, + ($loop_fmax + $loop_fmin) / 2, ($loop_fmax - $loop_fmin) / 2, + $loop_freq_rms); + } + else { + warn "no valid lines in $directory/$fname"; + } + close OUTPUT +} + +# calculate mean, standard deviation, maximum offset, mean dispersion, +# and maximum distance for each peer +sub do_peer +{ + my ($directory, $fname, $out_file) = @_; + print "$directory/$fname\n"; + open INPUT, "$directory/$fname" or warn "can't open $directory/$fname: $!"; + open OUTPUT, ">>$out_file" or die "can't open $out_file: $!"; + print OUTPUT "$fname\n"; +# we toss out all distances greater than one second on the assumption the +# peer is in initial acquisition + my ($n, $MAXDISTANCE) = (0, 1.0); + my %peer_time; + my %peer_time_rms; + my %peer_count; + my %peer_delay; + my %peer_disp; + my %peer_dist; + my %peer_ident; + my %peer_tmin; + my %peer_tmax; + my @Fld; + my ($i, $j); + my ($dist, $offs); + while (<INPUT>) { + chop; # strip record separator + @Fld = split; + next if ($#Fld < 6); +#NTPv3: 50529 83316.249 127.127.8.1 9674 0.008628 0.00000 0.00700 +#NTPv3: day, sec.msec, addr, status, offset, delay, dispersion +#NTPv4: 51333 56042.037 127.127.8.1 94f5 -0.000014657 0.000000000 0.000000000 0.000013214 +#NTPv4: day, sec.msec, addr, status, offset, delay, dispersion, skew + + $dist = $Fld[6] + $Fld[5] / 2; + next if ($dist > $MAXDISTANCE); + $offs = $Fld[4]; + if ($offs > $skip_time_steps || $offs < -$skip_time_steps) { + warn "ignoring peer offset $offs (file $fname, line $.)\n"; + next + } + $i = $n; + for ($j = 0; $j < $n; $j++) { + if ($Fld[2] eq $peer_ident{$j}) { + $i = $j; # peer found + last; + } + } + if ($i == $n) { # add new peer + $peer_ident{$i} = $Fld[2]; + $peer_tmax{$i} = $peer_dist{$i} = -1e9; + $peer_tmin{$i} = 1e9; + $peer_time{$i} = $peer_time_rms{$i} = 0; + $peer_delay{$i} = $peer_disp{$i} = 0; + $peer_count{$i} = 0; + $n++; + } + $peer_count{$i}++; + $peer_tmax{$i} = max($peer_tmax{$i}, $offs); + $peer_tmin{$i} = min($peer_tmin{$i}, $offs); + $peer_dist{$i} = max($peer_dist{$i}, $dist); + $peer_time{$i} += $offs; + $peer_time_rms{$i} += $offs * $offs; + $peer_delay{$i} += $Fld[5]; + $peer_disp{$i} += $Fld[6]; + } + close INPUT; + print OUTPUT +" ident cnt mean rms max delay dist disp\n"; + print OUTPUT +"==========================================================================\n"; + my @lines = (); + for ($i = 0; $i < $n; $i++) { + next if $peer_count{$i} < 2; + $peer_time{$i} /= $peer_count{$i}; + eval { $peer_time_rms{$i} = sqrt($peer_time_rms{$i} / $peer_count{$i} - + $peer_time{$i} * $peer_time{$i}); }; + $peer_time_rms{$i} = 0, warn $@ if $@; + $peer_delay{$i} /= $peer_count{$i}; + $peer_disp{$i} /= $peer_count{$i}; + $peer_tmax{$i} = $peer_tmax{$i} - $peer_time{$i}; + $peer_tmin{$i} = $peer_time{$i} - $peer_tmin{$i}; + if ($peer_tmin{$i} > $peer_tmax{$i}) { # can this happen at all? + $peer_tmax{$i} = $peer_tmin{$i}; + } + push @lines, sprintf + "%-15s %4d %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", + $peer_ident{$i}, $peer_count{$i}, $peer_time{$i} * 1e3, + $peer_time_rms{$i} * 1e3, $peer_tmax{$i} * 1e3, + $peer_delay{$i} * 1e3, $peer_dist{$i} * 1e3, $peer_disp{$i} * 1e3; + } + print OUTPUT sort @lines; + close OUTPUT; +} + +sub do_clock +{ + my ($directory, $fname, $out_file) = @_; + print "$directory/$fname\n"; + open INPUT, "$directory/$fname"; + open OUTPUT, ">>$out_file" or die "can't open $out_file: $!"; + print OUTPUT "$fname\n"; + close INPUT; + close OUTPUT; +} + +sub peer_summary +{ + my $in_file = shift; + my ($i, $j, $n); + my (%peer_ident, %peer_count, %peer_mean, %peer_var, %peer_max); + my (%peer_1, %peer_2, %peer_3, %peer_4); + my $dist; + my $max; + open INPUT, "<$in_file" or die "can't open $in_file: $!"; + my @Fld; + $n = 0; + while (<INPUT>) { + chop; # strip record separator + @Fld = split; + next if ($#Fld < 7 || $Fld[0] eq 'ident'); + $i = $n; + for ($j = 0; $j < $n; $j++) { + if ($Fld[0] eq $peer_ident{$j}) { + $i = $j; + last; # peer found + } + } + if ($i == $n) { # add new peer + $peer_count{$i} = $peer_mean{$i} = $peer_var{$i} = 0; + $peer_max{$i} = 0; + $peer_1{$i} = $peer_2{$i} = $peer_3{$i} = $peer_4{$i} = 0; + $peer_ident{$i} = $Fld[0]; + ++$n; + } + $dist = $Fld[6] - $Fld[5] / 2; + if ($dist < $peer_dist_limit) { + $peer_count{$i}++; + $peer_mean{$i} += $Fld[2]; + $peer_var{$i} += $Fld[3] * $Fld[3]; + $max = $Fld[4]; + $peer_max{$i} = max($peer_max{$i}, $max); + if ($max > 1) { + $peer_1{$i}++; + if ($max > 5) { + $peer_2{$i}++; + if ($max > 10) { + $peer_3{$i}++; + if ($max > 50) { + $peer_4{$i}++; + } + } + } + } + } + else { + warn "dist exceeds limit: $dist (file $in_file, line $.)\n"; + } + } + close INPUT; + my @lines = (); + print + " host days mean rms max >1 >5 >10 >50\n"; + print + "==================================================================\n"; + for ($i = 0; $i < $n; $i++) { + next if ($peer_count{$i} < 2); + $peer_mean{$i} /= $peer_count{$i}; + eval { $peer_var{$i} = sqrt($peer_var{$i} / $peer_count{$i} - + $peer_mean{$i} * $peer_mean{$i}); }; + $peer_var{$i} = 0, warn $@ if $@; + push @lines, sprintf + "%-15s %3d %9.3f% 9.3f %9.3f %3d %3d %3d %3d\n", + $peer_ident{$i}, $peer_count{$i}, $peer_mean{$i}, $peer_var{$i}, + $peer_max{$i}, $peer_1{$i}, $peer_2{$i}, $peer_3{$i}, $peer_4{$i}; + } + print sort @lines; +} + +my $loop_summary="$outputdir/loop_summary"; +my $peer_summary="$outputdir/peer_summary"; +my $clock_summary="$outputdir/clock_summary"; +my (@loopfiles, @peerfiles, @clockfiles); + +print STDERR "Creating summaries from $statsdir ($startdate to $enddate)\n"; + +opendir SDIR, $statsdir or die "directory ${statsdir}: $!"; +rewinddir SDIR; +@loopfiles=sort grep /loop.*$log_date_pattern/, readdir SDIR; +rewinddir SDIR; +@peerfiles=sort grep /peer.*$log_date_pattern/, readdir SDIR; +rewinddir SDIR; +@clockfiles=sort grep /clock.*$log_date_pattern/, readdir SDIR; +closedir SDIR; + +# remove old summary files +map { unlink $_ if -f $_ } ($loop_summary, $peer_summary, $clock_summary); + +my $date; +map { + $date = $_; $date =~ s/.*($log_date_pattern)$/$1/; + if ($date ge $startdate && $date le $enddate) { + do_loop $statsdir, $_, $loop_summary; + } +} @loopfiles; + +map { + $date = $_; $date =~ s/.*($log_date_pattern)$/$1/; + if ($date ge $startdate && $date le $enddate) { + do_peer $statsdir, $_, $peer_summary; + } +} @peerfiles; + +map { + $date = $_; $date =~ s/.*($log_date_pattern)$/$1/; + if ($date ge $startdate && $date le $enddate) { + do_clock $statsdir, $_, $clock_summary; + } +} @clockfiles; + +print STDERR "Creating peer summary with limit $peer_dist_limit\n"; +peer_summary $peer_summary if (-f $peer_summary); diff --git a/contrib/ntp/util/Makefile.am b/contrib/ntp/util/Makefile.am index 4d70318..d9a85f3 100644 --- a/contrib/ntp/util/Makefile.am +++ b/contrib/ntp/util/Makefile.am @@ -1,10 +1,13 @@ #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies AUTOMAKE_OPTIONS = ansi2knr -bin_PROGRAMS = @MAKE_TICKADJ@ @MAKE_NTPTIME@ +bin_PROGRAMS = @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ ntp-genkeys EXTRA_PROGRAMS = byteorder hist jitter kern longsize ntptime \ -precision tickadj testrs6000 timetrim sht +precision sht testrs6000 tickadj timetrim -INCLUDES = -I$(top_srcdir)/include +ntp_genkeys_LDADD = ../ntpd/ntp_config$U.o ../libntp/libntp.a $(LIBRSAREF) +ntp_genkeys_DEPENDENCIES = ../ntpd/ntp_config$U.o ../libntp/libntp.a $(LIBRSAREF) + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref # LDADD might need RESLIB and ADJLIB LDADD = ../libntp/libntp.a #EXTRA_DIST = README TAGS diff --git a/contrib/ntp/util/Makefile.in b/contrib/ntp/util/Makefile.in index bf37e56..c10e3a0 100644 --- a/contrib/ntp/util/Makefile.in +++ b/contrib/ntp/util/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,190 +91,192 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies AUTOMAKE_OPTIONS = ansi2knr -bin_PROGRAMS = @MAKE_TICKADJ@ @MAKE_NTPTIME@ +bin_PROGRAMS = @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ ntp-genkeys EXTRA_PROGRAMS = byteorder hist jitter kern longsize ntptime \ -precision tickadj testrs6000 timetrim sht +precision sht testrs6000 tickadj timetrim + +ntp_genkeys_LDADD = ../ntpd/ntp_config$U.o ../libntp/libntp.a $(LIBRSAREF) +ntp_genkeys_DEPENDENCIES = ../ntpd/ntp_config$U.o ../libntp/libntp.a $(LIBRSAREF) -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref # LDADD might need RESLIB and ADJLIB LDADD = ../libntp/libntp.a #EXTRA_DIST = README TAGS EXTRA_DIST = ETAGS_ARGS = Makefile.am +EXEEXT = +OBJEXT = o subdir = util mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +EXTRA_PROGRAMS = byteorder$(EXEEXT) hist$(EXEEXT) jitter$(EXEEXT) \ +kern$(EXEEXT) longsize$(EXEEXT) ntptime$(EXEEXT) precision$(EXEEXT) \ +sht$(EXEEXT) testrs6000$(EXEEXT) tickadj$(EXEEXT) timetrim$(EXEEXT) +bin_PROGRAMS = @MAKE_NTPTIME@ @MAKE_TICKADJ@ @MAKE_TIMETRIM@ \ +ntp-genkeys$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = @ANSI2KNR@ byteorder_SOURCES = byteorder.c -byteorder_OBJECTS = byteorder$U.o +byteorder_OBJECTS = byteorder$U.$(OBJEXT) byteorder_LDADD = $(LDADD) -byteorder_DEPENDENCIES = ../libntp/libntp.a +byteorder_DEPENDENCIES = ../libntp/libntp.a byteorder_LDFLAGS = hist_SOURCES = hist.c -hist_OBJECTS = hist$U.o +hist_OBJECTS = hist$U.$(OBJEXT) hist_LDADD = $(LDADD) -hist_DEPENDENCIES = ../libntp/libntp.a +hist_DEPENDENCIES = ../libntp/libntp.a hist_LDFLAGS = jitter_SOURCES = jitter.c -jitter_OBJECTS = jitter$U.o +jitter_OBJECTS = jitter$U.$(OBJEXT) jitter_LDADD = $(LDADD) -jitter_DEPENDENCIES = ../libntp/libntp.a +jitter_DEPENDENCIES = ../libntp/libntp.a jitter_LDFLAGS = kern_SOURCES = kern.c -kern_OBJECTS = kern$U.o +kern_OBJECTS = kern$U.$(OBJEXT) kern_LDADD = $(LDADD) -kern_DEPENDENCIES = ../libntp/libntp.a +kern_DEPENDENCIES = ../libntp/libntp.a kern_LDFLAGS = longsize_SOURCES = longsize.c -longsize_OBJECTS = longsize$U.o +longsize_OBJECTS = longsize$U.$(OBJEXT) longsize_LDADD = $(LDADD) -longsize_DEPENDENCIES = ../libntp/libntp.a +longsize_DEPENDENCIES = ../libntp/libntp.a longsize_LDFLAGS = +ntp_genkeys_SOURCES = ntp-genkeys.c +ntp_genkeys_OBJECTS = ntp-genkeys$U.$(OBJEXT) +ntp_genkeys_LDFLAGS = ntptime_SOURCES = ntptime.c -ntptime_OBJECTS = ntptime$U.o +ntptime_OBJECTS = ntptime$U.$(OBJEXT) ntptime_LDADD = $(LDADD) -ntptime_DEPENDENCIES = ../libntp/libntp.a +ntptime_DEPENDENCIES = ../libntp/libntp.a ntptime_LDFLAGS = precision_SOURCES = precision.c -precision_OBJECTS = precision$U.o +precision_OBJECTS = precision$U.$(OBJEXT) precision_LDADD = $(LDADD) -precision_DEPENDENCIES = ../libntp/libntp.a +precision_DEPENDENCIES = ../libntp/libntp.a precision_LDFLAGS = sht_SOURCES = sht.c -sht_OBJECTS = sht$U.o +sht_OBJECTS = sht$U.$(OBJEXT) sht_LDADD = $(LDADD) -sht_DEPENDENCIES = ../libntp/libntp.a +sht_DEPENDENCIES = ../libntp/libntp.a sht_LDFLAGS = testrs6000_SOURCES = testrs6000.c -testrs6000_OBJECTS = testrs6000$U.o +testrs6000_OBJECTS = testrs6000$U.$(OBJEXT) testrs6000_LDADD = $(LDADD) -testrs6000_DEPENDENCIES = ../libntp/libntp.a +testrs6000_DEPENDENCIES = ../libntp/libntp.a testrs6000_LDFLAGS = tickadj_SOURCES = tickadj.c -tickadj_OBJECTS = tickadj$U.o +tickadj_OBJECTS = tickadj$U.$(OBJEXT) tickadj_LDADD = $(LDADD) -tickadj_DEPENDENCIES = ../libntp/libntp.a +tickadj_DEPENDENCIES = ../libntp/libntp.a tickadj_LDFLAGS = timetrim_SOURCES = timetrim.c -timetrim_OBJECTS = timetrim$U.o +timetrim_OBJECTS = timetrim$U.$(OBJEXT) timetrim_LDADD = $(LDADD) -timetrim_DEPENDENCIES = ../libntp/libntp.a +timetrim_DEPENDENCIES = ../libntp/libntp.a timetrim_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = byteorder.c hist.c jitter.c kern.c longsize.c ntptime.c \ -precision.c sht.c testrs6000.c tickadj.c timetrim.c -DIST_COMMON = README Makefile.am Makefile.in ansi2knr.1 ansi2knr.c - - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best +DIST_SOURCES = byteorder.c hist.c jitter.c kern.c longsize.c \ +ntp-genkeys.c ntptime.c precision.c sht.c testrs6000.c tickadj.c \ +timetrim.c depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/byteorder$U.Po $(DEPDIR)/hist$U.Po \ -$(DEPDIR)/jitter$U.Po $(DEPDIR)/kern$U.Po $(DEPDIR)/longsize$U.Po \ -$(DEPDIR)/ntptime$U.Po $(DEPDIR)/precision$U.Po $(DEPDIR)/sht$U.Po \ -$(DEPDIR)/testrs6000$U.Po $(DEPDIR)/tickadj$U.Po \ -$(DEPDIR)/timetrim$U.Po -SOURCES = byteorder.c hist.c jitter.c kern.c longsize.c ntptime.c precision.c sht.c testrs6000.c tickadj.c timetrim.c -OBJECTS = byteorder$U.o hist$U.o jitter$U.o kern$U.o longsize$U.o ntptime$U.o precision$U.o sht$U.o testrs6000$U.o tickadj$U.o timetrim$U.o - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu util/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +@AMDEP@DEP_FILES = $(DEPDIR)/byteorder$U.Po $(DEPDIR)/hist$U.Po \ +@AMDEP@ $(DEPDIR)/jitter$U.Po $(DEPDIR)/kern$U.Po \ +@AMDEP@ $(DEPDIR)/longsize$U.Po $(DEPDIR)/ntp-genkeys$U.Po \ +@AMDEP@ $(DEPDIR)/ntptime$U.Po $(DEPDIR)/precision$U.Po \ +@AMDEP@ $(DEPDIR)/sht$U.Po $(DEPDIR)/testrs6000$U.Po \ +@AMDEP@ $(DEPDIR)/tickadj$U.Po $(DEPDIR)/timetrim$U.Po +DIST_COMMON = README Makefile.am Makefile.in ansi2knr.1 ansi2knr.c +SOURCES = byteorder.c hist.c jitter.c kern.c longsize.c ntp-genkeys.c ntptime.c precision.c sht.c testrs6000.c tickadj.c timetrim.c +OBJECTS = byteorder$U.$(OBJEXT) hist$U.$(OBJEXT) jitter$U.$(OBJEXT) kern$U.$(OBJEXT) longsize$U.$(OBJEXT) ntp-genkeys$U.$(OBJEXT) ntptime$U.$(OBJEXT) precision$U.$(OBJEXT) sht$U.$(OBJEXT) testrs6000$U.$(OBJEXT) tickadj$U.$(OBJEXT) timetrim$U.$(OBJEXT) -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +all: all-am -distclean-binPROGRAMS: +.SUFFIXES: +.SUFFIXES: .c .o .obj -maintainer-clean-binPROGRAMS: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu util/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ - echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-compile: - -rm -f *.o core *.core +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -clean-compile: +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: - -mostlyclean-krextra: - clean-krextra: -rm -f ansi2knr - -distclean-krextra: - -maintainer-clean-krextra: -ansi2knr: ansi2knr.o - $(LINK) ansi2knr.o $(LIBS) -ansi2knr.o: $(CONFIG_HEADER) +ansi2knr: ansi2knr.$(OBJEXT) + $(LINK) ansi2knr.$(OBJEXT) $(LIBS) +ansi2knr.$(OBJEXT): $(CONFIG_HEADER) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - byteorder: $(byteorder_OBJECTS) $(byteorder_DEPENDENCIES) @rm -f byteorder $(LINK) $(byteorder_LDFLAGS) $(byteorder_OBJECTS) $(byteorder_LDADD) $(LIBS) @@ -290,6 +297,10 @@ longsize: $(longsize_OBJECTS) $(longsize_DEPENDENCIES) @rm -f longsize $(LINK) $(longsize_LDFLAGS) $(longsize_OBJECTS) $(longsize_LDADD) $(LIBS) +ntp-genkeys: $(ntp_genkeys_OBJECTS) $(ntp_genkeys_DEPENDENCIES) + @rm -f ntp-genkeys + $(LINK) $(ntp_genkeys_LDFLAGS) $(ntp_genkeys_OBJECTS) $(ntp_genkeys_LDADD) $(LIBS) + ntptime: $(ntptime_OBJECTS) $(ntptime_DEPENDENCIES) @rm -f ntptime $(LINK) $(ntptime_LDFLAGS) $(ntptime_OBJECTS) $(ntptime_LDADD) $(LIBS) @@ -323,6 +334,8 @@ kern_.c: kern.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kern.c; then echo $(srcdir)/kern.c; else echo kern.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > kern_.c longsize_.c: longsize.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/longsize.c; then echo $(srcdir)/longsize.c; else echo longsize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > longsize_.c +ntp-genkeys_.c: ntp-genkeys.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntp-genkeys.c; then echo $(srcdir)/ntp-genkeys.c; else echo ntp-genkeys.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntp-genkeys_.c ntptime_.c: ntptime.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptime.c; then echo $(srcdir)/ntptime.c; else echo ntptime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptime_.c precision_.c: precision.c $(ANSI2KNR) @@ -335,8 +348,10 @@ tickadj_.c: tickadj.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tickadj.c; then echo $(srcdir)/tickadj.c; else echo tickadj.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tickadj_.c timetrim_.c: timetrim.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/timetrim.c; then echo $(srcdir)/timetrim.c; else echo timetrim.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > timetrim_.c -byteorder_.o hist_.o jitter_.o kern_.o longsize_.o ntptime_.o \ -precision_.o sht_.o testrs6000_.o tickadj_.o timetrim_.o : $(ANSI2KNR) +byteorder_.$(OBJEXT) hist_.$(OBJEXT) jitter_.$(OBJEXT) kern_.$(OBJEXT) \ +longsize_.$(OBJEXT) ntp-genkeys_.$(OBJEXT) ntptime_.$(OBJEXT) \ +precision_.$(OBJEXT) sht_.$(OBJEXT) testrs6000_.$(OBJEXT) \ +tickadj_.$(OBJEXT) timetrim_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -347,9 +362,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -362,84 +377,82 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/byteorder$U.Po -@AMDEP@include $(DEPDIR)/hist$U.Po -@AMDEP@include $(DEPDIR)/jitter$U.Po -@AMDEP@include $(DEPDIR)/kern$U.Po -@AMDEP@include $(DEPDIR)/longsize$U.Po -@AMDEP@include $(DEPDIR)/ntptime$U.Po -@AMDEP@include $(DEPDIR)/precision$U.Po -@AMDEP@include $(DEPDIR)/sht$U.Po -@AMDEP@include $(DEPDIR)/testrs6000$U.Po -@AMDEP@include $(DEPDIR)/tickadj$U.Po -@AMDEP@include $(DEPDIR)/timetrim$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/byteorder$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/hist$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/jitter$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/kern$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/longsize$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntp-genkeys$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ntptime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/precision$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/sht$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/testrs6000$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tickadj$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/timetrim$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(ANSI2KNR) $(PROGRAMS) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(ANSI2KNR) $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -450,47 +463,56 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-krextra mostlyclean-kr mostlyclean-tags \ - mostlyclean-depend mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-krextra mostlyclean-am -clean-am: clean-binPROGRAMS clean-compile clean-krextra clean-kr \ - clean-tags clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-binPROGRAMS distclean-compile distclean-krextra \ - distclean-kr distclean-tags distclean-depend \ - distclean-generic clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-krextra \ - maintainer-clean-kr maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-krextra distclean-krextra \ -clean-krextra maintainer-clean-krextra mostlyclean-kr distclean-kr \ -clean-kr maintainer-clean-kr tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir mostlyclean-depend \ -distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all install-strip \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +uninstall-am: uninstall-binPROGRAMS + +.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ + clean-krextra distclean distclean-compile distclean-depend \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-kr tags uninstall uninstall-am \ + uninstall-binPROGRAMS ../libntp/libntp.a: diff --git a/contrib/ntp/util/hist.c b/contrib/ntp/util/hist.c index ee4e93a..b02d73f 100644 --- a/contrib/ntp/util/hist.c +++ b/contrib/ntp/util/hist.c @@ -8,14 +8,14 @@ */ #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#include <sys/time.h> -#include <stdio.h> -#include <stdlib.h> #include "ntp_types.h" +#include <stdio.h> +#include <stdlib.h> + #define NBUF 100001 /* size of basic histogram */ #define NSRT 20000 /* size of overflow histogram */ #define NCNT (600 * 1000000) /* sample interval (us) */ @@ -79,7 +79,7 @@ main( } if (n == 0) return; - qsort((char *)ovfl, (int)n, sizeof(long), col); + qsort((char *)ovfl, (size_t)n, sizeof(long), col); w = 0; j = 0; for (i = 0; i < n; i++) { diff --git a/contrib/ntp/util/jitter.c b/contrib/ntp/util/jitter.c index 79f4757..462fe12 100644 --- a/contrib/ntp/util/jitter.c +++ b/contrib/ntp/util/jitter.c @@ -6,8 +6,9 @@ * analysis. From this you can determine the jitter and if the clock ever * runs backwards. */ -#include <sys/time.h> + #include <stdio.h> +#include <sys/time.h> #define NBUF 20002 diff --git a/contrib/ntp/util/kern.c b/contrib/ntp/util/kern.c index 37d9257..b193d6f 100644 --- a/contrib/ntp/util/kern.c +++ b/contrib/ntp/util/kern.c @@ -3,6 +3,7 @@ * actual code segments from modified kernel distributions for SunOS, * Ultrix and OSF/1 kernels. These segments do not use any licensed code. */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/contrib/ntp/util/ntp-genkeys.c b/contrib/ntp/util/ntp-genkeys.c new file mode 100644 index 0000000..fd85121 --- /dev/null +++ b/contrib/ntp/util/ntp-genkeys.c @@ -0,0 +1,1042 @@ +/* + * Program to generate MD5 and RSA keys for NTP clients and servers + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef HAVE_NETINFO +#include <netinfo/ni.h> +#endif + +#include "ntpd.h" +#include "ntp_stdlib.h" +#include "ntp_string.h" +#include "ntp_filegen.h" +#include "ntp_unixtime.h" +#include "ntp_config.h" +#include "ntp_cmdargs.h" + +#include <stdio.h> +#include <unistd.h> +#include <limits.h> /* PATH_MAX */ +#include <sys/stat.h> + +#ifdef PUBKEY +# include "ntp_crypto.h" +#endif + +#ifndef PATH_MAX +# ifdef _POSIX_PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +# else +# define PATH_MAX 255 +# endif +#endif + +/* + * Cryptodefines + */ +#define MAXKEYLEN 1024 /* maximum encoded key length */ +#define MODULUSLEN 512 /* length of RSA modulus */ +#define PRIMELEN 512 /* length of D_H prime, generator */ + +/* + * This program generates (up to) four files: + * + * ntp.keys containing the DES/MD5 private keys, + * ntpkey containing the RSA private key, + * ntpkey_HOST containing the RSA public key + * where HOST is the DNS name of the generating machine, + * ntpkey_dh containing the parameters for the Diffie-Hellman + * key-agreement algorithm. + * + * The files contain cryptographic values generated by the algorithms of + * the rsaref20 package and are in printable ASCII format. Since the + * algorythms are seeded by the system clock, each run of this program + * will produce a different outcome. There are no options or frills of + * any sort, although a number of options would seem to be appropriate. + * Waving this program in the breeze will no doubt bring a cast of + * thousands to wiggle the options this way and that for various useful + * purposes. + * + * The names of all files begin with "ntp" and end with an extension + * consisting of the seconds value of the current NTP timestamp, which + * appears in the form ".*". This provides a way to distinguish between + * key generations, since the host name and timestamp can be fetched by + * a client during operation. + * + * The ntp.keys.* file contains 16 MD5 keys. Each key consists of 16 + * characters randomized over the ASCII 95-character printing subset. + * The file is read by the daemon at the location specified by the keys + * configuration file command and made visible only to root. An + * additional key consisting of a easily remembered password should be + * added by hand for use with the ntpdc program. The file must be + * distributed by secure means to other servers and clients sharing the + * same security compartment. + * + * The key identifiers for MD5 and DES keys must be less than 65536, + * although this program uses only the identifiers from 1 to 16. The key + * identifier for each association is specified as the key argument in + * the server or peer configuration file command. + * + * The ntpkey.* file contains the RSA private key. It is read by the + * daemon at the location specified by the private argument of the + * crypto configuration file command and made visible only to root. + * This file is useful only to the machine that generated it and never + * shared with any other daemon or application program. + * + * The ntpkey_host.* file contains the RSA public key, where host is the + * DNS name of the host that generated it. The file is read by the + * daemon at the location specified by the public argument to the server + * or peer configuration file command. This file can be widely + * distributed and stored without using secure means, since the data are + * public values. + * + * The ntp_dh.* file contains two Diffie-Hellman parameters, the prime + * modulus and the generator. The file is read by the daemon at the + * location specified by the dhparams argument of the crypto + * configuration file command. This file can be widely distributed and + * stored without using secure means, since the data are public values. + * + * The file formats all begin with two lines. The first line contains + * the file name and decimal timestamp, while the second contains the + * readable datestamp. Lines beginning with # are considered comments + * and ignored by the daemon. In the ntp.keys.* file, the next 16 lines + * contain the MD5 keys in order. In the ntpkey.* and ntpkey_host.* + * files, the next line contains the modulus length in bits followed by + * the key as a PEM encoded string. In the ntpkey_dh.* file, the next + * line contains the prime length in bytes followed by the prime as a + * PEM encoded string, and the next and final line contains the + * generator length in bytes followed by the generator as a PEM encoded + * string. + * + * Note: See the file ./source/rsaref.h in the rsaref20 package for + * explanation of return values, if necessary. + */ + + +extern char *config_file; + +#ifdef HAVE_NETINFO +extern struct netinfo_config_state *config_netinfo; +extern int check_netinfo; +#endif /* HAVE_NETINFO */ + +#ifdef SYS_WINNT +char *alt_config_file; +LPTSTR temp; +char config_file_storage[PATH_MAX]; +char alt_config_file_storage[PATH_MAX]; +#endif /* SYS_WINNT */ + +int make_dh = 0; /* Make D-H parameter file? */ +int make_md5 = 0; /* Make MD5 keyfile? */ +int make_rsa = 0; /* Make RSA pair? */ +int force = 0; /* Force the installation? */ +int here = 0; /* Put the files here (curdir)? */ +int nosymlinks = 0; /* Just create the (timestamped) files? */ +int memorex = 0; /* Are we live? */ +int trash = 0; /* Trash old files? */ +int errflag = 0; + +char *f1_keysdir = NTP_KEYSDIR; + +char *f1_keys; /* Visible MD5 key file name */ +char *f2_keys; /* timestamped */ +char *f3_keys; /* previous filename */ + +char *f1_publickey; +char *f2_publickey; +char *f3_publickey; + +char *f1_privatekey; +char *f2_privatekey; +char *f3_privatekey; + +char *f1_dhparms; +char *f2_dhparms; +char *f3_dhparms; + + +/* Stubs and hacks so we can link with ntp_config.o */ +u_long sys_automax; /* maximum session key lifetime */ +int sys_bclient; /* we set our time to broadcasts */ +int sys_manycastserver; /* 1 => respond to manycast client pkts */ +u_long client_limit_period; +char * req_file; /* name of the file with configuration info */ +keyid_t ctl_auth_keyid; /* keyid used for authenticating write requests */ +struct interface *any_interface; /* default interface */ +keyid_t info_auth_keyid; /* keyid used to authenticate requests */ +u_long current_time; /* current time (s) */ +const char *Version = ""; /* version declaration */ +keyid_t req_keyid; /* request keyid */ +u_long client_limit; +u_long client_limit_period; +l_fp sys_revoketime; +u_long sys_revoke; /* keys revoke timeout */ +volatile int debug = 0; /* debugging flag */ +u_char sys_minpoll; /* min poll interval (log2 s) */ + +void snifflink P((const char *, char **)); +int filep P((const char *)); +FILE *newfile P((const char *, const char *, mode_t, const char *)); +void cleanlinks P((const char *, const char *, const char *)); + +struct peer * +peer_config( + struct sockaddr_in *srcadr, + struct interface *dstadr, + int hmode, + int version, + int minpoll, + int maxpoll, + u_int flags, + int ttl, + keyid_t key, + u_char *keystr + ) +{ + if (debug > 1) printf("peer_config...\n"); + return 0; +} + + +void +set_sys_var( + char *data, + u_long size, + int def + ) +{ + if (debug > 1) printf("set_sys_var...\n"); + return; +} + + +void +ntp_intres (void) +{ + if (debug > 1) printf("ntp_intres...\n"); + return; +} + + +int +ctlsettrap( + struct sockaddr_in *raddr, + struct interface *linter, + int traptype, + int version + ) +{ + if (debug > 1) printf("ctlsettrap...\n"); + return 0; +} + + +#ifdef PUBKEY +void +crypto_config( + int item, /* configuration item */ + char *cp /* file name */ + ) +{ + switch (item) { + case CRYPTO_CONF_DH: + if (debug > 0) printf("crypto_config: DH/<%d> <%s>\n", item, cp); + f1_dhparms = strdup(cp); + break; + case CRYPTO_CONF_PRIV: + if (debug > 0) printf("crypto_config: PRIVATEKEY/<%d> <%s>\n", item, cp); + f1_privatekey = strdup(cp); + break; + case CRYPTO_CONF_PUBL: + if (debug > 0) printf("crypto_config: PUBLICKEY/<%d> <%s>\n", item, cp); + f1_publickey = strdup(cp); + break; + default: + if (debug > 1) printf("crypto_config: <%d> <%s>\n", item, cp); + break; + } + return; +} +#endif + + +struct interface * +findinterface( + struct sockaddr_in *addr + ) +{ + if (debug > 1) printf("findinterface...\n"); + return 0; +} + + +void +refclock_control( + struct sockaddr_in *srcadr, + struct refclockstat *in, + struct refclockstat *out + ) +{ + if (debug > 1) printf("refclock_control...\n"); + return; +} + + +void +loop_config( + int item, + double freq + ) +{ + if (debug > 1) printf("loop_config...\n"); + return; +} + + +void +filegen_config( + FILEGEN *gen, + char *basename, + u_int type, + u_int flag + ) +{ + if (debug > 1) printf("filegen_config...\n"); + return; +} + + +void +stats_config( + int item, + char *invalue /* only one type so far */ + ) +{ + if (debug > 1) printf("stats_config...\n"); + return; +} + + +void +hack_restrict( + int op, + struct sockaddr_in *resaddr, + struct sockaddr_in *resmask, + int mflags, + int flags + ) +{ + if (debug > 1) printf("hack_restrict...\n"); + return; +} + + +void +kill_asyncio (void) +{ + if (debug > 1) printf("kill_asyncio...\n"); + return; +} + + +void +proto_config( + int item, + u_long value, + double dvalue + ) +{ + if (debug > 1) printf("proto_config...\n"); + return; +} + +void +getauthkeys( + char *keyfile + ) +{ + if (debug > 0) printf("getauthkeys: got <%s>\n", keyfile); + f1_keys = strdup(keyfile); + return; +} + + +FILEGEN * +filegen_get( + char *name + ) +{ + if (debug > 1) printf("filegen_get...\n"); + return 0; +} + + +/* End of stubs and hacks */ + + +static void +usage( + void + ) +{ + printf("Usage: %s [ -c ntp.conf ] [ -g {d,m,r} ] [ -k key_file ]\n", + progname); + printf(" [ -d ] [ -f ] [ -h ] [ -l ] [ -n ] [ -t ]\n"); + printf(" where:\n"); + printf(" -c /etc/ntp.conf Location of ntp.conf file\n"); + printf(" -d enable debug messages (can be used multiple times)\n"); + printf(" -f force installation of generated keys.\n"); + printf(" -g d Generate D-H parameter file\n"); + printf(" -g m Generate MD5 key file\n"); + printf(" -g r Generate RSA keys\n"); + printf(" -g dmr (Can be combined)\n"); + printf(" -h Build keys here (current directory). Implies -l\n"); + printf(" -k key_file Location of key file\n"); + printf(" -l Don't make the symlinks\n"); + printf(" -n Don't actually do anything, just say what would be done\n"); + printf(" -t Trash the (old) files at the end of symlink\n"); + + exit(1); +} + + +void +getCmdOpts ( + int argc, + char *argv[] + ) +{ + int i; + + while ((i = ntp_getopt(argc, argv, "c:dfg:hlnt")) != EOF) + switch (i) { + case 'c': + config_file = ntp_optarg; +#ifdef HAVE_NETINFO + check_netinfo = 0; +#endif + break; + case 'd': + ++debug; + break; + case 'f': + ++force; + break; + case 'g': + while (*ntp_optarg) { + switch (*ntp_optarg) { + case 'd': + ++make_dh; + break; + case 'm': + ++make_md5; + break; + case 'r': + ++make_rsa; + break; + default: + ++errflag; + break; + } + ++ntp_optarg; + } + break; + case 'h': + ++here; + ++nosymlinks; + break; + case 'l': + ++nosymlinks; + break; + case 'n': + ++memorex; + break; + case 't': + ++trash; + break; + case '?': + ++errflag; + break; + } + + if (errflag) + usage(); + + /* If no file type was specified, make them all. */ + if (!(make_dh | make_md5 | make_rsa)) { + ++make_dh; + ++make_md5; + ++make_rsa; + } +} + + +void +snifflink( + const char *file, + char **linkdata + ) +{ +#ifdef HAVE_READLINK + char buf[PATH_MAX]; + int rc; + + if (!file) + return; + + rc = readlink(file, buf, sizeof buf); + if (-1 == rc) { + switch (errno) { + case EINVAL: /* Fall thru */ + case ENOENT: + return; + } + fprintf(stderr, "%s: readlink(%s) failed: (%d) %s\n", + progname, file, errno, strerror(errno)); + exit(1); + } + buf[rc] = '\0'; + *linkdata = strdup(buf); + /* XXX: make sure linkdata is not 0... */ +#endif /* not HAVE_READLINK */ + return; +} + + +int +filep( + const char *fn + ) +{ + struct stat sb; + + if (-1 == stat(fn, &sb)) { + if (ENOENT == errno) + return 0; + fprintf(stderr, "stat(%s) failed: %s\n", + fn, strerror(errno)); + exit(1); + } + return 1; +} + + +FILE * +newfile( + const char *f1, /* Visible file */ + const char *f2, /* New timestamped file name */ + mode_t fmask, /* umask for new timestamped file */ + const char *f3 /* Previous symlink target */ + ) +{ + FILE *fp; + char fb[PATH_MAX]; + char *cp; + + if (debug > 1) printf("newfile(%s,%s,%0o,%s)\n", f1, f2, + (unsigned)fmask, f3 ? f3 : "NULL"); + /* + If: + - no symlink support, or + - there is no old symlink (!f3) + - - file = dirname(f1) / f2 + Otherwise: + - If ('/' == *f3) + - - file = dirname(f3) / f2 + - else + - - file = dirname(f1) / dirname(f3) / f2 + fopen(file) + print any error message/bail + return FILE + */ + + if (here) + snprintf(fb, sizeof fb, "%s", f2); + else { + if ( +#ifdef HAVE_READLINK + !f3 +#else + 1 +#endif + ) { + /* file = dirname(f1) / f2 */ + snprintf(fb, sizeof fb, "%s", f1); + cp = strrchr(fb, '/'); + if (cp) { + *cp = 0; + } + snprintf(fb, sizeof fb, "%s/%s", fb, f2); + if (debug > 1) printf("case 1: file is <%s>\n", fb); + } else { + /* + - If ('/' == *f3) + - - file = dirname(f3) / f2 + - else + - - file = dirname(f1) / dirname(f3) / f2 + */ + if ('/' != *f3) { + snprintf(fb, sizeof fb, "%s", f1); + cp = strrchr(fb, '/'); + if (cp) { + ++cp; + *cp = 0; + } + if (debug > 1) + printf("case 2: file is <%s>\n", fb); + } else { + *fb = 0; + } + snprintf(fb, sizeof fb, "%s%s", fb, f3); + cp = strrchr(fb, '/'); + if (cp) { + *cp = 0; + } + snprintf(fb, sizeof fb, "%s/%s", fb, f2); + if (debug > 1) printf("case 3: file is <%s>\n", fb); + } + } + + /* + fopen(file) + print any error message/bail + return FILE + */ + if (memorex) { + printf("Would write file <%s>\n", fb); + fp = NULL; + } else { + mode_t omask; + + omask = umask(fmask); + fp = fopen(fb, "w"); + (void) umask(omask); + if (fp == NULL) { + perror(fb); + exit(1); + } + } + return fp; +} + +void +cleanlinks( + const char *f1, /* Visible file */ + const char *f2, /* New timestamped file name */ + const char *f3 /* Previous symlink target */ + ) +{ +#ifdef HAVE_READLINK + char *cp; + char fb[PATH_MAX]; + + /* + Just return if nosymlinks. + unlink f1 + file = dirname(f3) / f2 + symlink file, f1 + If trash: + - if f3 begins with a /, unlink it + - else, unlink dirname(f1) / f3 + */ +#endif /* HAVE_READLINK */ + + if (nosymlinks) + return; + + if (memorex) + printf("Would unlink(%s)\n", f1); + else if (unlink(f1)) { + if (errno != ENOENT) { + fprintf(stderr, "unlink(%s) failed: %s\n", f1, + strerror(errno)); + return; + } + } + /* file = dirname(f3) / f2 */ + if (f3) { + snprintf(fb, sizeof fb, "%s", f3); + cp = strrchr(fb, '/'); + if (cp) { + ++cp; + *cp = 0; + } else { + *fb = 0; + } + } else { + *fb = 0; + } + snprintf(fb, sizeof fb, "%s%s", fb, f2); + if (debug > 1) printf("cleanlinks 1: file is <%s>\n", fb); + + if (memorex) + printf("Would symlink <%s> -> <%s>\n", f1, fb); + else if (symlink(fb, f1)) { + fprintf(stderr, "symlink(%s,%s) failed: %s\n", fb, f1, + strerror(errno)); + return; + } + + /* + If trash: + - if f3 begins with a /, unlink it + - else, unlink dirname(f1) / f3 + */ + if (trash && f3) { + if ('/' == *f3) { + if (memorex) + printf("Would unlink(%s)\n", f3); + else if (unlink(f3)) { + if (errno != ENOENT) { + fprintf(stderr, "unlink(%s) failed: %s\n", f3, + strerror(errno)); + return; + } + } + } else { + snprintf(fb, sizeof fb, "%s", f1); + cp = strrchr(fb, '/'); + if (cp) { + *cp = 0; + } + snprintf(fb, sizeof fb, "%s/%s", fb, f3); + if (debug > 1) + printf("cleanlinks 2: file is <%s>\n", fb); + if (memorex) + printf("Would unlink(%s)\n", fb); + else if (unlink(fb)) { + if (errno != ENOENT) { + fprintf(stderr, "unlink(%s) failed: %s\n", fb, + strerror(errno)); + return; + } + } + } + } + + return; +} + + +int +main( + int argc, + char *argv[] + ) +{ +#ifdef PUBKEY + R_RSA_PRIVATE_KEY rsaref_private; /* RSA private key */ + R_RSA_PUBLIC_KEY rsaref_public; /* RSA public key */ + R_RSA_PROTO_KEY protokey; /* RSA prototype key */ + R_DH_PARAMS dh_params; /* Diffie-Hellman parameters */ + R_RANDOM_STRUCT randomstr; /* random structure */ + int rval; /* return value */ + u_char encoded_key[MAXKEYLEN]; /* encoded PEM string buffer */ + u_int modulus; /* modulus length */ + u_int len; +#endif /* PUBKEY */ + struct timeval tv; /* initialization vector */ + u_long ntptime; /* NTP timestamp */ + char hostname[256]; /* DNS host name */ + u_char md5key[17]; /* generated MD5 key */ + FILE *str; /* file handle */ + u_int temp; + int i, j; + mode_t std_mask; /* Standard mask */ + mode_t sec_mask = 077; /* Secure mask */ + char pathbuf[PATH_MAX]; + + gethostname(hostname, sizeof(hostname)); + gettimeofday(&tv, 0); + ntptime = tv.tv_sec + JAN_1970; + + /* Initialize config_file */ + getconfig(argc, argv); /* ntpd/ntp_config.c */ + + if (!f1_keysdir) { + /* Shouldn't happen... */ + f1_keysdir = "PATH_KEYSDIR"; + } + if (*f1_keysdir != '/') { + fprintf(stderr, + "%s: keysdir path <%s> doesn't begin with a /\n", + progname, f1_keysdir); + exit(1); + } + + if (!f2_keys) { + snprintf(pathbuf, sizeof pathbuf, "ntp.keys.%lu", + ntptime); + f2_keys = strdup(pathbuf); + } + if (!f1_keys) { + snprintf(pathbuf, sizeof pathbuf, "%s/ntp.keys", + f1_keysdir); + f1_keys = strdup(pathbuf); + } + if (*f1_keys != '/') { + fprintf(stderr, + "%s: keys path <%s> doesn't begin with a /\n", + progname, f1_keys); + exit(1); + } + snifflink(f1_keys, &f3_keys); + + if (!f2_publickey) { + snprintf(pathbuf, sizeof pathbuf, "ntpkey_%s.%lu", + hostname, ntptime); + f2_publickey = strdup(pathbuf); + } + if (!f1_publickey) { + snprintf(pathbuf, sizeof pathbuf, "%s/ntpkey_%s", + f1_keysdir, hostname); + f1_publickey = strdup(pathbuf); + } + if (*f1_publickey != '/') { + fprintf(stderr, + "%s: publickey path <%s> doesn't begin with a /\n", + progname, f1_publickey); + exit(1); + } + snifflink(f1_publickey, &f3_publickey); + + if (!f2_privatekey) { + snprintf(pathbuf, sizeof pathbuf, "ntpkey.%lu", + ntptime); + f2_privatekey = strdup(pathbuf); + } + if (!f1_privatekey) { + snprintf(pathbuf, sizeof pathbuf, "%s/ntpkey", + f1_keysdir); + f1_privatekey = strdup(pathbuf); + } + if (*f1_privatekey != '/') { + fprintf(stderr, + "%s: privatekey path <%s> doesn't begin with a /\n", + progname, f1_privatekey); + exit(1); + } + snifflink(f1_privatekey, &f3_privatekey); + + if (!f2_dhparms) { + snprintf(pathbuf, sizeof pathbuf, "ntpkey_dh.%lu", + ntptime); + f2_dhparms = strdup(pathbuf); + } + if (!f1_dhparms) { + snprintf(pathbuf, sizeof pathbuf, "%s/ntpkey_dh", + f1_keysdir); + f1_dhparms = strdup(pathbuf); + } + if (*f1_dhparms != '/') { + fprintf(stderr, + "%s: dhparms path <%s> doesn't begin with a /\n", + progname, f1_dhparms); + exit(1); + } + snifflink(f1_dhparms, &f3_dhparms); + + if (debug > 1) { + printf("After config:\n"); + printf("keysdir = <%s>\n", f1_keysdir? f1_keysdir: ""); + printf("keys = <%s> -> <%s>\n" + , f1_keys? f1_keys: "" + , f2_keys? f2_keys: "" + ); + printf(" old = <%s>\n", f3_keys? f3_keys: ""); + printf("publickey = <%s> -> <%s>\n" + , f1_publickey? f1_publickey: "" + , f2_publickey? f2_publickey: "" + ); + printf(" old = <%s>\n", f3_publickey? f3_publickey: ""); + printf("privatekey = <%s> -> <%s>\n" + , f1_privatekey? f1_privatekey: "" + , f2_privatekey? f2_privatekey: "" + ); + printf(" old = <%s>\n", f3_privatekey? f3_privatekey: ""); + printf("dhparms = <%s> -> <%s>\n" + , f1_dhparms? f1_dhparms: "" + , f2_dhparms? f2_dhparms: "" + ); + printf(" old = <%s>\n", f3_dhparms? f3_dhparms: ""); + } + + /* + for each file we're going to install: + - make the new timestamped file + - if (!nosymlinks) + - - remove any old link + - - make the link + - - if (trash) + - - - remove the old file + */ + + std_mask = umask(sec_mask); /* Get the standard mask */ + (void) umask(std_mask); + + if (make_md5 && (force || !filep(f1_keys))) { + /* + * Generate 16 random MD5 keys. + */ + printf("Generating MD5 key file...\n"); + str = newfile(f1_keys, f2_keys, sec_mask, f3_keys); + if (!memorex) { + srandom((u_int)tv.tv_usec); + fprintf(str, "# MD5 key file %s\n# %s", f2_keys, + ctime((const time_t *) &tv.tv_sec)); + for (i = 1; i <= 16; i++) { + for (j = 0; j < 16; j++) { + while (1) { + temp = random() & 0xff; + /* + ** Harlan says Karnaugh maps + ** are not his friend, and + ** compilers can optimize + ** this most easily. + */ + if (temp == '#') + continue; + if (temp > 0x20 && temp < 0x7f) + break; + } + md5key[j] = (u_char)temp; + } + md5key[16] = 0; + fprintf(str, "%2d M %16s # MD5 key\n", + i, md5key); + } + } + if (str) fclose(str); + cleanlinks(f1_keys, f2_keys, f3_keys); + } + +#ifdef PUBKEY + if (make_rsa && (force || !filep(f1_publickey) + || !filep(f1_privatekey))) { + /* + * Roll the RSA public/private key pair. + */ + printf("Generating RSA public/private key pair (%d bits)...\n", + MODULUSLEN); + if (!memorex) { + protokey.bits = MODULUSLEN; + protokey.useFermat4 = 1; + R_RandomInit(&randomstr); + R_GetRandomBytesNeeded(&len, &randomstr); + for (i = 0; i < len; i++) { + temp = random(); + R_RandomUpdate(&randomstr, (u_char *)&temp, 1); + } + rval = R_GeneratePEMKeys(&rsaref_public, + &rsaref_private, &protokey, + &randomstr); + if (rval) { + printf("R_GeneratePEMKeys error %x\n", rval); + return (-1); + } + } + + /* + * Generate the file "ntpkey.*" containing the RSA + * private key in printable ASCII format. + */ + str = newfile(f1_privatekey, f2_privatekey, sec_mask, + f3_privatekey); + if (!memorex) { + len = sizeof(rsaref_private) + - sizeof(rsaref_private.bits); + modulus = (u_int32)rsaref_private.bits; + fprintf(str, "# RSA private key file %s\n# %s", + f2_privatekey, ctime(&tv.tv_sec)); + R_EncodePEMBlock(encoded_key, &temp, + (u_char *)rsaref_private.modulus, + len); + encoded_key[temp] = '\0'; + fprintf(str, "%d %s\n", modulus, encoded_key); + } + if (str) fclose(str); + cleanlinks(f1_privatekey, f2_privatekey, f3_privatekey); + + /* + * Generate the file "ntpkey_host.*" containing the RSA + * public key in printable ASCII format. + */ + str = newfile(f1_publickey, f2_publickey, std_mask, + f3_publickey); + if (!memorex) { + len = sizeof(rsaref_public) + - sizeof(rsaref_public.bits); + modulus = (u_int32)rsaref_public.bits; + fprintf(str, "# RSA public key file %s\n# %s", + f2_publickey, ctime(&tv.tv_sec)); + R_EncodePEMBlock(encoded_key, &temp, + (u_char *)rsaref_public.modulus, len); + encoded_key[temp] = '\0'; + fprintf(str, "%d %s\n", modulus, encoded_key); + } + if (str) fclose(str); + cleanlinks(f1_publickey, f2_publickey, f3_publickey); + } +#endif /* PUBKEY */ + +#ifdef PUBKEY + if (make_dh && (force || !filep(f1_dhparms))) { + /* + * Roll the prime and generator for the Diffie-Hellman key + * agreement algorithm. + */ + printf("Generating Diffie-Hellman parameters (%d bits)...\n", + PRIMELEN); + str = newfile(f1_dhparms, f2_dhparms, std_mask, f3_dhparms); + + if (!memorex) { + R_RandomInit(&randomstr); + R_GetRandomBytesNeeded(&len, &randomstr); + for (i = 0; i < len; i++) { + temp = random(); + R_RandomUpdate(&randomstr, (u_char *)&temp, 1); + } + + /* + * Generate the file "ntpkey_dh.*" containing the + * Diffie-Hellman prime and generator in printable + * ASCII format. + */ + len = DH_PRIME_LEN(PRIMELEN); + dh_params.prime = (u_char *)malloc(len); + dh_params.generator = (u_char *)malloc(len); + rval = R_GenerateDHParams(&dh_params, PRIMELEN, + PRIMELEN / 2, &randomstr); + if (rval) { + printf("R_GenerateDHParams error %x\n", rval); + return (-1); + } + + fprintf(str, + "# Diffie-Hellman parameter file %s\n# %s", + f2_dhparms, ctime(&tv.tv_sec)); + R_EncodePEMBlock(encoded_key, &temp, + (u_char *)dh_params.prime, + dh_params.primeLen); + encoded_key[temp] = '\0'; + fprintf(str, "%d %s\n", dh_params.primeLen, + encoded_key); + R_EncodePEMBlock(encoded_key, &temp, + (u_char *)dh_params.generator, + dh_params.generatorLen); + encoded_key[temp] = '\0'; + fprintf(str, "%d %s\n", dh_params.generatorLen, + encoded_key); + } + if (str) fclose(str); + cleanlinks(f1_dhparms, f2_dhparms, f3_dhparms); + } +#endif /* PUBKEY */ + + return (0); +} diff --git a/contrib/ntp/util/ntptime.c b/contrib/ntp/util/ntptime.c index 1a6f2f3..81bd2be 100644 --- a/contrib/ntp/util/ntptime.c +++ b/contrib/ntp/util/ntptime.c @@ -9,28 +9,28 @@ * For more information, see the README.kern file in the doc directory * of the xntp3 distribution. */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif /* HAVE_CONFIG_H */ -#include <stdio.h> -#include <ctype.h> -#include <sys/time.h> -#include <signal.h> -#include <setjmp.h> - #include "ntp_fp.h" #include "ntp_unixtime.h" #include "ntp_syscall.h" #include "ntp_stdlib.h" +#include <stdio.h> +#include <ctype.h> +#include <signal.h> +#include <setjmp.h> + #ifdef NTP_SYSCALLS_STD # ifndef SYS_DECOSF1 # define BADCALL -1 /* this is supposed to be a bad syscall */ # endif /* SYS_DECOSF1 */ #endif -#ifdef HAVE_TV_NSEC_IN_NTPTIMEVAL +#ifdef HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC #define tv_frac_sec tv_nsec #else #define tv_frac_sec tv_usec @@ -68,7 +68,7 @@ static volatile int pll_control; /* (0) daemon, (1) kernel loop */ static volatile int status; /* most recent status bits */ static volatile int flash; /* most recent ntp_adjtime() bits */ char* progname; -static char optargs[] = "cde:f:hm:o:rs:t:"; +static char optargs[] = "MNT:cde:f:hm:o:rs:t:"; int main( @@ -100,6 +100,24 @@ main( memset((char *)&ntx, 0, sizeof(ntx)); progname = argv[0]; while ((c = ntp_getopt(argc, argv, optargs)) != EOF) switch (c) { +#ifdef MOD_MICRO + case 'M': + ntx.modes |= MOD_MICRO; + break; +#endif +#ifdef MOD_NANO + case 'N': + ntx.modes |= MOD_NANO; + break; +#endif +#ifdef NTP_API +# if NTP_API > 3 + case 'T': + ntx.modes = MOD_TAI; + ntx.constant = atoi(ntp_optarg); + break; +# endif +#endif case 'c': cost++; break; @@ -128,7 +146,7 @@ main( case 's': ntx.modes |= MOD_STATUS; ntx.status = atoi(ntp_optarg); - if (ntx.status < 0 || ntx.status > 4) errflg++; + if (ntx.status < 0 || ntx.status >= 0x100) errflg++; break; case 't': ntx.modes |= MOD_TIMECONST; @@ -140,6 +158,7 @@ main( if (errflg || (ntp_optind != argc)) { (void) fprintf(stderr, "usage: %s [-%s]\n\n\ +%s%s%s\ -c display the time taken to call ntp_gettime (us)\n\ -e esterror estimate of the error (us)\n\ -f frequency Frequency error (-500 .. 500) (ppm)\n\ @@ -149,7 +168,27 @@ main( -r print the unix and NTP time raw\n\ -l leap Set the leap bits\n\ -t timeconstant log2 of PLL time constant (0 .. %d)\n", - progname, optargs, MAXTC); + progname, optargs, +#ifdef MOD_MICRO +"-M switch to microsecond mode\n", +#else +"", +#endif +#ifdef MOD_NANO +"-N switch to nanosecond mode\n", +#else +"", +#endif +#ifdef NTP_API +# if NTP_API > 3 +"-T tai_offset set TAI offset\n", +# else +"", +# endif +#else +"", +#endif + MAXTC); exit(2); } @@ -258,12 +297,18 @@ main( ts.l_uf &= ts_mask; printf(" time %s, (.%0*d),\n", prettydate(&ts), fdigits, (int) time_frac); - printf(" maximum error %lu us, estimated error %lu us.\n", + printf(" maximum error %lu us, estimated error %lu us", (u_long)ntv.maxerror, (u_long)ntv.esterror); - if (rawtime) printf(" ntptime=%x.%x unixtime=%x.%0*d %s", + if (rawtime) + printf(" ntptime=%x.%x unixtime=%x.%0*d %s", (unsigned int) ts.l_ui, (unsigned int) ts.l_uf, (int) ntv.time.tv_sec, fdigits, (int) time_frac, ctime((const time_t *) &ntv.time.tv_sec)); +#if NTP_API > 3 + printf(", TAI offset %d\n", ntv.tai); +#else + printf("\n"); +#endif /* NTP_API */ } status = ntp_adjtime(&ntx); if (status < 0) diff --git a/contrib/ntp/util/precision.c b/contrib/ntp/util/precision.c index 0fd3c3a..b1516b3 100644 --- a/contrib/ntp/util/precision.c +++ b/contrib/ntp/util/precision.c @@ -1,8 +1,7 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <stdio.h> #include "ntp_unixtime.h" +#include <stdio.h> + #define DEFAULT_SYS_PRECISION -99 int default_get_resolution(); diff --git a/contrib/ntp/util/tickadj.c b/contrib/ntp/util/tickadj.c index 5ac8121..4f524b1 100644 --- a/contrib/ntp/util/tickadj.c +++ b/contrib/ntp/util/tickadj.c @@ -13,15 +13,14 @@ # include <config.h> #endif +#include "ntp_types.h" +#include "l_stdlib.h" + #include <stdio.h> -#include <sys/types.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif /* HAVE_UNISTD_H */ -#include "ntp_types.h" -#include "l_stdlib.h" - #ifdef HAVE___ADJTIMEX /* Linux */ #include <sys/timex.h> @@ -178,7 +177,6 @@ main( #ifdef NLIST_STRUCT # include <nlist.h> #else /* not NLIST_STRUCT */ /* was defined(SYS_AUX3) || defined(SYS_AUX2) */ -# include <sys/time.h> # include <sys/resource.h> # include <sys/file.h> # include <a.out.h> diff --git a/contrib/ntp/util/timetrim.c b/contrib/ntp/util/timetrim.c index 4397b56..8f0a9ba 100644 --- a/contrib/ntp/util/timetrim.c +++ b/contrib/ntp/util/timetrim.c @@ -27,6 +27,7 @@ #include <stdio.h> #include <ctype.h> +#include <stdlib.h> #ifdef HAVE_SYS_SYSSGI_H # include <sys/syssgi.h> #endif @@ -43,11 +44,11 @@ main( ) { char *rem; - int c, incremental = 0, ntpunits = 0; + int incremental = 0, ntpunits = 0; long timetrim; - double value, strtod(); + double value; - while (--argc && **++argv == '-' && isalpha(argv[0][1])) { + while (--argc && **++argv == '-' && isalpha((int)argv[0][1])) { switch (argv[0][1]) { case 'i': incremental++; @@ -68,7 +69,7 @@ main( if (argc == 0) { if (ntpunits) - fprintf(stdout, "%0.5lf\n", SGITONTP(timetrim)); + fprintf(stdout, "%0.5f\n", SGITONTP(timetrim)); else fprintf(stdout, "%ld\n", timetrim); } else if (argc != 1) { @@ -91,5 +92,6 @@ main( exit(2); } } + return 0; } #endif |